Skip navigation links

Oracle Fusion Middleware
Java API Reference for Oracle WebLogic Server
12c (12.2.1)

Part Number E55141-01
P4 Change 1723563 on 2015/10/09


weblogic.security.service
Class ResourceBase

java.lang.Object
  extended by weblogic.security.service.ResourceBase

All Implemented Interfaces:
Serializable, Resource, SelfDescribingResource, SelfDescribingResourceV2
Direct Known Subclasses:
AdminResource, ApplicationResource, COMResource, ControlResource, EISResource, EJBResource, JDBCResource, JMSResource, JMXResource, JNDIResource, RemoteResource, ServerResource, URLResource, WebServiceResource, WorkContextResource

public abstract class ResourceBase
extends Object
implements SelfDescribingResourceV2

The ResourceBase class is an abstract base class for all the specific resource types and facilitates the model for the extending resources. Each resource is represented by its type and a set of attributes, and each instance is identified by a unique long identifier that is computed with a hash function from the resource type and the attributes.

The ResourceBase class contains the BEA-provided implementations of the getKeys, getFields, getID, and toString methods.

The ResourceBase class contains an array of values for which the extending classes are expected to provide a corresponding array of keys. (See the getkeys methods in each extending class for more information).

See Also:
Serialized Form

Field Summary
protected  long id
          Resource long hashcode.
protected  int length
          The valid length of the values array.
protected static Resource NO_PARENT
           
protected  Resource parent
           
protected  String resStr
           
protected static boolean SCOPE_RESOURCE_ACTION
           
protected  String[] values
          The array of values for which the extending classes are expected to provide a corresponding array of keys.

 

Fields inherited from interface weblogic.security.spi.SelfDescribingResource
LIST_FIELD_TYPE, NORMAL_FIELD_TYPE, PATH_FIELD_TYPE, UNDEFINED_FIELD_TYPE

 

Method Summary
protected static StringBuffer appendArrayValue(StringBuffer buf, String[] values, int len)
          Appends the array of values to the buffer as a comma-separated list of values in curly parentheses.
protected static StringBuffer appendValue(StringBuffer buf, String value)
          Appends the value to the buffer, escaping special characters with '\' and treating null strings as empty strings.
 boolean equals(Object obj)
          Compares this resource to the resource in the specified object.
 int getFieldType(String fieldName)
          Describe getFieldType method here.
 long getID()
          Gets a 64-bit hashcode for a resource.
abstract  String[] getKeys()
          Gets keys for the resource.
 Resource getParentResource()
          Gets a Resource object that represents the parent of the current resource.
 int getRepeatingFieldIndex()
          getRepeatingFieldIndex returns an index into the array returned by getKeys() that signifies what part of the Resource's fields repeat as the hierarchy is traversed.
 int getRepeatingFieldTerminatingIndex()
          The field returned by getRepeatingFieldIndex is repeated as the Resource is shortened up to and including this field index.
 String[] getValues()
          Gets the values corresponding to the keys of this resource's type.
 int hashCode()
          Returns an identifier for the resource as a hash code.
protected  void init(String[] values, int len, long seed)
          Initializes the resource with the array of values, and computes the resource ID as a hash function of the resource type and each of its non-null values.
protected  void init(String[] values, long seed)
          Initializes the resource with the array of values.
 boolean isTransitiveField(String fieldName)
          Returns true when the specified field name is a transitive field.
protected  Resource makeParent()
          Creates a ResourceBase object that represents the parent of the current resource.
 String toString()
          Returns a string representation of the resource.
protected  void writeResourceString(StringBuffer buf)
          Writes a string representation of the resource to buffer.

 

Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

 

Methods inherited from interface weblogic.security.spi.Resource
getType

 

Field Detail

SCOPE_RESOURCE_ACTION

protected static final boolean SCOPE_RESOURCE_ACTION

NO_PARENT

protected static final Resource NO_PARENT

parent

protected Resource parent

resStr

protected String resStr

values

protected String[] values
The array of values for which the extending classes are expected to provide a corresponding array of keys.

length

protected int length
The valid length of the values array. This variable eliminates the need to make copies to shorter arrays.

id

protected long id
Resource long hashcode.

Method Detail

equals

public boolean equals(Object obj)
Compares this resource to the resource in the specified object.
Specified by:
equals in interface Resource
Overrides:
equals in class Object
Parameters:
obj - the other resource with which to compare this resource.
Returns:
TRUE if the resource passed in matches this resource, and FALSE otherwise.
See Also:
Object.equals(Object)

toString

public String toString()
Returns a string representation of the resource.

Each type of resource is first printed in angled brackets. Then, each key is printed, in order, along with it's value. The keys are comma-separated. Values that are lists are comma-separated and delineated by open and close curly braces. Each value is printed as is, except that commas (,), open braces ({), close braces (}), and back slashes (\) are each escaped with a backslash.

For more information about the toString formats for specific resource types, see the descriptions in the extending classes.

Note: Because this method produces a result based on the concatenation of strings, it may be expensive in terms of performance.

Specified by:
toString in interface Resource
Overrides:
toString in class Object
Returns:
the resource, represented as a String.

writeResourceString

protected void writeResourceString(StringBuffer buf)
Writes a string representation of the resource to buffer.

Subclasses should override this method if their string representation is different.

Parameters:
buf - buffer to write to.

getParentResource

public Resource getParentResource()
Gets a Resource object that represents the parent of the current resource. If the resource does not have a parent, the value of null must be returned.
Specified by:
getParentResource in interface Resource
Returns:
the Resource object of the parent resource.

makeParent

protected Resource makeParent()
Creates a ResourceBase object that represents the parent of the current resource. If the resource does not have a parent, the value of null must be returned.

Subclasses should override this method.

Returns:
the Resource object of the parent resource.

getID

public long getID()
Gets a 64-bit hashcode for a resource.

This method is a hash operation that is calculated and cached within the resource itself. Note: This method is not guaranteed between service packs or future releases. Therefore, you should not store getID values in your database.

Specified by:
getID in interface Resource
Returns:
the ID value for the resource, represented as a long.

hashCode

public int hashCode()
Description copied from interface: Resource
Returns an identifier for the resource as a hash code.
Specified by:
hashCode in interface Resource
Overrides:
hashCode in class Object
Returns:
the hashcode value for the resource.
See Also:
Object.hashCode()

getKeys

public abstract String[] getKeys()
Gets keys for the resource.
Specified by:
getKeys in interface Resource
Returns:
an array of Strings containing the resource's keys.

getFieldType

public int getFieldType(String fieldName)
Description copied from interface: SelfDescribingResource
Describe getFieldType method here.
Specified by:
getFieldType in interface SelfDescribingResource
Parameters:
fieldName - the String name of the field being queried.
Returns:
the int field type of fieldName

getRepeatingFieldIndex

public int getRepeatingFieldIndex()
Description copied from interface: SelfDescribingResource
getRepeatingFieldIndex returns an index into the array returned by getKeys() that signifies what part of the Resource's fields repeat as the hierarchy is traversed. For example, in the URLResource, the httpMethod is repeated as the hierarchy is walked. A value of -1 indicates that there are no repeating fields.
Specified by:
getRepeatingFieldIndex in interface SelfDescribingResource
Returns:
the index of the repeating fields or -1 if none

getRepeatingFieldTerminatingIndex

public int getRepeatingFieldTerminatingIndex()
Description copied from interface: SelfDescribingResource
The field returned by getRepeatingFieldIndex is repeated as the Resource is shortened up to and including this field index. After this field index the repetition is no longer applied.
Specified by:
getRepeatingFieldTerminatingIndex in interface SelfDescribingResource
Returns:
an int describing the terminating index or getKeys().length if none

isTransitiveField

public boolean isTransitiveField(String fieldName)
Description copied from interface: SelfDescribingResourceV2
Returns true when the specified field name is a transitive field. When the transitive field value is null the field name is not included into the resource id.
Specified by:
isTransitiveField in interface SelfDescribingResourceV2

getValues

public String[] getValues()
Gets the values corresponding to the keys of this resource's type. This array may be shorter than the array returned by getKeys, because the latter depends only on the type of the resource.

This returns a copy of the original array so copying and modifying the return value will have no affect on the Resource.

If the Resource has no non-null values then this will return an array of zero lenght.

Specified by:
getValues in interface Resource
Returns:
a potentially zero-length array of Strings representing the keys' values for the resource.

appendValue

protected static StringBuffer appendValue(StringBuffer buf,
                                          String value)
Appends the value to the buffer, escaping special characters with '\' and treating null strings as empty strings.
Parameters:
buf - StringBuffer to which the value should be appended.
value - the string value to append to the StringBuffer.
Returns:
StringBuffer with appended values.

appendArrayValue

protected static StringBuffer appendArrayValue(StringBuffer buf,
                                               String[] values,
                                               int len)
Appends the array of values to the buffer as a comma-separated list of values in curly parentheses.
Parameters:
buf - StringBuffer to which the value should be appended.
values - the array of string values to append to the StringBuffer.
len - the number of values from the array that should be appended.
Returns:
StringBuffer with appended values.

init

protected void init(String[] values,
                    long seed)
Initializes the resource with the array of values.
Parameters:
values - the array of string values with which the resource should be initialized.
seed - the seed for the hash function.

init

protected void init(String[] values,
                    int len,
                    long seed)
Initializes the resource with the array of values, and computes the resource ID as a hash function of the resource type and each of its non-null values.
Parameters:
values - the array of string values with which the resource should be initialized.
len - the number of values from the array that apply to this resource.
seed - the seed for the hash function.

Skip navigation links

Copyright 1996, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Oracle Fusion Middleware
Java API Reference for Oracle WebLogic Server
12c (12.2.1)

Part Number E55141-01
P4 Change 1723563 on 2015/10/09