Package org.apache.geronimo.common

Examples of org.apache.geronimo.common.DeploymentException


    private JarFile getModule(boolean inPlace, File moduleFile) throws DeploymentException {
        JarFile module = null;
        if (moduleFile != null) {
            if (inPlace && !moduleFile.isDirectory()) {
                throw new DeploymentException("In place deployment is not allowed for packed module");
            }
            if (!moduleFile.exists()) {
                throw new DeploymentException("Module file does not exist: " + moduleFile.getAbsolutePath());
            }
            try {
                module = DeploymentUtil.createJarFile(moduleFile);
            } catch (IOException e) {
                throw new DeploymentException("Cound not open module file: " + moduleFile.getAbsolutePath(), e);
            }
        }
        return module;
    }
View Full Code Here


    }

    private void validatePlanFile(File planFile) throws DeploymentException {
        if (planFile != null) {
            if (!planFile.exists()) {
                throw new DeploymentException("Plan file does not exist: " + planFile.getAbsolutePath());
            }
            if (!planFile.isFile()) {
                throw new DeploymentException("Plan file is not a regular file: " + planFile.getAbsolutePath());
            }
        }
    }
View Full Code Here

            String className;
            if (callback.isSetLifecycleCallbackClass()) {
                className = callback.getLifecycleCallbackClass().getStringValue().trim();
            } else {
                if (componentType == null) {
                    throw new DeploymentException("No component type available and none in  lifecycle callback");
                }
                className = componentType;
            }
            map.put(className, callback);
        }
View Full Code Here

    protected ProgressObject runCommand(DeploymentManager mgr, ConsoleReader out, boolean inPlace, Target[] tlist, File module, File plan) throws DeploymentException {
        ProgressObject po = super.runCommand(mgr, out, inPlace, tlist, module, plan);
        waitForProgress(out, po);
        if(po.getDeploymentStatus().isFailed()) {
            throw new DeploymentException("Unable to distribute "+(module == null ? plan.getName() : module.getName())+": "+po.getDeploymentStatus().getMessage());
        }
        return mgr.start(po.getResultTargetModuleIDs());
    }
View Full Code Here

            manager = new LocalDeploymentManager(kernel);
        } else {
            tryToConnect(uri, driver, user, password, true);
        }
        if (manager == null) {
            throw new DeploymentException("Unexpected error; connection failed.");
        }
    }
View Full Code Here

            } catch (AuthenticationFailedException e) { // server's there, you just can't talk to it
                if (authPrompt) {
                    doAuthPromptAndRetry(useURI, user, password);
                    return;
                } else {
                    throw new DeploymentException("Login Failed");
                }
            } catch (DeploymentManagerCreationException e) {
                throw new DeploymentException("Unable to connect to server at " + useURI + " -- " + e.getMessage(), e);
            }
        }

        if (manager instanceof JMXDeploymentManager) {
            JMXDeploymentManager deploymentManager = (JMXDeploymentManager) manager;
View Full Code Here

        String className = null;
        try {
            JarFile jar = new JarFile(file);
            className = jar.getManifest().getMainAttributes().getValue("J2EE-DeploymentFactory-Implementation-Class");
            if (className == null) {
                throw new DeploymentException("The driver JAR " + file.getAbsolutePath() + " does not specify a J2EE-DeploymentFactory-Implementation-Class; cannot load driver.");
            }
            jar.close();
            DeploymentFactory factory = (DeploymentFactory) Class.forName(className).newInstance();
            mgr.registerDeploymentFactory(factory);
        } catch (DeploymentException e) {
View Full Code Here

            }
            if (password == null) {
                password = prompt.getPassword("Password: ");
            }
        } catch (IOException e) {
            throw new DeploymentException("Unable to prompt for login", e);
        }
        tryToConnect(uri, null, user, password, false);
    }
View Full Code Here

        DeploymentManager dmgr = connection.getDeploymentManager();
        if(dmgr instanceof GeronimoDeploymentManager) {
            try {
                GeronimoDeploymentManager mgr = (GeronimoDeploymentManager) dmgr;
                if (commandArgs.getArgs().length == 0) {
                    throw new DeploymentException("Must specify Plugin CAR file");
                }
                File carFile = new File(commandArgs.getArgs()[0]);
                carFile = carFile.getAbsoluteFile();
                if(!carFile.exists() || !carFile.canRead()) {
                    throw new DeploymentException("CAR file cannot be read: "+carFile.getAbsolutePath());
                }
                //TODO figure out if there is a plausible default repo
                Object key = mgr.startInstall(carFile, null, false, null, null);
                long start = System.currentTimeMillis();
                DownloadResults results = showProgress(consoleReader, mgr, key);
                int time = (int)(System.currentTimeMillis() - start) / 1000;
                printResults(consoleReader, results, time);           
                if(results.isFinished() && !results.isFailed() && results.getInstalledConfigIDs().size() == 1) {
                    Artifact target = results.getInstalledConfigIDs().get(0);
                    consoleReader.printString(DeployUtils.reformat("Now starting "+target+"...", 4, 72));
                    consoleReader.flushConsole();
                    new CommandStart().execute(consoleReader, connection, new BaseCommandArgs(new String[]{target.toString()}));
                }
            } catch (IOException e) {
                throw new DeploymentException("Cannot install plugin", e);
            }
        } else {
            throw new DeploymentException("Cannot install plugins when connected to "+connection.getServerURI());
        }
    }
View Full Code Here

        if (!(commandArgs instanceof InstallLibraryCommandArgs)) {
            throw new DeploymentSyntaxException("CommandArgs has the type [" + commandArgs.getClass() + "]; expected [" + InstallLibraryCommandArgs.class + "]");
        }
        InstallLibraryCommandArgs installLibraryCommandArgs = (InstallLibraryCommandArgs)commandArgs;
        if (installLibraryCommandArgs.getArgs().length == 0) {
            throw new DeploymentException("Must specify a LibraryFile");
        }
        File libFile = new File(installLibraryCommandArgs.getArgs()[0]);
        if(!libFile.exists() || !libFile.isFile() || !libFile.canRead()) {
            throw new DeploymentException("File does not exist or not a normal file or not readable. "+libFile);
        }
        DeploymentManager dmgr = connection.getDeploymentManager();
        if(dmgr instanceof GeronimoDeploymentManager) {
            GeronimoDeploymentManager mgr = (GeronimoDeploymentManager) dmgr;
            String groupId = installLibraryCommandArgs.getGroupId();
            try {
                Artifact artifact = mgr.installLibrary(libFile, groupId);
                if(artifact != null) {
                    consoleReader.printString(DeployUtils.reformat("Installed "+artifact, 4, 72));
                } else {
                    throw new DeploymentException("Unable to install library "+installLibraryCommandArgs.getArgs()[0]);
                }
            } catch (Exception e) {
                throw new DeploymentException("Unable to install library "+installLibraryCommandArgs.getArgs()[0], e);
            }
        } else {
            throw new DeploymentException("Cannot install library when connected to "+connection.getServerURI());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.common.DeploymentException

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.