Archive for the 'Development' Category
Integrating GigaSpaces persistency service into an existing tier based system
April 23rd, 2008A common issue I’m facing recently is how to integrate existing tier based applications with GigaSpaces persistency service, AKA persistency as a service (Paas) or mirror . The motivation is often a result of the acknowledgment that a standard tier based application fails to scale when facing the database throughput limitation.
Software Caching technologies (overlooking their [...]
Sharing Results of Expensive Computations
March 25th, 2008A customer recently contacted us to discuss how to use GigaSpaces XAP to minimize the number of times an expensive computation must run. The particular domain is option price stress testing, but the problem is more general and the solution demonstrates a couple of interesting GigaSpaces XAP features.
Consider a service that executes an expensive [...]
New GigaSpaces/OpenSpaces.org Forums
December 17th, 2007As part of our ongoing effort to build and serve the fast-growing community around GigaSpaces and OpenSpaces.Org , we've re-launched our discussion forums , using Jive Forums. We have migrated all of the posts from the old forums and simplified the forum structure. So please, check them out .
The new forums are the [...]
Opinionated architecture - blue prints without the middleman
December 16th, 2007While at the Spring Experience this past week, I was delighted to learn a few things.
I got a good look at an OSGI environment, discovered what it felt like to turn rapidly in a circle on a cigarette boat doing well over 40 knots, and was introduced to the term “Opinionated Architecture”.
To my new understanding, an opinionated architecture, or framework, or solution, is one that proclaims a mandatory set of conventions in various things such as directory structure, configuration and code artifacts, naming conventions, and patterns of use. Due to the specification of these and possibly other things, the adopter of the solution will benefit from the use of the naturally occurring wizards and reusable templates that exemplify the mandatory bits and pieces. More than the traditional “blue-prints” offered by some, the essence of the available and proper use of the
opinionated solution depends on the erasure of alternative paths lest disaster strike.
This is not a trivial course to take. The author of the solution must have effective and real knowledge of the problem domain addressed by the solution - hopefully informed by enough failures that the successful path as declared is completely valid to the limits of the conceit of the solution.
For instance, web frameworks such as Grails provide rapid application development to those who agree to adopt the programming paradigm made possible and pushed by the elected framework. The result is a religious fervor adopted as those who share the faith and bend to the will of the higher, more-knowing, technological power are validated by their successes and spurred to greater adoption and recognition of the awesome power of the solutions’ prescription.
Caution: some wordiness follows:
The topic of the effect of poor planning and proceeding with lack of effective guidance down the enterprise architectural path was touched on in a BOF on high-performance Spring apps that took place late Friday night. (After the keynote filled with Monty Python references) During this talk, it was made clear that only experience can fulfill the needs of the architect challenged by a huge problem. What was also revealed is that humans frequently fail to avoid making the same mistakes numerous times even when presented with compelling alternatives. Old habits die hard it seems.
I am (tonight) of the opinion that unless your solution infrastructure mandates a path of best results and guides you to a proven successful state, you are more than likely to wander into the woods of competing best practices overgrown with budget constraints, lack of innovative and experienced resources, and just plain lack of understanding. It is therefore better to adopt a winning solution set whole-heartedly and when all the Kool-Aid is gone, agree to be dictated to by a benevolent dictator who has the right stuff.
The experience of a journeyman or artist is really very similar. In classical Ballet, for instance, the student rarely questions the validity of the techniques demonstrated by the Maestro leading the class/company. There is an element of necessary blind faith in the chosen path and the guides you choose to follow down it. Once one determines that the task at hand is indeed Ballet, one really has no choice but to turn out hips, point feet, and develop habits of posture that will sustain them through the most grueling choreography - for it will surely come and in spades. The student/apprentice is not well served to strike out on their own until a mastery is attained of the subject matter *through experience* that validates new choices and proves that through their adoption, greater success is to be found. The opinion therefore exhibited must be one based on hard-earned experience and still based predominately on a foundation made real and sustainable by the experiences of many others.
As it happens, I have watched the growth of OpenSpaces over the last many months with the skeptical eye of a - er skeptic - not realizing that the purpose of the framework is not only buzzword compliance and the implementation of popular development practices, but in the context of GigaSpaces and what is offered to our prospects and customers, a truly opinionated framework that takes the vastly flexible GigaSpaces infrastructure and service implementations and distills *the* successful use of it all into enforceable use of the Spring programmatic approach and technologies, thus empowering the neophyte and thought-leader alike with the unmistakably opinionated path to success.
The beauty of the switch to the prescriptive and formulaic from the free and often flailing style, is the stunningly rapid improvement in adoption rate, early prototyping successes, and sustained production-systems that continue to reinforce my growing certainty that we got our bit of it right this time.
Yes, OpenSpaces and by our support of it, GigaSpaces, has become an opinionated architecture/solution. As more and more tools and samples become available, and more wizards like my somewhat primitive, yet highly effective Project-creator, are built and offered, that fact will be obvious to all and joyfully so to the initiates and practitioners of the Linearly Scaling Aplication Arts. (The LSAA)
Write Once, [our way]
Scale Anywhere
Cheers,
Owen.
Agile Development at GigaSpaces
December 6th, 2007Guy Nirpaz, GigaSpaces ' Executive VP of R&D, writes in his blog about GigaSpaces agile development methodologies using Scrum.
Guy writes about best practices, what works and doesn't work and more. Read the full post .
Alternate Script to create projects using ProjectCreator and update to jar
September 5th, 2007Hi,
I have made a small adjustment to one of the template files in the project-creator.jar. This means that *all* eclipse projects will be generated with a classpath that includes the variable GS_HOME . This variable will point to whatever you (the owner of the running eclipse instance) determines it should point to.
BTW: It needs to point to the home directory for your installation of GigaSpacesXAP6.0
To accomplish this:
1) create the project using projectcreator
2) import the project into eclipse version 3.3 (europa)
3) right-click on the project and select
Build Path | Configure Build Path…
4) select
Add Variable | Configure Variables…
5) select
New…
6) enter the following in the two fields
Name: GS_HOME
Path: [browse_to_the_home_directory_of_your_installation_of_GigaSpacesXAP6.0]
(
On my system, in eclipse I have configured GS_HOME to point to
c:\GigaSpacesXAP6.0
)
7) click OK
do a rebuild
9) ignore the warning that the path is not a jar file (we know that already)
10) Find your way back to the project and look: the red x is gone!
The Variable GS_HOME should now be resolved and reusable for future projects in eclipse.
In addition, I noticed mucho redundancy in the scripts I offered in my previous posts.
The eclipse and intellij versions are now identical except for the value provided for the IDE variable.
The following scripts are hopefully clearer alternates you can use to create the various projects:
____________________________
file: createPublisher.cmd
____________________________
rem #### if you are using intellij: before calling this script, configure the following:
rem #### set IDE=-intellij
rem ####
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: if the IDE is set to -eclipse:
rem ProjectCreator determines that the classpath in the eclipse project uses an eclipse-specific 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.
rem Personal Settings (these change according to each machine environment)
set JAR_FILE_LOCATION=./project-creator.jar
set OUTPUT_DIRECTORY=C:\tmp\projectcreator
set JAVA_HOME=c:\java\jdk1.5.0_07
if “%JSHOMEDIR%.” == “.” set JSHOMEDIR=c:\GigaSpacesXAP6.0
rem Script-specific Configuration Settings:
set PROJECT_NAME=Publisher
if “%IDE%.” == “.” set IDE=-eclipse
set SERVICE_TEMPLATE_NAME=service.javasrc_timerTask
set PU_TEMPLATE_NAME=pu.xmlsrc_timerTask
rem General Options
rem elect to overwrite existing projects with same name:
set OVERWRITE_OPTION=-overwrite
call %JAVA_HOME%\bin\java -jar %JAR_FILE_LOCATION% %IDE% %OVERWRITE_OPTION% -project %PROJECT_NAME% -out %OUTPUT_DIRECTORY% -setServiceTemplateName %SERVICE_TEMPLATE_NAME% -setPUTemplateName %PU_TEMPLATE_NAME% -gigaHome %JSHOMEDIR%
____________________________
____________________________
file: createNotifyListener.cmd
____________________________
rem #### if you are using intellij: before calling this script, configure the following:
rem #### set IDE=-intellij
rem ####
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: if the IDE is set to -eclipse:
rem ProjectCreator determines that the classpath in the eclipse project uses an eclipse-specific 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.
rem Personal Settings (these change according to each machine environment)
set JAR_FILE_LOCATION=./project-creator.jar
set OUTPUT_DIRECTORY=C:\tmp\projectcreator
set JAVA_HOME=c:\java\jdk1.5.0_07
if “%JSHOMEDIR%.” == “.” set JSHOMEDIR=c:\GigaSpacesXAP6.0
rem Script-specific Configuration Settings:
set PROJECT_NAME=NotifyListener
if “%IDE%.” == “.” set IDE=-eclipse
set SERVICE_TEMPLATE_NAME=service.javasrc
set PU_TEMPLATE_NAME=pu.xmlsrc_notifyContainer
rem General Options
rem elect to overwrite existing projects with same name:
set OVERWRITE_OPTION=-overwrite
call %JAVA_HOME%\bin\java -jar %JAR_FILE_LOCATION% %IDE% %OVERWRITE_OPTION% -project %PROJECT_NAME% -out %OUTPUT_DIRECTORY% -setServiceTemplateName %SERVICE_TEMPLATE_NAME% -setPUTemplateName %PU_TEMPLATE_NAME% -gigaHome %JSHOMEDIR%
_______________________________
file: createPollingWorker.cmd
____________________________
rem #### if you are using intellij: before calling this script, configure the following:
rem #### set IDE=-intellij
rem ####
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. NB: The PollingContainer removes (takes) the interesting information from the Space!
rem Note this is good for a worker and usually means you will elect to have an embedded space.
rem In addition: if the IDE is set to -eclipse:
rem ProjectCreator determines that the classpath in the eclipse project uses an eclipse-specific 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.
rem Personal Settings (these change according to each machine environment)
set JAR_FILE_LOCATION=./project-creator.jar
set OUTPUT_DIRECTORY=C:\tmp\projectcreator
set JAVA_HOME=c:\java\jdk1.5.0_07
if “%JSHOMEDIR%.” == “.” set JSHOMEDIR=c:\GigaSpacesXAP6.0
rem Script-specific Configuration Settings:
set PROJECT_NAME=PollingWorker
if “%IDE%.” == “.” set IDE=-eclipse
set SERVICE_TEMPLATE_NAME=service.javasrc
set PU_TEMPLATE_NAME=pu.xmlsrc
rem General Options
rem elect to overwrite existing projects with same name:
set OVERWRITE_OPTION=-overwrite
call %JAVA_HOME%\bin\java -jar %JAR_FILE_LOCATION% %IDE% %OVERWRITE_OPTION% -project %PROJECT_NAME% -out %OUTPUT_DIRECTORY% -setServiceTemplateName %SERVICE_TEMPLATE_NAME% -setPUTemplateName %PU_TEMPLATE_NAME% -gigaHome %JSHOMEDIR%
________________________________
Cheers,
Owen.
ProjectCreator version .0000001 :0) [A hackers utility that creates openspaces projects in eclipse]
August 18th, 2007Early 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!)
Here is the first binary release of it - let me know if you want/need the code.
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 [
***
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.







