J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2002-2006 Sun Microsystems, Inc. All Rights Reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun in the LICENSE file that accompanied this code. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | * version 2 for more details (a copy is included in the LICENSE file that |
| 15 | * accompanied this code). |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License version |
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any questions. |
| 24 | */ |
| 25 | |
| 26 | package com.sun.jmx.snmp; |
| 27 | |
| 28 | import java.io.Serializable; |
| 29 | |
| 30 | /** |
| 31 | * This class is used to pass some specific parameters to an <CODE> |
| 32 | * SnmpEngineFactory </CODE>. |
| 33 | * |
| 34 | * <p><b>This API is a Sun Microsystems internal API and is subject |
| 35 | * to change without notice.</b></p> |
| 36 | * @since 1.5 |
| 37 | */ |
| 38 | public class SnmpEngineParameters implements Serializable { |
| 39 | private static final long serialVersionUID = 3720556613478400808L; |
| 40 | |
| 41 | private UserAcl uacl = null; |
| 42 | private String securityFile = null; |
| 43 | private boolean encrypt = false; |
| 44 | private SnmpEngineId engineId = null; |
| 45 | |
| 46 | /** |
| 47 | * Sets the file to use for SNMP Runtime Lcd. If no file is provided, the default location will be checked. |
| 48 | */ |
| 49 | public void setSecurityFile(String securityFile) { |
| 50 | this.securityFile = securityFile; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Gets the file to use for SNMP Runtime Lcd. |
| 55 | * @return The security file. |
| 56 | */ |
| 57 | public String getSecurityFile() { |
| 58 | return securityFile; |
| 59 | } |
| 60 | /** |
| 61 | * Sets a customized user ACL. User Acl is used in order to check |
| 62 | * access for SNMP V3 requests. If no ACL is provided, |
| 63 | * <CODE>com.sun.jmx.snmp.usm.UserAcl.UserAcl</CODE> is instantiated. |
| 64 | * @param uacl The user ACL to use. |
| 65 | */ |
| 66 | public void setUserAcl(UserAcl uacl) { |
| 67 | this.uacl = uacl; |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Gets the customized user ACL. |
| 72 | * @return The customized user ACL. |
| 73 | */ |
| 74 | public UserAcl getUserAcl() { |
| 75 | return uacl; |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Activate SNMP V3 encryption. By default the encryption is not activated. Be sure that the security provider classes needed for DES are in your classpath (eg:JCE classes) |
| 80 | * |
| 81 | */ |
| 82 | public void activateEncryption() { |
| 83 | this.encrypt = true; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Deactivate SNMP V3 encryption. By default the encryption is not activated. Be sure that the security provider classes needed for DES are in your classpath (eg:JCE classes) |
| 88 | * |
| 89 | */ |
| 90 | public void deactivateEncryption() { |
| 91 | this.encrypt = false; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Check if encryption is activated. By default the encryption is not activated. |
| 96 | * @return The encryption activation status. |
| 97 | */ |
| 98 | public boolean isEncryptionEnabled() { |
| 99 | return encrypt; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Set the engine Id. |
| 104 | * @param engineId The engine Id to use. |
| 105 | */ |
| 106 | public void setEngineId(SnmpEngineId engineId) { |
| 107 | this.engineId = engineId; |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * Get the engine Id. |
| 112 | * @return The engineId. |
| 113 | */ |
| 114 | public SnmpEngineId getEngineId() { |
| 115 | return engineId; |
| 116 | } |
| 117 | } |