Permalink
Browse files

Added the getObject method and added more javadoc to the DatabaseMana…

…ger interface.
  • Loading branch information...
ccorsi committed Sep 18, 2010
1 parent b726784 commit 7a1b413e526e64c1472945b0b3a0c5b58fdd41b6
Showing with 82 additions and 3 deletions.
  1. +82 −3 persistence/books/base/src/books/persistence/manager/DatabaseManager.java
@@ -35,7 +35,7 @@
* This is the service interface that the persistent implementation will need to implement to be able to manipulate
* the Book instances within the system.
*
- * @author ccorsi
+ * @author Claudio Corsi
*
*/
public interface DatabaseManager {
@@ -73,21 +73,78 @@
*/
public void save(Book book);
+ /**
+ * This method will be used to start a new transaction for the underlying
+ * persistent layer implementation.
+ *
+ * It is not a requirement that the underlying persistent layer start a
+ * transaction.
+ *
+ */
public void beginTx();
+ /**
+ * This method will be used to commit an action transaction for the underlying
+ * persistent layer implementation.
+ *
+ * It is not a requirement that the underlying persistent layer commit a
+ * transaction.
+ */
public void commitTx();
/**
- * @param properties
+ * This method should be called before any other DatabaseManager methods can be
+ * called.
+ *
+ * This method should be called when the application or container is being started.
+ *
+ * The close method should then be called whenever the application or container is
+ * ending.
+ *
+ * The passed properties instance can contain persistent layer specific properties
+ * settings that can be used to setup the underlying persistent layer.
+ *
+ * @param properties Properties instance containing persistent layer specific settings
+ *
+ * @see #close()
*/
public void init(Properties properties);
+ /**
+ * This method is called whenever the application container is ending.
+ *
+ * This method should be called only after the init method was called.
+ *
+ * @see #init(Properties)
+ */
public void close();
+ /**
+ * The method will return a collection of all of the Book instances contained within
+ * the underlying persistent layer.
+ *
+ * @return Collection of Book instances
+ */
public Collection<Book> getBooks();
+ /**
+ * This method will return a collection of all of the Person instances contained within
+ * the underlying persistent layer for the passed PersonType.
+ *
+ * @param type The type of Person objects to be returned
+ *
+ * @return Collection of Person objects of the type passed
+ *
+ * @see books.persistence.types.PersonType
+ */
public Collection<Person> getPersons(PersonType type);
+ /**
+ * This method will return a collection of all of the Gender instances contained
+ * within the underlying persistent layer
+ *
+ * @return Collection of Gender instances
+ */
public Collection<Gender> getGenders();
/**
@@ -99,6 +156,28 @@
*/
public String getIdentifier(Object object);
- void update(Book book);
+ /**
+ * This method is called whenever you want to persistent an updated Book instance.
+ * This can be used by the underlying persistent layer to perform the required
+ * task to be able to update an persistent Book instance.
+ *
+ * @param book Persistent Book instance that needs to be updated
+ *
+ */
+ public void update(Book book);
+ /**
+ * This method will convert the underlying persistent layer specific identifier
+ * string into a persistent instance.
+ *
+ * @param <T> This is the type of instance that will be created and returned
+ *
+ * @param identityString The identifier string of the object to be returned
+ *
+ * @return An instance of type T corresponding to the passed identifier string,
+ * else it will return a null value
+ *
+ * @see #getIdentifier(Object)
+ */
+ public <T> T getObject(String identityString);
}

0 comments on commit 7a1b413

Please sign in to comment.