Oracle Entitlements Server for Java API Reference

com.bea.security
Class NamingAuthority

java.lang.Object
  |
  +--com.bea.security.NamingAuthority
Direct Known Subclasses:
DataDrivenAuthority

public abstract class NamingAuthority
extends java.lang.Object

A Naming Authority has two functions. First, it provides a scope for a name, allowing it to be unique within that scope. Second, it defines the format of the name, breaking the name into named fields separated by delimiters.

The scoping functions of the name authority allow two identical names to be recognized as unique. For example:
OrderEntryForm may exist in both a fullfillment application and a point of sales (POS) application. By associating the name OrderEntryForm with the naming authority FULLFILLMENT or the naming authority POS, it can be recognized which actual form is being referenced.

In addition, a name may define fields within itself. In the example above, a form may contain fields, and fields may contain functions and so on. The POS name, then, might be defined as FORMNAME, FIELDNAME, FUNCTION with a delimter of "." (period). This would allow the name OrderEntryForm.name.setText to then be parsed into three name/value pairs FORMNAME=OrderEntryForm, FIELDNAME=name, FUNCTION=setText. By combining authorities, subauthorities, and delimiters into a parse tree, a very flexible way of defining names can be formed.

If through the use of authorities and sub-authorities a name cannot be represented, you may create a custom class to override the methods of this base class and provide custom or optimized parsing.

Author:
Copyright © 2004-2008, Oracle and/or its affiliates. All rights reserved.

Field Summary
protected static boolean cachenames
          A flag to indicate if the naming authority is allowed to cache name parsings.
protected  boolean initialized
          A flag for the Naming Authority Manager to set once this authority's dependencies have been met.
protected static int maxentries
          The maximum number of entries to hold in the LRU cache of this naming authority.
protected  NamingAuthorityManager mgr
          A reference to this authority's Naming Authority Manager.
 
Constructor Summary
NamingAuthority()
           
 
Method Summary
 java.lang.String assembleTokens(java.util.Enumeration namedattrvalues)
          Given an enumeration of NameAttributeValues, assemble this name into a string form.
 boolean equals(java.lang.Object another)
          Determines if this authority is equal to another.
abstract  NameAttributeType[] getAttributeTypes()
          Gets the attributes for this naming authority.
abstract  java.lang.String getAuthorityName()
          Gets the name of this authority.
 java.util.Enumeration getDeepTokenEnumeration(java.lang.String name)
          Tokenizes a name according to this name authority's rules and the rules of its referenced authorities.
abstract  java.lang.String getDelimiters()
          Gets the list of delimiters for this authority.
abstract  java.lang.String[] getDependencies()
          Gets a list of this authority's dependencies.
abstract  int getNumAttributes()
          Gets the number of attributes defined in this naming authority.
 SecurityRuntime getRuntime()
          Gets the runtime associated with this naming authority.
abstract  NamingAuthority[] getSubAuthorities()
          Gets a list of references to sub-authorities provided by this authority for registration.
 java.util.Enumeration getTokenEnumeration(java.lang.String name)
          Tokenizes a name according to this name authority's rules.
static boolean hasSameAuthority(NamedObject one, NamedObject another)
          Determines if two named objects use the same authority.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initialized

protected boolean initialized
A flag for the Naming Authority Manager to set once this authority's dependencies have been met. If a naming authority is not properly initialized, it will not be able to be fetched by the application through the Naming Authority Manager.

cachenames

protected static boolean cachenames
A flag to indicate if the naming authority is allowed to cache name parsings. This is controlled with the system property com.bea.security.naming.cache to enable or disable all naming authority caching.

maxentries

protected static int maxentries
The maximum number of entries to hold in the LRU cache of this naming authority. This is controlled with the system property com.bea.security.naming.maxentries to set this value for all naming authorities.

mgr

protected NamingAuthorityManager mgr
A reference to this authority's Naming Authority Manager. This value is set when this authority has been registered.
Constructor Detail

NamingAuthority

public NamingAuthority()
Method Detail

getDependencies

public abstract java.lang.String[] getDependencies()
Gets a list of this authority's dependencies. An authority is said to have a dependency on another authority when it encodes one or more attributes referencing that authority. Sub-authorities, or authorities that are part of another authority, are not listed as dependencies since the containing authority controls the presence of its own sub-authorities at the time of registration.

Returns:
this authority's dependencies as an array of Strings.

getSubAuthorities

public abstract NamingAuthority[] getSubAuthorities()
Gets a list of references to sub-authorities provided by this authority for registration. Sub-authorites and their parent authority are considered "one piece" and are registered and unregistered atomically.

Returns:
an array of NamingAuthoritys that are sub-athorities for this authority.

getAuthorityName

public abstract java.lang.String getAuthorityName()
Gets the name of this authority.

Returns:
the name of this authority.

getDelimiters

public abstract java.lang.String getDelimiters()
Gets the list of delimiters for this authority.

Returns:
a String whose characters are delimiters for this authority. The first character in this string is said to be the PRIMARY DELIMITER and may be used when adding values programatically to an object that conforms to this naming convention.

getNumAttributes

public abstract int getNumAttributes()
Gets the number of attributes defined in this naming authority.

Returns:
the number of attributes in this authority as an int.

getAttributeTypes

public abstract NameAttributeType[] getAttributeTypes()
Gets the attributes for this naming authority.

Returns:
an array of NameAttributeTypes that define this authority's naming convention.

hasSameAuthority

public static boolean hasSameAuthority(NamedObject one,
                                       NamedObject another)
Determines if two named objects use the same authority. If both objects have no authority, they are considered to have the same authority.

Returns:
true if these two objects share the same authority; otherwise, returns false.

equals

public boolean equals(java.lang.Object another)
Determines if this authority is equal to another. It is equal if it has the same name, same delimiters, same number of attributes with the same attribute names and same references to other authorities, and the same Naming Authority Manager.

Returns:
true if this naming authority is equal to the other; otherwise, returns false.
Overrides:
equals in class java.lang.Object

getTokenEnumeration

public java.util.Enumeration getTokenEnumeration(java.lang.String name)
Tokenizes a name according to this name authority's rules. Given a string, this function breaks that string into a number of fields or "attributes" as determined by this authority's naming convention. This is a shallow enumeration, which means that references to other authorites are not resolved in this method.

Parameters:
name - a name that conforms to this naming authority's conventions.
Returns:
an enumeration of NameAttributeValues that contains the type information, sub-authority information, name, and value for the attributes within this name.

getDeepTokenEnumeration

public java.util.Enumeration getDeepTokenEnumeration(java.lang.String name)
Tokenizes a name according to this name authority's rules and the rules of its referenced authorities. Given a string, this function breaks that string into a number of fields or "attributes" as determined by this authority's naming convention. This is a deep enumeration, which means that references to other authorites are resolved recursively in this method.

Parameters:
name - a name that conforms to this naming authority's conventions.
Returns:
an enumeration of NameAttributeValues which contain the type information, the sub-authority information, and the value for the attributes within this name.

assembleTokens

public java.lang.String assembleTokens(java.util.Enumeration namedattrvalues)
Given an enumeration of NameAttributeValues, assemble this name into a string form.

If the enumeration is a shallow enumeration, it is recursively assembled into a string using the PRIMARY DELMITERS of the naming authorities, therefore, taking a form which can then be reparsed into the original name/value enumeration that was originally presented. In this way a name can be enumerated, assembled and enumerated again and again, always getting the same values.

If the enumeration is a deep enumeration, the name is assembled using only the PRIMARY DELIMITER of the original naming authority. Whereas this can unify a name to use only one delimiter, the resuling string will not conform to the naming specification of the original naming authority.

Parameters:
namedattrvalues - an enumeration of NameAttributeValues to assemble into a String representation of the name.
Returns:
a String representation of the name.

getRuntime

public SecurityRuntime getRuntime()
Gets the runtime associated with this naming authority.