Package com.sun.enterprise.deployment.phasing

Examples of com.sun.enterprise.deployment.phasing.DeploymentTarget


   
    private DeploymentTarget getAndValidateDeploymentTarget(String targetName,
        String appName, boolean isRegistered, boolean isDeleting) throws IASDeploymentException
    {
        try {
            final DeploymentTarget target = getTargetFactory().getTarget(
                getConfigContext(), getDomainName(), targetName);

            if (isRegistered) {
                if (targetName == null) {
                    //If the targetName passed in was null, we need to set it to its default value.
                    targetName = target.getTarget().getName();
                }
                if (target.getTarget().getType() == TargetType.DOMAIN && isDeleting) {
                    // If the target is the domain and the object is being deleted, then we must
                    // ensure that the there are no references to it.
                    if (ApplicationHelper.isApplicationReferenced(getConfigContext(), appName)) {
                        throw new IASDeploymentException(localStrings.getString("applicationIsReferenced",
                            appName, ApplicationHelper.getApplicationReferenceesAsString(
                                getConfigContext(), appName)));
                    }
                }
                else if (target.getTarget().getType() == TargetType.SERVER ||
                    target.getTarget().getType() == TargetType.DAS) { 
                    // If the application exists, we must ensure that if a standalone server instance is
                    // the target, that it must be the only entity referring to the application and
                    // indeed it must have a reference to the application
                    if (!ServerHelper.serverReferencesApplication(getConfigContext(),
                        targetName, appName) && isDeleting) {
                        throw new IASDeploymentException(localStrings.getString("serverApplicationRefDoesNotExist",
                            targetName, appName));
                    } else if (!ApplicationHelper.isApplicationReferencedByServerOnly(getConfigContext(),
                            appName, targetName)) {
                        throw new IASDeploymentException(localStrings.getString("applicationHasMultipleRefs",
                            targetName, appName, ApplicationHelper.getApplicationReferenceesAsString(
                                getConfigContext(), appName)));
                    }
                } else if (target.getTarget().getType() == TargetType.CLUSTER) {
                    // If the application exists, we must ensure that if a cluster is
                    // the target, that it must be the only entity referring to the application and
                    // indeed it must have a reference to the application
                     if (!ClusterHelper.clusterReferencesApplication(getConfigContext(),
                        targetName, appName) && isDeleting) {
View Full Code Here


     * @param targetName The name of the target to associate the application.
     */
    public void associateApplication(Properties props, String targetName)
            throws MBeanConfigException {
        try {
            final DeploymentTarget target = getTargetFactory().getTarget(
                    getConfigContext(), getDomainName(), targetName);
            boolean enabled = Boolean.valueOf(props.getProperty(DeploymentProperties.ENABLE)).booleanValue();
            target.addAppReference(
                    props.getProperty(DeploymentProperties.NAME),
                    enabled,
                    props.getProperty(DeploymentProperties.VIRTUAL_SERVERS));
        } catch(Exception e) {
            MBeanConfigException m = new MBeanConfigException(e.getMessage());
View Full Code Here

     * removed from.
     */
    public void disassociateApplication(Properties props, String targetName)
            throws MBeanConfigException {
        try {
            final DeploymentTarget target = getTargetFactory().getTarget(
                    getConfigContext(), getDomainName(), targetName);
            target.removeAppReference(
                    props.getProperty(DeploymentProperties.NAME));
        } catch(Exception e) {
            MBeanConfigException m = new MBeanConfigException(e.getMessage());
            m.initCause(e);
            throw m;
View Full Code Here

            req.setLibraries(dProps.getLibraries());
            req.setJavaWebStartEnabled(dProps.getJavaWebStartEnabled());
            req.setExternallyManagedPath(dProps.getExternallyManaged());
            req.setActionCode(actionCode);
            DeploymentServiceUtils.setResourceOptionsInRequest(req, dProps);
            final DeploymentTarget target = getAndValidateDeploymentTarget(dProps.getTarget(),
                name, isRegistered);
            req.setTarget(target);
           
            Properties optionalAttributes = new Properties();
            //optionalAttributes.put(ServerTags.ENABLED, String.valueOf(bEnabled));
View Full Code Here

            if(objectType.isAPP())
                req.setActionCode(BaseDeployEvent.APPLICATION_UNDEPLOYED);
            else               
                req.setActionCode(BaseDeployEvent.MODULE_UNDEPLOYED);
           
            final DeploymentTarget target = getAndValidateDeploymentTarget(dProps.getTarget(),
                name, true, true);
            req.setTarget(target);
                                                                               
            String dependentResource = DeploymentServiceUtils.checkConnectorDependentResourcesForUndeploy(req);
            if (dependentResource != null) {
View Full Code Here

            req.setForced(dProps.getForce());
            req.setVerifying(dProps.getVerify());
            req.setPrecompileJSP(dProps.getPrecompileJSP());
            req.setStartOnDeploy(dProps.getEnable());
            req.setActionCode(actionCode);
            final DeploymentTarget target = getAndValidateDeploymentTarget(dProps.getTarget(),
                appName, isAppExists);
            req.setTarget(target);
           
            Properties optionalAttributes = new Properties();
            //optionalAttributes.put(ServerTags.ENABLED, String.valueOf(bEnabled));
View Full Code Here

            //req.setShared(isShared);
            req.setForced(dProps.getForce());
            req.setVerifying(dProps.getVerify());
            req.setStartOnDeploy(dProps.getEnable());
            req.setActionCode(actionCode);
            final DeploymentTarget target = getAndValidateDeploymentTarget(dProps.getTarget(),
                moduleName, isModuleExists);
            req.setTarget(target);
            if(props == null)
                props = new Properties();
            else
View Full Code Here

            req.setForced(dProps.getForce());
            req.setVerifying(dProps.getVerify());
            req.setPrecompileJSP(dProps.getPrecompileJSP());
            req.setStartOnDeploy(dProps.getEnable());           
            req.setActionCode(actionCode);
            final DeploymentTarget target = getAndValidateDeploymentTarget(dProps.getTarget(),
                webAppName, isModuleExists);
            req.setTarget(target);
            //req.setShared(false);
            // get the webserver hostname and ports
            setHostAndPort(req);
View Full Code Here

            req.setFileSource(deployFile);
            req.setName(moduleName);
            req.setForced(dProps.getForce());
            req.setVerifying(dProps.getVerify());
            req.setActionCode(actionCode);
            final DeploymentTarget target = getAndValidateDeploymentTarget(dProps.getTarget(),
                moduleName, isModuleExists);
            req.setTarget(target);
            req.setStartOnDeploy(dProps.getEnable());           
            //req.setShared(false);
           
View Full Code Here

    throw new ConfigException(localStrings.getString(
        "admin.mbeans.acmb.duplicateLCMName", name));
  }

        Boolean isRegistered = isLifecycleModuleRegistered(name);
        final DeploymentTarget target = getAndValidateDeploymentTarget(
            targetName, name, isRegistered.booleanValue(), false);
        /**
            TODO: There is a catch here. What if the module was already
            registered. Should we just add the app reference to the given
            target or should we allow the following config call to raise an
            exception?
         */
        final ObjectName on = (ObjectName)invoke("createLifecycleModule",
                    new Object[]{attribute_list},
                    new String[]{"javax.management.AttributeList"});

                   
        //add properties into lifecycle element
        if (props!=null && props.size()>0) {
            //get created bean
            ArrayList arr = new ArrayList();
            for (Enumeration e = props.propertyNames(); e.hasMoreElements() ;) {
                String propName = (String)e.nextElement();
                String propValue = (String)props.getProperty(propName);
                if (propValue != null) {
                    ElementProperty ep = new ElementProperty();
                    ep.setName(propName);
                    ep.setValue(propValue);                   
                    arr.add(ep);
                }
            }
            if(arr.size()>0)
            {
                LifecycleModule lcm = (LifecycleModule)ApplicationHelper.findApplication(ctx, name);
                lcm.setElementProperty((ElementProperty[])arr.toArray(new ElementProperty[arr.size()]));
            }
        }

        final String isEnabled = (String)values.get(ENABLED);
        boolean enabled = Boolean.valueOf(isEnabled).booleanValue();
        target.addAppReference(name, enabled, null);
        return on;
    }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.phasing.DeploymentTarget

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.