clazz = Class.forName(className);
} catch (ClassNotFoundException e) {
throw new DeploymentException(Messages.getMessage("clusterImplNotFound",
className));
}
ContextManager contextManager = (ContextManager) clazz.newInstance();
clusterManager.setContextManager(contextManager);
// Load & set the ContextManagerListener
OMElement listenerEle =
contextManagerEle.getFirstChildWithName(new QName(TAG_LISTENER));
if (listenerEle != null) {
classNameAttr = listenerEle.getAttribute(new QName(TAG_CLASS_NAME));
if (classNameAttr == null) {
throw new DeploymentException(Messages.getMessage("classAttributeNotFound",
TAG_LISTENER));
}
className = classNameAttr.getAttributeValue();
try {
clazz = Class.forName(className);
} catch (ClassNotFoundException e) {
throw new DeploymentException(Messages.getMessage("clusterImplNotFound",
className));
}
ContextManagerListener listener = (ContextManagerListener) clazz.newInstance();
contextManager.setContextManagerListener(listener);
} else {
throw new DeploymentException(Messages.getMessage("contextManagerListenerIsNull"));
}
//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);
}
// 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);
}
}
}
}