Package org.jboss.as.naming

Examples of org.jboss.as.naming.NamingStore


        }
    }

    @Override
    public void startSystemServices(StartContext startContext, BundleContext systemContext) {
        NamingStore namingStore = injectedNamingStore.getOptionalValue();
        if (namingStore != null) {
            // Register the {@link InitialContextFactoryBuilder} service
            String[] classes = new String[] {javax.naming.spi.InitialContextFactoryBuilder.class.getName(), InitialContextFactoryBuilder.class.getName()};
            systemContext.registerService(classes, new InitialContextFactoryBuilder(), null);
View Full Code Here


            return null;
        }
    }

    public Context getContext(final String identifier) {
        NamingStore namingStore = getNamingStore(identifier);
        if (namingStore != null) {
            try {
                return (Context) namingStore.lookup(EMPTY_NAME);
            } catch (NamingException e) {
                throw new IllegalStateException(e);
            }
        } else {
            return null;
View Full Code Here

        log.info("Activating Naming Subsystem");

        NamingContext.initializeNamingManager();

        final NamingStore namingStore = new InMemoryNamingStore(new NamingEventCoordinator());

        // Create the Naming Service
        final ServiceTarget target = context.getServiceTarget();
        newControllers.add(target.addService(NamingService.SERVICE_NAME, new NamingService(namingStore))
                .addAliases(ContextNames.JAVA_CONTEXT_SERVICE_NAME)
View Full Code Here

                    ObjectFactoryBuilder.INSTANCE.setServiceRegistry(context.getServiceRegistry());

                    NamingContext.initializeNamingManager();

                    final NamingStore namingStore = new InMemoryNamingStore(new NamingEventCoordinator());

                    // Create the Naming Service
                    final ServiceTarget target = context.getServiceTarget();
                        target.addService(NamingService.SERVICE_NAME, new NamingService(namingStore))
                            .addAliases(ContextNames.JAVA_CONTEXT_SERVICE_NAME)
View Full Code Here

                    final ServiceRegistry serviceRegistry = context.getServiceRegistry(false);

                    final ModelNode contextsNode = resultNode.get("java: contexts");

                    final ServiceController<?> javaContextService = serviceRegistry.getService(ContextNames.JAVA_CONTEXT_SERVICE_NAME);
                    final NamingStore javaContextNamingStore = NamingStore.class.cast(javaContextService.getValue());
                    try {
                        addEntries(contextsNode.get("java:"), new NamingContext(javaContextNamingStore, null));
                    } catch (NamingException e) {
                        throw new OperationFailedException(e, new ModelNode().set(MESSAGES.failedToReadContextEntries("java:")));
                    }

                    final ServiceController<?> jbossContextService = serviceRegistry.getService(ContextNames.JBOSS_CONTEXT_SERVICE_NAME);
                    final NamingStore jbossContextNamingStore = NamingStore.class.cast(jbossContextService.getValue());
                    try {
                        addEntries(contextsNode.get("java:jboss"), new NamingContext(jbossContextNamingStore, null));
                    } catch (NamingException e) {
                        throw new OperationFailedException(e, new ModelNode().set(MESSAGES.failedToReadContextEntries("java:jboss")));
                    }

                    final ServiceController<?> exportedContextService = serviceRegistry.getService(ContextNames.EXPORTED_CONTEXT_SERVICE_NAME);
                    final NamingStore exportedContextNamingStore = NamingStore.class.cast(exportedContextService.getValue());
                    try {
                        addEntries(contextsNode.get("java:jboss/exported"), new NamingContext(exportedContextNamingStore, null));
                    } catch (NamingException e) {
                        throw new OperationFailedException(e, new ModelNode().set(MESSAGES.failedToReadContextEntries("java:jboss/exported")));
                    }

                    final ServiceController<?> globalContextService = serviceRegistry.getService(ContextNames.GLOBAL_CONTEXT_SERVICE_NAME);
                    final NamingStore globalContextNamingStore = NamingStore.class.cast(globalContextService.getValue());
                    try {
                        addEntries(contextsNode.get("java:global"), new NamingContext(globalContextNamingStore, null));
                    } catch (NamingException e) {
                        throw new OperationFailedException(e, new ModelNode().set(MESSAGES.failedToReadContextEntries("java:global")));
                    }
View Full Code Here

                .addListener(verificationHandler)
                .install());

        NamespaceContextSelector.setDefault(new NamespaceContextSelector() {
            public Context getContext(String identifier) {
                final NamingStore namingStore;
                if (identifier.equals("global")) {
                    namingStore = globalNamingStore;
                } else if (identifier.equals("jboss")) {
                    namingStore = jbossNamingStore;
                } else if (identifier.equals("jboss/exported")) {
                    namingStore = remoteExposedNamingStore;
                } else {
                    namingStore = null;
                }
                if (namingStore != null) {
                    try {
                        return (Context) namingStore.lookup(EMPTY_NAME);
                    } catch (NamingException e) {
                        throw new IllegalStateException(e);
                    }
                } else {
                    return null;
View Full Code Here

     *
     * @param context The start context
     * @throws StartException If the entity can not be bound
     */
    public synchronized void start(StartContext context) throws StartException {
        final NamingStore namingStore = namingStoreValue.getValue();
        try {
            final Reference reference = ManagedReferenceObjectFactory.createReference(context.getController().getName());
            final Name name = NameParser.INSTANCE.parse(this.name);
            namingStore.bind(name, reference);
        } catch (NamingException e) {
            throw new StartException("Failed to bind resource into naming store [" + namingStore + "] at location [" + name + "]", e);
        }
    }
View Full Code Here

     * Unbind the entry from the injected context.
     *
     * @param context The stop context
     */
    public synchronized void stop(StopContext context) {
        final NamingStore namingStore = namingStoreValue.getValue();
        try {
            namingStore.unbind(NameParser.INSTANCE.parse(name));
        } catch (NamingException e) {
            throw new IllegalStateException("Failed to unbind resource from naming store [" + namingStore + "] at location [" + name + "]", e);
        }
    }
View Full Code Here

    public synchronized void start(final StartContext context) throws StartException {
        store = new InMemoryNamingStore();

        try {
            final Reference globalReference = GlobalNamespaceObjectFactory.createReference(name, (Context) store.lookup(new CompositeName()));
            final NamingStore javaContext =  this.javaContext.getValue();
            javaContext.rebind(NameParser.INSTANCE.parse(name), globalReference, Reference.class);
        } catch (NamingException e) {
            throw new StartException("Failed to bind EE context: java:" + name, e);
        }
    }
View Full Code Here

     * Unbinds the context from the parent.
     *
     * @param context The stop context
     */
    public synchronized void stop(StopContext context) {
        final NamingStore javaContext = this.javaContext.getValue();
        try {
            javaContext.unbind(NameParser.INSTANCE.parse(name));
        } catch (NamingException e) {
            throw new IllegalStateException("Failed to unbind EE context: java:" + name, e);
        } finally {
            try {
                store.close();
View Full Code Here

TOP

Related Classes of org.jboss.as.naming.NamingStore

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.