public static ITouchpointInstruction createTouchpointInstruction(String body, String importAttribute) { return new TouchpointInstruction(body, importAttribute); }
protected String[] getConfigurationStrings(Collection<IConfigAdvice> configAdvice) { String configurationData = ""; //$NON-NLS-1$ String unconfigurationData = ""; //$NON-NLS-1$ Set<String> properties = new HashSet<String>(); for (IConfigAdvice advice : configAdvice) { for (Entry<String, String> aProperty : advice.getProperties().entrySet()) { String key = aProperty.getKey(); if (shouldPublishProperty(key) && !properties.contains(key)) { properties.add(key); Map<String, String> parameters = new LinkedHashMap<String, String>(); parameters.put("propName", key); //$NON-NLS-1$ parameters.put("propValue", aProperty.getValue()); //$NON-NLS-1$ configurationData += TouchpointInstruction.encodeAction("setProgramProperty", parameters); //$NON-NLS-1$ parameters.put("propValue", ""); //$NON-NLS-1$//$NON-NLS-2$ unconfigurationData += TouchpointInstruction.encodeAction("setProgramProperty", parameters); //$NON-NLS-1$ } } } return new String[] {configurationData, unconfigurationData}; }
/** * Encodes an action statement in string form. This method will * take care of escaping any illegal characters in function parameter values. * * @param actionName The name of the action. * @param parameters The function's parameters. This is a Map<String,String> * where the keys are parameter names, and the values are parameter values * @return An encoded touchpoint instruction statement */ public static String encodeAction(String actionName, Map<String, String> parameters) { StringBuffer result = new StringBuffer(actionName); result.append('('); boolean first = true; for (Entry<String, String> entry : parameters.entrySet()) { if (first) first = false; else result.append(','); result.append(entry.getKey()); result.append(':'); appendEncoded(result, entry.getValue()); } result.append(')').append(';'); return result.toString(); }
touchpointParameters.clear(); touchpointParameters.put("jvmArg", jvmArgs[i]); //$NON-NLS-1$ configurationData += TouchpointInstruction.encodeAction("addJvmArg", touchpointParameters); //$NON-NLS-1$ unconfigurationData += TouchpointInstruction.encodeAction("removeJvmArg", touchpointParameters); //$NON-NLS-1$ touchpointParameters.clear(); touchpointParameters.put("programArg", programArgs[i]); //$NON-NLS-1$ configurationData += TouchpointInstruction.encodeAction("addProgramArg", touchpointParameters); //$NON-NLS-1$ unconfigurationData += TouchpointInstruction.encodeAction("removeProgramArg", touchpointParameters); //$NON-NLS-1$ } else if (i + 1 < programArgs.length && !programArgs[i + 1].startsWith("-")) { //$NON-NLS-1$
touchpointParameters.clear(); touchpointParameters.put("jvmArg", jvmArgs[i]); //$NON-NLS-1$ configurationData += TouchpointInstruction.encodeAction("addJvmArg", touchpointParameters); //$NON-NLS-1$ unconfigurationData += TouchpointInstruction.encodeAction("removeJvmArg", touchpointParameters); //$NON-NLS-1$ touchpointParameters.clear(); touchpointParameters.put("programArg", programArgs[i]); //$NON-NLS-1$ configurationData += TouchpointInstruction.encodeAction("addProgramArg", touchpointParameters); //$NON-NLS-1$ unconfigurationData += TouchpointInstruction.encodeAction("removeProgramArg", touchpointParameters); //$NON-NLS-1$ } else if (i + 1 < programArgs.length && !programArgs[i + 1].startsWith("-")) { //$NON-NLS-1$
touchpointParameters.clear(); touchpointParameters.put("jvmArg", jvmArgs[i]); //$NON-NLS-1$ configurationData += TouchpointInstruction.encodeAction("addJvmArg", touchpointParameters); //$NON-NLS-1$ unconfigurationData += TouchpointInstruction.encodeAction("removeJvmArg", touchpointParameters); //$NON-NLS-1$ touchpointParameters.clear(); touchpointParameters.put("programArg", programArgs[i]); //$NON-NLS-1$ configurationData += TouchpointInstruction.encodeAction("addProgramArg", touchpointParameters); //$NON-NLS-1$ unconfigurationData += TouchpointInstruction.encodeAction("removeProgramArg", touchpointParameters); //$NON-NLS-1$ } else if (i + 1 < programArgs.length && !programArgs[i + 1].startsWith("-")) { //$NON-NLS-1$
parameters.put("propName", key); //$NON-NLS-1$ parameters.put("propValue", aProperty.getValue()); //$NON-NLS-1$ configurationData += TouchpointInstruction.encodeAction("setProgramProperty", parameters); //$NON-NLS-1$ parameters.put("propValue", ""); //$NON-NLS-1$//$NON-NLS-2$ unconfigurationData += TouchpointInstruction.encodeAction("setProgramProperty", parameters); //$NON-NLS-1$ parameters.put("location", repo.getLocation().toString()); //$NON-NLS-1$ parameters.put("enabled", Boolean.toString((repo.getOptions() & IRepository.ENABLED) == IRepository.ENABLED)); //$NON-NLS-1$ configurationData += TouchpointInstruction.encodeAction("addRepository", parameters); //$NON-NLS-1$ parameters.remove("enabled"); //$NON-NLS-1$ unconfigurationData += TouchpointInstruction.encodeAction("removeRepository", parameters);//$NON-NLS-1$
parameters.put("propName", key); //$NON-NLS-1$ parameters.put("propValue", aProperty.getValue()); //$NON-NLS-1$ configurationData += TouchpointInstruction.encodeAction("setProgramProperty", parameters); //$NON-NLS-1$ parameters.put("propValue", ""); //$NON-NLS-1$//$NON-NLS-2$ unconfigurationData += TouchpointInstruction.encodeAction("setProgramProperty", parameters); //$NON-NLS-1$ parameters.put("location", repo.getLocation().toString()); //$NON-NLS-1$ parameters.put("enabled", Boolean.toString((repo.getOptions() & IRepository.ENABLED) == IRepository.ENABLED)); //$NON-NLS-1$ configurationData += TouchpointInstruction.encodeAction("addRepository", parameters); //$NON-NLS-1$ parameters.remove("enabled"); //$NON-NLS-1$ unconfigurationData += TouchpointInstruction.encodeAction("removeRepository", parameters);//$NON-NLS-1$