Presentation is loading. Please wait.

Presentation is loading. Please wait.

Development of the EDEX plug-in Ingest overview Manual Endpoint LDM DistributionSrv Plugin decoder Plugin Data Object PersistIndexSrv NotificationSrv.

Similar presentations


Presentation on theme: "Development of the EDEX plug-in Ingest overview Manual Endpoint LDM DistributionSrv Plugin decoder Plugin Data Object PersistIndexSrv NotificationSrv."— Presentation transcript:

1

2 Development of the EDEX plug-in

3 Ingest overview Manual Endpoint LDM DistributionSrv Plugin decoder Plugin Data Object PersistIndexSrv NotificationSrv Post gres HDF5

4 Plug-in naming conventions Use reverse – E.g. gov.nasa.msfc.sport….. Data Plug-in – gov.nasa.msfc.sport.dataplugin.pluginname EDEX Plug-in – gov.nasa.msfc.sport.edex.pluginname CAVE Plug-in – gov.nasa.msfc.sport.viz.pluginname

5 Creating new project File Menu, New, Project – Select Plug-in Project, Next – Project Name: gov.nasa.msfc.epdt.edex.plugin.aqi Next – Provider Name: EPDT – Uncheck generate Activator – Unchecked This plug-in will make contributions to the UI – No is checked for creating a rich client application. – Finished

6 Adding to uframe Open file com.raytheon.edex.uframe feature.xml

7 Adding to includegen This step is only required if your plug-in does not contain noaa.nws or raytheon Edit build.edex, edex, common.properties – Add to includegen.filter – Includegen.filter=raytheon|noaa\.nws|nasa\.msfc

8 Note If you place your plug-ins into a separate directory you will also need to add it to build.edex, edex, common.properties – Add entry to extend the dir.01 – So if you organize your plug-ins into a epdt directory – Create entry dir.08=epdt

9 Adding base dependencies Edit META-INF/MANIFEST.MF Add following plug-in dependencies gov.nasa.msfc.epdt.dataplugin.aqi, com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", com.raytheon.uf.common.geospatial;bundle-version="1.12.1174", org.dom4j;bundle-version="1.0.0" gov.nasa.msfc.epdt.dataplugin.aqi, com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", com.raytheon.uf.common.geospatial;bundle-version="1.12.1174", org.dom4j;bundle-version="1.0.0"

10 Creating package for decoder Right click on project, New, Package Name: gov.nasa.msfc.epdt.edex.plugin.aqi Finish

11 Creating decoder Right click on newly created package, New, Class – Name: AQIDecoder – Finish – Now you should have a new class in the correct package, but should be empty.

12 Add Placeholder decode method Create decode method public class AQIDecoder { public PluginDataObject[] decode(String input) throws Exception { return null; } public class AQIDecoder { public PluginDataObject[] decode(String input) throws Exception { return null; } Resolve PluginDataObject to com.raytheon.uf.common.dataplugin.PluginDataObject

13 Discuss various methods that could decode method could be public PluginDataObject[] decode(String input) throws Exception { } public PluginDataObject[] decode(byte[] data) throws Exception { } public PluginDataObject[] decode(byte[] data, Headers header) throws Exception { String filename = (String)headers.get(“camelfilenameonly”); } public PluginDataObject[] decode(String input) throws Exception { } public PluginDataObject[] decode(byte[] data) throws Exception { } public PluginDataObject[] decode(byte[] data, Headers header) throws Exception { String filename = (String)headers.get(“camelfilenameonly”); } Camel will know what you want and will provide data in that type

14 Now that we have decoder? Want to wire decoder to get data This is performed using Spring configuration files This will wire our new decoder to the architecture. Later we will tell EDEX to route products to our decoder. Manual Endpoint LDM Distribution Srv Plugin decoder

15 Introduction to Spring What is Spring? – Way to create instances of java objects using xml code. – Then you can wire them together using more spring configuration code. – Allows for very flexible configuration that can be reconfigured easily. – www.springsource.com www.springsource.com – Let’s look at some basic examples unrelated to AWIPS II.

16 Creating a Bean //Create new String using null constructor String myString = new String(); //Create new String using null constructor String myString = new String(); Now the Spring Context will have a bean named myString Above is the way to create an object in Java, and below is the way using Spring

17 Constructor args in spring package gov.nasa.msfc.sport.epdt.test; public class MyClass { String name; public MyClass(String name) { this.name = name; } package gov.nasa.msfc.sport.epdt.test; public class MyClass { String name; public MyClass(String name) { this.name = name; } Now the Spring Context will have a bean named thisOne, of the type MyClass. thisOne will have the name variable set to EPDT

18 Basic wiring package gov.nasa.msfc.sport.epdt.test; public class MyClass { String name; public MyClass(String name) { this.name = name; } package gov.nasa.msfc.sport.epdt.test; public class MyClass { String name; public MyClass(String name) { this.name = name; } Now the Spring Context will have a bean named thisOne, of the type MyClass. thisOne will have the name variable set to EPDT, but we could reuse myString in other beans

19 Wiring references to beans package gov.nasa.msfc.sport.epdt.test; public class MyClass { } package gov.nasa.msfc.sport.epdt.test; public class MyClass { } Now the Spring Context will have two beans named thisOne and theOther, And thisOne gets injected into theOther. package gov.nasa.msfc.sport.epdt.other; public class MyOtherClass { MyClass myclass; public MyOtherClass(MyClass myclass) { this.myclass = myclass; } package gov.nasa.msfc.sport.epdt.other; public class MyOtherClass { MyClass myclass; public MyOtherClass(MyClass myclass) { this.myclass = myclass; }

20 Properties and getters and setters package gov.nasa.msfc.sport.epdt.test; public class MyClass { String name; public setName(String name) { this.name = name; } package gov.nasa.msfc.sport.epdt.test; public class MyClass { String name; public setName(String name) { this.name = name; } Now the Spring Context will have a bean named thisOne, of the type MyClass. thisOne will have the name variable set to EPDT. It used the setter method called setName.

21 One last type of Spring Wiring used public class PluginRegistry extends GenericRegistry { private static PluginRegistry instance = new PluginRegistry(); … public static PluginRegistry getInstance() { return instance; } @Override public Object register(String pluginName, PluginProperties pluginProperties) throws RegistryException { public class PluginRegistry extends GenericRegistry { private static PluginRegistry instance = new PluginRegistry(); … public static PluginRegistry getInstance() { return instance; } @Override public Object register(String pluginName, PluginProperties pluginProperties) throws RegistryException { This pattern is used for registration purposes within the EDEX framework.

22 Creating directories to hold spring Right click on the project, New, Folder – Name: res Right click on newly created folder called res, new, folder – Name: spring

23 Make sure this gets bundled with jar Double Click on build.properties – Add Check next to res directory – Save file Now anything in the res directory will get bundled with the jar that is created.

24 pluginname-common.xml Right click on spring folder and select New, Other, XML, XML file – File Name: pluginname-common.xml, where pluginname is the name of your plug-in. – Finish This Spring configuration file will create some beans that are used in other spring configuration files. Within this file you will also register your plug-in with the plug-in registry service. Plugin Registry Service is used by other parts of EDEX to find out information about your plugin.

25 epdtaqi-common.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> Define plug-in name into bean for later use in Spring Context

26 epdtaqi-common.xml cont’d Define Plug-in properties and then register your plug-in to the Plug-in Registry

27 pluginname-ingest.xml Right click on spring folder and select New, Other, XML, XML File file called pluginname-ingest.xml, where pluginname is the name of your plug-in. Finish This Spring configuration file will create some beans for your decoder and Data Access Object (DAO). It will also create threads to do work, and register your plug-in within camel to receive products from distribution service.

28 epdtaqi-ingest.xml Define register thread pattern to do work.

29 epdtaqi-ingest.xml Create instance of Decoder, and register with distribution service to get data.

30 epdtaqi-ingest.xml <camelContext id="epdtaqi-camel“ xmlns=http://camel.apache.org/schema/spring errorHandlerRef="errorHandler“ ? epdtaqi java.lang.Throwable <camelContext id="epdtaqi-camel“ xmlns=http://camel.apache.org/schema/spring errorHandlerRef="errorHandler“ ? epdtaqi java.lang.Throwable Define pipeline to process data.

31 epdtaqi-ingest.xml Registers Camel context for our pipeline to the Context manager. Starting our camel context, thus enabling our pipeline.

32 Creating the utility tree for purging Right click on project, New, Folder Name: utility Right click on utility folder you just created, new folder common_static. Right click on the common_static and create new folder called base. Right click on the base and create new folder called purge. Right click on purge directory, New,Other, XML, XML File – Name: pluginnamePurgeRules.xml, where plugin name is your plugin name. – Finish This file will hold your custom purge rules for your data you ingest with this plugin.

33 Purge rules 10 10 Only keep 10 versions default

34 Other purge types network 24 02-00:00:00 NALMA 90 network 24 02-00:00:00 NALMA 90

35 Looking around the ADE for purge rules

36 Creating the utility tree for distribution file. Right click on utility folder, New, Folder – Name: edex_static. Right click on the edex_static and create new folder called base. Right click on the base and create new folder called distribution. Right click on distribution directory, New, Other, XML, XML File – Name: pluginname.xml, where plugin name is your plugin name. This file will hold rules that tell Distribution Service to route incoming products to your plugin.

37 Distribution file airnow* airnow* airnow* aqi* airnow* aqi* These distribution rules are applied to the headers of the files, and to the filenames. So it can match either. And data can be routed to multiple plug-ins. These files can be edited while EDEX is running. They will be re-read on the fly by EDEX.

38 Deploying the plug-in Expand out build.edex – Right click on deploy-install.xml Select Run As.., 2 Ant Build Watch console and make sure your two plug- ins got deployed. Might have to change preferences in console to allow more output.

39 Where do these files go for deploy Plugins get deployed to – /awips2/edex/lib/plugins Items in the utility directory go to – /awips2/edex/data/utility

40 Logging in your plug-in Using IUFStatusHandler public class AQIDecoder { private static IUFStatusHandler handler = UFStatus.getHandler(AQIDecoder.class); public PluginDataObject[] decode(String input) throws Exception { handler.info(“Starting decoding EPDT AQI”); return null; } public class AQIDecoder { private static IUFStatusHandler handler = UFStatus.getHandler(AQIDecoder.class); public PluginDataObject[] decode(String input) throws Exception { handler.info(“Starting decoding EPDT AQI”); return null; } Need to add dependency for com.raytheon.uf.common.status Resolve com.raytheon.uf.common.status.IUFStatusHandler, andResolve com.raytheon.uf.common.status.UFStatus handler.debug(“This is a debug message”);

41 Deploy again Expand out build.edex – Right click on deploy-install.xml Select Run As.., 2 Ant Build Now if you ingest a file it should print – “Starting decoding EPDT AQI” – In the ingest logfile.

42 Running EDEX If qpidd, edex_postgres, and http-pypies are running. Then you can start EDEX as user awips using: – cd /awips2/edex/bin – Normal./start.sh ingest – Debugging./start.sh ingest -d – This will only start the ingest. Watch for message stating that EDEX is Operational. – Then you can ingest your file.

43 Ingesting a file Copy your data file into – /awips2/edex/data/manual Watch the log file for EDEX ingest – tail –f /awips2/edex/logs/edex-ingest-YYYYMMDD.log – At this point it will print out to the ingest logfile the statement, and since we are returning a null it will also print errors.

44 Questions


Download ppt "Development of the EDEX plug-in Ingest overview Manual Endpoint LDM DistributionSrv Plugin decoder Plugin Data Object PersistIndexSrv NotificationSrv."

Similar presentations


Ads by Google