The Eclipse Data Grid Starter Templates

The Eclipse Data Grid comes with Starter Templates, that allow you to quickly get started with building your project! You can choose from a list of supported frameworks. Choose one you are comfortable with.

There are small differences that apply between frameworks. You can read up on your specific framework by clicking it in the navigaton bar on the left.

The “controller” Package

controller package

This package contains an example controller returning a timestamp on when the DataRoot-Object was created. Here you can add your REST-Endpoints that you want to reach from outside your cluster. You can add endpoints for example to read, write or update a list of customers.

When you input the url gained by click the "Cluster URL" button in the platform tab, you should be greeted by an empty page, showing the creation timestamp of the DataRoot-Object, as defined by the example controller.

The “storage” Package

This package contains all the files required for you to access your Eclipse-Store storage.

DataRoot

The DataRoot class is the Root of your Object-Graph. Here all the data like a list of customers, a collection of books, etc. is declared. In the Starter-Template this will only contain a single String field called data that is initialized with a timestamp, assigned in the constructor.

data root

Required Classes

Some other classes are necessary for the project to work in the Eclipse Data Grid.

RootProvider

This class is required for the cluster to have access to your root class. The cluster storage manager will use the created object to initialize its storage root if no data has been stored yet.

root provider

Logging

For logs to function properly some configuration has to be made.

Here is the default log4j configuration the starter templates use. The most important setting is that logs are sent to /var/log/mscluster/mscluster.log

property.logdir=/var/log/mscluster
property.logfile=${logdir}/mscluster.log
property.logbackuppattern=${logdir}/app-%d{MM-dd-yy-HH-mm-ss}-%i.log.zip
property.logbackupglob=app-*.log.zip
property.logpattern=%date{ISO8601} [%-5level] [%t] %c - %msg%n
property.logsize=10MB

appender.console.type=Console
appender.console.name=stdout
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=${logpattern}

appender.file.type=RollingFile
appender.file.name=file
#appender.file.immediateFlush=true
#appender.file.append=true
appender.file.fileName=${logfile}
appender.file.filePattern=${logbackuppattern}
appender.file.layout.type=PatternLayout
appender.file.layout.pattern=${logpattern}
appender.file.policies.type=Policies
appender.file.policies.size.type=SizeBasedTriggeringPolicy
appender.file.policies.size.size=${logsize}
appender.file.strategy.type=DefaultRolloverStrategy

appender.file.strategy.delete.type=Delete
appender.file.strategy.delete.basePath=${logdir}
appender.file.strategy.delete.maxDepth=1
appender.file.strategy.delete.ifFileName.type=IfFileName
appender.file.strategy.delete.ifFileName.glob=${logbackupglob}
appender.file.strategy.delete.ifOlder.type=IfLastModified
appender.file.strategy.delete.ifOlder.age=1m

rootLogger=info, stdout, file

Framework differences

Depending on the framework there might be more required classes. Check out their respective documentations by clicking one of the links below.