001: /*
002: * $Id: RequestSecurityTokenResponseCollectionImpl.java,v 1.5 2007/05/29 22:11:34 ofung Exp $
003: */
004:
005: /*
006: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
007: *
008: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
009: *
010: * The contents of this file are subject to the terms of either the GNU
011: * General Public License Version 2 only ("GPL") or the Common Development
012: * and Distribution License("CDDL") (collectively, the "License"). You
013: * may not use this file except in compliance with the License. You can obtain
014: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
015: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
016: * language governing permissions and limitations under the License.
017: *
018: * When distributing the software, include this License Header Notice in each
019: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
020: * Sun designates this particular file as subject to the "Classpath" exception
021: * as provided by Sun in the GPL Version 2 section of the License file that
022: * accompanied this code. If applicable, add the following below the License
023: * Header, with the fields enclosed by brackets [] replaced by your own
024: * identifying information: "Portions Copyrighted [year]
025: * [name of copyright owner]"
026: *
027: * Contributor(s):
028: *
029: * If you wish your version of this file to be governed by only the CDDL or
030: * only the GPL Version 2, indicate your decision by adding "[Contributor]
031: * elects to include this software in this distribution under the [CDDL or GPL
032: * Version 2] license." If you don't indicate a single choice of license, a
033: * recipient has the option to distribute your version of this file under
034: * either the CDDL, the GPL Version 2 or to extend the choice of license to
035: * its licensees as provided above. However, if you add GPL Version 2 code
036: * and therefore, elected the GPL Version 2 license, then the option applies
037: * only if the new code is made subject to such option by the copyright
038: * holder.
039: */
040:
041: package com.sun.xml.ws.security.trust.impl.elements;
042:
043: import com.sun.xml.ws.policy.impl.bindings.AppliesTo;
044: import com.sun.xml.ws.api.security.trust.WSTrustException;
045: import com.sun.xml.ws.security.trust.elements.Entropy;
046: import com.sun.xml.ws.security.trust.elements.Lifetime;
047: import com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponse;
048: import com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponseCollection;
049: import com.sun.xml.ws.security.trust.elements.RequestedAttachedReference;
050: import com.sun.xml.ws.security.trust.elements.RequestedProofToken;
051: import com.sun.xml.ws.security.trust.elements.RequestedSecurityToken;
052: import com.sun.xml.ws.security.trust.elements.RequestedUnattachedReference;
053: import com.sun.xml.ws.security.trust.impl.bindings.RequestSecurityTokenResponseCollectionType;
054: import com.sun.xml.ws.security.trust.impl.bindings.RequestSecurityTokenResponseType;
055: import java.net.URI;
056: import java.net.URISyntaxException;
057: import java.util.ArrayList;
058: import java.util.List;
059:
060: /**
061: * @author Manveen Kaur.
062: */
063: public class RequestSecurityTokenResponseCollectionImpl extends
064: RequestSecurityTokenResponseCollectionType implements
065: RequestSecurityTokenResponseCollection {
066:
067: protected List<RequestSecurityTokenResponse> requestSecurityTokenResponses;
068:
069: public RequestSecurityTokenResponseCollectionImpl() {
070: // empty ctor
071: }
072:
073: public RequestSecurityTokenResponseCollectionImpl(URI tokenType,
074: URI context, RequestedSecurityToken token,
075: AppliesTo scopes, RequestedAttachedReference attached,
076: RequestedUnattachedReference unattached,
077: RequestedProofToken proofToken, Entropy entropy, Lifetime lt) {
078: final RequestSecurityTokenResponse rstr = new RequestSecurityTokenResponseImpl(
079: tokenType, context, token, scopes, attached,
080: unattached, proofToken, entropy, lt, null);
081: addRequestSecurityTokenResponse(rstr);
082:
083: }
084:
085: public RequestSecurityTokenResponseCollectionImpl(
086: RequestSecurityTokenResponseCollectionType rstrcType)
087: throws URISyntaxException, WSTrustException {
088: final List<RequestSecurityTokenResponseType> list = rstrcType
089: .getRequestSecurityTokenResponse();
090: for (int i = 0; i < list.size(); i++) {
091: addRequestSecurityTokenResponse(new RequestSecurityTokenResponseImpl(
092: (RequestSecurityTokenResponseType) list.get(i)));
093: }
094: }
095:
096: public List<RequestSecurityTokenResponse> getRequestSecurityTokenResponses() {
097: if (requestSecurityTokenResponses == null) {
098: requestSecurityTokenResponses = new ArrayList<RequestSecurityTokenResponse>();
099: }
100: return this .requestSecurityTokenResponses;
101: }
102:
103: public final void addRequestSecurityTokenResponse(
104: final RequestSecurityTokenResponse rstr) {
105: getRequestSecurityTokenResponses().add(rstr);
106:
107: //JAXBElement<RequestSecurityTokenResponseType> rstrEl =
108: // (new ObjectFactory()).createRequestSecurityTokenResponse((RequestSecurityTokenResponseType)rstr);
109: getRequestSecurityTokenResponse().add(
110: (RequestSecurityTokenResponseType) rstr);
111: }
112: }
|