com.ibm.websphere.samples.technologysamples.sdo.AlbumCatalog
Class AlbumCatalogJDBCSDOService

java.lang.Object
  extended by com.ibm.websphere.samples.technologysamples.sdo.AlbumCatalog.AlbumCatalogJDBCSDOService

public class AlbumCatalogJDBCSDOService
extends java.lang.Object

AlbumCatalogJDBCSDOService provides methods to retrieve and commit Datagraphs from and to the Album Catalog relational database. It uses AlbumCatalogMetadata and JDBC Mediator APIs to retrieve/commit SDOs.


Constructor Summary
AlbumCatalogJDBCSDOService()
           
 
Method Summary
 void commitAlbumGraph(commonj.sdo.DataObject graph)
          Commits Datagraph containing album DataObjects to the database.
 void commitBandGraph(commonj.sdo.DataObject graph)
          Commits Datagraph containing band DataObject to the database.
 void commitBandWithAlbumsGraph(commonj.sdo.DataObject graph)
          Commits Datagraph containing Band and Album dataobjects the database.
 commonj.sdo.DataObject findAlbum(java.lang.String albumToFind)
          Uses JDBC Mediator APIs to find an album using the parameter passed in and return the results as a Datagraph.
 commonj.sdo.DataObject findAlbumsByBandAndYear(java.lang.String bandName, java.lang.String albumYear)
          Uses JDBC Mediator APIs to find albums by band name and year passed in and returns the results as a Datagraph.
 commonj.sdo.DataObject findBand(java.lang.String bandToFind)
          Uses JDBC Mediator APIs to find bands using the parameter passed in and return the results as a Datagraph Note that this method uses JDBCMediator Metadata APIs (from the AlbumCatalogMetadata class) to describe the query.
 commonj.sdo.DataObject getEmptyAlbumGraph()
          Uses JDBC Mediator APIs to create an empty Datagraph with relational metadata for the Album table.
 commonj.sdo.DataObject getEmptyBandGraph()
          Uses JDBC Mediator APIs create an empty Datagraph with relational metadata for the Band table.
 commonj.sdo.DataObject getEmptyGraph(com.ibm.websphere.sdo.mediator.jdbc.metadata.Metadata metadata)
          Uses JDBC Mediator APIs to create an empty Datagraph for relational metadata passed in.
static AlbumCatalogJDBCSDOService soleInstance()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlbumCatalogJDBCSDOService

public AlbumCatalogJDBCSDOService()
Method Detail

soleInstance

public static AlbumCatalogJDBCSDOService soleInstance()

findBand

public commonj.sdo.DataObject findBand(java.lang.String bandToFind)
                                throws com.ibm.websphere.sdo.mediator.exception.MediatorException
Uses JDBC Mediator APIs to find bands using the parameter passed in and return the results as a Datagraph Note that this method uses JDBCMediator Metadata APIs (from the AlbumCatalogMetadata class) to describe the query.

Parameters:
bandToFind - the name of band to search.
Returns:
DataObject Datagraph of Band DataObjects
Throws:
com.ibm.websphere.sdo.mediator.exception.MediatorException

findAlbum

public commonj.sdo.DataObject findAlbum(java.lang.String albumToFind)
                                 throws com.ibm.websphere.sdo.mediator.exception.MediatorException
Uses JDBC Mediator APIs to find an album using the parameter passed in and return the results as a Datagraph. Note that this method uses a SQL query string, instead of using Metadata APIs, to describe the query

Parameters:
albumToFind - the name of album to search.
Returns:
DataObject Datagraph of album DataObjects
Throws:
com.ibm.websphere.sdo.mediator.exception.MediatorException

findAlbumsByBandAndYear

public commonj.sdo.DataObject findAlbumsByBandAndYear(java.lang.String bandName,
                                                      java.lang.String albumYear)
                                               throws com.ibm.websphere.sdo.mediator.exception.MediatorException
Uses JDBC Mediator APIs to find albums by band name and year passed in and returns the results as a Datagraph.

Parameters:
bandName - the name of band to search.
albumYear - the album year to search.
Returns:
DataObject Datagraph of album DataObjects
Throws:
com.ibm.websphere.sdo.mediator.exception.MediatorException

getEmptyBandGraph

public commonj.sdo.DataObject getEmptyBandGraph()
                                         throws com.ibm.websphere.sdo.mediator.exception.MediatorException
Uses JDBC Mediator APIs create an empty Datagraph with relational metadata for the Band table. Therefore only DataObjects that contain fields for the Band table can be added to this Datagraph.

Returns:
DataObject empty Datagraph for Band metadata
Throws:
com.ibm.websphere.sdo.mediator.exception.MediatorException

getEmptyAlbumGraph

public commonj.sdo.DataObject getEmptyAlbumGraph()
                                          throws com.ibm.websphere.sdo.mediator.exception.MediatorException
Uses JDBC Mediator APIs to create an empty Datagraph with relational metadata for the Album table. Therefore only DataObjects that contain fields for the Album table can be added to this Datagraph.

Returns:
DataObject empty Datagraph for Album metadata
Throws:
com.ibm.websphere.sdo.mediator.exception.MediatorException

getEmptyGraph

public commonj.sdo.DataObject getEmptyGraph(com.ibm.websphere.sdo.mediator.jdbc.metadata.Metadata metadata)
                                     throws com.ibm.websphere.sdo.mediator.exception.MediatorException
Uses JDBC Mediator APIs to create an empty Datagraph for relational metadata passed in.

Returns:
graph empty Datagraph for Album metadata
Throws:
com.ibm.websphere.sdo.mediator.exception.MediatorException

commitAlbumGraph

public void commitAlbumGraph(commonj.sdo.DataObject graph)
                      throws com.ibm.websphere.sdo.mediator.exception.MediatorException
Commits Datagraph containing album DataObjects to the database.

Parameters:
graph - the Datagraph to commit
Throws:
com.ibm.websphere.sdo.mediator.exception.MediatorException

commitBandWithAlbumsGraph

public void commitBandWithAlbumsGraph(commonj.sdo.DataObject graph)
                               throws com.ibm.websphere.sdo.mediator.exception.MediatorException
Commits Datagraph containing Band and Album dataobjects the database.

Parameters:
graph - the Datagraph to commit
Throws:
com.ibm.websphere.sdo.mediator.exception.MediatorException

commitBandGraph

public void commitBandGraph(commonj.sdo.DataObject graph)
                     throws com.ibm.websphere.sdo.mediator.exception.MediatorException
Commits Datagraph containing band DataObject to the database.

Parameters:
graph - the Datagraph to commit
Throws:
com.ibm.websphere.sdo.mediator.exception.MediatorException