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


001:        /*_############################################################################
002:          _## 
003:          _##  SNMP4J - StateReference.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.mp;
022:
023:        import java.util.*;
024:
025:        import org.snmp4j.*;
026:        import org.snmp4j.security.*;
027:        import org.snmp4j.smi.*;
028:        import java.io.Serializable;
029:
030:        /**
031:         * The <code>StateReference</code> class represents state information associated
032:         * with SNMP messages. The state reference is used to send response or report
033:         * (SNMPv3 only). Depending on the security model not all fields may be filled.
034:         *
035:         * @author Frank Fock
036:         * @version 1.2
037:         */
038:        public class StateReference implements  Serializable {
039:
040:            private static final long serialVersionUID = 7385215386971310699L;
041:
042:            private Address address;
043:            private transient TransportMapping transportMapping;
044:            private byte[] contextEngineID;
045:            private byte[] contextName;
046:            private SecurityModel securityModel;
047:            private byte[] securityName;
048:            private int securityLevel;
049:            private SecurityStateReference securityStateReference;
050:            private int msgID;
051:            private int maxSizeResponseScopedPDU;
052:            private int msgFlags;
053:            private PduHandle pduHandle;
054:            private byte[] securityEngineID;
055:            private int errorCode = 0;
056:
057:            /**
058:             * Default constructor.
059:             */
060:            public StateReference() {
061:            }
062:
063:            /**
064:             * Creates a state reference for community based security models.
065:             * @param pduHandle PduHandle
066:             * @param peerAddress Address
067:             * @param peerTransport
068:             *    the <code>TransportMapping</code> to be used to communicate with the
069:             *    peer.
070:             * @param secModel SecurityModel
071:             * @param secName
072:             *    a community string.
073:             * @param errorCode
074:             *    an error code associated with the SNMP message.
075:             */
076:            public StateReference(PduHandle pduHandle, Address peerAddress,
077:                    TransportMapping peerTransport, SecurityModel secModel,
078:                    byte[] secName, int errorCode) {
079:                this (0, 0, 65535, pduHandle, peerAddress, peerTransport, null,
080:                        secModel, secName, SecurityLevel.NOAUTH_NOPRIV, null,
081:                        null, null, errorCode);
082:            }
083:
084:            /**
085:             * Creates a state reference for SNMPv3 messages.
086:             * @param msgID int
087:             * @param msgFlags int
088:             * @param maxSizeResponseScopedPDU int
089:             * @param pduHandle PduHandle
090:             * @param peerAddress Address
091:             * @param peerTransport
092:             *    the <code>TransportMapping</code> to be used to communicate with the
093:             *    peer.
094:             * @param secEngineID byte[]
095:             * @param secModel SecurityModel
096:             * @param secName byte[]
097:             * @param secLevel int
098:             * @param contextEngineID byte[]
099:             * @param contextName byte[]
100:             * @param secStateReference SecurityStateReference
101:             * @param errorCode int
102:             */
103:            public StateReference(int msgID, int msgFlags,
104:                    int maxSizeResponseScopedPDU, PduHandle pduHandle,
105:                    Address peerAddress, TransportMapping peerTransport,
106:                    byte[] secEngineID, SecurityModel secModel, byte[] secName,
107:                    int secLevel, byte[] contextEngineID, byte[] contextName,
108:                    SecurityStateReference secStateReference, int errorCode) {
109:                this .msgID = msgID;
110:                this .msgFlags = msgFlags;
111:                this .maxSizeResponseScopedPDU = maxSizeResponseScopedPDU;
112:                this .pduHandle = pduHandle;
113:                this .address = peerAddress;
114:                this .transportMapping = peerTransport;
115:                this .securityEngineID = secEngineID;
116:                this .securityModel = secModel;
117:                this .securityName = secName;
118:                this .securityLevel = secLevel;
119:                this .contextEngineID = contextEngineID;
120:                this .contextName = contextName;
121:                this .securityStateReference = secStateReference;
122:                this .errorCode = errorCode;
123:            }
124:
125:            public boolean isReportable() {
126:                return ((msgFlags & 0x04) > 0);
127:            }
128:
129:            public Address getAddress() {
130:                return address;
131:            }
132:
133:            public void setAddress(org.snmp4j.smi.Address address) {
134:                this .address = address;
135:            }
136:
137:            public void setContextEngineID(byte[] contextEngineID) {
138:                this .contextEngineID = contextEngineID;
139:            }
140:
141:            public byte[] getContextEngineID() {
142:                return contextEngineID;
143:            }
144:
145:            public void setContextName(byte[] contextName) {
146:                this .contextName = contextName;
147:            }
148:
149:            public byte[] getContextName() {
150:                return contextName;
151:            }
152:
153:            public void setSecurityModel(SecurityModel securityModel) {
154:                this .securityModel = securityModel;
155:            }
156:
157:            public SecurityModel getSecurityModel() {
158:                return securityModel;
159:            }
160:
161:            public void setSecurityName(byte[] securityName) {
162:                this .securityName = securityName;
163:            }
164:
165:            public byte[] getSecurityName() {
166:                return securityName;
167:            }
168:
169:            public void setSecurityLevel(int securityLevel) {
170:                this .securityLevel = securityLevel;
171:            }
172:
173:            public int getSecurityLevel() {
174:                return securityLevel;
175:            }
176:
177:            public void setSecurityStateReference(
178:                    SecurityStateReference securityStateReference) {
179:                this .securityStateReference = securityStateReference;
180:            }
181:
182:            public SecurityStateReference getSecurityStateReference() {
183:                return securityStateReference;
184:            }
185:
186:            public void setMsgID(int msgID) {
187:                this .msgID = msgID;
188:            }
189:
190:            public int getMsgID() {
191:                return msgID;
192:            }
193:
194:            public void setMsgFlags(int msgFlags) {
195:                this .msgFlags = msgFlags;
196:            }
197:
198:            public int getMsgFlags() {
199:                return msgFlags;
200:            }
201:
202:            public void setMaxSizeResponseScopedPDU(int maxSizeResponseScopedPDU) {
203:                this .maxSizeResponseScopedPDU = maxSizeResponseScopedPDU;
204:            }
205:
206:            public int getMaxSizeResponseScopedPDU() {
207:                return maxSizeResponseScopedPDU;
208:            }
209:
210:            public PduHandle getPduHandle() {
211:                return pduHandle;
212:            }
213:
214:            public byte[] getSecurityEngineID() {
215:                return securityEngineID;
216:            }
217:
218:            public int getErrorCode() {
219:                return errorCode;
220:            }
221:
222:            public TransportMapping getTransportMapping() {
223:                return transportMapping;
224:            }
225:
226:            public void setPduHandle(PduHandle pduHandle) {
227:                this .pduHandle = pduHandle;
228:            }
229:
230:            public void setSecurityEngineID(byte[] securityEngineID) {
231:                this .securityEngineID = securityEngineID;
232:            }
233:
234:            public void setErrorCode(int errorCode) {
235:                this .errorCode = errorCode;
236:            }
237:
238:            public void setTransportMapping(TransportMapping transportMapping) {
239:                this .transportMapping = transportMapping;
240:            }
241:
242:            public boolean equals(Object o) {
243:                if (o instanceof  StateReference) {
244:                    StateReference other = (StateReference) o;
245:                    return ((msgID == other.msgID)
246:                            && ((pduHandle == null) && (other.pduHandle == null)) || (pduHandle != null)
247:                            && (pduHandle.equals(other.getPduHandle()))
248:                            && (Arrays.equals(securityEngineID,
249:                                    other.securityEngineID))
250:                            && (securityModel.equals(other.securityModel))
251:                            && (Arrays.equals(securityName, other.securityName))
252:                            && (securityLevel == other.securityLevel)
253:                            && (Arrays.equals(contextEngineID,
254:                                    other.contextEngineID))
255:                            && (Arrays.equals(contextName, other.contextName)));
256:                }
257:                return false;
258:            }
259:
260:            public int hashCode() {
261:                return msgID;
262:            }
263:
264:            public String toString() {
265:                return "StateReference[msgID=" + msgID + ",pduHandle="
266:                        + pduHandle + ",securityEngineID="
267:                        + OctetString.fromByteArray(securityEngineID)
268:                        + ",securityModel=" + securityModel + ",securityName="
269:                        + OctetString.fromByteArray(securityName)
270:                        + ",securityLevel=" + securityLevel
271:                        + ",contextEngineID="
272:                        + OctetString.fromByteArray(contextEngineID)
273:                        + ",contextName="
274:                        + OctetString.fromByteArray(contextName) + "]";
275:            }
276:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.