PK ]>
c build.xml
PK X>hA A commands.py# Here you can create play commands that are specific to the module, and extend existing commands
MODULE = 'hazelcast'
# Commands that are specific to your module
COMMANDS = ['hazelcast:hello']
def execute(**kargs):
command = kargs.get("command")
app = kargs.get("app")
args = kargs.get("args")
env = kargs.get("env")
if command == "hazelcast:hello":
print "~ Hello"
# This will be executed before any command (new, run...)
def before(**kargs):
command = kargs.get("command")
app = kargs.get("app")
args = kargs.get("args")
env = kargs.get("env")
# This will be executed after any command (new, run...)
def after(**kargs):
command = kargs.get("command")
app = kargs.get("app")
args = kargs.get("args")
env = kargs.get("env")
if command == "new":
pass
PK b>YD commands.pyc
{Mc @ s. d Z d g Z d Z d Z d Z d S( t hazelcasts hazelcast:helloc K sV | i d } | i d } | i d } | i d } | d j o d GHn d S( Nt commandt appt argst envs hazelcast:hellos ~ Hello( t get( t kargsR R R R ( ( s= /Users/marcus/Developments/play_modules/hazelcast/commands.pyt execute s
c K s@ | i d } | i d } | i d } | i d } d S( NR R R R ( R ( R R R R R ( ( s= /Users/marcus/Developments/play_modules/hazelcast/commands.pyt before s c K sQ | i d } | i d } | i d } | i d } | d j o n d S( NR R R R t new( R ( R R R R R ( ( s= /Users/marcus/Developments/play_modules/hazelcast/commands.pyt after s
N( t MODULEt COMMANDSR R R
( ( ( s= /Users/marcus/Developments/play_modules/hazelcast/commands.pyt s PK ,m?53JW" " manifestversion=0.4
frameworkVersions=1.2
PK m? ܈ README.textileh1. Documentation for the Hazelcast module
bq. This module is a @dropin@ replacement for EhCacheImpl or MemcachedImpl from Play.
It allow your application to have a clustered cache when you can't install a memcached server on your platform.
It's also a great free open source *In-Memory Data Grid*
See "Hazelcast Documentation":http://www.hazelcast.com/documentation.jsp for more details.
h2. Installing Hazelcast Module
p. To install Hazelcast Plugin module, you do like every other Play Modules:
bc. play install hazelcast[-version]
h2. Using Hazelcast Module in your application (Dependency management)
h3. There is two way to use the module
* The Play 1.x way (*in application.conf*)
bc. module.hazelcast=${play.path}/modules/hazelcast-[version]
* The Play 1.2.x way (*in dependencies.yml*)
bc.. require:
- play -> hazelcast [version]
h3. Parameters
You can disable the module in your application by usinga parameter in @application.conf@:
bc. hazelcast.disabled=true
The value default to false.
h2. Using standard Play! Framework Cache Mechanisms
p. All the standard Play annotations or methods work seamlessly with *Hazelcast* instead of *EhCache* or *Memcached*.
* @CacheFor("1h")@
* @Cache.xxx()@
* Etc...
bq. See "Play Framework Cache Documentation":/@documentation/cache for @CacheFor("1h")@ and provided Play! @Cache.xxx()@ usage.
h2. Using features from Hazelcast
h3. Using @Inject to inject an instance of *Hazelcast* in your controller
bc(Java). @Inject private static HazelcastInstance hazel;
h3. Injecting the default ExecutorService
bc(Java). @Inject private static ExecutorService executor;
h3. Using @Named to inject a named resource
bc(Java). @Named("MyQueue") private static Queue myQueue;
h2. Hazelcast clustered services
* Distributed Queues (Entries are consumed by one and only one JVM)
* Distributed Topics (Entries are consumed by all JVM)
* Distributed Events
* Distributed AtomicNumber provider
* Distributed ExecutorService
* Distributed ID Generator (_ID are UNIQUE in all cluster nodes_)
* Distributed List (to share a list in the cluster between many JVM)
* Distributed Lock (_to apply a lock on an object and share between JVM_)
* Distributed Set
* Distributed Map/MultiMap (_Maps are shared between JMV, MultiMap allow for multiple values for the same key_)
* Distributed Transaction (_affect transactions on clustered objects, not database!_)
h3. Configuration file *hazelcast.xml*
You can modify *hazelcast.xml* to your need to create more Queues or Map and modify the default ExecutorService parameters. Just copy the hazelcast.xml file from the module _conf_ directory to your application _conf_ directory. This is also the file that allow you to change from multicast to TCPIP static cluster definition.
h3. Hazelcast Object type that can be retreived via @@Named@ annotation
* Queue
* Topic
* AtomicNumber
* ExecutorService
* Set
* Map
* MultiMap
* IdGenerator
h3. Hazelcast Object type that can by retreived via @@Inject@ annotation
* Transaction
* ExecutorService
* PartitionService
* Event
h3. Method directly accessible on @HazelcastPlugin@ class
* @HazelcastPlugin.getTransaction()@ [1]
* @HazelcastPlugin.getLock(Object o)@ [2]
* @HazelcastPlugin.getHazel()@ [3]
fn1. Use this to get a Transaction object then you can @begin()@ or @commit()@ or @rollback()@ operations on cluster.
fn2. Use this to lock an object across the cluster.
fn3. Use this if you absolutly _NEED_ to directly get the Default Hazelcast instance.
h2. Hibernate second level cache configuration
* application.conf
hibernate.cache.region.factory_class=com.hazelcast.hibernate.HazelcastCacheRegionFactoryhibernate.cache.use_query_cache=falsehibernate.cache.use_minimal_puts=truehibernate.cache.use_second_level_cache=truehibernate.cache.region_prefix=myApphibernate.cache.use_structured_entries=true
* dependencies.yml
# Application dependenciesrequire: - play - play -> hazelcast 0.3 - com.hazelcast -> hazelcast-hibernate 1.9.4.4
* Entity class annotation
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "model")
* hazelcast.xml - add following map definition
103600LRU1000025
h2. Roadmap
p. I'd like to see some basic Play! features use Hazel capabilities:
* Play! Jobs could use Hazelcast ExecutorService automaticaly
* Integrating Hazelcast with my other upcoming module "Camel":http://myuri.me/3VAE for "EIP":http://myuri.me/3Vh8
* Etc...
PK > ) app/controllers/HazelcastApplication.javapackage controllers;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.inject.Inject;
import play.Logger;
import play.cache.Cache;
import play.data.validation.Required;
import play.mvc.Controller;
import com.hazelcast.config.ExecutorConfig;
import com.hazelcast.config.MapConfig;
import com.hazelcast.config.QueueConfig;
import com.hazelcast.config.TopicConfig;
import com.hazelcast.core.HazelcastInstance;
public class HazelcastApplication extends Controller {
@Inject
private static HazelcastInstance hazel;
public static void index() {
Logger.info("Compteur: %s", hazel.getAtomicNumber("test").addAndGet(1));
String implementation = Cache.cacheImpl.getClass().getName();
String name = hazel.getName();
String port = "" + hazel.getConfig().getPort();
hazel.getList("myList");
hazel.getQueue("myQueue");
hazel.getMap("myMap");
hazel.getTopic("myTopic");
hazel.getAtomicNumber("myAtomicNumber");
hazel.getExecutorService("myExecutorService");
hazel.getIdGenerator("myIdGenerator");
hazel.getMultiMap("myMultiMap");
hazel.getSet("mySet");
List maps = new ArrayList(hazel.getConfig().getMapConfigs().values());
List executors = new ArrayList(hazel.getConfig().getExecutorConfigs());
List queues = new ArrayList(hazel.getConfig().getQConfigs().values());
List topics = new ArrayList(hazel.getConfig().getTopicConfigs().values());
render(implementation, name, port, maps, executors, queues, topics);
}
public static void viewMap(@Required String name){
Map map = hazel.getMap(name);
Set keys = map.keySet();
render(name, keys, map);
}
}
PK N>l3 ) app/views/HazelcastApplication/index.html#{extends "HazelcastApplication/main.html" /}
#{set title:'Home' /}
PK <>1 conf/application.confapplication.name=hazelcast
PK m?Bt conf/dependencies.ymlself: play -> hazelcast 0.4
require:
- play
- com.hazelcast -> hazelcast 1.9.4.4:
exclude:
- junit-addons -> junit-addons 1.4
- xerces -> xercesImpl 2.6.2
- xerces -> xmlParserAPIs 2.6.2
- org.mockito -> mockito-all 1.8.2
- com.hazelcast -> hazelcast-hibernate 1.9.4.4
- com.hazelcast -> hazelcast-spring 1.9.4.4
- com.hazelcast -> hazelcast-client 1.9.4.4:
exclude:
- junit-addons -> junit-addons 1.4
- xerces -> xercesImpl 2.6.2
- xerces -> xmlParserAPIs 2.6.2
- org.mockito -> mockito-all 1.8.2
- com.hazelcast -> hazelcast-hibernate 1.9.4.4
- com.hazelcast -> hazelcast-spring 1.9.4.4
PK \>/n| | conf/hazelcast.xml
devdev-pass5701224.2.2.354327127.0.0.110.10.1.*PBEWithMD5AndDESthesaltthepass19RSA/NONE/PKCS1PADDINGthekeypasslocalJKSthestorepasskeystore166460PK X>r
conf/messages# Default hazelcast messages
# You can specialize this file for each language.
# For exemple, for french create a messages.fr file
#hazelcast.name=hazelcastPK Z>Ad$$ $ conf/routes# This file defines all module routes (Higher priority routes first)
#
# import these routes in the main app as :
# * / module:hazelcast
#
# ~~~~
#GET /? HazelcastApplication.index
GET /play-hazelcast/ staticDir:public-hazelcastPK S?E7 ! documentation/manual/home.textileh1. Documentation for the Hazelcast module
bq. This module is a @dropin@ replacement for EhCacheImpl or MemcachedImpl from Play.
It allow your application to have a clustered cache when you can't install a memcached server on your platform.
It's also a great free open source *In-Memory Data Grid*
See "Hazelcast Documentation":http://www.hazelcast.com/documentation.jsp for more details.
h2. Installing Hazelcast Module
p. To install Hazelcast Plugin module, you do like every other Play Modules:
bc. play install hazelcast[-version]
h2. Using Hazelcast Module in your application (Dependency management)
h3. There is two way to use the module
* The Play 1.x way (*in application.conf*)
bc. module.hazelcast=${play.path}/modules/hazelcast-[version]
* The Play 1.2.x way (*in dependencies.yml*)
bc.. require:
- play -> hazelcast [version]
h3. Parameters
You can disable the module in your application by usinga parameter in @application.conf@:
bc. hazelcast.disabled=true
The value default to false.
h2. Using standard Play! Framework Cache Mechanisms
p. All the standard Play annotations or methods work seamlessly with *Hazelcast* instead of *EhCache* or *Memcached*.
* @CacheFor("1h")@
* @Cache.xxx()@
* Etc...
bq. See "Play Framework Cache Documentation":/@documentation/cache for @CacheFor("1h")@ and provided Play! @Cache.xxx()@ usage.
h2. Using features from Hazelcast
h3. Using @Inject to inject an instance of *Hazelcast* in your controller
bc(Java). @Inject private static HazelcastInstance hazel;
h3. Injecting the default ExecutorService
bc(Java). @Inject private static ExecutorService executor;
h3. Using @Named to inject a named resource
bc(Java). @Named("MyQueue") private static Queue myQueue;
h2. Hazelcast clustered services
* Distributed Queues (Entries are consumed by one and only one JVM)
* Distributed Topics (Entries are consumed by all JVM)
* Distributed Events
* Distributed AtomicNumber provider
* Distributed ExecutorService
* Distributed ID Generator (_ID are UNIQUE in all cluster nodes_)
* Distributed List (to share a list in the cluster between many JVM)
* Distributed Lock (_to apply a lock on an object and share between JVM_)
* Distributed Set
* Distributed Map/MultiMap (_Maps are shared between JMV, MultiMap allow for multiple values for the same key_)
* Distributed Transaction (_affect transactions on clustered objects, not database!_)
h3. Configuration file *hazelcast.xml*
You can modify *hazelcast.xml* to your need to create more Queues or Map and modify the default ExecutorService parameters. Just copy the hazelcast.xml file from the module _conf_ directory to your application _conf_ directory. This is also the file that allow you to change from multicast to TCPIP static cluster definition.
h3. Hazelcast Object type that can be retreived via @@Named@ annotation
* Queue
* Topic
* AtomicNumber
* ExecutorService
* Set
* Map
* MultiMap
* IdGenerator
h3. Hazelcast Object type that can by retreived via @@Inject@ annotation
* Transaction
* ExecutorService
* PartitionService
* Event
h3. Method directly accessible on @HazelcastPlugin@ class
* @HazelcastPlugin.getTransaction()@ [1]
* @HazelcastPlugin.getLock(Object o)@ [2]
* @HazelcastPlugin.getHazel()@ [3]
fn1. Use this to get a Transaction object then you can @begin()@ or @commit()@ or @rollback()@ operations on cluster.
fn2. Use this to lock an object across the cluster.
fn3. Use this if you absolutly _NEED_ to directly get the Default Hazelcast instance.
h2. Roadmap
p. I'd like to see some basic Play! features use Hazel capabilities:
* Play! Jobs could use Hazelcast ExecutorService automaticaly
* Integrating Hazelcast with my other upcoming module "Camel":http://myuri.me/3VAE for "EIP":http://myuri.me/3Vh8
* Etc...
PK m?F| | lib/hazelcast-1.9.4.4.jarPK
WK? META-INF/PK
WK?U% META-INF/MANIFEST.MFTMo0#ОJUD=Jz&f`j-__{ ۞73oޛ)@
~6L<@nQ=;8vI@=ketΓN(e^p5Ͷe<w]dctL̮ob~e֖!8aqr(?H~݁#?PK
Z=? com/PK
Z=? com/hazelcast/PK
KOK? com/hazelcast/cluster/PK
Z=? com/hazelcast/config/PK
Z=? com/hazelcast/core/PK
Z=? com/hazelcast/examples/PK
WNK? com/hazelcast/impl/PK
Z=? com/hazelcast/impl/ascii/PK
Z=? " com/hazelcast/impl/ascii/memcache/PK
Z=? com/hazelcast/impl/ascii/rest/PK
i=? com/hazelcast/impl/base/PK
Z=? ! com/hazelcast/impl/concurrentmap/PK
Z=? com/hazelcast/impl/executor/PK
Z=? com/hazelcast/impl/management/PK
Z=? com/hazelcast/impl/monitor/PK
Z=? com/hazelcast/impl/wan/PK
i=? com/hazelcast/jmx/PK
Z=? com/hazelcast/logging/PK
Z=? com/hazelcast/merge/PK
Z=? com/hazelcast/monitor/PK
WNK? com/hazelcast/nio/PK
Z=? com/hazelcast/nio/ascii/PK
Z=? com/hazelcast/partition/PK
Z=? com/hazelcast/query/PK
Z=? com/hazelcast/util/PK
Z=? com/hazelcast/util/concurrent/PK
Z=?ϗ"H d - com/hazelcast/cluster/AbstractNodeAware.classQJAf],;jaP]Dju!H]76dv-
JOy{yp
6`AA+|צc܉d`Tk]bF%#=.y/J+yJ~2ӾLjS~0LRf/ISmռJ94^N۪ x|q.B~p0W@9ʰ G