You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by az...@apache.org on 2007/05/19 15:34:51 UTC
svn commit: r539751 - in /webservices/axis2/trunk/java/modules:
clustering/src/org/apache/axis2/cluster/tribes/context/
clustering/src/org/apache/axis2/cluster/tribes/context/messages/
kernel/src/org/apache/axis2/cluster/context/ kernel/src/org/apache/...
Author: azeez
Date: Sat May 19 06:34:50 2007
New Revision: 539751
URL: http://svn.apache.org/viewvc?view=rev&rev=539751
Log:
Filtering out properties which should not be replicated
Added:
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateContextCommand.java
Modified:
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextCommandMessageFactory.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/PropertyUpdater.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateConfigurationContextCommand.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceContextCommand.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceGroupContextCommand.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManager.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextCommandMessageFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextCommandMessageFactory.java?view=diff&rev=539751&r1=539750&r2=539751
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextCommandMessageFactory.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextCommandMessageFactory.java Sat May 19 06:34:50 2007
@@ -18,79 +18,138 @@
import org.apache.axis2.cluster.context.ContextCommandMessage;
import org.apache.axis2.cluster.tribes.context.messages.*;
import org.apache.axis2.context.*;
+import org.apache.axis2.deployment.DeploymentConstants;
-import java.util.Map;
-import java.util.Iterator;
import java.io.Serializable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
/**
*
*/
public final class ContextCommandMessageFactory {
- public static final int CREATE = 0;
- public static final int UPDATE = 1;
- public static final int DELETE = 2;
-
- public static ContextCommandMessage getMessage(AbstractContext abstractContext,
- int operationType) {
- if (abstractContext instanceof ConfigurationContext && operationType == UPDATE) {
- UpdateConfigurationContextCommand cmd = new UpdateConfigurationContextCommand();
- Map diffs = abstractContext.getPropertyDifferences();
+
+ public static ContextCommandMessage getUpdateMessage(AbstractContext context,
+ Map excludedPropertyPatterns) {
+
+ ContextCommandMessage cmd = null;
+ if (context instanceof ConfigurationContext) {
+ cmd = new UpdateConfigurationContextCommand();
+ } else if (context instanceof ServiceGroupContext) {
+ ServiceGroupContext sgCtx = (ServiceGroupContext) context;
+ cmd = new UpdateServiceGroupContextCommand();
+ UpdateServiceGroupContextCommand updateSgCmd = (UpdateServiceGroupContextCommand) cmd;
+
+ updateSgCmd.setServiceGroupName(sgCtx.getDescription().getServiceGroupName());
+ updateSgCmd.setServiceGroupContextId(sgCtx.getId());
+
+ //TODO: impl
+ } else if (context instanceof ServiceContext) {
+ ServiceContext serviceCtx = (ServiceContext) context;
+ cmd = new UpdateServiceContextCommand();
+ UpdateServiceContextCommand updateServiceCmd = (UpdateServiceContextCommand) cmd;
+
+ // TODO impl
+ updateServiceCmd.setServiceGroupName(serviceCtx.getGroupName());
+ updateServiceCmd.setServiceName(serviceCtx.getAxisService().getName());
+ }
+
+ if (cmd != null) {
+ // Fill the properties
+ UpdateContextCommand updateCmd = (UpdateContextCommand) cmd;
+ Map diffs = context.getPropertyDifferences();
for (Iterator iter = diffs.keySet().iterator(); iter.hasNext();) {
- String key = (String) iter.next();
- Object prop = abstractContext.getProperty(key);
-// if (prop instanceof Serializable) { //TODO: Handling only Strings now
- if (prop instanceof String || prop instanceof Integer) { //TODO: Handling only Strings now
- System.err.println("..................... sending prop=" + key + "-" + prop);
- PropertyDifference diff = (PropertyDifference) diffs.get(key);
- diff.setValue(prop);
+ String key = (String) iter.next();
+ Object prop = context.getProperty(key);
+ if (prop instanceof Serializable) { // First check whether it is serializable
- // TODO: Before adding it here, exclude all the properties with names matching the exclude patterns
- cmd.addConfigurationContextProperty(diff);
+ // Next check whether it matches an excluded pattern
+ if (!isExcluded(key, context.getClass().getName(), excludedPropertyPatterns)) {
+ System.err.println("..................... sending prop=" + key + "-" + prop);
+ PropertyDifference diff = (PropertyDifference) diffs.get(key);
+ diff.setValue(prop);
+ updateCmd.addProperty(diff);
+ }
}
}
- abstractContext.clearPropertyDifferences(); // Once we send the diffs, we should clear the diffs
- return cmd;
- } else if (abstractContext instanceof ServiceGroupContext) {
- ServiceGroupContext sgCtx = (ServiceGroupContext) abstractContext;
- ServiceGroupContextCommand cmd;
- switch (operationType) {
- case CREATE:
- cmd = new CreateServiceGroupContextCommand();
- break;
- case UPDATE:
- cmd = new UpdateServiceGroupContextCommand();
-
- // TODO: Need to get a diff between old & new properties
- // TODO call UpdateServiceGroupContextCommand#addServiceGroupContextProperty
- break;
- case DELETE:
- cmd = new DeleteServiceGroupContextCommand();
- break;
- default:
- return null;
+ context.clearPropertyDifferences(); // Once we send the diffs, we should clear the diffs
+ }
+ return cmd;
+ }
+
+ private static boolean isExcluded(String propertyName,
+ String ctxClassName,
+ Map excludedPropertyPatterns) {
+
+ // First check in the default excludes
+ List defaultExcludes =
+ (List) excludedPropertyPatterns.get(DeploymentConstants.TAG_DEFAULTS);
+ if (isExcluded(defaultExcludes, propertyName)) {
+ return true;
+ } else {
+ // If not, check in the excludes list specific to the context
+ List specificExcludes =
+ (List) excludedPropertyPatterns.get(ctxClassName);
+ return isExcluded(specificExcludes, propertyName);
+ }
+ }
+
+ private static boolean isExcluded(List list, String propertyName) {
+ for (Iterator iter = list.iterator(); iter.hasNext();) {
+ String pattern = (String) iter.next();
+ if (pattern.startsWith("*")) {
+ pattern = pattern.replaceAll("\\*", "");
+ if (propertyName.endsWith(pattern)) {
+ return true;
+ }
+ } else if (pattern.endsWith("*")) {
+ pattern = pattern.replaceAll("\\*", "");
+ if (propertyName.startsWith(pattern)) {
+ return true;
+ }
+ } else if (pattern.equals(propertyName)) {
+ return true;
}
+ }
+ return false;
+ }
+
+ public static ContextCommandMessage getCreateMessage(AbstractContext abstractContext) {
+ if (abstractContext instanceof ServiceGroupContext) {
+ ServiceGroupContext sgCtx = (ServiceGroupContext) abstractContext;
+ ServiceGroupContextCommand cmd = new CreateServiceGroupContextCommand();
+ //TODO impl
cmd.setServiceGroupName(sgCtx.getDescription().getServiceGroupName());
cmd.setServiceGroupContextId(sgCtx.getId());
return cmd;
} else if (abstractContext instanceof ServiceContext) {
ServiceContext serviceCtx = (ServiceContext) abstractContext;
- ServiceContextCommand cmd;
- switch (operationType) {
- case CREATE:
- cmd = new CreateServiceContextCommand();
- ServiceGroupContext parent = (ServiceGroupContext)serviceCtx.getParent();
- if (parent != null) {
- ((CreateServiceContextCommand) cmd).setServiceGroupContextId(parent.getId());
- }
- break;
- case UPDATE:
- return new UpdateServiceContextCommand();
- case DELETE:
- return new DeleteServiceContextCommand();
- default:
- return null;
+ ServiceContextCommand cmd = new CreateServiceContextCommand();
+ ServiceGroupContext parent = (ServiceGroupContext) serviceCtx.getParent();
+ if (parent != null) {
+ ((CreateServiceContextCommand) cmd).setServiceGroupContextId(parent.getId());
}
+ //TODO: check impl
+ cmd.setServiceGroupName(serviceCtx.getGroupName());
+ cmd.setServiceName(serviceCtx.getAxisService().getName());
+ return cmd;
+ }
+ return null;
+ }
+
+ public static ContextCommandMessage getRemoveMessage(AbstractContext abstractContext) {
+ if (abstractContext instanceof ServiceGroupContext) {
+ ServiceGroupContext sgCtx = (ServiceGroupContext) abstractContext;
+ ServiceGroupContextCommand cmd = new DeleteServiceGroupContextCommand();
+ // TODO: impl
+ cmd.setServiceGroupName(sgCtx.getDescription().getServiceGroupName());
+ cmd.setServiceGroupContextId(sgCtx.getId());
+ return cmd;
+ } else if (abstractContext instanceof ServiceContext) {
+ ServiceContext serviceCtx = (ServiceContext) abstractContext;
+ ServiceContextCommand cmd = new DeleteServiceContextCommand();
+ // TODO: impl
cmd.setServiceGroupName(serviceCtx.getGroupName());
cmd.setServiceName(serviceCtx.getAxisService().getName());
return cmd;
Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/PropertyUpdater.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/PropertyUpdater.java?view=diff&rev=539751&r1=539750&r2=539751
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/PropertyUpdater.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/PropertyUpdater.java Sat May 19 06:34:50 2007
@@ -19,7 +19,6 @@
import org.apache.axis2.context.PropertyDifference;
import java.io.Serializable;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java?view=diff&rev=539751&r1=539750&r2=539751
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java Sat May 19 06:34:50 2007
@@ -45,6 +45,8 @@
private ChannelSender sender;
private ContextReplicationProcessor processor = new ContextReplicationProcessor();
+ private Map excludedReplicationPatterns = new HashMap();
+
public void setSender(ChannelSender sender) {
this.sender = sender;
}
@@ -53,23 +55,17 @@
}
public void addContext(final AbstractContext context) throws ClusteringFault {
- ContextCommandMessage message =
- ContextCommandMessageFactory.getMessage(context,
- ContextCommandMessageFactory.CREATE);
- processor.process(message);
+ processor.process(ContextCommandMessageFactory.getCreateMessage(context));
}
public void removeContext(AbstractContext context) throws ClusteringFault {
- ContextCommandMessage message =
- ContextCommandMessageFactory.getMessage(context,
- ContextCommandMessageFactory.DELETE);
- processor.process(message);
+ processor.process(ContextCommandMessageFactory.getRemoveMessage(context));
}
public void updateContext(AbstractContext context) throws ClusteringFault {
ContextCommandMessage message =
- ContextCommandMessageFactory.getMessage(context,
- ContextCommandMessageFactory.UPDATE);
+ ContextCommandMessageFactory.getUpdateMessage(context,
+ excludedReplicationPatterns);
processor.process(message);
}
@@ -117,6 +113,13 @@
listener.setConfigurationContext(configurationContext);
}
}
+ }
+
+ public void setReplicationExcludePatterns(String contextType, List patterns) {
+ System.out.println("### contextType=" + contextType);
+ System.out.println("### pattern=" + patterns);
+ //TODO: Method implementation
+ excludedReplicationPatterns.put(contextType, patterns);
}
// ---------------------- Methods from ParameterInclude ----------------------------------------
Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateConfigurationContextCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateConfigurationContextCommand.java?view=diff&rev=539751&r1=539750&r2=539751
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateConfigurationContextCommand.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateConfigurationContextCommand.java Sat May 19 06:34:50 2007
@@ -26,7 +26,10 @@
/**
*
*/
-public class UpdateConfigurationContextCommand extends ContextCommandMessage {
+public class UpdateConfigurationContextCommand
+ extends ContextCommandMessage
+ implements UpdateContextCommand {
+
private PropertyUpdater propertyUpdater = new PropertyUpdater();
public void execute(ConfigurationContext configurationContext) throws ClusteringFault {
@@ -37,14 +40,7 @@
return UPDATE_CONFIGURATION_CONTEXT_MSG;
}
- /*public void addConfigurationContextProperty(String key, Object value, int updateStatus) {
- if (propertyUpdater.getProperties() == null) {
- propertyUpdater.setProperties(new HashMap());
- }
- propertyUpdater.addContextProperty(key, value, updateStatus);
- }*/
-
- public void addConfigurationContextProperty(PropertyDifference diff) {
+ public void addProperty(PropertyDifference diff) {
if (propertyUpdater.getProperties() == null) {
propertyUpdater.setProperties(new HashMap());
}
Added: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateContextCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateContextCommand.java?view=auto&rev=539751
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateContextCommand.java (added)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateContextCommand.java Sat May 19 06:34:50 2007
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.axis2.cluster.tribes.context.messages;
+
+import org.apache.axis2.context.PropertyDifference;
+
+/**
+ *
+ */
+public interface UpdateContextCommand {
+ void addProperty(PropertyDifference diff);
+}
Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceContextCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceContextCommand.java?view=diff&rev=539751&r1=539750&r2=539751
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceContextCommand.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceContextCommand.java Sat May 19 06:34:50 2007
@@ -18,18 +18,21 @@
import org.apache.axis2.cluster.ClusteringFault;
import org.apache.axis2.cluster.tribes.context.PropertyUpdater;
import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.PropertyDifference;
+
+import java.util.HashMap;
/**
*
*/
-public class UpdateServiceContextCommand extends ServiceContextCommand {
+public class UpdateServiceContextCommand
+ extends ServiceContextCommand
+ implements UpdateContextCommand{
+
private PropertyUpdater propertyUpdater = new PropertyUpdater();
public void execute(ConfigurationContext configurationContext) throws ClusteringFault {
//TODO: Impl
-// ServiceGroupContext sgCtx =
-// configurationContext.getServiceGroupContext(serviceGroupContextId);
-// propertyUpdater.updateProperties(sgCtx);
/*ServiceGroupContext srvGrpCtx = configurationContext.getServiceGroupContext
(event.getParentContextID());
@@ -57,13 +60,23 @@
log.error(message);
}*/
+
+
+
+ //TODO: Get the service context
+// ServiceGroupContext sgCtx =
+// configurationContext.getServiceGroupContext(serviceGroupContextId);
+// propertyUpdater.updateProperties(sgCtx);
}
public int getMessageType() {
return UPDATE_SERVICE_CONTEXT_MSG;
}
- /* public void addServiceGroupContextProperty(String key, Object value, int updateStatus) {
- propertyUpdater.addContextProperty(key, value, updateStatus);
- }*/
+ public void addProperty(PropertyDifference diff) {
+ if (propertyUpdater.getProperties() == null) {
+ propertyUpdater.setProperties(new HashMap());
+ }
+ propertyUpdater.addContextProperty(diff);
+ }
}
Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceGroupContextCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceGroupContextCommand.java?view=diff&rev=539751&r1=539750&r2=539751
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceGroupContextCommand.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceGroupContextCommand.java Sat May 19 06:34:50 2007
@@ -19,11 +19,16 @@
import org.apache.axis2.cluster.tribes.context.PropertyUpdater;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.context.PropertyDifference;
+
+import java.util.HashMap;
/**
*
*/
-public class UpdateServiceGroupContextCommand extends ServiceGroupContextCommand {
+public class UpdateServiceGroupContextCommand
+ extends ServiceGroupContextCommand
+ implements UpdateContextCommand{
private PropertyUpdater propertyUpdater = new PropertyUpdater();
@@ -37,7 +42,10 @@
return UPDATE_SERVICE_GROUP_CONTEXT_MSG;
}
- /*public void addServiceGroupContextProperty(String key, Object value, int updateStatus) {
- propertyUpdater.addContextProperty(key, value, updateStatus);
- }*/
+ public void addProperty(PropertyDifference diff) {
+ if (propertyUpdater.getProperties() == null) {
+ propertyUpdater.setProperties(new HashMap());
+ }
+ propertyUpdater.addContextProperty(diff);
+ }
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManager.java?view=diff&rev=539751&r1=539750&r2=539751
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManager.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManager.java Sat May 19 06:34:50 2007
@@ -21,6 +21,8 @@
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.ParameterInclude;
+import java.util.List;
+
public interface ContextManager extends ParameterInclude {
public void addContext(AbstractContext context) throws ClusteringFault;
@@ -33,4 +35,15 @@
public void addContextManagerListener(ContextManagerListener listener);
public void setConfigurationContext(ConfigurationContext configurationContext);
+
+ /**
+ * All properties in the context with type <code>contextType</code> which have
+ * names that match the specified pattern will be excluded from replication.
+ *
+ * Generally, we can use the context class name as the context type.
+ *
+ * @param contextType
+ * @param patterns The patterns
+ */
+ public void setReplicationExcludePatterns(String contextType, List patterns);
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java?view=diff&rev=539751&r1=539750&r2=539751
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java Sat May 19 06:34:50 2007
@@ -29,7 +29,9 @@
import javax.xml.namespace.QName;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
/**
@@ -50,12 +52,12 @@
/**
* Populates service from corresponding OM.
*/
- public void buildCluster(OMElement clusterElement)
- throws DeploymentException {
+ public void buildCluster(OMElement clusterElement) throws DeploymentException {
OMAttribute classNameAttr = clusterElement.getAttribute(new QName(TAG_CLASS_NAME));
if (classNameAttr == null) {
- throw new DeploymentException(Messages.getMessage("classAttributeNotFound", TAG_CLUSTER));
+ throw new DeploymentException(Messages.getMessage("classAttributeNotFound",
+ TAG_CLUSTER));
}
String className = classNameAttr.getAttributeValue();
@@ -65,103 +67,174 @@
clusterManager = (ClusterManager) clazz.newInstance();
//loading the parameters.
- Iterator params = clusterElement.getChildrenWithName(new QName(TAG_PARAMETER));
- processParameters(params, clusterManager, null);
+ processParameters(clusterElement.getChildrenWithName(new QName(TAG_PARAMETER)),
+ clusterManager,
+ null);
//loading the ConfigurationManager
- OMElement configurationManagerElement = clusterElement.getFirstChildWithName(
- new QName(TAG_CONFIGURATION_MANAGER));
- if (configurationManagerElement != null) {
- classNameAttr = configurationManagerElement.getAttribute(new QName(TAG_CLASS_NAME));
- if (classNameAttr == null) {
- throw new DeploymentException(Messages.getMessage("classAttributeNotFound", TAG_CONFIGURATION_MANAGER));
- }
+ loadConfigManager(clusterElement, clusterManager);
- className = classNameAttr.getAttributeValue();
- clazz = Class.forName(className);
+ // loading the ContextManager
+ loadContextManager(clusterElement, clusterManager);
- ConfigurationManager configurationManager = (ConfigurationManager) clazz
- .newInstance();
- clusterManager.setConfigurationManager(configurationManager);
-
- OMElement listenersElement = configurationManagerElement
- .getFirstChildWithName(new QName(TAG_LISTENERS));
- if (listenersElement != null) {
- Iterator listenerElemIter = listenersElement.getChildrenWithName(new QName(
- TAG_LISTENER));
- while (listenerElemIter.hasNext()) {
- OMElement listenerElement = (OMElement) listenerElemIter.next();
- classNameAttr = listenerElement.getAttribute(new QName(TAG_CLASS_NAME));
- if (classNameAttr == null) {
- throw new DeploymentException(Messages.getMessage("classAttributeNotFound", TAG_LISTENER));
- }
-
- className = classNameAttr.getAttributeValue();
- clazz = Class.forName(className);
- ConfigurationManagerListener listener = (ConfigurationManagerListener) clazz
- .newInstance();
- listener.setConfigurationContext(configCtx);
- configurationManager.addConfigurationManagerListener(listener);
+ axisConfig.setClusterManager(clusterManager);
+ } catch (ClassNotFoundException e) {
+ throw new DeploymentException(Messages.getMessage("clusterImplNotFound"));
+ } catch (InstantiationException e) {
+ throw new DeploymentException(Messages.getMessage("cannotLoadClusterImpl"));
+ } catch (IllegalAccessException e) {
+ throw new DeploymentException(e);
+ }
+ }
+
+ private void loadContextManager(OMElement clusterElement,
+ ClusterManager clusterManager) throws DeploymentException,
+ ClassNotFoundException,
+ InstantiationException,
+ IllegalAccessException {
+ OMElement contextManagerEle =
+ clusterElement.getFirstChildWithName(new QName(TAG_CONTEXT_MANAGER));
+ if (contextManagerEle != null) {
+
+ // Load & set the ContextManager class
+ OMAttribute classNameAttr =
+ contextManagerEle.getAttribute(new QName(ATTRIBUTE_CLASS));
+ if (classNameAttr == null) {
+ throw new DeploymentException(Messages.getMessage("classAttributeNotFound",
+ TAG_CONTEXT_MANAGER));
+ }
+
+ String className = classNameAttr.getAttributeValue();
+
+ Class clazz = Class.forName(className);
+ ContextManager contextManager = (ContextManager) clazz.newInstance();
+ clusterManager.setContextManager(contextManager);
+
+ // Load & set the ContextManagerListener objects
+ OMElement listenersElement =
+ contextManagerEle.getFirstChildWithName(new QName(TAG_LISTENERS));
+ if (listenersElement != null) {
+ for (Iterator iter = listenersElement.getChildrenWithName(new QName(TAG_LISTENER));
+ iter.hasNext();) {
+ OMElement listenerElement = (OMElement) iter.next();
+ classNameAttr = listenerElement.getAttribute(new QName(TAG_CLASS_NAME));
+ if (classNameAttr == null) {
+ throw new DeploymentException(Messages.getMessage("classAttributeNotFound",
+ TAG_LISTENER));
}
+
+ className = classNameAttr.getAttributeValue();
+ clazz = Class.forName(className);
+ ContextManagerListener listener = (ContextManagerListener) clazz.newInstance();
+ contextManager.addContextManagerListener(listener);
}
+ }
- //updating the ConfigurationManager with the new ConfigurationContext
- configurationManager.setConfigurationContext(configCtx);
+ //loading the parameters.
+ processParameters(contextManagerEle.getChildrenWithName(new QName(TAG_PARAMETER)),
+ contextManager,
+ null);
+
+ // Load the replication patterns to be excluded. We load the following structure.
+ /*<replication>
+ <defaults>
+ <exclude name="foo.bar.*"/>
+ </defaults>
+ <context class="org.apache.axis2.context.ConfigurationContext">
+ <exclude name="my.sandesha.*"/>
+ </context>
+ <context class="org.apache.axis2.context.ServiceGroupContext">
+ <exclude name="my.sandesha.*"/>
+ </context>
+ <context class="org.apache.axis2.context.ServiceContext">
+ <exclude name="my.sandesha.*"/>
+ </context>
+ </replication>*/
+ OMElement replicationEle =
+ contextManagerEle.getFirstChildWithName(new QName(TAG_REPLICATION));
+ if (replicationEle != null) {
+ // Process defaults
+ OMElement defaultsEle =
+ replicationEle.getFirstChildWithName(new QName(TAG_DEFAULTS));
+ if (defaultsEle != null) {
+ List defaults = new ArrayList();
+ for (Iterator iter = defaultsEle.getChildrenWithName(new QName(TAG_EXCLUDE));
+ iter.hasNext();) {
+ OMElement excludeEle = (OMElement) iter.next();
+ OMAttribute nameAtt = excludeEle.getAttribute(new QName(ATTRIBUTE_NAME));
+ defaults.add(nameAtt.getAttributeValue());
+ }
+ contextManager.setReplicationExcludePatterns(TAG_DEFAULTS, defaults);
+ }
- //loading the parameters.
- processParameters(configurationManagerElement.getChildrenWithName(new QName(TAG_PARAMETER)),
- configurationManager,
- null);
+ // Process specifics
+ for (Iterator iter = replicationEle.getChildrenWithName(new QName(TAG_CONTEXT));
+ iter.hasNext();) {
+ OMElement contextEle = (OMElement) iter.next();
+ String ctxClassName =
+ contextEle.getAttribute(new QName(ATTRIBUTE_CLASS)).getAttributeValue();
+ List excludes = new ArrayList();
+ for (Iterator iter2 = contextEle.getChildrenWithName(new QName(TAG_EXCLUDE));
+ iter2.hasNext();) {
+ OMElement excludeEle = (OMElement) iter2.next();
+ OMAttribute nameAtt = excludeEle.getAttribute(new QName(ATTRIBUTE_NAME));
+ excludes.add(nameAtt.getAttributeValue());
+ }
+ contextManager.setReplicationExcludePatterns(ctxClassName, excludes);
+ }
}
+ }
+ }
- // loading the ContextManager
- OMElement contextManagerElement = clusterElement.getFirstChildWithName(
- new QName(TAG_CONTEXT_MANAGER));
- if (contextManagerElement != null) {
- classNameAttr = contextManagerElement.getAttribute(new QName(TAG_CLASS_NAME));
- if (classNameAttr == null) {
- throw new DeploymentException(Messages.getMessage("classAttributeNotFound", TAG_CONTEXT_MANAGER));
- }
+ private void loadConfigManager(OMElement clusterElement,
+ ClusterManager clusterManager) throws DeploymentException,
+ ClassNotFoundException,
+ InstantiationException,
+ IllegalAccessException {
+ OMElement configManagerEle =
+ clusterElement.getFirstChildWithName(new QName(TAG_CONFIGURATION_MANAGER));
+ if (configManagerEle != null) {
+ OMAttribute classNameAttr = configManagerEle.getAttribute(new QName(ATTRIBUTE_CLASS));
+ if (classNameAttr == null) {
+ throw new DeploymentException(Messages.getMessage("classAttributeNotFound",
+ TAG_CONFIGURATION_MANAGER));
+ }
- className = classNameAttr.getAttributeValue();
+ String className = classNameAttr.getAttributeValue();
+ Class clazz = Class.forName(className);
- clazz = Class.forName(className);
- ContextManager contextManager = (ContextManager) clazz.newInstance();
- clusterManager.setContextManager(contextManager);
-
- OMElement listenersElement = contextManagerElement.getFirstChildWithName(new QName(
- TAG_LISTENERS));
- if (listenersElement != null) {
- Iterator listenerElemIter = listenersElement.getChildrenWithName(new QName(
- TAG_LISTENER));
- while (listenerElemIter.hasNext()) {
- OMElement listenerElement = (OMElement) listenerElemIter.next();
- classNameAttr = listenerElement.getAttribute(new QName(TAG_CLASS_NAME));
- if (classNameAttr == null) {
- throw new DeploymentException(Messages.getMessage("classAttributeNotFound", TAG_LISTENER));
- }
-
- className = classNameAttr.getAttributeValue();
- clazz = Class.forName(className);
- ContextManagerListener listener = (ContextManagerListener) clazz.newInstance();
- contextManager.addContextManagerListener(listener);
+ ConfigurationManager configurationManager =
+ (ConfigurationManager) clazz.newInstance();
+ clusterManager.setConfigurationManager(configurationManager);
+
+ OMElement listenersElement =
+ configManagerEle.getFirstChildWithName(new QName(TAG_LISTENERS));
+ if (listenersElement != null) {
+ Iterator listenerElemIter = listenersElement.getChildrenWithName(new QName(
+ TAG_LISTENER));
+ while (listenerElemIter.hasNext()) {
+ OMElement listenerElement = (OMElement) listenerElemIter.next();
+ classNameAttr = listenerElement.getAttribute(new QName(TAG_CLASS_NAME));
+ if (classNameAttr == null) {
+ throw new DeploymentException(Messages.getMessage("classAttributeNotFound", TAG_LISTENER));
}
- }
- //loading the parameters.
- processParameters(contextManagerElement.getChildrenWithName(new QName(TAG_PARAMETER)),
- contextManager,
- null);
+ className = classNameAttr.getAttributeValue();
+ clazz = Class.forName(className);
+ ConfigurationManagerListener listener = (ConfigurationManagerListener) clazz
+ .newInstance();
+ listener.setConfigurationContext(configCtx);
+ configurationManager.addConfigurationManagerListener(listener);
+ }
}
- axisConfig.setClusterManager(clusterManager);
- } catch (ClassNotFoundException e) {
- throw new DeploymentException(Messages.getMessage("clusterImplNotFound"));
- } catch (InstantiationException e) {
- e.printStackTrace();
- throw new DeploymentException(Messages.getMessage("cannotLoadClusterImpl"));
- } catch (IllegalAccessException e) {
- throw new DeploymentException(e);
+ //updating the ConfigurationManager with the new ConfigurationContext
+ configurationManager.setConfigurationContext(configCtx);
+
+ //loading the parameters.
+ processParameters(configManagerEle.getChildrenWithName(new QName(TAG_PARAMETER)),
+ configurationManager,
+ null);
}
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java?view=diff&rev=539751&r1=539750&r2=539751
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java Sat May 19 06:34:50 2007
@@ -96,7 +96,12 @@
String TAG_CONFIGURATION_MANAGER = "configurationManager";
String TAG_CONTEXT_MANAGER = "contextManager";
String TAG_LISTENERS = "listeners";
-
+ String TAG_REPLICATION = "replication";
+ String TAG_DEFAULTS = "defaults";
+ String TAG_CONTEXT = "context";
+ String TAG_EXCLUDE = "exclude";
+ String ATTRIBUTE_CLASS = "class";
+
//Deployer related cons
String DIRECTORY = "directory";
String EXTENSION = "extension";
@@ -116,7 +121,7 @@
String ATTRIBUTE_DEFAULT_VERSION = "version";
String ATTRIBUTE_SCOPE = "scope";
String ATTRIBUTE_LOCKED = "locked";
-
+
// Whether to activate a deployed service.
String ATTRIBUTE_ACTIVATE = "activate";
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org