01: /*
02: * The contents of this file are subject to the terms
03: * of the Common Development and Distribution License
04: * (the License). You may not use this file except in
05: * compliance with the License.
06: *
07: * You can obtain a copy of the license at
08: * https://glassfish.dev.java.net/public/CDDLv1.0.html.
09: * See the License for the specific language governing
10: * permissions and limitations under the License.
11: *
12: * When distributing Covered Code, include this CDDL
13: * Header Notice in each file and include the License file
14: * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
15: * If applicable, add the following below the CDDL Header,
16: * with the fields enclosed by brackets [] replaced by
17: * you own identifying information:
18: * "Portions Copyrighted [year] [name of copyright owner]"
19: *
20: * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
21: */
22:
23: /*
24: * DerivedTokenKeyBinding.java
25: *
26: * Created on December 20, 2005, 5:22 PM
27: *
28: * To change this template, choose Tools | Template Manager
29: * and open the template in the editor.
30: */
31:
32: package com.sun.xml.wss.impl.policy.mls;
33:
34: import com.sun.xml.wss.impl.PolicyTypeUtil;
35:
36: /**
37: *
38: * @author Abhijit Das
39: */
40: public class DerivedTokenKeyBinding extends KeyBindingBase {
41:
42: private WSSPolicy originalKeyBinding = null;
43:
44: /** Creates a new instance of DerivedTokenKeyBinding */
45: public DerivedTokenKeyBinding() {
46: setPolicyIdentifier(PolicyTypeUtil.DERIVED_TOKEN_KEY_BINDING);
47: }
48:
49: public Object clone() {
50: DerivedTokenKeyBinding dkt = new DerivedTokenKeyBinding();
51: dkt.setOriginalKeyBinding((WSSPolicy) getOriginalKeyBinding()
52: .clone());
53: dkt.setUUID(this .getUUID());
54: return dkt;
55: }
56:
57: public boolean equals(WSSPolicy policy) {
58: if (!PolicyTypeUtil.derivedTokenKeyBinding(policy)) {
59: return false;
60: }
61:
62: WSSPolicy dkt = ((DerivedTokenKeyBinding) policy)
63: .getOriginalKeyBinding();
64: if (dkt.getType().intern() != getOriginalKeyBinding().getType()
65: .intern())
66: return false;
67: //TODO: check the contents (dkt.getValue() and derivedTokenKeyBinding.getValue()
68: return true;
69: }
70:
71: public boolean equalsIgnoreTargets(WSSPolicy policy) {
72: return equals(policy);
73: }
74:
75: public String getType() {
76: return PolicyTypeUtil.DERIVED_TOKEN_KEY_BINDING;
77: }
78:
79: public WSSPolicy getOriginalKeyBinding() {
80: return originalKeyBinding;
81: }
82:
83: public void setOriginalKeyBinding(WSSPolicy originalKeyBinding) {
84: this.originalKeyBinding = originalKeyBinding;
85: }
86:
87: }
|