How to Add an OSGi Bundle to an Oracle CEP Project How to Add a Property File to an Oracle CEP Project

Oracle CEP IDE for Eclipse Projects 4-37 Figure 4–39 Oracle CEP IDE for Eclipse properties Directory

4. Expand the META-INF directory and right-click the MANIFEST.MF file and select

Open With Plug-in Manifest Editor . The Manifest Editor opens as Figure 4–40 shows. Figure 4–40 Manifest Editor: Build Tab

5. Click the Build tab.

6. Add your property file to the binary build under the project root as follows:

■ In the Binary Build area, expand the properties directory. ■ Check the box next to your property file as Figure 4–40 shows. 4-38 Oracle Complex Event Processing Developers Guide ■ Press hit CTRL-SHIFT-S to save all files. This edits the build.properties file in your project, and tells the Oracle CEP IDE for Eclipse to add the property file to your bundle when you build the bundle JAR. 7. You can access the properties file in Java code as Example 4–1 shows: Example 4–1 Accessing a Properties File public void onInsertEventObject event { if event instanceof HelloWorldEvent { HelloWorldEvent helloWorldEvent = HelloWorldEvent event; InputStream resourceAsStream = getClass.getClassLoader.getResourceAsStream propertiestest.properties ; Properties props = new Properties; try { props.loadresourceAsStream; } catch IOException e { e.printStackTrace; } System.out.printlnMessage: + props.gettest-key; } }

4.7.4 How to Export a Package

Optionally, if your bundle needs to export a package from a JAR to other bundles that will depend on this bundle, then you can export this package. By doing so, you update the Package-Export MANIFEST entry to create an OSGi exporter for the package. To export a package: 1. Inside the Oracle CEP IDE for Eclipse, expand the META-INF directory as Figure 4–41 shows. Figure 4–41 Oracle CEP IDE for Eclipse lib Directory

2. Right-click the MANIFEST.MF file and select Open With Plug-in Manifest

Editor . The Manifest Editor opens as Figure 4–42 shows. Oracle CEP IDE for Eclipse Projects 4-39 Figure 4–42 Manifest Editor: Runtime tab

3. Click the Runtime tab.

The Runtime tab appears as Figure 4–42 shows.

4. In the Exported Packages area, click the Add button.

The Package Selection dialog appears as Figure 4–43 shows. Figure 4–43 Package Selection Dialog 5. Select the package you want to export. 4-40 Oracle Complex Event Processing Developers Guide To find a package in the list by name, type the name into the text field. In this example, select the javax.jws.soap package.

6. Click OK.

The selected package is added to the Exported Packages area as Figure 4–44 shows. Figure 4–44 Manifest Editor Runtime tab After Exporting a Package 7. Press CTRL-SHIFT-S to save all files.

4.7.5 How to Import a Package

Optionally, if your bundle needs to import a package from a JAR, then you can import this package. By doing so, you update the Package-Import MANIFEST entry to create an OSGi importer for the package. To import a package: 1. Inside the Oracle CEP IDE for Eclipse, expand the META-INF directory as Figure 4–45 shows.