|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object PersistenceManager
PersistenceManager coordinates all persistence activity and is the
public interface to the persistence framework. PersistenceManager
is a singleton; therefore, the constructors are private. The user
obtains a PersistenceManager by calling the getManager
method and passing the filename for a properties file. Subsequent
calls to getManager
return the same singleton object.
The property file must include the following properties.
- java.naming.provider.url
- The URL for JNDI name resolution (typically an LDAP server). When running within Weblogic, use t3://hostname:7001
- java.naming.factory.initial
- The initial context factory for name resolution. When running within Weblogic, use weblogic.jndi.WLInitialContextFactory. When running standalone with no name server, this can be set to com.xavax.xstore.test.MyInitialContextFactory.
- com.xavax.xstore.poolSize
- The maximum size of the pool of persistence contexts. As many as one context per user or thread may be needed.
- com.xavax.xstore.lockStyle
- The locking style for the metadata database. Valid choices are: MSS, MySQL, and Oracle.
- com.xavax.xstore.url
- The name of the metadata database.
- com.xavax.xstore.username
- Username for the metadata database (null when using data sources).
- com.xavax.xstore.password
- Password for the metadata database (null when using data sources).
The following properties are used when running without JNDI support. These properties are only examined if the initial context factory is com.xavax.xstore.util.InitialContextFactory.
- com.xavax.xstore.driver
- The classname of the JDBC driver.
- com.xavax.xstore.sourceList
- A list of data sources to be created and bound to names in the initial context.
- com.xavax.xstore.*.url
- The URL for a data source (where * is the data source name).
- com.xavax.xstore.*.username
- The username for a data source.
- com.xavax.xstore.*.password
- The password for a data source.
- com.xavax.xstore.*.poolSize
- The maximum number of connections in the pool.
Method Summary | |
Iterator |
classes()
Returns an iterator for the collection of persistent classes contained in the metadata. |
PersistenceContext |
currentContext()
Returns the current persistence context. |
Iterator |
databases()
Returns an iterator for the collection of databases contained in the metadata. |
ClassMap |
findClass(short id)
Returns the class map for the class with the specified identifier. |
ClassMap |
findClass(String name)
Returns the class map for the class with the specified name. |
ColumnMap |
findColumn(String tblname,
String colname)
Returns a column map for the specified column. |
DatabaseMap |
findDatabase(short id)
Returns a database map for the database with the specified identifier. |
DatabaseMap |
findDatabase(String name)
Returns a database map for the database with the specified name. |
TableMap |
findTable(String name)
Returns a table map for table with the specified name. |
PersistenceContext |
getContext()
Create a new persistence context and bind it to the current thread. |
static PersistenceManager |
getManager()
Returns the persistence manager, or null if no PersistenceManager is instantiated. |
static PersistenceManager |
getManager(PersistenceProperties props,
Context ctx)
Returns the PersistenceManager. |
static PersistenceManager |
getManager(String filename)
Returns the PersistenceManager. |
Context |
namingContext()
Returns the naming context used to resolve data source names. |
long |
nextOID()
Returns the next object identifier. |
void |
outputXML(PrintWriter out)
Output the metadata in XML format. |
boolean |
ready()
Returns true if this persistence manager is ready. |
void |
showClasses()
Display the metadata for each class in a user-friendly format. |
void |
showDatabases()
Display the metadata for each database in a user-friendly format. |
void |
showTables()
Display the metadata for all tables in a user-friendly format. |
void |
shutdown()
Shut down the persistence manager. |
Iterator |
tables()
Returns an iterator for the collection of tables in the metadata. |
Methods inherited from class Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public PersistenceContext currentContext() throws PersistenceException
PersistenceException
public PersistenceContext getContext() throws PersistenceException
PersistenceException
public static PersistenceManager getManager(String filename) throws PersistenceException
filename
- the name of a properties file.
PersistenceException
- if the properties file was not found,
the properties could not be loaded, or a PersistenceManager
was not instantiated successfully.public static PersistenceManager getManager(PersistenceProperties props, Context ctx) throws PersistenceException
props
- the persistence properties.ctx
- the Context to use for JNDI name resolution.
PersistenceException
- if the properties file was not found,
the properties could not be loaded, or a PersistenceManager
was not instantiated successfully.public static PersistenceManager getManager()
public void shutdown()
public long nextOID()
public ClassMap findClass(String name)
name
- the name of the class to find.
public ClassMap findClass(short id)
id
- the class identifier.
public void showClasses()
public Iterator classes()
public DatabaseMap findDatabase(short id)
id
- the database identifier.
public DatabaseMap findDatabase(String name)
name
- the database name.
public void showDatabases()
public Iterator databases()
public TableMap findTable(String name)
name
- the table name.
public ColumnMap findColumn(String tblname, String colname)
tblname
- the table name.colname
- the column name.
public void showTables()
public Iterator tables()
public Context namingContext()
public boolean ready()
public void outputXML(PrintWriter out)
out
- the output writer.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |