public static JvmOptionsBuilderFactory getInstance(final JvmType jvmType) { return new JvmOptionsBuilderFactory(jvmType); }
@Override void addPermGen(JvmElement jvmElement, List<String> command) { if (jvmElement.getPermgenSize() != null || jvmElement.getMaxPermgen() != null) { ROOT_LOGGER.ignoringPermGen(type, jvmElement.getName()); } } }
@Override void addPermGen(JvmElement jvmElement, List<String> command) { String permgen = jvmElement.getPermgenSize(); String maxPermgen = jvmElement.getMaxPermgen(); if (maxPermgen == null && permgen != null) { maxPermgen = permgen; } if (permgen == null && maxPermgen != null) { permgen = maxPermgen; } if (permgen != null) { command.add("-XX:PermSize=" + permgen); } if (maxPermgen != null) { command.add("-XX:MaxPermSize=" + maxPermgen); } } }
protected JvmResourceDefinition(boolean server) { super(PathElement.pathElement(ModelDescriptionConstants.JVM), new StandardResourceDescriptionResolver("jvm", HostEnvironmentResourceDefinition.class.getPackage().getName() + ".LocalDescriptions", HostEnvironmentResourceDefinition.class.getClassLoader(), true, false), new JVMAddHandler(JvmAttributes.getAttributes(server)), JVMRemoveHandler.INSTANCE); this.server = server; }
@Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { AttributeDefinition[] defs = JvmAttributes.getAttributes(server); OperationStepHandler handler = new ModelOnlyWriteAttributeHandler(defs); for (AttributeDefinition attr : JvmAttributes.getAttributes(server)) { resourceRegistration.registerReadWriteAttribute(attr, null, handler); } }
static void registerTransformers120(TransformersSubRegistration parent) { TransformersSubRegistration reg = parent.registerSubResource(JvmResourceDefinition.GLOBAL.getPathElement(), ResourceTransformer.DEFAULT); RejectExpressionValuesTransformer rejectExpression = new RejectExpressionValuesTransformer(AGENT_PATH, HEAP_SIZE, JAVA_HOME, MAX_HEAP_SIZE, PERMGEN_SIZE, MAX_PERMGEN_SIZE, STACK_SIZE, OPTIONS, ENVIRONMENT_VARIABLES, ENV_CLASSPATH_IGNORED, AGENT_LIB, JAVA_AGENT); reg.registerOperationTransformer(ADD, rejectExpression); reg.registerOperationTransformer(WRITE_ATTRIBUTE_OPERATION, rejectExpression.getWriteAttributeTransformer()); }
/** {@inheritDoc} */ @Override public Map<String, String> getServerLaunchEnvironment() { final Map<String, String> env = new HashMap<String, String>(); for(final Entry<String, String> property : jvmElement.getEnvironmentVariables().entrySet()) { env.put(property.getKey(), property.getValue()); } return env; }
public void addOptions(JvmElement jvmElement, List<String> command){ if (jvmElement == null) { throw MESSAGES.nullVar("jvm"); } if (command == null) { throw MESSAGES.nullVar("command"); } JvmOptionsBuilder builder = BUILDERS.get(jvmElement.getJvmType()); if (builder == null) { throw MESSAGES.unknown("jvm", jvmElement.getJvmType()); } builder.addToOptions(jvmElement, command); }
private synchronized JvmType getJvmType(boolean forLaunch) { JvmType result = this.jvmType; if (result == null) { String javaHome = jvmElement.getJavaHome(); if (javaHome == null) { if (environment.getDefaultJVM() != null) { String javaExecutable = environment.getDefaultJVM().getAbsolutePath(); result = JvmType.createFromJavaExecutable(javaExecutable, forLaunch); } else { result = JvmType.createFromSystemProperty(forLaunch); } } else { result = JvmType.createFromJavaHome(javaHome, forLaunch); } if (forLaunch) { this.jvmType = result; } // else don't cache it as we don't know if it's valid and may not add correct default java opts } return result; }
private ArrayList<String> getLaunchPrefixCommands(){ String launchCommand = jvmElement.getLaunchCommand(); ArrayList<String> commands = null; if(launchCommand.length()>0){ commands = new ArrayList<String>(Arrays.asList(launchCommand.split("\\s* \\s*"))); } ROOT_LOGGER.serverLaunchCommandPrefix(this.serverName, launchCommand); return commands; }
protected JvmResourceDefinition(boolean server) { super(new Parameters(PathElement.pathElement(ModelDescriptionConstants.JVM), new StandardResourceDescriptionResolver(ModelDescriptionConstants.JVM, HostEnvironmentResourceDefinition.class.getPackage().getName() + ".LocalDescriptions", HostEnvironmentResourceDefinition.class.getClassLoader(), true, false)) .setAddHandler(new JVMAddHandler(JvmAttributes.getAttributes(server))) .setRemoveHandler(JVMRemoveHandler.INSTANCE) .setMaxOccurs(server ? 1 : Integer.MAX_VALUE) .setMinOccurs(0)); this.server = server; }
@Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { AttributeDefinition[] defs = JvmAttributes.getAttributes(server); OperationStepHandler handler = new ModelOnlyWriteAttributeHandler(defs); for (AttributeDefinition attr : JvmAttributes.getAttributes(server)) { resourceRegistration.registerReadWriteAttribute(attr, null, handler); } }
public static void registerTransformers2_1_AndBelow(ResourceTransformationDescriptionBuilder parent) { parent.addChildResource(JvmResourceDefinition.GLOBAL.getPathElement()) .getAttributeBuilder() .setDiscard(DiscardAttributeChecker.UNDEFINED, LAUNCH_COMMAND) .addRejectCheck(RejectAttributeChecker.DEFINED, LAUNCH_COMMAND) .end(); } }
/** {@inheritDoc} */ @Override public Map<String, String> getServerLaunchEnvironment() { final Map<String, String> env = new HashMap<String, String>(); for(final Entry<String, String> property : jvmElement.getEnvironmentVariables().entrySet()) { env.put(property.getKey(), property.getValue()); } return env; }
public static JvmOptionsBuilderFactory getInstance(final JvmType jvmType) { return new JvmOptionsBuilderFactory(jvmType); }
private ArrayList<String> getLaunchPrefixCommands(){ String launchCommand = jvmElement.getLaunchCommand(); ArrayList<String> commands = null; if(launchCommand.length()>0){ commands = new ArrayList<String>(Arrays.asList(launchCommand.split("\\s* \\s*"))); } ROOT_LOGGER.serverLaunchCommandPrefix(this.serverName, launchCommand); return commands; }
protected JvmResourceDefinition(boolean server) { super(new Parameters(PathElement.pathElement(ModelDescriptionConstants.JVM), new StandardResourceDescriptionResolver(ModelDescriptionConstants.JVM, HostEnvironmentResourceDefinition.class.getPackage().getName() + ".LocalDescriptions", HostEnvironmentResourceDefinition.class.getClassLoader(), true, false)) .setAddHandler(new JVMAddHandler(JvmAttributes.getAttributes(server))) .setRemoveHandler(JVMRemoveHandler.INSTANCE) .setMaxOccurs(server ? 1 : Integer.MAX_VALUE) .setMinOccurs(0)); this.server = server; }
@Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { AttributeDefinition[] defs = JvmAttributes.getAttributes(server); OperationStepHandler handler = new ModelOnlyWriteAttributeHandler(defs); for (AttributeDefinition attr : JvmAttributes.getAttributes(server)) { resourceRegistration.registerReadWriteAttribute(attr, null, handler); } }
public static void registerTransformers2_1_AndBelow(ResourceTransformationDescriptionBuilder parent) { parent.addChildResource(JvmResourceDefinition.GLOBAL.getPathElement()) .getAttributeBuilder() .setDiscard(DiscardAttributeChecker.UNDEFINED, LAUNCH_COMMAND) .addRejectCheck(RejectAttributeChecker.DEFINED, LAUNCH_COMMAND) .end(); } }
/** {@inheritDoc} */ @Override public Map<String, String> getServerLaunchEnvironment() { final Map<String, String> env = new HashMap<String, String>(); for(final Entry<String, String> property : jvmElement.getEnvironmentVariables().entrySet()) { env.put(property.getKey(), property.getValue()); } return env; }