Package org.apache.geronimo.cli.deployer

Examples of org.apache.geronimo.cli.deployer.DistributeCommandArgs


    public void execute(ConsoleReader consoleReader, ServerConnection connection, CommandArgs commandArgs) throws DeploymentException {
        if (!(commandArgs instanceof DistributeCommandArgs)) {
            throw new DeploymentSyntaxException("CommandArgs has the type [" + commandArgs.getClass() + "]; expected [" + DistributeCommandArgs.class + "]");
        }
        DistributeCommandArgs distributeCommandArgs = (DistributeCommandArgs) commandArgs;
       
        BooleanHolder inPlaceHolder = new BooleanHolder();
        inPlaceHolder.inPlace = distributeCommandArgs.isInPlace();
       
        List<String> targets = Arrays.asList(distributeCommandArgs.getTargets());

        String[] args = distributeCommandArgs.getArgs();
        File module = null;
        File plan = null;
        if(args.length > 0) {
            File test = new File(args[0]);
            if(DeployUtils.isJarFile(test) || test.isDirectory()) {
View Full Code Here


    public void execute(ConsoleReader consoleReader, ServerConnection connection, CommandArgs commandArgs)
            throws DeploymentException {

        ProgressObject po = null;
        DistributeCommandArgs distributeCommandArgs = null;
        try {
            String[] args = commandArgs.getArgs();

            if (args.length == 0) {
                throw new DeploymentSyntaxException(
                        "Must specify a module or plan (or both) and optionally module IDs to replace");
            }

            DeploymentManager mgr = connection.getDeploymentManager();
            Target[] allTargets = mgr.getTargets();
            TargetModuleID[] allModules;
            try {
                allModules = mgr.getAvailableModules(null, allTargets);
            } catch (TargetException e) {
                throw new DeploymentException("Unable to load modules from server", e);
            }
            if (args.length >= 3 && args[0].equalsIgnoreCase("--targets")) // case of cluster redeployment
            {
                List modules = new ArrayList();
                boolean multipleTargets;
                File test = null;
                File test1 = null;
                File module = null;
                File plan = null;
                test = new File(args[2]); // check whether args[2] is a module or a plan
                checkFirstArguement(test);
                if (DeployUtils.isJarFile(test) || test.isDirectory()) {
                    if (module != null) {
                        throw new DeploymentSyntaxException("Module and plan cannot both be JAR files or directories!");
                    }
                    module = test;
                } else {
                    if (plan != null) {
                        throw new DeploymentSyntaxException("Module or plan must be a JAR file or directory!");
                    }
                    plan = test;
                }
                if (args.length >= 4) {// than it can be plan,moduleId,TargetModuleId
                    test1 = new File(args[3]);
                    if (test1.exists() && test1.canRead()) // check if it is plan
                    {
                        if (DeployUtils.isJarFile(test1) || test1.isDirectory()) {
                            if (module != null) {
                                throw new DeploymentSyntaxException(
                                        "Module and plan cannot both be JAR files or directories!");
                            }
                            module = test1;
                        } else {
                            if (plan != null) {
                                throw new DeploymentSyntaxException("Module or plan must be a JAR file or directory!");
                            }
                            plan = test1;
                        }
                    } else
                        modules.addAll(DeployUtils.identifyTargetModuleIDs(allModules, args[3], false));
                }
                if (module != null) {
                    module = module.getAbsoluteFile();
                }
                if (plan != null) {
                    plan = plan.getAbsoluteFile();
                }
                if (args.length >= 5) // Amy arguements beyond 4 should be ModuleId or Target ModuleId
                {
                    for (int i = 4; i < args.length; i++) {
                        modules.addAll(DeployUtils.identifyTargetModuleIDs(allModules, args[i], false));
                    }
                }
                try {
                    distributeCommandArgs = new DistributeCommandArgsImpl(args);
                } catch (CLParserException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

                List<String> targets = Arrays.asList(distributeCommandArgs.getTargets());
                if (targets.size() > 0) {
                    Target[] tlist = identifyTargets(targets, mgr); // before starting undeployment and deployment verify the correctness of target argument
                }
                if (modules.size() == 0) {
                    String moduleId = guessModuleId(modules, connection, consoleReader, plan, module, allModules);
View Full Code Here

    public void execute(ConsoleReader consoleReader, ServerConnection connection, CommandArgs commandArgs) throws DeploymentException {
        if (!(commandArgs instanceof DistributeCommandArgs)) {
            throw new DeploymentSyntaxException("CommandArgs has the type [" + commandArgs.getClass() + "]; expected [" + DistributeCommandArgs.class + "]");
        }
        DistributeCommandArgs distributeCommandArgs = (DistributeCommandArgs) commandArgs;

        BooleanHolder inPlaceHolder = new BooleanHolder();
        inPlaceHolder.inPlace = distributeCommandArgs.isInPlace();

        List<String> targets = Arrays.asList(distributeCommandArgs.getTargets());

        String[] args = distributeCommandArgs.getArgs();
        File module = null;
        File plan = null;
        if (args.length > 0) {
            File test = new File(args[0]);
            try {
View Full Code Here

    public void execute(ConsoleReader consoleReader, ServerConnection connection, CommandArgs commandArgs)
            throws DeploymentException {

        ProgressObject po;
        DistributeCommandArgs distributeCommandArgs = null;
        try {
            String[] args = commandArgs.getArgs();

            if (args.length == 0) {
                throw new DeploymentSyntaxException(
                        "Must specify a module or plan (or both) and optionally module IDs to replace");
            }

            DeploymentManager mgr = connection.getDeploymentManager();
            Target[] allTargets = mgr.getTargets();
            TargetModuleID[] allModules;
            try {
                allModules = mgr.getAvailableModules(null, allTargets);
            } catch (TargetException e) {
                throw new DeploymentException("Unable to load modules from server", e);
            }
            if (args.length >= 3 && args[0].equalsIgnoreCase("--targets")) // case of cluster redeployment
            {
                List<TargetModuleID> modules = new ArrayList<TargetModuleID>();
                boolean multipleTargets;
                File test = null;
                File test1 = null;
                File module = null;
                File plan = null;
                test = new File(args[2]); // check whether args[2] is a module or a plan
                checkFirstArguement(test);
                if (JarUtils.isJarFile(test) || test.isDirectory()) {
                    if (module != null) {
                        throw new DeploymentSyntaxException("Module and plan cannot both be JAR files or directories!");
                    }
                    module = test;
                } else {
                    if (plan != null) {
                        throw new DeploymentSyntaxException("Module or plan must be a JAR file or directory!");
                    }
                    plan = test;
                }
                if (args.length >= 4) {// than it can be plan,moduleId,TargetModuleId
                    test1 = new File(args[3]);
                    if (test1.exists() && test1.canRead()) // check if it is plan
                    {
                        if (JarUtils.isJarFile(test1) || test1.isDirectory()) {
                            if (module != null) {
                                throw new DeploymentSyntaxException(
                                        "Module and plan cannot both be JAR files or directories!");
                            }
                            module = test1;
                        } else {
                            if (plan != null) {
                                throw new DeploymentSyntaxException("Module or plan must be a JAR file or directory!");
                            }
                            plan = test1;
                        }
                    } else
                        modules.addAll(DeployUtils.identifyTargetModuleIDs(allModules, args[3], false));
                }
                if (module != null) {
                    module = module.getAbsoluteFile();
                }
                if (plan != null) {
                    plan = plan.getAbsoluteFile();
                }
                if (args.length >= 5) // Amy arguements beyond 4 should be ModuleId or Target ModuleId
                {
                    for (int i = 4; i < args.length; i++) {
                        modules.addAll(DeployUtils.identifyTargetModuleIDs(allModules, args[i], false));
                    }
                }
                try {
                    distributeCommandArgs = new DistributeCommandArgsImpl(args);
                } catch (CLParserException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

                List<String> targets = Arrays.asList(distributeCommandArgs.getTargets());
                if (targets.size() > 0) {
                    //Target[] tlist = identifyTargets(targets, mgr);
                    // before starting undeployment and deployment verify the correctness of target argument
                }
                if (modules.size() == 0) {
View Full Code Here

    public void execute(ConsoleReader consoleReader, ServerConnection connection, CommandArgs commandArgs) throws DeploymentException {
        if (!(commandArgs instanceof DistributeCommandArgs)) {
            throw new DeploymentSyntaxException("CommandArgs has the type [" + commandArgs.getClass() + "]; expected [" + DistributeCommandArgs.class + "]");
        }
        DistributeCommandArgs distributeCommandArgs = (DistributeCommandArgs) commandArgs;

        BooleanHolder inPlaceHolder = new BooleanHolder();
        inPlaceHolder.inPlace = distributeCommandArgs.isInPlace();

        List<String> targets = Arrays.asList(distributeCommandArgs.getTargets());

        String[] args = distributeCommandArgs.getArgs();
        File module = null;
        File plan = null;
        if (args.length > 0) {
            File test = new File(args[0]);
            try {
View Full Code Here

    public void execute(PrintWriter out, ServerConnection connection, CommandArgs commandArgs) throws DeploymentException {
        if (!(commandArgs instanceof DistributeCommandArgs)) {
            throw new DeploymentSyntaxException("CommandArgs has the type [" + commandArgs.getClass() + "]; expected [" + DistributeCommandArgs.class + "]");
        }
        DistributeCommandArgs distributeCommandArgs = (DistributeCommandArgs) commandArgs;
       
        BooleanHolder inPlaceHolder = new BooleanHolder();
        inPlaceHolder.inPlace = distributeCommandArgs.isInPlace();
       
        List<String> targets = Arrays.asList(distributeCommandArgs.getTargets());

        String[] args = distributeCommandArgs.getArgs();
        File module = null;
        File plan = null;
        if(args.length > 0) {
            File test = new File(args[0]);
            if(DeployUtils.isJarFile(test) || test.isDirectory()) {
View Full Code Here

    public void execute(PrintWriter out, ServerConnection connection, CommandArgs commandArgs) throws DeploymentException {
        if (!(commandArgs instanceof DistributeCommandArgs)) {
            throw new DeploymentSyntaxException("CommandArgs has the type [" + commandArgs.getClass() + "]; expected [" + DistributeCommandArgs.class + "]");
        }
        DistributeCommandArgs distributeCommandArgs = (DistributeCommandArgs) commandArgs;
       
        BooleanHolder inPlaceHolder = new BooleanHolder();
        inPlaceHolder.inPlace = distributeCommandArgs.isInPlace();
       
        List<String> targets = Arrays.asList(distributeCommandArgs.getTargets());

        String[] args = distributeCommandArgs.getArgs();
        File module = null;
        File plan = null;
        if(args.length > 0) {
            File test = new File(args[0]);
            if(DeployUtils.isJarFile(test) || test.isDirectory()) {
View Full Code Here

    public void execute(ConsoleReader consoleReader, ServerConnection connection, CommandArgs commandArgs) throws DeploymentException {
        if (!(commandArgs instanceof DistributeCommandArgs)) {
            throw new DeploymentSyntaxException("CommandArgs has the type [" + commandArgs.getClass() + "]; expected [" + DistributeCommandArgs.class + "]");
        }
        DistributeCommandArgs distributeCommandArgs = (DistributeCommandArgs) commandArgs;

        BooleanHolder inPlaceHolder = new BooleanHolder();
        inPlaceHolder.inPlace = distributeCommandArgs.isInPlace();

        List<String> targets = Arrays.asList(distributeCommandArgs.getTargets());

        String[] args = distributeCommandArgs.getArgs();
        File module = null;
        File plan = null;
        if (args.length > 0) {
            File test = new File(args[0]);
            try {
View Full Code Here

    public void execute(ConsoleReader consoleReader, ServerConnection connection, CommandArgs commandArgs)
            throws DeploymentException {

        ProgressObject po;
        DistributeCommandArgs distributeCommandArgs = null;
        try {
            String[] args = commandArgs.getArgs();

            if (args.length == 0) {
                throw new DeploymentSyntaxException(
                        "Must specify a module or plan (or both) and optionally module IDs to replace");
            }

            DeploymentManager mgr = connection.getDeploymentManager();
            Target[] allTargets = mgr.getTargets();
            TargetModuleID[] allModules;
            try {
                allModules = mgr.getAvailableModules(null, allTargets);
            } catch (TargetException e) {
                throw new DeploymentException("Unable to load modules from server", e);
            }
            if (args.length >= 3 && args[0].equalsIgnoreCase("--targets")) // case of cluster redeployment
            {
                List<TargetModuleID> modules = new ArrayList<TargetModuleID>();
                boolean multipleTargets;
                File test = null;
                File test1 = null;
                File module = null;
                File plan = null;
                test = new File(args[2]); // check whether args[2] is a module or a plan
                checkFirstArguement(test);
                if (JarUtils.isJarFile(test) || test.isDirectory()) {
                    if (module != null) {
                        throw new DeploymentSyntaxException("Module and plan cannot both be JAR files or directories!");
                    }
                    module = test;
                } else {
                    if (plan != null) {
                        throw new DeploymentSyntaxException("Module or plan must be a JAR file or directory!");
                    }
                    plan = test;
                }
                if (args.length >= 4) {// than it can be plan,moduleId,TargetModuleId
                    test1 = new File(args[3]);
                    if (test1.exists() && test1.canRead()) // check if it is plan
                    {
                        if (JarUtils.isJarFile(test1) || test1.isDirectory()) {
                            if (module != null) {
                                throw new DeploymentSyntaxException(
                                        "Module and plan cannot both be JAR files or directories!");
                            }
                            module = test1;
                        } else {
                            if (plan != null) {
                                throw new DeploymentSyntaxException("Module or plan must be a JAR file or directory!");
                            }
                            plan = test1;
                        }
                    } else
                        modules.addAll(DeployUtils.identifyTargetModuleIDs(allModules, args[3], false));
                }
                if (module != null) {
                    module = module.getAbsoluteFile();
                }
                if (plan != null) {
                    plan = plan.getAbsoluteFile();
                }
                if (args.length >= 5) // Amy arguements beyond 4 should be ModuleId or Target ModuleId
                {
                    for (int i = 4; i < args.length; i++) {
                        modules.addAll(DeployUtils.identifyTargetModuleIDs(allModules, args[i], false));
                    }
                }
                try {
                    distributeCommandArgs = new DistributeCommandArgsImpl(args);
                } catch (CLParserException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

                List<String> targets = Arrays.asList(distributeCommandArgs.getTargets());
                if (targets.size() > 0) {
                    //Target[] tlist = identifyTargets(targets, mgr);
                    // before starting undeployment and deployment verify the correctness of target argument
                }
                if (modules.size() == 0) {
View Full Code Here

        if (modulePlan != null) {
            commandArgs.add(modulePlan);
        }

        DistributeCommandArgs args = new DistributeCommandArgsImpl(commandArgs.toArray(new String[commandArgs.size()]),
                (targets == null ? new String[0] : targets.split(";")), inPlace);

        command.execute(this, connection, args);
        return null;
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.cli.deployer.DistributeCommandArgs

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.