}
public static void setPropertyOnAppBean(ConfigBean appBean,
DeploymentRequest request) throws ConfigException {
if (request.isExternallyManagedApp()) {
ElementProperty extManagedProperty = new ElementProperty();
extManagedProperty.setName(EXTERNALLY_MANAGED);
extManagedProperty.setValue("true");
if (appBean instanceof J2eeApplication) {
J2eeApplication app = (J2eeApplication) appBean;
app.addElementProperty(extManagedProperty);
} else if (appBean instanceof EjbModule) {
EjbModule app = (EjbModule) appBean;
app.addElementProperty(extManagedProperty);
} else if (appBean instanceof WebModule) {
WebModule app = (WebModule) appBean;
app.addElementProperty(extManagedProperty);
} else if (appBean instanceof AppclientModule) {
AppclientModule app = (AppclientModule) appBean;
app.addElementProperty(extManagedProperty);
} else if (appBean instanceof ConnectorModule) {
ConnectorModule app = (ConnectorModule) appBean;
app.addElementProperty(extManagedProperty);
}
}
// 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
if(appBean instanceof J2eeApplication) {
Properties props = request.getOptionalArguments();
if(props.containsKey("isConverged")) {
ElementProperty isConvergedAppProp = new ElementProperty();
isConvergedAppProp.setName(IS_CONVERGED);
isConvergedAppProp.setValue("true");
if(((J2eeApplication)appBean).getElementPropertyByName("isConverged") != null ) {
((J2eeApplication)appBean).removeElementProperty(
((J2eeApplication)appBean).getElementPropertyByName("isConverged"));
}