Source Code Cross Referenced for LinkedEndpoint.java in  » ESB » open-esb » com » sun » 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 » open esb » com.sun.jbi.messaging 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * BEGIN_HEADER - DO NOT EDIT
003:         *
004:         * The contents of this file are subject to the terms
005:         * of the Common Development and Distribution License
006:         * (the "License").  You may not use this file except
007:         * in compliance with the License.
008:         *
009:         * You can obtain a copy of the license at
010:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011:         * See the License for the specific language governing
012:         * permissions and limitations under the License.
013:         *
014:         * When distributing Covered Code, include this CDDL
015:         * HEADER in each file and include the License file at
016:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017:         * If applicable add the following below this CDDL HEADER,
018:         * with the fields enclosed by brackets "[]" replaced with
019:         * your own identifying information: Portions Copyright
020:         * [year] [name of copyright owner]
021:         */
022:
023:        /*
024:         * @(#)LinkedEndpoint.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package com.sun.jbi.messaging;
030:
031:        import com.sun.jbi.messaging.stats.Value;
032:        import com.sun.jbi.messaging.stats.METimestamps;
033:
034:        import javax.management.openmbean.CompositeData;
035:        import javax.management.openmbean.CompositeDataSupport;
036:        import javax.management.openmbean.CompositeType;
037:        import javax.management.openmbean.SimpleType;
038:        import javax.management.openmbean.OpenType;
039:
040:        import javax.xml.namespace.QName;
041:
042:        /** 
043:         * @author Sun Microsystems, Inc.
044:         */
045:        public class LinkedEndpoint extends RegisteredEndpoint {
046:            /** Linked endpoints are global in scope and are activated as a result of
047:             *  service connection information in a service assembly.  Therefore they 
048:             *  are not 'owned' by a single component.  This constant is provided so
049:             *  to avoid a null ownerId var in RegisteredEndpoint.
050:             */
051:            private static final String OWNER_ID = "<NotKnownYet>";
052:
053:            private QName mServiceLink;
054:            private String mEndpointLink;
055:            private Link mLinkType;
056:
057:            /** Creates a new MappedEndpoint.
058:             *  @param service service name
059:             *  @param endpoint endpoint name
060:             *  @param linkType link type for connection mapping
061:             *  @param reference endpoint reference for this endpoint
062:             *  @param type endpoint type
063:             */
064:            public LinkedEndpoint(QName fromService, String fromEndpoint,
065:                    QName toService, String toEndpoint, Link linkType) {
066:                super (fromService, fromEndpoint, OWNER_ID);
067:
068:                mLinkType = linkType;
069:                mServiceLink = toService;
070:                mEndpointLink = toEndpoint;
071:            }
072:
073:            public int getType() {
074:                return LINKED;
075:            }
076:
077:            public String getEndpointLink() {
078:                return mEndpointLink;
079:            }
080:
081:            public QName getServiceLink() {
082:                return mServiceLink;
083:            }
084:
085:            public void setInUse(String ownerId) {
086:                mActiveExchanges.incrementAndGet();
087:                if (mOwnerId.equals(OWNER_ID)) {
088:                    mOwnerId = ownerId;
089:                }
090:            }
091:
092:            /** Compares two LinkedEndpoint instances for equality. */
093:            public boolean equals(Object obj) {
094:                LinkedEndpoint le;
095:                boolean isEqual = false;
096:
097:                if (obj instanceof  LinkedEndpoint) {
098:                    le = (LinkedEndpoint) obj;
099:                    isEqual = (mLinkType == le.mLinkType)
100:                            && (mEndpointLink.equals(le.mEndpointLink))
101:                            && (mServiceLink.equals(le.mServiceLink))
102:                            && (getEndpointName().equals(le.getEndpointName()))
103:                            && (getServiceName().equals(le.getServiceName()))
104:                            && (getOwnerId().equals(le.getOwnerId()));
105:                }
106:
107:                return isEqual;
108:            }
109:
110:            /** Using to->service, to->endpoint, and from->service to produce hashcode.
111:             */
112:            public int hashCode() {
113:                return (mServiceLink.toString() + mEndpointLink + getServiceName())
114:                        .hashCode();
115:            }
116:
117:            synchronized void updateStatistics(MessageExchangeProxy me) {
118:                int mask = me.getPhaseMask();
119:                METimestamps ts = me.getTimestamps();
120:
121:                if ((mask & MessageExchangeProxy.PM_RECEIVE_REPLY) != 0) {
122:                    mReceiveReply++;
123:                }
124:                if ((mask & MessageExchangeProxy.PM_SEND_FAULT) != 0) {
125:                    mSendFault++;
126:                    mLastFaultTime = System.currentTimeMillis();
127:                }
128:                if ((mask & MessageExchangeProxy.PM_SEND_DONE) != 0) {
129:                    mSendDONE++;
130:                    mLastDONETime = System.currentTimeMillis();
131:                }
132:                if ((mask & MessageExchangeProxy.PM_SEND_ERROR) != 0) {
133:                    mSendERROR++;
134:                    mLastERRORTime = System.currentTimeMillis();
135:                }
136:                if ((mask & MessageExchangeProxy.PM_SEND_REQUEST) != 0) {
137:                    mSendRequest++;
138:                }
139:                if ((mask & MessageExchangeProxy.PM_RECEIVE_FAULT) != 0) {
140:                    mReceiveFault++;
141:                    mLastFaultTime = System.currentTimeMillis();
142:                }
143:                if ((mask & MessageExchangeProxy.PM_RECEIVE_DONE) != 0) {
144:                    mReceiveDONE++;
145:                    mLastDONETime = System.currentTimeMillis();
146:                }
147:                if ((mask & MessageExchangeProxy.PM_RECEIVE_ERROR) != 0) {
148:                    mReceiveERROR++;
149:                    mLastERRORTime = System.currentTimeMillis();
150:                }
151:                if (ts != null) {
152:                    mStatusTime.addSample(ts.mStatusTime);
153:                    mNMRTime.addSample(ts.mNMRTime);
154:                    mChannelTime.addSample(ts.mProviderChannelTime);
155:                    mComponentTime.addSample(ts.mProviderTime);
156:                }
157:            }
158:
159:            //-------------------------EndpointStatistics-------------------------------
160:
161:            public String getName() {
162:                return (toExternalName());
163:            }
164:
165:            /**
166:             * List of item names for CompositeData construction.
167:             */
168:            private static final String[] ITEM_NAMES = { "OwningChannel",
169:                    "ActiveExchanges", "SendRequest", "ReceiveReply",
170:                    "SendFault", "ReceiveFault", "LastFaultTime", "SendDONE",
171:                    "ReceiveDONE", "LastDONETime", "SendERROR", "ReceiveERROR",
172:                    "LastERRORTime", "StatusTimeMin (ns)",
173:                    "StatusTimeAvg (ns)", "StatusTimeMax (ns)",
174:                    "StatusTimeStd (ns)", "NMRTimeMin (ns)", "NMRTimeAvg (ns)",
175:                    "NMRTimeMax (ns)", "NMRTimeStd (ns)",
176:                    "ComponentTimeMin (ns)", "ComponentTimeAvg (ns)",
177:                    "ComponentTimeMax (ns)", "ComponentTimeStd (ns)",
178:                    "ChannelTimeMin (ns)", "ChannelTimeAvg (ns)",
179:                    "ChannelTimeMax (ns)", "ChannelTimeStd (ns)" };
180:
181:            /**
182:             * List of descriptions of items for ComponsiteData construction.
183:             */
184:            private static final String ITEM_DESCRIPTIONS[] = {
185:                    "Owning DeliveryChannel", "Active Exchanges",
186:                    "Number of requests sent", "Number of replies received",
187:                    "Number of faults sent", "Number of faults received",
188:                    "Timestamp of last fault", "Number of DONE requests sent",
189:                    "Number of DONE requests received",
190:                    "Timestamp of last DONE", "Number of ERROR requests sent",
191:                    "Number of ERROR requests received",
192:                    "Timestamp of last ERROR", "Status Time Min",
193:                    "Status Time Avg", "Status Time Max", "Status Time Std",
194:                    "NMR Time Min", "NMR Time Avg", "NMR Time Max",
195:                    "NMR Time Std", "Component Time Min", "Component Time Avg",
196:                    "Component Time Max", "Component Time Std",
197:                    "Channel Time Min", "Channel Time Avg", "Channel Time Max",
198:                    "Channel Time Std" };
199:
200:            /**
201:             * List of types of items for CompositeData construction.
202:             */
203:            private static final OpenType ITEM_TYPES[] = { SimpleType.STRING,
204:                    SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
205:                    SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
206:                    SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
207:                    SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
208:                    SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
209:                    SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
210:                    SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
211:                    SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
212:                    SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
213:                    SimpleType.LONG };
214:
215:            public CompositeData getStatistics() {
216:                try {
217:                    Object values[] = { mOwnerId, mActiveExchanges.get(),
218:                            mSendRequest, mReceiveReply, mSendFault,
219:                            mReceiveFault, mLastFaultTime, mSendDONE,
220:                            mReceiveDONE, mLastDONETime, mSendERROR,
221:                            mReceiveERROR, mLastERRORTime,
222:                            mStatusTime.getMin(),
223:                            (long) mStatusTime.getAverage(),
224:                            mStatusTime.getMax(), (long) mStatusTime.getSd(),
225:                            mNMRTime.getMin(), (long) mNMRTime.getAverage(),
226:                            mNMRTime.getMax(), (long) mNMRTime.getSd(),
227:                            mComponentTime.getMin(),
228:                            (long) mComponentTime.getAverage(),
229:                            mComponentTime.getMax(),
230:                            (long) mComponentTime.getSd(),
231:                            mChannelTime.getMin(),
232:                            (long) mChannelTime.getAverage(),
233:                            mChannelTime.getMax(), (long) mChannelTime.getSd() };
234:
235:                    return new CompositeDataSupport(new CompositeType(
236:                            "EndpointStatistics", "Endpoint statistics",
237:                            ITEM_NAMES, ITEM_DESCRIPTIONS, ITEM_TYPES),
238:                            ITEM_NAMES, values);
239:                } catch (javax.management.openmbean.OpenDataException odEx) {
240:                    ; // ignore this for now
241:                }
242:                return (null);
243:            }
244:
245:            public String toStringBrief() {
246:                StringBuilder sb = new StringBuilder();
247:
248:                sb.append("        EndPoint Type: Linked(Endpoint=");
249:                sb.append(mEndpointLink == null ? "Null" : mEndpointLink);
250:                sb.append(",Service=");
251:                sb.append(mServiceLink == null ? "Null" : mServiceLink);
252:                sb.append(")\n");
253:                sb.append(super .toStringBrief());
254:                return (sb.toString());
255:            }
256:
257:            public String toString() {
258:                StringBuilder sb = new StringBuilder();
259:
260:                sb.append(toStringBrief());
261:                sb.append("            SendRequest: " + mSendRequest);
262:                sb.append("  ReceiveReply: " + mReceiveReply);
263:                sb.append("\n            RecvDONE: " + mReceiveDONE);
264:                sb.append("  SendDONE: " + mSendDONE);
265:                sb.append("\n            RecvERROR: " + mReceiveERROR);
266:                sb.append("  SendERROR: " + mSendERROR);
267:                sb.append("\n            RecvFault: " + mReceiveFault);
268:                sb.append("  SendFault: " + mSendFault);
269:                if (mStatusTime != null) {
270:                    sb.append("\n            StatusTime:  "
271:                            + mStatusTime.toString());
272:                    sb.append("\n            ComponentTime: "
273:                            + mComponentTime.toString());
274:                    sb.append("\n            ChannelTime:   "
275:                            + mChannelTime.toString());
276:                    sb.append("\n            NMRTime:       "
277:                            + mNMRTime.toString());
278:                    sb.append("\n");
279:                }
280:                return (sb.toString());
281:            }
282:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.