Skip to content
GigaSpaces Logo GigaSpaces Logo
  • Products
    • InsightEdge Portfolio
      • Smart Cache
      • Smart ODS
      • Smart Augmented Transactions
    • GigaSpaces Cloud
  • Roles
    • Architects
    • CXOs
    • Product Teams
  • Solutions
    • Industry Solutions
      • Financial Services
      • Insurance
      • Retail and eCommerce
      • Telecommunications
      • Transportations
    • Technical Solutions
      • Operational BI
      • Mainframe & AS/400 Modernization
      • In Memory Data Grid
      • Transactional and Analytical Processing (HTAP)
      • Hybrid Cloud Data Fabric
      • Multi-Tiered Storage
      • Kubernetes Deployment
      • Streaming Analytics for Stateful Apps
  • Customers
  • Company
    • About GigaSpaces
    • Customers
    • Partners
    • Support & Services
      • University
      • Services
      • Support
    • News
    • Contact Us
    • Careers
  • Resources
    • Webinars
    • Blog
    • Demos
    • Solution Briefs & Whitepapers
    • Case Studies
    • Benchmarks
    • ROI Calculators
    • Analyst Reports
    • eBooks
    • Technical Documentation
  • Contact Us
  • Try Free

ProjectCreator version .0000001 :0) [A hackers utility that creates openspaces projects in eclipse]

Subscribe to our blog!

Subscribe for Updates
Close
Back

ProjectCreator version .0000001 :0) [A hackers utility that creates openspaces projects in eclipse]

Owen August 18, 2007
9 minutes read

Early release of java command-line wizard generates OpenSpaces projects in seconds for rapid development of highly scalable Spring Applications using the GigaSpaces SBA platform. –It works for me 🙂

OK. Be gentle.

I am biting the bullet and publishing my current release of the wizard I have been working on that generates eclipse projects for OpenSpaces developers. Those who have seen me at various shows and JUGS will know what it does. It certainly saves me time as I get started on new projects, but then I know the code.. 😉
In an attempt to broaden the use of it, I have begun to document my work on it and some of the feedback and future plans I have for it.
Note: this utility will change and hopefully improve in the coming days/weeks etc. There are areas I already plan to improve -not least of all the code implementing it-.
Your feedback is welcome.

It is my sincere wish that somebody will benefit as they begin to explore the OpenSpaces concepts through rapidly generating their first few projects using this tool. Perhaps, more add-ons will be created by those interested in OpenSpaces — I particularly would love someone to create a front-end wizard for quick web pages backed by the Spring-based OpenSpaces. I think if we put our heads together we can give folks over at ruby on rails a run for their money.

(how’s that for inflammatory!)

The current state of this unofficial utility is somewhat summed up below:

projectcreator_thoughts

NameOfPersonWantingFeature: Feature description
As of 2007-08-17
Completed Features
OwenT: Polling(take)
OwenT: Polling(complex query)
OwenT: Publishing(TimerTask)
PatrickM: clean ant script better
OwenT: Supply a @projectName.launch file in the .eclipse folder in the project directory (this will save a configuration step)
TODO
PatrickM: NotifyContainer
OwenT: Remoting
OwenT: Domain model shared
PatrickM: Randy’s thing
PeterC: readme: how to import, run, deploy Why does this help?
PeterC: whyme?
KevinH: include change to pu.xml templates to point XSD’s to local path
OwenT: Unix scripts to do what the windows scripts do
DennisR: Implement configurable resource bundles to contain templates and corresponding map of
variable names. This will allow much more flexibility for future extensions.
DennisR: Create Unit Tests to ensure nothing gets broken as new features are added
Explanation of basic concepts behind the projectcreator:
Project Creator creates the directory structure, build files, java source files and configuration files necessary to build and deploy an OpenSpaces ProcessingUnit herein thought of as a ‘project’.
To create the proper java, xml, eclipse files and the directory structures necessary, Project Creator uses various templates (stored initially within the projectcreator.jar file) and some variables that are replaced with user-provided values as the project is created.
Within the templates, variables are specified as @variableName
These variables are currently:
@projectName (Name of the project you want to build)
@spaceName (Name of the space you want to connect to ex: MySpace)
@propertySpaceName (Name of the space with a lowercased first letter – derived from @spaceName ex: mySpace)
@varGSHome (Path to [and including] Root Directory of your XAP installation)
@spaceUrl (This is derived from the @spaceName and your choice of remote or embedded)
@packageName (You specify this as the package for your first service in this Project)
@packageDir (This is derived from the @packageName)
@serviceName (You specify this as the name of your service class)
@dataObjectName (You specify this as the name of your data class (note the package name will set to @packageName.common to ensure this class is packaged in a separate jar file for classloading purposes)

@spaceMutator (currently not used, but uses the upperCased first letter version of
@propertySpaceName to derive the setter method Ex: setMySpace)

First Cut: Instructions
The scripts pass args to the projectcreator that are then used to define some of the variables I wrote about as well as discern whether or not to build particularly eclipse-specific files into the project and other similar things.
The args used are:
-eclipse (specifies you want all the eclipse-specific artifacts)
-overwrite (specifies you wish to overwrite any project files in the same directory you are about to specify)
-project test (specifies the project directory name – you are later prompted to change this)
-out c:\wrk\openspaces (specifies the directory into which the -project will go)
-setServiceTemplateName service.javasrc (specifies the java service template file to use – found in the jar file unless otherwise specified)
-setPUTemplateName pu.xmlsrc (specifies the OpenSpaces PU.xml template file to use – found in the jar file unless otherwise specified)
-gigaHomeVar c:\GigaSpacesXAP6.0 (specifies the root directory of your GigaSpaces installation)
Running the java -jar project-creator.jar command with the various args starts an interactive shell wherein you provide the rest of the salient properties pertaining to project creation:
An example: (user feedback is in bold)
***
Welcome to the GigaSpaces Project Creator
To create a new project, please answer the following questions:
What would you like to name your project [test]?
Root directory for project creation [c:\wrk\openspaces]?
Is Space embedded in this PU? [yes]
Name of space [gigaspace]
Package name for ProcessingUnit [com.test]?
ClassName of Service [MyService]?
Name of Data Object []? Message
***
Completing this set of questions causes the project creator to create the files and directories that make it easy to develop and deploy a simple OpenSpaces ProcessingUnit.
For more info on Processing Units and OpenSpaces please look at hello world.
Getting Started: Using the scripts mentioned at the bottom of this post as a guide:
1. Create a polling container to create an embedded (colocated) worker service.

Take note of the Data type you create – this file will need to be copied into any other projects that also use it – note it will use a sub-package called ‘common’ to ensure it can be shared accross processing units (workaround to a well known classloading issue)

Also take note of the spacename you chose – other projects that want to communicate with this one will need to specify the same spacename

2. Create a TaskTimer to create a remote driver or publisher of information.

see the notes above regarding the shared data and spacename

Take note that you specify a remote space with the same name as the other projects with which you want to share info

Once a project is built:
1) import it into Eclipse Europa with the Spring plugin.
2) Configure the build Path so the GS_HOME variable is accurate for your system
3) Edit the generated build.xml file for the project so the gshome.dir property is accurate for your system
4) Add in some simple code to the Service you created System.out.println(“Hi Mom”);—or uncomment the code snippets I provided
5) Right-click on the project, select ‘Run As’ then ‘Open Run Dialog’ if it already has a @projectName.launch file simply select the @projectName under ‘Java Aplication’ and execute ‘Run’ (bottom right-hand of the ‘Run’ window.
Otherwise you need to configure the following:

A) Right-click the ‘Java Application’ branch of the tree in the left-hand pane of the ‘Run’ window.
B) Select ‘New’
C) change the name of the ‘Name’ from ‘New_configuration’ to something project-specific
D) Select the ‘Main class’ textbox and paste in:
org.openspaces.pu.container.integrated.IntegratedProcessingUnitContainer
E) ‘Browse’ to the project for which you are creating this configuration (middle button)
F) ensure that the correct ‘Project’ has been selected and that the above main class is still visible then click ‘Apply’
G) click ‘Run’ to run your project inside the eclipse IDE

Note: You must run the projects with the embedded spaces first! the remote space projects are injected with the space proxy only at startup time and never again!

…

…

Current windows scripts Owen uses:

1) runprojectcreatorPolling_GSHOME.cmd
rem This script starts the projectCreator so as to create a PU containing a PollingContainer – 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 worker and usually means you will elect to have an 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:\wrk\openspaces -setServiceTemplateName service.javasrc -setPUTemplateName pu.xmlsrc -gigaHomeVar c:\GigaSpacesXAP6.0
2) runprojectcreatorTaskTimer_GSHOME.cmd
rem This script starts the projectCreator so as to create a PU containing a TimerTask – a SpringBean that gets invoked over and over again by a Timer. Configure how often to do this in the PU.xml Note this is good for a feed or driver and usually means you will elect to have a remote 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:\wrk\openspaces -setServiceTemplateName service.javasrc_timerTask -setPUTemplateName pu.xmlsrc_timerTask -gigaHomeVar c:\GigaSpacesXAP6.0
3) runprojectcreatorComplexPolling_GSHOME.cmd
rem This script starts the projectCreator so as to create a PU containing a PollingContainer – 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 worker and usually means you will elect to have an embedded space.
rem In addition: This script uses the templates that provide the framework for complex queries using SQL and REGEX syntax
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:\wrk\openspaces -setServiceTemplateName service.javasrc_pollingComplexQuery -setPUTemplateName pu.xmlsrc_pollingComplexQuery -gigaHomeVar c:\GigaSpacesXAP6.0

Cheers,
Owen.

CATEGORIES

  • Development
  • GigaSpaces
  • Java
  • JavaSpaces
  • OpenSpaces
Owen

All Posts (36)

YOU MAY ALSO LIKE

October 24, 2008

Feedback on the GigaSpaces-EC2 Framework
3 minutes read

December 27, 2006

GigaSpaces 5.2 is out
1 minutes read

October 31, 2007

GigaSpaces will present at QCon…
1 minutes read
  • Copied to clipboard

PRODUCTS, SOLUTIONS & ROLES

  • Products
  • InsightEdge Portfolio
    • Smart Cache
    • Smart ODS
    • Smart Augmented Transactions
    • Compare InsightEdge Products
  • GigaSpaces Cloud
  • Roles
  • Architects
  • CXOs
  • Product Teams
  • Solutions
  • Industry
    • Financial Services
    • Insurance
    • Retail and eCommerce
    • Telecommunications
    • Transportation
  • Technical
    • Operational BI
    • Mainframe & AS/400 Modernization
    • In Memory Data Grid
    • HTAP
    • Hybrid Cloud Data Fabric
    • Multi-Tiered Storage
    • Kubernetes Deployment
    • Streaming Analytics for Stateful Apps

RESOURCES

  • Resource Hub
  • Webinars
  • Blogs
  • Demos
  • Solution Briefs & Whitepapers
  • Case Studies
  • Benchmarks
  • ROI Calculators
  • Analyst Reports
  • eBooks
  • Technical Documentation
  • Featured Case Studies
  • Mainframe Offload with Groupe PSA
  • Digital Transformation with Avanza Bank
  • High Peak Handling with PriceRunner
  • Optimizing Business Communications with Avaya

COMPANY

  • About
  • Customers
  • Management
  • Board Members
  • Investors
  • News
  • Events
  • Careers
  • Contact Us
  • Book A Demo
  • Try GigaSpaces For Free
  • Partners
  • OEM Partners
  • System Integrators
  • Value Added Resellers
  • Technology Partners
  • Support & Services
  • University
  • Services
  • Support
Copyright © GigaSpaces 2021 All rights reserved | Privacy Policy
LinkedInTwitterFacebookYouTube

Contact Us