Source Code Cross Referenced for SequenceConfig.java in  » 6.0-JDK-Modules-com.sun » wsit » com » sun » xml » ws » rm » jaxws » runtime » 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 » wsit » com.sun.xml.ws.rm.jaxws.runtime 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         * 
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         * 
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common Development
008:         * and Distribution License("CDDL") (collectively, the "License").  You
009:         * may not use this file except in compliance with the License. You can obtain
010:         * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011:         * or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
012:         * language governing permissions and limitations under the License.
013:         * 
014:         * When distributing the software, include this License Header Notice in each
015:         * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016:         * Sun designates this particular file as subject to the "Classpath" exception
017:         * as provided by Sun in the GPL Version 2 section of the License file that
018:         * accompanied this code.  If applicable, add the following below the License
019:         * Header, with the fields enclosed by brackets [] replaced by your own
020:         * identifying information: "Portions Copyrighted [year]
021:         * [name of copyright owner]"
022:         * 
023:         * Contributor(s):
024:         * 
025:         * If you wish your version of this file to be governed by only the CDDL or
026:         * only the GPL Version 2, indicate your decision by adding "[Contributor]
027:         * elects to include this software in this distribution under the [CDDL or GPL
028:         * Version 2] license."  If you don't indicate a single choice of license, a
029:         * recipient has the option to distribute your version of this file under
030:         * either the CDDL, the GPL Version 2 or to extend the choice of license to
031:         * its licensees as provided above.  However, if you add GPL Version 2 code
032:         * and therefore, elected the GPL Version 2 license, then the option applies
033:         * only if the new code is made subject to such option by the copyright
034:         * holder.
035:         */
036:
037:        /*
038:         * SequenceConfig.java
039:         *
040:         * @author Mike Grogan
041:         * Created on October 16, 2005, 1:23 PM
042:         *
043:         */
044:
045:        package com.sun.xml.ws.rm.jaxws.runtime;
046:
047:        import com.sun.xml.ws.api.SOAPVersion;
048:        import com.sun.xml.ws.api.WSBinding;
049:        import com.sun.xml.ws.api.addressing.AddressingVersion;
050:        import com.sun.xml.ws.api.model.wsdl.WSDLBoundPortType;
051:        import com.sun.xml.ws.api.model.wsdl.WSDLModel;
052:        import com.sun.xml.ws.api.model.wsdl.WSDLPort;
053:        import com.sun.xml.ws.api.rm.SequenceSettings;
054:        import com.sun.xml.ws.policy.*;
055:        import com.sun.xml.ws.policy.jaxws.WSDLPolicyMapWrapper;
056:        import com.sun.xml.ws.rm.RMConstants;
057:        import com.sun.xml.ws.rm.RMException;
058:        import com.sun.xml.ws.rm.RMVersion;
059:
060:        import javax.xml.namespace.QName;
061:        import javax.xml.ws.WebServiceException;
062:        import java.util.Iterator;
063:
064:        /**
065:         * SequenceConfig stores settings read from a WS-RM Policy Assertion in a Web Service's
066:         * metadata and is used enable/disable and configure reliable messaging on bindings
067:         * to which the policy assertion is attached.  (Placeholder for now pending WS-Policy
068:         * implementation)
069:         */
070:        public class SequenceConfig extends SequenceSettings {
071:
072:            /**
073:             * Constructor initializes with default values.
074:             */
075:            public SequenceConfig() {
076:
077:                //Use anonymous URI for acksTo.  Its value depends on 
078:                //WS-Addressing version being used
079:
080:                if (constants == null) {
081:                    //hardcoding W3C as default
082:                    constants = RMConstants
083:                            .getRMConstants(AddressingVersion.W3C);
084:                }
085:                acksTo = constants.getAnonymousURI().toString();
086:
087:                ordered = false;
088:                allowDuplicates = false;
089:                inactivityTimeout = 600000;
090:                flowControl = false;
091:                bufferSize = 32;
092:                soapVersion = SOAPVersion.SOAP_12;
093:
094:                ackRequestInterval = 0;
095:                resendInterval = 0;
096:
097:                closeTimeout = 0; //infinite
098:                sequenceSTR = false;
099:                sequenceTransportSecurity = false;
100:
101:            }
102:
103:            public SequenceConfig(WSDLPort port, WSBinding wsbinding) {
104:
105:                this ();
106:                if (port != null) {
107:                    WSDLBoundPortType binding = port.getBinding();
108:                    WSDLModel model = binding.getOwner();
109:                    PolicyMap policyMap = model.getExtension(
110:                            WSDLPolicyMapWrapper.class).getPolicyMap();
111:                    this .constants = RMConstants.getRMConstants(wsbinding
112:                            .getAddressingVersion());
113:                    try {
114:                        init(port, policyMap);
115:                    } catch (RMException e) {
116:                        throw new WebServiceException(e);
117:                    }
118:                }
119:            }
120:
121:            /**
122:             * Copies the members of a specified SequenceSettings
123:             */
124:            public SequenceConfig(SequenceSettings toCopy) {
125:
126:                this .ackRequestInterval = toCopy.ackRequestInterval;
127:                this .acksTo = toCopy.acksTo;
128:                this .allowDuplicates = toCopy.allowDuplicates;
129:                this .bufferSize = toCopy.bufferSize;
130:                this .closeTimeout = toCopy.closeTimeout;
131:                this .constants = toCopy.constants;
132:                this .flowControl = toCopy.flowControl;
133:                this .inactivityTimeout = toCopy.inactivityTimeout;
134:                this .ordered = toCopy.ordered;
135:                this .resendInterval = toCopy.resendInterval;
136:                this .soapVersion = toCopy.soapVersion;
137:                this .sequenceSTR = toCopy.sequenceSTR;
138:                this .sequenceTransportSecurity = toCopy.sequenceTransportSecurity;
139:                this .rmVersion = toCopy.rmVersion;
140:
141:            }
142:
143:            /**
144:             * Accessor for the <code>acksTo</code> property.
145:             *
146:             * @return The value of the property.
147:             */
148:            public String getAcksTo() {
149:                return acksTo;
150:            }
151:
152:            /**
153:             * Mutator for the <code>AcksTo</code> property.
154:             *
155:             * @param acksTo The new value of the property.
156:             */
157:            public void setAcksTo(String acksTo) {
158:                this .acksTo = acksTo;
159:            }
160:
161:            /**
162:             * Accessor for <code>ordered</code> property.
163:             *
164:             * @return The value of the property.
165:             */
166:            public boolean getOrdered() {
167:                return ordered;
168:            }
169:
170:            /**
171:             * Mutator for the <code>ordered</code> property.
172:             *
173:             * @param ordered The new value of the property.
174:             */
175:            public void setOrdered(boolean ordered) {
176:                this .ordered = ordered;
177:            }
178:
179:            /**
180:             * Accessor for <code>inactivityTimeout</code> property.
181:             *
182:             * @return The value of the property.
183:             */
184:            public long getInactivityTimeout() {
185:                return inactivityTimeout;
186:            }
187:
188:            /**
189:             * Mutator for the <code>inactivityTimeout</code> property.
190:             *
191:             * @param inactivityTimeout The new value of the property.
192:             */
193:            public void setInactivityTimeout(long inactivityTimeout) {
194:                this .inactivityTimeout = inactivityTimeout;
195:            }
196:
197:            /**
198:             * Accessor for <code>bufferSize</code> property.
199:             *
200:             * @return The value of the property.
201:             */
202:            public int getBufferSize() {
203:                return bufferSize;
204:            }
205:
206:            /**
207:             * Mutator for the <code>bufferSize</code> property.
208:             *
209:             * @param bufferSize The new value of the property.
210:             */
211:            public void setBufferSize(int bufferSize) {
212:                this .bufferSize = bufferSize;
213:            }
214:
215:            /**
216:             * Accessor for the closeTimeout property.
217:             *
218:             * @return The value of the property.
219:             */
220:            public long getCloseTimeout() {
221:                return closeTimeout;
222:            }
223:
224:            /**
225:             * Mutator for the closeTimeout property.
226:             *
227:             * @param The new value.
228:             */
229:            public void setCloseTimeout(long timeout) {
230:                closeTimeout = timeout;
231:            }
232:
233:            /**
234:             * Returns the SOAPVersion obtained from the WSBinding
235:             * Defaulting to SOAP_12
236:             *
237:             * @return SOAPVersion should not be null
238:             */
239:            public SOAPVersion getSoapVersion() {
240:                if (soapVersion != null)
241:                    return soapVersion;
242:                //TODO check if this defaulting is ok
243:                else
244:                    return SOAPVersion.SOAP_12;
245:            }
246:
247:            public void setSoapVersion(SOAPVersion soapVersion) {
248:                this .soapVersion = soapVersion;
249:            }
250:
251:            /**
252:             * Accessor for flow control field
253:             *
254:             * @return The value of the field.
255:             */
256:            public boolean getFlowControl() {
257:                return flowControl;
258:            }
259:
260:            /**
261:             * Mutator for the flow control field
262:             *
263:             * @param The new value
264:             */
265:            public void setFlowControl(boolean use) {
266:                flowControl = use;
267:            }
268:
269:            /**
270:             * Accessor for resendIterval field
271:             *
272:             * @return The value of the field.
273:             */
274:            public long getResendInterval() {
275:                return resendInterval;
276:            }
277:
278:            /**
279:             * Mutator for the flow control field
280:             *
281:             * @param The new value
282:             */
283:            public void setResendInterval(long interval) {
284:                resendInterval = interval;
285:            }
286:
287:            /**
288:             * Accessor for ackRequestIterval field
289:             *
290:             * @return The value of the field.
291:             */
292:            public long getAckRequestInterval() {
293:                return ackRequestInterval;
294:            }
295:
296:            /**
297:             * Mutator for the ackRequestInterval field
298:             *
299:             * @param The new value
300:             */
301:            public void setAckRequestInterval(long interval) {
302:                ackRequestInterval = interval;
303:            }
304:
305:            public void init(WSDLPort port, PolicyMap policyMap)
306:                    throws RMException {
307:
308:                try {
309:
310:                    if (policyMap != null) {
311:                        PolicyMapKey endpointScopeKey = policyMap
312:                                .createWsdlEndpointScopeKey(port.getOwner()
313:                                        .getName(), port.getName());
314:
315:                        if (endpointScopeKey != null) {
316:
317:                            AssertionSet policyAssertionSet = null;
318:
319:                            Policy policy = policyMap
320:                                    .getEndpointEffectivePolicy(endpointScopeKey);
321:                            if (policy != null) {
322:                                for (AssertionSet set : policy) {
323:                                    policyAssertionSet = set;
324:                                    break;
325:                                }
326:                            }
327:
328:                            if (policyAssertionSet != null) {
329:
330:                                PolicyAssertion rmAssertion = null;
331:                                PolicyAssertion flowAssertion = null;
332:
333:                                for (PolicyAssertion assertion : policyAssertionSet) {
334:                                    QName qname = assertion.getName();
335:
336:                                    if (qname.equals(RMVersion.WSRM10
337:                                            .getRMPolicyAssertionQName())) {
338:                                        rmVersion = RMVersion.WSRM10;
339:                                        rmAssertion = assertion;
340:                                    } else if (qname.equals(RMVersion.WSRM11
341:                                            .getRMPolicyAssertionQName())) {
342:                                        rmVersion = RMVersion.WSRM11;
343:                                        rmAssertion = assertion;
344:                                    } else if (qname.equals(constants
345:                                            .getRMFlowControlQName())) {
346:                                        flowAssertion = assertion;
347:                                    } else if (qname.equals(constants
348:                                            .getOrderedQName())) {
349:                                        ordered = true;
350:                                    } else if (qname.equals(constants
351:                                            .getAllowDuplicatesQName())) {
352:                                        allowDuplicates = true;
353:                                    } else if (qname.equals(constants
354:                                            .getAckRequestIntervalQName())) {
355:                                        String num = assertion
356:                                                .getAttributeValue(new QName(
357:                                                        "", "Milliseconds"));
358:                                        if (num != null) {
359:                                            ackRequestInterval = Long
360:                                                    .parseLong(num);
361:                                        }
362:                                    } else if (qname.equals(constants
363:                                            .getResendIntervalQName())) {
364:                                        String num = assertion
365:                                                .getAttributeValue(new QName(
366:                                                        "", "Milliseconds"));
367:                                        if (num != null) {
368:                                            resendInterval = Long
369:                                                    .parseLong(num);
370:                                        }
371:                                    } else if (qname.equals(constants
372:                                            .getCloseTimeoutQName())) {
373:                                        String num = assertion
374:                                                .getAttributeValue(new QName(
375:                                                        "", "Milliseconds"));
376:                                        if (num != null) {
377:                                            closeTimeout = Long.parseLong(num);
378:                                        }
379:                                    } else if (qname.equals(RMVersion.WSRM11
380:                                            .getSequenceSTRAssertionQName())) {
381:                                        sequenceSTR = true;
382:                                    } else if (qname
383:                                            .equals(RMVersion.WSRM11
384:                                                    .getSequenceTransportSecurityAssertionQName())) {
385:                                        sequenceTransportSecurity = true;
386:                                    } else {
387:                                        //TODO handle error condition here
388:                                    }
389:                                }
390:
391:                                if (rmAssertion != null) {
392:                                    handleRMAssertion(rmAssertion);
393:                                }
394:
395:                                if (flowAssertion != null)
396:                                    handleFlowAssertion(flowAssertion);
397:                            }
398:                        }
399:                    }
400:
401:                } catch (PolicyException e) {
402:                    e.printStackTrace();
403:                }
404:            }
405:
406:            private void handleRMAssertion(PolicyAssertion rmAssertion) {
407:
408:                Iterator<PolicyAssertion> it = rmAssertion
409:                        .getNestedAssertionsIterator();
410:
411:                while (it != null && it.hasNext()) {
412:                    PolicyAssertion assertion = it.next();
413:                    if (assertion.getName().equals(
414:                            rmVersion.getInactivityTimeoutAssertionQName())) {
415:
416:                        String num = assertion.getAttributeValue(new QName("",
417:                                "Milliseconds"));
418:
419:                        if (num != null) {
420:                            inactivityTimeout = Long.parseLong(num);
421:                        }
422:                        //TODO - disregard other nested assertions for now.
423:                        //possibly revisit this later
424:                    }
425:                }
426:            }
427:
428:            private void handleFlowAssertion(PolicyAssertion flowAssertion) {
429:
430:                flowControl = true;
431:
432:                Iterator<PolicyAssertion> it = flowAssertion
433:                        .getNestedAssertionsIterator();
434:                while (it != null && it.hasNext()) {
435:                    PolicyAssertion assertion = it.next();
436:                    if (assertion.getName().equals(
437:                            constants.getMaxReceiveBufferSizeQName())) {
438:                        bufferSize = Integer.parseInt(assertion.getValue());
439:                        break;
440:                    }
441:                }
442:            }
443:
444:            /**
445:             *  Returns the RMConstants based on the AddressingVersion
446:             * @return RMConstants
447:             */
448:            public RMConstants getRMConstants() {
449:                return constants;
450:            }
451:
452:            public RMConstants getConstants() {
453:                return constants;
454:            }
455:
456:            public boolean isAllowDuplicates() {
457:                return allowDuplicates;
458:            }
459:
460:            public RMVersion getRMVersion() {
461:                return rmVersion;
462:            }
463:        }
w_w___w_.___ja___v_a2__s.c_om___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.