001: /*
002: * The contents of this file are subject to the terms
003: * of the Common Development and Distribution License
004: * (the License). You may not use this file except in
005: * compliance with the License.
006: *
007: * You can obtain a copy of the license at
008: * https://glassfish.dev.java.net/public/CDDLv1.0.html.
009: * See the License for the specific language governing
010: * permissions and limitations under the License.
011: *
012: * When distributing Covered Code, include this CDDL
013: * Header Notice in each file and include the License file
014: * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
015: * If applicable, add the following below the CDDL Header,
016: * with the fields enclosed by brackets [] replaced by
017: * you own identifying information:
018: * "Portions Copyrighted [year] [name of copyright owner]"
019: *
020: * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
021: */
022:
023: /*
024: * SignatureConfirmationPolicy.java
025: *
026: * Created on January 24, 2006, 5:05 PM
027: *
028: * To change this template, choose Tools | Template Manager
029: * and open the template in the editor.
030: */
031:
032: package com.sun.xml.wss.impl.policy.mls;
033:
034: import com.sun.xml.wss.impl.PolicyTypeUtil;
035: import com.sun.xml.wss.impl.MessageConstants;
036:
037: /**
038: * A policy representing a WSS1.1 SignatureConfirmation element.
039: * Note: The SignatureConfirmationPolicy is WSSPolicy element that does not contain a
040: * concrete FeatureBinding and/or KeyBinding.
041: *
042: * @author Ashutosh.Shahi@sun.com
043: */
044: public class SignatureConfirmationPolicy extends WSSPolicy {
045:
046: private String signatureValue = MessageConstants._EMPTY;
047:
048: /**
049: * DefaultConstructor
050: */
051: public SignatureConfirmationPolicy() {
052: setPolicyIdentifier(PolicyTypeUtil.SIGNATURE_CONFIRMATION_POLICY_TYPE);
053: }
054:
055: /**
056: * sets the Value attribute for SignatureConfirmation in this SignatureConfirmationPolicy
057: * @param signatureValue
058: */
059: public void setSignatureValue(String signatureValue) {
060: this .signatureValue = signatureValue;
061: }
062:
063: /**
064: * @return the Value attribute of SignatureConfirmation
065: */
066: public String getSignatureValue() {
067: return this .signatureValue;
068: }
069:
070: /**
071: * @param policy the policy to be compared for equality
072: * @return true if the argument policy is equal to this policy
073: */
074: public boolean equals(WSSPolicy policy) {
075:
076: boolean assrt = false;
077: try {
078: SignatureConfirmationPolicy scPolicy = (SignatureConfirmationPolicy) policy;
079: assrt = signatureValue.equals(scPolicy.getSignatureValue());
080: } catch (Exception e) {
081: }
082:
083: return assrt;
084: }
085:
086: /**
087: * Equality comparison ignoring the targets
088: * @param policy the policy to be compared for equality
089: * @return true if the argument policy is equal to this policy
090: */
091: public boolean equalsIgnoreTargets(WSSPolicy policy) {
092: return equals(policy);
093: }
094:
095: /**
096: * Clone operator
097: * @return clone of this policy
098: */
099: public Object clone() {
100: SignatureConfirmationPolicy scPolicy = new SignatureConfirmationPolicy();
101:
102: try {
103: scPolicy.setUUID(this .getUUID());
104: scPolicy.setSignatureValue(signatureValue);
105: } catch (Exception e) {
106: }
107:
108: return scPolicy;
109: }
110:
111: /**
112: * @return the type of policy
113: */
114: public String getType() {
115: return PolicyTypeUtil.SIGNATURE_CONFIRMATION_POLICY_TYPE;
116: }
117: }
|