diff options
author | donald.g.dunne | 2018-01-26 18:16:43 +0000 |
---|---|---|
committer | donald.g.dunne | 2018-02-07 21:59:25 +0000 |
commit | 3fc7f704a7f213b1c5deab1fc2b4aca90f2be734 (patch) | |
tree | 12dfd7306e19c91188eec6caa9b5f8078d276634 /plugins | |
parent | 67801f3aef6ba3f18a9bf89c0560c2d7406c2b38 (diff) | |
download | org.eclipse.osee-3fc7f704a7f213b1c5deab1fc2b4aca90f2be734.tar.gz org.eclipse.osee-3fc7f704a7f213b1c5deab1fc2b4aca90f2be734.tar.xz org.eclipse.osee-3fc7f704a7f213b1c5deab1fc2b4aca90f2be734.zip |
feature[ats_TW6810]: Delete un-used osee.cluster bundles
Change-Id: I1daeb73a9b59ce475935233689d0f767ad6af486
Diffstat (limited to 'plugins')
44 files changed, 0 insertions, 2808 deletions
diff --git a/plugins/org.eclipse.osee.cluster.hazelcast/.classpath b/plugins/org.eclipse.osee.cluster.hazelcast/.classpath deleted file mode 100644 index 1fa3e6803d3..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <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.hazelcast/.project b/plugins/org.eclipse.osee.cluster.hazelcast/.project deleted file mode 100644 index d158a887d89..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/.project +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.osee.cluster.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.hazelcast/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.cluster.hazelcast/META-INF/MANIFEST.MF deleted file mode 100644 index bbd296e2956..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/META-INF/MANIFEST.MF +++ /dev/null @@ -1,16 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: OSEE Hazelcast Cluster -Bundle-SymbolicName: org.eclipse.osee.cluster.hazelcast -Bundle-Version: 0.25.3.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Import-Package: com.hazelcast.config, - com.hazelcast.core, - com.hazelcast.impl, - com.hazelcast.query, - org.eclipse.osee.cluster, - org.eclipse.osee.distributed, - org.eclipse.osee.event, - org.eclipse.osee.logger -Service-Component: OSGI-INF/*.xml -Bundle-Vendor: Eclipse Open System Engineering Environment diff --git a/plugins/org.eclipse.osee.cluster.hazelcast/OSGI-INF/cluster.service.impl.xml b/plugins/org.eclipse.osee.cluster.hazelcast/OSGI-INF/cluster.service.impl.xml deleted file mode 100644 index a84e9a6af4e..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/OSGI-INF/cluster.service.impl.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" enabled="true" name="org.eclipse.osee.cluster.hazelcast.internal.ClusterServiceImpl"> - <implementation class="org.eclipse.osee.cluster.hazelcast.internal.ClusterServiceImpl"/> - - <reference interface="org.eclipse.osee.event.EventService" name="EventService" - cardinality="1..1" - policy="static" - bind="setEventService" /> - - <reference interface="org.eclipse.osee.logger.Log" name="Log" - cardinality="1..1" - policy="static" - bind="setLogger" /> - - <service> - <provide interface="org.eclipse.osee.cluster.ClusterService"/> - <provide interface="org.eclipse.osee.distributed.InstanceManager"/> - </service> -</scr:component> diff --git a/plugins/org.eclipse.osee.cluster.hazelcast/build.properties b/plugins/org.eclipse.osee.cluster.hazelcast/build.properties deleted file mode 100644 index c58ea2178c3..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/build.properties +++ /dev/null @@ -1,5 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - OSGI-INF/ diff --git a/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/AtomicNumberProxy.java b/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/AtomicNumberProxy.java deleted file mode 100644 index 15dd070da94..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/AtomicNumberProxy.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * 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.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 boolean compareAndSet(long expect, long update) { - return proxyObject.compareAndSet(expect, update); - } - -} diff --git a/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/CallableTransactionImpl.java b/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/CallableTransactionImpl.java deleted file mode 100644 index 399321bc420..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/CallableTransactionImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * 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.hazelcast.internal; - -import java.util.concurrent.Callable; -import org.eclipse.osee.cluster.Transaction; -import org.eclipse.osee.cluster.TransactionWork; -import org.eclipse.osee.logger.Log; - -/** - * @author Roberto E. Escobar - */ -public class CallableTransactionImpl<T> implements Callable<T> { - - private final Log logger; - private final Transaction txn; - private final TransactionWork<T> work; - - public CallableTransactionImpl(Log 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("Start Transaction: [%s]", work.getName()); - result = work.doWork(); - txn.commit(); - logger.debug("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(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.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/ClusterEventNotifier.java b/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/ClusterEventNotifier.java deleted file mode 100644 index e93491379d5..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/ClusterEventNotifier.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * 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.hazelcast.internal; - -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; -import java.util.Map; -import org.eclipse.osee.cluster.ClusterConstants; -import org.eclipse.osee.cluster.ClusterConstants.ClusterInstanceState; -import org.eclipse.osee.cluster.ClusterServiceUtils; -import org.eclipse.osee.cluster.Member; -import org.eclipse.osee.event.EventService; - -/** - * @author Roberto E. Escobar - */ -public class ClusterEventNotifier implements LifecycleListener, InstanceListener, MembershipListener { - - private final String componentName; - private final String contextName; - private final EventService eventService; - - public ClusterEventNotifier(String componentName, String contextName, EventService eventService) { - this.componentName = componentName; - this.contextName = contextName; - this.eventService = eventService; - } - - @Override - public void memberAdded(MembershipEvent event) { - Map<String, Object> data = toMap(event); - postEvent(ClusterConstants.CLUSTER_MEMBER_ADDED_EVENT, data); - } - - @Override - public void memberRemoved(MembershipEvent event) { - Map<String, Object> data = toMap(event); - postEvent(ClusterConstants.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(ClusterConstants.CLUSTER_LIFECYCLE_STATE, state); - postEvent(ClusterConstants.CLUSTER_LIFECYCLE_EVENT, data); - } - - @Override - public void instanceCreated(InstanceEvent event) { - Map<String, Object> data = toMap(event); - postEvent(ClusterConstants.CLUSTER_INSTANCE_CREATED_EVENT, data); - } - - @Override - public void instanceDestroyed(InstanceEvent event) { - Map<String, Object> data = toMap(event); - postEvent(ClusterConstants.CLUSTER_INSTANCE_DESTROYED_EVENT, data); - } - - public void notifyRegistration() { - Map<String, Object> data = ClusterServiceUtils.toMap(componentName, contextName); - postEvent(ClusterConstants.CLUSTER_REGISTRATION_EVENT, data); - } - - public void notifyDeRegistration() { - Map<String, Object> data = ClusterServiceUtils.toMap(componentName, contextName); - postEvent(ClusterConstants.CLUSTER_DEREGISTRATION_EVENT, data); - } - - private void postEvent(String topic, Map<String, Object> data) { - eventService.postEvent(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(ClusterConstants.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(ClusterConstants.CLUSTER_OBJECT_TYPE, instanceType.name()); - data.put(ClusterConstants.CLUSTER_OBJECT_ID, objectId); - data.put(ClusterConstants.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.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/ClusterProxy.java b/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/ClusterProxy.java deleted file mode 100644 index 21cb5c016fd..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/ClusterProxy.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * 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.hazelcast.internal; - -import com.hazelcast.core.HazelcastInstance; -import java.util.HashSet; -import java.util.Set; -import org.eclipse.osee.cluster.Cluster; -import org.eclipse.osee.cluster.Member; - -/** - * @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<>(); - 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.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/ClusterServiceImpl.java b/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/ClusterServiceImpl.java deleted file mode 100644 index 008eb847e16..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/ClusterServiceImpl.java +++ /dev/null @@ -1,286 +0,0 @@ -/******************************************************************************* - * 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.hazelcast.internal; - -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; -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.Cluster; -import org.eclipse.osee.cluster.ClusterService; -import org.eclipse.osee.cluster.ClusterServiceUtils; -import org.eclipse.osee.cluster.DistributedExecutorService; -import org.eclipse.osee.cluster.Transaction; -import org.eclipse.osee.cluster.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.event.EventService; -import org.eclipse.osee.logger.Log; - -/** - * @author Roberto E. Escobar - */ -public class ClusterServiceImpl implements ClusterService, InstanceManager { - - private final Map<Object, DistributedObject> distributedObjects = new ConcurrentHashMap<>(); - private final ProxyCleaner proxyCleaner = new ProxyCleaner(); - private Log logger; - private EventService eventService; - private HazelcastInstance instance; - private Thread thread; - private ClusterEventNotifier eventNotifier; - private ClusterProxy clusterProxy; - private DistributedExecutorService executor; - - public void setEventService(EventService eventService) { - this.eventService = eventService; - } - - private EventService getEventService() { - return eventService; - } - - public void setLogger(Log logger) { - this.logger = logger; - } - - private Log getLogger() { - return logger; - } - - private Config getConfiguration(Map<String, Object> properties) { - Config config = null; - - String loggerClass = System.getProperty("hazelcast.logging.class"); - if (loggerClass == null) { - String loggerType = System.getProperty("hazelcast.logging.type"); - if (loggerType == null) { - System.setProperty("hazelcast.logging.type", "slf4j"); - } - } - 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, "false"); - props.put(GroupProperties.PROP_ENABLE_JMX_DETAILED, "false"); - 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, getEventService()); - 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) { - deregisterEventListeners(); - LifecycleService service = instance.getLifecycleService(); - service.shutdown(); - 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.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedBlockingQueueProxy.java b/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedBlockingQueueProxy.java deleted file mode 100644 index 4ee897dda5c..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedBlockingQueueProxy.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * 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.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.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedExecutorServiceImpl.java b/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedExecutorServiceImpl.java deleted file mode 100644 index 66f57905f85..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedExecutorServiceImpl.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * 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.hazelcast.internal; - -import com.hazelcast.core.DistributedTask; -import com.hazelcast.core.ExecutionCallback; -import com.hazelcast.core.HazelcastInstance; -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.Callback; -import org.eclipse.osee.cluster.DistributedExecutorService; -import org.eclipse.osee.cluster.Member; - -/** - * @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<>(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<>(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<>(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<>(); - for (Member member : members) { - MemberProxy memberProxy = (MemberProxy) member; - xMembers.add(memberProxy.getProxyObject()); - } - DistributedTask<T> task = new DistributedTask<>(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.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedIdProxy.java b/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedIdProxy.java deleted file mode 100644 index 88066ed51d7..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedIdProxy.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * 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.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.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedListProxy.java b/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedListProxy.java deleted file mode 100644 index d67ad37eac5..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedListProxy.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * 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.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.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedLockProxy.java b/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedLockProxy.java deleted file mode 100644 index 1150e5c6325..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedLockProxy.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * 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.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.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedMapProxy.java b/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedMapProxy.java deleted file mode 100644 index 3df21ac10fe..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedMapProxy.java +++ /dev/null @@ -1,258 +0,0 @@ -/******************************************************************************* - * 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.hazelcast.internal; - -import com.hazelcast.core.MapEntry; -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; - -/** - * @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.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedMultiMapProxy.java b/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedMultiMapProxy.java deleted file mode 100644 index 0543815052b..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedMultiMapProxy.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * 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.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.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedSetProxy.java b/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedSetProxy.java deleted file mode 100644 index 5f2f6ffb3b3..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/DistributedSetProxy.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * 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.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.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/MemberProxy.java b/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/MemberProxy.java deleted file mode 100644 index 0782ec8f94e..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/MemberProxy.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * 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.hazelcast.internal; - -import java.net.InetSocketAddress; -import org.eclipse.osee.cluster.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.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/TransactionProxy.java b/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/TransactionProxy.java deleted file mode 100644 index 77e096044d8..00000000000 --- a/plugins/org.eclipse.osee.cluster.hazelcast/src/org/eclipse/osee/cluster/hazelcast/internal/TransactionProxy.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * 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.hazelcast.internal; - -import org.eclipse.osee.cluster.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.rest/.classpath b/plugins/org.eclipse.osee.cluster.rest/.classpath deleted file mode 100644 index 1fa3e6803d3..00000000000 --- a/plugins/org.eclipse.osee.cluster.rest/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <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.rest/.project b/plugins/org.eclipse.osee.cluster.rest/.project deleted file mode 100644 index f5184787b84..00000000000 --- a/plugins/org.eclipse.osee.cluster.rest/.project +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.osee.cluster.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.rest/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.cluster.rest/META-INF/MANIFEST.MF deleted file mode 100644 index bd45e4fa7f6..00000000000 --- a/plugins/org.eclipse.osee.cluster.rest/META-INF/MANIFEST.MF +++ /dev/null @@ -1,11 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: OSEE Cluster Rest -Bundle-SymbolicName: org.eclipse.osee.cluster.rest -Bundle-Version: 0.25.3.qualifier -Bundle-Vendor: Eclipse Open System Engineering Environment -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Service-Component: OSGI-INF/*.xml -Import-Package: javax.ws.rs, - javax.ws.rs.core, - org.eclipse.osee.cluster diff --git a/plugins/org.eclipse.osee.cluster.rest/OSGI-INF/cluster.rest.application.xml b/plugins/org.eclipse.osee.cluster.rest/OSGI-INF/cluster.rest.application.xml deleted file mode 100644 index 4b445c86bfb..00000000000 --- a/plugins/org.eclipse.osee.cluster.rest/OSGI-INF/cluster.rest.application.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?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.rest.internal.ClusterRestApplication"> - <implementation class="org.eclipse.osee.cluster.rest.internal.ClusterRestApplication"/> - <service> - <provide interface="javax.ws.rs.core.Application"/> - </service> - <reference bind="setClusterService" cardinality="1..1" interface="org.eclipse.osee.cluster.ClusterService" name="ClusterService" policy="static"/> -</scr:component>
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.cluster.rest/build.properties b/plugins/org.eclipse.osee.cluster.rest/build.properties deleted file mode 100644 index c58ea2178c3..00000000000 --- a/plugins/org.eclipse.osee.cluster.rest/build.properties +++ /dev/null @@ -1,5 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - OSGI-INF/ diff --git a/plugins/org.eclipse.osee.cluster.rest/src/org/eclipse/osee/cluster/rest/internal/ClusterRestApplication.java b/plugins/org.eclipse.osee.cluster.rest/src/org/eclipse/osee/cluster/rest/internal/ClusterRestApplication.java deleted file mode 100644 index 48450d60dfa..00000000000 --- a/plugins/org.eclipse.osee.cluster.rest/src/org/eclipse/osee/cluster/rest/internal/ClusterRestApplication.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * 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.rest.internal; - -import java.util.HashSet; -import java.util.Set; -import javax.ws.rs.ApplicationPath; -import javax.ws.rs.core.Application; -import org.eclipse.osee.cluster.ClusterService; -import org.eclipse.osee.cluster.Member; - -/** - * A service for clients to obtain information about the cluster. - * - * @author Roberto E. Escobar - */ -@ApplicationPath("cluster") -public class ClusterRestApplication extends Application { - - private static ClusterService clusterService; - - public void setClusterService(ClusterService clusterService) { - ClusterRestApplication.clusterService = clusterService; - } - - public static ClusterService getClusterService() { - return clusterService; - } - - public static Set<Member> getMembers() { - ClusterService service = ClusterRestApplication.getClusterService(); - return service.getCluster().getMembers(); - } - - @Override - public Set<Class<?>> getClasses() { - Set<Class<?>> resources = new HashSet<>(); - resources.add(MembersResource.class); - resources.add(JobsResource.class); - return resources; - } -} diff --git a/plugins/org.eclipse.osee.cluster.rest/src/org/eclipse/osee/cluster/rest/internal/ClusterUtil.java b/plugins/org.eclipse.osee.cluster.rest/src/org/eclipse/osee/cluster/rest/internal/ClusterUtil.java deleted file mode 100644 index cd8ae1bf28e..00000000000 --- a/plugins/org.eclipse.osee.cluster.rest/src/org/eclipse/osee/cluster/rest/internal/ClusterUtil.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * 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.rest.internal; - -import java.net.InetSocketAddress; -import org.eclipse.osee.cluster.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.rest/src/org/eclipse/osee/cluster/rest/internal/JobsResource.java b/plugins/org.eclipse.osee.cluster.rest/src/org/eclipse/osee/cluster/rest/internal/JobsResource.java deleted file mode 100644 index e53a463ee2c..00000000000 --- a/plugins/org.eclipse.osee.cluster.rest/src/org/eclipse/osee/cluster/rest/internal/JobsResource.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * 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.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.rest/src/org/eclipse/osee/cluster/rest/internal/MemberResource.java b/plugins/org.eclipse.osee.cluster.rest/src/org/eclipse/osee/cluster/rest/internal/MemberResource.java deleted file mode 100644 index 37eed140330..00000000000 --- a/plugins/org.eclipse.osee.cluster.rest/src/org/eclipse/osee/cluster/rest/internal/MemberResource.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * 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.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.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; - for (Member member : ClusterRestApplication.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.rest/src/org/eclipse/osee/cluster/rest/internal/MembersResource.java b/plugins/org.eclipse.osee.cluster.rest/src/org/eclipse/osee/cluster/rest/internal/MembersResource.java deleted file mode 100644 index 0daf06f3201..00000000000 --- a/plugins/org.eclipse.osee.cluster.rest/src/org/eclipse/osee/cluster/rest/internal/MembersResource.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * 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.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.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<>(); - for (Member member : ClusterRestApplication.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<>(); - for (Member member : ClusterRestApplication.getMembers()) { - todos.add(ClusterUtil.fromMember(member)); - } - return todos; - } - - @GET - @Path("count") - @Produces(MediaType.TEXT_PLAIN) - public String getCount() { - int count = ClusterRestApplication.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.rest/src/org/eclipse/osee/cluster/rest/internal/XmlMember.java b/plugins/org.eclipse.osee.cluster.rest/src/org/eclipse/osee/cluster/rest/internal/XmlMember.java deleted file mode 100644 index ad0e678b22c..00000000000 --- a/plugins/org.eclipse.osee.cluster.rest/src/org/eclipse/osee/cluster/rest/internal/XmlMember.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * 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.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/.classpath b/plugins/org.eclipse.osee.cluster/.classpath deleted file mode 100644 index 1fa3e6803d3..00000000000 --- a/plugins/org.eclipse.osee.cluster/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <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/.project b/plugins/org.eclipse.osee.cluster/.project deleted file mode 100644 index efdc49f6fb6..00000000000 --- a/plugins/org.eclipse.osee.cluster/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.osee.cluster</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/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.cluster/META-INF/MANIFEST.MF deleted file mode 100644 index 408153b40fd..00000000000 --- a/plugins/org.eclipse.osee.cluster/META-INF/MANIFEST.MF +++ /dev/null @@ -1,8 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: OSEE Cluster -Bundle-SymbolicName: org.eclipse.osee.cluster -Bundle-Version: 0.25.3.qualifier -Bundle-Vendor: Eclipse Open System Engineering Environment -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Export-Package: org.eclipse.osee.cluster diff --git a/plugins/org.eclipse.osee.cluster/build.properties b/plugins/org.eclipse.osee.cluster/build.properties deleted file mode 100644 index 34d2e4d2dad..00000000000 --- a/plugins/org.eclipse.osee.cluster/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - . diff --git a/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/Callback.java b/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/Callback.java deleted file mode 100644 index ea0fbd1ff69..00000000000 --- a/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/Callback.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * 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; - -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/src/org/eclipse/osee/cluster/Cluster.java b/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/Cluster.java deleted file mode 100644 index 8053eb9767c..00000000000 --- a/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/Cluster.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * 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; - -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/src/org/eclipse/osee/cluster/ClusterConstants.java b/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/ClusterConstants.java deleted file mode 100644 index e08b41cf734..00000000000 --- a/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/ClusterConstants.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * 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; - -/** - * @author Roberto E. Escobar - */ -public class ClusterConstants { - - 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/src/org/eclipse/osee/cluster/ClusterService.java b/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/ClusterService.java deleted file mode 100644 index 4a6f5b147fe..00000000000 --- a/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/ClusterService.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * 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; - -import java.util.concurrent.Callable; - -/** - * @author Roberto E. Escobar - */ -public interface ClusterService { - - /** - * 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("mymap"); - * Transaction txn = clusterAdmin.getTransaction(); - * txn.begin(); - * try { - * map.put("key", "value"); - * 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/src/org/eclipse/osee/cluster/ClusterServiceUtils.java b/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/ClusterServiceUtils.java deleted file mode 100644 index a7e3971ff66..00000000000 --- a/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/ClusterServiceUtils.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * 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; - -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<>(); - 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(ClusterConstants.CLUSTER_CONFIG_URL); - } - -} diff --git a/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/DistributedExecutorService.java b/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/DistributedExecutorService.java deleted file mode 100644 index 2b7e23864ea..00000000000 --- a/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/DistributedExecutorService.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * 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; - -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/src/org/eclipse/osee/cluster/Member.java b/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/Member.java deleted file mode 100644 index 2459b79b331..00000000000 --- a/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/Member.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * 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; - -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/src/org/eclipse/osee/cluster/Transaction.java b/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/Transaction.java deleted file mode 100644 index 805dd7dcaee..00000000000 --- a/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/Transaction.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * 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; - -/** - * @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/src/org/eclipse/osee/cluster/TransactionWork.java b/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/TransactionWork.java deleted file mode 100644 index 0d11028ed45..00000000000 --- a/plugins/org.eclipse.osee.cluster/src/org/eclipse/osee/cluster/TransactionWork.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * 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; - -/** - * @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 |