/** {@inheritDoc} */ public void destroySubcontext(final Name name) throws NamingException { check(name, JndiPermission.ACTION_DESTROY_SUBCONTEXT); if(!(namingStore instanceof WritableNamingStore)) { throw NamingLogger.ROOT_LOGGER.readOnlyNamingContext(); } }
/** {@inheritDoc} */ public void addNamingListener(final Name target, final int scope, final NamingListener listener) throws NamingException { check(target, JndiPermission.ACTION_ADD_NAMING_LISTENER); namingStore.addNamingListener(target, scope, listener); }
/** {@inheritDoc} */ public void rename(final Name oldName, final Name newName) throws NamingException { //check for appropriate permissions first so that no other info leaks from this context //in case of insufficient perms (like the fact if it is readonly or not) check(oldName, JndiPermission.ACTION_LOOKUP | JndiPermission.ACTION_UNBIND); check(newName, JndiPermission.ACTION_BIND); if (namingStore instanceof WritableNamingStore) { bind(newName, lookup(oldName)); unbind(oldName); } else { throw NamingLogger.ROOT_LOGGER.readOnlyNamingContext(); } }
/** {@inheritDoc} */ public void unbind(final Name name) throws NamingException { check(name, JndiPermission.ACTION_UNBIND); if(namingStore instanceof WritableNamingStore) { final Name absoluteName = getAbsoluteName(name); getWritableNamingStore().unbind(absoluteName); } else { throw NamingLogger.ROOT_LOGGER.readOnlyNamingContext(); } }
/** {@inheritDoc} */ public Context createSubcontext(Name name) throws NamingException { check(name, JndiPermission.ACTION_CREATE_SUBCONTEXT); if(namingStore instanceof WritableNamingStore) { final Name absoluteName = getAbsoluteName(name); return getWritableNamingStore().createSubcontext(absoluteName); } else { throw NamingLogger.ROOT_LOGGER.readOnlyNamingContext(); } }
/** {@inheritDoc} */ public void rebind(final Name name, Object object) throws NamingException { check(name, JndiPermission.ACTION_REBIND); if(namingStore instanceof WritableNamingStore) { final Name absoluteName = getAbsoluteName(name); if (object instanceof Referenceable) { object = ((Referenceable) object).getReference(); } getWritableNamingStore().rebind(absoluteName, object); } else { throw NamingLogger.ROOT_LOGGER.readOnlyNamingContext(); } }
check(name, JndiPermission.ACTION_BIND);
/** {@inheritDoc} */ public Object lookupLink(Name name) throws NamingException { check(name, JndiPermission.ACTION_LOOKUP); if (name.isEmpty()) { return lookup(name); } try { final Name absoluteName = getAbsoluteName(name); Object link = namingStore.lookup(absoluteName); if (!(link instanceof LinkRef) && link instanceof Reference) { link = getObjectInstance(link, name, null); } return link; } catch (Exception e) { throw namingException(NamingLogger.ROOT_LOGGER.cannotLookupLink(), e, name); } }
/** {@inheritDoc} */ public NamingEnumeration<NameClassPair> list(final Name name) throws NamingException { check(name, JndiPermission.ACTION_LIST); try { return namingEnumeration(namingStore.list(getAbsoluteName(name))); } catch(CannotProceedException cpe) { final Context continuationContext = NamingManager.getContinuationContext(cpe); return continuationContext.list(cpe.getRemainingName()); } catch (RequireResolveException r) { final Object o = lookup(r.getResolve()); if (o instanceof Context) { return ((Context)o).list(name.getSuffix(r.getResolve().size())); } throw notAContextException(r.getResolve()); } }
/** {@inheritDoc} */ public NamingEnumeration<Binding> listBindings(final Name name) throws NamingException { check(name, JndiPermission.ACTION_LIST_BINDINGS); try { return namingEnumeration(namingStore.listBindings(getAbsoluteName(name))); } catch(CannotProceedException cpe) { final Context continuationContext = NamingManager.getContinuationContext(cpe); return continuationContext.listBindings(cpe.getRemainingName()); } catch (RequireResolveException r) { final Object o = lookup(r.getResolve()); if (o instanceof Context) { return ((Context)o).listBindings(name.getSuffix(r.getResolve().size())); } throw notAContextException(r.getResolve()); } }
public Object lookup(final Name name, boolean dereference) throws NamingException { check(name, JndiPermission.ACTION_LOOKUP);
/** {@inheritDoc} */ public void addNamingListener(final Name target, final int scope, final NamingListener listener) throws NamingException { check(target, JndiPermission.ACTION_ADD_NAMING_LISTENER); namingStore.addNamingListener(target, scope, listener); }
/** {@inheritDoc} */ public void destroySubcontext(final Name name) throws NamingException { check(name, JndiPermission.ACTION_DESTROY_SUBCONTEXT); if(!(namingStore instanceof WritableNamingStore)) { throw NamingLogger.ROOT_LOGGER.readOnlyNamingContext(); } }
/** {@inheritDoc} */ public void addNamingListener(final Name target, final int scope, final NamingListener listener) throws NamingException { check(target, Action.ADD_NAMING_LISTENER); namingStore.addNamingListener(target, scope, listener); }
/** {@inheritDoc} */ public void addNamingListener(final Name target, final int scope, final NamingListener listener) throws NamingException { check(target, JndiPermission.ACTION_ADD_NAMING_LISTENER); namingStore.addNamingListener(target, scope, listener); }
/** {@inheritDoc} */ public Context createSubcontext(Name name) throws NamingException { check(name, Action.CREATE_SUBCONTEXT); if(namingStore instanceof WritableNamingStore) { final Name absoluteName = getAbsoluteName(name); return getWritableNamingStore().createSubcontext(absoluteName); } else { throw MESSAGES.readOnlyNamingContext(); } }
/** {@inheritDoc} */ public Context createSubcontext(Name name) throws NamingException { check(name, JndiPermission.ACTION_CREATE_SUBCONTEXT); if(namingStore instanceof WritableNamingStore) { final Name absoluteName = getAbsoluteName(name); return getWritableNamingStore().createSubcontext(absoluteName); } else { throw NamingLogger.ROOT_LOGGER.readOnlyNamingContext(); } }
/** {@inheritDoc} */ public void unbind(final Name name) throws NamingException { check(name, Action.UNBIND); if(namingStore instanceof WritableNamingStore) { final Name absoluteName = getAbsoluteName(name); getWritableNamingStore().unbind(absoluteName); } else { throw MESSAGES.readOnlyNamingContext(); } }
/** {@inheritDoc} */ public void unbind(final Name name) throws NamingException { check(name, JndiPermission.ACTION_UNBIND); if(namingStore instanceof WritableNamingStore) { final Name absoluteName = getAbsoluteName(name); getWritableNamingStore().unbind(absoluteName); } else { throw NamingLogger.ROOT_LOGGER.readOnlyNamingContext(); } }
/** {@inheritDoc} */ public Context createSubcontext(Name name) throws NamingException { check(name, JndiPermission.ACTION_CREATE_SUBCONTEXT); if(namingStore instanceof WritableNamingStore) { final Name absoluteName = getAbsoluteName(name); return getWritableNamingStore().createSubcontext(absoluteName); } else { throw NamingLogger.ROOT_LOGGER.readOnlyNamingContext(); } }