Skip to content
GigaSpaces Logo GigaSpaces Logo
  • Products, Solutions & Roles
    • Products
      • InsightEdge Portfolio
        • Smart Cache
        • Smart ODS
        • Smart Augmented Transactions
        • Compare InsightEdge Products
      • GigaSpaces Cloud
    • Solutions
      • Industry
        • Financial Services
        • Insurance
        • Retail and eCommerce
        • Telecommunications
        • Transportations
      • Technical
        • 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
    • Roles
      • Architects
      • CXOs
      • Product Team
    • Building a Successful Hybrid and Multicloud Strategy
      vid-icon Guide

      Learn how to build and deploy a successful hybrid and multicloud strategy to achieve: agility and scalability, faster go-to-market, application acceleration, legacy modernization, and more.

      DOWNLOAD
    • Contact us
    • Try Free
  • Resources
    • Resource Hub
      • Webinars
      • Demos
      • Solution Briefs & Whitepapers
      • Case Studies
      • Benchmarks
      • Cost Reduction Calculators
      • Analyst Reports
      • eBooks
    • col2
      • Featured Case Studies
        • Mainframe Offload with Groupe PSA
        • Digital Transformation with Avanza Bank
        • High Peak Handling with PriceRunner
        • Optimizing Business Communications with Avaya
    • col3
      • Blog
      • Technical Documentation
    • How a Smart Operational Data Store (ODS) Drives Digital Transformation
      vid-icon Blog

      Learn how a Smart Operational Data Store has become one of the main drivers of digital transformation initatives in enterprises in several major industries.

      LEARN MORE
    • Contact Us
    • Try Free
  • Company
    • Col1
      • About
      • Customers
      • Management
      • Board Members
      • Investors
      • Events
      • News
      • Careers
    • col2
      • Partners
      • OEM Partners
      • System Integrators
      • Technology Partners
      • Value Added Resellers
    • col3
      • Support & Services
      • University
      • Services
      • Support
    • GigaSpaces is Headed to Database Management Today
      calendar-icon Event | April 22

      Join us at Database Management Today: New Strategies and Technologies, a special DBTA rountable webinar. Dive into the latest technologies and strategies every database professional needs to know about today and for the future.

      REGISTER NOW
    • Contact Us
    • Try Free
  • Contact Us
  • Try Free
  • Products, Solutions & Roles
    • Products
      • InsightEdge Portfolio
        • Smart Cache
        • Smart ODS
        • Smart Augmented Transactions
        • Compare InsightEdge Products
      • GigaSpaces Cloud
    • Solutions
      • Industry
        • Financial Services
        • Insurance
        • Retail and eCommerce
        • Telecommunications
        • Transportations
      • Technical
        • 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
    • Roles
      • Architects
      • CXOs
      • Product Teams
    • Contact Us
    • Try Free
  • Resources
    • Resource Hub
      • Webinars
      • Demos
      • Solution Briefs & Whitepapers
      • Case Studies
      • Benchmarks
      • Cost Reduction Calculators
      • Analyst Reports
      • eBooks
    • Featured Case Studies
      • Mainframe Offload with Groupe PSA
      • Digital Transformation with Avanza Bank
      • High Peak Handling with PriceRunner
      • Optimizing Business Communications with Avaya
    • Blog
    • Technical Documentation
    • Contact Us
    • Try Free
  • Company
    • About
    • Management
    • Customers
    • Board Members
    • Investors
    • Events
    • News
    • Careers
    • Partners
      • OEM Partners
      • System Integrators
      • Technology Partners
      • Value Added Resellers
    • Support & Services
      • University
      • Services
      • Support
  • Contact Us
  • Try Free

version .02 Update to project-creator.jar –Make your own templates!

Subscribe to our blog!

Subscribe for Updates
Close
Back

version .02 Update to project-creator.jar –Make your own templates!

Owen September 7, 2007
3 minutes read

I have made another fix to the project-creator.jar.
This fix allows you to specify
-templateDir X
where
X = path relative to the directory from which the script is invoked
or
X = Absolute path
example:
Let’s say I want to create a new template for my data Object so that it always has a defined String property.
I create a file called “dataObject.javasrc” (because that is currently the only name available for the dataObject template file)
The file could look like this:
***
package @packageName.common;
public class @dataObjectName {
private String dummyValue;
public void setDummyValue(String val){dummyValue=val;}
public String getDummyValue(){return dummyValue};
}
***
I save that file in:
c:\tmp\openspaces\mytemplates
in c:\tmp\openspaces I have a script that looks like this: (changes from previous examples are in different font)

****
rem Personal Settings (these change according to each machine environment)
set JAR_FILE_LOCATION=./project-creator.jar
set OUTPUT_DIRECTORY=c:/tmp/openspaces/output
set JAVA_HOME=c:\java\jdk1.5.0_07
if “%JSHOMEDIR%.” == “.” set JSHOMEDIR=c:\GigaSpacesXAP6.0
rem Script-specific Configuration Settings:
set PROJECT_NAME=Worker
if “%IDE%.” == “.” set IDE=-eclipse
set SERVICE_TEMPLATE_NAME=service.javasrc_myversion
set PU_TEMPLATE_NAME=pu.xmlsrc

set TEMPLATE_DIR=-templateDir ./mytemplates

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% %TEMPLATE_DIR%
****
If I call that script from the c:\tmp\openspaces directory all will be well and it will find my new version of the dataObject.javasrc file.
If I do not want to call it from that dir everytime, I can instead provide the arg:

set TEMPLATE_DIR=-templateDir c:/tmp/openspaces/mytemplates

and call the script from anywhere.
If the template needed for an operation is not provided in your specified TEMPLATE_DIR, projectcreator will look for it in the jar file as usual.
The template directory structure is as follows:
/%templateDir%
/%templateDir%/eclipse
/%templateDir%/intellij
All the templates are stored in the root of the templateDir except the files used for eclipse and intellij.
Some of the templates you can create must have certain names such as:
build.xml
any of the eclipse or intellij files
dataObject.javasrc
The template files used for the Service.java and pu.xml files can be given any name you like.
Within the templates you create you can currently use any of the following as replacement tokens.
@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)
I hope this addition makes this utility even more fun to use.
Cheers,
Owen.

CATEGORIES

  • GigaSpaces
  • JavaSpaces
  • OpenSpaces
Owen

All Posts (36)

YOU MAY ALSO LIKE

December 10, 2007

Strut Your Stuff: The OpenSpaces…
3 minutes read

February 28, 2008

Parting the Clouds
7 minutes read

July 29, 2008

GigaSpaces and the Economics of…
14 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
  • Cost Reduction 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