protected File file(String arg0) { return super.file(arg0); } }
@Override protected File file(String arg0) { File file = super.file(arg0); if (file == null) { for (FileDirContextAdapter virtualContext : virtualContexts) { file = virtualContext.file(arg0); if (file != null) { return file; } } } return file; }
/** * Binds a new name to the object bound to an old name, and unbinds the * old name. Both names are relative to this context. Any attributes * associated with the old name become associated with the new name. * Intermediate contexts of the old name are not changed. * * @param oldName the name of the existing binding; may not be empty * @param newName the name of the new binding; may not be empty * @exception NameAlreadyBoundException if newName is already bound * @exception NamingException if a naming exception is encountered */ public void rename(String oldName, String newName) throws NamingException { File file = file(oldName); if (file == null) throw new NamingException (MESSAGES.resourceNotFound(oldName)); File newFile = new File(base, newName); file.renameTo(newFile); }
/** * Retrieves selected attributes associated with a named object. * See the class description regarding attribute models, attribute type * names, and operational attributes. * * @return the requested attributes; never null * @param name the name of the object from which to retrieve attributes * @param attrIds the identifiers of the attributes to retrieve. null * indicates that all attributes should be retrieved; an empty array * indicates that none should be retrieved * @exception NamingException if a naming exception is encountered */ @Override protected Attributes doGetAttributes(String name, String[] attrIds) throws NamingException { // Building attribute list File file = file(name); if (file == null) return null; return new FileResourceAttributes(file); }
/** * Retrieves selected attributes associated with a named object. * See the class description regarding attribute models, attribute type * names, and operational attributes. * * @return the requested attributes; never null * @param name the name of the object from which to retrieve attributes * @param attrIds the identifiers of the attributes to retrieve. null * indicates that all attributes should be retrieved; an empty array * indicates that none should be retrieved * @exception NamingException if a naming exception is encountered */ @Override protected Attributes doGetAttributes(String name, String[] attrIds) throws NamingException { // Building attribute list File file = file(name); if (file == null) return null; return new FileResourceAttributes(file); }
/** * Enumerates the names bound in the named context, along with the * objects bound to them. The contents of any subcontexts are not * included. * <p> * If a binding is added to or removed from this context, its effect on * an enumeration previously returned is undefined. * * @param name the name of the context to list * @return an enumeration of the bindings in this context. * Each element of the enumeration is of type Binding. * @exception NamingException if a naming exception is encountered */ @Override protected List<NamingEntry> doListBindings(String name) throws NamingException { File file = file(name); if (file == null) return null; return list(file); }
/** * Binds a new name to the object bound to an old name, and unbinds the * old name. Both names are relative to this context. Any attributes * associated with the old name become associated with the new name. * Intermediate contexts of the old name are not changed. * * @param oldName the name of the existing binding; may not be empty * @param newName the name of the new binding; may not be empty * @exception NameAlreadyBoundException if newName is already bound * @exception NamingException if a naming exception is encountered */ public void rename(String oldName, String newName) throws NamingException { File file = file(oldName); if (file == null) throw new NamingException (sm.getString("resources.notFound", oldName)); File newFile = new File(base, newName); file.renameTo(newFile); }
/** * Enumerates the names bound in the named context, along with the * objects bound to them. The contents of any subcontexts are not * included. * <p> * If a binding is added to or removed from this context, its effect on * an enumeration previously returned is undefined. * * @param name the name of the context to list * @return an enumeration of the bindings in this context. * Each element of the enumeration is of type Binding. * @exception NamingException if a naming exception is encountered */ @Override protected List<NamingEntry> doListBindings(String name) throws NamingException { File file = file(name); if (file == null) return null; return list(file); }
/** * Retrieves selected attributes associated with a named object. * See the class description regarding attribute models, attribute type * names, and operational attributes. * * @return the requested attributes; never null * @param name the name of the object from which to retrieve attributes * @param attrIds the identifiers of the attributes to retrieve. null * indicates that all attributes should be retrieved; an empty array * indicates that none should be retrieved * @exception NamingException if a naming exception is encountered */ @Override protected Attributes doGetAttributes(String name, String[] attrIds) throws NamingException { // Building attribute list File file = file(name); if (file == null) return null; return new FileResourceAttributes(file); }
/** * Unbinds the named object. Removes the terminal atomic name in name * from the target context--that named by all but the terminal atomic * part of name. * <p> * This method is idempotent. It succeeds even if the terminal atomic * name is not bound in the target context, but throws * NameNotFoundException if any of the intermediate contexts do not exist. * * @param name the name to bind; may not be empty * @exception NameNotFoundException if an intermediate context does not * exist * @exception NamingException if a naming exception is encountered */ public void unbind(String name) throws NamingException { File file = file(name); if (file == null) throw new NamingException (MESSAGES.resourceNotFound(name)); if (!file.delete()) throw new NamingException (MESSAGES.resourceUnbindFailed(name)); }
/** * Binds a new name to the object bound to an old name, and unbinds the * old name. Both names are relative to this context. Any attributes * associated with the old name become associated with the new name. * Intermediate contexts of the old name are not changed. * * @param oldName the name of the existing binding; may not be empty * @param newName the name of the new binding; may not be empty * @exception NameAlreadyBoundException if newName is already bound * @exception NamingException if a naming exception is encountered */ @Override public void rename(String oldName, String newName) throws NamingException { File file = file(oldName); if (file == null) throw new NameNotFoundException (sm.getString("resources.notFound", oldName)); File newFile = new File(base, newName); file.renameTo(newFile); }
/** * Retrieves selected attributes associated with a named object. * See the class description regarding attribute models, attribute type * names, and operational attributes. * * @return the requested attributes; never null * @param name the name of the object from which to retrieve attributes * @param attrIds the identifiers of the attributes to retrieve. null * indicates that all attributes should be retrieved; an empty array * indicates that none should be retrieved * @exception NamingException if a naming exception is encountered */ public Attributes getAttributes(String name, String[] attrIds) throws NamingException { // Building attribute list File file = file(name); if (file == null) throw new NamingException (MESSAGES.resourceNotFound(name)); return new FileResourceAttributes(file); }
/** * Binds a new name to the object bound to an old name, and unbinds the * old name. Both names are relative to this context. Any attributes * associated with the old name become associated with the new name. * Intermediate contexts of the old name are not changed. * * @param oldName the name of the existing binding; may not be empty * @param newName the name of the new binding; may not be empty * @exception NameAlreadyBoundException if newName is already bound * @exception NamingException if a naming exception is encountered */ @Override public void rename(String oldName, String newName) throws NamingException { File file = file(oldName); if (file == null) throw new NameNotFoundException (sm.getString("resources.notFound", oldName)); File newFile = new File(base, newName); file.renameTo(newFile); }
/** * Retrieves selected attributes associated with a named object. * See the class description regarding attribute models, attribute type * names, and operational attributes. * * @return the requested attributes; never null * @param name the name of the object from which to retrieve attributes * @param attrIds the identifiers of the attributes to retrieve. null * indicates that all attributes should be retrieved; an empty array * indicates that none should be retrieved * @exception NamingException if a naming exception is encountered */ public Attributes getAttributes(String name, String[] attrIds) throws NamingException { // Building attribute list File file = file(name); if (file == null) throw new NamingException (sm.getString("resources.notFound", name)); return new FileResourceAttributes(file); }
/** * Enumerates the names bound in the named context, along with the * objects bound to them. The contents of any subcontexts are not * included. * <p> * If a binding is added to or removed from this context, its effect on * an enumeration previously returned is undefined. * * @param name the name of the context to list * @return an enumeration of the bindings in this context. * Each element of the enumeration is of type Binding. * @exception NamingException if a naming exception is encountered */ @Override protected NamingEnumeration<Binding> doListBindings(String name) throws NamingException { File file = file(name); if (file == null) return null; return new NamingContextBindingsEnumeration(list(file).iterator(), this); }
/** * Enumerates the names bound in the named context, along with the class * names of objects bound to them. The contents of any subcontexts are * not included. * <p> * If a binding is added to or removed from this context, its effect on * an enumeration previously returned is undefined. * * @param name the name of the context to list * @return an enumeration of the names and class names of the bindings in * this context. Each element of the enumeration is of type NameClassPair. * @exception NamingException if a naming exception is encountered */ public NamingEnumeration list(String name) throws NamingException { File file = file(name); if (file == null) throw new NamingException (sm.getString("resources.notFound", name)); return new NamingContextEnumeration(list(file).iterator()); }
/** * Enumerates the names bound in the named context, along with the class * names of objects bound to them. The contents of any subcontexts are * not included. * <p> * If a binding is added to or removed from this context, its effect on * an enumeration previously returned is undefined. * * @param name the name of the context to list * @return an enumeration of the names and class names of the bindings in * this context. Each element of the enumeration is of type NameClassPair. * @exception NamingException if a naming exception is encountered */ public NamingEnumeration list(String name) throws NamingException { File file = file(name); if (file == null) throw new NamingException (MESSAGES.resourceNotFound(name)); return new NamingContextEnumeration(list(file).iterator()); }
/** * Unbinds the named object. Removes the terminal atomic name in name * from the target context--that named by all but the terminal atomic * part of name. * <p> * This method is idempotent. It succeeds even if the terminal atomic * name is not bound in the target context, but throws * NameNotFoundException if any of the intermediate contexts do not exist. * * @param name the name to bind; may not be empty * @exception NameNotFoundException if an intermediate context does not * exist * @exception NamingException if a naming exception is encountered */ @Override public void unbind(String name) throws NamingException { File file = file(name); if (file == null) throw new NameNotFoundException( sm.getString("resources.notFound", name)); if (!file.delete()) throw new NamingException (sm.getString("resources.unbindFailed", name)); }
/** * Retrieves the named object. * * @param name the name of the object to look up * @return the object bound to name */ @Override protected Object doLookup(String name) { Object result = null; File file = file(name); if (file == null) return null; if (file.isDirectory()) { FileDirContext tempContext = new FileDirContext(env); tempContext.setDocBase(file.getPath()); tempContext.setAllowLinking(getAllowLinking()); result = tempContext; } else { result = new FileResource(file); } return result; }
/** * Enumerates the names bound in the named context, along with the class * names of objects bound to them. The contents of any subcontexts are * not included. * <p> * If a binding is added to or removed from this context, its effect on * an enumeration previously returned is undefined. * * @param name the name of the context to list * @return an enumeration of the names and class names of the bindings in * this context. Each element of the enumeration is of type NameClassPair. * @exception NamingException if a naming exception is encountered */ @Override public NamingEnumeration<NameClassPair> list(String name) throws NamingException { File file = file(name); if (file == null) throw new NameNotFoundException (sm.getString("resources.notFound", name)); return new NamingContextEnumeration(list(file).iterator()); }