Package net.fortuna.ical4j.connector.jcr
Class AbstractJcrObjectStore<C extends AbstractJcrObjectCollection<?>>
- java.lang.Object
-
- net.fortuna.ical4j.connector.jcr.AbstractJcrObjectStore<C>
-
- Type Parameters:
C
- the supported collection type
- All Implemented Interfaces:
ObjectStore<C>
- Direct Known Subclasses:
JcrCalendarStore
,JcrCardStore
public abstract class AbstractJcrObjectStore<C extends AbstractJcrObjectCollection<?>> extends Object implements ObjectStore<C>
-
-
Constructor Summary
Constructors Constructor Description AbstractJcrObjectStore(javax.jcr.Repository repository, String path, org.jcrom.Jcrom jcrom)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description C
addCollection(String name)
Adds the specified collection to the store.C
addCollection(String name, String displayName, String description, String[] supportedComponents, Calendar timezone)
protected void
assertConnected()
boolean
connect()
Connect to a object store anonymously.boolean
connect(String username, char[] password)
Connect to a object store using the specified credentials.void
disconnect()
C
getCollection(String name)
protected abstract AbstractJcrObjectCollectionDao<C>
getCollectionDao()
List<C>
getCollections()
boolean
isConnected()
protected abstract C
newCollection()
C
removeCollection(String name)
Removes the collection with specified id from the store.
-
-
-
Constructor Detail
-
AbstractJcrObjectStore
public AbstractJcrObjectStore(javax.jcr.Repository repository, String path, org.jcrom.Jcrom jcrom)
- Parameters:
repository
- a repository instancepath
- a repository store pathjcrom
- a JCROM instance
-
-
Method Detail
-
connect
public final boolean connect() throws ObjectStoreException
Connect to a object store anonymously.- Specified by:
connect
in interfaceObjectStore<C extends AbstractJcrObjectCollection<?>>
- Returns:
- true if connection is successful, otherwise false
- Throws:
ObjectStoreException
- where an unexpected error occurs
-
connect
public final boolean connect(String username, char[] password) throws ObjectStoreException
Connect to a object store using the specified credentials.- Specified by:
connect
in interfaceObjectStore<C extends AbstractJcrObjectCollection<?>>
- Parameters:
username
- connection usernamepassword
- connection password- Returns:
- true if connection is successful, otherwise false
- Throws:
ObjectStoreException
- where an unexpected error occurs
-
disconnect
public final void disconnect() throws ObjectStoreException
- Specified by:
disconnect
in interfaceObjectStore<C extends AbstractJcrObjectCollection<?>>
- Throws:
ObjectStoreException
- where an unexpected error occurs
-
isConnected
public boolean isConnected()
- Specified by:
isConnected
in interfaceObjectStore<C extends AbstractJcrObjectCollection<?>>
-
addCollection
public final C addCollection(String name) throws ObjectStoreException
Adds the specified collection to the store.- Specified by:
addCollection
in interfaceObjectStore<C extends AbstractJcrObjectCollection<?>>
- Parameters:
name
- a collection identifier- Returns:
- the new collection instance
- Throws:
ObjectStoreException
- if a calendar with the specified id already exists in the store
-
addCollection
public final C addCollection(String name, String displayName, String description, String[] supportedComponents, Calendar timezone) throws ObjectStoreException
- Specified by:
addCollection
in interfaceObjectStore<C extends AbstractJcrObjectCollection<?>>
- Parameters:
name
- a collection identifierdisplayName
- the collection namedescription
- the collection descriptionsupportedComponents
- supported collection objectstimezone
- collection timezone- Returns:
- the new collection instance
- Throws:
ObjectStoreException
- where an unexpected error occurs
-
getCollection
public final C getCollection(String name) throws ObjectStoreException, ObjectNotFoundException
- Specified by:
getCollection
in interfaceObjectStore<C extends AbstractJcrObjectCollection<?>>
- Parameters:
name
- a collection identifier- Returns:
- an object collection with the specified id. If no collection with the specified id
is found in this store, an
ObjectNotFoundException
is thrown. - Throws:
ObjectStoreException
- where an unexpected error occursObjectNotFoundException
- if a collection with the specified identifier doesn't exist
-
getCollections
public List<C> getCollections() throws ObjectStoreException, ObjectNotFoundException
- Specified by:
getCollections
in interfaceObjectStore<C extends AbstractJcrObjectCollection<?>>
- Throws:
ObjectStoreException
ObjectNotFoundException
-
removeCollection
public final C removeCollection(String name) throws ObjectStoreException, ObjectNotFoundException
Removes the collection with specified id from the store.- Specified by:
removeCollection
in interfaceObjectStore<C extends AbstractJcrObjectCollection<?>>
- Parameters:
name
- a collection identifier- Returns:
- if a collection with the specified id exists in the store it is returned. Otherwise returns null.
- Throws:
ObjectStoreException
- where an unexpected error occursObjectNotFoundException
- if a collection with the specified identifier doesn't exist
-
assertConnected
protected final void assertConnected() throws ObjectStoreException
- Throws:
ObjectStoreException
- where the store is not connected
-
newCollection
protected abstract C newCollection()
- Returns:
- a new collection instance
-
getCollectionDao
protected abstract AbstractJcrObjectCollectionDao<C> getCollectionDao()
- Returns:
- the underlying collection DAO
-
-