Source Code Cross Referenced for StaticApplicationContext.java in  » 6.0-JDK-Modules-com.sun » xws-security » com » sun » xml » wss » impl » configuration » 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.configuration 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: StaticApplicationContext.java,v 1.3 2006/09/29 12:04:53 kumarjayanti 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.configuration;
028:
029:        import com.sun.xml.wss.impl.policy.StaticPolicyContext;
030:
031:        /**
032:         * This class represents the static context associated with any Security Policy elements
033:         * defined in a <code>xwss:JAXRPCSecurity</code> configuration.
034:         * The <code>xwss:JAXRPCSecurity</code> element supports Security Policies to be specifed
035:         * at three levels
036:         * <UL>
037:         *   <LI>At a JAXRPC <code>Service</code> level
038:         *   <LI>At a JAXRPC <code>Port</code> level
039:         *   <LI>At a JAXRPC <code>Operation</code> level
040:         * </UL>
041:         * Accordingly the class StaticApplicationContext has methods to identify if the context
042:         * represents a Service, Port or Operation, and stores the corresponding context identifiers
043:         */
044:        public final class StaticApplicationContext implements 
045:                StaticPolicyContext {
046:
047:            private boolean isService = false;
048:            private boolean isPort = false;
049:            private boolean isOperation = false;
050:
051:            private String UUID = "";
052:            private String contextRoot = "";
053:
054:            private String serviceIdentifier = "";
055:            private String portIdentifier = "";
056:            private String operationIdentifier = "";
057:
058:            /**
059:             * Default constructor
060:             */
061:            public StaticApplicationContext() {
062:            }
063:
064:            /**
065:             * Copy constructor
066:             *@param context StaticApplicationContext
067:             */
068:            public StaticApplicationContext(StaticApplicationContext context) {
069:                copy(context);
070:            }
071:
072:            /**
073:             *Set if this context represents a Service
074:             *@param isService set to true if this is a service level context
075:             */
076:            public void isService(boolean isService) {
077:                this .isService = isService;
078:            }
079:
080:            /**
081:             *@return true if this context represents a Service
082:             */
083:            public boolean isService() {
084:                return this .isService;
085:            }
086:
087:            /**
088:             *Set if this context represents a Port
089:             *@param isPort set to true if this is a port level context
090:             */
091:            public void isPort(boolean isPort) {
092:                this .isPort = isPort;
093:            }
094:
095:            /**
096:             *@return true if this context represents a Port
097:             */
098:            public boolean isPort() {
099:                return this .isPort;
100:            }
101:
102:            /**
103:             *Set if this context represents an Operation
104:             *@param isOperation set to true if this is an Operation level context
105:             */
106:            public void isOperation(boolean isOperation) {
107:                this .isOperation = isOperation;
108:            }
109:
110:            /**
111:             *@return true if this context represents an Operation
112:             */
113:            public boolean isOperation() {
114:                return this .isOperation;
115:            }
116:
117:            /**
118:             *Set the service identifier
119:             *@param service the Service Identifier
120:             */
121:            public void setServiceIdentifier(String service) {
122:                this .serviceIdentifier = service;
123:            }
124:
125:            /**
126:             *@return the service identifier
127:             */
128:            public String getServiceIdentifier() {
129:                return this .serviceIdentifier;
130:            }
131:
132:            /**
133:             *Set the port identifier
134:             *@param port the Port Identifier
135:             */
136:            public void setPortIdentifier(String port) {
137:                this .portIdentifier = port;
138:            }
139:
140:            /**
141:             *@return the port identifier
142:             */
143:            public String getPortIdentifier() {
144:                return this .portIdentifier;
145:            }
146:
147:            /**
148:             *Set the Operation identifier
149:             *@param operation the Operation Identifier
150:             */
151:            public void setOperationIdentifier(String operation) {
152:                isOperation(true);
153:                this .operationIdentifier = operation;
154:            }
155:
156:            /**
157:             *@return the Operation identifier
158:             */
159:            public String getOperationIdentifier() {
160:                return this .operationIdentifier;
161:            }
162:
163:            /**
164:             *Set the Unique ID associated with the Service context
165:             *@param uuid the unique id associated with the Service
166:             */
167:            public void setUUID(String uuid) {
168:                this .UUID = uuid;
169:            }
170:
171:            /**
172:             *@return the Unique ID associated with the Service context
173:             */
174:            public String getUUID() {
175:                return this .UUID;
176:            }
177:
178:            /**
179:             *@param ctxRoot the Application Context Root/Identifier for the application
180:             */
181:            public void setApplicationContextRoot(String ctxRoot) {
182:                this .contextRoot = ctxRoot;
183:            }
184:
185:            /**
186:             *@return the Application Context Root/Identifier for the application (if any)
187:             */
188:            public String getApplicationContextRoot() {
189:                return this .contextRoot;
190:            }
191:
192:            /**
193:             *Copy operator
194:             *@param ctx the StaticApplicationContext to copy from
195:             */
196:            public void copy(StaticApplicationContext ctx) {
197:                setUUID(ctx.getUUID());
198:                setApplicationContextRoot(ctx.getApplicationContextRoot());
199:
200:                isService(ctx.isService());
201:                isPort(ctx.isPort());
202:                isOperation(ctx.isOperation());
203:
204:                setServiceIdentifier(ctx.getServiceIdentifier());
205:                setPortIdentifier(ctx.getPortIdentifier());
206:                operationIdentifier = ctx.getOperationIdentifier();
207:            }
208:
209:            /*
210:             *@return this context
211:             */
212:            /*public StaticApplicationContext getStaticContext () {
213:                return this;
214:            }*/
215:
216:            /**
217:             * equals operator
218:             * @param obj the Object to be compared with this context for equality
219:             * @return true if the argument object is equal to this context
220:             */
221:            public boolean equals(Object obj) {
222:                if (obj instanceof  StaticApplicationContext) {
223:                    return equals((StaticApplicationContext) obj);
224:                }
225:                return false;
226:            }
227:
228:            /**
229:             * equals operator
230:             * @param ctx the StaticApplicationContext to be compared with this context for equality
231:             * @return true if the argument context is equal to this context
232:             */
233:            public boolean equals(StaticApplicationContext ctx) {
234:
235:                boolean b1 = (UUID.equalsIgnoreCase(ctx.getUUID())); /* &&
236:                                 contextRoot.equalsIgnoreCase (ctx.getApplicationContextRoot()));*/
237:                if (!b1)
238:                    return false;
239:
240:                boolean b2 = (serviceIdentifier.equalsIgnoreCase(ctx
241:                        .getServiceIdentifier())
242:                        && portIdentifier.equalsIgnoreCase(ctx
243:                                .getPortIdentifier()) && operationIdentifier
244:                        .equalsIgnoreCase(ctx.getOperationIdentifier()));
245:                if (!b2)
246:                    return false;
247:
248:                return true;
249:            }
250:
251:            // TODO : this hashcode is not unique, change it later, but it works for now
252:            // hashCode needs to be implemented by this class for the equals() operator to 
253:            // be called by the HashMap.get() method
254:            // equals() method on HashMap is only called if hashCode succeeds
255:            /**
256:             * @return hashcode for this context
257:             */
258:            public int hashCode() {
259:                return UUID.hashCode() + serviceIdentifier.hashCode()
260:                        + portIdentifier.hashCode()
261:                        + operationIdentifier.hashCode();
262:            }
263:
264:            public String toString() {
265:                String ret = "isService=" + isService + "\nisPort=" + isPort
266:                        + "\nisOperation=" + isOperation + "\nUUID=" + UUID
267:                        + "\nserviceIdentifier=" + serviceIdentifier
268:                        + "\nportIdentifier=" + portIdentifier
269:                        + "\noperationIdentifier=" + operationIdentifier;
270:                return ret;
271:            }
272:
273:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.