Source Code Cross Referenced for MIB2SystemGroupService.java in  » EJB-Server-JBoss-4.2.1 » varia » org » jboss » jmx » adaptor » snmp » system » 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 » EJB Server JBoss 4.2.1 » varia » org.jboss.jmx.adaptor.snmp.system 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JBoss, Home of Professional Open Source.
003:         * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004:         * as indicated by the @author tags. See the copyright.txt file in the
005:         * distribution for a full listing of individual contributors.
006:         *
007:         * This is free software; you can redistribute it and/or modify it
008:         * under the terms of the GNU Lesser General Public License as
009:         * published by the Free Software Foundation; either version 2.1 of
010:         * the License, or (at your option) any later version.
011:         *
012:         * This software is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015:         * Lesser General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU Lesser General Public
018:         * License along with this software; if not, write to the Free
019:         * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021:         */
022:        package org.jboss.jmx.adaptor.snmp.system;
023:
024:        import javax.management.ObjectName;
025:
026:        import org.jboss.jmx.adaptor.snmp.agent.SnmpAgentServiceMBean;
027:        import org.jboss.system.ServiceMBeanSupport;
028:        import org.jboss.system.server.ServerConfigLocator;
029:        import org.jboss.system.server.ServerInfoMBean;
030:        import org.opennms.protocols.snmp.SnmpObjectId;
031:
032:        /**
033:         * An MBean service that defines the MIB-2 system group an agent
034:         * is supposed to implement under the oid
035:         * iso.org.dod.internet.mgmt.mib-2.system (.1.3.6.1.2.1.1)
036:         * See rfc-1213
037:         * 
038:         * @author <a href="mailto:hwr@pilhuhn.de">Heiko W. Rupp</a>
039:         * @author <a href="mailto:dimitris@jboss.org">Dimitris Andreadis</a>
040:         * @version $Revision: 57210 $
041:         */
042:        public class MIB2SystemGroupService extends ServiceMBeanSupport
043:                implements  MIB2SystemGroupServiceMBean {
044:            // Constants -----------------------------------------------------
045:
046:            /** JBoss OID Prefix */
047:            public static final String JBOSS_PREFIX = "1.3.6.1.4.1.18016";
048:
049:            /** Product JBossAS */
050:            public static final String PRODUCT = ".1.1";
051:
052:            /** Version 4.0.x */
053:            public static final String VERSION = ".2";
054:
055:            // Private Data --------------------------------------------------
056:
057:            private String sysDescr; // system.1
058:            private SnmpObjectId sysObjectId; // system.2
059:            // private long sysUpTime;          // system.3
060:            private String sysContact; // system.4
061:            private String sysName; // system.5  usually fqdn
062:            private String sysLocation; // system.6  where is the system located 
063:            private final int sysServices = 64; // system.7  (2^(L-1) with L=Layer 7 services)
064:
065:            private ObjectName snmpAgent = SnmpAgentServiceMBean.OBJECT_NAME;
066:
067:            /**
068:             * CTOR
069:             *
070:             */
071:            public MIB2SystemGroupService() {
072:                // empty
073:            }
074:
075:            // Attributes ----------------------------------------------------
076:
077:            /**
078:             * @jmx:managed-attribute
079:             */
080:            public void setSnmpAgent(ObjectName agent) {
081:                this .snmpAgent = agent;
082:            }
083:
084:            /**
085:             * @jmx:managed-attribute
086:             */
087:            public ObjectName getSnmpAgent() {
088:                return snmpAgent;
089:            }
090:
091:            /**
092:             * @jmx:managed-attribute
093:             */
094:            public void setSysDescr(String sysDescr) {
095:                this .sysDescr = sysDescr;
096:            }
097:
098:            /**
099:             * @jmx:managed-attribute
100:             */
101:            public String getSysDescr() {
102:                return sysDescr;
103:            }
104:
105:            /**
106:             * @jmx:managed-attribute
107:             */
108:            public SnmpObjectId getSysObjectId() {
109:                return sysObjectId;
110:            }
111:
112:            /**
113:             * The system uptime in hundreth of a second (TimeTicks)
114:             * @jmx:managed-attribute
115:             */
116:            public long getSysUpTime() {
117:                if (snmpAgent != null) {
118:                    try {
119:                        Long upTime = (Long) server.getAttribute(snmpAgent,
120:                                "Uptime");
121:                        return upTime.longValue() / 10;
122:                    } catch (Exception e) {
123:                        log.debug("Can't get uptime value from agent");
124:                    }
125:                }
126:                // fallback
127:                return System.currentTimeMillis() / 10;
128:            }
129:
130:            /**
131:             * @jmx:managed-attribute
132:             */
133:            public void setSysContact(String sysContact) {
134:                this .sysContact = sysContact;
135:            }
136:
137:            /**
138:             * @jmx:managed-attribute
139:             */
140:            public String getSysContact() {
141:                return sysContact;
142:            }
143:
144:            /**
145:             * @jmx:managed-attribute
146:             */
147:            public void setSysName(String sysName) {
148:                this .sysName = sysName;
149:            }
150:
151:            /**
152:             * @jmx:managed-attribute
153:             */
154:            public String getSysName() {
155:                return sysName;
156:            }
157:
158:            /**
159:             * @jmx:managed-attribute
160:             */
161:            public void setSysLocation(String sysLocation) {
162:                this .sysLocation = sysLocation;
163:            }
164:
165:            /**
166:             * @jmx:managed-attribute
167:             */
168:            public String getSysLocation() {
169:                return sysLocation;
170:            }
171:
172:            /**
173:             * @jmx:managed-attribute
174:             */
175:            public int getSysServices() {
176:                return sysServices;
177:            }
178:
179:            // Lifecycle -----------------------------------------------------
180:
181:            protected void createService() throws Exception {
182:                // Determine the sysName from the running server config and the host name.
183:                if (this .sysName == null) {
184:                    String serverConfig = ServerConfigLocator.locate()
185:                            .getServerName();
186:                    String hostAddress = (String) server.getAttribute(
187:                            ServerInfoMBean.OBJECT_NAME, "HostAddress");
188:
189:                    this .sysName = serverConfig + "@" + hostAddress;
190:                    log.debug("Setting sysName name to " + sysName);
191:                }
192:                this .sysObjectId = new SnmpObjectId(JBOSS_PREFIX + PRODUCT
193:                        + VERSION);
194:            }
195:
196:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.