Source Code Cross Referenced for LifeCycleEndpoint.java in  » ESB » cbesb-1.2 » com » bostechcorp » cbesb » runtime » ccsl » jbi » messaging » 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 » ESB » cbesb 1.2 » com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging;
002:
003:        import java.util.Vector;
004:
005:        import javax.jbi.messaging.MessageExchange.Role;
006:
007:        import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.notification.JMSNotification;
008:        import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.notification.MessageProcessNotification;
009:        import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.notification.StateChangeNotification;
010:
011:        public abstract class LifeCycleEndpoint extends EndpointProcessor {
012:
013:            protected String currentState = StatusConstants.STATUS_UNKNOWN;
014:            protected String detailedStatus = "";
015:            protected static long notificationSequence;
016:            protected boolean forceShutdown;
017:
018:            public String getState() {
019:                return currentState;
020:            }
021:
022:            public void setState(String s) {
023:                sendStateChangeNotification(currentState, s);
024:                currentState = s;
025:            }
026:
027:            public void setState(String s, String detail) {
028:                detailedStatus = detail;
029:                setState(s);
030:            }
031:
032:            public String[] getDisplayParameterTitles() {
033:                return new String[] {};
034:            }
035:
036:            public String[] getDisplayParameters() {
037:                return new String[] {};
038:            }
039:
040:            public void stop() throws Exception {
041:                setState(StatusConstants.STATUS_CLOSING);
042:                /**
043:                 * The estimation of activated is important for the first deactivate time 
044:                 */
045:                if (activated != null) {
046:                    if (getRole() == Role.PROVIDER) {
047:
048:                        providerProc.stop();
049:                    } else {
050:
051:                        providerProc.stop();
052:                        consumerProc.stop();
053:                    }
054:                }
055:                setState(StatusConstants.STATUS_DOWN);
056:
057:            }
058:
059:            public void start() throws Exception {
060:                setState(StatusConstants.STATUS_OPENING);
061:                /**
062:                 * The estimation of activated is important for the first activate time
063:                 */
064:                if (activated != null) {
065:
066:                    if (getRole() == Role.PROVIDER) {
067:                        providerProc.start();
068:                    } else {
069:                        consumerProc.start();
070:                        // The consumer endpoint also needs an provider processor for accept the MessageExchange in DONE or ERROR status
071:                        // It is not meaned to handle the ACTIVE MessageExchange
072:                        providerProc.start();
073:                    }
074:                }
075:                setState(StatusConstants.STATUS_UP);
076:
077:            }
078:
079:            /*
080:             * This returns a list of all properties that can be read
081:             */
082:            public String[] getGetableProperties() {
083:                return new String[] {};
084:            }
085:
086:            /*
087:             * This returns a list of all properties that may be set.
088:             */
089:            public String[] getSetableProperties() {
090:                return new String[] {};
091:            }
092:
093:            /* This broadcasts a JMX notification from the LifeCycleExtension that indicates a state change
094:             * on the endpoint.
095:             */
096:            protected void sendStateChangeNotification(String oldState,
097:                    String newState) {
098:                CbExtendedComponent comp = (CbExtendedComponent) getServiceUnit()
099:                        .getComponent();
100:                CbExtendedLifeCycle elc = (CbExtendedLifeCycle) comp
101:                        .getLifeCycle();
102:                LifeCycleExtension lcext = (LifeCycleExtension) elc
103:                        .getExtensionMBean();
104:                StateChangeNotification notification = new StateChangeNotification(
105:                        comp.getComponentName() + "EndpointNotification", elc
106:                                .getExtensionMBeanName(),
107:                        notificationSequence++, System.currentTimeMillis(),
108:                        comp.getComponentName(), this .getEndpoint(), oldState,
109:                        newState);
110:                lcext.sendNotification(notification);
111:            }
112:
113:            public void sendMessageProcessedNotification(long latency) {
114:                CbExtendedComponent comp = (CbExtendedComponent) getServiceUnit()
115:                        .getComponent();
116:                CbExtendedLifeCycle elc = (CbExtendedLifeCycle) comp
117:                        .getLifeCycle();
118:                LifeCycleExtension lcext = (LifeCycleExtension) elc
119:                        .getExtensionMBean();
120:                MessageProcessNotification notification = new MessageProcessNotification(
121:                        MessageProcessNotification.TYPE_MESSAGEPROCESSED, elc
122:                                .getExtensionMBeanName(),
123:                        notificationSequence++, System.currentTimeMillis(),
124:                        this .getSaName(), this .getServiceUnit().getName(), this 
125:                                .getEndpoint(),
126:                        getRole() == Role.PROVIDER ? "provider" : "consumer",
127:                        latency);
128:                lcext.sendNotification(notification);
129:            }
130:
131:            public void sendJMSDLQNotification() {
132:                CbExtendedComponent comp = (CbExtendedComponent) getServiceUnit()
133:                        .getComponent();
134:                CbExtendedLifeCycle elc = (CbExtendedLifeCycle) comp
135:                        .getLifeCycle();
136:                LifeCycleExtension lcext = (LifeCycleExtension) elc
137:                        .getExtensionMBean();
138:                JMSNotification notification = new JMSNotification(
139:                        JMSNotification.TYPE_DLQ, elc.getExtensionMBeanName(),
140:                        notificationSequence++, System.currentTimeMillis(),
141:                        this .getSaName(), this .getServiceUnit().getName(), this 
142:                                .getEndpoint(),
143:                        getRole() == Role.PROVIDER ? "provider" : "consumer");
144:                notification.setPutOneToDLQ(true);
145:                lcext.sendNotification(notification);
146:            }
147:
148:            public void sendJMSRetryCountExceededNotification() {
149:                CbExtendedComponent comp = (CbExtendedComponent) getServiceUnit()
150:                        .getComponent();
151:                CbExtendedLifeCycle elc = (CbExtendedLifeCycle) comp
152:                        .getLifeCycle();
153:                LifeCycleExtension lcext = (LifeCycleExtension) elc
154:                        .getExtensionMBean();
155:                JMSNotification notification = new JMSNotification(
156:                        JMSNotification.TYPE_RETRY_COUNT_EXCEEDED, elc
157:                                .getExtensionMBeanName(),
158:                        notificationSequence++, System.currentTimeMillis(),
159:                        this .getSaName(), this .getServiceUnit().getName(), this 
160:                                .getEndpoint(),
161:                        getRole() == Role.PROVIDER ? "provider" : "consumer");
162:                notification.setRetryCountExceeded(true);
163:                lcext.sendNotification(notification);
164:            }
165:
166:            public void sendJMSTransactionRollBackNotification() {
167:                CbExtendedComponent comp = (CbExtendedComponent) getServiceUnit()
168:                        .getComponent();
169:                CbExtendedLifeCycle elc = (CbExtendedLifeCycle) comp
170:                        .getLifeCycle();
171:                LifeCycleExtension lcext = (LifeCycleExtension) elc
172:                        .getExtensionMBean();
173:                JMSNotification notification = new JMSNotification(
174:                        JMSNotification.TYPE_TRANSACTION_ROLL_BACK, elc
175:                                .getExtensionMBeanName(),
176:                        notificationSequence++, System.currentTimeMillis(),
177:                        this .getSaName(), this .getServiceUnit().getName(), this 
178:                                .getEndpoint(),
179:                        getRole() == Role.PROVIDER ? "provider" : "consumer");
180:                notification.setTransactionRollback(true);
181:                lcext.sendNotification(notification);
182:            }
183:
184:            public String[][] getGetablePropertyObjects() {
185:                Vector<String[]> properties = new Vector<String[]>();
186:                for (int i = 0; i < getGetableProperties().length; i++) {
187:                    properties.add(new String[] { getGetableProperties()[i],
188:                            getProperty(i) });
189:                }
190:                return properties.toArray(new String[][] {});
191:            }
192:
193:            /*
194:             * This gets one property from the list above.
195:             */
196:            public String getProperty(String property) {
197:                int found = -1;
198:                for (int i = 0; i < getGetableProperties().length; i++)
199:                    if (property.equals(getGetableProperties()[i])) {
200:                        found = i;
201:                        break;
202:                    }
203:
204:                return getProperty(found);
205:            }
206:
207:            /*
208:             * This sets one property from the list above.
209:             */
210:            public void setProperty(String property, String value) {
211:                int found = -1;
212:                for (int i = 0; i < getSetableProperties().length; i++)
213:                    if (property.equals(getSetableProperties()[i])) {
214:                        found = i;
215:                        break;
216:                    }
217:                setProperty(found, value);
218:            }
219:
220:            public void setProperty(int index, String value) {
221:
222:            }
223:
224:            public String getProperty(int index) {
225:                return null;
226:            }
227:
228:            protected void postProcess(long startProcessTime) {
229:
230:                sendMessageProcessedNotification(System.currentTimeMillis()
231:                        - startProcessTime);
232:
233:            }
234:        }
ww_w__.___j___av_a_2___s__._c___o___m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.