Search in sources :

Example 1 with ACCClassLoader

use of org.glassfish.appclient.client.acc.ACCClassLoader 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;
}
Also used : Builder(org.glassfish.appclient.client.acc.AppClientContainer.Builder) ACCClassLoader(org.glassfish.appclient.client.acc.ACCClassLoader) ClientContainer(org.glassfish.appclient.client.acc.config.ClientContainer) AppClientContainer(org.glassfish.appclient.client.acc.AppClientContainer) AppClientContainer(org.glassfish.appclient.client.acc.AppClientContainer) AgentArguments(org.glassfish.appclient.client.acc.AgentArguments) TargetServer(org.glassfish.appclient.client.acc.config.TargetServer)

Aggregations

ACCClassLoader (org.glassfish.appclient.client.acc.ACCClassLoader)1 AgentArguments (org.glassfish.appclient.client.acc.AgentArguments)1 AppClientContainer (org.glassfish.appclient.client.acc.AppClientContainer)1 Builder (org.glassfish.appclient.client.acc.AppClientContainer.Builder)1 ClientContainer (org.glassfish.appclient.client.acc.config.ClientContainer)1 TargetServer (org.glassfish.appclient.client.acc.config.TargetServer)1