Examples of DeploymentFactoryManager


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

    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 encrypted = props.getProperty("login." + useURI);
                    if (encrypted != null) {

                        if (encrypted.startsWith("{Plain}")) {
                            int pos = encrypted.indexOf("/");
                            user = encrypted.substring(7, pos);
                            password = encrypted.substring(pos + 1);
                        } else {
                            Object o = EncryptionManager.decrypt(encrypted);
                            if (o == encrypted) {
                                System.out.print(DeployUtils.reformat("Unknown encryption used in saved login file", 4, 72));
                            } else {
                                SavedAuthentication auth = (SavedAuthentication) o;
                                if (auth.uri.equals(useURI)) {
                                    user = auth.user;
                                    password = new String(auth.password);
                                }
                            }
                        }
                    }
                } 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

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

                }
            }
        } 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("");
                if(mgr instanceof JMXDeploymentManager) {
                    ((JMXDeploymentManager)mgr).setLogConfiguration(false, true);
                }
View Full Code Here

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

     * @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

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

        new DeploymentFactoryImpl();

        ClassLoader oldcl = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
            DeploymentFactoryManager factoryManager = DeploymentFactoryManager.getInstance();
            DeploymentManager manager = factoryManager.getDeploymentManager(getUri(), getUsername(), getPassword());
            return manager;
        } finally {
            Thread.currentThread().setContextClassLoader(oldcl);
        }
    }
View Full Code Here

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

            kernel.stop();
        }
    }

    private void tryToConnect(String uri, JMXDeploymentManager.CommandContext commandContext, String driver, String user, String password, boolean authPrompt) throws DeploymentException {
        DeploymentFactoryManager mgr = DeploymentFactoryManager.getInstance();
        if(driver != null) {
            loadDriver(driver, mgr);
        } else {
            mgr.registerDeploymentFactory(new DeploymentFactoryImpl());
        }
       
        try {
            manager = mgr.getDeploymentManager(uri == null ? DEFAULT_URI : uri, user, password);
        } catch(AuthenticationFailedException e) { // server's there, you just can't talk to it
            if(authPrompt && (user == null || password == null)) {
                doAuthPromptAndRetry(uri, commandContext, user, password);
            } else {
                throw new DeploymentException("Login Failed");
View Full Code Here

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

   protected DeploymentManager initDeploymentManager(String factoryClass, String uri, String username, String password) throws Exception
   {
      if (deploymentManager == null)
      {
         DeploymentFactoryManager dfm = DeploymentFactoryManager.getInstance();
         dfm.registerDeploymentFactory(
               (DeploymentFactory) Class.forName(factoryClass).newInstance());
         deploymentManager =
               dfm.getDeploymentManager(uri, username, password);
      }
      return deploymentManager;
   }
View Full Code Here

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

    String getServerURI() {
        return auth.uri;
    }

    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 ? getDefaultURI(secure) : argURI;

        if (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 encrypted = props.getProperty("login." + useURI);
                    if (encrypted != null) {

                        if (encrypted.startsWith("{Plain}")) {
                            int pos = encrypted.indexOf("/");
                            user = encrypted.substring(7, pos);
                            password = encrypted.substring(pos + 1);
                        } else {
                            Object o = EncryptionManager.decrypt(encrypted);
                            if (o == encrypted) {
                                System.out.print(DeployUtils.reformat("Unknown encryption used in saved login file", 4, 72));
                            } else {
                                SavedAuthentication auth = (SavedAuthentication) o;
                                if (auth.uri.equals(useURI)) {
                                    user = auth.user;
                                    password = new String(auth.password);
                                }
                            }
                        }
                    }
                } 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 (user == null || password == null) {
            try {
                InputPrompt prompt = new InputPrompt(in, out);
                if (user == null) {
                    user = prompt.getInput("Username: ");
                }
                if (password == null) {
                    password = prompt.getPassword("Password: ");
                }
            } 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

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

    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(new DeploymentFactoryImpl());
        }
        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) {
                    }
                }
            }
            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) {
                    }
                }
            }
        }

        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

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

        new DeploymentFactoryImpl();

        ClassLoader oldcl = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
            DeploymentFactoryManager factoryManager = DeploymentFactoryManager.getInstance();
            DeploymentManager manager = factoryManager.getDeploymentManager(getUri(), getUsername(), getPassword());
            return manager;
        } finally {
            Thread.currentThread().setContextClassLoader(oldcl);
        }
    }
View Full Code Here

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

                }
            }
        } 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("");
                if(mgr instanceof JMXDeploymentManager) {
                    ((JMXDeploymentManager)mgr).setLogConfiguration(false, true);
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.