/* this method create and returns the instance object */ protected void createInstance(OMElement instanceNode, ProductGroup productGroup) { Instance instance = new Instance(); String instanceName = instanceNode.getAttributeValue( QName.valueOf(ContextConstants.PLATFORM_CONTEXT_INSTANCE_NAME)); String instanceType = instanceNode.getAttributeValue( QName.valueOf(ContextConstants.PLATFORM_CONTEXT_INSTANCE_TYPE)); String instancePortType = instanceNode.getAttributeValue( QName.valueOf(ContextConstants.PLATFORM_CONTEXT_INSTANCE_PORT_TYPE)); instance.setName(instanceName); instance.setType(instanceType); instance.setServicePortType(instancePortType); Iterator instancePropertiesIterator = instanceNode.getChildElements(); OMElement instancePropertyNode; while (instancePropertiesIterator.hasNext()) { instancePropertyNode = (OMElement) instancePropertiesIterator.next(); // set the attribute values of the current instance String attribute = instancePropertyNode.getLocalName(); String attributeValue = instancePropertyNode.getText(); // set the property values of the current instance if (attribute.equals(ContextConstants.PLATFORM_CONTEXT_INSTANCE_HOST)) { instance.setHost(attributeValue); } else if (attribute.equals(ContextConstants.PLATFORM_CONTEXT_INSTANCE_HTTP_PORT)) { instance.setHttpPort(attributeValue); } else if (attribute.equals(ContextConstants.PLATFORM_CONTEXT_INSTANCE_HTTPS_PORT)) { instance.setHttpsPort(attributeValue); } else if (attribute.equals(ContextConstants.PLATFORM_CONTEXT_INSTANCE_WEB_CONTEXT)) { instance.setWebContext(attributeValue); } else if (attribute.equals(ContextConstants.PLATFORM_CONTEXT_INSTANCE_NHTTP_PORT)) { instance.setNhttpPort(attributeValue); } else if (attribute.equals(ContextConstants.PLATFORM_CONTEXT_INSTANCE_NHTTPS_PORT)) { instance.setNhttpsPort(attributeValue); } // add all the properties to the Map structure // this handles the unknown properties add by the user instance.addProperty(attribute, attributeValue); } if (instance.getType().equals(InstanceTypes.lb_worker_manager.name())) { LBWorkerManagerInstance lbWorkerManagerInstance = new LBWorkerManagerInstance(instance); lbWorkerManagerInstance.setWorkerHost( instance.getPropertyByKey(ContextConstants.PLATFORM_CONTEXT_INSTANCE_WORKER_HOST)); lbWorkerManagerInstance.setManagerHost( instance.getPropertyByKey(ContextConstants.PLATFORM_CONTEXT_INSTANCE_MANAGER_HOST)); productGroup.addLBWorkerManagerInstance(lbWorkerManagerInstance); } else if (instance.getType().equals(InstanceTypes.lb_worker.name())) { LBWorkerInstance lbWorkerInstance = new LBWorkerInstance(instance); lbWorkerInstance.setWorkerHost( instance.getPropertyByKey(ContextConstants.PLATFORM_CONTEXT_INSTANCE_WORKER_HOST)); productGroup.addLBWorkerInstance(lbWorkerInstance); } else if (instance.getType().equals(InstanceTypes.lb_manager.name())) { LBManagerInstance lbManagerInstance = new LBManagerInstance(instance); lbManagerInstance.setManagerHost( instance.getPropertyByKey(ContextConstants.PLATFORM_CONTEXT_INSTANCE_MANAGER_HOST)); productGroup.addLBManagerInstance(lbManagerInstance); } else if (instance.getType().equals(InstanceTypes.standalone.name())) { productGroup.addStandaloneInstance(instance); } else if (instance.getType().equals(InstanceTypes.manager.name())) { productGroup.addManagerInstance(instance); } else if (instance.getType().equals(InstanceTypes.worker.name())) { productGroup.addWorkerInstance(instance); } else if (instance.getType().equals(InstanceTypes.lb.name())) { productGroup.addLBInstance(instance); } }
/** @see #getStoreResource(Type,long) */ public StoreResource getStoreResource(final Instance _instance) throws EFapsException { return getStoreResource(_instance.getType(), _instance.getId()); }