Class COM.odi.Segment

java.lang.Object
   |
   +----COM.odi.Segment

public class Segment
extends Object
PSE/PSE Pro uses the Segment class to represent a segment in a database.

When you are using ObjectStore PSE or PSE Pro, a database can have only one segment.


Method Index

 o destroy()
Destroys a segment.
 o getDatabase()
Obtains the Database object associated with the database that contains the segment.
 o getSegmentId()
Obtains the segment ID of a segment.
 o getSizeInBytes()
Obtains the number of bytes of storage occupied by the segment.
 o isDestroyed()
Determines whether or not the segment has been destroyed.
 o of(Object)
Obtains the segment that contains the object.

Methods

 o destroy
  public abstract void destroy()
Destroys a segment. If an application tries to call a method on a segment that has been destroyed, PSE/PSE Pro throws SegmentNotFoundException. Destroying a segment causes any objects stored in that segment to become inaccessible. If you try to access an object in a destroyed segment, PSE/PSE Pro throws ObjectNotFoundException. You cannot recover a destroyed segment.

If you are using PSE or PSE Pro, there is never more than one segment in the database and you cannot destroy it.

If you destroy a segment and then abort the transaction in which you destroyed the segment, this undoes the destruction of the segment.

Throws: DatabaseNotOpenException
If the database is not open.
Throws: NoTransactionInProgressException
If there is no transaction in progress.
Throws: ObjectStoreException
If PSE/PSE Pro is not initialized for the current thread or if the segment object is not associated with this thread.
Throws: SegmentException
If the application is using PSE or PSE Pro.
Throws: SegmentNotFoundException
If the segment is not found, perhaps because it was already destroyed.
Throws: UpdateReadOnlyException
If there is a read-only transaction in progress or if the database is open for read-only.
 o isDestroyed
  public abstract boolean isDestroyed()
Determines whether or not the segment has been destroyed.

Returns:
The true constant if the segment has been destroyed. The false constant if it has not been destroyed.

Throws: DatabaseNotOpenException
If the database is not open.
Throws: NoTransactionInProgressException
If there is no transaction in progress.
Throws: ObjectStoreException
If PSE/PSE Pro is not initialized for the current thread or if the segment object is not associated with this thread.
 o getSegmentId
  public abstract int getSegmentId()
Obtains the segment ID of a segment.

Returns:
The segment ID.
 o getDatabase
  public abstract Database getDatabase()
Obtains the Database object associated with the database that contains the segment.

Returns:
The instance of Database associated with the database.

Throws: DatabaseNotOpenException
If the database is not open.
Throws: ObjectStoreException
If PSE/PSE Pro is not initialized for the current thread or if the segment object is not associated with this thread.
 o getSizeInBytes
  public abstract int getSizeInBytes()
Obtains the number of bytes of storage occupied by the segment.

Returns:
The number of bytes of storage.

Throws: DatabaseNotOpenException
If the database is not open.
Throws: NoTransactionInProgressException
If there is no transaction in progress.
Throws: ObjectStoreException
If PSE/PSE Pro is not initialized for the current thread or if the segment object is not associated with this thread.
Throws: SegmentNotFoundException
If the segment is not found.
 o of
  public static Segment of(Object object)
Obtains the segment that contains the object.

Parameters:
object - A persistent object in the segment you want to obtain.

Returns:
The instance of Segment that represents the segment that contains the specified object.

Throws: DatabaseNotOpenException
If the database is not open.
Throws: IllegalArgumentException
If the object argument is null.
Throws: NoTransactionInProgressException
If there is no transaction in progress.
Throws: ObjectException
If the object is stale.
Throws: ObjectNotPersistentException
If the object is not persistent.
Throws: ObjectStoreException
If PSE/PSE Pro is not initialized for the current thread or if the segment object is not associated with this thread.
Throws: SegmentNotFoundException
If the segment is not found.

Copyright © 1996, 1997 Object Design, Inc. All rights reserved.