@Override public Long[] getResourceAttributes(String name, Context context) { Long[] result = new Long[2]; try { ResourceAttributes resource = (ResourceAttributes) context.getResources().getAttributes(name); result[0] = resource.getContentLength(); result[1] = resource.getLastModified(); } catch (NamingException ex) { logger.trace("", ex); } return result; }
@Override public InputStream getResourceStream(String name, Context context) throws IOException { try { return ((Resource) context.getResources().lookup(name)).streamContent(); } catch (NamingException ex) { logger.trace("", ex); throw new RuntimeException(ex); } }
/** * Retrieves all of the attributes associated with a named object. * * @return the set of attributes associated with name. * Returns an empty attribute set if name has no attributes; never null. * @param name the name of the object from which to retrieve attributes * @exception NamingException if a naming exception is encountered */ public Attributes getAttributes(Name name) throws NamingException { return dirContext.getAttributes(composeName(name, pathName)); }
/** * Opens a connection to the object referenced by the <code>URL</code> * argument. */ @Override protected URLConnection openConnection(URL u) throws IOException { DirContext currentContext = this.context; if (currentContext == null) currentContext = get(); return new DirContextURLConnection(currentContext, u); }
/** * Get creation date. * * @return Creation date value */ @Override public Date getCreationDate() { if (creation == -1L) { creation = getCreation(); } return super.getCreationDate(); }
/** * Retrieves the named object. * * @param name the name of the object to look up * @return the object bound to name * @exception NamingException if a naming exception is encountered */ public Object lookup(String name) throws NamingException { return dirContext.lookup(composeName(name, path)); }
/** * Get lastModified date. * * @return LastModified date value */ @Override public Date getLastModifiedDate() { if (lastModified == -1L) { lastModified = getLastModified(); } return super.getLastModifiedDate(); }
/** * Unbinds the named object. * * @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 { dirContext.unbind(composeName(name, path)); }
/** * Retrieves the schema associated with the named object. * * @param name the name of the object whose schema is to be retrieved * @return the schema associated with the context; never null * @exception OperationNotSupportedException if schema not supported * @exception NamingException if a naming exception is encountered */ public DirContext getSchema(String name) throws NamingException { return dirContext.getSchema(composeName(name, path)); }
/** * Retrieves the parser associated with the named context. * * @param name the name of the context from which to get the parser * @return a name parser that can parse compound names into their atomic * components * @exception NamingException if a naming exception is encountered */ public NameParser getNameParser(String name) throws NamingException { return dirContext.getNameParser(composeName(name, path)); }
/** * Opens a connection to the object referenced by the <code>URL</code> * argument. */ @Override protected URLConnection openConnection(URL u) throws IOException { DirContext currentContext = this.context; if (currentContext == null) currentContext = get(); return new DirContextURLConnection(currentContext, u); }
/** * Get creation date. * * @return Creation date value */ @Override public Date getCreationDate() { if (creation == -1L) { creation = getCreation(); } return super.getCreationDate(); }
/** * Retrieves the named object. * * @param name the name of the object to look up * @return the object bound to name * @exception NamingException if a naming exception is encountered */ public Object lookup(String name) throws NamingException { return dirContext.lookup(composeName(name, path)); }
/** * Retrieves all of the attributes associated with a named object. * * @return the set of attributes associated with name. * Returns an empty attribute set if name has no attributes; never null. * @param name the name of the object from which to retrieve attributes * @exception NamingException if a naming exception is encountered */ public Attributes getAttributes(Name name) throws NamingException { return dirContext.getAttributes(composeName(name, pathName)); }
/** * Retrieves the schema associated with the named object. * * @param name the name of the object whose schema is to be retrieved * @return the schema associated with the context; never null * @exception OperationNotSupportedException if schema not supported * @exception NamingException if a naming exception is encountered */ public DirContext getSchema(String name) throws NamingException { return dirContext.getSchema(composeName(name, path)); }
/** * Opens a connection to the object referenced by the <code>URL</code> * argument. */ protected URLConnection openConnection(URL u) throws IOException { DirContext currentContext = this.context; if (currentContext == null) currentContext = get(); return new DirContextURLConnection(currentContext, u); }
/** * Get creation date. * * @return Creation date value */ @Override public Date getCreationDate() { if (creation == -1L) { creation = getCreation(); } return super.getCreationDate(); }
/** * Retrieves all of the attributes associated with a named object. * * @return the set of attributes associated with name * @param name the name of the object from which to retrieve attributes * @exception NamingException if a naming exception is encountered */ public Attributes getAttributes(String name) throws NamingException { return dirContext.getAttributes(composeName(name, path)); }
/** * Opens a connection to the object referenced by the <code>URL</code> * argument. */ @Override protected URLConnection openConnection(URL u) throws IOException { DirContext currentContext = this.context; if (currentContext == null) currentContext = get(); return new DirContextURLConnection(currentContext, u); }
/** * Get creation date. * * @return Creation date value */ @Override public Date getCreationDate() { if (creation == -1L) { creation = getCreation(); } return super.getCreationDate(); }