com.artima.place.attribute
Class Roles

java.lang.Object
  |
  +--com.artima.place.attribute.Roles
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Roles
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

A mapping of String service UI role interface names to Name objects, one of which is identified as the default role.

The roles Map contained in instances of this object is a mapping of String role interface name keys (such as "net.jini.lookup.ui.AdminUI") to Name objects containing localized Strings (likely verbs such as "Administer") that represent the meaning of the roles. This map must contain as a key the default role string. Therefore, the map must contain at least one key value pair, and if it contains only one key-value pair, the key will definitely be the default role.

The default role is the service UI role which should be presented to the user if the corresponding Link, (i.e., the Link contained in the LinkItem in whose attributes this Roles object appears) is activated. For example, if the default role is "net.jini.lookup.ui.AboutUI", then the LinkItem in whose attributes this Roles appears represents a link to an about UI for a service.

For example, a Roles object could map the following role interface name Strings (shown in the left column) to Name objects containing the localized English Strings (shown in the right column):

Role Interface English Verb
net.jini.lookup.ui.MainUI Open
net.jini.lookup.ui.AdminUI Administer
net.jini.lookup.ui.AboutUI About
com.artima.some.funky.UIRole Funkify

In this example, net.jini.looup.ui.MainUI could be indentified as the default role.

See Also:
Serialized Form

Constructor Summary
Roles(java.util.Map rolesMap, java.lang.String defaultRole)
          Constructs a new Roles with passed roles map and default role.
 
Method Summary
 java.lang.String getDefaultRole()
          Returns the default role interface name String contained in this Roles.
 java.util.Map getRolesMap()
          Returns the roles Map contained in this Roles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Roles

public Roles(java.util.Map rolesMap,
             java.lang.String defaultRole)
Constructs a new Roles with passed roles map and default role.

The rolesMap is a mapping of String role interface name keys (such as "net.jini.lookup.ui.AdminUI") to Name objects containing localized Strings (likely verbs such as "Administer") that represent the meaning of the roles. This map must contain as a key the default role string. Therefore, the map must contain at least one key value pair, and if it contains only one key-value pair, the key will definitely be the default role.

The default role is the service UI role which should be presented to the user if the corresponding Link, (i.e., the Link contained in the LinkItem in whose attributes this Roles object appears) is activated. For example, if the default role is "net.jini.lookup.ui.AboutUI", then the LinkItem in whose attributes this Roles appears represents a link to an about UI for a service.

Parameters:
rolesMap - a Map containing role interface name String keys mapped to Name values.
defaultRole - the role interface name String, which must appear as a key in the passed rolesMap, which represents the default role.
Throws:
NullPointerException - if either of the passed rolesMap or defaultRole references are null
Method Detail

getRolesMap

public java.util.Map getRolesMap()
Returns the roles Map contained in this Roles. The roles Map is a mapping of role interface name String keys to localized Name (likely verbs) values.
Returns:
the roles Map.

getDefaultRole

public java.lang.String getDefaultRole()
Returns the default role interface name String contained in this Roles.
Returns:
the default role interface name String.