use of org.glassfish.appclient.client.acc.AppClientContainer.Builder in project Payara by payara.
the class AppClientFacade method prepareACC.
public static void prepareACC(String agentArgsText, Instrumentation inst) throws UserError, MalformedURLException, URISyntaxException, JAXBException, FileNotFoundException, ParserConfigurationException, SAXException, IOException, Exception {
if (!JDK.isRunningLTSJDK()) {
logger.warning("You are running the product on an unsupported JDK version and might see unexpected results or exceptions.");
}
/*
* Analyze the agent argument string.
*/
AgentArguments agentArgs = AgentArguments.newInstance(agentArgsText);
/*
* The agent arguments that correspond to the ones that we want to
* pass to the ACC are the ones with the "arg=" keyword prefix. These
* will include arguments with meaning to the ACC (-textauth for example)
* as well as arguments to be passed on to the client's main method.
*/
appClientCommandArgs = AppclientCommandArguments.newInstance(agentArgs.namedValues("arg"));
if (appClientCommandArgs.isUsage()) {
usage(0);
} else if (appClientCommandArgs.isHelp()) {
help();
}
/*
* Examine the agent arguments for settings about how to launch the
* client.
*/
launchInfo = CommandLaunchInfo.newInstance(agentArgs);
if (launchInfo.getClientLaunchType() == ClientLaunchType.UNKNOWN) {
usage(1);
}
/*
* Handle the legacy env. variable APPCPATH.
*/
ACCClassLoader loader = initClassLoader((inst == null));
Thread.currentThread().setContextClassLoader(loader);
isJWS = Boolean.getBoolean("appclient.is.jws");
/*
* The installRoot property will be set by the ServerEnvironment
* initialization using the ACC start-up context. That happens during
* the ACCModulesManager warm-up.
*/
/*
* Load the ACC configuration XML file.
*/
ClientContainer clientContainer = readConfig(appClientCommandArgs.getConfigFilePath(), loader);
/*
* Decide what target servers to use. This combines any
* specified on the command line with any in the config file's
* target-server elements as well as any set in the properties
* of the config file.
*/
final TargetServer[] targetServers = TargetServerHelper.targetServers(clientContainer, appClientCommandArgs.getTargetServer());
/*
* Get the builder. Doing so correctly involves merging
* the configuration file data with some of the command line and
* agent arguments.
*/
final AppClientContainer.Builder builder = createBuilder(targetServers, clientContainer, appClientCommandArgs);
/*
* Create the ACC. Again, precisely how we create it depends on some
* of the command line arguments and agent arguments.
*/
final AppClientContainer newACC = createContainer(builder, launchInfo, appClientCommandArgs);
/*
* Because the JMV might invoke the client's main class, the agent
* needs to prepare the container. (This is done as part of the
* AppClientContainer.start() processing in the public API.
*/
newACC.prepare(inst);
acc = newACC;
}
use of org.glassfish.appclient.client.acc.AppClientContainer.Builder in project Payara by payara.
the class AppClientFacade method createBuilder.
private static Builder createBuilder(final TargetServer[] targetServers, final ClientContainer clientContainer, final AppclientCommandArguments appClientCommandArgs) throws IOException {
Builder builder = AppClientContainer.newBuilder(targetServers);
/*
* Augment the builder with settings from the app client options that
* can affect the builder itself. (This is distinct from options
* that affect what client to launch which are handled in creating
* the ACC itself.
*/
updateClientCredentials(builder, appClientCommandArgs);
final List<MessageSecurityConfig> msc = clientContainer.getMessageSecurityConfig();
if (msc != null) {
builder.getMessageSecurityConfig().addAll(clientContainer.getMessageSecurityConfig());
}
builder.logger(new ACCLogger(clientContainer.getLogService()));
final AuthRealm ar = clientContainer.getAuthRealm();
if (ar != null) {
builder.authRealm(ar.getClassname());
}
final List<Property> p = clientContainer.getProperty();
if (p != null) {
builder.containerProperties(p);
}
return builder;
}
Aggregations