Package org.jboss.modules

Examples of org.jboss.modules.Module


            return frameworkModule;
        }

        private Module createFrameworkModule(final Bundle systemBundle) {
            // Setup the extended framework module spec
            Module systemModule = injectedSystemModule.getValue();
            ModuleIdentifier systemIdentifier = systemModule.getIdentifier();
            ModuleLoader systemLoader = systemModule.getModuleLoader();
            ModuleSpec.Builder specBuilder = ModuleSpec.build(ModuleIdentifier.create(JBOSGI_PREFIX + ".framework"));
            PathFilter acceptAll = PathFilters.acceptAll();
            specBuilder.addDependency(DependencySpec.createModuleDependencySpec(acceptAll, acceptAll, systemLoader, systemIdentifier, false));

            // Add a dependency on the default framework module
View Full Code Here


    public static StandaloneServer create(final ModuleLoader moduleLoader, final File jbossHomeDir, final Properties systemProps, final Map<String, String> systemEnv) {
        try {
            // Load the server Module and get its ClassLoader
            final ModuleIdentifier serverModuleId = ModuleIdentifier.create("org.jboss.as.server");
            final Module serverModule = moduleLoader.loadModule(serverModuleId);
            final ModuleClassLoader serverModuleClassLoader = serverModule.getClassLoader();

            Class<?> embeddedStandAloneServerFactoryClass = serverModuleClassLoader.loadClass("org.jboss.as.server.EmbeddedStandAloneServerFactory");
            Method createMethod = embeddedStandAloneServerFactoryClass.getMethod("create", File.class, ModuleLoader.class, Properties.class, Map.class);
            final StandaloneServer standaloneServer = (StandaloneServer) createMethod.invoke(null, jbossHomeDir, moduleLoader, systemProps, systemEnv);
            return standaloneServer;
View Full Code Here

        final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
        final IronJacamarXmlDescriptor ironJacamarXmlDescriptor = deploymentUnit
                .getAttachment(IronJacamarXmlDescriptor.ATTACHMENT_KEY);

        final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
        if (module == null)
            throw new DeploymentUnitProcessingException("Failed to get module attachment for " + phaseContext.getDeploymentUnit());

        final ClassLoader classLoader = module.getClassLoader();

        Connector cmd = connectorXmlDescriptor != null ? connectorXmlDescriptor.getConnector() : null;
        final IronJacamar ijmd = ironJacamarXmlDescriptor != null ? ironJacamarXmlDescriptor.getIronJacamar() : null;

        try {
View Full Code Here

            raxmls = ((ResourceAdapters) raService.getValue());
        if (raxmls == null)
            return;

        log.tracef("processing Raxml");
        Module module = deploymentUnit.getAttachment(Attachments.MODULE);

        if (module == null)
            throw new DeploymentUnitProcessingException("Failed to get module attachment for " + deploymentUnit);

        try {
View Full Code Here

    /** {@inheritDoc} */
    @Override
    public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
        final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
        final ServicesAttachment servicesAttachment = deploymentUnit.getAttachment(Attachments.SERVICES);
        if (module != null && servicesAttachment != null) {
            final ModuleClassLoader classLoader = module.getClassLoader();
            final List<String> driverNames = servicesAttachment.getServiceImplementations(Driver.class.getName());
            for (String driverClassName : driverNames) {
                try {
                    final Class<? extends Driver> driverClass = classLoader.loadClass(driverClassName).asSubclass(Driver.class);
                    final Constructor<? extends Driver> constructor = driverClass.getConstructor();
View Full Code Here

    protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
        final String driverName = model.get(DRIVER_NAME).asString();
        final String moduleName = operation.require(DRIVER_MODULE_NAME).asString();

        // Use the module for now.  Would be nice to keep the driver info in the model.
        final Module module;
        try {
            module = Module.getCallerModuleLoader().loadModule(ModuleIdentifier.create(moduleName));
        } catch (ModuleLoadException e) {
            throw new OperationFailedException(e, new ModelNode().set("Failed to load module for driver [" + moduleName + "]"));
        }

        final ServiceLoader<Driver> serviceLoader = module.loadService(Driver.class);
        if (serviceLoader != null) for (Driver driver : serviceLoader) {
            final int majorVersion = driver.getMajorVersion();
            final int minorVersion = driver.getMinorVersion();

            context.removeService(ServiceName.JBOSS.append("jdbc-driver", driver.getClass().getName(), Integer.toString(majorVersion), Integer.toString(minorVersion)));
View Full Code Here

                DRIVER_XA_DATASOURCE_CLASS_NAME).asString() : null;

        final ServiceTarget target = context.getServiceTarget();

        final ModuleIdentifier moduleId;
        final Module module;
        try {
            moduleId = ModuleIdentifier.create(moduleName);
            module = Module.getCallerModuleLoader().loadModule(moduleId);
        } catch (ModuleLoadException e) {
            context.getFailureDescription().set("Failed to load module for driver [" + moduleName + "]");
            return;
        }

        if (driverClassName == null) {
            final ServiceLoader<Driver> serviceLoader = module.loadService(Driver.class);
            if (serviceLoader != null)
                for (Driver driver : serviceLoader) {
                    startDriverServices(target, moduleId, driver, driverName, majorVersion, minorVersion, xaDataSourceClassName);
                }
        } else {
            try {
                final Class<? extends Driver> driverClass = module.getClassLoader().loadClass(driverClassName)
                        .asSubclass(Driver.class);
                final Constructor<? extends Driver> constructor = driverClass.getConstructor();
                final Driver driver = constructor.newInstance();
                startDriverServices(target, moduleId, driver, driverName, majorVersion, minorVersion, xaDataSourceClassName);
            } catch (Exception e) {
View Full Code Here

public class BeanValidationFactoryDeployer implements DeploymentUnitProcessor {
    @Override
    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {

        final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
        final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
        final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
        if(module == null || moduleDescription == null) {
            return;
        }
        final LazyValidatorFactory factory  = new LazyValidatorFactory(module.getClassLoader());
        deploymentUnit.putAttachment(BeanValidationAttachments.VALIDATOR_FACTORY,factory);

        bindFactoryToJndi(factory,deploymentUnit,phaseContext,moduleDescription);

    }
View Full Code Here

        // wsdl location
        if (!isEmpty(annotation.wsdlLocation())) {
            serviceRefUMDM.setWsdlFile(annotation.wsdlLocation());
        }
        // ref class type
        final Module module = unit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
        final Class<?> typeClass = getClass(module.getClassLoader(), type);
        serviceRefUMDM.setServiceRefType(typeClass.getName());
        // ref service interface
        if (!isEmpty(annotation.value())) {
            serviceRefUMDM.setServiceInterface(annotation.value());
        } else if (Service.class.isAssignableFrom(typeClass)) {
View Full Code Here

    private static void processRef(final DeploymentUnit unit, final String type, final WSRefAnnotationWrapper annotation, final ClassInfo classInfo, final InjectionTarget injectionTarget, final String bindingName) throws DeploymentUnitProcessingException {
        boolean isEJB = false;
        final EEModuleDescription moduleDescription = unit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
        final String componentClassName = classInfo.name().toString();
        final Module module = unit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
        for (final ComponentDescription componentDescription : moduleDescription.getComponentsByClassName(componentClassName)) {
            if (componentDescription instanceof SessionBeanComponentDescription) {
                isEJB = true;

                final UnifiedServiceRefMetaData serviceRefUMDM = getServiceRef(unit, componentDescription, bindingName);
                initServiceRef(unit, serviceRefUMDM, type, annotation);
                processWSFeatures(unit, serviceRefUMDM, injectionTarget, classInfo);

                // Create the binding from whence our injection comes.
                final InjectionSource serviceRefSource = new WSRefValueSource(serviceRefUMDM, module.getClassLoader());
                final BindingConfiguration bindingConfiguration = new BindingConfiguration(bindingName, serviceRefSource);
                componentDescription.getBindingConfigurations().add(bindingConfiguration);
                // our injection comes from the local lookup, no matter what.
                final ResourceInjectionConfiguration injectionConfiguration = injectionTarget != null ? new ResourceInjectionConfiguration(injectionTarget, new LookupInjectionSource(bindingName)) : null;
                if (injectionConfiguration != null) {
                    componentDescription.addResourceInjection(injectionConfiguration);
                }
            }
        }
        if (!isEJB) {
            final UnifiedServiceRefMetaData serviceRefUMDM = getServiceRef(unit, null, bindingName);
            initServiceRef(unit, serviceRefUMDM, type, annotation);
            processWSFeatures(unit, serviceRefUMDM, injectionTarget, classInfo);

            // TODO: class hierarchies? shared bindings?
            final EEModuleClassDescription classDescription = moduleDescription.addOrGetLocalClassDescription(classInfo.name().toString());
            // Create the binding from whence our injection comes.
            final InjectionSource serviceRefSource = new WSRefValueSource(serviceRefUMDM, module.getClassLoader());
            final BindingConfiguration bindingConfiguration = new BindingConfiguration(bindingName, serviceRefSource);
            classDescription.getBindingConfigurations().add(bindingConfiguration);
            // our injection comes from the local lookup, no matter what.
            final ResourceInjectionConfiguration injectionConfiguration = injectionTarget != null ?
                new ResourceInjectionConfiguration(injectionTarget, new LookupInjectionSource(bindingName)) : null;
View Full Code Here

TOP

Related Classes of org.jboss.modules.Module

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.