Objectivity for Java Reference

com.objy.db.app
Interface ClusterReason


public interface ClusterReason

Defines constants that indicate the reason an object is being clustered, as well as behavior shared by all cluster reasons.

A clustering reason indicates why an object is being clustered. A clustering reason is used as a parameter to the requestCluster method of a clustering strategy or the requestCluster method of a session; another parameter to the method specifies the requesting object, that is, the object requesting that another object be clustered.

You should implement this interface in a class you define if you ever make direct calls to a requestCluster method. You should pass an object of your class as the reason parameter in every direct call to requestCluster.

When you implement this interface, the getReason method of your class should always return the constant APPLICATION to indicate an application-specific reason for clustering the object. If objects of your class will be used with an application-specific clustering strategy, your class may include whatever additional fields and methods are needed by the clustering strategy. (The default clustering strategy ignores the clustering reason.) For additional information about clustering strategies, see Implicit Clustering.

You can define as many clustering reason classes as your application needs.
Constant Types
Clustering reasons
    Specify why an object is being made persistent.
APPLICATION
BIND
COLLECTION
NAMEOBJ
REFERENCE
RELATIONSHIP


Field Summary
static int APPLICATION
          Cluster reason: An object is being made persistent for some application-specific reason, that is, by a direct call to requestCluster.
static int BIND
          Cluster reason: An object is being made persistent because it was given a root name in the roots dictionary of the requesting object.
static int COLLECTION
          Cluster reason: An object is being made persistent because it was added to a persistent collection (the requesting object).
static int NAMEOBJ
          Cluster reason: An object is being made persistent because it was given a scope name in the scope of the requesting object.
static int REFERENCE
          Cluster reason: An object is being made persistent because the requesting object references it in a persistent field and the requesting object is being written to the database.
static int RELATIONSHIP
          Cluster reason: An object is being made persistent because the requesting object has formed a relationship with it.
 
Method Summary
 int getReason()
          Gets the reason for making an object persistent.
 

Field Detail

APPLICATION

public static final int APPLICATION
Cluster reason: An object is being made persistent for some application-specific reason, that is, by a direct call to requestCluster.

REFERENCE

public static final int REFERENCE
Cluster reason: An object is being made persistent because the requesting object references it in a persistent field and the requesting object is being written to the database.

BIND

public static final int BIND
Cluster reason: An object is being made persistent because it was given a root name in the roots dictionary of the requesting object.

RELATIONSHIP

public static final int RELATIONSHIP
Cluster reason: An object is being made persistent because the requesting object has formed a relationship with it.

NAMEOBJ

public static final int NAMEOBJ
Cluster reason: An object is being made persistent because it was given a scope name in the scope of the requesting object.

COLLECTION

public static final int COLLECTION
Cluster reason: An object is being made persistent because it was added to a persistent collection (the requesting object).
Method Detail

getReason

public int getReason()
Gets the reason for making an object persistent.
Returns:
The reason represented by this object; one of the following constants defined in this interface:
BIND
The object was made a named root.
NAMEOBJ
The object was given a scope name.
RELATIONSHIP
A relationship was formed to the object.
REFERENCE
The object is referenced by an object being written to the database.
COLLECTION
The object was added to a persistent collection.
APPLICATION
The application made a direct call to requestCluster.

Objectivity for Java Reference

Copyright © 2000 Objectivity, Inc. All rights reserved.