wt.access
Class AccessSelector

java.lang.Object
  extended bywt.access.AccessSelector
All Implemented Interfaces:
Evolvable, Externalizable, NetFactor, ObjectMappable, Serializable

public class AccessSelector
extends Object
implements ObjectMappable, Evolvable

AccessSelector represents both rule antecendents (in access policy rules) and ACL locators. It is composed of a domain reference, persistent type identifier, and a state name. AccessSelectors can be used to derive QuerySpecification objects that can be used to search for rules or ACLs either by setting a specific domain, type and state or by setting any of these fields to "null," in which case the query returns all objects that match the non-null fileds. The AccessSelector constructor sets the persistent type identifier to the root of the type hierarchy and the state to "ALL". AccessSelector objects can also be obtained from access policies using the getAccessSelector method, effectively using policies as selector factories. In this case, the domain reference is the same as the one of the policy.

Use the newAccessSelector static factory method(s), not the AccessSelector constructor, to construct instances of this class. Instances must be constructed using the static factory(s), in order to ensure proper initialization of the instance.



Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
private static String CLASSNAME
           
static long EXTERNALIZATION_VERSION_UID
           
protected static long OLD_FORMAT_VERSION_UID
           
static String OWNER_REF
          Label for the attribute; Reference to an administartive domain.
private  ObjectReference ownerRef
           
protected static long PRE_R6_VERSION_UID
           
private static String RESOURCE
           
private static String SELECTOR_NAME
          Constant used to create search condition.
(package private) static long serialVersionUID
           
static String STATE_NAME
          Label for the attribute; Name of the state the selector refers to.
private static int STATE_NAME_UPPER_LIMIT
           
private  String stateName
           
static String TYPE_ID
          Label for the attribute; Persistable type identifier of the type the selector refers to.
private static int TYPE_ID_UPPER_LIMIT
           
private  String typeId
           
 
Constructor Summary
AccessSelector()
           
 
Method Summary
 boolean equals(Object obj)
          Determines if the access selector is equal to the object passed as argument.
 ClassInfo getClassInfo()
          Returns the ClassInfo object for this class.
 String getConceptualClassname()
          Deprecated.  
 ObjectReference getOwnerRef()
          Gets the value of the attribute: OWNER_REF.
 QuerySpec getQuerySpec(Class target_class)
          Returns a query specification for the class (AccessPolicyRule or PolicyAcl) passed as argument.
 String getStateName()
          Gets the value of the attribute: STATE_NAME.
 String getTypeId()
          Gets the value of the attribute: TYPE_ID.
 int hashCode()
          Returns the access selector hash code.
protected  boolean hasNullFields()
          Returns true if the selector has a field (ownerRef, typeId or stateName) that is null.
protected  void initialize()
          Supports initialization, following construction of an instance.
protected  void initialize(ObjectReference domain_ref)
          Supports initialization, following construction of an instance.
protected  void initialize(ObjectReference domain_ref, String type_id, String state_name)
          Supports initialization, following construction of an instance.
 boolean isMoreGeneral(AccessSelector sel)
          Returns true if the current selector is more general than the one passed as argument, otherwise returns false.
static AccessSelector newAccessSelector()
          No argument constructor.
static AccessSelector newAccessSelector(ObjectReference domain_ref)
          Constructor that takes a domain reference argument.
static AccessSelector newAccessSelector(ObjectReference domain_ref, String type_id, String state_name)
          Constructor that takes a domain reference, a persistence type identifier, and a state name as arguments.
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
 void readExternal(PersistentRetrieveIfc input)
          Used by Persistent Data Service to populate the persistent attributes of this class from a persistent store.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(AccessSelector thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
 void setOwnerRef(ObjectReference a_OwnerRef)
          Sets the value of the attribute: OWNER_REF.
 void setStateName(String a_StateName)
          Sets the value of the attribute: STATE_NAME.
 void setTypeId(String a_TypeId)
          Sets the value of the attribute: TYPE_ID.
 String toString()
          Returns the conceptual (modeled) name for the class.
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 void writeExternal(PersistentStoreIfc output)
          Used by Persistent Data Service to obtain the values of the persistent attributes of this class, so they can be written to a persistent store.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

TYPE_ID

public static final String TYPE_ID
Label for the attribute; Persistable type identifier of the type the selector refers to. Must be non-null for rules or ACLs or null if the selector is being used to construct a query specification.

Supported API: false

See Also:
Constant Field Values

TYPE_ID_UPPER_LIMIT

private static int TYPE_ID_UPPER_LIMIT

typeId

private String typeId

STATE_NAME

public static final String STATE_NAME
Label for the attribute; Name of the state the selector refers to. Must be non-null for rules or ACLs; can be "ALL" for rules or null if selector is being used to construct query specification.

Supported API: false

See Also:
Constant Field Values

STATE_NAME_UPPER_LIMIT

private static int STATE_NAME_UPPER_LIMIT

stateName

private String stateName

OWNER_REF

public static final String OWNER_REF
Label for the attribute; Reference to an administartive domain. Must be non-null for rules or ACLs or null if selector is being used to construct query specification.

Supported API: false

See Also:
Constant Field Values

ownerRef

private ObjectReference ownerRef

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values

PRE_R6_VERSION_UID

protected static final long PRE_R6_VERSION_UID
See Also:
Constant Field Values

SELECTOR_NAME

private static final String SELECTOR_NAME
Constant used to create search condition. It is required that the classes use this String to refer to the Selector structured attributes that they contain.

See Also:
Constant Field Values
Constructor Detail

AccessSelector

public AccessSelector()
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(AccessSelector thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(PersistentStoreIfc output)
                   throws SQLException,
                          DatastoreException
Used by Persistent Data Service to obtain the values of the persistent attributes of this class, so they can be written to a persistent store.

(Not intended for general use.)

Supported API: false

Specified by:
writeExternal in interface ObjectMappable
Parameters:
output -
Throws:
SQLException
DatastoreException

readExternal

public void readExternal(PersistentRetrieveIfc input)
                  throws SQLException,
                         DatastoreException
Used by Persistent Data Service to populate the persistent attributes of this class from a persistent store.

(Not intended for general use.)

Supported API: false

Specified by:
readExternal in interface ObjectMappable
Parameters:
input -
Throws:
SQLException
DatastoreException

getConceptualClassname

public String getConceptualClassname()
Deprecated.  

Returns the conceptual (modeled) name for the class.

Supported API: false

Specified by:
getConceptualClassname in interface NetFactor
Returns:
String

toString

public String toString()
Returns the conceptual (modeled) name for the class.

Supported API: false

Returns:
String

getClassInfo

public ClassInfo getClassInfo()
                       throws WTIntrospectionException
Returns the ClassInfo object for this class.

Supported API: false

Specified by:
getClassInfo in interface NetFactor
Returns:
ClassInfo
Throws:
WTIntrospectionException

getTypeId

public String getTypeId()
Gets the value of the attribute: TYPE_ID. Persistable type identifier of the type the selector refers to. Must be non-null for rules or ACLs or null if the selector is being used to construct a query specification.

Supported API: false

Returns:
String

setTypeId

public void setTypeId(String a_TypeId)
Sets the value of the attribute: TYPE_ID. Persistable type identifier of the type the selector refers to. Must be non-null for rules or ACLs or null if the selector is being used to construct a query specification.

Supported API: false

Parameters:
a_TypeId -

getStateName

public String getStateName()
Gets the value of the attribute: STATE_NAME. Name of the state the selector refers to. Must be non-null for rules or ACLs; can be "ALL" for rules or null if selector is being used to construct query specification.

Supported API: false

Returns:
String

setStateName

public void setStateName(String a_StateName)
Sets the value of the attribute: STATE_NAME. Name of the state the selector refers to. Must be non-null for rules or ACLs; can be "ALL" for rules or null if selector is being used to construct query specification.

Supported API: false

Parameters:
a_StateName -

getOwnerRef

public ObjectReference getOwnerRef()
Gets the value of the attribute: OWNER_REF. Reference to an administartive domain. Must be non-null for rules or ACLs or null if selector is being used to construct query specification.

Supported API: false

Returns:
ObjectReference

setOwnerRef

public void setOwnerRef(ObjectReference a_OwnerRef)
Sets the value of the attribute: OWNER_REF. Reference to an administartive domain. Must be non-null for rules or ACLs or null if selector is being used to construct query specification.

Supported API: false

Parameters:
a_OwnerRef -

newAccessSelector

public static AccessSelector newAccessSelector()
                                        throws WTException
No argument constructor. Used mainly to formulate queries. After the access selector is constructed, the domain reference is null, the persistence type identifier is set to Selector.TOP_CLASS, and the state to Selector.ALL_STATES.

Supported API: false

Returns:
AccessSelector
Throws:
WTException

initialize

protected void initialize()
                   throws WTException
Supports initialization, following construction of an instance. Invoked by "new" factory having the same signature.

Supported API: false

Throws:
WTException

newAccessSelector

public static AccessSelector newAccessSelector(ObjectReference domain_ref)
                                        throws WTException
Constructor that takes a domain reference argument. After the access selector is constructed, the domain reference is set to the specified value, and the remaining attributes are set to null.

Supported API: false

Parameters:
domain_ref -
Returns:
AccessSelector
Throws:
WTException

initialize

protected void initialize(ObjectReference domain_ref)
                   throws WTException
Supports initialization, following construction of an instance. Invoked by "new" factory having the same signature.

Supported API: false

Parameters:
domain_ref -
Throws:
WTException

newAccessSelector

public static AccessSelector newAccessSelector(ObjectReference domain_ref,
                                               String type_id,
                                               String state_name)
                                        throws WTException
Constructor that takes a domain reference, a persistence type identifier, and a state name as arguments.

Supported API: false

Parameters:
domain_ref -
type_id -
state_name -
Returns:
AccessSelector
Throws:
WTException

initialize

protected void initialize(ObjectReference domain_ref,
                          String type_id,
                          String state_name)
                   throws WTException
Supports initialization, following construction of an instance. Invoked by "new" factory having the same signature.

Supported API: false

Parameters:
domain_ref -
type_id -
state_name -
Throws:
WTException

equals

public boolean equals(Object obj)
Determines if the access selector is equal to the object passed as argument.

Supported API: false

Parameters:
obj -
Returns:
boolean

hashCode

public int hashCode()
Returns the access selector hash code. The hash code is based on the selector string representation.

Supported API: false

Returns:
int

getQuerySpec

public QuerySpec getQuerySpec(Class target_class)
                       throws WTException
Returns a query specification for the class (AccessPolicyRule or PolicyAcl) passed as argument. The result of the query will return all the rules or ACLs that correspond to the non-null fields of the selector. For example, to obtain all rules for a given type, irrespective of the domain and state, the persistent type identifier must be specified and the domain and state set to "null."

Supported API: false

Parameters:
target_class -
Returns:
QuerySpec
Throws:
WTException

isMoreGeneral

public boolean isMoreGeneral(AccessSelector sel)
Returns true if the current selector is more general than the one passed as argument, otherwise returns false. If a rule applies to an object, all rules with more general selectors apply as well. A selector with type1, state1 is more general than a selector with type2, state2 in the following cases: state1 = ALL_STATES and type1 equals type2 state1 = state2 and type1 is a supertype of type2 state1 = ALL_STATES and type1 is a supertype of type2 Note that this relationship is transitive and reflexive but not symmetric.

Supported API: false

Parameters:
sel -
Returns:
boolean

hasNullFields

protected boolean hasNullFields()
Returns true if the selector has a field (ownerRef, typeId or stateName) that is null.

An AccessSelector with null fields can only be used in queries.

Supported API: false

Returns:
boolean