/**
* 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: PPRequestHandler.java,v 1.2 2008/06/25 05:47:14 qcheng Exp $
*
*/
//Interaction imports
/**
* The class <code>PPRequestHandler</code> is used to process the
* query or modify requests for a personal profile service.
*/
/**
*Default constructor
*/
public PPRequestHandler() {
pp = new PersonalProfile();
}
/**
* @param request query or modify object.
* @param requestMsg Request Message.
* @param responseMsg Response Message.
* @return Object processed response object.
* @exception SOAPFaultException for the interaction redirects
* @exception Exception for any failure.
*/
throws SOAPFaultException, DSTException {
try {
}
if(request instanceof QueryElement) {
"com.sun.xml.bind.namespacePrefixMapper",
new NamespacePrefixMapperImpl());
} else if (request instanceof ModifyElement) {
"com.sun.xml.bind.namespacePrefixMapper",
new NamespacePrefixMapperImpl());
} else {
" Request.");
throw new DSTException(
}
} catch(IDPPException ie) {
throw new DSTException(ie);
} catch (JAXBException je) {
throw new DSTException(
} catch (SOAPBindingException sbe) {
throw new DSTException(sbe);
}
}
/**
* Processes Query Request.
* @param query JAXBQ QueryElement Object
* @param request queryRequest.
* @param providerID Provider ID.
* @param requestMsg Request Message.
* @return QueryResponseElement response.
* @exception IDPPException for a failure in processing the request
* @exception SOAPFaultException if the interaction is required
*/
public QueryResponseElement
throws IDPPException, SOAPFaultException {
"null values ");
throw new IDPPException(
}
}
}
"Request: resource id is invalid.");
}
return response;
}
if(LogUtil.isLogEnabled()) {
"securityMechID") + "=" +
}
"Request: The request does not have any query items.");
}
return response;
}
for(int i= 0; i < queryItemsSize; i++) {
boolean isQueryItemValid = true;
}
"QueryRequest: There is no Select in the request.");
}
isQueryItemValid = false;
}
"QueryRequest: Data not supported");
}
isQueryItemValid = false;
}
//Check for authorization & interaction.
if(LogUtil.isLogEnabled()) {
}
continue;
}
true, requestMsg, select)) {
if(LogUtil.isLogEnabled()) {
}
isQueryItemValid = false;
}
} else {
}
} else if(authZAction.equalsIgnoreCase(
requestMsg, select);
if(LogUtil.isLogEnabled()) {
//String[] data = { logMsg };
}
isQueryItemValid = false;
} else {
}
} else {
}
}
if(isQueryItemValid) {
if(changedSince != null) {
}
}
}
//Check for interfaction before processing the actual response.
}
}
if(LogUtil.isLogEnabled()) {
}
return response;
}
/**
* Get the data from the queried results
* @param queryResults map of DSTQueryItems and the corresponding results.
* @return List queried data.
* @exception IDPPException.
*/
try {
} catch (JAXBException je) {
throw new IDPPException(
}
continue;
}
}
return dataResults;
}
/**
* sets the response status.
* @param success This flag indicates whether the status is ok or failed.
* @param statusCode status code.
* @param comment.
* @param itemID Item ID for the reference.
* @return StatusType JAXB Object.
* @exception IDPPException for any failure
*/
throws IDPPException {
if(statusCode == null) {
throw new IDPPException(
}
try {
if(success) {
} else {
}
}
}
return status;
} catch (JAXBException je) {
"jaxb failure:" , je);
}
}
/**
* Processes modify request.
* @param modify ModifyElement JAXB Object
* @param request modify request.
* @param providerID Provider ID.
* @param requestMsg Request Message.
* @return ModifyResponseElement response JAXB Object
* @exception IDPPException for failure in processing the request
* @exception SOAPFaultException for interaction redirect
*/
throws IDPPException, SOAPFaultException {
"Request. null values");
throw new IDPPException(
}
}
}
"Request: resource id is invalid.");
}
return response;
}
if(LogUtil.isLogEnabled()) {
"securityMechID") + "=" +
}
"ModifyRequest: Modification elements are null");
return response;
}
for (int i=0; i < size; i++) {
"ModifyRequest: select is null");
}
return response;
}
"ModifyRequest: Data not supported");
}
return response;
}
//Check for authorization & interaction.
if(LogUtil.isLogEnabled()) {
}
return response;
}
+ " Authorization action" + authZAction);
}
false, requestMsg, select)) {
if(LogUtil.isLogEnabled()) {
}
return response;
}
} else {
}
} else if (authZAction.equalsIgnoreCase(
false, requestMsg, select);
if(LogUtil.isLogEnabled()) {
}
return response;
} else {
}
} else {
}
}
}
}
//Check for interfaction before processing the actual response.
}
if(LogUtil.isLogEnabled()) {
}
return response;
} else {
if(LogUtil.isLogEnabled()) {
}
return response;
}
}
/**
* Returns Policy Environment map
* @param resourceID resource id
* @param requestMsg Request Message
* @return Map Policy Environment map
*/
return env;
}
/**
* Gets the query response and set the status to OK.
* @param query JAXB query object.
* @return QueryResponseElement JAXB query response.
* @exception IDPPException
*/
throws IDPPException {
"Query is null.");
throw new IDPPException(
}
try {
return response;
} catch (JAXBException je) {
"JAXB failure.", je);
}
}
/**
* Gets the modify response and set the status to OK.
* @param modify JAXB modify object.
* @return ModifyResponseElement JAXB modify response.
* @exception IDPPException
*/
throws IDPPException {
"Modify is null.");
throw new IDPPException(
}
try {
return response;
} catch (JAXBException je) {
"JAXB failure.", je);
}
}
/**
* Checks if the interaction response exists for this message
* @param msg SOAP Request Message
* @return true if exists
*/
try {
return (InteractionManager.getInstance().
} catch (Exception e) {
"Exists: Exception while getting interaction response.", e);
return false;
}
}
/**
* Initialize interaction for the queries that require interaction
* @param isQuery true if this is a <code>PP</code> query request,
* false if this is a <code>PP</code> modify request.
* @param interactResourceMap map of resources that need an interaction
* This map will have key as the resource
* and the value as interaction type.
* @param msg SOAP request message
* @exception SOAPFaultException for interaction redirection
* @exception IDPPException for any other failure.
*/
throws SOAPFaultException, IDPPException {
"Input parameters");
throw new IDPPException(
}
try {
//Create Interaction inquiry element
} else if(interactionType.equals(
}
}
if(LogUtil.isLogEnabled()) {
}
} catch (InteractionSOAPFaultException ise) {
"Interact redirection happened");
}
throw ise.getSOAPFaultException();
throw new IDPPException(ex);
}
}
/**
* Returns interaction confirm element
* @param isQuery true if this is a <code>PP</code> query request,
* false if this is a <code>PP</code> modify request.
* @param resource resource that needs an interaction
* @param msg Message.
* @return Confirm Interaction JAXB Confirm Element
* @exception IDPPException
*/
throws IDPPException {
"Null input:");
throw new IDPPException(
}
"Resource Context:" + resource);
}
try {
return confirmElement;
} catch(Exception e) {
"Exception while creating interact select.", e);
throw new IDPPException(e);
}
}
/**
* Returns interaction text elements.
* @param isQuery true if this is a <code>PP</code> query request,
* false if this is a <code>PP</code> modify request.
* @param resource resource that needs an interaction
* @param msg Message.
* @return List list of Interaction JAXB TextElements.
* @exception IDPPException
*/
throws IDPPException {
"Null input:");
throw new IDPPException(
}
"Resource Context:" + resource);
}
try {
}
return textElements;
} catch(Exception e) {
"Exception while creating interact text element.", e);
throw new IDPPException(e);
}
}
/**
* Process the interaction response
* @param isQuery true if this is a <code>PP</code> query request,
* false if this is a <code>PP</code> modify request.
* @param msg SOAP Request Message
* @param resource interaction resource
* @return true if the consent is allowed.
*/
private boolean processInteractionConsentResponse(
boolean isQuery,
"Response:Init");
}
"Response:null input params");
return false;
}
"PP Element that was trying to access:" + resource);
}
try {
return false;
}
return false;
}
"Interaction: response is deny");
}
return false;
} else {
return true;
}
} catch (Exception e) {
"Response: Exception occured.", e);
return false;
}
}
/**
* Process the interaction response for values.
* @param isQuery true if this is a <code>PP</code> query request,
* false if this is a <code>PP</code> modify request.
* @param msg SOAP Request Message
* @param resource interaction resource
* @return Map map of interacted data.
*/
boolean isQuery,
"Response:Init");
}
"Response:null input params");
return null;
}
//Get the actual element
"PP Element that was trying to access:" + resource);
}
try {
return null;
}
return null;
}
new PPInteractionHelper(lang);
continue;
}
}
return interactedData;
} catch (Exception e) {
"Response: Exception occured.", e);
return null;
}
}
/**
* Gets the language from the locale header.
* @param requestMsg RequestMsg.
* @return String Language string from the message.
*/
"Headers are empty in the interaction message.");
}
return null;
}
}
return lang;
}
/**
* Gets the service instance update header.
*
* @exception SOAPFaultException.
*/
throws SOAPFaultException {
if(siu.isSOAPFaultNeeded()) {
detail);
throw sfe;
}
return siuHeader;
}
}