/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: ActionSchema.java,v 1.3 2008/06/25 05:43:43 qcheng Exp $
*
*/
/**
* The class <code>ActionSchema</code> provides interfaces to
* obtain meta information about service action values.
* For example, information about the syntax of the action values,
* defaults values, choice values, etc.
*/
/**
* Constructor with the action schema node
* @param node <code>Node</code> representing w3c DOM representation
of the object.
*/
super(node);
actionNode = node;
}
/**
* Returns a <code>Set</code> of possible action values if the action
* schema is of choice type ie <code>SINGLE_CHOICE</code> or
* <code>MULTIPLE_CHOICE</code> in the service schema definition.
* The choice values are sorted alphabetically in the ascending order.
* If the action values are not of choice type, this method return an
* empty <code>Set</code> and not <code>null</code>.
*
* @return choice values for action values
*/
return(getChoiceValuesSet());
}
/**
* Returns the I18N key for the action value. This method can
* be used only when the action schema is of type <code>SINGLE_CHOICE</code>
* or <code>MULTIPLE_CHOICE</code>. Also each action value must have
* defined its <code>i18nKey</code> in the XML.
*
* @return i18n key for the action value if present in the
* service XML; <code>null</code> otherwise
*/
return(getChoiceValueI18NKey(actionValue));
}
/**
* Returns <code>true</code> if the action requires a resource name.
* An action can have a resource name only if its type is either
* <code>SINGLE_CHOICE</code> or <code>MULTIPLE_CHOICE</code>, or if
* its <code>syntax</code> is boolean.
*
* @return <code>true</code> if the action name requires a resource name;
* <code>false</code> otherwise
*/
public boolean requiresResourceName() {
return(isResourceNameAllowed());
}
/**
* Returns the default resource names associated with the
* action value. If it is not configured, it returns an
* empty <code>Set</code>.
*
* @return default resource names associated with the action value
*/
// Get the child nodes
// Obtain the action value nodes
// Check for Value node
// Check if it matchs actionValue
// Get the resource names from ActionValue node
if (r.getNodeName().equalsIgnoreCase(
RESOURCE_NAME)) {
}
}
return (answer);
}
}
}
}
}
return (Collections.EMPTY_SET);
}
/**
* Returns the I18N key for displaying resource names associated
* with the action value. If it is not configured, it returns
* <code>null</code>.
*
* @return String representing <code>i18nKey</code> for displaying
* resource names.
*/
// Get the child nodes
for (int i = 0; i < numNodes; i++) {
// Obtain the action value nodes
for (int j = 0; j < numOfNodeList; j++) {
// Check for Value node
// Check if it matchs actionValue
// Get the resource names from ActionValue node
for (int k = 0; k < rlLength; k++) {
if (r.getNodeName().equalsIgnoreCase(
RESOURCE_NAME)) {
// Get the i18n key attribute
r, I18N_KEY);
return (i18nKey);
}
}
}
}
}
}
}
}
return (null);
}
/**
* Validates the values against the action schema
*/
throws InvalidNameException {
// throw an exception
"In validate action name: invalid values");
}
}
/**
* Checks the validity of action values against the action 's
* type as defined in the action schema.
*/
// It is OK to have no values set for an action
return (true);
}
// Get the type
boolean checkType = false;
// Check for single values
checkType = true;
return (false);
}
}
// Check for choice values
checkType = true;
// Get possible choice values and check them
while (givenValues.hasNext()) {
return (false);
}
}
}
// Check the type, other types SINGLE & CHOICE have been checked
return (false);
}
return (true);
}
/**
* Checks the validity of action values against the action 's
* syntax as defined in the action schema.
*/
// Check for String syntax
boolean answer = false;
// Anything is allowed
answer = true;
}
answer = true;
}
}
}
}
answer = true;
answer = false;
break;
}
}
}
answer = true;
answer = false;
break;
}
}
}
answer = true;
answer = false;
break;
}
}
}
answer = true;
answer = false;
break;
}
}
}
answer = true;
answer = false;
break;
}
answer = false;
break;
}
}
}
answer = true;
answer = false;
break;
}
}
}
return (answer);
}
// Validators from UMS service
new MailAddressValidator();
}