1 23 24 package com.sun.enterprise.admin.mbeans.custom; 25 import java.util.Collections ; 26 import java.util.HashMap ; 27 import java.util.HashSet ; 28 import java.util.Map ; 29 import java.util.Set ; 30 import com.sun.enterprise.config.serverbeans.ServerTags; 31 import javax.management.ObjectName ; 32 33 35 public class CustomMBeanConstants { 36 37 private CustomMBeanConstants() { 38 } 39 41 public static final String NAME_KEY = ServerTags.NAME; 42 44 public static final String OBJECT_NAME_KEY = ServerTags.OBJECT_NAME; 45 46 48 public static final String IMPL_CLASS_NAME_KEY = ServerTags.IMPL_CLASS_NAME; 49 50 52 public static final String OBJECT_TYPE_KEY = ServerTags.OBJECT_TYPE; 53 54 56 public static final String SERVER_KEY = ServerTags.SERVER; 57 58 60 public static final String ENABLED_KEY = ServerTags.ENABLED; 61 63 public static final int USER_DEFINED = 0; 64 66 public static final int SYSTEM_ALL = 1; 67 69 public static final int SYSTEM_ADMIN = 2; 70 71 73 public static final String CMB_LOCAL = "com.sun.enterprise.admin.mbeans.custom.LocalStrings"; 74 75 77 public static final String CMB_LOADING_LOCAL = "com.sun.enterprise.admin.mbeans.custom.loading.LocalStrings"; 78 79 81 public static final String CMB_EE_LOCAL = "com.sun.enterprise.ee.admin.mbeans.LocalStrings"; 82 83 85 public static final String CMB_LOG = "com.sun.logging.enterprise.system.tools.admin.LogStrings"; 86 87 public static final String CUSTOM_MBEAN_DOMAIN = "user"; 88 private static final Set <Integer > iSet; 89 static { 90 iSet = new HashSet <Integer > (); 91 iSet.add(USER_DEFINED); 92 iSet.add(SYSTEM_ALL); 93 iSet.add(SYSTEM_ADMIN); } 95 public static final Set <Integer > MBEAN_TYPES = Collections.unmodifiableSet(iSet); 96 97 98 104 public static final Map <String , String > unmodifiableMap(final String key, final String value) throws IllegalArgumentException { 105 final boolean vk = OBJECT_NAME_KEY.equals(key) || IMPL_CLASS_NAME_KEY.equals(key) || NAME_KEY.equals(key); 106 if (!vk) 107 throw new IllegalArgumentException (CMBStrings.get("InternalError", "invalid arg")); if (value == null) 109 throw new IllegalArgumentException (CMBStrings.get("InternalError", "can't be null value")); final Map <String , String > m = new HashMap <String , String > (); 111 m.put(key, value); 112 return ( Collections.unmodifiableMap(m) ); 113 } 114 } | Popular Tags |