Class AbstractLocalObjectStore<C extends AbstractLocalObjectCollection<?>>
- java.lang.Object
-
- net.fortuna.ical4j.connector.local.AbstractLocalObjectStore<C>
-
- All Implemented Interfaces:
ObjectStore<C>
- Direct Known Subclasses:
LocalCalendarStore
,LocalCardStore
public abstract class AbstractLocalObjectStore<C extends AbstractLocalObjectCollection<?>> extends Object implements ObjectStore<C>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description C
addCollection(String id)
Adds the specified collection to the store.C
addCollection(String id, String displayName, String description, String[] supportedComponents, Calendar timezone)
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 id)
List<C>
getCollections()
protected File
getRoot()
boolean
isConnected()
protected abstract C
newCollection(String id)
C
removeCollection(String id)
Removes the collection with specified id from the store.
-
-
-
Method Detail
-
getRoot
protected File getRoot()
-
connect
public boolean connect() throws ObjectStoreException
Description copied from interface:ObjectStore
Connect to a object store anonymously.- Specified by:
connect
in interfaceObjectStore<C extends AbstractLocalObjectCollection<?>>
- Returns:
- true if connection is successful, otherwise false
- Throws:
ObjectStoreException
- where an unexpected error occurs
-
connect
public boolean connect(String username, char[] password) throws ObjectStoreException
Description copied from interface:ObjectStore
Connect to a object store using the specified credentials.- Specified by:
connect
in interfaceObjectStore<C extends AbstractLocalObjectCollection<?>>
- Parameters:
username
- connection usernamepassword
- connection password- Returns:
- true if connection is successful, otherwise false
- Throws:
ObjectStoreException
- where an unexpected error occurs
-
disconnect
public void disconnect()
- Specified by:
disconnect
in interfaceObjectStore<C extends AbstractLocalObjectCollection<?>>
-
isConnected
public boolean isConnected()
- Specified by:
isConnected
in interfaceObjectStore<C extends AbstractLocalObjectCollection<?>>
-
addCollection
public C addCollection(String id) throws ObjectStoreException
Description copied from interface:ObjectStore
Adds the specified collection to the store.- Specified by:
addCollection
in interfaceObjectStore<C extends AbstractLocalObjectCollection<?>>
- Parameters:
id
- a collection identifier- Returns:
- the new collection instance
- Throws:
ObjectStoreException
- if a calendar with the specified id already exists in the store
-
addCollection
public C addCollection(String id, String displayName, String description, String[] supportedComponents, Calendar timezone) throws ObjectStoreException
- Specified by:
addCollection
in interfaceObjectStore<C extends AbstractLocalObjectCollection<?>>
- Parameters:
id
- 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
-
removeCollection
public C removeCollection(String id)
Description copied from interface:ObjectStore
Removes the collection with specified id from the store.- Specified by:
removeCollection
in interfaceObjectStore<C extends AbstractLocalObjectCollection<?>>
- Parameters:
id
- a collection identifier- Returns:
- if a collection with the specified id exists in the store it is returned. Otherwise returns null.
-
getCollection
public C getCollection(String id) throws ObjectStoreException, ObjectNotFoundException
- Specified by:
getCollection
in interfaceObjectStore<C extends AbstractLocalObjectCollection<?>>
- Parameters:
id
- 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()
- Specified by:
getCollections
in interfaceObjectStore<C extends AbstractLocalObjectCollection<?>>
-
-