Package org.jboss.modules

Examples of org.jboss.modules.ModuleClassLoader.loadClass()


                    Class<?> bootstrapFactoryClass = serverModuleClassLoader.loadClass(Bootstrap.Factory.class.getName());
                    Method newInstanceMethod = bootstrapFactoryClass.getMethod("newInstance");
                    Object bootstrap = newInstanceMethod.invoke(null);

                    Class<?> configurationClass = serverModuleClassLoader.loadClass(Bootstrap.Configuration.class.getName());
                    Constructor<?> configurationCtor = configurationClass.getConstructor();
                    Object configuration = configurationCtor.newInstance();

                    Method setServerEnvironmentMethod = configurationClass.getMethod("setServerEnvironment", serverEnvironment.getClass());
                    setServerEnvironmentMethod.invoke(configuration, serverEnvironment);
View Full Code Here


                    setServerEnvironmentMethod.invoke(configuration, serverEnvironment);

                    Method setModuleLoaderMethod = configurationClass.getMethod("setModuleLoader", ModuleLoader.class);
                    setModuleLoaderMethod.invoke(configuration, moduleLoader);

                    Class<?> bootstrapClass = serverModuleClassLoader.loadClass(Bootstrap.class.getName());
                    Method bootstrapStartMethod = bootstrapClass.getMethod("startup", configurationClass, List.class);
                    Object future = bootstrapStartMethod.invoke(bootstrap, configuration, Collections.<ServiceActivator>emptyList());

                    Class<?> asyncFutureClass = serverModuleClassLoader.loadClass(AsyncFuture.class.getName());
                    Method getMethod = asyncFutureClass.getMethod("get");
View Full Code Here

                    Class<?> bootstrapClass = serverModuleClassLoader.loadClass(Bootstrap.class.getName());
                    Method bootstrapStartMethod = bootstrapClass.getMethod("startup", configurationClass, List.class);
                    Object future = bootstrapStartMethod.invoke(bootstrap, configuration, Collections.<ServiceActivator>emptyList());

                    Class<?> asyncFutureClass = serverModuleClassLoader.loadClass(AsyncFuture.class.getName());
                    Method getMethod = asyncFutureClass.getMethod("get");
                    serviceContainer = getMethod.invoke(future);

                } catch (RuntimeException rte) {
                    throw rte;
View Full Code Here

            @Override
            public void stop() {
                if (serviceContainer != null) {
                    try {
                        Class<?> serverContainerClass = serverModuleClassLoader.loadClass(ServiceContainer.class.getName());
                        Method shutdownMethod = serverContainerClass.getMethod("shutdown");
                        shutdownMethod.invoke(serviceContainer);

                        Method awaitTerminationMethod = serverContainerClass.getMethod("awaitTermination");
                        awaitTerminationMethod.invoke(serviceContainer);
View Full Code Here

            ModuleLoader moduleLoader = Module.getBootModuleLoader();

            // Sanity check that the SYSTEM module ClassLoader cannot see this class
            try {
                ModuleClassLoader classLoader = moduleLoader.loadModule(ModuleIdentifier.SYSTEM).getClassLoader();
                classLoader.loadClass(InitialModuleLoaderFactory.class.getName());
                throw new IllegalStateException("Cannot initialize module system. There was probably a previous usage.");
            } catch (ModuleLoadException e) {
                // ignore
            } catch (ClassNotFoundException ex) {
                // expected
View Full Code Here

        Class<T> serviceClass = getServiceClass();
        List<String> services = servicesAttachment.getServiceImplementations(serviceClass.getName());
        ModuleClassLoader classLoader = module.getClassLoader();
        for (String serviceName : services) {
            try {
                Class<? extends T> clazz = classLoader.loadClass(serviceName).asSubclass(serviceClass);
                Constructor<? extends T> ctor = clazz.getConstructor();
                T instance = ctor.newInstance();
                installService(ctx, serviceName, instance);
            } catch (Exception e) {
                ROOT_LOGGER.cannotInstantiateClass(serviceName, e);
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.