Source Code Cross Referenced for Destination.java in  » Web-Services-apache-cxf-2.0.1 » ws-rm » org » apache » cxf » ws » rm » 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 » Web Services apache cxf 2.0.1 » ws rm » org.apache.cxf.ws.rm 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Licensed to the Apache Software Foundation (ASF) under one
003:         * or more contributor license agreements. See the NOTICE file
004:         * distributed with this work for additional information
005:         * regarding copyright ownership. The ASF licenses this file
006:         * to you under the Apache License, Version 2.0 (the
007:         * "License"); you may not use this file except in compliance
008:         * with the License. You may obtain a copy of the License at
009:         *
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing,
013:         * software distributed under the License is distributed on an
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015:         * KIND, either express or implied. See the License for the
016:         * specific language governing permissions and limitations
017:         * under the License.
018:         */package org.apache.cxf.ws.rm;
019:
020:        import java.util.Collection;
021:        import java.util.HashMap;
022:        import java.util.Map;
023:
024:        import org.apache.cxf.helpers.CastUtils;
025:        import org.apache.cxf.message.Message;
026:        import org.apache.cxf.ws.addressing.AddressingPropertiesImpl;
027:        import org.apache.cxf.ws.rm.persistence.RMStore;
028:
029:        public class Destination extends AbstractEndpoint {
030:
031:            private Map<String, DestinationSequence> map;
032:
033:            Destination(RMEndpoint reliableEndpoint) {
034:                super (reliableEndpoint);
035:                map = new HashMap<String, DestinationSequence>();
036:            }
037:
038:            public DestinationSequence getSequence(Identifier id) {
039:                return map.get(id.getValue());
040:            }
041:
042:            public Collection<DestinationSequence> getAllSequences() {
043:                return CastUtils.cast(map.values());
044:            }
045:
046:            public void addSequence(DestinationSequence seq) {
047:                addSequence(seq, true);
048:            }
049:
050:            public void addSequence(DestinationSequence seq, boolean persist) {
051:                seq.setDestination(this );
052:                map.put(seq.getIdentifier().getValue(), seq);
053:                if (persist) {
054:                    RMStore store = getReliableEndpoint().getManager()
055:                            .getStore();
056:                    if (null != store) {
057:                        store.createDestinationSequence(seq);
058:                    }
059:                }
060:            }
061:
062:            public void removeSequence(DestinationSequence seq) {
063:                map.remove(seq.getIdentifier().getValue());
064:                RMStore store = getReliableEndpoint().getManager().getStore();
065:                if (null != store) {
066:                    store.removeDestinationSequence(seq.getIdentifier());
067:                }
068:            }
069:
070:            /**
071:             * Acknowledges receipt of a message. If the message is the last in the
072:             * sequence, sends an out-of-band SequenceAcknowledgement unless there a
073:             * response will be sent to the acksTo address onto which the acknowldegment
074:             * can be piggybacked.
075:             * 
076:             * @param sequenceType the sequenceType object that includes identifier and
077:             *            message number (and possibly a lastMessage element) for the
078:             *            message to be acknowledged)
079:             * @param replyToAddress the replyTo address of the message that carried
080:             *            this sequence information
081:             * @throws SequenceFault if the sequence specified in
082:             *             <code>sequenceType</code> does not exist
083:             */
084:            public void acknowledge(Message message) throws SequenceFault,
085:                    RMException {
086:                SequenceType sequenceType = RMContextUtils
087:                        .retrieveRMProperties(message, false).getSequence();
088:                if (null == sequenceType) {
089:                    return;
090:                }
091:
092:                DestinationSequence seq = getSequence(sequenceType
093:                        .getIdentifier());
094:
095:                if (null != seq) {
096:                    seq.applyDeliveryAssurance(sequenceType.getMessageNumber());
097:                    seq.acknowledge(message);
098:
099:                    if (null != sequenceType.getLastMessage()) {
100:                        seq.setLastMessageNumber(sequenceType
101:                                .getMessageNumber());
102:                        ackImmediately(seq, message);
103:                    }
104:                } else {
105:                    SequenceFaultFactory sff = new SequenceFaultFactory();
106:                    throw sff.createUnknownSequenceFault(sequenceType
107:                            .getIdentifier());
108:                }
109:            }
110:
111:            void ackRequested(Message message) throws SequenceFault,
112:                    RMException {
113:                // TODO
114:                Collection<AckRequestedType> ars = RMContextUtils
115:                        .retrieveRMProperties(message, false)
116:                        .getAcksRequested();
117:                if (null == ars) {
118:                    return;
119:                }
120:                for (AckRequestedType ar : ars) {
121:                    Identifier id = ar.getIdentifier();
122:                    DestinationSequence seq = getSequence(id);
123:                    if (null == seq) {
124:                        continue;
125:                    }
126:                    ackImmediately(seq, message);
127:                }
128:            }
129:
130:            void ackImmediately(DestinationSequence seq, Message message)
131:                    throws RMException {
132:
133:                seq.scheduleImmediateAcknowledgement();
134:
135:                // if we cannot expect an outgoing message to which the
136:                // acknowledgement
137:                // can be added we need to send an out-of-band
138:                // SequenceAcknowledgement message
139:
140:                AddressingPropertiesImpl maps = RMContextUtils.retrieveMAPs(
141:                        message, false, false);
142:                String replyToAddress = null;
143:                if (null != maps.getReplyTo()) {
144:                    replyToAddress = maps.getReplyTo().getAddress().getValue();
145:                }
146:                if (!(seq.getAcksTo().getAddress().getValue().equals(
147:                        replyToAddress) || seq
148:                        .canPiggybackAckOnPartialResponse())) {
149:                    getReliableEndpoint().getProxy().acknowledge(seq);
150:                }
151:            }
152:
153:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.