/** * {@inheritDoc} */ @Override public String toString() { return getType(); } }
/** * Defaults to the standalone configuration if type is not specified by the user. * * @param typeAsString the configuration type as a string * @see org.codehaus.cargo.generic.configuration.ConfigurationFactory */ public void setType(String typeAsString) { this.type = ConfigurationType.toType(typeAsString); }
/** * Transform a type represented as a string into a {@link ConfigurationType} object. * * @param typeAsString the string to transform * @return the {@link ConfigurationType} object */ public static ConfigurationType toType(String typeAsString) { ConfigurationType type; if (typeAsString.equalsIgnoreCase(STANDALONE.getType())) { type = STANDALONE; } else if (typeAsString.equalsIgnoreCase(EXISTING.getType())) { type = EXISTING; } else if (typeAsString.equalsIgnoreCase(RUNTIME.getType())) { type = RUNTIME; } else { type = new ConfigurationType(typeAsString); } return type; }
@Override protected void addConfigurationScriptProperties(Map<String, String> propertiesMap) { if (ConfigurationType.RUNTIME.equals(getConfiguration().getType())) { propertiesMap.put("cargo.weblogic.login.user", getConfiguration(). getPropertyValue(RemotePropertySet.USERNAME)); propertiesMap.put("cargo.weblogic.login.password", getConfiguration(). getPropertyValue(RemotePropertySet.PASSWORD)); } else { propertiesMap.put("cargo.weblogic.login.user", getConfiguration(). getPropertyValue(WebLogicPropertySet.ADMIN_USER)); propertiesMap.put("cargo.weblogic.login.password", getConfiguration(). getPropertyValue(WebLogicPropertySet.ADMIN_PWD)); } } }
parameters.setParameter("configurationType", configuration.getType().toString()); parameters.setParameter("timeout", String.valueOf(container.getTimeout()));
@Override protected void addConfigurationScriptProperties(Map<String, String> propertiesMap) { if (ConfigurationType.RUNTIME.equals(getConfiguration().getType())) { propertiesMap.put("cargo.weblogic.login.user", getConfiguration(). getPropertyValue(RemotePropertySet.USERNAME)); propertiesMap.put("cargo.weblogic.login.password", getConfiguration(). getPropertyValue(RemotePropertySet.PASSWORD)); } else { propertiesMap.put("cargo.weblogic.login.user", getConfiguration(). getPropertyValue(WebLogicPropertySet.ADMIN_USER)); propertiesMap.put("cargo.weblogic.login.password", getConfiguration(). getPropertyValue(WebLogicPropertySet.ADMIN_PWD)); } } }
parameters.setParameter("configurationType", configuration.getType().toString()); parameters.setParameter("timeout", String.valueOf(container.getTimeout()));
/** * @param type Configuration type. */ public void setType(ConfigurationType type) { this.type = type.getType(); }
/** * Defaults to the standalone configuration if type is not specified by the user. * * @param typeAsString the configuration type as a string * @see org.codehaus.cargo.generic.configuration.ConfigurationFactory */ public void setType(String typeAsString) { this.type = ConfigurationType.toType(typeAsString); }
""); else if (ConfigurationType.RUNTIME.equals(getType()))
/** * @return Configuration type. */ public ConfigurationType getType() { return ConfigurationType.toType(this.type); }
/** * {@inheritDoc} */ @Override public boolean isConfigurationRegistered(String containerId, ContainerType containerType, ConfigurationType configurationType) { return hasMapping(new RegistrationKey(new FullContainerIdentity(containerId, containerType), configurationType.getType())); }
/** * {@inheritDoc} */ @Override protected Constructor<? extends Configuration> getConstructor( Class<? extends Configuration> configurationClass, String hint, GenericParameters parameters) throws NoSuchMethodException { Constructor<? extends Configuration> constructor; // Runtime configurations have constructors that do not take any parameter. if (ConfigurationType.toType(hint) == ConfigurationType.RUNTIME) { constructor = configurationClass.getConstructor(new Class[] {}); } else if (ConfigurationType.toType(hint) == ConfigurationType.EXISTING || ConfigurationType.toType(hint) == ConfigurationType.STANDALONE) { constructor = configurationClass.getConstructor(new Class[] {String.class}); } else { throw new ContainerException("Unknown configuration type [" + hint + "]"); } return constructor; }
/** * {@inheritDoc} */ @Override public Class<? extends Configuration> getConfigurationClass(String containerId, ContainerType containerType, ConfigurationType configurationType) { return getMapping(new RegistrationKey(new FullContainerIdentity(containerId, containerType), configurationType.getType())); }
/** * {@inheritDoc} */ @Override protected Constructor<? extends Configuration> getConstructor( Class<? extends Configuration> configurationClass, String hint, GenericParameters parameters) throws NoSuchMethodException { Constructor<? extends Configuration> constructor; // Runtime configurations have constructors that do not take any parameter. if (ConfigurationType.toType(hint) == ConfigurationType.RUNTIME) { constructor = configurationClass.getConstructor(new Class[] {}); } else if (ConfigurationType.toType(hint) == ConfigurationType.EXISTING || ConfigurationType.toType(hint) == ConfigurationType.STANDALONE) { constructor = configurationClass.getConstructor(new Class[] {String.class}); } else { throw new ContainerException("Unknown configuration type [" + hint + "]"); } return constructor; }
/** * {@inheritDoc} */ @Override public Class<? extends Configuration> getConfigurationClass(String containerId, ContainerType containerType, ConfigurationType configurationType) { return getMapping(new RegistrationKey(new FullContainerIdentity(containerId, containerType), configurationType.getType())); }
/** * {@inheritDoc} */ @Override public void registerConfigurationCapability(String containerId, ContainerType containerType, ConfigurationType configurationType, Class<? extends ConfigurationCapability> configurationCapabilityClass) { registerImplementation(new RegistrationKey(new FullContainerIdentity(containerId, containerType), configurationType.getType()), configurationCapabilityClass); }