org.apache.jdo.impl.fostore
Class DBClass

java.lang.Object
  extended byorg.apache.jdo.impl.fostore.DBClass
All Implemented Interfaces:
org.netbeans.mdr.persistence.Streamable

public class DBClass
extends java.lang.Object
implements org.netbeans.mdr.persistence.Streamable

Represents a class stored in the database.

This class is public so that it can be used as a Streamable and stored in the database.

Author:
Dave Bristor

Nested Class Summary
(package private)  class DBClass.ClassDetail
          A ClassDetail represents a single field or PC superclass of a class that is (or was at one time) stored in the databse.
 
Field Summary
private  CLID clid
          CLID corresponding to the class.
private  DBClass.ClassDetail[] fields
          The fields of the class.
private  FOStoreSchemaUID fsuid
          FSUID corresponding to the class.
private  boolean hasProvisionals
          Indicates whether the CLIDs of any superclass or field were given as provisional.
(package private) static org.apache.commons.logging.Log logger
          Logger
private  java.lang.String name
          Fully qualified name of the class represented.
private  DBClass.ClassDetail[] supers
          Lists the class's PersistenceCapable superclasses, from the class to Object.
 
Constructor Summary
  DBClass()
           
private DBClass(java.lang.String name, CLID clid, FOStoreSchemaUID fsuid, java.io.DataInput in, FOStoreDatabase db)
          Constructor
 
Method Summary
(package private) static DBClass create(java.lang.String name, CLID clid, FOStoreSchemaUID fsuid, java.io.DataInput in, FOStoreDatabase db)
           
private  void getClassDetail(DBClass.ClassDetail[] details, java.io.DataInput in)
          Gets the details for as many slots as are in the given array.
(package private)  CLID getCLID()
           
(package private)  FOStoreSchemaUID getFSUID()
           
(package private)  java.lang.String getName()
           
(package private)  OID getOID()
           
(package private)  boolean hasProvisionals()
           
(package private)  boolean hasSuperclasses()
           
 void read(java.io.InputStream is)
          Initialize this DBClass from the given stream.
private  void readClassDetails(DBClass.ClassDetail[] details, java.io.DataInputStream dis)
          Read details from the given input stream.
private  void remapCLIDs(DBClass.ClassDetail[] details, FOStoreDatabase db)
          Changes provisional CLIDs to real CLIDs in the given ClassDetails.
(package private)  void remapCLIDs(FOStoreDatabase db)
          Changes the CLID mapping of this DBClass's fields and PC superclasses in the database as from provisional to real as necessary.
(package private)  void setCLID(CLID clid)
           
(package private)  void setupSubclasses(FOStoreDatabase db)
          Sets up subclass relationships between this DBClass and its superclass DBClass instances.
 java.lang.String toString()
           
 void write(java.io.OutputStream os)
          Write this DBClass to the given stream.
private  void writeClassDetails(DBClass.ClassDetail[] details, java.io.DataOutputStream dos)
          Write the given details of this DBClass to the given stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private java.lang.String name
Fully qualified name of the class represented.


clid

private CLID clid
CLID corresponding to the class. It might be provisional, until the finishing phase of request handling has run.


fsuid

private FOStoreSchemaUID fsuid
FSUID corresponding to the class.


supers

private DBClass.ClassDetail[] supers
Lists the class's PersistenceCapable superclasses, from the class to Object. Null unless the class has PersistenceCapable superclasses.


fields

private DBClass.ClassDetail[] fields
The fields of the class. Null unless the class has fields.


hasProvisionals

private transient boolean hasProvisionals
Indicates whether the CLIDs of any superclass or field were given as provisional.


logger

static final org.apache.commons.logging.Log logger
Logger

Constructor Detail

DBClass

private DBClass(java.lang.String name,
                CLID clid,
                FOStoreSchemaUID fsuid,
                java.io.DataInput in,
                FOStoreDatabase db)
         throws java.io.IOException
Constructor


DBClass

public DBClass()
Method Detail

create

static DBClass create(java.lang.String name,
                      CLID clid,
                      FOStoreSchemaUID fsuid,
                      java.io.DataInput in,
                      FOStoreDatabase db)
               throws java.io.IOException
Throws:
java.io.IOException
See Also:
ActivateClassRequest.doRequestBody()

getClassDetail

private void getClassDetail(DBClass.ClassDetail[] details,
                            java.io.DataInput in)
                     throws java.io.IOException
Gets the details for as many slots as are in the given array.

Throws:
java.io.IOException

hasProvisionals

boolean hasProvisionals()
Returns:
True if any of this DBClass's fields or superclasses has a CLID that is provisional.

remapCLIDs

void remapCLIDs(FOStoreDatabase db)
Changes the CLID mapping of this DBClass's fields and PC superclasses in the database as from provisional to real as necessary.

Parameters:
db - Database in which to find the provisional-to-real mapping.

remapCLIDs

private void remapCLIDs(DBClass.ClassDetail[] details,
                        FOStoreDatabase db)
Changes provisional CLIDs to real CLIDs in the given ClassDetails.


hasSuperclasses

boolean hasSuperclasses()
Returns:
True if this DBClass has superclasses.

setupSubclasses

void setupSubclasses(FOStoreDatabase db)
               throws FOStoreDatabaseException
Sets up subclass relationships between this DBClass and its superclass DBClass instances.

Throws:
FOStoreDatabaseException

getOID

OID getOID()

getCLID

CLID getCLID()

setCLID

void setCLID(CLID clid)

getName

java.lang.String getName()

getFSUID

FOStoreSchemaUID getFSUID()

toString

public java.lang.String toString()

write

public void write(java.io.OutputStream os)
           throws org.netbeans.mdr.persistence.StorageException
Write this DBClass to the given stream.

Specified by:
write in interface org.netbeans.mdr.persistence.Streamable
Throws:
org.netbeans.mdr.persistence.StorageException

writeClassDetails

private void writeClassDetails(DBClass.ClassDetail[] details,
                               java.io.DataOutputStream dos)
                        throws java.io.IOException
Write the given details of this DBClass to the given stream.

Throws:
java.io.IOException

read

public void read(java.io.InputStream is)
          throws org.netbeans.mdr.persistence.StorageException
Initialize this DBClass from the given stream.

Specified by:
read in interface org.netbeans.mdr.persistence.Streamable
Throws:
org.netbeans.mdr.persistence.StorageException

readClassDetails

private void readClassDetails(DBClass.ClassDetail[] details,
                              java.io.DataInputStream dis)
                       throws java.io.IOException
Read details from the given input stream.

Throws:
java.io.IOException