/** * Returns a deployerURL based on default values. * @param configuration The server configuration object * @return The url for the deployer */ protected String createDefaultDeployerUrl(Configuration configuration) { String protocol = configuration.getPropertyValue(GeneralPropertySet.PROTOCOL); String host = configuration.getPropertyValue(GeneralPropertySet.HOSTNAME); String port = configuration.getPropertyValue(ServletPropertySet.PORT); String deployerUrl = protocol + "://" + host + ":" + port + "/" + DEFAULT_DEPLOYER_CONTEXT; return deployerUrl; }
/** * Returns a deployerURL based on default values. * @param configuration The server configuration object * @return The url for the deployer */ protected String createDefaultDeployerUrl(Configuration configuration) { String protocol = configuration.getPropertyValue(GeneralPropertySet.PROTOCOL); String host = configuration.getPropertyValue(GeneralPropertySet.HOSTNAME); String port = configuration.getPropertyValue(ServletPropertySet.PORT); String deployerUrl = protocol + "://" + host + ":" + port + "/" + DEFAULT_DEPLOYER_CONTEXT; return deployerUrl; }
/** * Saves the username and password based on the CARGO {@link Configuration}. * @param configuration CARGO {@link Configuration} from which to retrieve the username, * password or other data. */ public UsernamePasswordCallbackHandler(Configuration configuration) { this.logger = configuration.getLogger(); this.username = configuration.getPropertyValue(RemotePropertySet.USERNAME); this.password = configuration.getPropertyValue(RemotePropertySet.PASSWORD); }
/** * Remote deployer for the Jetty container. * @param container The container used for deployment */ public JettyRemoteDeployer(RemoteContainer container) { super(container); Configuration configuration = container.getConfiguration(); username = configuration.getPropertyValue(RemotePropertySet.USERNAME); password = configuration.getPropertyValue(RemotePropertySet.PASSWORD); deployerUrl = configuration.getPropertyValue(JettyPropertySet.DEPLOYER_URL); if (deployerUrl == null) { this.deployerUrl = createDefaultDeployerUrl(configuration); } }
/** * Remote deployer for the Jetty container. * @param container The container used for deployment */ public JettyRemoteDeployer(RemoteContainer container) { super(container); Configuration configuration = container.getConfiguration(); username = configuration.getPropertyValue(RemotePropertySet.USERNAME); password = configuration.getPropertyValue(RemotePropertySet.PASSWORD); deployerUrl = configuration.getPropertyValue(JettyPropertySet.DEPLOYER_URL); if (deployerUrl == null) { this.deployerUrl = createDefaultDeployerUrl(configuration); } }
/** * @return JBoss profile for the {@link Configuration}. */ private ProfileKey getProfile() { String server = this.configuration.getPropertyValue(JBossPropertySet.CONFIGURATION); if (server == null || server.trim().isEmpty()) { server = ProfileKey.DEFAULT; } String profile = this.configuration.getPropertyValue(JBossPropertySet.PROFILE); boolean isClustered = Boolean.parseBoolean(this.configuration.getPropertyValue( JBossPropertySet.CLUSTERED)); String name = isClustered ? "farm" : profile; if (name == null || name.trim().isEmpty()) { name = ProfileKey.DEFAULT; } return new ProfileKey(ProfileKey.DEFAULT, server, name); }
@Override public boolean isApplicable() { boolean transactionTimeoutSet = getConfiguration(). getPropertyValue(WebLogicPropertySet.JTA_TRANSACTION_TIMEOUT) != null; return transactionTimeoutSet; } }
@Override public boolean isApplicable() { boolean transactionTimeoutSet = getConfiguration(). getPropertyValue(WebLogicPropertySet.JTA_TRANSACTION_TIMEOUT) != null; return transactionTimeoutSet; } }
String protocolProperty = configuration.getPropertyValue(GeneralPropertySet.PROTOCOL); String hostnameProperty = configuration.getPropertyValue(GeneralPropertySet.HOSTNAME); String portProperty = configuration.getPropertyValue(ServletPropertySet.PORT); String offsetProperty = configuration.getPropertyValue(GeneralPropertySet.PORT_OFFSET);
/** * @return JBoss profile for the {@link Configuration}. */ private ProfileKey getProfile() { String server = this.configuration.getPropertyValue(JBossPropertySet.CONFIGURATION); if (server == null || server.trim().isEmpty()) { server = ProfileKey.DEFAULT; } String profile = this.configuration.getPropertyValue(JBossPropertySet.PROFILE); boolean isClustered = Boolean.parseBoolean(this.configuration.getPropertyValue( JBossPropertySet.CLUSTERED)); String name = isClustered ? "farm" : profile; if (name == null || name.trim().isEmpty()) { name = ProfileKey.DEFAULT; } return new ProfileKey(ProfileKey.DEFAULT, server, name); }
/** * @param configuration the configuration from which to derive the CPC URL. We need it to get * the hostname, the port, etc. * @return the CPC Cargo URL */ public static URL getCPCURL(Configuration configuration) { try { String hostname = configuration.getPropertyValue(GeneralPropertySet.HOSTNAME); if ("0.0.0.0".equals(hostname) || "::0".equals(hostname)) { hostname = "localhost"; } return new URL(configuration.getPropertyValue(GeneralPropertySet.PROTOCOL) + "://" + hostname + ":" + configuration.getPropertyValue(ServletPropertySet.PORT) + "/cargocpc/index.html"); } catch (MalformedURLException e) { throw new ContainerException("Failed to compute CPC URL", e); } }
@Override protected void addConfigurationScriptProperties(Map<String, String> propertiesMap) { String logLevel = getConfiguration().getPropertyValue(GeneralPropertySet.LOGGING); propertiesMap.put("cargo.websphere.logging", getWebSphereLogLevel(logLevel)); }
@Override protected void addConfigurationScriptProperties(Map<String, String> propertiesMap) { String logLevel = getConfiguration().getPropertyValue(GeneralPropertySet.LOGGING); propertiesMap.put("cargo.weblogic.logging", getWebLogicLogLevel(logLevel)); }
@Override protected void addConfigurationScriptProperties(Map<String, String> propertiesMap) { String logLevel = getConfiguration().getPropertyValue(GeneralPropertySet.LOGGING); propertiesMap.put("cargo.weblogic.logging", getWebLogicLogLevel(logLevel)); }
@Override protected void addConfigurationScriptProperties(Map<String, String> propertiesMap) { String cargoLogLevel = getConfiguration().getPropertyValue(GeneralPropertySet.LOGGING); String wildFlyLogLevel = WildFlyLogUtils.getWildFlyLogLevel(cargoLogLevel); propertiesMap.put("cargo.wildfly.logging", wildFlyLogLevel); } }
@Override protected void addConfigurationScriptProperties(Map<String, String> propertiesMap) { String cargoLogLevel = getConfiguration().getPropertyValue(GeneralPropertySet.LOGGING); String wildFlyLogLevel = WildFlyLogUtils.getWildFlyLogLevel(cargoLogLevel); propertiesMap.put("cargo.wildfly.logging", wildFlyLogLevel); } }
/** * @param configuration the configuration to construct the Tomcat manager URL from * @return the URL to use to connect to the Tomcat manager */ private URL getManagerURL(Configuration configuration) { URL url; String managerURL = configuration.getPropertyValue(RemotePropertySet.URI); // If not defined by the user use a default URL if (managerURL == null) { managerURL = configuration.getPropertyValue(GeneralPropertySet.PROTOCOL) + "://" + configuration.getPropertyValue(GeneralPropertySet.HOSTNAME) + ":" + configuration.getPropertyValue(ServletPropertySet.PORT) + this.managerContext; getLogger().debug("Setting Tomcat Manager URL to " + managerURL, this.getClass().getName()); } getLogger().debug("Tomcat Manager URL is " + managerURL, this.getClass().getName()); try { url = new URL(managerURL); } catch (MalformedURLException e) { throw new ContainerException("Invalid Tomcat Manager URL [" + managerURL + "]", e); } return url; }
/** * @param configuration the configuration to construct the Tomcat manager URL from * @return the URL to use to connect to the Tomcat manager */ private URL getManagerURL(Configuration configuration) { URL url; String managerURL = configuration.getPropertyValue(RemotePropertySet.URI); // If not defined by the user use a default URL if (managerURL == null) { managerURL = configuration.getPropertyValue(GeneralPropertySet.PROTOCOL) + "://" + configuration.getPropertyValue(GeneralPropertySet.HOSTNAME) + ":" + configuration.getPropertyValue(ServletPropertySet.PORT) + this.managerContext; getLogger().debug("Setting Tomcat Manager URL to " + managerURL, this.getClass().getName()); } getLogger().debug("Tomcat Manager URL is " + managerURL, this.getClass().getName()); try { url = new URL(managerURL); } catch (MalformedURLException e) { throw new ContainerException("Invalid Tomcat Manager URL [" + managerURL + "]", e); } return url; }
@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)); } } }
@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)); } } }