Package com.sun.enterprise.deployment.client

Examples of com.sun.enterprise.deployment.client.DeploymentFacility


            targets = new String[] {defaultTarget};
        }
       
       archivePath = archivePath.replace('\\', '/' );
        AbstractArchive archive = (new ArchiveFactory()).openArchive(archivePath);
        DeploymentFacility df= DeploymentFacilityFactory.getLocalDeploymentFacility();
        JESProgressObject progressObject = null;
       
        progressObject = df.deploy(df.createTargets(targets), archive, null , props)//null for deployment plan
        DeploymentStatus status = null;
        do {
            status = progressObject.getCompletedStatus();
            if(status == null) {
                try {
View Full Code Here


      dProps.put(DeploymentProperties.CASCADE, "true");
    }
       
        List selectedRows = (List) obj;
        JESProgressObject progressObject = null;
         DeploymentFacility df= DeploymentFacilityFactory.getLocalDeploymentFacility();
        //Hard coding to server, fix me for actual targets in EE.
        String[] targetNames = new String[] {"server"};
       
        for(int i=0; i< selectedRows.size(); i++){
            Map oneRow = (Map) selectedRows.get(i);
            String appName = (String) oneRow.get("name");
            //Undeploy the app here.
            if(AMXUtil.isEE()){
                List<String> refList = TargetUtil.getDeployedTargets(appName, true);
                if(refList.size() > 0)
                    targetNames = refList.toArray(new String[refList.size()]);
                else
                    targetNames=new String[]{"domain"};
            }
            progressObject = df.undeploy(df.createTargets(targetNames), appName, dProps);
            DeploymentStatus status = df.waitFor(progressObject);
            //we DO want it to continue and call the rest handlers, ie navigate(). This will
            //re-generate the table data because there may be some apps thats been undeployed
            //successfully.  If we stopProcessing, the table data is stale and still shows the
            //app that has been gone.
            if( checkDeployStatus(status, handlerCtx, false)){
View Full Code Here

   
    //Status of app-ref created will be the same as the app itself.
    static public void handleAppRefs(String appName, String[] targetNames, HandlerContext handlerCtx, boolean addFlag, Boolean enableFlag) {
        if (targetNames != null && targetNames.length > 0){
            DeploymentFacility df= DeploymentFacilityFactory.getLocalDeploymentFacility();
            JESProgressObject progressObject = null;
            Properties dProps = new Properties();

            if (enableFlag != null)
                dProps.setProperty(DeploymentProperties.ENABLE, enableFlag.toString());
           
            if (addFlag)
                progressObject = df.createAppRef(df.createTargets(targetNames), appName, dProps);
            else
                progressObject = df.deleteAppRef(df.createTargets(targetNames), appName, dProps);
            DeploymentStatus status = df.waitFor(progressObject);
            checkDeployStatus(status, handlerCtx, true);
        }
    }
View Full Code Here

    public void runCommand()
        throws CommandException, CommandValidationException
    {
        validateOptions();

        DeploymentFacility df = DeploymentFacilityFactory.getDeploymentFacility();
        ServerConnectionIdentifier conn = createServerConnectionIdentifier(
            getHost(), getPort(), getUser(), getPassword());
        df.connect(conn);

        //prepare data
        //Target[] targets = new JESTarget[1];
        final String targetName = getOption(TARGET_OPTION);
        //targets[0] = new JESTarget(targetName, null);
        Map deployOptions = createDeploymentProperties();

        JESProgressObject progressObject = null;
       
        try
        {
            if (df.isConnected())
            {
                CLILogger.getInstance().printDebugMessage("Calling the undeploy with DeployOptions");
                Target[] targets = df.createTargets(new String[]{targetName});
                if (targets == null)
                {
                    //CLILogger.getInstance().printError(getLocalizedString("InvalidTarget"));
                    throw new CommandException(getLocalizedString("InvalidTarget", new Object[] {targetName}));
                }

                progressObject = df.undeploy(targets, getComponentName(), deployOptions);
            } else
            {
                CLILogger.getInstance().printError(
                                   getLocalizedString("CouldNotConnectToDAS"));
            }
        }
        catch (Exception e)
        {
            if (e.getLocalizedMessage() != null)
                CLILogger.getInstance().printDetailMessage(
                    e.getLocalizedMessage());

            throw new CommandException(getLocalizedString(
                "CommandUnSuccessful", new Object[] {name} ), e);
        }

        DeploymentStatus status = df.waitFor(progressObject);
        final String statusString = status.getStageStatusMessage();


        if (status != null &&
            status.getStatus() == DeploymentStatus.FAILURE) {
View Full Code Here

        CommandType commandType, TargetModuleID[] targetModuleIDList)
        throws IllegalStateException {

         verifyConnected();
       try
         DeploymentFacility df = getDeploymentFacility();

        /*
         *Create a temporary collection based on the target module IDs to make it easier to deal
         *with the different modules and the set of targets.
         */
        TargetModuleIDCollection coll = new TargetModuleIDCollection(targetModuleIDList);
       
        /*
         *For each distinct module ID present in the list, ask the deployment facility to
         *operate on that module on all the relevant targets.
         */
       
        for (Iterator it = coll.iterator(); it.hasNext();) {
            /*
             *The iterator returns one work instance for each module present in the collection.
             *Each work instance reflects one invocation of a method on the DeploymentFacility.
             */
            DeploymentFacilityModuleWork work = (DeploymentFacilityModuleWork) it.next();
            ProgressObject po = null;
           
            if (commandType.equals(CommandType.START)) {
                po = df.enable(work.targets(), work.getModuleID());
               
            } else if (commandType.equals(CommandType.STOP)) {
                po = df.disable(work.targets(), work.getModuleID());
               
            } else if (commandType.equals(CommandType.UNDEPLOY)) {
                po = df.undeploy(work.targets(), work.getModuleID());

            } else {
                throw new IllegalArgumentException(localStrings.getLocalString(
                    "enterprise.deployapi.spi.unexpcommand",
                    "Received unexpected deployment facility command ${0}",
View Full Code Here

        ServerConnectionIdentifier conn = createServerConnectionIdentifier(
            getHost(), getPort(), getUser(), getPassword());

  try
        {
            DeploymentFacility df = DeploymentFacilityFactory.getDeploymentFacility();      
            df.connect(conn);

            final String targetName = getTargetOperand();
            if (df.isConnected())
            {
                targetModuleIDs = df.listAppRefs(new String[]{targetName});
                if (targetModuleIDs == null)
                {
                    //CLILogger.getInstance().printError(getLocalizedString("InvalidTarget"));
                    throw new CommandException(_strMgr.getString("InvalidTarget", new Object[] {targetName}));
                }
View Full Code Here

    public void runCommand()
        throws CommandException, CommandValidationException
    {
        validateOptions();

        DeploymentFacility df = DeploymentFacilityFactory.getDeploymentFacility();      
        ServerConnectionIdentifier conn = createServerConnectionIdentifier(
            getHost(), getPort(), getUser(), getPassword());
        df.connect(conn);

        final String targetName = getOption(TARGET_OPTION);               
        //Target[] targets = df.createTargets(new String[]{targetName});
        final String moduleID = (String) getOperands().get(0);
       
        JESProgressObject progressObject = null;
  try
        {
            Map props = createProperties();
            if (df.isConnected())
            {
                Target[] targets = df.createTargets(new String[]{targetName});
                if (targets == null)
                {
                    //CLILogger.getInstance().printError(getLocalizedString("InvalidTarget"));
                    throw new CommandException(_strMgr.getString("InvalidTarget", new Object[] {targetName}));
                }

                progressObject = df.createAppRef(targets, moduleID, props);
            } else
            {
                CLILogger.getInstance().printError(
                                   getLocalizedString("CouldNotConnectToDAS"));
            }
        }
        catch (Exception e)
        {
            //e.printStackTrace();
            if (e.getLocalizedMessage() != null)
                CLILogger.getInstance().printDetailMessage(
                    e.getLocalizedMessage());

            throw new CommandException(getLocalizedString(
                "CommandUnSuccessful", new Object[] {name} ), e);
        }
       
        DeploymentStatus status = df.waitFor(progressObject);
        final String statusString = status.getStageStatusMessage();

        if (status != null &&
                status.getStatus() == DeploymentStatus.WARNING)
        {
View Full Code Here

    public void runCommand()
        throws CommandException, CommandValidationException
    {
        validateOptions();

        DeploymentFacility df = DeploymentFacilityFactory.getDeploymentFacility();      
        ServerConnectionIdentifier conn = createServerConnectionIdentifier(
            getHost(), getPort(), getUser(), getPassword());
        df.connect(conn);

        final String targetName = getOption(TARGET_OPTION);               
        //Target[] targets = df.createTargets(new String[]{targetName});
        final String moduleID = (String) getOperands().get(0);
       
        JESProgressObject progressObject = null;
  try
        {
            Map props = createProperties();
            if (df.isConnected())
            {
                Target[] targets = df.createTargets(new String[]{targetName});
                if (targets == null)
                {
                    //CLILogger.getInstance().printError(getLocalizedString("InvalidTarget"));
                    throw new CommandException(_strMgr.getString("InvalidTarget", new Object[] {targetName}));
                }

                progressObject = df.deleteAppRef(targets, moduleID, props);
            } else
            {
                CLILogger.getInstance().printError(
                                   getLocalizedString("CouldNotConnectToDAS"));
            }
        }
        catch (Exception e)
        {
            //e.printStackTrace();
            if (e.getLocalizedMessage() != null)
                CLILogger.getInstance().printDetailMessage(
                    e.getLocalizedMessage());

            throw new CommandException(getLocalizedString(
                "CommandUnSuccessful", new Object[] {name} ), e);
        }

        DeploymentStatus status = df.waitFor(progressObject);
        final String statusString = status.getStageStatusMessage();

        if (status != null &&
                status.getStatus() == DeploymentStatus.WARNING)
        {
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.client.DeploymentFacility

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.