}
// Set the context root on the extension module as a property
if(appBean instanceof ExtensionModule) {
ExtensionModule extApp = (ExtensionModule) appBean;
ElementProperty isConvergedProperty = new ElementProperty();
isConvergedProperty.setName(IS_CONVERGED);
ElementProperty contextRootProperty = new ElementProperty();
contextRootProperty.setName(CONTEXT_ROOT);
Properties props = request.getOptionalArguments();
/*
* The (name=value)[:name=value]* of the property option is
* converted to ElementProperty here.
*/
Map<String, String> propMap = (Map) props.get("property");
if(propMap != null) {
ArrayList list = new ArrayList();
for (Iterator<String> itr = propMap.keySet().iterator(); itr.hasNext();) {
String key = itr.next();
ElementProperty property = new ElementProperty();
property.setName(key);
property.setValue(propMap.get(key));
list.add(property);
}
ElementProperty[] eProp = (ElementProperty[]) list.toArray(new ElementProperty[list.size()]);
extApp.setElementProperty(eProp);
}
String value = props.getProperty("isConverged");
if(value != null ) {
if("true".equals(value)) {
isConvergedProperty.setValue("true");
// Check if context root is explictily set
if(request.getContextRoot() != null) {
contextRootProperty.setValue(request.getContextRoot());
} else {
contextRootProperty.setValue(
request.getDefaultContextRoot());
}
if(extApp.getElementPropertyByName("isConverged") != null ) {
extApp.removeElementProperty(
extApp.getElementPropertyByName("isConverged"));
}
if(extApp.getElementPropertyByName("contextRoot") != null) {
extApp.removeElementProperty(
extApp.getElementPropertyByName("contextRoot"));
}
extApp.addElementProperty(isConvergedProperty, true);
extApp.addElementProperty(contextRootProperty, true );
} else {
isConvergedProperty.setValue("false");
if(extApp.getElementPropertyByName("isConverged") != null ) {
extApp.removeElementProperty(
extApp.getElementPropertyByName("isConverged"));
}
extApp.addElementProperty(isConvergedProperty);
}
}
}
// now see if there is a property added for j2ee-applications