org.openorb.pss.connector.file
Class FileSession

java.lang.Object
  extended by org.omg.CORBA.LocalObject
      extended by org.openorb.pss.connector.file.FileCatalog
          extended by org.openorb.pss.connector.file.FileSession
All Implemented Interfaces:
java.io.Serializable, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity, CatalogBase, CatalogBaseOperations, Session, SessionOperations, ExtendedCatalog, FileCatalogBase
Direct Known Subclasses:
FileSessionPool, TransactionalFileSession

public class FileSession
extends FileCatalog
implements Session

This class is an implementation of file based persistent session. Each persistent file contains several data wich are divided into 4 parts : - the VALID FLAG ( a boolean ) - the SHORT PID length ( a long value ) - the SHORT PID ( a buffer of bytes ) - the DATA length ( a long value ) - the DATA ( a buffer of bytes )

Author:
Jerome Daniel
See Also:
Serialized Form

Constructor Summary
FileSession()
           
FileSession(org.omg.PortableInterceptor.ORBInitInfo info)
          Constructor
 
Method Summary
 void clean(StorageHomeBase home)
           
 void close()
          The operation close terminates the catalog.
 StorageObject create_embedded_object(StorageHomeBase home_base, java.lang.String storage_type_id)
          This operation creates a new embedded storage type
 StorageObject create_empty_object(StorageHomeBase home_base, java.lang.String storage_type_id)
          This operation creates a new storage type
 org.omg.CORBA.portable.OutputStream create_new_entry(PID home_pid, PID type_pid)
          Create a new entry
 StorageObject create_object(StorageHomeBase home_base, java.lang.String storage_type_id)
          This operation creates a new storage type
 PID createHomePID(java.lang.String storage_home_name)
          Generate a Home PID
 PID createPID(PID home_pid, long index)
          Generate a storage type PID
 void delete(PID home_pid, PID type_pid)
          Delete a storage object
 void destroy(StorageHomeBase home)
           
 org.omg.CORBA.portable.InputStream entry(PID home_pid, PID type_pid)
          Return the entry data as an input stream
 void entry(PID home_pid, PID type_pid, org.omg.CORBA.portable.OutputStream output)
          Write a new entry into the file.
 StorageHomeBase find_home_base(PID pid)
          Returns an storage object home from its PID ( high part is only used )
 void flush()
          The flush operation instructs the PSS implementation to write to disk any cached modifications of storage object incarnations managed by this catalog.
 void free_all()
          The operation free_all instructs the catalog implementation to set the reference count of all its PSDL storage object instances to 0.
 DataManager getDataManager(java.lang.String storage_home_name)
          This operation return the DataManager
 java.util.Enumeration getSequentialAccess(PID home_pid)
          Returns a sequential access for all storage home's storage type
 StorageObject incarnate(StorageHomeBase home_base, byte[] storage_type_pid, java.lang.String storage_type_id)
          This operation returns a storage type incarnation
 void refresh()
          A PSS implementation can cache data read from the datastore(s).
 void setBaseInfo(FileConnector connector, short access, Parameter[] parameters)
          Set the base information require by a catalog
 boolean stored(PID home_pid, PID type_pid)
          Look for a stored object
 void write_entry(DataManager manager, DataEntry entry)
          Write the entry to the data store ( this operation could be overloaded if required - no access to private data - )
 
Methods inherited from class org.openorb.pss.connector.file.FileCatalog
access_mode, connector, find_all, find_by_pid, find_ref_by_pid, find_storage_home, iterator, parameters, setCatalogInfo
 
Methods inherited from class org.omg.CORBA.LocalObject
_create_request, _create_request, _duplicate, _get_domain_managers, _get_interface_def, _get_interface, _get_policy, _hash, _invoke, _is_a, _is_equivalent, _is_local, _non_existent, _orb, _release, _releaseReply, _request, _request, _servant_postinvoke, _servant_preinvoke, _set_policy_override, validate_connection
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.omg.CosPersistentState.CatalogBaseOperations
access_mode, find_by_pid, find_storage_home
 
Methods inherited from interface org.omg.CORBA.Object
_create_request, _create_request, _duplicate, _get_domain_managers, _get_interface_def, _get_policy, _hash, _is_a, _is_equivalent, _non_existent, _release, _request, _set_policy_override
 

Constructor Detail

FileSession

public FileSession()

FileSession

public FileSession(org.omg.PortableInterceptor.ORBInitInfo info)
Constructor

Method Detail

setBaseInfo

public void setBaseInfo(FileConnector connector,
                        short access,
                        Parameter[] parameters)
Set the base information require by a catalog

Specified by:
setBaseInfo in interface FileCatalogBase

getDataManager

public DataManager getDataManager(java.lang.String storage_home_name)
This operation return the DataManager


createHomePID

public PID createHomePID(java.lang.String storage_home_name)
Generate a Home PID


createPID

public PID createPID(PID home_pid,
                     long index)
Generate a storage type PID


delete

public void delete(PID home_pid,
                   PID type_pid)
Delete a storage object

Specified by:
delete in interface FileCatalogBase

stored

public boolean stored(PID home_pid,
                      PID type_pid)
Look for a stored object

Specified by:
stored in interface FileCatalogBase

entry

public org.omg.CORBA.portable.InputStream entry(PID home_pid,
                                                PID type_pid)
                                         throws NotFoundException
Return the entry data as an input stream

Specified by:
entry in interface FileCatalogBase
Throws:
NotFoundException

create_new_entry

public org.omg.CORBA.portable.OutputStream create_new_entry(PID home_pid,
                                                            PID type_pid)
Create a new entry

Specified by:
create_new_entry in interface FileCatalogBase

entry

public void entry(PID home_pid,
                  PID type_pid,
                  org.omg.CORBA.portable.OutputStream output)
Write a new entry into the file.

Specified by:
entry in interface FileCatalogBase

write_entry

public void write_entry(DataManager manager,
                        DataEntry entry)
Write the entry to the data store ( this operation could be overloaded if required - no access to private data - )


clean

public void clean(StorageHomeBase home)
Specified by:
clean in interface ExtendedCatalog

destroy

public void destroy(StorageHomeBase home)
Specified by:
destroy in interface ExtendedCatalog

flush

public void flush()
Description copied from interface: CatalogBaseOperations
The flush operation instructs the PSS implementation to write to disk any cached modifications of storage object incarnations managed by this catalog. Often, when an application creates a new storage object or updates a storage object, the modification is not written directly to disk -- the PSS implementation can cache some dirty data.

Specified by:
flush in interface CatalogBaseOperations
Specified by:
flush in class FileCatalog

refresh

public void refresh()
Description copied from interface: CatalogBaseOperations
A PSS implementation can cache data read from the datastore(s). The refresh operation instructs the PSS implementation to refresh any cached storage object incarnations accessed by this catalog. This operation can invalidate any direct reference to a storage object incarnation?s data member.

Specified by:
refresh in interface CatalogBaseOperations
Specified by:
refresh in class FileCatalog

free_all

public void free_all()
Description copied from interface: CatalogBaseOperations
The operation free_all instructs the catalog implementation to set the reference count of all its PSDL storage object instances to 0. In programming languages without garbage collection, such as C++, PSDL storage object instances are reference-counted by the application. Further, when a PSDL storage object A holds a reference to another PSDL storage object B, A?s instance owns a reference count of B?s instance. When PSDL storage objects form a cyclic graph, the corresponding instances own reference count of each other; even if the programmer correctly releases all her reference counts, the cyclic graph will never be completely released. The free_all operation deals with this problem.

Specified by:
free_all in interface CatalogBaseOperations
Specified by:
free_all in class FileCatalog

close

public void close()
Description copied from interface: CatalogBaseOperations
The operation close terminates the catalog. When closed, the catalog is also flushed. If the catalog is associated with one or more transactions when close is called, these transactions are marked roll-back only.

Specified by:
close in interface CatalogBaseOperations
Specified by:
close in class FileCatalog

incarnate

public StorageObject incarnate(StorageHomeBase home_base,
                               byte[] storage_type_pid,
                               java.lang.String storage_type_id)
                        throws NotFoundException
This operation returns a storage type incarnation

Specified by:
incarnate in interface FileCatalogBase
Throws:
NotFoundException

create_object

public StorageObject create_object(StorageHomeBase home_base,
                                   java.lang.String storage_type_id)
This operation creates a new storage type

Specified by:
create_object in interface FileCatalogBase

create_empty_object

public StorageObject create_empty_object(StorageHomeBase home_base,
                                         java.lang.String storage_type_id)
This operation creates a new storage type

Specified by:
create_empty_object in interface FileCatalogBase

create_embedded_object

public StorageObject create_embedded_object(StorageHomeBase home_base,
                                            java.lang.String storage_type_id)
This operation creates a new embedded storage type

Specified by:
create_embedded_object in interface FileCatalogBase

find_home_base

public StorageHomeBase find_home_base(PID pid)
Returns an storage object home from its PID ( high part is only used )

Specified by:
find_home_base in class FileCatalog

getSequentialAccess

public java.util.Enumeration getSequentialAccess(PID home_pid)
Returns a sequential access for all storage home's storage type

Specified by:
getSequentialAccess in interface FileCatalogBase