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 CaddCollection(String name)Adds the specified collection to the store.CaddCollection(String name, String displayName, String description, String[] supportedComponents, Calendar timezone)protected voidassertConnected()booleanconnect()Connect to a object store anonymously.booleanconnect(String username, char[] password)Connect to a object store using the specified credentials.voiddisconnect()CgetCollection(String name)protected abstract AbstractJcrObjectCollectionDao<C>getCollectionDao()List<C>getCollections()booleanisConnected()protected abstract CnewCollection()CremoveCollection(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 ObjectStoreExceptionConnect to a object store anonymously.- Specified by:
connectin 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:
connectin 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:
disconnectin interfaceObjectStore<C extends AbstractJcrObjectCollection<?>>- Throws:
ObjectStoreException- where an unexpected error occurs
-
isConnected
public boolean isConnected()
- Specified by:
isConnectedin interfaceObjectStore<C extends AbstractJcrObjectCollection<?>>
-
addCollection
public final C addCollection(String name) throws ObjectStoreException
Adds the specified collection to the store.- Specified by:
addCollectionin 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:
addCollectionin 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:
getCollectionin 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
ObjectNotFoundExceptionis 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:
getCollectionsin interfaceObjectStore<C extends AbstractJcrObjectCollection<?>>- Throws:
ObjectStoreExceptionObjectNotFoundException
-
removeCollection
public final C removeCollection(String name) throws ObjectStoreException, ObjectNotFoundException
Removes the collection with specified id from the store.- Specified by:
removeCollectionin 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
-
-