Package org.apache.geronimo.kernel

Examples of org.apache.geronimo.kernel.Kernel$KernelReference


        }
        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

    public String getClassName() {
        return "org.omg.CORBA.ORB";
    }

    public Object getContent() throws NamingException {
        Kernel kernel = getKernel();
        try {
            AbstractName targetName = resolveTargetName();
            return kernel.getAttribute(targetName, "ORB");
        } catch (Exception e) {
            throw (NameNotFoundException) new NameNotFoundException("Error getting ORB attribute from CORBAGBean: name query =" + abstractNameQueries).initCause(e);
        }
    }
View Full Code Here

        this.configId = configId;
        this.abstractNameQueries = abstractNameQueries;
    }

    public Configuration getConfiguration() {
        Kernel kernel = getKernel();
        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
        return configurationManager.getConfiguration(configId);
    }
View Full Code Here

    public String getClassName() {
        return iface.getName();
    }

    public Object getContent() throws NameNotFoundException {
        Kernel kernel = getKernel();

        AbstractName target;
        try {
            target = resolveTargetName();
        } catch (GBeanNotFoundException e) {
            throw (NameNotFoundException) new NameNotFoundException("Could not resolve name query: " + abstractNameQueries).initCause(e);
        }

        Object proxy;
        try {
            proxy = kernel.invoke(target, "$getResource");
        } catch (Exception e) {
            throw (IllegalStateException) new IllegalStateException("Could not get proxy").initCause(e);
        }
        if (proxy == null) {
            throw new IllegalStateException("Proxy not returned. Target " + target + " not started");
View Full Code Here

    public String getClassName() {
        return "javax.ejb.spi.HandleDelegate";
    }

    public Object getContent() throws NamingException {
        Kernel kernel = getKernel();
        try {
            AbstractName targetName = resolveTargetName();
            return kernel.getAttribute(targetName, "handleDelegate");
        } catch (Exception e) {
            throw (NameNotFoundException) new NameNotFoundException("Error getting handle delegate attribute from CORBAGBean: name query =" + abstractNameQueries).initCause(e);
        }
    }
View Full Code Here

    public String getKernelName() {
        return kernelName;
    }

    public void execute() throws Exception {
        Kernel kernel = KernelRegistry.getKernel(getKernelName());
        kernel.shutdown();
    }
View Full Code Here

        String[] credentials = new String[]{user, password};
        environment.put(javax.management.remote.JMXConnector.CREDENTIALS, credentials);
        javax.management.remote.JMXServiceURL address = new javax.management.remote.JMXServiceURL("service:" + uri);
        javax.management.remote.JMXConnector jmxConnector = javax.management.remote.JMXConnectorFactory.connect(address, environment);
        javax.management.MBeanServerConnection mbServerConnection = jmxConnector.getMBeanServerConnection();
        Kernel kernel = new org.apache.geronimo.system.jmx.KernelDelegate(mbServerConnection);
        return new KernelManagementHelper(kernel);
    }
View Full Code Here

        String[] credentials = new String[]{user, password};
        environment.put(javax.management.remote.JMXConnector.CREDENTIALS, credentials);
        javax.management.remote.JMXServiceURL address = new javax.management.remote.JMXServiceURL("service:" + uri);
        javax.management.remote.JMXConnector jmxConnector = javax.management.remote.JMXConnectorFactory.connect(address, environment);
        javax.management.MBeanServerConnection mbServerConnection = jmxConnector.getMBeanServerConnection();
        Kernel kernel = new org.apache.geronimo.system.jmx.KernelDelegate(mbServerConnection);
        return new KernelManagementHelper(kernel);
    }
View Full Code Here

            }
        } catch (Exception e) {
          log.error("Problem getting datasource " + dbName, e);
        }
       
        Kernel kernel = KernelRegistry.getSingleKernel();
        ManagementHelper helper = new KernelManagementHelper(kernel);
        ResourceAdapterModule[] modules = helper.getOutboundRAModules(helper.getDomains()[0].getServerInstances()[0], "javax.sql.DataSource");
        for (ResourceAdapterModule module : modules) {
            org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory[] databases = helper.getOutboundFactories(module, "javax.sql.DataSource");
            for (org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory db : databases) {
View Full Code Here

TOP

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

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.