Package org.apache.geronimo.deployment.plugin

Examples of org.apache.geronimo.deployment.plugin.GeronimoDeploymentManager


    public void execute(ConsoleReader consoleReader, ServerConnection connection, CommandArgs commandArgs) throws DeploymentException {
        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);
            } catch (IOException e) {
View Full Code Here


        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]);
                }
View Full Code Here

        PluginArtifactType instance = new PluginArtifactType();
        pluginType.getPluginArtifact().add(instance);
        ArtifactType artifactType = PluginInstallerGBean.toArtifactType(geronimoArtifact);
        instance.setModuleId(artifactType);

        GeronimoDeploymentManager mgr = getDeploymentManager2();
        Object key = mgr.startInstall(pluginListType, defaultRepository, false, null, null);
//        Object key = mgr.startInstall(artifactFile, defaultRepository, false, null, null);
        waitTillDone(mgr, key);

        if (startModules) {
            getLog().info("Starting modules...");
            Target[] allTargets = mgr.getTargets();
            TargetModuleID[] allModules;
            try {
                allModules = mgr.getAvailableModules(null, allTargets);
            } catch (TargetException e) {
                throw new MojoExecutionException("Unable to load module list from server", e);
            }
            TargetModuleID id = null;
            for (TargetModuleID test : allModules) {
View Full Code Here

    protected String groupId = null;

    @Override
    public void execute() throws MojoExecutionException {
        getLog().info("libraryFile: " + libraryFile.getAbsolutePath());
        GeronimoDeploymentManager mgr = getGeronimoDeploymentManager();
        try {
            mgr.installLibrary(libraryFile, groupId);
        } catch (IOException e) {
            throw new MojoExecutionException("Could not install library", e);
        }
    }
View Full Code Here

    public void execute(ConsoleReader consoleReader, ServerConnection connection, CommandArgs commandArgs) throws DeploymentException {
        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);           
            } catch (IOException e) {
View Full Code Here

        if(args.length == 0) {
            throw new DeploymentSyntaxException("Must specify Plugin CAR file");
        }
        DeploymentManager dmgr = connection.getDeploymentManager();
        if(dmgr instanceof GeronimoDeploymentManager) {
            GeronimoDeploymentManager mgr = (GeronimoDeploymentManager) dmgr;
            File carFile = new File(args[0]);
            carFile = carFile.getAbsoluteFile();
            if(!carFile.exists() || !carFile.canRead()) {
                throw new DeploymentException("CAR file cannot be read: "+carFile.getAbsolutePath());
            }
            Object key = mgr.startInstall(carFile, null, null);
            long start = System.currentTimeMillis();
            DownloadResults results = showProgress(mgr, key);
            int time = (int)(System.currentTimeMillis() - start) / 1000;
            System.out.println();
            if(!results.isFailed()) {
View Full Code Here

    }

    public void execute(PrintWriter out, ServerConnection connection, String[] args) throws DeploymentException {
        DeploymentManager dmgr = connection.getDeploymentManager();
        if(dmgr instanceof GeronimoDeploymentManager) {
            GeronimoDeploymentManager mgr = (GeronimoDeploymentManager) dmgr;
            try {
                String repo = null;
                if(args.length == 1) {
                    repo = args[0];
                } else {
                    repo = getRepository(out, new BufferedReader(new InputStreamReader(System.in)), mgr);
                }
                PluginList data;
                URL repository;
                try {
                    repository = new URL(repo);
                    data = mgr.listPlugins(repository, null, null);
                } catch (IOException e) {
                    throw new DeploymentException("Unable to list configurations", e);
                } catch (FailedLoginException e) {
                    throw new DeploymentException("Invalid login for Maven repository '"+repo+"'");
                }
                if (data == null) {
                    out.println();
                    out.println("No plugins were returned from this site.");
                    return;
                }
                Map categories = new HashMap();
                List available = new ArrayList();
                for (int i = 0; i < data.getPlugins().length; i++) {
                    PluginMetadata metadata = data.getPlugins()[i];
                    List list = (List) categories.get(metadata.getCategory());
                    if(list == null) {
                        list = new ArrayList();
                        categories.put(metadata.getCategory(), list);
                    }
                    list.add(metadata);
                }
                for (Iterator it = categories.entrySet().iterator(); it.hasNext();) {
                    Map.Entry entry = (Map.Entry) it.next();
                    String category = (String) entry.getKey();
                    List items = (List) entry.getValue();
                    out.println();
                    out.print(DeployUtils.reformat(category, 4, 72));
                    for (int i = 0; i < items.size(); i++) {
                        PluginMetadata metadata = (PluginMetadata) items.get(i);
                        String prefix = "    ";
                        if(!metadata.isInstalled() && metadata.isEligible()) {
                            available.add(metadata);
                            prefix = Integer.toString(available.size());
                            if(available.size() < 10) {
                                prefix += " ";
                            }
                            prefix += ": ";
                        }
                        out.print(DeployUtils.reformat(prefix+metadata.getName()+" ("+metadata.getVersion()+")", 8, 72));
                        out.flush();
                    }
                }
                if(available.size() == 0) {
                    out.println();
                    out.println("No plugins from this site are eligible for installation.");
                    return;
                }
                out.println();
                out.print("Install Service [enter number or 'q' to quit]: ");
                out.flush();
                BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
                String answer = in.readLine();
                if(answer.equalsIgnoreCase("q")) {
                    return;
                }
                int selection = Integer.parseInt(answer);
                PluginMetadata target = ((PluginMetadata) available.get(selection - 1));
                long start = System.currentTimeMillis();
                Object key = mgr.startInstall(PluginList.createInstallList(data, target.getModuleId()), null, null);
                DownloadResults results = CommandInstallCAR.showProgress(mgr, key);
                int time = (int)(System.currentTimeMillis() - start) / 1000;
                out.println();
                if(!results.isFailed()) {
                    out.print(DeployUtils.reformat("**** Installation Complete!", 4, 72));
View Full Code Here

    protected String groupId = null;

    @Override
    public void execute() throws MojoExecutionException {
        getLog().info("libraryFile: " + libraryFile.getAbsolutePath());
        GeronimoDeploymentManager mgr = getGeronimoDeploymentManager();
        try {
            mgr.installLibrary(libraryFile, groupId);
        } catch (IOException e) {
            throw new MojoExecutionException("Could not install library", e);
        }
    }
View Full Code Here

        PluginArtifactType instance = new PluginArtifactType();
        pluginType.getPluginArtifact().add(instance);
        ArtifactType artifactType = PluginInstallerGBean.toArtifactType(geronimoArtifact);
        instance.setModuleId(artifactType);

        GeronimoDeploymentManager mgr = getDeploymentManager2();
        Object key = mgr.startInstall(pluginListType, defaultRepository, false, null, null);
//        Object key = mgr.startInstall(artifactFile, defaultRepository, false, null, null);
        waitTillDone(mgr, key);

        if (startModules) {
            getLog().info("Starting modules...");
            Target[] allTargets = mgr.getTargets();
            TargetModuleID[] allModules;
            try {
                allModules = mgr.getAvailableModules(null, allTargets);
            } catch (TargetException e) {
                throw new MojoExecutionException("Unable to load module list from server", e);
            }
            TargetModuleID id = null;
            for (TargetModuleID test : allModules) {
View Full Code Here

    public void execute(ConsoleReader consoleReader, ServerConnection connection, CommandArgs commandArgs) throws DeploymentException {
        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);           
            } catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.apache.geronimo.deployment.plugin.GeronimoDeploymentManager

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.