Package org.apache.geronimo.kernel

Examples of org.apache.geronimo.kernel.Kernel


    public void execute() throws Exception {
        System.out.println();
        System.out.println("    Packaging configuration " + planFile);
        System.out.println();
        try {
            Kernel kernel = createKernel();
            if(!targetSet) {
                setTargetConfigStore();
            }

            // start the Configuration we're going to use for this deployment
View Full Code Here


        URL systemURL = new File(root, "bin/server.jar").toURL();
        URL configURL = new URL("jar:" + systemURL.toString() + "!/META-INF/config.ser");
        InputStream in = configURL.openStream();

        // build a basic kernel without a configuration-store, our configuration store is
        Kernel kernel = KernelFactory.newInstance().createKernel(getKernelName());
        kernel.boot();

        ConfigurationUtil.loadBootstrapConfiguration(kernel, in, this.getClass().getClassLoader());

        // load the rest of the configuration listed on the command line
        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
View Full Code Here

                dataSourceAppName = "null";
            } else {
                dataSourceAppName = dataSourceAppName.trim();
            }
            String kernelName = (String) options.get(JaasLoginModuleUse.KERNEL_NAME_LM_OPTION);
            Kernel kernel = KernelRegistry.getKernel(kernelName);
            Set set = kernel.listGBeans(new AbstractNameQuery(JCAManagedConnectionFactory.class.getName()));
            JCAManagedConnectionFactory factory;
            for (Iterator it = set.iterator(); it.hasNext();) {
                AbstractName name = (AbstractName) it.next();
                if(name.getName().get(NameFactory.J2EE_APPLICATION).equals(dataSourceAppName) &&
                    name.getName().get(NameFactory.J2EE_NAME).equals(dataSourceName)) {
                    try {
                        factory = (JCAManagedConnectionFactory) kernel.getGBean(name);
                        String type = factory.getConnectionFactoryInterface();
                        if(type.equals(DataSource.class.getName())) {
                            this.factory = factory;
                            break;
                        }
View Full Code Here

        RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/sampleNotInstalled.jsp");
        dispatcher.forward(request, response);
    }

    private void doInstall(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Kernel kernel = KernelRegistry.getSingleKernel();
        PluginInstaller installer = getPluginInstaller(kernel);
        String moduleIdName = getInitParameter("moduleId");
        moduleIdName = moduleIdName.replaceAll("SERVER", getServerType());
        URL repo = getFirstPluginRepository(kernel);
        PluginMetadata target = new PluginMetadata("Sample Application", null, "Samples", "A sample application",
View Full Code Here

    try {
      if (port == null) {
        port = DEFAULT_PORT;
      }
      System.out.print("Locating server on port " + port + "... ");
      Kernel kernel = null;
      try {
        kernel = getRunningKernel();
      } catch (IOException e) {
        System.out
            .println("\nCould not communicate with the server.  The server may not be running or the port number may be incorrect.");
      }
      if (kernel != null) {
        System.out.println("Server found.");
        System.out.println("Server shutdown begun");
        kernel.shutdown();
        System.out.println("Server shutdown completed");
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

  }

  public Kernel getRunningKernel() throws IOException {
    Map map = new HashMap();
    map.put("jmx.remote.credentials", new String[] { user, password });
    Kernel kernel = null;
    try {
      JMXServiceURL address = new JMXServiceURL(
          "service:jmx:rmi:///jndi/rmi://localhost" + ":" + port
              + "/JMXConnector");
      JMXConnector jmxConnector = JMXConnectorFactory.connect(address,
View Full Code Here

            try {
                localServer = new LocalServer("geronimo/j2ee-system//car", "var/config/offline-deployer-list");
            } catch (Exception e) {
                throw new DeploymentException("Could not start local server", e);
            }
            Kernel kernel = localServer.getKernel();
            ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
            configurationManager.setOnline(false);

            manager = new LocalDeploymentManager(localServer.getKernel());
        } else {
View Full Code Here

    private JaasLoginServiceMBean connect() {
        if (serverHost != null && serverPort > 0) {
            return JaasLoginServiceRemotingClient.create(serverHost, serverPort);
        } else {
            Kernel kernel = KernelRegistry.getKernel(kernelName);
            try {
                return (JaasLoginServiceMBean) kernel.getGBean(serviceName);
            } catch (GBeanNotFoundException e) {
                IllegalStateException illegalStateException = new IllegalStateException();
                illegalStateException.initCause(e);
                throw illegalStateException;
            }
View Full Code Here

            AddToSystemProperty(extensionDirs, extensionDirsFromManifest, geronimoInstallDirectory);

            ClassLoader classLoader = Daemon.class.getClassLoader();

            // create the kernel
            final Kernel kernel = KernelFactory.newInstance().createKernel("geronimo");

            // boot the kernel
            try {
                kernel.boot();
            } catch (Exception e) {
                e.printStackTrace();
                System.exit(1);
                throw new AssertionError();
            }

            // add our shutdown hook
            Runtime.getRuntime().addShutdownHook(new Thread("Geronimo shutdown thread") {
                public void run() {
                    System.out.println("\rServer shutdown begun              ");
                    kernel.shutdown();
                    System.out.println("Server shutdown completed");
                }
            });

            // load this configuration
            InputStream in = classLoader.getResourceAsStream("META-INF/config.ser");
            try {
                ConfigurationUtil.loadBootstrapConfiguration(kernel, in, classLoader);
            } finally {
                if (in != null) {
                    try {
                        in.close();
                    } catch (IOException ignored) {
                        // ignored
                    }
                }
            }
           
            monitor.systemStarted(kernel);

            AbstractNameQuery query = new AbstractNameQuery(PersistentConfigurationList.class.getName());

            if (configs.isEmpty()) {
                // --override wasn't used (nothing explicit), see what was running before
                Set configLists = kernel.listGBeans(query);
                for (Iterator i = configLists.iterator(); i.hasNext();) {
                    AbstractName configListName = (AbstractName) i.next();
                    try {
                        configs.addAll((List) kernel.invoke(configListName, "restore"));
                    } catch (IOException e) {
                        System.err.println("Unable to restore last known configurations");
                        e.printStackTrace();
                        kernel.shutdown();
                        System.exit(1);
                        throw new AssertionError();
                    }
                }
            }

            monitor.foundModules((Artifact[]) configs.toArray(new Artifact[configs.size()]));

            // load the rest of the configurations
            try {
                ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
                try {
                    for (Iterator i = configs.iterator(); i.hasNext();) {
                        Artifact configID = (Artifact) i.next();
                        monitor.moduleLoading(configID);
                        configurationManager.loadConfiguration(configID);
                        monitor.moduleLoaded(configID);
                        monitor.moduleStarting(configID);
                        configurationManager.startConfiguration(configID);
                        monitor.moduleStarted(configID);
                    }
                } finally {
                    ConfigurationUtil.releaseConfigurationManager(kernel, configurationManager);
                }
            } catch (Exception e) {
                //Exception caught when starting configurations, starting kernel shutdown
                monitor.serverStartFailed(e);
                try {
                    kernel.shutdown();
                } catch (Exception e1) {
                    System.err.println("Exception caught during kernel shutdown");
                    e1.printStackTrace();
                }
                System.exit(1);
                throw new AssertionError();
            }

            // Tell every persistent configuration list that the kernel is now fully started
            Set configLists = kernel.listGBeans(query);
            for (Iterator i = configLists.iterator(); i.hasNext();) {
                AbstractName configListName = (AbstractName) i.next();
                kernel.setAttribute(configListName, "kernelFullyStarted", Boolean.TRUE);
            }

            // Startup sequence is finished
            monitor.startupFinished();
            monitor = null;

            // capture this thread until the kernel is ready to exit
            while (kernel.isRunning()) {
                try {
                    synchronized (kernel) {
                        kernel.wait();
                    }
                } catch (InterruptedException e) {
                    // continue
                }
            }
View Full Code Here

    public void setInternalProxy(final Object internalProxy) {
        this.internalProxy = internalProxy;
    }

    private void connectInternalProxy() throws Throwable {
        Kernel kernel = KernelRegistry.getKernel(kernelName);
        try {
            internalProxy = kernel.invoke(targetName, "$getConnectionFactory");
        } catch (Exception e) {
            throw new IllegalStateException("Could not connect proxy to ManagedConnectionFactoryWrapper").initCause(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.kernel.Kernel

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.