Hi Again,
The changes are:
1) Added a NotifyContainer template — to use this execute the following script:
rem This script starts the projectCreator so as to create a PU containing a NotifyContainer – a SpringBean with a default method that gets invoked when a matching object appears or is modified in the space. Note this is good for a listener (a take is not performed as part of the NotifyContainer operation) and could be implemented with either a remote or embedded space.
rem In addition: This script specifies that the classpath in the eclipse project uses a GS_HOME variable in the same way the examples that come with the product do – this makes for a more portable project. Note that the build.xml file created as part of the project will still use an explicit path and will need to be edited if the project is used in a new environment and the ant tasks are invoked.
set JAVA_HOME=c:\java\jdk1.5.0_07
call %JAVA_HOME%\bin\java -jar project-creator.jar -eclipse -overwrite -project test -out C:\tmp\projectcreator -setServiceTemplateName service.javasrc -setPUTemplateName pu.xmlsrc_notifyContainer -gigaHomeVar c:\GigaSpacesXAP6.0
Notice that other than the change to the -setPUTemplateName, this script is identical to the one used for the pollingcontainer.
2) Fixed two bugs:
a) Extra HelloWorld directory is no longer created inside the processing unit directory
b) The FIXME properties offered in the templates for the pollingcontainer and notifycontainer are now inside comments in the XML so they will not break your build if you simply ignore them.
Added these simple print statements to the java templates so you can see activity as soon as you build and deploy it:
TimerTask:
System.out.println(this.getClass().getName()+” Wrote @dataObjectName “+obj);
(note: you need to uncomment the sample code block in the execute method to enable this behavior)
PollingService:
System.out.println(this.getClass().getName()+” Received @dataObjectName: “+data);
Practical Instructions for use:
- Run the command(s) to generate a publisher, poller, or listener processing unit project supplying args as you see fit. (see example commands in this and earlier posts)
- Import the project(s) into eclipse
- Uncomment the code in your publisher execute method to see the default behavior
- Run the project that declares an embedded space by right-clicking it in eclipse and selecting ‘Run As’ | ‘Open Run Dialog…’ Then select the configuration with the same name as the project you right-clicked and click ‘Run’
- Run any other projects that share that space – you may want to wait to start the publisher until after all listeners and pollers are started.
- Watch as the default print Statements prove the various pieces are communicating.
- Edit the java files so they perform some real logic and process real information. be sure to keep your common libraries in sync — I will provide a simpler way to manage as part of this utility in the future.
Cheers,
Owen.