public Resource getResource( String id ) throws XMLDBException { if ( !collection.getPermissions().validate( user, Permission.READ ) ) throw new XMLDBException( ErrorCodes.PERMISSION_DENIED, "not allowed to read collection" ); String name = collection.getName() + '/' + id; DocumentImpl document = collection.getDocument( name ); if ( document == null ) return null; LocalXMLResource r = new LocalXMLResource( user, brokerPool, this, document, -1, properties ); return r; }
public Resource getResource(String id) throws XMLDBException { if (!collection.getPermissions().validate(user, Permission.READ)) throw new XMLDBException( ErrorCodes.PERMISSION_DENIED, "not allowed to read collection"); String name = collection.getName() + '/' + id; DocumentImpl document = collection.getDocument(name); if (document == null) return null; Resource r; if(document.getResourceType() == DocumentImpl.XML_FILE) r = new LocalXMLResource( user, brokerPool, this, document, -1, properties); else if(document.getResourceType() == DocumentImpl.BINARY_FILE) r = new LocalBinaryResource(user, brokerPool, this, (BLOBDocument)document); else throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, "unknown resource type"); return r; }
    public Resource getResource( String id ) throws XMLDBException {        if ( !collection.getPermissions().validate( user, Permission.READ ) )            throw new XMLDBException( ErrorCodes.PERMISSION_DENIED,                "not allowed to read collection" );        String name =            collection.getName() + '/' + id;        DocumentImpl document =            collection.getDocument( name );        if ( document == null )            return null;        LocalXMLResource r =            new LocalXMLResource( user, brokerPool, this, document, -1, properties );        return r;    }