Package com.sun.enterprise.config.serverbeans

Examples of com.sun.enterprise.config.serverbeans.Application


            }
            return
        }

        try {
            Application app = applications.getApplication(name());
            ApplicationRef appRef = domain.getApplicationRefInServer(server.getName(), name());

            deployment.enable(target, app, appRef, report, logger);

            if (!report.getActionExitCode().equals(ActionReport.ExitCode.FAILURE)) {
View Full Code Here


    private boolean isApplicationOfThisType(String name, String type) {
        if (type == null)  {
            return true;
        }

        Application app = applications.getApplication(name);
        if (app != null) {
            if (!app.isStandaloneModule()) {
                if (type.equals("ear")) {
                    return true;
                } else {
                    return false;
                }
            }
            for (Module module : app.getModule()) {
                final List<Engine> engineList = module.getEngines();
                for (Engine engine : engineList) {
                    if (engine.getSniffer().equals(type)) {
                        return true;
                    }
View Full Code Here

        // for each matched version
        Iterator it = matchedVersions.iterator();
        while (it.hasNext()) {
            String appName = (String) it.next();
            Application app = applications.getApplication(appName);

            ApplicationRef applicationRef = domain.getApplicationRefInTarget(appName, target);
            if ( applicationRef != null ) {
                // we provides warning messages
                // if a versioned name has been provided to the command
                if( isVersionExpression ){
                    ActionReport.MessagePart childPart = part.addChild();
                    childPart.setMessage(localStrings.getLocalString("appref.already.exists",
                            "Application reference {0} already exists in target {1}.", appName, target));
                } else {
                    // returns failure if an untagged name has been provided to the command
                    report.setMessage(localStrings.getLocalString("appref.already.exists",
                            "Application reference {0} already exists in target {1}.", name, target));
                    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                    return;
                }
            } else {

                Transaction t = new Transaction();
                if (app.isLifecycleModule()) {
                    handleLifecycleModule(context, t);
                    return;
                }

                ReadableArchive archive;
                File file = null;
                DeployCommandParameters commandParams=null;
                Properties contextProps = new Properties();
                Map<String, Properties> modulePropsMap = null;
                ApplicationConfigInfo savedAppConfig = null;
                try {
                    commandParams = app.getDeployParameters(null);
                    commandParams.origin = Origin.create_application_ref;
                    commandParams.target = target;
                    commandParams.virtualservers = virtualservers;
                    commandParams.enabled = enabled;
                    if(lbenabled != null){
                        commandParams.lbenabled = lbenabled;
                    }
                    if (app.containsSnifferType(Application.OSGI_SNIFFER_TYPE)) {
                        commandParams.type = DeploymentProperties.OSGI;
                    }

                    contextProps = app.getDeployProperties();
                    modulePropsMap = app.getModulePropertiesMap();
                    savedAppConfig = new ApplicationConfigInfo(app);

                    URI uri = new URI(app.getLocation());
                    file = new File(uri);

                    if (!file.exists()) {
                        report.setMessage(localStrings.getLocalString("fnf",
                            "File not found", file.getAbsolutePath()));
                        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                        return;
                    }

                    archive = archiveFactory.openArchive(file);
                } catch (Exception e) {
                    logger.log(Level.SEVERE, "Error opening deployable artifact : " + file.getAbsolutePath(), e);
                    report.setMessage(localStrings.getLocalString("unknownarchiveformat", "Archive format not recognized"));
                    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                    return;
                }

                try {
                    final ExtendedDeploymentContext deploymentContext =
                            deployment.getBuilder(logger, commandParams, report).source(archive).build();

                    Properties appProps = deploymentContext.getAppProps();
                    appProps.putAll(contextProps);

                    // relativize the location so it could be set properly in
                    // domain.xml
                    String location = DeploymentUtils.relativizeWithinDomainIfPossible(new URI(app.getLocation()));
                    appProps.setProperty(ServerTags.LOCATION, location);

                    // relativize the URI properties so they could store in the
                    // domain.xml properly on the instances
                    String appLocation = appProps.getProperty(Application.APP_LOCATION_PROP_NAME);
View Full Code Here

    private void handleLifecycleModule(AdminCommandContext context, Transaction t) {
        final ActionReport report = context.getActionReport();
        final Logger logger = context.getLogger();

        Application app = applications.getApplication(name);

        // create a dummy context to hold params and props
        DeployCommandParameters commandParams = new DeployCommandParameters();
        commandParams.name = name;
        commandParams.target = target;
        commandParams.virtualservers = virtualservers;
        commandParams.enabled = enabled;

        ExtendedDeploymentContext lifecycleContext = new DeploymentContextImpl(report, logger, null, commandParams, null);
        try  {
            deployment.registerAppInDomainXML(null, lifecycleContext, t, true);
        } catch(Exception e) {
            report.failure(logger, e.getMessage());
        }

        if (!DeploymentUtils.isDASTarget(target)) {
            final ParameterMap paramMap = new ParameterMap();
            paramMap.add("DEFAULT", name);
            paramMap.add(DeploymentProperties.TARGET, target);
            paramMap.add(DeploymentProperties.ENABLED, enabled.toString());
            if (virtualservers != null) {
                paramMap.add(DeploymentProperties.VIRTUAL_SERVERS,
                    virtualservers);
            }
            // pass the app props so we have the information to persist in the
            // domain.xml
            Properties appProps = app.getDeployProperties();
            paramMap.set(DeploymentProperties.APP_PROPS, DeploymentUtils.propertiesValue(appProps, ':'));

            final List<String> targets = new ArrayList<String>();
            targets.add(target);
            ClusterOperationUtil.replicateCommand("_lifecycle", FailurePolicy.Error, FailurePolicy.Warn, targets, context, paramMap, habitat);
View Full Code Here

    public void execute(AdminCommandContext context) {
        final ActionReport report = context.getActionReport();
        final Logger logger = context.getLogger();

        try {
            Application application = applications.getApplication(name);
            Transaction t = new Transaction();

            // create a dummy context to hold params and props
            DeployCommandParameters commandParams = new DeployCommandParameters();
            commandParams.name = name;
View Full Code Here

            }
            return;
        }

        try {
            Application app = applications.getApplication(appName);
            this.name = appName;

            deployment.disable(this, app, appInfo, report, logger);
        } catch (Exception e) {
            logger.log(Level.SEVERE, "Error during disabling: ", e);
View Full Code Here

        transactions.addTransactionsListener(this);
    }

    private void handleAppEnableChange(Object parent,
        String appName, boolean enabled) {
        Application application = applications.getApplication(appName);
        if (application.isLifecycleModule()) {
            return;
        }
        if (enabled) {
            if (isCurrentInstanceMatchingTarget(parent)) {
                enableApplication(appName);
View Full Code Here

            }
        }
    }

    private void handleOtherAppConfigChanges(Object parent, String appName) {
        Application application = applications.getApplication(appName);
        if (application.isLifecycleModule()) {
            return;
        }
        // reload the application for other application related
        // config changes if the application is in enabled state
        if (isCurrentInstanceMatchingTarget(parent) &&
View Full Code Here

        }
        return true;
    }

    private void enableApplication(String appName) {       
        Application app = applications.getApplication(appName);
        ApplicationRef appRef = domain.getApplicationRefInServer(server.getName(), appName);
        // if the application does not exist or application is not referenced
        // by the current server instance, do not load
        if (app == null || appRef == null) {
            return;
View Full Code Here

            throw re;
        }
    }

    private void disableApplication(String appName) {
        Application app = applications.getApplication(appName);
        ApplicationRef appRef = domain.getApplicationRefInServer(server.getName(), appName);
        // if the application does not exist or application is not referenced
        // by the current server instance, do not unload
        if (app == null || appRef == null) {
            return;
View Full Code Here

TOP

Related Classes of com.sun.enterprise.config.serverbeans.Application

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.