Source Code Cross Referenced for ResponseEvent.java in  » Net » snmp4j » org » snmp4j » event » 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 » Net » snmp4j » org.snmp4j.event 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*_############################################################################
002:          _## 
003:          _##  SNMP4J - ResponseEvent.java  
004:          _## 
005:          _##  Copyright (C) 2003-2008  Frank Fock and Jochen Katz (SNMP4J.org)
006:          _##  
007:          _##  Licensed under the Apache License, Version 2.0 (the "License");
008:          _##  you may not use this file except in compliance with the License.
009:          _##  You may obtain a copy of the License at
010:          _##  
011:          _##      http://www.apache.org/licenses/LICENSE-2.0
012:          _##  
013:          _##  Unless required by applicable law or agreed to in writing, software
014:          _##  distributed under the License is distributed on an "AS IS" BASIS,
015:          _##  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016:          _##  See the License for the specific language governing permissions and
017:          _##  limitations under the License.
018:          _##  
019:          _##########################################################################*/
020:
021:        package org.snmp4j.event;
022:
023:        import java.util.EventObject;
024:
025:        import org.snmp4j.PDU;
026:        import org.snmp4j.smi.Address; // Imports needed for JavaDoc
027:        import org.snmp4j.Session;
028:
029:        /**
030:         * <code>ResponseEvent</code> associates a request PDU with the corresponding
031:         * response and an optional user object.
032:         *
033:         * @author Frank Fock
034:         * @version 1.1
035:         */
036:        public class ResponseEvent extends EventObject {
037:
038:            private static final long serialVersionUID = 3966730838956160070L;
039:
040:            private Address peerAddress;
041:            private PDU request;
042:            private PDU response;
043:            private Object userObject;
044:            private Exception error;
045:
046:            /**
047:             * Creates an <code>ResponseEvent</code> instance.
048:             * @param source
049:             *    the event source.
050:             * @param peerAddress
051:             *    the transport address of the entity that send the response.
052:             * @param request
053:             *    the request PDU (must not be <code>null</code>).
054:             * @param response
055:             *    the response PDU or <code>null</code> if the request timed out.
056:             * @param userObject
057:             *    an optional user object.
058:             */
059:            public ResponseEvent(Object source, Address peerAddress,
060:                    PDU request, PDU response, Object userObject) {
061:                super (source);
062:                setPeerAddress(peerAddress);
063:                setRequest(request);
064:                setResponse(response);
065:                setUserObject(userObject);
066:            }
067:
068:            /**
069:             * Creates an <code>ResponseEvent</code> instance with an exception object
070:             * indicating a message processing error.
071:             * @param source
072:             *    the event source.
073:             * @param peerAddress
074:             *    the transport address of the entity that send the response.
075:             * @param request
076:             *    the request PDU (must not be <code>null</code>).
077:             * @param response
078:             *    the response PDU or <code>null</code> if the request timed out.
079:             * @param userObject
080:             *    an optional user object.
081:             * @param error
082:             *    an <code>Exception</code>.
083:             */
084:            public ResponseEvent(Object source, Address peerAddress,
085:                    PDU request, PDU response, Object userObject,
086:                    Exception error) {
087:                this (source, peerAddress, request, response, userObject);
088:                this .error = error;
089:            }
090:
091:            /**
092:             * Gets the request PDU.
093:             * @return
094:             *    a <code>PDU</code>.
095:             */
096:            public PDU getRequest() {
097:                return request;
098:            }
099:
100:            protected final void setPeerAddress(Address peerAddress) {
101:                this .peerAddress = peerAddress;
102:            }
103:
104:            protected final void setRequest(PDU request) {
105:                this .request = request;
106:            }
107:
108:            protected final void setResponse(PDU response) {
109:                this .response = response;
110:            }
111:
112:            /**
113:             * Gets the response PDU.
114:             * @return
115:             *    a PDU instance if a response has been received. If the request
116:             *    timed out then <code>null</code> will be returned.
117:             */
118:            public PDU getResponse() {
119:                return response;
120:            }
121:
122:            protected final void setUserObject(Object userObject) {
123:                this .userObject = userObject;
124:            }
125:
126:            /**
127:             * Gets the user object that has been supplied to the asynchronous request
128:             * {@link Session#send(PDU pdu, Target target, Object userHandle,
129:             * ResponseListener listener)}.
130:             * @return
131:             *    an Object.
132:             */
133:            public Object getUserObject() {
134:                return userObject;
135:            }
136:
137:            /**
138:             * Gets the exception object from the exception that has been generated
139:             * when the request processing has failed due to an error.
140:             * @return
141:             *    an <code>Exception</code> instance.
142:             */
143:            public Exception getError() {
144:                return error;
145:            }
146:
147:            /**
148:             * Gets the transport address of the response sender.
149:             * @return
150:             *    the transport <code>Address</code> of the command responder that send
151:             *    this response, or <code>null</code> if no response has been received
152:             *    within the time-out interval or if an error occured (see
153:             *    {@link #getError()}).
154:             */
155:            public Address getPeerAddress() {
156:                return peerAddress;
157:            }
158:
159:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.