Return-Path: X-Original-To: apmail-ode-commits-archive@www.apache.org Delivered-To: apmail-ode-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7E38317CD6 for ; Fri, 6 Nov 2015 10:55:11 +0000 (UTC) Received: (qmail 91239 invoked by uid 500); 6 Nov 2015 10:55:11 -0000 Delivered-To: apmail-ode-commits-archive@ode.apache.org Received: (qmail 91202 invoked by uid 500); 6 Nov 2015 10:55:11 -0000 Mailing-List: contact commits-help@ode.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ode.apache.org Delivered-To: mailing list commits@ode.apache.org Received: (qmail 91186 invoked by uid 99); 6 Nov 2015 10:55:11 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Nov 2015 10:55:11 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 36C02DFBC9; Fri, 6 Nov 2015 10:55:11 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sathwik@apache.org To: commits@ode.apache.org Date: Fri, 06 Nov 2015 10:55:11 -0000 Message-Id: <2be1c5c173c842aca88ac670dc797713@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [01/30] ode git commit: initial commit Repository: ode Updated Branches: refs/heads/master 8fcaf5f0e -> 26dacc201 initial commit Project: http://git-wip-us.apache.org/repos/asf/ode/repo Commit: http://git-wip-us.apache.org/repos/asf/ode/commit/50c4dfe0 Tree: http://git-wip-us.apache.org/repos/asf/ode/tree/50c4dfe0 Diff: http://git-wip-us.apache.org/repos/asf/ode/diff/50c4dfe0 Branch: refs/heads/master Commit: 50c4dfe022c664e50519c0f048795cf787383b7f Parents: 482c873 Author: suba Authored: Sun Jun 7 16:13:27 2015 +0530 Committer: suba Committed: Sun Jun 7 16:13:27 2015 +0530 ---------------------------------------------------------------------- Rakefile | 18 ++- .../java/org/apache/ode/axis2/ODEServer.java | 50 +++++++ .../apache/ode/bpel/hzapi/HazelcastCluster.java | 56 ++++++++ .../apache/ode/bpel/engine/BpelServerImpl.java | 5 + .../org/apache/ode/bpel/engine/Contexts.java | 3 + clustering/pom.xml | 30 ++++ .../java/org/apache/ode/clustering/Test.java | 4 + .../hazelcast/HazelcastClusterImpl.java | 140 +++++++++++++++++++ .../hazelcast/HazelcastConstants.java | 29 ++++ .../hazelcast/HazelcastInstanceConfig.java | 56 ++++++++ dependencies.rb | 1 + pom.xml | 1 + 12 files changed, 387 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ode/blob/50c4dfe0/Rakefile ---------------------------------------------------------------------- diff --git a/Rakefile b/Rakefile index 2a23e7b..1320043 100644 --- a/Rakefile +++ b/Rakefile @@ -83,10 +83,10 @@ define "ode" do desc "ODE Axis Integration Layer" define "axis2" do compile.with projects("bpel-api", "bpel-connector", "bpel-dao", "bpel-epr", "bpel-runtime", - "scheduler-simple", "bpel-schemas", "bpel-store", "utils", "agents"), + "scheduler-simple", "bpel-schemas", "bpel-store", "utils", "agents", "clustering"), AXIOM, AXIS2_ALL, COMMONS.lang, COMMONS.collections, COMMONS.httpclient, COMMONS.lang, DERBY, GERONIMO.kernel, GERONIMO.transaction, JAVAX.activation, JAVAX.servlet, JAVAX.stream, - JAVAX.transaction, JENCKS, WSDL4J, WS_COMMONS, XMLBEANS, AXIS2_MODULES.libs, SLF4J, LOG4J + JAVAX.transaction, JENCKS, WSDL4J, WS_COMMONS, XMLBEANS, AXIS2_MODULES.libs, SLF4J, LOG4J, HAZELCAST test.exclude 'org.apache.ode.axis2.management.*' test.with project("tools"), AXIOM, JAVAX.javamail, COMMONS.codec, COMMONS.httpclient, XERCES, WOODSTOX @@ -99,12 +99,12 @@ define "ode" do libs = projects("axis2", "bpel-api", "bpel-compiler", "bpel-connector", "bpel-dao", "bpel-epr", "bpel-obj", "bpel-ql", "bpel-runtime", "scheduler-simple", "bpel-schemas", "bpel-store", "dao-hibernate", "jca-ra", "jca-server", - "utils", "dao-jpa", "agents"), + "utils", "dao-jpa", "agents", "clustering"), AXIS2_ALL, ANNONGEN, BACKPORT, COMMONS.codec, COMMONS.collections, COMMONS.fileupload, COMMONS.io, COMMONS.httpclient, COMMONS.beanutils, COMMONS.lang, COMMONS.pool, DERBY, DERBY_TOOLS, JACOB, JAXEN, JAVAX.activation, JAVAX.ejb, JAVAX.javamail, JAVAX.connector, JAVAX.jms, JAVAX.persistence, JAVAX.transaction, JAVAX.stream, JIBX, GERONIMO.connector, GERONIMO.kernel, GERONIMO.transaction, LOG4J, OPENJPA, SAXON, TRANQL, - WOODSTOX, WSDL4J, WS_COMMONS, XALAN, XERCES, XMLBEANS, SPRING, AXIS2_MODULES.libs, SLF4J, LOG4J + WOODSTOX, WSDL4J, WS_COMMONS, XALAN, XERCES, XMLBEANS, SPRING, AXIS2_MODULES.libs, SLF4J, LOG4J, HAZELCAST package(:war).with(:libs=>libs).path("WEB-INF").tap do |web_inf| web_inf.merge project("dao-jpa-ojpa-derby").package(:zip) @@ -166,7 +166,7 @@ define "ode" do desc "ODE APIs" define "bpel-api" do - compile.with projects("utils", "bpel-obj", "bpel-schemas"), WSDL4J, XERCES, SLF4J, LOG4J + compile.with projects("utils", "bpel-obj", "bpel-schemas"), WSDL4J, XERCES, SLF4J, LOG4J, HAZELCAST package :jar end @@ -206,6 +206,12 @@ define "ode" do package :jar end + desc "ODE Clustering" + define "clustering" do + compile.with projects("bpel-api"),HAZELCAST, COMMONS.logging + package :jar + end + desc "ODE BPEL Object Model" define "bpel-obj" do compile.with project("utils"), SAXON, WSDL4J, COMMONS.collections @@ -225,7 +231,7 @@ define "ode" do desc "ODE Runtime Engine" define "bpel-runtime" do compile.with projects("bpel-api", "bpel-compiler", "bpel-dao", "bpel-epr", "bpel-obj", "bpel-schemas", - "bpel-store", "utils", "agents"), + "bpel-store", "utils", "agents","clustering"), COMMONS.collections, COMMONS.httpclient, JACOB, JAVAX.persistence, JAVAX.stream, JAXEN, SAXON, WSDL4J, XMLBEANS, SPRING, SLF4J, LOG4J http://git-wip-us.apache.org/repos/asf/ode/blob/50c4dfe0/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java ---------------------------------------------------------------------- diff --git a/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java b/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java index 7cbf142..1547042 100644 --- a/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java +++ b/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java @@ -82,6 +82,9 @@ import org.apache.ode.store.ProcessStoreImpl; import org.apache.ode.utils.GUID; import org.apache.ode.utils.fs.TempFileManager; +import org.apache.ode.clustering.hazelcast.*; +import com.hazelcast.core.*; + /** * Server class called by our Axis hooks to handle all ODE lifecycle management. * @@ -133,6 +136,14 @@ public class ODEServer { public Runnable txMgrCreatedCallback; + private HazelcastInstanceConfig hazelcastInstanceConfig; + + private HazelcastClusterImpl hazelcastClusterImpl; + + private String clusteringState = ""; + + private boolean isClusteringEnabled; + public void init(ServletConfig config, ConfigurationContext configContext) throws ServletException { init(config.getServletContext().getRealPath("/WEB-INF"), configContext); } @@ -184,6 +195,11 @@ public class ODEServer { if (txMgrCreatedCallback != null) { txMgrCreatedCallback.run(); } + + clusteringState = _odeConfig.getClusteringState(); + if (isClusteringEnabled()) initClustering(); + else __log.info("Clustering has not been initialized"); + __log.debug("Creating data source."); initDataSource(); __log.debug("Starting DAO."); @@ -455,6 +471,39 @@ public class ODEServer { } } + public boolean isClusteringEnabled() { + boolean state; + if (clusteringState.equals("true")) state = true; + else state = false; + setClustering(state); + return state; + } + + public void setClustering (boolean state) { + isClusteringEnabled = state; + } + + public boolean getClusteringState() { + return isClusteringEnabled; + } + + /** + * Initialize the clustering if it is enabled + */ + private void initClustering() { + String hzConfig = System.getProperty("hazelcast.config"); + if (hzConfig != null) hazelcastInstanceConfig = new HazelcastInstanceConfig(); + else { + File hzXml = new File(_configRoot, "hazelcast.xml"); + if (!hzXml.isFile()) + __log.error("hazelcast.xml does not exist or is not a file"); + else hazelcastInstanceConfig = new HazelcastInstanceConfig(hzXml); + } + if (hazelcastInstanceConfig != null) { + hazelcastClusterImpl = new HazelcastClusterImpl(hazelcastInstanceConfig.getHazelcastInstance()); + } + } + /** * Initialize the DAO. * @@ -533,6 +582,7 @@ public class ODEServer { _bpelServer.setCronScheduler(_cronScheduler); _bpelServer.setDaoConnectionFactory(_daoCF); + _bpelServer.setHazelcastCluster(hazelcastClusterImpl); _bpelServer.setInMemDaoConnectionFactory(new BpelDAOConnectionFactoryImpl(_scheduler, _odeConfig.getInMemMexTtl())); _bpelServer.setEndpointReferenceContext(eprContext); _bpelServer.setMessageExchangeContext(new MessageExchangeContextImpl(this)); http://git-wip-us.apache.org/repos/asf/ode/blob/50c4dfe0/bpel-api/src/main/java/org/apache/ode/bpel/hzapi/HazelcastCluster.java ---------------------------------------------------------------------- diff --git a/bpel-api/src/main/java/org/apache/ode/bpel/hzapi/HazelcastCluster.java b/bpel-api/src/main/java/org/apache/ode/bpel/hzapi/HazelcastCluster.java new file mode 100644 index 0000000..4e03c7d --- /dev/null +++ b/bpel-api/src/main/java/org/apache/ode/bpel/hzapi/HazelcastCluster.java @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ode.bpel.hzapi; + +import com.hazelcast.core.Member; + +import java.util.List; + +public interface HazelcastCluster { + + /** + * Initialization of the cluster + */ + void init(); + + /** + * Get hostName + port nu of Member + * @param member + * @return + */ + String getHazelCastNodeID(Member member); + + /** + * Check whether current node is the leader or not. + */ + void isLeader(); + + /** + * returns Current Nodes in the cluster. + * @return + */ + List getKnownNodes(); + + /** + * Return isMaster + * @return + */ + boolean getIsMaster(); + +} http://git-wip-us.apache.org/repos/asf/ode/blob/50c4dfe0/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java index 666ed65..92e9784 100644 --- a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java +++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java @@ -59,6 +59,7 @@ import org.apache.ode.bpel.iapi.Scheduler.MapSerializableRunnable; import org.apache.ode.bpel.iapi.Scheduler.Synchronizer; import org.apache.ode.bpel.intercept.MessageExchangeInterceptor; import org.apache.ode.bpel.o.OProcess; +import org.apache.ode.clustering.hazelcast.HazelcastClusterImpl; import org.apache.ode.utils.msg.MessageBundle; import org.apache.ode.utils.stl.CollectionsX; import org.apache.ode.utils.stl.MemberOfFunction; @@ -534,6 +535,10 @@ public class BpelServerImpl implements BpelServer, Scheduler.JobProcessor { _contexts.bindingContext = bc; } + public void setHazelcastCluster(HazelcastClusterImpl hzCImpl) { + _contexts.hazelcastClusterImpl = hzCImpl; + } + public DebuggerContext getDebugger(QName pid) throws BpelEngineException { return _engine._activeProcesses.get(pid)._debugger; } http://git-wip-us.apache.org/repos/asf/ode/blob/50c4dfe0/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java index 9fa3258..115f4f7 100644 --- a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java +++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java @@ -28,6 +28,7 @@ import org.apache.ode.bpel.iapi.Scheduler; import org.apache.ode.bpel.intercept.MessageExchangeInterceptor; import org.apache.ode.bpel.engine.cron.CronScheduler; import org.apache.ode.bpel.evar.ExternalVariableModule; +import org.apache.ode.clustering.hazelcast.HazelcastClusterImpl; import java.util.HashMap; import java.util.List; @@ -46,6 +47,8 @@ public class Contexts { public CronScheduler cronScheduler; + public HazelcastClusterImpl hazelcastClusterImpl; + EndpointReferenceContext eprContext; BindingContext bindingContext; http://git-wip-us.apache.org/repos/asf/ode/blob/50c4dfe0/clustering/pom.xml ---------------------------------------------------------------------- diff --git a/clustering/pom.xml b/clustering/pom.xml new file mode 100644 index 0000000..d0e4b7c --- /dev/null +++ b/clustering/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + org.apache.ode + ode-clustering + ODE :: Clustering + + org.apache.ode + ode + 1.4-SNAPSHOT + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ode/blob/50c4dfe0/clustering/src/main/java/org/apache/ode/clustering/Test.java ---------------------------------------------------------------------- diff --git a/clustering/src/main/java/org/apache/ode/clustering/Test.java b/clustering/src/main/java/org/apache/ode/clustering/Test.java new file mode 100644 index 0000000..0e25733 --- /dev/null +++ b/clustering/src/main/java/org/apache/ode/clustering/Test.java @@ -0,0 +1,4 @@ +package org.apache.ode.clustering; + +public class Test { +} http://git-wip-us.apache.org/repos/asf/ode/blob/50c4dfe0/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastClusterImpl.java ---------------------------------------------------------------------- diff --git a/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastClusterImpl.java b/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastClusterImpl.java new file mode 100644 index 0000000..afe0e95 --- /dev/null +++ b/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastClusterImpl.java @@ -0,0 +1,140 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ode.clustering.hazelcast; + +import com.hazelcast.core.*; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.apache.ode.bpel.hzapi.HazelcastCluster; + +/** + * This class implements necessary methods to build the cluster using hazelcast + */ +public class HazelcastClusterImpl implements HazelcastCluster{ + private static final Log __log = LogFactory.getLog(HazelcastClusterImpl.class); + + private HazelcastInstance _hazelcastInstance; + private boolean isMaster = false; + private String message = ""; + private Member leader; + + public HazelcastClusterImpl(HazelcastInstance hazelcastInstance) { + _hazelcastInstance = hazelcastInstance; + init(); + } + + public void init() { + // Registering this node in the cluster. + _hazelcastInstance.getCluster().addMembershipListener(new ClusterMemberShipListener()); + + // Register for listening to message listener + ITopic clusterMessageTopic = _hazelcastInstance.getTopic("clusterMsg"); + clusterMessageTopic.addMessageListener(new ClusterMessageListener()); + + Member localMember = _hazelcastInstance.getCluster().getLocalMember(); + String localMemberID = getHazelCastNodeID(localMember); + __log.info("Registering HZ localMember ID " + localMemberID); + _hazelcastInstance.getMap(HazelcastConstants.ODE_CLUSTER_NODE_MAP) + .put(localMemberID, isMaster); + } + + public String getHazelCastNodeID(Member member) { + String hostName = member.getSocketAddress().getHostName(); + int port = member.getSocketAddress().getPort(); + return hostName + ":" + port; + } + + class ClusterManager { + IMap lock_map; + + ClusterManager() { + lock_map = _hazelcastInstance.getMap(HazelcastConstants.ODE_CLUSTER_LOCK_MAP); + } + + void lock(String key) { + lock_map.lock(key); + } + + void unlock(String key) { + lock_map.unlock(key); + } + } + + class ClusterMemberShipListener implements MembershipListener { + + @Override + public void memberAdded(MembershipEvent membershipEvent) { + // Noting to do here. + } + + @Override + public void memberRemoved(MembershipEvent membershipEvent) { + isLeader(); + // Allow Leader to update distributed map. + if (isMaster) { + String leftMemberID = getHazelCastNodeID(membershipEvent.getMember()); + _hazelcastInstance.getMap(HazelcastConstants.ODE_CLUSTER_NODE_MAP).remove(leftMemberID); + _hazelcastInstance.getMap(HazelcastConstants.ODE_CLUSTER_NODE_MAP).replace(getHazelCastNodeID(leader), isMaster); + } + } + + @Override + public void memberAttributeChanged(MemberAttributeEvent memberAttributeEvent) { + // Noting to do here. + } + } + + class ClusterMessageListener implements MessageListener { + @Override + public void onMessage(Message msg) { + message = msg.getMessageObject(); + } + } + + + public void isLeader() { + leader = _hazelcastInstance.getCluster().getMembers().iterator().next(); + if (leader.localMember()) { + isMaster = true; + } + __log.info(isMaster); + } + + public List getKnownNodes() { + List nodeList = new ArrayList(); + for (Object s : _hazelcastInstance.getMap(HazelcastConstants.ODE_CLUSTER_NODE_MAP).keySet()) { + nodeList.add((String) _hazelcastInstance.getMap(HazelcastConstants.ODE_CLUSTER_NODE_MAP).get(s)); + } + return nodeList; + } + + public boolean getIsMaster() { + return isMaster; + } + + public String getMessage() { + return message; + } + +} http://git-wip-us.apache.org/repos/asf/ode/blob/50c4dfe0/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastConstants.java ---------------------------------------------------------------------- diff --git a/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastConstants.java b/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastConstants.java new file mode 100644 index 0000000..e201b70 --- /dev/null +++ b/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastConstants.java @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2005-2011, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ +package org.apache.ode.clustering.hazelcast; + +/** + * Constants used in Hazelcast based clustering implementation + */ +public final class HazelcastConstants { + public static final String ODE_CLUSTER_NODE_MAP = "ODE_NODE_ID_MAP"; + public static final String ODE_CLUSTER_LOCK_MAP = "ODE_LOCK_MAP"; + + private HazelcastConstants() { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ode/blob/50c4dfe0/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastInstanceConfig.java ---------------------------------------------------------------------- diff --git a/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastInstanceConfig.java b/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastInstanceConfig.java new file mode 100644 index 0000000..9e8c59b --- /dev/null +++ b/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastInstanceConfig.java @@ -0,0 +1,56 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ +package org.apache.ode.clustering.hazelcast; + +import com.hazelcast.config.Config; +import com.hazelcast.config.FileSystemXmlConfig; +import com.hazelcast.core.*; + +import java.io.File; +import java.io.FileNotFoundException; + +/** + * This is to create hazelcast instance. + * It sets the config object using hazelcast.xml file.First, it looks for the hazelcast.config system property. If it is set, its value is used as the path. + * Else it will load the hazelcast.xml file using FileSystemXmlConfig() + */ +public class HazelcastInstanceConfig { + private HazelcastInstance hazelcastInstance; + + public HazelcastInstanceConfig() { + hazelcastInstance = Hazelcast.newHazelcastInstance(); + } + + /** + * + * @param hzXml + */ + public HazelcastInstanceConfig(File hzXml) { + try { + Config config = new FileSystemXmlConfig(hzXml); + hazelcastInstance = Hazelcast.newHazelcastInstance(config); + } catch (FileNotFoundException fnf) { + } + } + + public HazelcastInstance getHazelcastInstance() { + return hazelcastInstance; + } +} + http://git-wip-us.apache.org/repos/asf/ode/blob/50c4dfe0/dependencies.rb ---------------------------------------------------------------------- diff --git a/dependencies.rb b/dependencies.rb index 9a69f1a..33da5e4 100644 --- a/dependencies.rb +++ b/dependencies.rb @@ -75,6 +75,7 @@ GERONIMO = struct( :transaction =>"org.apache.geronimo.components:geronimo-transaction:jar:2.0.1", :connector =>"org.apache.geronimo.components:geronimo-connector:jar:2.0.1" ) +HAZELCAST ="com.hazelcast:hazelcast:jar:3.4.2" HIBERNATE = [ "org.hibernate:hibernate-core:jar:3.3.2.GA", "javassist:javassist:jar:3.9.0.GA", "antlr:antlr:jar:2.7.6", "asm:asm:jar:3.3.1", "cglib:cglib:jar:2.2", "net.sf.ehcache:ehcache:jar:1.2.3" ] HSQLDB = "hsqldb:hsqldb:jar:1.8.0.7" http://git-wip-us.apache.org/repos/asf/ode/blob/50c4dfe0/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index c43c2d0..f36373c 100644 --- a/pom.xml +++ b/pom.xml @@ -165,6 +165,7 @@ jbi-karaf-pmapi-httpbinding axis2-war bpel-itest + clustering