Package javax.enterprise.deploy.shared.factories

Examples of javax.enterprise.deploy.shared.factories.DeploymentFactoryManager


    public static String[] deploy(PortletRequest actionRequest, File moduleFile, File planFile)
            throws PortletException {
        // TODO this is a duplicate of the code from
        // org.apache.geronimo.console.configmanager.DeploymentPortlet.processAction()
        // TODO need to eliminate this duplicate code
        DeploymentFactoryManager dfm = DeploymentFactoryManager.getInstance();
        String[] statusMsgs = new String[2];
        try {
            DeploymentManager mgr = dfm.getDeploymentManager("deployer:geronimo:inVM", null, null);
            try {
                if (mgr instanceof JMXDeploymentManager) {
                    ((JMXDeploymentManager) mgr).setLogConfiguration(false, true);
                }
               
View Full Code Here


        return (auth == null) ? null : auth.getURI();
    }

    private void tryToConnect(String argURI, String driver, String user, String password, boolean secure)
            throws DeploymentException {
        DeploymentFactoryManager mgr = DeploymentFactoryManager.getInstance();
        if (driver != null) {
            loadDriver(driver, mgr);
        } else {
            mgr.registerDeploymentFactory(geronimoDeploymentFactory);
        }
        String useURI = argURI == null ? DeployUtils.getConnectionURI(null, null, secure) : argURI;

        if (user == null && password == null) {
            try {
                SavedAuthentication savedAuthentication = DeployUtils.readSavedCredentials(useURI);
                if (savedAuthentication != null) {
                    user = savedAuthentication.getUser();
                    password = new String(savedAuthentication.getPassword());
                }
            } catch (IOException e) {
                System.out.println("Warning: " + e.getMessage());
            }
        }

        if (secure) {
            try {
                Properties props = new Properties();

                String keyStorePassword = null;
                String trustStorePassword = null;

                FileInputStream fstream = new FileInputStream(System.getProperty(KEYSTORE_TRUSTSTORE_PASSWORD_FILE,
                        DEFAULT_KEYSTORE_TRUSTSTORE_PASSWORD_FILE));
                props.load(fstream);

                keyStorePassword = (String) EncryptionManager.decrypt(props.getProperty("keyStorePassword"));
                trustStorePassword = (String) EncryptionManager.decrypt(props.getProperty("trustStorePassword"));

                fstream.close();

                String value = System.getProperty("javax.net.ssl.keyStore", System.getProperty(GERONIMO_HOME)
                        + DEFAULT_TRUSTSTORE_KEYSTORE_LOCATION);
                String value1 = System.getProperty("javax.net.ssl.trustStore", System.getProperty(GERONIMO_HOME)
                        + DEFAULT_TRUSTSTORE_KEYSTORE_LOCATION);
                System.setProperty("javax.net.ssl.keyStore", value);
                System.setProperty("javax.net.ssl.trustStore", value1);
                System.setProperty("javax.net.ssl.keyStorePassword", keyStorePassword);
                System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);
            } catch (IOException e) {
                throw new DeploymentException("Unable to set KeyStorePassword and TrustStorePassword.", e);
            }
        }
        if (user == null || password == null) {
            try {
                if (user == null) {
                    user = handler.getUsername();
                }
                if (password == null) {
                    password = handler.getPassword();
                }
            } catch (IOException e) {
                throw new DeploymentException("Unable to prompt for login", e);
            }
        }
        try {
            manager = mgr.getDeploymentManager(useURI, user, password);
            auth = new SavedAuthentication(useURI, user, password == null ? null : password.toCharArray());
        } catch (AuthenticationFailedException e) {
            // server's there, you just can't talk to it
            throw new DeploymentException("Login Failed");
        } catch (DeploymentManagerCreationException e) {
View Full Code Here

    public static String[] deploy(PortletRequest actionRequest, File moduleFile, File planFile)
            throws PortletException {
        // TODO this is a duplicate of the code from
        // org.apache.geronimo.console.configmanager.DeploymentPortlet.processAction()
        // TODO need to eliminate this duplicate code
        DeploymentFactoryManager dfm = DeploymentFactoryManager.getInstance();
        String[] statusMsgs = new String[2];
        try {
            DeploymentManager mgr = dfm.getDeploymentManager("deployer:geronimo:inVM", null, null);
            try {
                if (mgr instanceof JMXDeploymentManager) {
                    ((JMXDeploymentManager) mgr).setLogConfiguration(false, true);
                }
               
View Full Code Here

                }
            }
        } catch (FileUploadException e) {
            throw new PortletException(e);
        }
        DeploymentFactoryManager dfm = DeploymentFactoryManager.getInstance();
        FileInputStream fis = null;
        try {
            DeploymentManager mgr = dfm.getDeploymentManager("deployer:geronimo:inVM", null, null);
            try {
               
               
               
                boolean isRedeploy = redeploy != null && !redeploy.equals("");
View Full Code Here

    String getServerURI() {
        return auth.uri;
    }

    private void tryToConnect(String argURI, String driver, String user, String password, boolean authPrompt) throws DeploymentException {
        DeploymentFactoryManager mgr = DeploymentFactoryManager.getInstance();
        if (driver != null) {
            loadDriver(driver, mgr);
        } else {
            mgr.registerDeploymentFactory(geronimoDeploymentFactory);
        }
        String useURI = argURI == null ? DEFAULT_URI : argURI;

        if (authPrompt && user == null && password == null) {
            InputStream in;
            // First check for .geronimo-deployer on class path (e.g. packaged in deployer.jar)
            in = ServerConnection.class.getResourceAsStream("/.geronimo-deployer");
            // If not there, check in home directory
            if (in == null) {
                File authFile = new File(System.getProperty("user.home"), ".geronimo-deployer");
                if (authFile.exists() && authFile.canRead()) {
                    try {
                        in = new BufferedInputStream(new FileInputStream(authFile));
                    } catch (FileNotFoundException e) {
                        // ignore
                    }
                }
            }
            if (in != null) {
                try {
                    Properties props = new Properties();
                    props.load(in);
                    String encryped = props.getProperty("login." + useURI);
                    if (encryped != null) {
                        if (encryped.startsWith("{Standard}")) {
                            SavedAuthentication auth = (SavedAuthentication) SimpleEncryption.decrypt(encryped.substring(10));
                            if (auth.uri.equals(useURI)) {
                                user = auth.user;
                                password = new String(auth.password);
                            }
                        } else if (encryped.startsWith("{Plain}")) {
                            int pos = encryped.indexOf("/");
                            user = encryped.substring(7, pos);
                            password = encryped.substring(pos + 1);
                        } else {
                            System.out.print(DeployUtils.reformat("Unknown encryption used in saved login file", 4, 72));
                        }
                    }
                } catch (IOException e) {
                    System.out.print(DeployUtils.reformat("Unable to read authentication from saved login file: " + e.getMessage(), 4, 72));
                } finally {
                    try {
                        in.close();
                    } catch (IOException e) {
                        // ingore
                    }
                }
            }
        }

        if (authPrompt && !useURI.equals(DEFAULT_URI) && user == null && password == null) {
            // Non-standard URI, but no authentication information
            doAuthPromptAndRetry(useURI, user, password);
            return;
        } else { // Standard URI with no auth, Non-standard URI with auth, or else this is the 2nd try already
            try {
                manager = mgr.getDeploymentManager(useURI, user, password);
                auth = new SavedAuthentication(useURI, user, password == null ? null : password.toCharArray());
            } catch (AuthenticationFailedException e) { // server's there, you just can't talk to it
                if (authPrompt) {
                    doAuthPromptAndRetry(useURI, user, password);
                    return;
View Full Code Here

        return getDeploymentManager(uri, username, password);
    }

    private DeploymentManager getDeploymentManager(String uri, String username, String password) throws Exception {
        DeploymentFactoryImpl.register();
        DeploymentFactoryManager dfManager = DeploymentFactoryManager.getInstance();
        DeploymentFactory[] factories = dfManager.getDeploymentFactories();
        DeploymentManager deploymentManager = factories[0].getDeploymentManager(uri, username, password);
        return deploymentManager;
    }
View Full Code Here

    }

    private DeploymentManager getDeploymentManager() throws Exception {
        String uri = DeploymentManagerImpl.DEPLOYER_URI + "?targetType=as7&serverHost=" + managementClient.getMgmtAddress() + "&serverPort=" + managementClient.getMgmtPort();
        DeploymentFactoryImpl.register();
        DeploymentFactoryManager dfManager = DeploymentFactoryManager.getInstance();
        DeploymentFactory[] factories = dfManager.getDeploymentFactories();
        DeploymentManager deploymentManager = factories[0].getDeploymentManager(uri, USERNAME, PASSWORD);
        return deploymentManager;
    }
View Full Code Here

        return (auth == null) ? null : auth.getURI();
    }

    private void tryToConnect(String argURI, String driver, String user, String password, boolean secure)
            throws DeploymentException {
        DeploymentFactoryManager mgr = DeploymentFactoryManager.getInstance();
        if (driver != null) {
            loadDriver(driver, mgr);
        } else {
            mgr.registerDeploymentFactory(geronimoDeploymentFactory);
        }
        String useURI = argURI == null ? DeployUtils.getConnectionURI(null, null, secure) : argURI;

        if (user == null && password == null) {
            try {
                SavedAuthentication savedAuthentication = DeployUtils.readSavedCredentials(useURI);
                if (savedAuthentication != null) {
                    user = savedAuthentication.getUser();
                    password = new String(savedAuthentication.getPassword());
                }
            } catch (IOException e) {
                System.out.println("Warning: " + e.getMessage());
            }
        }

        if (secure) {
            try {
                Properties props = new Properties();

                String keyStorePassword = null;
                String trustStorePassword = null;

                FileInputStream fstream = new FileInputStream(System.getProperty(KEYSTORE_TRUSTSTORE_PASSWORD_FILE,
                        DEFAULT_KEYSTORE_TRUSTSTORE_PASSWORD_FILE));
                props.load(fstream);

                keyStorePassword = (String) EncryptionManager.decrypt(props.getProperty("keyStorePassword"));
                trustStorePassword = (String) EncryptionManager.decrypt(props.getProperty("trustStorePassword"));

                fstream.close();

                String value = System.getProperty("javax.net.ssl.keyStore", System.getProperty(GERONIMO_HOME)
                        + DEFAULT_TRUSTSTORE_KEYSTORE_LOCATION);
                String value1 = System.getProperty("javax.net.ssl.trustStore", System.getProperty(GERONIMO_HOME)
                        + DEFAULT_TRUSTSTORE_KEYSTORE_LOCATION);
                System.setProperty("javax.net.ssl.keyStore", value);
                System.setProperty("javax.net.ssl.trustStore", value1);
                System.setProperty("javax.net.ssl.keyStorePassword", keyStorePassword);
                System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);
            } catch (IOException e) {
                throw new DeploymentException("Unable to set KeyStorePassword and TrustStorePassword.", e);
            }
        }
        if (user == null || password == null) {
            try {
                if (user == null) {
                    user = handler.getUsername();
                }
                if (password == null) {
                    password = handler.getPassword();
                }
            } catch (IOException e) {
                throw new DeploymentException("Unable to prompt for login", e);
            }
        }
        try {
            manager = mgr.getDeploymentManager(useURI, user, password);
            auth = new SavedAuthentication(useURI, user, password == null ? null : password.toCharArray());
        } catch (AuthenticationFailedException e) {
            // server's there, you just can't talk to it
            throw new DeploymentException("Login Failed");
        } catch (DeploymentManagerCreationException e) {
View Full Code Here

     * @throws DeploymentManagerCreationException
     */
    protected DeploymentManager getDeploymentManager() throws IOException, DeploymentManagerCreationException {
        if (deploymentManager == null) {
            // Register the Geronimo factory
            DeploymentFactoryManager manager = DeploymentFactoryManager.getInstance();
            manager.registerDeploymentFactory(new DeploymentFactoryImpl());

            String uri = URI_PREFIX + "://" + hostname + ":" + port;

            DeploymentFactoryManager factoryManager = DeploymentFactoryManager.getInstance();
            deploymentManager = factoryManager.getDeploymentManager(uri, username, password);
        }

        return deploymentManager;
    }
View Full Code Here

    public static ApplicationInfo createApplicationInfo(PortletRequest actionRequest, File moduleFile) {
        ApplicationInfo applicationInfo = null;
        EARConfigBuilder.createPlanMode.set(Boolean.TRUE);
        try {
            DeploymentFactoryManager dfm = DeploymentFactoryManager.getInstance();
            DeploymentManager mgr = dfm.getDeploymentManager("deployer:geronimo:inVM", null, null);
            if (mgr instanceof JMXDeploymentManager) {
                ((JMXDeploymentManager) mgr).setLogConfiguration(false, true);
            }
            Target[] targets = mgr.getTargets();
            if (null == targets) {
View Full Code Here

TOP

Related Classes of javax.enterprise.deploy.shared.factories.DeploymentFactoryManager

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.