Package org.jboss.as.naming

Examples of org.jboss.as.naming.NamingStore


                    final ServiceRegistry serviceRegistry = context.getServiceRegistry(false);

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

                    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("Failed to read java:jboss context entries."));
                    }

                    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("Failed to read java:global context entries."));
                    }
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 {
            ServiceController<?> controller = context.getController();
            this.controller = controller;
            final Reference reference = ManagedReferenceObjectFactory.createReference(controller.getName());
            final Name name = NameParser.INSTANCE.parse(this.name);
            namingStore.bind(name, reference);
            logger.tracef("Bound resource %s into naming store %s", name, namingStore);
        } 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

        this.name = name;
    }

    public synchronized void start(StartContext startContext) throws StartException {
        final Reference appReference = NamespaceObjectFactory.createReference(name);
        final NamingStore javaContext = this.javaContext.getValue();
        try {
            javaContext.rebind(NameParser.INSTANCE.parse(name), appReference, Reference.class);
        } catch (NamingException e) {
            throw new StartException("Failed to bind EE context: java:" + name, e);
        }
    }
View Full Code Here

            throw new StartException("Failed to bind EE context: java:" + name, e);
        }
    }

    public synchronized void stop(StopContext stopContext) {
        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);
        }
    }
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

                .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 {
                    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

    private volatile SimpleEENamespaceContextSelector selector;

    @Override
    public void start(StartContext context) throws StartException {
        NamingStore app = this.app.getOptionalValue();
        NamingStore module = this.module.getOptionalValue();
        NamingStore comp = this.comp.getOptionalValue();
        try {
            selector = new SimpleEENamespaceContextSelector(
                    app != null ? (Context) app.lookup(new CompositeName()) : null,
                    module != null ? (Context) module.lookup(new CompositeName()) : null,
                    comp != null ? (Context) module.lookup(new CompositeName()) : null);
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.