IDPPUtils.java revision a688bcbb4bcff5398fdd29b86f83450257dc0df4
/**
* 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: IDPPUtils.java,v 1.3 2008/08/06 17:28:09 exu Exp $
*
*/
/**
* Class <code>IDPPUtils</code> is utility class used by IDPP service
* for any common functionality in various modules.
*/
public class IDPPUtils {
public static ResourceBundle bundle =
//This needs to change it as configurable.
static {
try {
dbf.setNamespaceAware(true);
} catch (Exception e) {
" Failed.", e);
}
}
/**
* Stores the IDPPElements map
*/
private static void getIDPPElementsMap() {
}
//Default constructor
public IDPPUtils() {
}
/**
* Creates a Query Request element given a set of query expressions.
* @param queryExpressions a list of query expressions
* @param resourceID resource id.
* @param includeCommonAttr include common attribute or not
* @return QueryElement JAXB object.
*/
boolean includeCommonAttr)
throws JAXBException, IDPPException {
" expressions or resource id is null.");
throw new IDPPException("ResourceID or query expressions are null");
}
}
return query;
}
/**
* Gets the data element given a Query Response.
* @param response QueryResponseElement
* @return List of data elements.
*/
throws JAXBException, IDPPException {
throw new IDPPException("response is null");
}
}
/**
* Creates Discovery resource id type.
* @param resourceID resource id string.
* @return ResourceIDType JAXB object.
*/
throws JAXBException, IDPPException {
if(resourceID == null) {
throw new IDPPException("ResourceID is null");
}
return resourceIDElement;
}
/**
* Adds prefix "idpp" to the expression. This should be configurable
* Also, need a name space prefix mapper.
*/
return expression;
}
return expression;
}
while(st.hasMoreTokens()) {
}
}
/**
* Looks for the expression context. For e.g. if the expression
* is /idpp:IDPP/idpp:IDPPCommonName/idpp:AnalyzedName/idpp:FN, then
* it one returns "FN".
* @param select string.
* @return context string.
*/
return null;
}
if(i != -1) {
}
return select;
} else {
}
}
/**
* Returns the user attribute values.
* @param userDN user DN.
* @param requiredSet a set of required attributes.
* @return user attribute value map.
*/
throws IDPPException {
try {
} catch(DataStoreProviderException dspe) {
" user attributes.", dspe);
throw new IDPPException(dspe);
}
}
/**
* Stores the user attribute values in the data store.
* @param userDN user DN
* @param map user attribute value map
*/
throws IDPPException {
try {
} catch(DataStoreProviderException dspe) {
"user attributes.", dspe);
throw new IDPPException(dspe);
}
}
/**
* Checks for if the user attribute values exist
* for a given set.
* @param userDN user DN.
* @param set a set of user attributes that require check.
* @return true if any of the user attibute values found.
*/
throws IDPPException {
try {
return false;
}
return true;
} catch (DataStoreProviderException dspe) {
"checking for user attributes.", dspe);
throw new IDPPException(dspe);
}
}
/**
* Returns element type.
* @param element a String representing an Element.
* @return integer value of the element.
*/
return -1;
}
if(elementType == null) {
return -1;
}
return elementType.intValue();
}
/**
* Checks is the user exists or not.
* @param userDN user DN
* @return true if the user exists.
*/
try {
} catch (DataStoreProviderException dspe) {
if (debug.messageEnabled()) {
dspe);
}
return false;
}
}
/**
* Gets the IDPPFactory JAXB Object.
* @return ObjectFactory JAXB IDPP Factory Object.
*/
public static ObjectFactory getIDPPFactory() {
return idppFactory;
}
/**
* Gets the marshaller
* @return Marshaller JAXB Marshaller Object.
*/
public static Marshaller getMarshaller() {
return marshaller;
}
/**
* Get the unmarshaller object.
* @return Unmarshaller JAXB unmarshaller object.
*/
public static Unmarshaller getUnmarshaller() {
return unmarshaller;
}
/**
* Gets the document builder.
* @return DocumentBuilder dom document builder
*/
public static DocumentBuilder getDocumentBuilder() {
return documentBuilder;
}
/**
* Returns the resource expression from the select xpath expression.
* @param select Xpath select expression.
* @return String resource expression
*/
return select;
}
while(st.hasMoreTokens()) {
if(index != -1) {
}
continue;
}
if(index != -1) {
}
continue;
}
}
}
/**
* Gets the resource id for a given user id
* @param userID ID of a user
* @return String Resource ID
*/
}
}