...
The image below shows an example of the IGB Tools Menu with the addition of a a Hello IGB Toolbar World App item in the menu.
Info |
---|
By adding a menu item to an IGB menu, as seen above, a developer can create an entry point that their IGB App can hook into. |
...
- Open the Tools menu in IGB. Observe your Hello IGB ToolbarWorld App menu item is an option.
- Select Tools > > Hello IGB ToolbarWorld App to run your App; observe the message printed to the console:
...
Many Apps will include image files and other content. To include these, create a directory named "resources" at the same level as the pom.xml file, as seen in the image above. is this accurate???
pom.xml
...
Code Block |
---|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.affymetrix</groupId>
<artifactId>igb-project</artifactId>
<version>9.0.0</version>
</parent>
<groupId>org.lorainelab.igb</groupId>
<artifactId>org.lorainelab.igb.menu.api.example</artifactId>
<version>1.0.0</version>
<packaging>bundle</packaging>
<name>IGB Menubar Extension</name>
<dependencies>
<dependency>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bndlib</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.lorainelab.igb</groupId>
<artifactId>org.lorainelab.igb.menu.api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>build plugin repository</id>
<goals>
<goal>
index
</goal>
</goals>
<phase>package</phase>
<configuration>
<obrRepository>${project.build.directory}</obrRepository>
<mavenRepository>${project.build.directory}</mavenRepository>
</configuration>
</execution>
</executions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Import-Package>*</Import-Package>
<Export-Package/>
<Service-Component>*</Service-Component>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
|
...
parent tag
Code Block | ||
---|---|---|
| ||
<parent> <groupId>com.affymetrix</groupId> <artifactId>igb-project</artifactId> <version>8.6.0</version> </parent> |
Find IGB version in IGB project pom.xml:
packaging tag
This tag specifies packaging type - e.g., war or jar. In IGB, we use an OSGi-specific packaging structure called a "bundle," which is a jar file with additional metadata. This additional metadata transforms an ordinary jar file into a plug-able module in the OSGi runtime. The IGB project uses the Apache Felix Maven Bundle plugin (BND) to generate this metadata. The BND bundle defines the packaging type "bundle."
Replace "jar" with "bundle" in the packaging tag.
Code Block | ||
---|---|---|
| ||
<packaging>bundle</packaging> |
...
name tag
This should be a user-friendly name for your App suitable for display in the IGB App Manager list of available Apps. This tag is optional; if you don't include it, then the App Manager will list your App's artifactId.
Code Block | ||||
---|---|---|---|---|
| ||||
<name>Hello World</name> |
...
...
dependency tags (parent tag "dependencies")
The term "dependency" just means: third-party resources your project requires to compile and run, such as library files.
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<dependencies> <dependency>...</dependency> <dependency>...</dependency> </dependencies> |
Add the following dependency tags to your pom.xml:
biz.aQute.bnd:bndlib
This dependency enables the Declarative Services annotations used within the IGB code base that allow easy service consumption and registration with the IGB OSGi component runtime.
...
Code Block | ||
---|---|---|
| ||
<dependency> <groupId>biz.aQute.bnd</groupId> <artifactId>bndlib</artifactId> <scope>provided</scope> </dependency> |
...
org.slf4j:slf4j-api
The IGB logging system uses this API. To log error or status messages, using this. For more information see http://www.slf4j.org/manual.html.
...
Code Block | ||
---|---|---|
| ||
<dependency> <groupId>com.affymetrix</groupId> <artifactId>igbSwingExt</artifactId> <scope>provided</scope> </dependency> |
...
build, plugins, and plugin tag
maven-bundle-plugin
This is the most important plugin to be aware of as an IGB module developer. This plugin is known as the "Swiss army knife of OSGi" and is a wrapper around the BND project described in the previous section.
...