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


001:        /*_############################################################################
002:          _## 
003:          _##  SNMP4J - SNMP4JSettings.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;
022:
023:        import org.snmp4j.util.ThreadFactory;
024:        import org.snmp4j.util.DefaultThreadFactory;
025:        import org.snmp4j.util.TimerFactory;
026:        import org.snmp4j.util.DefaultTimerFactory;
027:
028:        /**
029:         * The <code>SNMP4JSettings</code> class implements a central configuration
030:         * class of the SNMP4J framework. As a rule of thumb, changes to the default
031:         * configuration should be made before any other classes of the SNMP4J API are
032:         * instantiated or referenced by the application code.
033:         *
034:         * @author Frank Fock
035:         * @version 1.9
036:         * @since 1.5
037:         */
038:        public final class SNMP4JSettings {
039:
040:            /**
041:             * Specifies whether SNMP4J can be extended by own implementation of
042:             * security protocols, transport mappings, address types, SMI syntaxes, etc.
043:             * through property files defined via System properties.
044:             * If set to <code>false</code> all classes SNMP4J is aware of will be
045:             * used hard coded which speeds up initialization and is required to use
046:             * SNMP4J in a secure environment where System properties are not available
047:             * (i.e. in an unsigned applet).
048:             * @since 1.2.2
049:             */
050:            private static boolean extensibilityEnabled = false;
051:
052:            /**
053:             * By default SNMP4J (and SNMP4J-Agent*) catch runtime exceptions at thread
054:             * boundaries of API controlled threads. In SNMP4J such a thread runs in each
055:             * {@link TransportMapping} and in each {@link Snmp} session object. To ensure
056:             * robust runtime behavior, unexpected runtime exceptions are caught and
057:             * logged. If you need to localize and debug such exceptions then set this
058:             * value to <code>true</code>.
059:             *
060:             * @since 1.8.1
061:             */
062:            private static volatile boolean forwardRuntimeExceptions = false;
063:
064:            /**
065:             * By default SNMP4J uses {@link java.util.Thread} instances to run
066:             * concurrent tasks. For environments with restricted thread management
067:             * like Java EE application servers, a custom thread factory can be used.
068:             *
069:             * @since 1.9
070:             */
071:            private static ThreadFactory threadFactory = new DefaultThreadFactory();
072:
073:            /**
074:             * By default SNMP4J uses {@link java.util.Timer} instances to run
075:             * timed tasks. For environments with restricted thread management
076:             * like Java EE application servers, a custom timer factory can be used.
077:             *
078:             * @since 1.9
079:             */
080:            private static TimerFactory timerFactory = new DefaultTimerFactory();
081:
082:            /**
083:             * Enables (or disables) the extensibility feature of SNMP4J. When enabled,
084:             * SNMP4J checks certain properties files that describe which transport
085:             * mappings, address types, SMI syntaxes, security protocols, etc. should be
086:             * supported by SNMP4J.
087:             * <p>
088:             * By default, the extensibility feature is disabled which provides a faster
089:             * startup and since no system properties are read, it ensures that SNMP4J
090:             * can be used also in secure environments like applets.
091:             * @param enable
092:             *    if <code>true</code> activates extensibility or if <code>false</code>
093:             *    disables it. In the latter case, SNMP4J's default configuration will
094:             *    be used with all available features.
095:             * @since 1.2.2
096:             */
097:            public static void setExtensibilityEnabled(boolean enable) {
098:                extensibilityEnabled = enable;
099:            }
100:
101:            /**
102:             * Tests if the extensibility feature is enabled.
103:             * @return
104:             *    if <code>true</code> the extensibility is enabled otherwise it is
105:             *    disabled. In the latter case, SNMP4J's default configuration will
106:             *    be used with all available features.
107:             * @since 1.2.2
108:             */
109:            public final static boolean isExtensibilityEnabled() {
110:                return extensibilityEnabled;
111:            }
112:
113:            /**
114:             * Enables or disables runtime exception forwarding.
115:             * @see #forwardRuntimeExceptions
116:             * @param forwardExceptions
117:             *    <code>true</code> runtime exceptions are thrown on thread boundaries
118:             *    controlled by SNMP4J and related APIs. Default is <code>false</code>.
119:             * @since 1.8.1
120:             */
121:            public static void setForwardRuntimeExceptions(
122:                    boolean forwardExceptions) {
123:                forwardRuntimeExceptions = forwardExceptions;
124:            }
125:
126:            /**
127:             * Indicates whether runtime exceptions should be thrown on thread boundaries
128:             * controlled by SNMP4J and related APIs.
129:             * @return
130:             *    <code>true</code> runtime exceptions are thrown on thread boundaries
131:             *    controlled by SNMP4J and related APIs. Default is <code>false</code>.
132:             * @since 1.8.1
133:             */
134:            public final static boolean isFowardRuntimeExceptions() {
135:                return forwardRuntimeExceptions;
136:            }
137:
138:            /**
139:             * Gets the thread factory.
140:             * @return
141:             *    a ThreadFactory.
142:             * @since 1.9
143:             */
144:            public final static ThreadFactory getThreadFactory() {
145:                return threadFactory;
146:            }
147:
148:            /**
149:             * Sets the thread factory for creating new threads of execution.
150:             * @param newThreadFactory
151:             *    a ThreadFactory (must not be <code>null</code>).
152:             * @since 1.9
153:             */
154:            public final static void setThreadFactory(
155:                    ThreadFactory newThreadFactory) {
156:                if (newThreadFactory == null) {
157:                    throw new NullPointerException();
158:                }
159:                threadFactory = newThreadFactory;
160:            }
161:
162:            /**
163:             * Gets the timer factory.
164:             * @return
165:             *    a TimerFactory.
166:             * @since 1.9
167:             */
168:            public final static TimerFactory getTimerFactory() {
169:                return timerFactory;
170:            }
171:
172:            /**
173:             * Sets the timer factory for creating new timer instances.
174:             * @param newTimerFactory
175:             *    a TimerFactory (must not be <code>null</code>).
176:             * @since 1.9
177:             */
178:            public final static void setTimerFactory(
179:                    TimerFactory newTimerFactory) {
180:                if (newTimerFactory == null) {
181:                    throw new NullPointerException();
182:                }
183:                timerFactory = newTimerFactory;
184:            }
185:
186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.