protected List<String> determineGlobs(Configuration configuration, String name) { PropertySimple includeGlobsProp = configuration.getSimple(name); if (includeGlobsProp == null) return null; List<String> ret = new ArrayList<String>(); ret.addAll(getGlobList(includeGlobsProp)); return ret; }
@NotNull protected String getResourceConfigurationRootPath() { Configuration pluginConfig = this.resourceContext.getPluginConfiguration(); String rootPath = pluginConfig.getSimpleValue(RESOURCE_CONFIGURATION_ROOT_NODE_PROP, null); if (rootPath == null) { String includeGlobs = pluginConfig.getSimple(INCLUDE_GLOBS_PROP).getStringValue(); if (includeGlobs.indexOf('|') != -1) { throw new IllegalStateException("Unable to determine resource configuration root Augeas path."); } rootPath = "/files" + includeGlobs; } return rootPath; }
private boolean isTakeOver(Configuration deploymentConfiguration) { PropertySimple takeOver = deploymentConfiguration.getSimple("takeOver"); if (takeOver == null) { return false; } Boolean value = takeOver.getBooleanValue(); return value != null && value; } }
private String composeResourceKey(Configuration pluginConfiguration) { PropertySimple includeGlobsProp = pluginConfiguration .getSimple(AugeasConfigurationComponent.INCLUDE_GLOBS_PROP); PropertySimple excludeGlobsProp = pluginConfiguration .getSimple(AugeasConfigurationComponent.EXCLUDE_GLOBS_PROP); StringBuilder bld = new StringBuilder(); bld.append(includeGlobsProp.getStringValue()); if (excludeGlobsProp != null && excludeGlobsProp.getStringValue().length() > 0) { bld.append("---"); bld.append(excludeGlobsProp.getStringValue()); } return bld.toString(); }
private void initGlobs() { Configuration pluginConfig = this.resourceContext.getPluginConfiguration(); PropertySimple includes = pluginConfig.getSimple(INCLUDE_GLOBS_PROP); PropertySimple excludes = pluginConfig.getSimple(EXCLUDE_GLOBS_PROP); includeGlobs = new ArrayList<String>(); excludeGlobs = new ArrayList<String>(); includeGlobs.addAll(Arrays.asList(includes.getStringValue().split("\\s*\\|\\s*"))); if (excludes != null && excludes.getStringValue() != null) { excludeGlobs.addAll(Arrays.asList(excludes.getStringValue().split("\\s*\\|\\s*"))); } }
@NotNull public Map<String, String> getStartScriptEnv() { PropertySimple prop = this.pluginConfig.getSimple(START_SCRIPT_ENV_PROP); Map<String, String> map = (prop != null) ? new MapPropertySimpleWrapper(prop).getValue() : new HashMap<String, String>(); return map; }
@NotNull public List<String> getStartScriptArgs() { PropertySimple prop = this.pluginConfig.getSimple(START_SCRIPT_ARGS_PROP); List<String> list = (prop != null) ? new ArgsPropertySimpleWrapper(prop).getValue() : new ArrayList<String>(); return list; }
protected List<String> determineIncludeGlobs(ResourceDiscoveryContext<T> discoveryContext) { Configuration pluginConfiguration = discoveryContext.getDefaultPluginConfiguration(); PropertySimple includeGlobsProp = pluginConfiguration .getSimple(AugeasConfigurationComponent.INCLUDE_GLOBS_PROP); List<String> ret = getGlobList(includeGlobsProp); if (ret == null || ret.size() == 0) { throw new IllegalStateException("Expecting at least once inclusion pattern for configuration files."); } return ret; }
protected List<String> determineExcludeGlobs(ResourceDiscoveryContext<T> discoveryContext) { Configuration pluginConfiguration = discoveryContext.getDefaultPluginConfiguration(); PropertySimple excludeGlobsProp = pluginConfiguration .getSimple(AugeasConfigurationComponent.EXCLUDE_GLOBS_PROP); List<String> ret = getGlobList(excludeGlobsProp); return ret; }
public void deleteResource() throws Exception { Configuration pluginConfiguration = getResourceContext().getPluginConfiguration(); String fileName = pluginConfiguration.getSimple(PROPERTY_FILENAME).getStringValue(); File file = new File(fileName); if (!file.exists()) { log.warn("Could not delete web application files (perhaps removed manually?). Proceeding with resource removal for: " + fileName); } else { deleteApp(pluginConfiguration, file, false, true); } }
private String replaceGlobalRequestProcessorNameProps(String property) { Configuration pluginConfiguration = getResourceContext().getPluginConfiguration(); String name = pluginConfiguration.getSimple(PLUGIN_CONFIG_NAME).getStringValue(); String result = property.replace("%name%", name); return result; }
public void setStartScript(File startScript) { PropertySimple prop = this.pluginConfig.getSimple(START_SCRIPT_PROP); if (prop == null) { prop = new PropertySimple(START_SCRIPT_PROP, null); this.pluginConfig.put(prop); } prop.setValue(startScript); }
@Override public void start(ResourceContext<TomcatServerComponent<?>> context) { if (UNKNOWN.equals(context.getPluginConfiguration().getSimple(PLUGIN_CONFIG_HANDLER).getStringValue())) { throw new InvalidPluginConfigurationException( "The connector is not listening for requests on the configured port. This is most likely due to the configured port being in use at Tomcat startup. In some cases (AJP connectors) Tomcat will assign an open port. This happens most often when there are multiple Tomcat servers running on the same platform. Check your Tomcat configuration for conflicts: " + context.getResourceKey()); } super.start(context); }
public void setStartScriptArgs(List<String> startScriptArgs) { PropertySimple prop = this.pluginConfig.getSimple(START_SCRIPT_ARGS_PROP); if (prop == null) { prop = new PropertySimple(START_SCRIPT_ARGS_PROP, null); this.pluginConfig.put(prop); } try { new ArgsPropertySimpleWrapper(prop).setValue(startScriptArgs); } catch (IllegalArgumentException e) { setPropertyError(startScriptArgs, prop); } }
private ProcessExecution getScriptShutdown(Configuration pluginConfiguration) { File shutdownScriptFile = this.serverComponent.getShutdownScriptPath(); validateScriptFile(shutdownScriptFile, TomcatServerComponent.PLUGIN_CONFIG_SHUTDOWN_SCRIPT); String prefix = pluginConfiguration.getSimple(TomcatServerComponent.PLUGIN_CONFIG_SCRIPT_PREFIX) .getStringValue(); ProcessExecution processExecution = ProcessExecutionUtility.createProcessExecution(prefix, shutdownScriptFile); initScriptProcessExecution(processExecution, shutdownScriptFile); return processExecution; }
public void setStartScriptEnv(Map<String, String> startScriptEnv) { PropertySimple prop = this.pluginConfig.getSimple(START_SCRIPT_ENV_PROP); if (prop == null) { prop = new PropertySimple(START_SCRIPT_ENV_PROP, null); this.pluginConfig.put(prop); } try { new MapPropertySimpleWrapper(prop).setValue(startScriptEnv); } catch (IllegalArgumentException e) { setPropertyError(startScriptEnv, prop); } }
public void deleteResource() throws Exception { Configuration opConfig = new Configuration(); ResourceContext<TomcatUserDatabaseComponent> resourceContext = getResourceContext(); // We must strip the quotes off of name for the operation parameter PropertySimple nameProperty = resourceContext.getPluginConfiguration().getSimple(PLUGIN_CONFIG_NAME); String name = nameProperty.getStringValue(); nameProperty = new PropertySimple(CONFIG_USERNAME, name.substring(1, name.length() - 1)); opConfig.put(nameProperty); resourceContext.getParentResourceComponent().invokeOperation("removeUser", opConfig); resourceContext.getParentResourceComponent().save(); }
public void deleteResource() throws Exception { Configuration opConfig = new Configuration(); ResourceContext<TomcatUserDatabaseComponent> resourceContext = getResourceContext(); // We must strip the quotes off of name for the operation parameter PropertySimple nameProperty = resourceContext.getPluginConfiguration().getSimple(PLUGIN_CONFIG_NAME); String name = nameProperty.getStringValue(); nameProperty = new PropertySimple(CONFIG_GROUP_NAME, name.substring(1, name.length() - 1)); opConfig.put(nameProperty); resourceContext.getParentResourceComponent().invokeOperation("removeGroup", opConfig); resourceContext.getParentResourceComponent().save(); }
public void deleteResource() throws Exception { Configuration opConfig = new Configuration(); ResourceContext<TomcatUserDatabaseComponent> resourceContext = getResourceContext(); PropertySimple nameProperty = resourceContext.getPluginConfiguration().getSimple(PLUGIN_CONFIG_NAME); String name = nameProperty.getStringValue(); nameProperty = new PropertySimple(CONFIG_ROLE_NAME, name); opConfig.put(nameProperty); resourceContext.getParentResourceComponent().invokeOperation("removeRole", opConfig); resourceContext.getParentResourceComponent().save(); }
@Override public OperationResult invokeOperation(String name, Configuration parameters) throws InterruptedException, Exception { Operation op = new Operation(name, getAddress()); Result res = getASConnection().execute(op, parameters.getSimple("responseTimeout").getIntegerValue()); OperationResult result = new OperationResult(); if (res.isSuccess()) { result.setSimpleResult(SUCCESS); } else { result.setErrorMessage(res.getFailureDescription()); } return result; }