Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2011-08-09 21:43:48 +0000
committerRyan D. Brooks2011-08-09 21:43:48 +0000
commit889cd095158b68983a8e8d09417c68bfff9baafe (patch)
tree57266fe8b58b4b6367dbcc667b8031593733a256
parent296293feb8ca60d3b3c998fb63b21ccd65f59509 (diff)
downloadorg.eclipse.osee-889cd095158b68983a8e8d09417c68bfff9baafe.tar.gz
org.eclipse.osee-889cd095158b68983a8e8d09417c68bfff9baafe.tar.xz
org.eclipse.osee-889cd095158b68983a8e8d09417c68bfff9baafe.zip
feature: Add cluster admin bundles
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/.classpath7
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/.project33
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/META-INF/MANIFEST.MF17
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/OSGI-INF/cluster.admin.impl.xml16
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/build.properties9
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/AtomicNumberProxy.java92
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/CallableTransactionImpl.java69
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/ClusterAdminImpl.java278
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/ClusterEventNotifier.java159
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/ClusterProxy.java52
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedBlockingQueueProxy.java169
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedExecutorServiceImpl.java159
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedIdProxy.java47
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedListProxy.java160
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedLockProxy.java74
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedMapProxy.java258
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedMultiMapProxy.java141
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedSetProxy.java109
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/MemberProxy.java46
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/TransactionProxy.java93
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.rest/.classpath7
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.rest/.project33
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.rest/META-INF/MANIFEST.MF11
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.rest/OSGI-INF/cluster.admin.application.xml9
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.rest/build.properties7
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/ClusterAdminApplication.java48
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/ClusterUtil.java32
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/JobsResource.java28
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/MemberResource.java71
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/MembersResource.java68
-rw-r--r--plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/XmlMember.java57
-rw-r--r--plugins/org.eclipse.osee.cluster.admin/.classpath7
-rw-r--r--plugins/org.eclipse.osee.cluster.admin/.project28
-rw-r--r--plugins/org.eclipse.osee.cluster.admin/META-INF/MANIFEST.MF8
-rw-r--r--plugins/org.eclipse.osee.cluster.admin/build.properties4
-rw-r--r--plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/Callback.java22
-rw-r--r--plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/Cluster.java40
-rw-r--r--plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/ClusterAdmin.java69
-rw-r--r--plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/ClusterAdminConstants.java53
-rw-r--r--plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/ClusterServiceUtils.java56
-rw-r--r--plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/DistributedExecutorService.java30
-rw-r--r--plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/Member.java41
-rw-r--r--plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/Transaction.java57
-rw-r--r--plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/TransactionWork.java42
44 files changed, 2816 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/.classpath b/plugins/org.eclipse.osee.cluster.admin.hazelcast/.classpath
new file mode 100644
index 00000000000..ad32c83a788
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/.project b/plugins/org.eclipse.osee.cluster.admin.hazelcast/.project
new file mode 100644
index 00000000000..ef0ac62809c
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.cluster.admin.hazelcast</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.cluster.admin.hazelcast/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..212e8830aec
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OSEE Hazelcast Cluster
+Bundle-SymbolicName: org.eclipse.osee.cluster.admin.hazelcast
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: com.hazelcast.config,
+ com.hazelcast.core,
+ com.hazelcast.impl,
+ com.hazelcast.partition,
+ com.hazelcast.query,
+ org.eclipse.osee.cluster.admin,
+ org.eclipse.osee.distributed,
+ org.eclipse.osee.log.admin,
+ org.eclipse.osgi.framework.console,
+ org.osgi.service.event
+Service-Component: OSGI-INF/*.xml
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/OSGI-INF/cluster.admin.impl.xml b/plugins/org.eclipse.osee.cluster.admin.hazelcast/OSGI-INF/cluster.admin.impl.xml
new file mode 100644
index 00000000000..86a6e56622a
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/OSGI-INF/cluster.admin.impl.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" immediate="true" name="org.eclipse.osee.cluster.admin.hazelcast.internal.ClusterAdminImpl">
+ <implementation class="org.eclipse.osee.cluster.admin.hazelcast.internal.ClusterAdminImpl"/>
+ <reference interface="org.osgi.service.event.EventAdmin" name="EventAdmin"
+ cardinality="1..1"
+ policy="static"
+ bind="setEventAdmin" />
+ <reference interface="org.eclipse.osee.log.admin.Logger" name="Logger"
+ cardinality="1..1"
+ policy="static"
+ bind="setLogger" />
+ <service>
+ <provide interface="org.eclipse.osee.cluster.admin.ClusterAdmin"/>
+ <provide interface="org.eclipse.osee.distributed.InstanceManager"/>
+ </service>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/build.properties b/plugins/org.eclipse.osee.cluster.admin.hazelcast/build.properties
new file mode 100644
index 00000000000..f48e79b4539
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/build.properties
@@ -0,0 +1,9 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/
+additional.bundles = org.eclipse.osee.cluster.admin,\
+ com.hazelcast,\
+ org.eclipse.osee.distributed,\
+ org.eclipse.osee.log.admin
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/AtomicNumberProxy.java b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/AtomicNumberProxy.java
new file mode 100644
index 00000000000..a9c154808f4
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/AtomicNumberProxy.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.hazelcast.internal;
+
+import org.eclipse.osee.distributed.AtomicNumber;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AtomicNumberProxy implements AtomicNumber {
+
+ private final com.hazelcast.core.AtomicNumber proxyObject;
+
+ public AtomicNumberProxy(com.hazelcast.core.AtomicNumber proxyObject) {
+ super();
+ this.proxyObject = proxyObject;
+ }
+
+ @Override
+ public Object getId() {
+ return proxyObject.getId();
+ }
+
+ @Override
+ public void dispose() {
+ proxyObject.destroy();
+ }
+
+ @Override
+ public String getName() {
+ return proxyObject.getName();
+ }
+
+ @Override
+ public long get() {
+ return proxyObject.get();
+ }
+
+ @Override
+ public void set(long newValue) {
+ proxyObject.set(newValue);
+ }
+
+ @Override
+ public long decrementAndGet() {
+ return proxyObject.decrementAndGet();
+ }
+
+ @Override
+ public long incrementAndGet() {
+ return proxyObject.incrementAndGet();
+ }
+
+ @Override
+ public long getAndAdd(long delta) {
+ return proxyObject.getAndAdd(delta);
+ }
+
+ @Override
+ public long addAndGet(long delta) {
+ return proxyObject.addAndGet(delta);
+ }
+
+ @Override
+ public long getAndSet(long newValue) {
+ return proxyObject.getAndSet(newValue);
+ }
+
+ @Override
+ public void lazySet(long newValue) {
+ proxyObject.lazySet(newValue);
+ }
+
+ @Override
+ public boolean compareAndSet(long expect, long update) {
+ return proxyObject.compareAndSet(expect, update);
+ }
+
+ @Override
+ public boolean weakCompareAndSet(long expect, long update) {
+ return proxyObject.weakCompareAndSet(expect, update);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/CallableTransactionImpl.java b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/CallableTransactionImpl.java
new file mode 100644
index 00000000000..83c67ea7775
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/CallableTransactionImpl.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.hazelcast.internal;
+
+import java.util.concurrent.Callable;
+import org.eclipse.osee.cluster.admin.Transaction;
+import org.eclipse.osee.cluster.admin.TransactionWork;
+import org.eclipse.osee.log.admin.Logger;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CallableTransactionImpl<T> implements Callable<T> {
+
+ private final Logger logger;
+ private final Transaction txn;
+ private final TransactionWork<T> work;
+
+ public CallableTransactionImpl(Logger logger, Transaction txn, TransactionWork<T> work) {
+ super();
+ this.logger = logger;
+ this.txn = txn;
+ this.work = work;
+ }
+
+ @Override
+ public T call() throws Exception {
+ Throwable saveThrowable = null;
+ T result = null;
+ try {
+ txn.begin();
+ logger.debug(this, "Start Transaction: [%s]", work.getName());
+ result = work.doWork();
+ txn.commit();
+ logger.debug(this, "End Transaction: [%s]", work.getName());
+ } catch (Throwable throwable) {
+ saveThrowable = throwable;
+ try {
+ txn.rollback();
+ } finally {
+ work.handleException(throwable);
+ }
+ } finally {
+ try {
+ work.handleTxFinally();
+ } catch (Throwable ex) {
+ logger.error(this, ex, "Error in Transaction: [%s] ", work.getName());
+ if (saveThrowable != null) {
+ throw new Exception(ex);
+ }
+ }
+ }
+
+ if (saveThrowable != null) {
+ throw new Exception(saveThrowable);
+ }
+
+ return result;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/ClusterAdminImpl.java b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/ClusterAdminImpl.java
new file mode 100644
index 00000000000..ba16ea5b9e0
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/ClusterAdminImpl.java
@@ -0,0 +1,278 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.hazelcast.internal;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import org.eclipse.osee.cluster.admin.Cluster;
+import org.eclipse.osee.cluster.admin.ClusterAdmin;
+import org.eclipse.osee.cluster.admin.ClusterServiceUtils;
+import org.eclipse.osee.cluster.admin.DistributedExecutorService;
+import org.eclipse.osee.cluster.admin.Transaction;
+import org.eclipse.osee.cluster.admin.TransactionWork;
+import org.eclipse.osee.distributed.AtomicNumber;
+import org.eclipse.osee.distributed.DistributedId;
+import org.eclipse.osee.distributed.DistributedLock;
+import org.eclipse.osee.distributed.DistributedMap;
+import org.eclipse.osee.distributed.DistributedMultiMap;
+import org.eclipse.osee.distributed.DistributedObject;
+import org.eclipse.osee.distributed.InstanceManager;
+import org.eclipse.osee.log.admin.Logger;
+import org.osgi.service.event.EventAdmin;
+import com.hazelcast.config.Config;
+import com.hazelcast.config.UrlXmlConfig;
+import com.hazelcast.config.XmlConfigBuilder;
+import com.hazelcast.core.Hazelcast;
+import com.hazelcast.core.HazelcastInstance;
+import com.hazelcast.core.IList;
+import com.hazelcast.core.ILock;
+import com.hazelcast.core.IMap;
+import com.hazelcast.core.IQueue;
+import com.hazelcast.core.ISet;
+import com.hazelcast.core.IdGenerator;
+import com.hazelcast.core.Instance;
+import com.hazelcast.core.InstanceEvent;
+import com.hazelcast.core.InstanceListener;
+import com.hazelcast.core.LifecycleService;
+import com.hazelcast.core.MultiMap;
+import com.hazelcast.impl.GroupProperties;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ClusterAdminImpl implements ClusterAdmin, InstanceManager {
+
+ private final Map<Object, DistributedObject> distributedObjects = new ConcurrentHashMap<Object, DistributedObject>();
+ private final ProxyCleaner proxyCleaner = new ProxyCleaner();
+ private Logger logger;
+ private EventAdmin eventAdmin;
+ private HazelcastInstance instance;
+ private Thread thread;
+ private ClusterEventNotifier eventNotifier;
+ private ClusterProxy clusterProxy;
+ private DistributedExecutorService executor;
+
+ public void setEventAdmin(EventAdmin eventAdmin) {
+ this.eventAdmin = eventAdmin;
+ }
+
+ private EventAdmin getEventAdmin() {
+ return eventAdmin;
+ }
+
+ public void setLogger(Logger logger) {
+ this.logger = logger;
+ }
+
+ private Logger getLogger() {
+ return logger;
+ }
+
+ private Config getConfiguration(Map<String, Object> properties) {
+ Config config = null;
+ String configPath = ClusterServiceUtils.getConfigurationURL(properties);
+ if (configPath != null && configPath.length() > 0) {
+ config = loadConfiguration(configPath);
+ } else {
+ config = new XmlConfigBuilder().build();
+ }
+ Properties props = config.getProperties();
+ props.put(GroupProperties.PROP_VERSION_CHECK_ENABLED, "false");
+ // props.put(GroupProperties.PROP_REST_ENABLED, "true");
+ props.put(GroupProperties.PROP_ENABLE_JMX, "true");
+ props.put(GroupProperties.PROP_ENABLE_JMX_DETAILED, "true");
+ return config;
+ }
+
+ private Config loadConfiguration(String configPath) {
+ // InputStream stream = null;
+ try {
+ // URL configURL = new URL(configPath);
+ // stream = new BufferedInputStream(configURL.openStream());
+ //
+ // XmlConfigBuilder builder = new XmlConfigBuilder(stream);
+ return new UrlXmlConfig(configPath);
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ // } finally {
+ // if (stream != null) {
+ // try {
+ // stream.close();
+ // } catch (IOException ex) {
+ // // Do Nothing
+ // }
+ // }
+ }
+ }
+
+ public synchronized void start(final Map<String, Object> properties) {
+ thread = new Thread("Register Pending Rest Services") {
+ @Override
+ public void run() {
+ Config config = getConfiguration(properties);
+ instance = Hazelcast.init(config);
+ clusterProxy = new ClusterProxy(instance);
+ executor = new DistributedExecutorServiceImpl(instance);
+
+ String componentName = ClusterServiceUtils.getComponentName(properties);
+ String contextName = ClusterServiceUtils.getContextName(properties);
+ eventNotifier = new ClusterEventNotifier(componentName, contextName, getEventAdmin());
+ registerEventListeners();
+ eventNotifier.notifyRegistration();
+ }
+ };
+ thread.start();
+ }
+
+ public synchronized void stop(Map<String, Object> properties) {
+ if (thread != null && thread.isAlive()) {
+ thread.interrupt();
+ thread = null;
+ }
+ distributedObjects.clear();
+ if (instance != null) {
+ LifecycleService service = instance.getLifecycleService();
+ service.shutdown();
+ deregisterEventListeners();
+ instance = null;
+ }
+ eventNotifier.notifyDeRegistration();
+ eventNotifier = null;
+ }
+
+ private void registerEventListeners() {
+ instance.addInstanceListener(proxyCleaner);
+ instance.addInstanceListener(eventNotifier);
+ instance.getLifecycleService().addLifecycleListener(eventNotifier);
+ instance.getCluster().addMembershipListener(eventNotifier);
+ }
+
+ private void deregisterEventListeners() {
+ instance.removeInstanceListener(proxyCleaner);
+ instance.removeInstanceListener(eventNotifier);
+ instance.getLifecycleService().removeLifecycleListener(eventNotifier);
+ instance.getCluster().removeMembershipListener(eventNotifier);
+ }
+
+ protected HazelcastInstance getHazelcastInstance() {
+ return instance;
+ }
+
+ @Override
+ public DistributedExecutorService getExecutor() {
+ return executor;
+ }
+
+ @Override
+ public Cluster getCluster() {
+ return clusterProxy;
+ }
+
+ @Override
+ public String getName() {
+ return getHazelcastInstance().getName();
+ }
+
+ @Override
+ public Transaction getTransaction() {
+ // Create a new one every time
+ return new TransactionProxy(getHazelcastInstance().getTransaction());
+ }
+
+ @Override
+ public <T> Callable<T> createTxCallable(TransactionWork<T> work) {
+ Transaction txn = getTransaction();
+ return new CallableTransactionImpl<T>(getLogger(), txn, work);
+ }
+
+ @Override
+ public AtomicNumber getAtomicNumber(String name) {
+ return getProxyObject(AtomicNumberProxy.class, com.hazelcast.core.AtomicNumber.class,
+ getHazelcastInstance().getAtomicNumber(name));
+ }
+
+ @SuppressWarnings({"unchecked"})
+ @Override
+ public <E> BlockingQueue<E> getQueue(String name) {
+ return getProxyObject(DistributedBlockingQueueProxy.class, IQueue.class, getHazelcastInstance().getQueue(name));
+ }
+
+ @SuppressWarnings({"unchecked"})
+ @Override
+ public <E> Set<E> getSet(String name) {
+ return getProxyObject(DistributedSetProxy.class, ISet.class, getHazelcastInstance().getSet(name));
+ }
+
+ @SuppressWarnings({"unchecked"})
+ @Override
+ public <E> List<E> getList(String name) {
+ return getProxyObject(DistributedListProxy.class, IList.class, getHazelcastInstance().getList(name));
+ }
+
+ @SuppressWarnings({"unchecked"})
+ @Override
+ public <K, V> DistributedMap<K, V> getMap(String name) {
+ return getProxyObject(DistributedMapProxy.class, IMap.class, getHazelcastInstance().getMap(name));
+ }
+
+ @SuppressWarnings({"unchecked"})
+ @Override
+ public <K, V> DistributedMultiMap<K, V> getMultiMap(String name) {
+ return getProxyObject(DistributedMultiMapProxy.class, MultiMap.class, getHazelcastInstance().getMultiMap(name));
+ }
+
+ @Override
+ public DistributedId getIdGenerator(String name) {
+ return getProxyObject(DistributedIdProxy.class, IdGenerator.class, getHazelcastInstance().getIdGenerator(name));
+ }
+
+ @Override
+ public DistributedLock getLock(Object key) {
+ return getProxyObject(DistributedLockProxy.class, ILock.class, getHazelcastInstance().getLock(key));
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T extends DistributedObject> T getProxyObject(Class<T> proxyClass, Class<?> hClazz, Instance instance) {
+ Object key = instance.getId();
+ T proxy = (T) distributedObjects.get(key);
+ if (proxy == null) {
+ try {
+ Constructor<T> constructor = proxyClass.getConstructor(hClazz);
+ proxy = constructor.newInstance(instance);
+ distributedObjects.put(key, proxy);
+ } catch (Exception ex) {
+ logger.error(ex, "Error creating proxy object");
+ }
+ }
+ return proxy;
+ }
+
+ private final class ProxyCleaner implements InstanceListener {
+
+ @Override
+ public void instanceCreated(InstanceEvent event) {
+ // Do nothing
+ }
+
+ @Override
+ public void instanceDestroyed(InstanceEvent event) {
+ Instance instance = event.getInstance();
+ distributedObjects.remove(instance.getId());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/ClusterEventNotifier.java b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/ClusterEventNotifier.java
new file mode 100644
index 00000000000..e067246d26f
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/ClusterEventNotifier.java
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.hazelcast.internal;
+
+import java.util.Map;
+import org.eclipse.osee.cluster.admin.ClusterAdminConstants;
+import org.eclipse.osee.cluster.admin.ClusterAdminConstants.ClusterInstanceState;
+import org.eclipse.osee.cluster.admin.ClusterServiceUtils;
+import org.eclipse.osee.cluster.admin.Member;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
+import com.hazelcast.core.Instance;
+import com.hazelcast.core.Instance.InstanceType;
+import com.hazelcast.core.InstanceEvent;
+import com.hazelcast.core.InstanceListener;
+import com.hazelcast.core.LifecycleEvent;
+import com.hazelcast.core.LifecycleEvent.LifecycleState;
+import com.hazelcast.core.LifecycleListener;
+import com.hazelcast.core.MembershipEvent;
+import com.hazelcast.core.MembershipListener;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ClusterEventNotifier implements LifecycleListener, InstanceListener, MembershipListener {
+
+ private final String componentName;
+ private final String contextName;
+ private final EventAdmin eventAdmin;
+
+ public ClusterEventNotifier(String componentName, String contextName, EventAdmin eventAdmin) {
+ this.componentName = componentName;
+ this.contextName = contextName;
+ this.eventAdmin = eventAdmin;
+ }
+
+ @Override
+ public void memberAdded(MembershipEvent event) {
+ Map<String, Object> data = toMap(event);
+ postEvent(ClusterAdminConstants.CLUSTER_MEMBER_ADDED_EVENT, data);
+ }
+
+ @Override
+ public void memberRemoved(MembershipEvent event) {
+ Map<String, Object> data = toMap(event);
+ postEvent(ClusterAdminConstants.CLUSTER_MEMBER_REMOVED_EVENT, data);
+ }
+
+ @Override
+ public void stateChanged(LifecycleEvent event) {
+ Map<String, Object> data = ClusterServiceUtils.toMap(componentName, contextName);
+ ClusterInstanceState state = mapState(event.getState());
+ data.put(ClusterAdminConstants.CLUSTER_LIFECYCLE_STATE, state);
+ postEvent(ClusterAdminConstants.CLUSTER_LIFECYCLE_EVENT, data);
+ }
+
+ @Override
+ public void instanceCreated(InstanceEvent event) {
+ Map<String, Object> data = toMap(event);
+ postEvent(ClusterAdminConstants.CLUSTER_INSTANCE_CREATED_EVENT, data);
+ }
+
+ @Override
+ public void instanceDestroyed(InstanceEvent event) {
+ Map<String, Object> data = toMap(event);
+ postEvent(ClusterAdminConstants.CLUSTER_INSTANCE_DESTROYED_EVENT, data);
+ }
+
+ public void notifyRegistration() {
+ Map<String, Object> data = ClusterServiceUtils.toMap(componentName, contextName);
+ postEvent(ClusterAdminConstants.CLUSTER_REGISTRATION_EVENT, data);
+ }
+
+ public void notifyDeRegistration() {
+ Map<String, Object> data = ClusterServiceUtils.toMap(componentName, contextName);
+ postEvent(ClusterAdminConstants.CLUSTER_DEREGISTRATION_EVENT, data);
+ }
+
+ private void postEvent(String topic, Map<String, Object> data) {
+ eventAdmin.postEvent(new Event(topic, data));
+ }
+
+ private Map<String, Object> toMap(MembershipEvent membershipEvent) {
+ Map<String, Object> data = ClusterServiceUtils.toMap(componentName, contextName);
+ Member member = new MemberProxy(membershipEvent.getMember());
+ data.put(ClusterAdminConstants.CLUSTER_MEMBER, member);
+ return data;
+ }
+
+ private Map<String, Object> toMap(InstanceEvent event) {
+ Map<String, Object> data = ClusterServiceUtils.toMap(componentName, contextName);
+ InstanceType instanceType = event.getInstanceType();
+ Instance instance = event.getInstance();
+ Object objectId = instance.getId();
+
+ data.put(ClusterAdminConstants.CLUSTER_OBJECT_TYPE, instanceType.name());
+ data.put(ClusterAdminConstants.CLUSTER_OBJECT_ID, objectId);
+ data.put(ClusterAdminConstants.CLUSTER_OBJECT, instance);
+ return data;
+ }
+
+ private ClusterInstanceState mapState(LifecycleState state) {
+ ClusterInstanceState toReturn;
+ switch (state) {
+ case STARTING:
+ toReturn = ClusterInstanceState.STARTING;
+ break;
+ case STARTED:
+ toReturn = ClusterInstanceState.STARTED;
+ break;
+ case RESTARTING:
+ toReturn = ClusterInstanceState.RESTARTING;
+ break;
+ case RESTARTED:
+ toReturn = ClusterInstanceState.RESTARTED;
+ break;
+ case PAUSING:
+ toReturn = ClusterInstanceState.PAUSING;
+ break;
+ case PAUSED:
+ toReturn = ClusterInstanceState.PAUSED;
+ break;
+ case RESUMING:
+ toReturn = ClusterInstanceState.RESUMING;
+ break;
+ case RESUMED:
+ toReturn = ClusterInstanceState.RESUMED;
+ break;
+ case SHUTTING_DOWN:
+ toReturn = ClusterInstanceState.SHUTTING_DOWN;
+ break;
+ case SHUTDOWN:
+ toReturn = ClusterInstanceState.SHUTDOWN;
+ break;
+ case CLIENT_CONNECTION_LOST:
+ toReturn = ClusterInstanceState.CLIENT_CONNECTION_LOST;
+ break;
+ case CLIENT_CONNECTION_OPENING:
+ toReturn = ClusterInstanceState.CLIENT_CONNECTION_OPENING;
+ break;
+ case CLIENT_CONNECTION_OPENED:
+ toReturn = ClusterInstanceState.CLIENT_CONNECTION_OPENED;
+ break;
+ default:
+ toReturn = ClusterInstanceState.UNKNOWN;
+ break;
+ }
+ return toReturn;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/ClusterProxy.java b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/ClusterProxy.java
new file mode 100644
index 00000000000..d872e83e13d
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/ClusterProxy.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.hazelcast.internal;
+
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.osee.cluster.admin.Cluster;
+import org.eclipse.osee.cluster.admin.Member;
+import com.hazelcast.core.HazelcastInstance;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ClusterProxy implements Cluster {
+
+ private final HazelcastInstance instance;
+
+ public ClusterProxy(HazelcastInstance instance) {
+ this.instance = instance;
+ }
+
+ @Override
+ public Set<Member> getMembers() {
+ Set<Member> members = new HashSet<Member>();
+ for (com.hazelcast.core.Member member : getProxyObject().getMembers()) {
+ members.add(new MemberProxy(member));
+ }
+ return members;
+ }
+
+ @Override
+ public Member getLocalMember() {
+ return new MemberProxy(getProxyObject().getLocalMember());
+ }
+
+ @Override
+ public long getClusterTime() {
+ return getProxyObject().getClusterTime();
+ }
+
+ protected com.hazelcast.core.Cluster getProxyObject() {
+ return instance.getCluster();
+ }
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedBlockingQueueProxy.java b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedBlockingQueueProxy.java
new file mode 100644
index 00000000000..5243c0d6adb
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedBlockingQueueProxy.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.hazelcast.internal;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.concurrent.TimeUnit;
+import org.eclipse.osee.distributed.DistributedBlockingQueue;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DistributedBlockingQueueProxy<E> implements DistributedBlockingQueue<E> {
+
+ private final com.hazelcast.core.IQueue<E> proxyObject;
+
+ public DistributedBlockingQueueProxy(com.hazelcast.core.IQueue<E> proxyObject) {
+ super();
+ this.proxyObject = proxyObject;
+ }
+
+ @Override
+ public Object getId() {
+ return proxyObject.getId();
+ }
+
+ @Override
+ public void dispose() {
+ proxyObject.destroy();
+ }
+
+ @Override
+ public String getName() {
+ return proxyObject.getName();
+ }
+
+ @Override
+ public E remove() {
+ return proxyObject.remove();
+ }
+
+ @Override
+ public E poll() {
+ return proxyObject.poll();
+ }
+
+ @Override
+ public E element() {
+ return proxyObject.element();
+ }
+
+ @Override
+ public E peek() {
+ return proxyObject.peek();
+ }
+
+ @Override
+ public int size() {
+ return proxyObject.size();
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return proxyObject.isEmpty();
+ }
+
+ @Override
+ public Iterator<E> iterator() {
+ return proxyObject.iterator();
+ }
+
+ @Override
+ public Object[] toArray() {
+ return proxyObject.toArray();
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return proxyObject.toArray(a);
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return proxyObject.containsAll(c);
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends E> c) {
+ return proxyObject.containsAll(c);
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return proxyObject.removeAll(c);
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return proxyObject.retainAll(c);
+ }
+
+ @Override
+ public void clear() {
+ proxyObject.clear();
+ }
+
+ @Override
+ public boolean add(E e) {
+ return proxyObject.add(e);
+ }
+
+ @Override
+ public boolean offer(E e) {
+ return proxyObject.offer(e);
+ }
+
+ @Override
+ public void put(E e) throws InterruptedException {
+ proxyObject.put(e);
+ }
+
+ @Override
+ public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException {
+ return proxyObject.offer(e, timeout, unit);
+ }
+
+ @Override
+ public E take() throws InterruptedException {
+ return proxyObject.take();
+ }
+
+ @Override
+ public E poll(long timeout, TimeUnit unit) {
+ return proxyObject.poll();
+ }
+
+ @Override
+ public int remainingCapacity() {
+ return proxyObject.remainingCapacity();
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return proxyObject.remove(o);
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return proxyObject.contains(o);
+ }
+
+ @Override
+ public int drainTo(Collection<? super E> c) {
+ return proxyObject.drainTo(c);
+ }
+
+ @Override
+ public int drainTo(Collection<? super E> c, int maxElements) {
+ return proxyObject.drainTo(c, maxElements);
+ }
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedExecutorServiceImpl.java b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedExecutorServiceImpl.java
new file mode 100644
index 00000000000..72b7c69e454
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedExecutorServiceImpl.java
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.hazelcast.internal;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import org.eclipse.osee.cluster.admin.Callback;
+import org.eclipse.osee.cluster.admin.DistributedExecutorService;
+import org.eclipse.osee.cluster.admin.Member;
+import com.hazelcast.core.DistributedTask;
+import com.hazelcast.core.ExecutionCallback;
+import com.hazelcast.core.HazelcastInstance;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DistributedExecutorServiceImpl implements DistributedExecutorService {
+
+ private final HazelcastInstance instance;
+
+ public DistributedExecutorServiceImpl(HazelcastInstance instance) {
+ this.instance = instance;
+ }
+
+ private ExecutorService getProxyObject() {
+ return instance.getExecutorService();
+ }
+
+ @Override
+ public void shutdown() {
+ getProxyObject().shutdown();
+ }
+
+ @Override
+ public List<Runnable> shutdownNow() {
+ return getProxyObject().shutdownNow();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ return getProxyObject().isShutdown();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return getProxyObject().isTerminated();
+ }
+
+ @Override
+ public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
+ return getProxyObject().awaitTermination(timeout, unit);
+ }
+
+ @Override
+ public <T> Future<T> submit(Callable<T> task) {
+ return getProxyObject().submit(task);
+ }
+
+ @Override
+ public <T> Future<T> submit(Runnable task, T result) {
+ return getProxyObject().submit(task, result);
+ }
+
+ @Override
+ public Future<?> submit(Runnable task) {
+ return getProxyObject().submit(task);
+ }
+
+ @Override
+ public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException {
+ return getProxyObject().invokeAll(tasks);
+ }
+
+ @Override
+ public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException {
+ return getProxyObject().invokeAll(tasks, timeout, unit);
+ }
+
+ @Override
+ public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException {
+ return getProxyObject().invokeAny(tasks);
+ }
+
+ @Override
+ public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
+ return getProxyObject().invokeAny(tasks, timeout, unit);
+ }
+
+ @Override
+ public void execute(Runnable command) {
+ getProxyObject().execute(command);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> Future<T> submit(Callable<T> worker, Callback<T> callback) {
+ DistributedTask<T> task = new DistributedTask<T>(worker);
+ addCallback(task, callback);
+ return (Future<T>) getProxyObject().submit(task);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> Future<T> submitOnKeyOwner(Callable<T> worker, Callback<T> callback, Object key) {
+ DistributedTask<T> task = new DistributedTask<T>(worker, key);
+ addCallback(task, callback);
+ return (Future<T>) getProxyObject().submit(task);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> Future<T> submitOnMember(Callable<T> worker, Callback<T> callback, Member member) {
+ MemberProxy memberProxy = (MemberProxy) member;
+ DistributedTask<T> task = new DistributedTask<T>(worker, memberProxy.getProxyObject());
+ addCallback(task, callback);
+ return (Future<T>) getProxyObject().submit(task);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> Future<T> submitOnMembers(Callable<T> worker, Callback<T> callback, Set<Member> members) {
+ Set<com.hazelcast.core.Member> xMembers = new HashSet<com.hazelcast.core.Member>();
+ for (Member member : members) {
+ MemberProxy memberProxy = (MemberProxy) member;
+ xMembers.add(memberProxy.getProxyObject());
+ }
+ DistributedTask<T> task = new DistributedTask<T>(worker, xMembers);
+ addCallback(task, callback);
+ return (Future<T>) getProxyObject().submit(task);
+ }
+
+ private <T> void addCallback(final DistributedTask<T> task, final Callback<T> callback) {
+ if (callback != null) {
+ ExecutionCallback<T> execCallback = new ExecutionCallback<T>() {
+ @Override
+ public void done(Future<T> future) {
+ callback.done(future);
+ }
+ };
+ task.setExecutionCallback(execCallback);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedIdProxy.java b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedIdProxy.java
new file mode 100644
index 00000000000..6ae5a935b1b
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedIdProxy.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.hazelcast.internal;
+
+import org.eclipse.osee.distributed.DistributedId;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DistributedIdProxy implements DistributedId {
+
+ private final com.hazelcast.core.IdGenerator proxyObject;
+
+ public DistributedIdProxy(com.hazelcast.core.IdGenerator proxyObject) {
+ super();
+ this.proxyObject = proxyObject;
+ }
+
+ @Override
+ public Object getId() {
+ return proxyObject.getId();
+ }
+
+ @Override
+ public void dispose() {
+ proxyObject.destroy();
+ }
+
+ @Override
+ public String getName() {
+ return proxyObject.getName();
+ }
+
+ @Override
+ public long newId() {
+ return proxyObject.newId();
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedListProxy.java b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedListProxy.java
new file mode 100644
index 00000000000..01c415f01d7
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedListProxy.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.hazelcast.internal;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.osee.distributed.DistributedList;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DistributedListProxy<E> implements DistributedList<E> {
+
+ private final com.hazelcast.core.IList<E> proxyObject;
+
+ public DistributedListProxy(com.hazelcast.core.IList<E> proxyObject) {
+ super();
+ this.proxyObject = proxyObject;
+ }
+
+ @Override
+ public Object getId() {
+ return proxyObject.getId();
+ }
+
+ @Override
+ public void dispose() {
+ proxyObject.destroy();
+ }
+
+ @Override
+ public String getName() {
+ return proxyObject.getName();
+ }
+
+ @Override
+ public int size() {
+ return proxyObject.size();
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return proxyObject.isEmpty();
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return proxyObject.contains(o);
+ }
+
+ @Override
+ public Iterator<E> iterator() {
+ return proxyObject.iterator();
+ }
+
+ @Override
+ public Object[] toArray() {
+ return proxyObject.toArray();
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return proxyObject.toArray(a);
+ }
+
+ @Override
+ public boolean add(E e) {
+ return proxyObject.add(e);
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return proxyObject.remove(o);
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return proxyObject.containsAll(c);
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends E> c) {
+ return proxyObject.addAll(c);
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends E> c) {
+ return proxyObject.addAll(index, c);
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return proxyObject.removeAll(c);
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return proxyObject.retainAll(c);
+ }
+
+ @Override
+ public void clear() {
+ proxyObject.clear();
+ }
+
+ @Override
+ public E get(int index) {
+ return proxyObject.get(index);
+ }
+
+ @Override
+ public E set(int index, E element) {
+ return proxyObject.set(index, element);
+ }
+
+ @Override
+ public void add(int index, E element) {
+ proxyObject.add(index, element);
+ }
+
+ @Override
+ public E remove(int index) {
+ return proxyObject.remove(index);
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return proxyObject.indexOf(o);
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return proxyObject.lastIndexOf(o);
+ }
+
+ @Override
+ public ListIterator<E> listIterator() {
+ return proxyObject.listIterator();
+ }
+
+ @Override
+ public ListIterator<E> listIterator(int index) {
+ return proxyObject.listIterator(index);
+ }
+
+ @Override
+ public List<E> subList(int fromIndex, int toIndex) {
+ return proxyObject.subList(fromIndex, toIndex);
+ }
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedLockProxy.java b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedLockProxy.java
new file mode 100644
index 00000000000..44e8a717562
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedLockProxy.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.hazelcast.internal;
+
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import org.eclipse.osee.distributed.DistributedLock;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DistributedLockProxy implements DistributedLock {
+
+ private final com.hazelcast.core.ILock proxyObject;
+
+ public DistributedLockProxy(com.hazelcast.core.ILock proxyObject) {
+ super();
+ this.proxyObject = proxyObject;
+ }
+
+ @Override
+ public Object getId() {
+ return proxyObject.getId();
+ }
+
+ @Override
+ public void dispose() {
+ proxyObject.destroy();
+ }
+
+ @Override
+ public Object getObjectLocked() {
+ return proxyObject.getLockObject();
+ }
+
+ @Override
+ public void lock() {
+ proxyObject.lock();
+ }
+
+ @Override
+ public void lockInterruptibly() throws InterruptedException {
+ proxyObject.lockInterruptibly();
+ }
+
+ @Override
+ public boolean tryLock() {
+ return proxyObject.tryLock();
+ }
+
+ @Override
+ public boolean tryLock(long time, TimeUnit unit) throws InterruptedException {
+ return proxyObject.tryLock(time, unit);
+ }
+
+ @Override
+ public void unlock() {
+ proxyObject.unlock();
+ }
+
+ @Override
+ public Condition newCondition() {
+ return proxyObject.newCondition();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedMapProxy.java b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedMapProxy.java
new file mode 100644
index 00000000000..d0aba657730
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedMapProxy.java
@@ -0,0 +1,258 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.hazelcast.internal;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import org.eclipse.osee.distributed.DistributedMap;
+import org.eclipse.osee.distributed.Predicate;
+import com.hazelcast.core.MapEntry;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DistributedMapProxy<K, V> implements DistributedMap<K, V> {
+
+ private final com.hazelcast.core.IMap<K, V> proxyObject;
+
+ public DistributedMapProxy(com.hazelcast.core.IMap<K, V> proxyObject) {
+ super();
+ this.proxyObject = proxyObject;
+ }
+
+ @Override
+ public Object getId() {
+ return proxyObject.getId();
+ }
+
+ @Override
+ public void dispose() {
+ proxyObject.destroy();
+ }
+
+ @Override
+ public String getName() {
+ return proxyObject.getName();
+ }
+
+ @Override
+ public V putIfAbsent(K key, V value) {
+ return proxyObject.putIfAbsent(key, value);
+ }
+
+ @Override
+ public boolean remove(Object key, Object value) {
+ return proxyObject.remove(key, value);
+ }
+
+ @Override
+ public boolean replace(K key, V oldValue, V newValue) {
+ return proxyObject.replace(key, oldValue, newValue);
+ }
+
+ @Override
+ public V replace(K key, V value) {
+ return proxyObject.replace(key, value);
+ }
+
+ @Override
+ public int size() {
+ return proxyObject.size();
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return proxyObject.isEmpty();
+ }
+
+ @Override
+ public boolean containsKey(Object key) {
+ return proxyObject.containsKey(key);
+ }
+
+ @Override
+ public boolean containsValue(Object value) {
+ return proxyObject.containsValue(value);
+ }
+
+ @Override
+ public V get(Object key) {
+ return proxyObject.get(key);
+ }
+
+ @Override
+ public V put(K key, V value) {
+ return proxyObject.put(key, value);
+ }
+
+ @Override
+ public V remove(Object key) {
+ return proxyObject.remove(key);
+ }
+
+ @Override
+ public void putAll(Map<? extends K, ? extends V> m) {
+ proxyObject.putAll(m);
+ }
+
+ @Override
+ public void clear() {
+ proxyObject.clear();
+ }
+
+ @Override
+ public Set<K> keySet() {
+ return proxyObject.keySet();
+ }
+
+ @Override
+ public Collection<V> values() {
+ return proxyObject.values();
+ }
+
+ @Override
+ public Set<java.util.Map.Entry<K, V>> entrySet() {
+ return proxyObject.entrySet();
+ }
+
+ @Override
+ public void flush() {
+ proxyObject.flush();
+ }
+
+ @Override
+ public Map<K, V> getAll(Set<K> keys) {
+ return proxyObject.getAll(keys);
+ }
+
+ @Override
+ public Future<V> getAsync(K key) {
+ return proxyObject.getAsync(key);
+ }
+
+ @Override
+ public Future<V> putAsync(K key, V value) {
+ return proxyObject.putAsync(key, value);
+ }
+
+ @Override
+ public Future<V> removeAsync(K key) {
+ return proxyObject.removeAsync(key);
+ }
+
+ @Override
+ public Object tryRemove(K key, long timeout, TimeUnit timeunit) throws TimeoutException {
+ return proxyObject.tryRemove(key, timeout, timeunit);
+ }
+
+ @Override
+ public boolean tryPut(K key, V value, long timeout, TimeUnit timeunit) {
+ return proxyObject.tryPut(key, value, timeout, timeunit);
+ }
+
+ @Override
+ public V put(K key, V value, long ttl, TimeUnit timeunit) {
+ return proxyObject.put(key, value, ttl, timeunit);
+ }
+
+ @Override
+ public void putTransient(K key, V value, long ttl, TimeUnit timeunit) {
+ proxyObject.putTransient(key, value, ttl, timeunit);
+ }
+
+ @Override
+ public V putIfAbsent(K key, V value, long ttl, TimeUnit timeunit) {
+ return proxyObject.putIfAbsent(key, value, ttl, timeunit);
+ }
+
+ @Override
+ public V tryLockAndGet(K key, long time, TimeUnit timeunit) throws TimeoutException {
+ return proxyObject.tryLockAndGet(key, time, timeunit);
+ }
+
+ @Override
+ public void putAndUnlock(K key, V value) {
+ proxyObject.putAndUnlock(key, value);
+ }
+
+ @Override
+ public void lock(K key) {
+ proxyObject.lock(key);
+ }
+
+ @Override
+ public boolean tryLock(K key) {
+ return proxyObject.tryLock(key);
+ }
+
+ @Override
+ public boolean tryLock(K key, long time, TimeUnit timeunit) {
+ return proxyObject.tryLock(key, time, timeunit);
+ }
+
+ @Override
+ public void unlock(K key) {
+ proxyObject.unlock(key);
+ }
+
+ @Override
+ public boolean lockMap(long time, TimeUnit timeunit) {
+ return proxyObject.lockMap(time, timeunit);
+ }
+
+ @Override
+ public void unlockMap() {
+ proxyObject.unlockMap();
+ }
+
+ @Override
+ public java.util.Map.Entry<K, V> getMapEntry(K key) {
+ return proxyObject.getMapEntry(key);
+ }
+
+ @Override
+ public boolean evict(Object key) {
+ return proxyObject.evict(key);
+ }
+
+ @Override
+ public Set<K> keySet(Predicate<K, V> predicate) {
+ return proxyObject.keySet(toPredicate(predicate));
+ }
+
+ @Override
+ public Set<java.util.Map.Entry<K, V>> entrySet(Predicate<K, V> predicate) {
+ return proxyObject.entrySet(toPredicate(predicate));
+ }
+
+ @Override
+ public Collection<V> values(Predicate<K, V> predicate) {
+ return proxyObject.values(toPredicate(predicate));
+ }
+
+ private com.hazelcast.query.Predicate<K, V> toPredicate(final Predicate<K, V> predicate) {
+ com.hazelcast.query.Predicate<K, V> toReturn = new com.hazelcast.query.Predicate<K, V>() {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public boolean apply(MapEntry<K, V> mapEntry) {
+ return predicate.apply(mapEntry);
+ }
+ };
+ return toReturn;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedMultiMapProxy.java b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedMultiMapProxy.java
new file mode 100644
index 00000000000..1e52438b6fd
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedMultiMapProxy.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.hazelcast.internal;
+
+import java.util.Collection;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import org.eclipse.osee.distributed.DistributedMultiMap;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DistributedMultiMapProxy<K, V> implements DistributedMultiMap<K, V> {
+
+ private final com.hazelcast.core.MultiMap<K, V> proxyObject;
+
+ public DistributedMultiMapProxy(com.hazelcast.core.MultiMap<K, V> proxyObject) {
+ super();
+ this.proxyObject = proxyObject;
+ }
+
+ @Override
+ public Object getId() {
+ return proxyObject.getId();
+ }
+
+ @Override
+ public void dispose() {
+ proxyObject.destroy();
+ }
+
+ @Override
+ public String getName() {
+ return proxyObject.getName();
+ }
+
+ @Override
+ public boolean put(K key, V value) {
+ return proxyObject.put(key, value);
+ }
+
+ @Override
+ public Collection<V> get(K key) {
+ return proxyObject.get(key);
+ }
+
+ @Override
+ public boolean remove(Object key, Object value) {
+ return proxyObject.remove(key, value);
+ }
+
+ @Override
+ public Collection<V> remove(Object key) {
+ return proxyObject.remove(key);
+ }
+
+ @Override
+ public Set<K> keySet() {
+ return proxyObject.keySet();
+ }
+
+ @Override
+ public Collection<V> values() {
+ return proxyObject.values();
+ }
+
+ @Override
+ public Set<Entry<K, V>> entrySet() {
+ return proxyObject.entrySet();
+ }
+
+ @Override
+ public boolean containsKey(K key) {
+ return proxyObject.containsKey(key);
+ }
+
+ @Override
+ public boolean containsValue(Object value) {
+ return proxyObject.containsValue(value);
+ }
+
+ @Override
+ public boolean containsEntry(K key, V value) {
+ return proxyObject.containsEntry(key, value);
+ }
+
+ @Override
+ public int size() {
+ return proxyObject.size();
+ }
+
+ @Override
+ public void clear() {
+ proxyObject.clear();
+ }
+
+ @Override
+ public int valueCount(K key) {
+ return proxyObject.valueCount(key);
+ }
+
+ @Override
+ public void lock(K key) {
+ proxyObject.lock(key);
+ }
+
+ @Override
+ public boolean tryLock(K key) {
+ return proxyObject.tryLock(key);
+ }
+
+ @Override
+ public boolean tryLock(K key, long time, TimeUnit timeunit) {
+ return proxyObject.tryLock(key, time, timeunit);
+ }
+
+ @Override
+ public void unlock(K key) {
+ proxyObject.unlock(key);
+ }
+
+ @Override
+ public boolean lockMap(long time, TimeUnit timeunit) {
+ return proxyObject.lockMap(time, timeunit);
+ }
+
+ @Override
+ public void unlockMap() {
+ proxyObject.unlockMap();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedSetProxy.java b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedSetProxy.java
new file mode 100644
index 00000000000..3f506c5d321
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/DistributedSetProxy.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.hazelcast.internal;
+
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.osee.distributed.DistributedSet;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DistributedSetProxy<E> implements DistributedSet<E> {
+
+ private final com.hazelcast.core.ISet<E> proxyObject;
+
+ public DistributedSetProxy(com.hazelcast.core.ISet<E> proxyObject) {
+ super();
+ this.proxyObject = proxyObject;
+ }
+
+ @Override
+ public Object getId() {
+ return proxyObject.getId();
+ }
+
+ @Override
+ public void dispose() {
+ proxyObject.destroy();
+ }
+
+ @Override
+ public String getName() {
+ return proxyObject.getName();
+ }
+
+ @Override
+ public int size() {
+ return proxyObject.size();
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return proxyObject.isEmpty();
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return proxyObject.contains(o);
+ }
+
+ @Override
+ public Iterator<E> iterator() {
+ return proxyObject.iterator();
+ }
+
+ @Override
+ public Object[] toArray() {
+ return proxyObject.toArray();
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return proxyObject.toArray(a);
+ }
+
+ @Override
+ public boolean add(E e) {
+ return proxyObject.add(e);
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return proxyObject.remove(o);
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return proxyObject.containsAll(c);
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends E> c) {
+ return proxyObject.addAll(c);
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return proxyObject.retainAll(c);
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return proxyObject.removeAll(c);
+ }
+
+ @Override
+ public void clear() {
+ proxyObject.clear();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/MemberProxy.java b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/MemberProxy.java
new file mode 100644
index 00000000000..cd7cc8319be
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/MemberProxy.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.hazelcast.internal;
+
+import java.net.InetSocketAddress;
+import org.eclipse.osee.cluster.admin.Member;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class MemberProxy implements Member {
+
+ private final com.hazelcast.core.Member member;
+
+ public MemberProxy(com.hazelcast.core.Member member) {
+ super();
+ this.member = member;
+ }
+
+ @Override
+ public boolean isLocal() {
+ return member.localMember();
+ }
+
+ @Override
+ public InetSocketAddress getInetSocketAddress() {
+ return member.getInetSocketAddress();
+ }
+
+ @Override
+ public boolean hasData() {
+ return !member.isSuperClient();
+ }
+
+ protected com.hazelcast.core.Member getProxyObject() {
+ return member;
+ }
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/TransactionProxy.java b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/TransactionProxy.java
new file mode 100644
index 00000000000..77bd008b236
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.hazelcast/src/org/eclipse/osee/cluster/admin/hazelcast/internal/TransactionProxy.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.hazelcast.internal;
+
+import org.eclipse.osee.cluster.admin.Transaction;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class TransactionProxy implements Transaction {
+
+ private final com.hazelcast.core.Transaction txn;
+
+ /**
+ * Isolation is always <tt>READ_COMMITTED</tt> . If you are in a transaction, you can read the data in your
+ * transaction and the data that is already committed and if not in a transaction, you can only read the committed
+ * data. Implementation is different for queue and map/set. For queue operations (offer,poll), offered and/or polled
+ * objects are copied to the next member in order to safely commit/rollback. For map/set, impl first acquires the
+ * locks for the write operations (put, remove) and holds the differences (what is added/removed/updated) locally for
+ * each transaction. When transaction is set to commit, impl will release the locks and apply the differences. When
+ * rolling back, impl will simply releases the locks and discard the differences. Transaction instance is attached to
+ * the current thread and each operation checks if the current thread holds a transaction, if so, operation will be
+ * transaction aware. When transaction is committed, rolled back or timed out, it will be detached from the thread
+ * holding it.
+ */
+ public TransactionProxy(com.hazelcast.core.Transaction txn) {
+ super();
+ this.txn = txn;
+ }
+
+ @Override
+ public void begin() throws IllegalStateException {
+ txn.begin();
+ }
+
+ @Override
+ public void commit() throws IllegalStateException {
+ txn.commit();
+ }
+
+ @Override
+ public void rollback() throws IllegalStateException {
+ txn.rollback();
+ }
+
+ @Override
+ public TransactionStatus getStatus() {
+ TransactionStatus toReturn;
+ int txStatus = txn.getStatus();
+ switch (txStatus) {
+ case com.hazelcast.core.Transaction.TXN_STATUS_NO_TXN:
+ toReturn = TransactionStatus.NO_TXN;
+ break;
+ case com.hazelcast.core.Transaction.TXN_STATUS_ACTIVE:
+ toReturn = TransactionStatus.ACTIVE;
+ break;
+ case com.hazelcast.core.Transaction.TXN_STATUS_PREPARED:
+ toReturn = TransactionStatus.PREPARED;
+ break;
+ case com.hazelcast.core.Transaction.TXN_STATUS_COMMITTED:
+ toReturn = TransactionStatus.COMMITTED;
+ break;
+ case com.hazelcast.core.Transaction.TXN_STATUS_ROLLED_BACK:
+ toReturn = TransactionStatus.ROLLED_BACK;
+ break;
+ case com.hazelcast.core.Transaction.TXN_STATUS_PREPARING:
+ toReturn = TransactionStatus.PREPARING;
+ break;
+ case com.hazelcast.core.Transaction.TXN_STATUS_COMMITTING:
+ toReturn = TransactionStatus.COMMITTING;
+ break;
+ case com.hazelcast.core.Transaction.TXN_STATUS_ROLLING_BACK:
+ toReturn = TransactionStatus.ROLLING_BACK;
+ break;
+ default:
+ toReturn = TransactionStatus.UNKNOWN;
+ break;
+ }
+ return toReturn;
+ }
+
+ protected com.hazelcast.core.Transaction getProxyObject() {
+ return txn;
+ }
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.rest/.classpath b/plugins/org.eclipse.osee.cluster.admin.rest/.classpath
new file mode 100644
index 00000000000..ad32c83a788
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.rest/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.cluster.admin.rest/.project b/plugins/org.eclipse.osee.cluster.admin.rest/.project
new file mode 100644
index 00000000000..d160a993d51
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.rest/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.cluster.admin.rest</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.cluster.admin.rest/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.cluster.admin.rest/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..cceaf335645
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.rest/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Cluster Admin Rest
+Bundle-SymbolicName: org.eclipse.osee.cluster.admin.rest
+Bundle-Version: 0.9.9.qualifier
+Bundle-Vendor: Eclipse Open System Engineering Environment
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Service-Component: OSGI-INF/*.xml
+Import-Package: javax.ws.rs,
+ javax.ws.rs.core,
+ org.eclipse.osee.cluster.admin
diff --git a/plugins/org.eclipse.osee.cluster.admin.rest/OSGI-INF/cluster.admin.application.xml b/plugins/org.eclipse.osee.cluster.admin.rest/OSGI-INF/cluster.admin.application.xml
new file mode 100644
index 00000000000..bd67abfd3c1
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.rest/OSGI-INF/cluster.admin.application.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osee.cluster.admin.rest.internal.ClusterAdminApplication">
+ <implementation class="org.eclipse.osee.cluster.admin.rest.internal.ClusterAdminApplication"/>
+ <service>
+ <provide interface="javax.ws.rs.core.Application"/>
+ </service>
+ <property name="context.name" type="String" value="clusterAdmin"/>
+ <reference bind="setClusterAdmin" cardinality="1..1" interface="org.eclipse.osee.cluster.admin.ClusterAdmin" name="ClusterAdmin" policy="static"/>
+</scr:component> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.cluster.admin.rest/build.properties b/plugins/org.eclipse.osee.cluster.admin.rest/build.properties
new file mode 100644
index 00000000000..b07384a9d60
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.rest/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/
+additional.bundles = org.eclipse.osee.cluster.admin,\
+ javax.ws.rs
diff --git a/plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/ClusterAdminApplication.java b/plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/ClusterAdminApplication.java
new file mode 100644
index 00000000000..9d614ff20b3
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/ClusterAdminApplication.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.rest.internal;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.ws.rs.core.Application;
+import org.eclipse.osee.cluster.admin.ClusterAdmin;
+import org.eclipse.osee.cluster.admin.Member;
+
+/**
+ * A service for clients to obtain information about the cluster.
+ *
+ * @author Roberto E. Escobar
+ */
+public class ClusterAdminApplication extends Application {
+
+ private static ClusterAdmin clusterAdmin;
+
+ public void setClusterAdmin(ClusterAdmin clusterAdmin) {
+ ClusterAdminApplication.clusterAdmin = clusterAdmin;
+ }
+
+ public static ClusterAdmin getClusterAdmin() {
+ return clusterAdmin;
+ }
+
+ public static Set<Member> getMembers() {
+ ClusterAdmin admin = ClusterAdminApplication.getClusterAdmin();
+ return admin.getCluster().getMembers();
+ }
+
+ @Override
+ public Set<Class<?>> getClasses() {
+ Set<Class<?>> resources = new HashSet<Class<?>>();
+ resources.add(MembersResource.class);
+ resources.add(JobsResource.class);
+ return resources;
+ }
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/ClusterUtil.java b/plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/ClusterUtil.java
new file mode 100644
index 00000000000..01c885d057d
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/ClusterUtil.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.rest.internal;
+
+import java.net.InetSocketAddress;
+import org.eclipse.osee.cluster.admin.Member;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class ClusterUtil {
+
+ private ClusterUtil() {
+ // Utility class
+ }
+
+ public static String asId(InetSocketAddress address) {
+ return address.toString();
+ }
+
+ public static XmlMember fromMember(Member member) {
+ return new XmlMember(member.getInetSocketAddress().toString(), member.hasData(), member.isLocal());
+ }
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/JobsResource.java b/plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/JobsResource.java
new file mode 100644
index 00000000000..063298829ba
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/JobsResource.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.rest.internal;
+
+import javax.ws.rs.Path;
+
+/**
+ * @author Roberto E. Escobar
+ */
+@Path("jobs")
+public class JobsResource {
+ //
+ // GET /jobs/ gets list of jobs
+ //
+ // One user methods:
+ //
+ // GET /jobs/[jobId] gets job details
+ // DELETE /jobs/[jobId] deletes a job - stops/cancels ?
+ //
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/MemberResource.java b/plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/MemberResource.java
new file mode 100644
index 00000000000..b1b94150479
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/MemberResource.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.rest.internal;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.UriInfo;
+import org.eclipse.osee.cluster.admin.ClusterAdmin;
+import org.eclipse.osee.cluster.admin.Member;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class MemberResource {
+
+ @Context
+ UriInfo uriInfo;
+ @Context
+ Request request;
+ String id;
+
+ public MemberResource(UriInfo uriInfo, Request request, String id) {
+ this.uriInfo = uriInfo;
+ this.request = request;
+ this.id = id;
+ }
+
+ @GET
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ public XmlMember getMember() {
+ XmlMember toReturn = toXmlMember(id);
+ if (toReturn == null) {
+ throw new RuntimeException("Get: Member with " + id + " not found");
+ }
+ return toReturn;
+ }
+
+ @GET
+ @Produces(MediaType.TEXT_XML)
+ public XmlMember getMemberHTML() {
+ XmlMember toReturn = toXmlMember(id);
+ if (toReturn == null) {
+ throw new RuntimeException("Get: Member with " + id + " not found");
+ }
+ return toReturn;
+ }
+
+ private XmlMember toXmlMember(String id) {
+ XmlMember toReturn = null;
+ ClusterAdmin admin = ClusterAdminApplication.getClusterAdmin();
+ for (Member member : admin.getCluster().getMembers()) {
+ String memberId = ClusterUtil.asId(member.getInetSocketAddress());
+ if (memberId.equals(id)) {
+ toReturn = ClusterUtil.fromMember(member);
+ break;
+ }
+ }
+ return toReturn;
+ }
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/MembersResource.java b/plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/MembersResource.java
new file mode 100644
index 00000000000..94cba8f5b81
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/MembersResource.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.rest.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.UriInfo;
+import org.eclipse.osee.cluster.admin.Member;
+
+/**
+ * @author Roberto E. Escobar
+ */
+@Path("members")
+public class MembersResource {
+
+ @Context
+ UriInfo uriInfo;
+ @Context
+ Request request;
+
+ @GET
+ @Produces(MediaType.TEXT_XML)
+ public List<XmlMember> getMemberBrowser() {
+ List<XmlMember> todos = new ArrayList<XmlMember>();
+ for (Member member : ClusterAdminApplication.getMembers()) {
+ todos.add(ClusterUtil.fromMember(member));
+ }
+ return todos;
+ }
+
+ @GET
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ public List<XmlMember> getMembers() {
+ List<XmlMember> todos = new ArrayList<XmlMember>();
+ for (Member member : ClusterAdminApplication.getMembers()) {
+ todos.add(ClusterUtil.fromMember(member));
+ }
+ return todos;
+ }
+
+ @GET
+ @Path("count")
+ @Produces(MediaType.TEXT_PLAIN)
+ public String getCount() {
+ int count = ClusterAdminApplication.getMembers().size();
+ return String.valueOf(count);
+ }
+
+ @Path("{member}")
+ public MemberResource getTodo(@PathParam("member") String id) {
+ return new MemberResource(uriInfo, request, id);
+ }
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/XmlMember.java b/plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/XmlMember.java
new file mode 100644
index 00000000000..83f822bccc5
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin.rest/src/org/eclipse/osee/cluster/admin/rest/internal/XmlMember.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin.rest.internal;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "member", namespace = "members")
+public class XmlMember {
+
+ private String socketAddress;
+ private boolean hasData;
+ private boolean localMember;
+
+ public XmlMember() {
+ super();
+ }
+
+ public XmlMember(String socketAddress, boolean hasData, boolean localMember) {
+ super();
+ this.socketAddress = socketAddress;
+ this.hasData = hasData;
+ this.localMember = localMember;
+ }
+
+ public boolean isLocal() {
+ return localMember;
+ }
+
+ public String getSocketAddress() {
+ return socketAddress;
+ }
+
+ public boolean hasData() {
+ return hasData;
+ }
+
+ public void setSocketAddress(String socketAddress) {
+ this.socketAddress = socketAddress;
+ }
+
+ public void setHasData(boolean hasData) {
+ this.hasData = hasData;
+ }
+
+ public void setLocal(boolean local) {
+ this.localMember = local;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin/.classpath b/plugins/org.eclipse.osee.cluster.admin/.classpath
new file mode 100644
index 00000000000..ad32c83a788
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.cluster.admin/.project b/plugins/org.eclipse.osee.cluster.admin/.project
new file mode 100644
index 00000000000..e329ec0dc01
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.cluster.admin</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.cluster.admin/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.cluster.admin/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..96e410d5bae
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Culster Admin
+Bundle-SymbolicName: org.eclipse.osee.cluster.admin
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: OSEE
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Export-Package: org.eclipse.osee.cluster.admin
diff --git a/plugins/org.eclipse.osee.cluster.admin/build.properties b/plugins/org.eclipse.osee.cluster.admin/build.properties
new file mode 100644
index 00000000000..34d2e4d2dad
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/Callback.java b/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/Callback.java
new file mode 100644
index 00000000000..15ecdf34050
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/Callback.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin;
+
+import java.util.concurrent.Future;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface Callback<V> {
+
+ void done(Future<V> future);
+
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/Cluster.java b/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/Cluster.java
new file mode 100644
index 00000000000..2ab3aaf1d60
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/Cluster.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin;
+
+import java.util.Set;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface Cluster {
+
+ /**
+ * Set of current cluster members
+ *
+ * @return cluster members
+ */
+ Set<Member> getMembers();
+
+ /**
+ * Returns the member running on the local machine
+ *
+ * @return this member
+ */
+ Member getLocalMember();
+
+ /**
+ * Returns the cluster-wide time
+ *
+ * @return cluster-wide time
+ */
+ long getClusterTime();
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/ClusterAdmin.java b/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/ClusterAdmin.java
new file mode 100644
index 00000000000..fe9482848e6
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/ClusterAdmin.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin;
+
+import java.util.concurrent.Callable;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface ClusterAdmin {
+
+ /**
+ * The name of this cluster instance
+ *
+ * @return name of this instance
+ */
+ String getName();
+
+ /**
+ * Returns the distributed executor service to execute <tt>Runnables</tt> and <tt>Callables</tt> on the cluster.
+ *
+ * @return distributed executor service of this cluster instance
+ */
+ DistributedExecutorService getExecutor();
+
+ /**
+ * Returns the Cluster that this instance is part of.
+ *
+ * @return cluster that this instance is part of
+ */
+ Cluster getCluster();
+
+ /**
+ * Returns the transaction instance associated with the current thread, creates a new one if it wasn't already.
+ * <p/>
+ * Transaction doesn't start until <tt>transaction.begin()</tt> is called and if a transaction is started then all
+ * transactional operations are automatically transactional.
+ *
+ * <pre>
+ * Map map = getMap(&quot;mymap&quot;);
+ * Transaction txn = clusterAdmin.getTransaction();
+ * txn.begin();
+ * try {
+ * map.put(&quot;key&quot;, &quot;value&quot;);
+ * txn.commit();
+ * } catch (Exception e) {
+ * txn.rollback();
+ * }
+ * </pre>
+ *
+ * @return transaction for the current thread
+ */
+ Transaction getTransaction();
+
+ /**
+ * Creates a callable with a default transaction/roll-back implementation.
+ *
+ * @return callable with transaction begin, commit, roll-back surrounding work
+ */
+ <T> Callable<T> createTxCallable(TransactionWork<T> work);
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/ClusterAdminConstants.java b/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/ClusterAdminConstants.java
new file mode 100644
index 00000000000..bba6084f9f3
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/ClusterAdminConstants.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ClusterAdminConstants {
+
+ public static final String CLUSTER_CONFIG_URL = "cluster.config.url";
+
+ public static final String CLUSTER_TOPIC_PREFIX = "org/eclipse/osee/cluster/admin/event/";
+ public static final String CLUSTER_REGISTRATION_EVENT = CLUSTER_TOPIC_PREFIX + "CLUSTER_MEMBER_REGISTRATION";
+ public static final String CLUSTER_DEREGISTRATION_EVENT = CLUSTER_TOPIC_PREFIX + "CLUSTER_MEMBER_DEREGISTRATION";
+
+ public static final String CLUSTER_LIFECYCLE_EVENT = CLUSTER_TOPIC_PREFIX + "CLUSTER_LIFECYCLE_STATE_CHANGED";
+ public static final String CLUSTER_LIFECYCLE_STATE = "cluster.state";
+
+ public static enum ClusterInstanceState {
+ STARTING,
+ STARTED,
+ RESTARTING,
+ RESTARTED,
+ PAUSING,
+ PAUSED,
+ RESUMING,
+ RESUMED,
+ SHUTTING_DOWN,
+ SHUTDOWN,
+ CLIENT_CONNECTION_LOST,
+ CLIENT_CONNECTION_OPENING,
+ CLIENT_CONNECTION_OPENED,
+ UNKNOWN;
+ }
+
+ public static final String CLUSTER_INSTANCE_CREATED_EVENT = CLUSTER_TOPIC_PREFIX + "CLUSTER_INSTANCE_CREATED";
+ public static final String CLUSTER_INSTANCE_DESTROYED_EVENT = CLUSTER_TOPIC_PREFIX + "CLUSTER_INSTANCE_DESTROYED";
+ public static final String CLUSTER_OBJECT_TYPE = "cluster.object.type";
+ public static final String CLUSTER_OBJECT_ID = "cluster.object.id";
+ public static final String CLUSTER_OBJECT = "cluster.object";
+
+ public static final String CLUSTER_MEMBER_ADDED_EVENT = CLUSTER_TOPIC_PREFIX + "CLUSTER_MEMBER_ADDED";
+ public static final String CLUSTER_MEMBER_REMOVED_EVENT = CLUSTER_TOPIC_PREFIX + "CLUSTER_MEMBER_REMOVED";
+ public static final String CLUSTER_MEMBER = "cluster.member";
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/ClusterServiceUtils.java b/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/ClusterServiceUtils.java
new file mode 100644
index 00000000000..2ff4d2ddfdd
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/ClusterServiceUtils.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class ClusterServiceUtils {
+
+ private ClusterServiceUtils() {
+ // Utility class
+ }
+
+ public static Map<String, Object> toMap(String componentName, String contextName) {
+ Map<String, Object> data = new HashMap<String, Object>();
+ data.put("component.name", componentName);
+ data.put("context.name", contextName);
+ return data;
+ }
+
+ public static String getContextName(Map<String, Object> properties) {
+ String contextName = (String) properties.get("context.name");
+ if (!isValid(contextName)) {
+ contextName = getComponentName(properties);
+ }
+ return normalize(contextName);
+ }
+
+ public static String getComponentName(Map<String, Object> properties) {
+ return (String) properties.get("component.name");
+ }
+
+ private static boolean isValid(String value) {
+ return value != null && value.length() > 0;
+ }
+
+ private static String normalize(String contextName) {
+ return contextName != null && !contextName.startsWith("/") ? "/" + contextName : contextName;
+ }
+
+ public static String getConfigurationURL(Map<String, Object> properties) {
+ return (String) properties.get(ClusterAdminConstants.CLUSTER_CONFIG_URL);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/DistributedExecutorService.java b/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/DistributedExecutorService.java
new file mode 100644
index 00000000000..f39f132ce25
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/DistributedExecutorService.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin;
+
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface DistributedExecutorService extends ExecutorService {
+
+ <T> Future<T> submit(Callable<T> worker, Callback<T> callback);
+
+ <T> Future<T> submitOnKeyOwner(Callable<T> worker, Callback<T> callback, Object key);
+
+ <T> Future<T> submitOnMember(Callable<T> worker, Callback<T> callback, Member member);
+
+ <T> Future<T> submitOnMembers(Callable<T> worker, Callback<T> callback, Set<Member> members);
+}
diff --git a/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/Member.java b/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/Member.java
new file mode 100644
index 00000000000..4b093478bf9
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/Member.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin;
+
+import java.net.InetSocketAddress;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface Member {
+
+ /**
+ * Returns if this member is the local member.
+ *
+ * @return <tt>true<tt> if this member is the
+ * local member, <tt>false</tt> otherwise.
+ */
+ boolean isLocal();
+
+ /**
+ * Returns the InetSocketAddress of this member.
+ *
+ * @return InetSocketAddress of this member
+ */
+ InetSocketAddress getInetSocketAddress();
+
+ /**
+ * Returns if this cluster member holds any data on it.
+ *
+ * @return <tt>true</tt> if this member has data, <tt>false</tt> otherwise
+ */
+ boolean hasData();
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/Transaction.java b/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/Transaction.java
new file mode 100644
index 00000000000..9296b6544c6
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/Transaction.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface Transaction {
+
+ public static enum TransactionStatus {
+ NO_TXN,
+ ACTIVE,
+ PREPARED,
+ COMMITTED,
+ ROLLED_BACK,
+ PREPARING,
+ COMMITTING,
+ ROLLING_BACK,
+ UNKNOWN;
+ }
+
+ /**
+ * Creates a new transaction and associates it with the current thread.
+ *
+ * @throws IllegalStateException if transaction is already began
+ */
+ void begin() throws IllegalStateException;
+
+ /**
+ * Commits the transaction associated with the current thread.
+ *
+ * @throws IllegalStateException if transaction didn't begin.
+ */
+ void commit() throws IllegalStateException;
+
+ /**
+ * Rolls back the transaction associated with the current thread.
+ *
+ * @throws IllegalStateException if transaction didn't begin.
+ */
+ void rollback() throws IllegalStateException;
+
+ /**
+ * Returns the status of the transaction associated with the current thread.
+ *
+ * @return the status
+ */
+ TransactionStatus getStatus();
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/TransactionWork.java b/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/TransactionWork.java
new file mode 100644
index 00000000000..e7f523fece0
--- /dev/null
+++ b/plugins/org.eclipse.osee.cluster.admin/src/org/eclipse/osee/cluster/admin/TransactionWork.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.cluster.admin;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface TransactionWork<T> {
+
+ /**
+ * Gets the name of this transaction work section
+ *
+ * @return transaction work name
+ */
+ String getName();
+
+ /**
+ * Work section for this transaction
+ *
+ * @return T work result
+ * @throws Exception during work section
+ */
+ T doWork() throws Exception;
+
+ /**
+ * Handles errors from doWork section
+ */
+ void handleException(Throwable throwable);
+
+ /**
+ * Transaction work finally section. Will always be executed even if an error is encountered.
+ */
+ void handleTxFinally();
+} \ No newline at end of file

Back to the top