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


001:        /*_############################################################################
002:          _## 
003:          _##  SNMP4J-Agent - MOColumn.java  
004:          _## 
005:          _##  Copyright (C) 2005-2007  Frank Fock (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.agent.mo;
022:
023:        import org.snmp4j.agent.*;
024:        import org.snmp4j.smi.*;
025:        import org.snmp4j.agent.request.SubRequest;
026:        import org.snmp4j.mp.SnmpConstants;
027:
028:        /**
029:         * The <code>MOColumn</code> class represents columnar SMI objects. It
030:         * represents all instances of a table's column not only a single instance
031:         * (cell).
032:         * <p>
033:         * Objects represented by <code>MOColumn</code> cannot be modified via SNMP,
034:         * thus <code>MOColumn</code> supports read-only maximum access only.
035:         *
036:         * @see MOMutableColumn
037:         * @author Frank Fock
038:         * @version 1.0
039:         */
040:        public class MOColumn implements  Comparable {
041:
042:            private int columnID;
043:            private int syntax;
044:            private MOAccess access;
045:            private MOTable table;
046:
047:            public MOColumn(int columnID, int syntax) {
048:                this .columnID = columnID;
049:                this .syntax = syntax;
050:                this .access = MOAccessImpl.ACCESS_READ_ONLY;
051:            }
052:
053:            public MOColumn(int columnID, int syntax, MOAccess access) {
054:                this .columnID = columnID;
055:                this .syntax = syntax;
056:                if (access == null) {
057:                    throw new NullPointerException("Access must be specified");
058:                }
059:                this .access = access;
060:            }
061:
062:            public void setColumnID(int columnID) {
063:                this .columnID = columnID;
064:            }
065:
066:            public void setSyntax(int syntax) {
067:                this .syntax = syntax;
068:            }
069:
070:            public void setAccess(MOAccess access) {
071:                this .access = access;
072:            }
073:
074:            /**
075:             * Sets the table instance this columnar object is contained in. This method
076:             * should be called by {@link MOTable} instance to register the table with
077:             * the column.
078:             * @param table
079:             *    the <code>MOTable</code> instance where this column is contained in.
080:             */
081:            public void setTable(MOTable table) {
082:                this .table = table;
083:            }
084:
085:            public int getColumnID() {
086:                return columnID;
087:            }
088:
089:            public int getSyntax() {
090:                return syntax;
091:            }
092:
093:            public MOAccess getAccess() {
094:                return access;
095:            }
096:
097:            public MOTable getTable() {
098:                return table;
099:            }
100:
101:            public Variable getValue(MOTableRow row, int column) {
102:                return row.getValue(column);
103:            }
104:
105:            /**
106:             * Tests if the supplied row is volatile or persistent. If volatile then
107:             * the row will not be saved when the table is saved to persistent storage.
108:             *
109:             * @param row
110:             *    a row of the table where this column is part of.
111:             * @param column
112:             *    the column index of this column in <code>row</code>.
113:             * @return
114:             *    <code>true</code> if <code>row</code> should not be
115:             */
116:            public boolean isVolatile(MOTableRow row, int column) {
117:                return false;
118:            }
119:
120:            /**
121:             * Compares this managed object column by its ID with another column.
122:             * @param column
123:             *    another <code>MOColumn</code>.
124:             * @return int
125:             *    a negative integer, zero, or a positive integer as this column ID
126:             *    is less than, equal to, or greater than the specified object's column
127:             *    ID.
128:             */
129:            public int compareTo(Object column) {
130:                return columnID - ((MOColumn) column).getColumnID();
131:            }
132:
133:            public String toString() {
134:                return this .getClass().getName() + "[columnID=" + getColumnID()
135:                        + ",syntax=" + getSyntax() + "]";
136:            }
137:
138:            public void get(SubRequest subRequest, MOTableRow row, int column) {
139:                if (getAccess().isAccessibleForRead()) {
140:                    Variable value = getValue(row, column);
141:                    if (value != null) {
142:                        subRequest.getVariableBinding().setVariable(
143:                                (Variable) value.clone());
144:                    } else {
145:                        subRequest.getVariableBinding().setVariable(
146:                                Null.noSuchInstance);
147:                    }
148:                    subRequest.completed();
149:                } else {
150:                    subRequest.getStatus().setErrorStatus(
151:                            SnmpConstants.SNMP_ERROR_NO_ACCESS);
152:                }
153:            }
154:
155:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.