org.exist.xmldb
Class LocalCollection

java.lang.Object
  extended byjava.util.Observable
      extended byorg.exist.xmldb.LocalCollection
All Implemented Interfaces:
CollectionImpl

public class LocalCollection
extends java.util.Observable
implements CollectionImpl

A local implementation of the Collection interface. This is used when the database is running in embedded mode. Extends Observable to allow status callbacks during indexing. Methods storeResource notifies registered observers about the progress of the indexer by passing an object of type ProgressIndicator to the observer.

Author:
wolf

Field Summary
protected  BrokerPool brokerPool
           
protected static java.util.Properties defaultProperties
           
protected  boolean needsSync
           
protected  java.util.ArrayList observers
           
protected  LocalCollection parent
           
protected  java.lang.String path
           
protected  java.util.Properties properties
           
protected  User user
           
 
Constructor Summary
LocalCollection(User user, BrokerPool brokerPool, LocalCollection parent, java.lang.String name, AccessContext accessCtx)
          Create a collection identified by its name.
LocalCollection(User user, BrokerPool brokerPool, java.lang.String collection, AccessContext accessCtx)
          Create a collection with no parent (root collection).
 
Method Summary
 void addObserver(java.util.Observer o)
          Add a new observer to the list.
protected  boolean checkOwner(Collection collection, User user)
           
protected  boolean checkPermissions(Collection collection, int perm)
           
 void close()
          Close the current collection.
 java.lang.String createId()
           
 Resource createResource(java.lang.String id, java.lang.String type)
           
 AccessContext getAccessContext()
           
 org.xmldb.api.base.Collection getChildCollection(java.lang.String name)
           
 int getChildCollectionCount()
           
 java.lang.String[] getChildCollections()
           
protected  Collection getCollection()
           
protected  Collection getCollectionWithLock(int lockMode)
           
 java.util.Date getCreationTime()
          Returns the time of creation of the collection.
 java.lang.String getName()
           
 org.xmldb.api.base.Collection getParentCollection()
           
 java.lang.String getPath()
           
 java.lang.String getProperty(java.lang.String property)
           
 Resource getResource(java.lang.String id)
           
 int getResourceCount()
           
 java.lang.String[] getResources()
           
 Service getService(java.lang.String name, java.lang.String version)
          Possible services: XPathQueryService, XQueryService, CollectionManagementService (CollectionManager), UserManagementService, DatabaseInstanceManager, XUpdateQueryService, IndexQueryService, ValidationService.
 Service[] getServices()
           
 XmldbURI getURI()
           
 boolean isOpen()
           
 boolean isRemoteCollection()
           
 java.lang.String[] listChildCollections()
           
 java.lang.String[] listResources()
           
 void registerService(Service serv)
           
 void removeResource(Resource res)
           
protected  void saveCollection()
           
 void setProperty(java.lang.String property, java.lang.String value)
           
 void setReader(org.xml.sax.XMLReader reader)
          set user-defined Reader
 void storeResource(Resource resource)
           
 void storeResource(Resource resource, java.util.Date a, java.util.Date b)
           
 
Methods inherited from class java.util.Observable
clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultProperties

protected static final java.util.Properties defaultProperties

path

protected java.lang.String path

brokerPool

protected BrokerPool brokerPool

properties

protected java.util.Properties properties

parent

protected LocalCollection parent

user

protected User user

observers

protected java.util.ArrayList observers

needsSync

protected boolean needsSync
Constructor Detail

LocalCollection

public LocalCollection(User user,
                       BrokerPool brokerPool,
                       java.lang.String collection,
                       AccessContext accessCtx)
                throws XMLDBException
Create a collection with no parent (root collection).

Parameters:
user -
brokerPool -
collection -
Throws:
XMLDBException

LocalCollection

public LocalCollection(User user,
                       BrokerPool brokerPool,
                       LocalCollection parent,
                       java.lang.String name,
                       AccessContext accessCtx)
                throws XMLDBException
Create a collection identified by its name. Load the collection from the database.

Parameters:
user -
brokerPool -
parent -
name -
Throws:
XMLDBException
Method Detail

getAccessContext

public AccessContext getAccessContext()

getCollectionWithLock

protected Collection getCollectionWithLock(int lockMode)
                                    throws XMLDBException
Throws:
XMLDBException

saveCollection

protected void saveCollection()
                       throws XMLDBException
Throws:
XMLDBException

getCollection

protected Collection getCollection()
                            throws XMLDBException
Throws:
XMLDBException

checkOwner

protected boolean checkOwner(Collection collection,
                             User user)
                      throws XMLDBException
Throws:
XMLDBException

checkPermissions

protected boolean checkPermissions(Collection collection,
                                   int perm)
                            throws XMLDBException
Throws:
XMLDBException

close

public void close()
           throws XMLDBException
Close the current collection. Calling this method will flush all open buffers to disk.

Throws:
XMLDBException

createId

public java.lang.String createId()
                          throws XMLDBException
Throws:
XMLDBException

createResource

public Resource createResource(java.lang.String id,
                               java.lang.String type)
                        throws XMLDBException
Throws:
XMLDBException

getChildCollection

public org.xmldb.api.base.Collection getChildCollection(java.lang.String name)
                                                 throws XMLDBException
Throws:
XMLDBException

getChildCollectionCount

public int getChildCollectionCount()
                            throws XMLDBException
Throws:
XMLDBException

getName

public java.lang.String getName()
                         throws XMLDBException
Throws:
XMLDBException

getParentCollection

public org.xmldb.api.base.Collection getParentCollection()
                                                  throws XMLDBException
Throws:
XMLDBException

getPath

public java.lang.String getPath()
                         throws XMLDBException
Throws:
XMLDBException

getProperty

public java.lang.String getProperty(java.lang.String property)
                             throws XMLDBException
Throws:
XMLDBException

getResource

public Resource getResource(java.lang.String id)
                     throws XMLDBException
Throws:
XMLDBException

getResourceCount

public int getResourceCount()
                     throws XMLDBException
Throws:
XMLDBException

getService

public Service getService(java.lang.String name,
                          java.lang.String version)
                   throws XMLDBException
Possible services: XPathQueryService, XQueryService, CollectionManagementService (CollectionManager), UserManagementService, DatabaseInstanceManager, XUpdateQueryService, IndexQueryService, ValidationService.

Throws:
XMLDBException

getServices

public Service[] getServices()
                      throws XMLDBException
Throws:
XMLDBException

isOpen

public boolean isOpen()
               throws XMLDBException
Throws:
XMLDBException

listChildCollections

public java.lang.String[] listChildCollections()
                                        throws XMLDBException
Throws:
XMLDBException

getChildCollections

public java.lang.String[] getChildCollections()
                                       throws XMLDBException
Specified by:
getChildCollections in interface CollectionImpl
Throws:
XMLDBException

listResources

public java.lang.String[] listResources()
                                 throws XMLDBException
Throws:
XMLDBException

getResources

public java.lang.String[] getResources()
                                throws XMLDBException
Specified by:
getResources in interface CollectionImpl
Throws:
XMLDBException

registerService

public void registerService(Service serv)
                     throws XMLDBException
Throws:
XMLDBException

removeResource

public void removeResource(Resource res)
                    throws XMLDBException
Throws:
XMLDBException

setProperty

public void setProperty(java.lang.String property,
                        java.lang.String value)
                 throws XMLDBException
Throws:
XMLDBException

storeResource

public void storeResource(Resource resource)
                   throws XMLDBException
Throws:
XMLDBException

storeResource

public void storeResource(Resource resource,
                          java.util.Date a,
                          java.util.Date b)
                   throws XMLDBException
Specified by:
storeResource in interface CollectionImpl
Throws:
XMLDBException

getCreationTime

public java.util.Date getCreationTime()
                               throws XMLDBException
Description copied from interface: CollectionImpl
Returns the time of creation of the collection.

Specified by:
getCreationTime in interface CollectionImpl
Returns:
Throws:
XMLDBException

addObserver

public void addObserver(java.util.Observer o)
Add a new observer to the list. Observers are just passed on to the indexer to be notified about the indexing progress.


isRemoteCollection

public boolean isRemoteCollection()
                           throws XMLDBException
Specified by:
isRemoteCollection in interface CollectionImpl
Throws:
XMLDBException

setReader

public void setReader(org.xml.sax.XMLReader reader)
set user-defined Reader


getURI

public XmldbURI getURI()
Specified by:
getURI in interface CollectionImpl


<oXygen/> XML Editor provides support for editing and debugging XQuery expressions against the eXist XML Database.