Package com.sun.enterprise.deployment.backend

Examples of com.sun.enterprise.deployment.backend.DeploymentRequest


        try {

            InstanceEnvironment env = new InstanceEnvironment(getInstanceName());
           
            //Prepare Request
            DeploymentRequest req = new DeploymentRequest(
                                        env,
                                        DeployableObjectType.WEB,
                                        DeploymentCommand.DEPLOY);
           
            String webAppName = dProps.getName(filePath);
            boolean isModuleExists = isRegistered(webAppName,
                                         DeployableObjectType.WEB);
            actionCode = (isModuleExists && dProps.getForce()) ?
                              BaseDeployEvent.MODULE_REDEPLOYED : BaseDeployEvent.MODULE_DEPLOYED;
                             
            req.setFileSource(deployFile);
            req.setName(webAppName);
            req.setContextRoot(dProps.getContextRoot());
            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);
            Properties optionalAttributes = new Properties();
            //optionalAttributes.put(ServerTags.ENABLED, String.valueOf(bEnabled));
            String virtualServers = dProps.getVirtualServers();
            if(virtualServers!=null)
                optionalAttributes.put(ServerTags.VIRTUAL_SERVERS, virtualServers);
            req.setOptionalAttributes(optionalAttributes);
                      
            getDeploymentService().deploy(req);
        }
        catch(Exception e) {
            if (actionCode == BaseDeployEvent.MODULE_DEPLOYED) {
View Full Code Here


        int actionCode = BaseDeployEvent.MODULE_DEPLOYED;
        try {

            InstanceEnvironment env = new InstanceEnvironment(getInstanceName());
           
            DeploymentRequest req = new DeploymentRequest(
                                        env,
                                        DeployableObjectType.CONN,
                                        DeploymentCommand.DEPLOY);
           
            String moduleName = dProps.getName(filePath);
            boolean isModuleExists = isRegistered(moduleName,
                                         DeployableObjectType.CONN);
            actionCode = (isModuleExists && dProps.getForce()) ?
                BaseDeployEvent.MODULE_REDEPLOYED : BaseDeployEvent.MODULE_DEPLOYED;
           
            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);
           
            setDeployDirOwner(req, env);
            getDeploymentService().deploy(req);           
        }
View Full Code Here

              
        java.io.File deployFile = new java.io.File(archiveName);
        int actionCode = BaseDeployEvent.APPLICATION_DEPLOYED; 
        try {
            InstanceEnvironment env = new InstanceEnvironment(getInstanceName());
            DeploymentRequest req = new DeploymentRequest(
                                        env,
                                        type,
                                        DeploymentCommand.DEPLOY);
           
           
            /* If app exists & forceDeploy is false it's an error.
             * It should be detected by the deployment backend.
             */
            boolean isRegistered = false ; //isRegistered(name, type);
            ObjectName componentON =
                getRegisteredComponentObjectName(name, type);

            if(componentON != null)
                isRegistered = true;

            if(isRegistered)
                validate(componentON, REDEPLOY_ACTION);

            if(type.isAPP())
            {
                actionCode = BaseDeployEvent.APPLICATION_DEPLOYED;
            }
            else
            {
                actionCode = BaseDeployEvent.MODULE_DEPLOYED;
            }
     
            req.setFileSource(deployFile);
            req.setName(name);
            req.setForced(dProps.getForce());
            // for redeployment
            req.setCascade(true);
            if(type.isWEB() || req.isExtensionModule()) {
                req.setDefaultContextRoot(dProps.getDefaultContextRoot(
                    archiveName));
                req.setContextRoot(dProps.getContextRoot());
            }
            req.setVerifying(dProps.getVerify());
            req.setPrecompileJSP(dProps.getPrecompileJSP());
            req.setGenerateRMIStubs(dProps.getGenerateRMIStubs());
            req.setAvailabilityEnabled(dProps.getAvailabilityEnabled());
            req.setStartOnDeploy(dProps.getEnable());
            req.setDescription(dProps.getDescription());
            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));
            String virtualServers = dProps.getVirtualServers();
            if(virtualServers!=null)
                optionalAttributes.put(ServerTags.VIRTUAL_SERVERS, dProps.getVirtualServers());
            req.setOptionalAttributes(optionalAttributes);
            if(props == null)
                props = new Properties();
            else
                props = dProps.prune();
            req.addOptionalArguments(props);
           
            setHostAndPort(req);
            return getDeploymentService().deploy(req);
        }
        catch(Exception e) {
View Full Code Here

            //BUG 4739891 begin
            if (objectType.isWEB()) {
                checkWebModuleReferences(name);
            }
            //BUG 4739891 end
            DeploymentRequest req = new DeploymentRequest(
                                         new InstanceEnvironment(getInstanceName()),
                                         objectType, DeploymentCommand.UNDEPLOY);
            DeploymentProperties dProps = new DeploymentProperties(props);
            req.setName(name);
            req.setCascade(dProps.getCascade());
            req.setReload(dProps.getReload());
            req.setForced(false);
            req.setExternallyManagedPath(dProps.getExternallyManaged());
            DeploymentServiceUtils.setResourceOptionsInRequest(req, dProps);
           
            props = dProps.prune();

            req.addOptionalArguments(props);
           
            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) {
                String msg = localStrings.getString("admin.mbeans.acmb.dependentresexist", new Object[] {dependentResource});
                throw new IASDeploymentException( msg );
View Full Code Here

            DeploymentEventInfo info = null;
            if (event !=null) {
                info = event.getEventInfo();
            }
            Application rootDD       = null;
            DeploymentRequest dr     = null;
            if (info != null) {
                rootDD = info.getApplicationDescriptor();
                dr = info.getDeploymentRequest();
            }
            CacheMgr mgr             = CacheMgr.getInstance();

            // post deploy event
            if ((event != null)
                    && (event.getEventType()==DeploymentEvent.POST_DEPLOY)) {

                // if an ejb module
                if (dr.isEjbModule()) {
                    Set ws = rootDD.getWebServiceDescriptors();
                    if ((ws != null) && !ws.isEmpty()) {
                        mgr.addEjbModule(dr.getName());
                        mgr.save();
                    }

                // if a web module
                } else if (dr.isWebModule()) {
                    Set ws = rootDD.getWebServiceDescriptors();
                    if ((ws != null) && !ws.isEmpty()) {
                        mgr.addWebModule(dr.getName());
                        mgr.save();
                    }

                // if application
                } else if (dr.isApplication()) {
                    List ejb = new ArrayList();
                    Set ejbBundles = rootDD.getEjbBundleDescriptors();

                    for (Iterator iter=ejbBundles.iterator(); iter.hasNext();) {
                        BundleDescriptor bd = (BundleDescriptor) iter.next();
                        WebServicesDescriptor wsDD = bd.getWebServices();
                        if (wsDD.hasWebServices()) {

                            // ejb bundle has web services
                            ejb.add(bd.getModuleDescriptor().getArchiveUri());
                        }
                    }

                    List web = new ArrayList();
                    Set webBundles = rootDD.getWebBundleDescriptors();
                    for (Iterator iter=webBundles.iterator(); iter.hasNext();) {
                        BundleDescriptor bd = (BundleDescriptor) iter.next();
                        WebServicesDescriptor wsDD = bd.getWebServices();
                        if (wsDD.hasWebServices()) {

                            // web bundle has web services
                            web.add(bd.getModuleDescriptor().getArchiveUri());
                        }
                    }

                    if ( (!ejb.isEmpty()) || (!web.isEmpty()) ) {
                        mgr.addJ2eeApplication(dr.getName(), ejb, web);
                        mgr.save();
                    }
                }
                WebServiceMgrBackEnd.getManager().removeFromCache(dr.getName());


            // post undeploy event and pre deploy event
            } else if ((event != null)
                    && (event.getEventType()==DeploymentEvent.POST_UNDEPLOY ||
                        event.getEventType()==DeploymentEvent.PRE_DEPLOY)) {

                // removes the app entry from cache
                if (dr.isEjbModule()) {
                    mgr.removeEjbModule(dr.getName());
                    mgr.save();
                } else if (dr.isWebModule()) {
                    mgr.removeWebModule(dr.getName());
                    mgr.save();
                } else if (dr.isApplication()) {
                    mgr.removeJ2eeApplication(dr.getName());
                    mgr.save();
                }
                WebServiceMgrBackEnd.getManager().removeFromCache(dr.getName());
            }



        } catch (Exception e) {
View Full Code Here

    private void processEvent(DeploymentEventInfo info, boolean create) {
        // Get the CLI overrides.
        String cliCreateTables = null;
        String cliDropTables = null;

        DeploymentRequest request = info.getDeploymentRequest();

        // Do nothing for drop tables on the deploy
        if (isDeploy(request) && !create) {
            return;
        }

        Properties cliOverrides = request.getOptionalArguments();

        String cliDropAndCreateTables = cliOverrides.getProperty(
                Constants.CMP_DROP_AND_CREATE_TABLES, Constants.UNDEFINED);

        if (create) {
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.backend.DeploymentRequest

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.