Package org.apache.geronimo.kernel

Examples of org.apache.geronimo.kernel.Kernel


   
    /**
     * This method returns the CertificateRequestStore.
     */
    public static CertificateRequestStore getCertificateRequestStore() {
        Kernel kernel = KernelRegistry.getSingleKernel();
       
        AbstractNameQuery certReqStoreQuery = new AbstractNameQuery(org.apache.geronimo.management.geronimo.CertificateRequestStore.class.getName());
        Set set = kernel.listGBeans(certReqStoreQuery);
        try {
            CertificateRequestStore certReqStore = (CertificateRequestStore)kernel.getGBean((AbstractName)set.iterator().next());
            return certReqStore;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
View Full Code Here


   
    /**
     * This method returns the CertificateStore.
     */
    public static CertificateStore getCertificateStore() {
        Kernel kernel = KernelRegistry.getSingleKernel();
       
        AbstractNameQuery certStoreQuery = new AbstractNameQuery(org.apache.geronimo.management.geronimo.CertificateStore.class.getName());
        Set set = kernel.listGBeans(certStoreQuery);
        try {
            CertificateStore certStore = (CertificateStore)kernel.getGBean((AbstractName)set.iterator().next());
            return certStore;
        } catch(Exception e) {
            e.printStackTrace();
        }
        return null;
View Full Code Here

     *
     * @return Port configured for HTTPS Client Authentication.
     * @return -1 if no HTTPS Client Authentication Connector is configured.
     */
    public static int getHttpsClientAuthPort() {
        Kernel kernel = KernelRegistry.getSingleKernel();
       
        AbstractNameQuery connectorQuery = new AbstractNameQuery(SecureConnector.class.getName());
        Set set = kernel.listGBeans(connectorQuery);
        for(Iterator itr = set.iterator(); itr.hasNext(); ){
            try {
                SecureConnector connector = (SecureConnector)kernel.getGBean((AbstractName)itr.next());
                if(connector.isClientAuthRequired())
                    return connector.getPort();
            } catch(Exception e) {
                e.printStackTrace();
            }
View Full Code Here

        }
        end = System.currentTimeMillis();
        printResults("FastClass", end, start, iterations);

        // start a kernel
        Kernel kernel = KernelFactory.newInstance().createKernel("speed");
        kernel.boot();
        AbstractName abstractName = kernel.getNaming().createRootName(new Artifact("test", "foo", "1", "car"), "test", "test");
        GBeanData mockGBean = new GBeanData(abstractName, MockGBean.getGBeanInfo());
        mockGBean.setAttribute("Name", "bar");
        mockGBean.setAttribute("FinalInt", new Integer(57));
        kernel.loadGBean(mockGBean, Speed.class.getClassLoader());
        kernel.startGBean(abstractName);

        // reflect proxy
//        ProxyFactory vmProxyFactory = new VMProxyFactory(MyInterface.class);
//        ProxyMethodInterceptor vmMethodInterceptor = vmProxyFactory.getMethodInterceptor();
//        MyInterface vmProxy = (MyInterface) vmProxyFactory.create(vmMethodInterceptor);
//        vmMethodInterceptor.connect(kernel.getMBeanServer(), objectName);
//        iterations = 50000;
//        for (int i = 0; i < iterations; i++) {
//            vmProxy.doNothing();
//        }
//        start = System.currentTimeMillis();
//        for (int i = 0; i < iterations; i++) {
//            vmProxy.doNothing();
//        }
//        end = System.currentTimeMillis();
//        printResults("ReflectionProxy", end, start, iterations);

        // cglib proxy (front half)
/*
        ProxyFactory frontCGLibProxyFactory = new CGLibProxyFactory(MyInterface.class);
        ProxyMethodInterceptor frontCGLibMethodInterceptor = new ProxyMethodInterceptor(MyInterface.class);
        Class enhancedType = frontCGLibProxyFactory.create(frontCGLibMethodInterceptor).getClass();
        frontCGLibMethodInterceptor = new ProxyMethodInterceptor(enhancedType) {
            public Object intercept(Object object, Method method, Object[] args, MethodProxy proxy) throws Throwable {
                return null;
            }
        };
        MyInterface frontCGLibProxy = (MyInterface) frontCGLibProxyFactory.create(frontCGLibMethodInterceptor);
        frontCGLibMethodInterceptor.connect(kernel.getMBeanServer(), objectName);
        iterations = 100000000;
        for (int i = 0; i < iterations; i++) {
            frontCGLibProxy.doNothing();
        }
        start = System.currentTimeMillis();
        for (int i = 0; i < iterations; i++) {
            frontCGLibProxy.doNothing();
        }
        end = System.currentTimeMillis();
        printResults("Front CGLibProxy", end, start, iterations);
*/

        // Raw Invoker
        RawInvoker rawInvoker = (RawInvoker) kernel.getAttribute(mockGBean.getAbstractName(), "$$RAW_INVOKER$$");
        int rawIndex = ((Integer) rawInvoker.getOperationIndex().get(new GOperationSignature("doNothing", new String[0]))).intValue();
        iterations = 2000000;
        for (int i = 0; i < iterations; i++) {
            rawInvoker.invoke(rawIndex, NO_ARGS);
        }
View Full Code Here

        }
        end = System.currentTimeMillis();
        printResults("FastClass", end, start, iterations);

        // start a kernel
        Kernel kernel = KernelFactory.newInstance().createKernel("speed");
        kernel.boot();
        AbstractName abstractName = kernel.getNaming().createRootName(new Artifact("test", "foo", "1", "car"), "test", "test");
        GBeanData mockGBean = new GBeanData(abstractName, MockGBean.getGBeanInfo());
        mockGBean.setAttribute("Name", "bar");
        mockGBean.setAttribute("FinalInt", new Integer(57));
        kernel.loadGBean(mockGBean, Speed.class.getClassLoader());
        kernel.startGBean(mockGBean.getAbstractName());

        // reflect proxy
//        ProxyFactory vmProxyFactory = new VMProxyFactory(MyInterface.class);
//        ProxyMethodInterceptor vmMethodInterceptor = vmProxyFactory.getMethodInterceptor();
//        MyInterface vmProxy = (MyInterface) vmProxyFactory.create(vmMethodInterceptor);
View Full Code Here

    private boolean targetSet;

    public void buildPackage() throws Exception {
        log.info("Packaging module configuration: " + planFile);

        Kernel kernel = createKernel();
        if (!targetSet) {
            kernel.stopGBean(targetRepositoryAName);
            kernel.setAttribute(targetRepositoryAName, "root", targetRepository.toURI());
            kernel.startGBean(targetRepositoryAName);

            if (kernel.getGBeanState(targetConfigStoreAName) != State.RUNNING_INDEX) {
                throw new IllegalStateException("After restarted repository then config store is not running");
            }

            targetSet = true;
        }

        log.debug("Starting configurations..." + Arrays.asList(deploymentConfigs));

        // start the Configuration we're going to use for this deployment
        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
        try {
            for (String artifactName : deploymentConfigs) {
                org.apache.geronimo.kernel.repository.Artifact configName = org.apache.geronimo.kernel.repository.Artifact.create(artifactName);
                if (!configurationManager.isLoaded(configName)) {
                    RecordingLifecycleMonitor monitor = new RecordingLifecycleMonitor();
                    try {
                        configurationManager.loadConfiguration(configName, monitor);
                    } catch (LifecycleException e) {
                        log.error("Could not load deployer configuration: " + configName + "\n" + monitor.toString(), e);
                    }
                    monitor = new RecordingLifecycleMonitor();
                    try {
                        configurationManager.startConfiguration(configName, monitor);
                        log.info("Started deployer: " + configName);
                    } catch (LifecycleException e) {
                        log.error("Could not start deployer configuration: " + configName + "\n" + monitor.toString(), e);
                    }
                }
            }
        } finally {
            ConfigurationUtil.releaseConfigurationManager(kernel, configurationManager);
        }

        log.debug("Deploying...");

        AbstractName deployer = locateDeployer(kernel);
        invokeDeployer(kernel, deployer, targetConfigStoreAName.toString());
        //use a fresh kernel for each module
        kernel.shutdown();
        kernel = null;
    }
View Full Code Here

        File targetServerPath = serverInfo.resolveServer(relativeTargetServerPath);
        if (targetServerPath.exists()) {
          FileUtils.forceDelete(targetServerPath);
        }
        String targetServerPathName = targetServerPath.getAbsolutePath();
        Kernel kernel = new BasicKernel("assembly");

        try {
//            kernel.boot();
            PluginInstallerGBean installer = new PluginInstallerGBean(
                    targetRepositoryPath,
                    targetServerPathName,
                    serverInstanceDatas,
                    kernel,
                    classLoader);

            installer.install(pluginList, localSourceRepository, true, null, null, downloadPoller);
        } finally {
            kernel.shutdown();
        }
        return downloadPoller;
    }
View Full Code Here

    protected void handleRequest(HttpServletRequest request, HttpServletResponse response, boolean reply) throws ServletException, IOException {
        String path = request.getPathInfo();
        if(path == null) {
            throw new ServletException("No configId specified for CAR download");
        }
        Kernel kernel = KernelRegistry.getSingleKernel();
        if(path.equals("/geronimo-plugins.xml")) {
            response.setContentType("text/xml");
            if(reply) {
                try {
                    generateConfigFile(request, kernel, response.getWriter());
View Full Code Here

        String configId = request.getParameter("configId");
        if(configId == null) {
            throw new ServletException("No configId specified for CAR download");
        }
        Artifact artifact = Artifact.create(configId);
        Kernel kernel = KernelRegistry.getSingleKernel();
        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
        ConfigurationStore store = mgr.getStoreForConfiguration(artifact);
        try {
            response.setContentType("application/zip");
            store.exportConfiguration(artifact, response.getOutputStream());
View Full Code Here

    // The following may change based on the user's selections
    // nothing yet

    private static ManagementHelper createHelper() {
        //todo: consider making this configurable; we could easily connect to a remote kernel if we wanted to
        Kernel kernel = null;
        try {
            kernel = (Kernel) new InitialContext().lookup("java:comp/GeronimoKernel");
        } catch (NamingException e) {
//            log.error("Unable to look up kernel in JNDI", 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.