org.openmdx.base.accessor.generic.spi
Class AbstractObject_1

java.lang.Object
  extended by org.openmdx.base.accessor.generic.spi.AbstractObject_1
All Implemented Interfaces:
Object_1_0

public class AbstractObject_1
extends Object
implements Object_1_0

Abstract Object_1_0 implementation


Field Summary
protected  Set dirty
           
protected  Path identity
           
protected  String objectClass
           
protected  short state
           
 
Constructor Summary
protected AbstractObject_1(Path identity, String objectClass)
           
 
Method Summary
protected static Object defaultFetchGroupToString(Object_1_0 source)
           
protected  BasicException.Parameter[] getExceptionParameters()
           
protected  BasicException.Parameter[] getExceptionParameters(BasicException.Parameter[] extension)
           
 void objAddEventListener(String feature, EventListener listener)
          Add an event listener.
 void objAddToUnitOfWork()
          After this call the object observes unit of work boundaries.
 Object_1_0 objCopy(FilterableMap there, String criteria)
          The copy operation makes a copy of the object.
 Set objDefaultFetchGroup()
          Returns a new set containing the names of the features in the default fetch group.
protected  void objFireInstanceCallbackEvent(short type)
          Fire an instance callback
 boolean objFlush()
          Flush the state of the instance to its provider.
 String objGetClass()
          Returns the object's model class.
 FilterableMap objGetContainer(String feature)
          Get a reference feature.
 EventListener[] objGetEventListeners(String feature, Class listenerType)
          Get event listeners.
 LargeObject_1_0 objGetLargeObject(String feature)
          Get a large object feature
 List objGetList(String feature)
          Get a List attribute.
 Path objGetPath()
          Returns the object's access path.
 Object objGetResourceIdentifier()
          Returns the object's access path.
 Set objGetSet(String feature)
          Get a Set attribute.
 SortedMap objGetSparseArray(String feature)
          Get a SparseArray attribute.
 Object objGetValue(String feature)
          Get a single-valued attribute.
 Structure_1_0 objInvokeOperation(String operation, Structure_1_0 arguments)
          Invokes an operation synchronously.
 Structure_1_0 objInvokeOperationInUnitOfWork(String operation, Structure_1_0 arguments)
          Invokes an operation asynchronously.
 boolean objIsDeleted()
          Tests whether this object has been deleted.
 boolean objIsDirty()
          Tests whether this object is dirty.
 boolean objIsInUnitOfWork()
          Tests whether this object belongs to the current unit of work.
 boolean objIsNew()
          Tests whether this object has been newly made persistent.
 boolean objIsPersistent()
          Tests whether this object is persistent.
 void objMakeVolatile()
          Mark an object as volatile, i.e POST_RELOAD InstanceCallbackEvents may be fired.
 void objMove(FilterableMap there, String criteria)
          The move operation moves the object to the scope of the container passed as the first parameter.
 void objRefresh()
          Refresh the state of the instance from its provider.
 void objRegisterSynchronization(InstanceCallbacks_1_0 synchronization)
          Deprecated. use addEventListener(String,EventListener) instead
 void objRemove()
          Removes an object.
 void objRemoveEventListener(String feature, EventListener listener)
          Remove an event listener.
 void objRemoveFromUnitOfWork()
          After this call the object ignores unit of work boundaries.
 void objSetValue(String feature, Object to)
          Set an attribute's value.
 void propertyChange(PropertyChangeEvent event)
           
protected  void setValue(String feature, Object to)
           
protected static String stateToString(Object_1_0 source)
           
 String toString()
           
static String toString(Object_1_0 source, String objectClass, String description)
          Create a String representation of an Object_1_0 instance
 void vetoableChange(PropertyChangeEvent event)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

state

protected short state

identity

protected Path identity

objectClass

protected String objectClass

dirty

protected final Set dirty
Constructor Detail

AbstractObject_1

protected AbstractObject_1(Path identity,
                           String objectClass)
Method Detail

objGetPath

public Path objGetPath()
Description copied from interface: Object_1_0
Returns the object's access path.

Specified by:
objGetPath in interface Object_1_0
Returns:
the object's access path; or null for transient objects
See Also:

While in general an Object implementing Object_1_0 is allowed to throw a ServiceException for status requests, the AbstractObject_1 does not include them in its statsu method declarations.


objGetResourceIdentifier

public Object objGetResourceIdentifier()
Returns the object's access path.

Specified by:
objGetResourceIdentifier in interface Object_1_0
Returns:
the object's access path; or null for transient or new objects

objDefaultFetchGroup

public Set objDefaultFetchGroup()
                         throws ServiceException
Description copied from interface: Object_1_0
Returns a new set containing the names of the features in the default fetch group.

The returned set is a copy of the original set, i.e. interceptors are free to modify it before passing it on.

Specified by:
objDefaultFetchGroup in interface Object_1_0
Returns:
the names of the features in the default fetch group
Throws:
ServiceException - if the information is unavailable

objGetClass

public String objGetClass()
Description copied from interface: Object_1_0
Returns the object's model class.

Specified by:
objGetClass in interface Object_1_0
Returns:
the object's model class

objAddToUnitOfWork

public void objAddToUnitOfWork()
                        throws ServiceException
Description copied from interface: Object_1_0
After this call the object observes unit of work boundaries.

This method is idempotent.

Specified by:
objAddToUnitOfWork in interface Object_1_0
Throws:
ServiceException - ILLEGAL_STATE if the object is locked

objRemoveFromUnitOfWork

public void objRemoveFromUnitOfWork()
                             throws ServiceException
Description copied from interface: Object_1_0
After this call the object ignores unit of work boundaries.

This method is idempotent.

Specified by:
objRemoveFromUnitOfWork in interface Object_1_0
Throws:
ServiceException - ILLEGAL_STATE if the object is dirty.

objIsDirty

public boolean objIsDirty()
Description copied from interface: Object_1_0
Tests whether this object is dirty. Instances that have been modified, deleted, or newly made persistent in the current unit of work return true.

Transient instances return false.

Specified by:
objIsDirty in interface Object_1_0
Returns:
true if this instance has been modified in the current unit of work.

objIsPersistent

public boolean objIsPersistent()
Description copied from interface: Object_1_0
Tests whether this object is persistent. Instances that represent persistent objects in the data store return true.

Specified by:
objIsPersistent in interface Object_1_0
Returns:
true if this instance is persistent.

objIsNew

public boolean objIsNew()
Description copied from interface: Object_1_0
Tests whether this object has been newly made persistent. Instances that have been made persistent in the current unit of work return true.

Transient instances return false.

Specified by:
objIsNew in interface Object_1_0
Returns:
true if this instance was made persistent in the current unit of work.

objIsDeleted

public boolean objIsDeleted()
Description copied from interface: Object_1_0
Tests whether this object has been deleted. Instances that have been deleted in the current unit of work return true. Transient instances return false.

Specified by:
objIsDeleted in interface Object_1_0
Returns:
true if this instance was deleted in the current unit of work.

objIsInUnitOfWork

public boolean objIsInUnitOfWork()
Tests whether this object belongs to the current unit of work.

Specified by:
objIsInUnitOfWork in interface Object_1_0
Returns:
true if this instance belongs to the current unit of work.

While in general an Object implementing Object_1_0 is allowed to throw a ServiceException for status requests, the AbstractObject_1 does not include them in its statsu method declarations.


getExceptionParameters

protected BasicException.Parameter[] getExceptionParameters()

getExceptionParameters

protected BasicException.Parameter[] getExceptionParameters(BasicException.Parameter[] extension)

objRefresh

public void objRefresh()
                throws ServiceException
Description copied from interface: Object_1_0
Refresh the state of the instance from its provider.

Specified by:
objRefresh in interface Object_1_0
Throws:
ServiceException - if the object can't be synchronized

objFlush

public boolean objFlush()
                 throws ServiceException
Description copied from interface: Object_1_0
Flush the state of the instance to its provider.

Specified by:
objFlush in interface Object_1_0
Returns:
true if all attributes could be flushed, false if some attributes contained placeholders
Throws:
ServiceException - NOT_SUPPORTED if the unit of work is optimistic

objMakeVolatile

public void objMakeVolatile()
                     throws ServiceException
Description copied from interface: Object_1_0
Mark an object as volatile, i.e POST_RELOAD InstanceCallbackEvents may be fired.

Specified by:
objMakeVolatile in interface Object_1_0
Throws:
ServiceException - if the object can't be made volatile.

objCopy

public Object_1_0 objCopy(FilterableMap there,
                          String criteria)
                   throws ServiceException
Description copied from interface: Object_1_0
The copy operation makes a copy of the object. The copy is located in the scope of the container passed as the first parameter and includes the object's default fetch set.

Specified by:
objCopy in interface Object_1_0
Parameters:
there - the new object's container or null, in which case the object will not belong to any container until it is moved to a container.
criteria - The criteria is used to add the object to the container or null, in which case it is up to the implementation to define the criteria.
Returns:
an object initialized from the existing object.
Throws:
ServiceException - if the copy operation fails.

objMove

public void objMove(FilterableMap there,
                    String criteria)
             throws ServiceException
Description copied from interface: Object_1_0
The move operation moves the object to the scope of the container passed as the first parameter. The object remains valid after move has successfully executed.

Specified by:
objMove in interface Object_1_0
Parameters:
there - the object's new container.
criteria - The criteria is used to move the object to the container or null, in which case it is up to the implementation to define the criteria.
Throws:
ServiceException - ILLEGAL_STATE if the object is persistent.

objRemove

public void objRemove()
               throws ServiceException
Description copied from interface: Object_1_0
Removes an object.

Neither getValue() nor setValue() calls are allowed after an remove() invocation and isDeleted() will return true unless the object has been transient.

Specified by:
objRemove in interface Object_1_0
Throws:
ServiceException - NOT_SUPPORTED If the object refuses to be removed.

setValue

protected void setValue(String feature,
                        Object to)
                 throws ServiceException
Throws:
ServiceException

objSetValue

public void objSetValue(String feature,
                        Object to)
                 throws ServiceException
Description copied from interface: Object_1_0
Set an attribute's value.

This method returns a BAD_PARAMETER exception unless the feature is single valued or a stream.

Specified by:
objSetValue in interface Object_1_0
Parameters:
feature - the attribute's name
to - the object.
Throws:
ServiceException - ILLEGAL_STATE if the object is write protected

objGetValue

public Object objGetValue(String feature)
                   throws ServiceException
Description copied from interface: Object_1_0
Get a single-valued attribute.

This method returns a BAD_PARAMETER exception unless the feature is single valued or a stream.

Specified by:
objGetValue in interface Object_1_0
Parameters:
feature - the feature's name
Returns:
the object representing the feature; or null if the feature's value hasn't been set yet.
Throws:
ServiceException - BAD_MEMBER_NAME if the object has no such feature

objGetList

public List objGetList(String feature)
                throws ServiceException
Description copied from interface: Object_1_0
Get a List attribute.

This method never returns null as an instance of the requested class is created on demand if it hasn't been set yet.

Specified by:
objGetList in interface Object_1_0
Parameters:
feature - The feature's name.
Returns:
a collection which may be empty but never null.
Throws:
ServiceException - ILLEGAL_STATE if the object is deleted

objGetSet

public Set objGetSet(String feature)
              throws ServiceException
Description copied from interface: Object_1_0
Get a Set attribute.

This method never returns null as an instance of the requested class is created on demand if it hasn't been set yet.

Specified by:
objGetSet in interface Object_1_0
Parameters:
feature - The feature's name.
Returns:
a collection which may be empty but never null.
Throws:
ServiceException - ILLEGAL_STATE if the object is deleted

objGetSparseArray

public SortedMap objGetSparseArray(String feature)
                            throws ServiceException
Description copied from interface: Object_1_0
Get a SparseArray attribute.

This method never returns null as an instance of the requested class is created on demand if it hasn't been set yet.

Specified by:
objGetSparseArray in interface Object_1_0
Parameters:
feature - The feature's name.
Returns:
a collection which may be empty but never null.
Throws:
ServiceException - ILLEGAL_STATE if the object is deleted

objGetLargeObject

public LargeObject_1_0 objGetLargeObject(String feature)
                                  throws ServiceException
Description copied from interface: Object_1_0
Get a large object feature

This method returns a new LargeObject.

Specified by:
objGetLargeObject in interface Object_1_0
Parameters:
feature - The feature's name.
Returns:
a large object which may be empty but never is null.
Throws:
ServiceException - ILLEGAL_STATE if the object is deleted

objGetContainer

public FilterableMap objGetContainer(String feature)
                              throws ServiceException
Description copied from interface: Object_1_0
Get a reference feature.

This method never returns null as an instance of the requested class is created on demand if it hasn't been set yet.

Specified by:
objGetContainer in interface Object_1_0
Parameters:
feature - The feature's name.
Returns:
a collection which may be empty but never null.
Throws:
ServiceException - ILLEGAL_STATE if the object is deleted

objInvokeOperation

public Structure_1_0 objInvokeOperation(String operation,
                                        Structure_1_0 arguments)
                                 throws ServiceException
Description copied from interface: Object_1_0
Invokes an operation synchronously.

Only query operations can be invoked synchronously unless the unit of work is non-optimistic or committing. Such queries use the object states at the beginning of the unit of work!

Specified by:
objInvokeOperation in interface Object_1_0
Parameters:
operation - The operation name
arguments - The operation's arguments
Returns:
the operation's return values
Throws:
ServiceException - ILLEGAL_STATE if a non-query operation is called in an inappropriate state of the unit of work.

objInvokeOperationInUnitOfWork

public Structure_1_0 objInvokeOperationInUnitOfWork(String operation,
                                                    Structure_1_0 arguments)
                                             throws ServiceException
Description copied from interface: Object_1_0
Invokes an operation asynchronously.

Such asynchronous operations will be invoked at the very end of an optimistic unit of work, i.e. after all modifications at object and attribute level.

Specified by:
objInvokeOperationInUnitOfWork in interface Object_1_0
Parameters:
operation - The operation name
arguments - The operation's arguments
Returns:
a structure with the result's values if the accessor is going to populate it after the unit of work has committed or null if the operation's return value(s) will never be available to the accessor.
Throws:
ServiceException - ILLEGAL_STATE if no unit of work is in progress

objAddEventListener

public void objAddEventListener(String feature,
                                EventListener listener)
                         throws ServiceException
Description copied from interface: Object_1_0
Add an event listener.

Specified by:
objAddEventListener in interface Object_1_0
Parameters:
feature - restrict the listener to this feature; or null if the listener is interested in all features
listener - the event listener to be added

It is implementation dependent whether the feature name is verified or not.

Throws:
ServiceException - BAD_MEMBER_NAME if the object has no such feature or if a non-null feature name is specified for an instance level event

objRemoveEventListener

public void objRemoveEventListener(String feature,
                                   EventListener listener)
                            throws ServiceException
Description copied from interface: Object_1_0
Remove an event listener.

It is implementation dependent whether feature name and listener class are verified.

Specified by:
objRemoveEventListener in interface Object_1_0
Parameters:
feature - the name of the feature that was listened on, or null if the listener is interested in all features
listener - the event listener to be removed
Throws:
ServiceException - BAD_MEMBER_NAME if the object has no such feature or if a non-null feature name is specified for an instance level event

objGetEventListeners

public EventListener[] objGetEventListeners(String feature,
                                            Class listenerType)
                                     throws ServiceException
Description copied from interface: Object_1_0
Get event listeners.

The feature argument is ignored for listeners registered with a null feature argument.

It is implementation dependent whether feature name and listener type are verified.

Specified by:
objGetEventListeners in interface Object_1_0
Parameters:
feature - the name of the feature that was listened on, or null for listeners interested in all features
listenerType - the type of the event listeners to be returned
Returns:
an array of listenerType containing the matching event listeners
Throws:
ServiceException - BAD_MEMBER_NAME if the object has no such feature or if a non-null feature name is specified for an instance level event

objFireInstanceCallbackEvent

protected void objFireInstanceCallbackEvent(short type)
                                     throws ServiceException
Fire an instance callback

Parameters:
type -
Throws:
ServiceException

objRegisterSynchronization

public void objRegisterSynchronization(InstanceCallbacks_1_0 synchronization)
                                throws ServiceException
Deprecated. use addEventListener(String,EventListener) instead

Register a synchronization object for upward delegation.

Specified by:
objRegisterSynchronization in interface Object_1_0
Parameters:
synchronization - The synchronization object to be registered
Throws:
ServiceException - TOO_MANY_EVENT_LISTENERS if an attempt is made to register more than one synchronization object.

propertyChange

public void propertyChange(PropertyChangeEvent event)

vetoableChange

public void vetoableChange(PropertyChangeEvent event)
                    throws PropertyVetoException
Throws:
PropertyVetoException

stateToString

protected static String stateToString(Object_1_0 source)

defaultFetchGroupToString

protected static Object defaultFetchGroupToString(Object_1_0 source)

toString

public static String toString(Object_1_0 source,
                              String objectClass,
                              String description)
Create a String representation of an Object_1_0 instance

Parameters:
source -
objectClass -
description -
Returns:

toString

public String toString()
Overrides:
toString in class Object


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