@Override public void inject(final NamingStore value) throws InjectionException { final NamingContext storeBaseContext = new NamingContext(value, null); final ManagedReferenceFactory factory = new ManagedReferenceFactory() { @Override public ManagedReference getReference() { try { return new ImmediateManagedReference(storeBaseContext.lookup(getBindName())); } catch (NamingException e) { if(!optional) { throw NamingLogger.ROOT_LOGGER.resourceLookupForInjectionFailed(getAbsoluteJndiName(), e); } else { NamingLogger.ROOT_LOGGER.tracef(e,"failed to lookup %s", getAbsoluteJndiName()); } } return null; } }; targetInjector.inject(factory); } };
protected Context foundBindContext(ContextNode contextNode) throws NamingException { final NamingContext subContext = new NamingContext(targetName, InMemoryNamingStore.this, new Hashtable<String, Object>()); final String childName = getLastComponent(targetName); final ContextNode subContextNode = new ContextNode(contextNode, childName, targetName, subContext); contextNode.addChild(getLastComponent(targetName), subContextNode); fireEvent(contextNode, targetName, null, subContextNode.binding, NamingEvent.OBJECT_ADDED, "createSubcontext"); return subContext; } }
public Context createSubcontext(final Name name) throws NamingException { requireOwner(); if (isLastComponentEmpty(name)) { throw NamingLogger.ROOT_LOGGER.emptyNameNotAllowed(); } return new NamingContext(name, WritableServiceBasedNamingStore.this, new Hashtable<String, Object>()); }
/** {@inheritDoc} */ public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception { return new NamingContext(name != null ? name : new CompositeName(""), environment); } }
@Override public ManagedReference getReference() { final NamingStore namingStore = namingStoreInjectedValue.getValue(); try { final Name name = NameParser.INSTANCE.parse(this.name); final NamingContext context = new NamingContext(name, namingStore, null); return new ManagedReference() { @Override public void release() { } @Override public Object getInstance() { return context; } }; } catch (NamingException e) { throw new RuntimeException(e); } }
/** * Lookup the object value of a binding node in the tree. * * @param name The entry name * @return The object value of the binding * @throws NamingException */ public Object lookup(final Name name) throws NamingException { if (isEmpty(name)) { final Name emptyName = new CompositeName(""); return new NamingContext(emptyName, this, new Hashtable<String, Object>()); } return root.accept(new LookupVisitor(name)); }
public synchronized void start(StartContext context) throws StartException { try { final Context namingContext = new NamingContext(namingStore.getValue(), new Hashtable<String, Object>()); remoteNamingService = new RemoteNamingService(namingContext); remoteNamingService.start(endpoint.getValue()); } catch (Exception e) { throw new StartException("Failed to start remote naming service", e); } }
@Override public void start(StartContext startContext) throws StartException { final Context namingContext = new NamingContext(namingStore.getValue(), new Hashtable<String, Object>()); HttpRemoteNamingService service = new HttpRemoteNamingService(namingContext); pathHandlerInjectedValue.getValue().addPrefixPath(NAMING, service.createHandler()); }
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(NamingLogger.ROOT_LOGGER.failedToReadContextEntries("java:"))); 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(NamingLogger.ROOT_LOGGER.failedToReadContextEntries("java:jboss"))); 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(NamingLogger.ROOT_LOGGER.failedToReadContextEntries("java:jboss/exported"))); 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(NamingLogger.ROOT_LOGGER.failedToReadContextEntries("java:global")));
results.add(new Binding(contextName, new NamingContext(((Name) name.clone()).add(contextName), this, null)));
final NamingStore moduleStore = NamingStore.class.cast(moduleContextController.getValue()); try { context.addEntries(moduleNode.get("java:module"), new NamingContext(moduleStore, null)); } catch (NamingException e) { throw new OperationFailedException(e, new ModelNode().set(EeLogger.ROOT_LOGGER.failedToRead("java:module", appName, moduleName))); final NamingStore compStore = NamingStore.class.cast(compContextController.getValue()); try { context.addEntries(componentNode.get("java:comp"), new NamingContext(compStore, null)); } catch (NamingException e) { throw new OperationFailedException(e, new ModelNode().set(EeLogger.ROOT_LOGGER.failedToRead("java:comp", appName, moduleName, componentName)));
public Object lookup(final Name name, boolean dereference) throws NamingException { if (name.isEmpty()) { return new NamingContext(EMPTY_NAME, this, null); return new NamingContext((Name) name.clone(), this, null);
public final T visit(final ContextNode contextNode) throws NamingException { if (isEmpty(currentName)) { return found(contextNode); } final String childName = currentName.get(0); traversedName.add(childName); currentName = currentName.getSuffix(1); final TreeNode node = contextNode.children.get(childName); if (node == null) { if (createIfMissing) { final NamingContext subContext = new NamingContext((Name)traversedName.clone(), InMemoryNamingStore.this, new Hashtable<String, Object>()); return contextNode.addOrGetChild(childName, new ContextNode(contextNode, childName, (Name)traversedName.clone(), subContext)).accept(this); } else { throw nameNotFoundException(childName, contextNode.fullName); } } return node.accept(this); }
final NamingStore appStore = NamingStore.class.cast(appContextController.getValue()); try { context.addEntries(deploymentNode.get("java:app"), new NamingContext(appStore, null)); } catch (NamingException e) { throw new OperationFailedException(e, new ModelNode().set(EeLogger.ROOT_LOGGER.failedToRead("java:app", appName)));
return new NamingContext(prefix, namingStore, environment);
/** {@inheritDoc} */ public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception { return new NamingContext(name != null ? name : new CompositeName(""), environment); } }
protected Context foundBindContext(ContextNode contextNode) throws NamingException { final NamingContext subContext = new NamingContext(targetName, InMemoryNamingStore.this, new Hashtable<String, Object>()); final String childName = getLastComponent(targetName); final ContextNode subContextNode = new ContextNode(contextNode, childName, targetName, subContext); contextNode.addChild(getLastComponent(targetName), subContextNode); fireEvent(contextNode, targetName, null, subContextNode.binding, NamingEvent.OBJECT_ADDED, "createSubcontext"); return subContext; } }
protected Context foundBindContext(ContextNode contextNode) throws NamingException { final NamingContext subContext = new NamingContext(targetName, InMemoryNamingStore.this, new Hashtable<String, Object>()); final String childName = getLastComponent(targetName); final ContextNode subContextNode = new ContextNode(contextNode, childName, targetName, subContext); contextNode.addChild(getLastComponent(targetName), subContextNode); fireEvent(contextNode, targetName, null, subContextNode.binding, NamingEvent.OBJECT_ADDED, "createSubcontext"); return subContext; } }
public Context createSubcontext(final Name name) throws NamingException { requireOwner(); if (isLastComponentEmpty(name)) { throw NamingLogger.ROOT_LOGGER.emptyNameNotAllowed(); } return new NamingContext(name, WritableServiceBasedNamingStore.this, new Hashtable<String, Object>()); }
public synchronized void start(StartContext context) throws StartException { try { final Context namingContext = new NamingContext(namingStore.getValue(), new Hashtable<String, Object>()); remoteNamingService = new RemoteNamingService(namingContext); remoteNamingService.start(endpoint.getValue()); } catch (Exception e) { throw new StartException("Failed to start remote naming service", e); } }