String parentCollectionPath = CEPConstants.CEP_CONF_ELE_CEP_BUCKETS + CEPConstants.CEP_REGISTRY_BS;
try {
if (registry.resourceExists(parentCollectionPath)) {
if (registry.get(parentCollectionPath) instanceof Collection) {
Collection cepBucketsCollection = (Collection) registry.get(parentCollectionPath);
buckets = new Bucket[cepBucketsCollection.getChildCount()];
int bucketCount = 0;
for (String bucketName : cepBucketsCollection.getChildren()) {
Bucket bucket = new Bucket();
if (registry.get(bucketName) instanceof Collection) {
Collection bucketDetailsCollection = (Collection) registry.get(bucketName);
for (String attirbute : bucketDetailsCollection.getChildren()) {
if (registry.get(attirbute) instanceof Collection) {
Input input;
Query query;
Collection attributeCollection = (Collection) registry.get(attirbute);
for (String names : attributeCollection.getChildren()) {
if (registry.get(names) instanceof Collection) {
if ((CEPConstants.CEP_REGISTRY_BS + CEPConstants.CEP_REGISTRY_INPUTS)
.equals(attirbute.substring(attirbute.lastIndexOf(CEPConstants.CEP_REGISTRY_BS)))) {
input = new Input();
Collection collection3 = (Collection) registry.get(names);
for (String names2 : collection3.getChildren()) {
if (registry.get(names2) instanceof Collection) {
Collection mappingCollection = (Collection) registry.get(names2);
Mapping mapping = new Mapping();
for (String mappingChild : mappingCollection.getChildren()) {
if (registry.get(mappingChild) instanceof Collection) {
Collection mapCollection = (Collection) registry.get(mappingChild);
if ((CEPConstants.CEP_REGISTRY_BS + CEPConstants.CEP_REGISTRY_XPATH_DEFS)
.equals(mappingChild.substring(mappingChild.lastIndexOf(CEPConstants.CEP_REGISTRY_BS)))) {
for (String defs : mapCollection.getChildren()) {
Resource xpathDefResource = registry.get(defs);
Hashtable propertiesHashtable = xpathDefResource.getProperties();
Enumeration e = propertiesHashtable.keys();
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
ArrayList values = (ArrayList) propertiesHashtable.get(key);
XpathDefinition xpathDefinition = new XpathDefinition();
xpathDefinition.setPrefix(key);
xpathDefinition.setNamespace(values.get(0).toString());
mapping.addXpathDefinition(xpathDefinition);
}
}
} else if (
(CEPConstants.CEP_REGISTRY_BS + CEPConstants.CEP_REGISTRY_PROPERTIES)
.equals(mappingChild.substring(mappingChild.lastIndexOf(CEPConstants.CEP_REGISTRY_BS)))) {
for (String defs : mapCollection.getChildren()) {
Resource xpathDefResource = registry.get(defs);
Hashtable propertiesHashtable = xpathDefResource.getProperties();
Enumeration e = propertiesHashtable.keys();
Property property = new Property();
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
ArrayList values = (ArrayList) propertiesHashtable.get(key);
if (CEPConstants.CEP_REGISTRY_NAME.equals(key)) {
property.setName(values.get(0).toString());
} else if (CEPConstants.CEP_REGISTRY_TYPE.equals(key)) {
property.setType(values.get(0).toString());
} else if (CEPConstants.CEP_REGISTRY_XPATH.equals(key)) {
property.setXpath(values.get(0).toString());
}
}
mapping.addProperty(property);
}
}
} else {
Resource resource = registry.get(mappingChild);
Hashtable propertiesHashtable = resource.getProperties();
Enumeration e = propertiesHashtable.keys();
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
ArrayList values = (ArrayList) propertiesHashtable.get(key);
if (CEPConstants.CEP_REGISTRY_STREAM.equals(key)) {
mapping.setStream(values.get(0).toString());
}
}
}
}
input.setMapping(mapping);
} else {
if ((CEPConstants.CEP_REGISTRY_BS + CEPConstants.CEP_REGISTRY_DETAILS)
.equals(names2.substring(names2.lastIndexOf(CEPConstants.CEP_REGISTRY_BS)))) {
Resource resource = registry.get(names2);
Hashtable propertiesHashtable = resource.getProperties();
Enumeration e = propertiesHashtable.keys();
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
ArrayList values = (ArrayList) propertiesHashtable.get(key);
if (CEPConstants.CEP_REGISTRY_TOPIC.equals(key)) {
input.setTopic(values.get(0).toString());
} else if (CEPConstants.CEP_CONF_ELE_BROKER_NAME.equals(key)) {
input.setBrokerName(values.get(0).toString());
}
}
}
}
}
bucket.addInput(input);
} else if ((CEPConstants.CEP_REGISTRY_BS + CEPConstants.CEP_REGISTRY_QUERIES)
.equals(attirbute.substring(attirbute.lastIndexOf(CEPConstants.CEP_REGISTRY_BS)))) {
query = new Query();
Expression expression = new Expression();
Output output = new Output();
Collection collection3 = (Collection) registry.get(names);
for (String names2 : collection3.getChildren()) {
if (registry.get(names2) instanceof Collection) {
Collection outputCollection = (Collection) registry.get(names2);
for (String outputS : outputCollection.getChildren()) {
if (registry.get(outputS) instanceof Collection) {
Collection outputMapping = (Collection) registry.get(outputS);
if ((CEPConstants.CEP_REGISTRY_BS + CEPConstants.CEP_REGISTRY_ELEMENT_MAPPING)
.equals(outputS.substring(outputS.lastIndexOf(CEPConstants.CEP_REGISTRY_BS)))) {
ElementMapping elementMapping = new ElementMapping();
for (String mappingName : outputMapping.getChildren()) {
if (registry.get(mappingName) instanceof Collection) {
Collection propertyCollection = (Collection) registry.get(mappingName);
for (String propertyName : propertyCollection.getChildren()) {
Resource propertyResource = registry.get(propertyName);
Hashtable propertiesHashtable = propertyResource.getProperties();
Enumeration e = propertiesHashtable.keys();
Property property = new Property();
while (e.hasMoreElements()) {