Source Code Cross Referenced for EncryptionTarget.java in  » 6.0-JDK-Modules-com.sun » xws-security » com » sun » xml » wss » impl » policy » mls » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules com.sun » xws security » com.sun.xml.wss.impl.policy.mls 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: EncryptionTarget.java,v 1.4 2007/01/08 09:28:46 ashutoshshahi Exp $
003:         */
004:
005:        /*
006:         * The contents of this file are subject to the terms
007:         * of the Common Development and Distribution License
008:         * (the License).  You may not use this file except in
009:         * compliance with the License.
010:         * 
011:         * You can obtain a copy of the license at
012:         * https://glassfish.dev.java.net/public/CDDLv1.0.html.
013:         * See the License for the specific language governing
014:         * permissions and limitations under the License.
015:         * 
016:         * When distributing Covered Code, include this CDDL
017:         * Header Notice in each file and include the License file
018:         * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
019:         * If applicable, add the following below the CDDL Header,
020:         * with the fields enclosed by brackets [] replaced by
021:         * you own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         * 
024:         * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
025:         */
026:
027:        package com.sun.xml.wss.impl.policy.mls;
028:
029:        import java.security.spec.AlgorithmParameterSpec;
030:        import java.util.Iterator;
031:        import java.util.ArrayList;
032:
033:        import org.w3c.dom.Element;
034:
035:        /**
036:         * Objects of this class represent an Encryption Target that can be part of
037:         * the FeatureBinding for an EncryptionPolicy (refer EncryptionPolicy.FeatureBinding).
038:         */
039:        public class EncryptionTarget extends Target implements  Cloneable {
040:
041:            String _dataEncryptionAlgorithm = ""; // Rf. MessageConstants
042:
043:            ArrayList _cipherReferenceTransforms = new ArrayList();
044:
045:            Element drefData = null;
046:            private boolean isOptimized = false;
047:
048:            /**
049:             * Default constructor
050:             */
051:            public EncryptionTarget() {
052:            }
053:
054:            /**
055:             * Constructor that takes a Target
056:             */
057:            public EncryptionTarget(Target target) {
058:                this .setEnforce(target.getEnforce());
059:                this .setType(target.getType());
060:                this .setValue(target.getValue());
061:                this .setContentOnly(target.getContentOnly());
062:            }
063:
064:            /**
065:             * Constructor
066:             * @param algorithm Data Encryption Algorithm
067:             */
068:            public EncryptionTarget(String algorithm) {
069:                this ._dataEncryptionAlgorithm = algorithm;
070:            }
071:
072:            /**
073:             * Constructor
074:             * @param algorithm Data Encryption Algorithm
075:             * @param transform Cipher Reference Transform
076:             */
077:            public EncryptionTarget(String algorithm, String transform) {
078:                this ._dataEncryptionAlgorithm = algorithm;
079:                this ._cipherReferenceTransforms.add(new Transform(transform));
080:            }
081:
082:            /**
083:             * set the DataEncryptionAlgorithm
084:             * @param algorithm Data Encryption Algorithm
085:             */
086:            public void setDataEncryptionAlgorithm(String algorithm) {
087:                this ._dataEncryptionAlgorithm = algorithm;
088:            }
089:
090:            /**
091:             * @return Data Encryption Algorithm
092:             */
093:            public String getDataEncryptionAlgorithm() {
094:                return this ._dataEncryptionAlgorithm;
095:            }
096:
097:            /**
098:             * add a CipherReference Transform
099:             * @param transform Cipher Reference Transform
100:             */
101:            public void addCipherReferenceTransform(String transform) {
102:                this ._cipherReferenceTransforms.add(new Transform(transform));
103:            }
104:
105:            /**
106:             * add a CipherReference Transform
107:             * @param transform CipherReference Transform
108:             */
109:            public void addCipherReferenceTransform(Transform transform) {
110:                this ._cipherReferenceTransforms.add(transform);
111:            }
112:
113:            /**
114:             * @return Collection of CipherReference Transforms
115:             */
116:            public ArrayList getCipherReferenceTransforms() {
117:                return _cipherReferenceTransforms;
118:            }
119:
120:            /**
121:             * @return  a new instance of Encryption Transform
122:             */
123:            public Transform newEncryptionTransform() {
124:                return new Transform();
125:            }
126:
127:            /**
128:             * Equals operator
129:             * @param target EncryptionTarget
130:             * @return true if the target argument is equal to this Target
131:             */
132:            public boolean equals(EncryptionTarget target) {
133:                boolean b1 = _dataEncryptionAlgorithm.equals("") ? true
134:                        : _dataEncryptionAlgorithm.equals(target
135:                                .getDataEncryptionAlgorithm());
136:
137:                boolean b2 = _cipherReferenceTransforms.equals(target
138:                        .getCipherReferenceTransforms());
139:
140:                return b1 && b2;
141:            }
142:
143:            /**
144:             * clone operator
145:             * @return a clone of this EncryptionTarget
146:             */
147:            public Object clone() {
148:                EncryptionTarget target = new EncryptionTarget();
149:
150:                try {
151:                    target.setDataEncryptionAlgorithm(_dataEncryptionAlgorithm);
152:                    target.setValue(this .getValue());
153:                    target.setType(this .getType());
154:                    target.setContentOnly(this .getContentOnly());
155:                    target.setEnforce(this .getEnforce());
156:
157:                    Iterator i = getCipherReferenceTransforms().iterator();
158:                    while (i.hasNext()) {
159:                        Transform transform = (Transform) i.next();
160:                        target.getCipherReferenceTransforms().add(
161:                                transform.clone());
162:                    }
163:                } catch (Exception e) {
164:                }
165:
166:                return target;
167:            }
168:
169:            public void setElementData(Element data) {
170:                this .drefData = data;
171:            }
172:
173:            public Element getElementData() {
174:                return this .drefData;
175:            }
176:
177:            /**
178:             * This class represents a Transform that can appear on an EcncryptionTarget,
179:             * Instances of this class are added as CipherReference Transforms on an EcncryptionTarget
180:             */
181:            public static class Transform implements  Cloneable {
182:
183:                String _transform = "";
184:
185:                AlgorithmParameterSpec _algorithmParameters = null;
186:
187:                /**
188:                 *Default constructor
189:                 */
190:                public Transform() {
191:                }
192:
193:                /**
194:                 * Constructor
195:                 * @param algorithm the URI for the transform alogrithm
196:                 */
197:                public Transform(String algorithm) {
198:                    this ._transform = algorithm;
199:                }
200:
201:                /**
202:                 * @return the algorithm parameters
203:                 */
204:                public AlgorithmParameterSpec getAlgorithmParameters() {
205:                    return this ._algorithmParameters;
206:                }
207:
208:                /**
209:                 * set any parameters for the Transform Algorithm
210:                 * @param params a HashMap of AlgorithmParameters
211:                 */
212:                public void setAlgorithmParameters(AlgorithmParameterSpec params) {
213:                    this ._algorithmParameters = params;
214:                }
215:
216:                /**
217:                 * set the Transform Algorithm
218:                 * @param algorithm the Algorithm for the Transform
219:                 */
220:                public void setTransform(String algorithm) {
221:                    this ._transform = algorithm;
222:                }
223:
224:                /**
225:                 * @return algorithm the transform algorithm
226:                 */
227:                public String getTransform() {
228:                    return this ._transform;
229:                }
230:
231:                /**
232:                 * equals operator
233:                 * @param transform the transform to be compared for equality
234:                 * @return true if the argument transform is equal to this transform
235:                 */
236:                public boolean equals(Transform transform) {
237:                    boolean b1 = _transform.equals("") ? true : _transform
238:                            .equals(transform.getTransform());
239:                    if (!b1)
240:                        return false;
241:
242:                    boolean b2 = _algorithmParameters.equals(transform
243:                            .getAlgorithmParameters());
244:                    if (!b2)
245:                        return false;
246:
247:                    return true;
248:                }
249:
250:                /**
251:                 * clone operator
252:                 * @return a clone of this Transform
253:                 */
254:                public Object clone() {
255:                    Transform transform = new Transform(_transform);
256:                    transform.setAlgorithmParameters(_algorithmParameters);
257:                    return transform;
258:                }
259:            }
260:
261:            public boolean isIsOptimized() {
262:                return isOptimized;
263:            }
264:        }
w_w___w._jav___a___2_s___.co_m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.