org.openmdx.base.accessor.generic.view
Class Manager_1

java.lang.Object
  extended by org.openmdx.compatibility.base.marshalling.CachingMarshaller
      extended by org.openmdx.base.accessor.generic.view.Manager_1
All Implemented Interfaces:
Serializable, EventListener, ObjectFactory_1_0, ObjectFactory_1_1, ObjectFactory_1_2, InstanceCallbackListener, Marshaller

public class Manager_1
extends CachingMarshaller
implements InstanceCallbackListener, Serializable, ObjectFactory_1_2

Manager_1 implementation.

The manager returns the same object for a given object id as long as it is not garbage collected.

A Manager can be constructed with the following transaction management policies:

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.openmdx.compatibility.base.marshalling.CachingMarshaller
mapping
 
Constructor Summary
Manager_1(Connection_1_0 interaction)
          Constructs a Manager.
 
Method Summary
 void close()
          Close the basic accessor.
protected  Object createMarshalledObject(Object source)
          Marshals path objects to Object_1_0 objects.
 Object_1_0 createObject(String objectClass)
          Create an object
 Object_1_0 createObject(String objectClass, Object_1_0 initialValues)
          This method creates a new object with the initial values.
 Object_1_0 createObject(String roleClass, String roleId, Object_1_0 roleCapable)
          This method creates a new role of a RoleCapable object.
 Structure_1_0 createStructure(String type, List fieldNames, List fieldValues)
          Create a structure
 Connection_1_0 getConnection()
          Return connection assigned to this manager.
 Connection_1Factory getConnectionFactory()
          Return this connection's factory
 Object_1_0 getObject(Object accessPath)
          Get an object from the object factory.
 UnitOfWork_1_0 getUnitOfWork()
          Return the unit of work associated with the current basic accessor.
 Boolean hasContainerManagedUnitOfWork()
          Container managed units of work are either non transactional or part of a bigger unit of work.
 Object marshal(Object source)
          Marshals an object
 void postLoad(InstanceCallbackEvent event)
          Called after the values are loaded from the data store into this instance.
 void preClear(InstanceCallbackEvent event)
          Called before the values in the instance are cleared.
 void preDelete(InstanceCallbackEvent event)
          Called before the instance is deleted.
 void preStore(InstanceCallbackEvent event)
          Called before the values are stored from this instance.
 Object unmarshal(Object source)
          Unmarshals an object
 
Methods inherited from class org.openmdx.compatibility.base.marshalling.CachingMarshaller
cache, clear, evict
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Manager_1

public Manager_1(Connection_1_0 interaction)
          throws ServiceException
Constructs a Manager.

Parameters:
interaction - the interaction object to be used by this manager
Throws:
ServiceException
Method Detail

getConnection

public Connection_1_0 getConnection()
Return connection assigned to this manager.


getConnectionFactory

public Connection_1Factory getConnectionFactory()
Description copied from interface: ObjectFactory_1_2
Return this connection's factory

Specified by:
getConnectionFactory in interface ObjectFactory_1_2
Returns:
the corresponding connection factory

hasContainerManagedUnitOfWork

public Boolean hasContainerManagedUnitOfWork()
Container managed units of work are either non transactional or part of a bigger unit of work.

Specified by:
hasContainerManagedUnitOfWork in interface ObjectFactory_1_2
Returns:
the value of the ContainerManaged property.

close

public void close()
           throws ServiceException
Close the basic accessor.

After the close method completes, all methods on the ObjectFactory_1_0 instance except isClosed throw a ILLEGAL_STATE RuntimeServiceException.

Specified by:
close in interface ObjectFactory_1_0
Throws:
ServiceException

getUnitOfWork

public UnitOfWork_1_0 getUnitOfWork()
                             throws ServiceException
Return the unit of work associated with the current basic accessor.

Specified by:
getUnitOfWork in interface ObjectFactory_1_0
Returns:
the unit of work
Throws:
ServiceException - ILLEGAL_STATE if the object factory is closed

getObject

public Object_1_0 getObject(Object accessPath)
                     throws ServiceException
Get an object from the object factory.

If an object with the given acess path is already in the cache it is returned, otherwise a new object is returned.

Specified by:
getObject in interface ObjectFactory_1_0
Parameters:
accessPath - Access path of object to be retrieved.
Returns:
A persistent object
Throws:
ServiceException - ILLEGAL_STATE if the object factory is closed

createObject

public Object_1_0 createObject(String objectClass)
                        throws ServiceException
Create an object

Specified by:
createObject in interface ObjectFactory_1_0
Parameters:
objectClass - The model class of the object to be created
Returns:
an object
Throws:
ServiceException - ILLEGAL_STATE if the object factory is closed

createStructure

public Structure_1_0 createStructure(String type,
                                     List fieldNames,
                                     List fieldValues)
                              throws ServiceException
Create a structure

Specified by:
createStructure in interface ObjectFactory_1_0
Parameters:
type - The type of the structure to be created
fieldNames - The names of the structure's fields
fieldValues - The structure's field values
Returns:
a structure
Throws:
ServiceException - ILLEGAL_STATE if the object factory is closed

createObject

public Object_1_0 createObject(String objectClass,
                               Object_1_0 initialValues)
                        throws ServiceException
This method creates a new object with the initial values.

This method method and its org::openmdx::compatibility::role1 model are deprecated in favour of the org::openmdx::base::RoleCapable class and the $link{ObjectFactory_1_1#createObject(java.lang.String, java.lang.String,Object_1_0) createObject(String,String,Object_1_0)} method.

Specified by:
createObject in interface ObjectFactory_1_0
Specified by:
createObject in interface ObjectFactory_1_1
Throws:
ServiceException
See Also:
Role

createObject

public Object_1_0 createObject(String roleClass,
                               String roleId,
                               Object_1_0 roleCapable)
                        throws ServiceException
This method creates a new role of a RoleCapable object.

Specified by:
createObject in interface ObjectFactory_1_1
Throws:
ServiceException
See Also:
RoleCapable

createMarshalledObject

protected Object createMarshalledObject(Object source)
                                 throws ServiceException
Marshals path objects to Object_1_0 objects.

Specified by:
createMarshalledObject in class CachingMarshaller
Parameters:
source - The object to be marshalled
Returns:
The marshalled object
Throws:
RuntimeServiceException - DATA_CONVERSION: Object can't be marshalled
ServiceException - MARSHAL_FAILURE Object can't be marshalled

marshal

public Object marshal(Object source)
               throws ServiceException
Marshals an object

Specified by:
marshal in interface Marshaller
Overrides:
marshal in class CachingMarshaller
Parameters:
source - The object to be marshalled
Returns:
The marshalled object
Throws:
ServiceException - Object can't be marshalled

unmarshal

public Object unmarshal(Object source)
                 throws ServiceException
Unmarshals an object

Specified by:
unmarshal in interface Marshaller
Specified by:
unmarshal in class CachingMarshaller
Parameters:
source - The marshalled object
Returns:
The unmarshalled object
Throws:
ServiceException - Object can't be unmarshalled

postLoad

public void postLoad(InstanceCallbackEvent event)
              throws ServiceException
Description copied from interface: InstanceCallbackListener
Called after the values are loaded from the data store into this instance.

Derived fields should be initialized in this method. The context in which this call is made does not allow access to other persistent Object_1_0 instances.

Specified by:
postLoad in interface InstanceCallbackListener
Parameters:
event - the instance callback event
Throws:
ServiceException - in case of failure
See Also:
InstanceCallbackEvent.POST_LOAD

preClear

public void preClear(InstanceCallbackEvent event)
              throws ServiceException
Description copied from interface: InstanceCallbackListener
Called before the values in the instance are cleared.

Transient fields should be cleared in this method. Associations between this instance and others in the runtime environment should be cleared.

Specified by:
preClear in interface InstanceCallbackListener
Parameters:
event - the instance callback event
Throws:
ServiceException - in case of failure
See Also:
InstanceCallbackEvent.PRE_CLEAR

preDelete

public void preDelete(InstanceCallbackEvent event)
               throws ServiceException
Description copied from interface: InstanceCallbackListener
Called before the instance is deleted. This method is called before the state transition to persistent-deleted or persistent-new-deleted. Access to field values within this call are valid. Access to field values after this call are disallowed.

Specified by:
preDelete in interface InstanceCallbackListener
Parameters:
event - the instance callback event
Throws:
ServiceException - in case of failure or veto
See Also:
InstanceCallbackEvent.PRE_DELETE

preStore

public void preStore(InstanceCallbackEvent event)
              throws ServiceException
Description copied from interface: InstanceCallbackListener
Called before the values are stored from this instance.

Fields that might have been affected by modified non-persistent fields should be updated in this method.

The context in which this call is made allows access to the ObjectFactory_1_0 instance and other persistent Object_1_0 instances.

Specified by:
preStore in interface InstanceCallbackListener
Parameters:
event - the instance callback event
Throws:
ServiceException - in case of failure or veto
See Also:
InstanceCallbackEvent.PRE_STORE


This software is published under the BSD license. Copyright © 2003-2007, OMEX AG, Switzerland, All rights reserved. Use is subject to license terms.