Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. to create a plugin, you will create (at least) two files, the MANIFEST.MF file and the Activator
  2. we sill will create a bundle that adds a new graph function
  3. create the following MANIFEST.MF file:
Panel

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: MyBundle
Bundle-SymbolicName: MyBundle
Bundle-Version: 1.0.0
Bundle-Activator: mypackage.MyActivator
Import-Package: com.affymetrix.genometryImpl.util,
 org.osgi.framework

    • (note - there are spaces at the beginning of the extension lines, and a blank line at the end)
  1. Now, create the Activator, mypackage.MyActivator.java
Code Block
titlemypackage.MyActivator.java
borderStylesolid
package mypackage;
import java.util.Properties;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import com.affymetrix.genometryImpl.util.FloatTransformer;

public class MyActivator implements BundleActivator {
    private BundleContext bundleContext;
    private ServiceRegistration serviceRegistration;
    protected BundleContext getContext() {
        return bundleContext;
    }
    public void start(BundleContext _bundleContext) throws Exception {
        bundleContext = _bundleContext;
        serviceRegistration = bundleContext.registerService(FloatTransformer.class.getName(), new InverseTransformer(), new Properties());
    }
    public void stop(BundleContext _bundleContext) throws Exception {
        if (serviceRegistration != null) {
            serviceRegistration.unregister();
        }
        bundleContext = null;
    }
}
  1. And create the Transformer, mypackage.MyTransformer.java
Code Block
titlemypackage.MyTransformer.java
borderStylesolid
package mypackage;
import com.affymetrix.genometryImpl.util.FloatTransformer;
public class MyTransformer implements FloatTransformer {
    final String paramPrompt;
    final String name;
    public MyTransformer() {
        super();
        paramPrompt = null;
        name = "MyTransformer";
    }
    public String getParamPrompt() { return null; }
    public String getName() {
        return name;
    }
    public String getDisplay() {
        return name;
    }
    public float transform(float x) {
        return x; // boring, put your own math function here, return 1.0/x; or return 3*x*x*x - 2*x*x +8*x - 6;
    }
    public float inverseTransform(float x) {
        return 0.0f;
    }
    public boolean isInvertible() { return false; }
    public boolean setParameter(String s) {
        return true;
    }
}

...