001: /**
002: * $Id: AttributeHandler.java,v 1.7 2005/05/17 01:37:19 pd109850 Exp $
003: * Copyright 2004 Sun Microsystems, Inc. All
004: * rights reserved. Use of this product is subject
005: * to license terms. Federal Acquisitions:
006: * Commercial Software -- Government Users
007: * Subject to Standard License Terms and
008: * Conditions.
009: *
010: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011: * are trademarks or registered trademarks of Sun Microsystems,
012: * Inc. in the United States and other countries.
013: */package com.sun.portal.fabric.common;
014:
015: import java.util.List;
016: import java.util.Map;
017: import com.sun.portal.admin.common.PSMBeanException;
018:
019: /**
020: * This interface needs to be implementing by all component specific
021: * attribute handlers.
022: */
023: public interface AttributeHandler {
024: /**
025: * Initializes the handler
026: *
027: * @param component string representing the user friendly component name
028: * @param domainId string representing the portal domain
029: * @param portalId string representing the identifier for portal
030: * @throws PSMBeanException if there was error in initilization
031: */
032: void init(String component, String domainId, String portalId)
033: throws PSMBeanException;
034:
035: /**
036: * Performs validation of the options in the map
037: * This method supports validating values only for singular set
038: * operation. For setting values for multiple attrs, pass in null
039: * for values and do validation before actually setting the specific
040: * attr in the attr set.
041: *
042: * @values a list of values used by set to be validated
043: * @optionsMap a map containing key-value pairs for options
044: * @throws PSMBeanException if the validation failed
045: */
046: void validate(List values, Map optionsMap) throws PSMBeanException;
047:
048: /**
049: * Maps the user friendly name of the attribute to its real name.
050: *
051: * @param userFriendlyName string passed in a name of the attribute
052: * @return real name of the attribute in backend or null if such attribute
053: * does not exist
054: */
055: String getAttributeName(String userFriendlyName);
056:
057: /**
058: * Maps the user friendly name of the component to its real name.
059: *
060: * @param userFriendlyName string passed in a name of the component
061: * @return real name of the component in backend such as the service name
062: */
063: String getComponentName(String userFriendlyName);
064:
065: /**
066: * Returns a list of values for the attribute name passed in the map
067: *
068: * The optionsMap contains these in addition to component
069: * specific options
070: * operation = get
071: * //common basic options
072: * OPT_COMPONENT = "component";
073: * OPT_ATTR_NAME = "attribute-name";
074: * OPT_DN = "dn";
075: * OPT_GLOBAL = "global";
076: * OPT_ORG = "org";
077: * //set operation options
078: * OPT_INHERIT = "inherit";
079: * OPT_ADD = "add";
080: * OPT_REMOVE = "remove";
081: *
082: * @param optionsMap a map containing key-value pairs for options
083: * @return list of values for the attribute
084: * @throws PSMBeanException if there was error in retrieving the value
085: */
086: List getAttribute(Map optionsMap) throws PSMBeanException;
087:
088: /**
089: * Returns attributes at the specific dn or at top level
090: * If global, then dn should not be specified
091: * If org and dn is not specified, then its org default
092: * If neither global nor org, then its dynamic
093: * If neither global nor org and no dn, then its dynamic default
094: * If neither global nor org and dn is user dn, then its user attrs
095: *
096: * The optionsMap contains these in addition to component
097: * specific options
098: * operation = get
099: * //common basic options
100: * OPT_COMPONENT = "component";
101: * OPT_ATTR_NAMES = "attribute-names"
102: * OPT_DN = "dn";
103: * OPT_GLOBAL = "global";
104: * OPT_ORG = "org";
105: *
106: * OPT_ATTR_NAMES should be a String Set of friendly attr names
107: * The returned Map contains these attr names as keys and the values are
108: * List objects
109: *
110: * @param optionsMap a map containing key-value pairs for options
111: * @return map of name-ListValues for the attribute
112: * @throws PSMBeanException if there was error in retrieving the value
113: */
114: Map getAttributes(Map optionsMap) throws PSMBeanException;
115:
116: /**
117: * Sets the value(s) for the attribute name passed in the map
118: *
119: * The optionsMap contains these in addition to component
120: * specific options
121: * operation = set
122: * //common basic options
123: * OPT_COMPONENT = "component";
124: * OPT_ATTR_NAME = "attribute-name";
125: * OPT_DN = "dn";
126: * OPT_GLOBAL = "global";
127: * OPT_ORG = "org";
128: * //set operation options
129: * OPT_INHERIT = "inherit";
130: * OPT_ADD = "add";
131: * OPT_REMOVE = "remove";
132: *
133: * OPT_COMPONENT is the friendly service name
134: * OPT_ATTR_NAME is the friendly attr name
135: *
136: * @param values list of values to be set for the component
137: * @param optionsMap a map containing key-value pairs for options
138: * @throws PSMBeanException if there was an error in setting the value
139: */
140: void setAttribute(List values, Map optionsMap)
141: throws PSMBeanException;
142:
143: /**
144: * Sets the value(s) for multiple attributes passed in the map
145: * This method does not support add/remove/inherit. It is only
146: * to set the values.
147: *
148: * The optionsMap contains these in addition to component
149: * specific options
150: * operation = set
151: * //common basic options
152: * OPT_COMPONENT = "component";
153: * OPT_DN = "dn";
154: * OPT_GLOBAL = "global";
155: * OPT_ORG = "org";
156: *
157: * OPT_COMPONENT is the friendly service name
158: * The nameValues map consists of mapping between friendly attr name
159: * and its value which is a List
160: *
161: * @param nameValues map of name-ListValues of attrs
162: * @param optionsMap a map containing key-value pairs for options
163: * @throws PSMBeanException if there was an error in setting the value
164: */
165: void setAttributes(Map nameValues, Map optionsMap)
166: throws PSMBeanException;
167:
168: /**
169: * Returns a map where the key is the user friendly name of the
170: * attribute and the value is a list.
171: * The list consists of the following in this order:
172: * <ul>
173: * <li>type as defined in AttributeInfo (mandatory)
174: * <li>i18n key for description like range of values etc. (optional)
175: * <li>r/w/ro/wo privilege (optional, default is r/w) as defined in AttributeInfo
176: * <li>i18n key for example (optional)
177: * </ul>
178: * The list is always in this order and if some info is not applicable
179: * then a null is specified for it. For example, if there is no
180: * descrition but privilege is specified, then a null
181: * in inserted for description. If only type is specified, then the
182: * list size may be "1".
183: *
184: * @param optionsMap a map containing key-value pairs for options
185: * @return map containing attribute-name and information about it
186: * @throws PSMBeanException if the there was an error
187: */
188: Map listAttributes(Map optionsMap) throws PSMBeanException;
189: }
|