1 23 24 25 package com.sun.enterprise.management.offline; 26 27 import java.util.Set ; 28 29 import javax.management.AttributeNotFoundException ; 30 import javax.management.InvalidAttributeValueException ; 31 32 import com.sun.enterprise.config.ConfigContext; 33 import com.sun.enterprise.config.ConfigBean; 34 import com.sun.enterprise.config.ConfigException; 35 36 37 final class SecurityMapConfigBeanHelper extends StdConfigBeanHelper 38 { 39 static private final String PRINCIPAL_ATTR = "Principal"; 40 static private final String USER_GROUP_ATTR = "UserGroup"; 41 42 public 43 SecurityMapConfigBeanHelper( 44 final ConfigContext configContext, 45 final ConfigBean configBean ) 46 { 47 super( configContext, configBean ); 48 49 } 50 51 public Object 52 getAttribute( final String attrName ) 53 throws AttributeNotFoundException 54 { 55 Object result = null; 56 57 if ( PRINCIPAL_ATTR.equals( attrName ) ) 58 { 59 result = getPrincipalNames(); 60 } 61 else if ( USER_GROUP_ATTR.equals( attrName ) ) 62 { 63 result = getUserGroupNames(); 64 } 65 else 66 { 67 result = super.getAttribute( attrName ); 68 } 69 return result; 70 } 71 72 protected Class 73 getAttributeClass( final String attrName ) 74 { 75 Class result = null; 76 77 if ( PRINCIPAL_ATTR.equals( attrName ) || 78 USER_GROUP_ATTR.equals( attrName ) ) 79 { 80 result = String [].class; 81 } 82 else 83 { 84 result = super.getAttributeClass( attrName ); 85 } 86 return result; 87 } 88 89 protected Set <String > 90 _getAttributeNames() 91 { 92 final Set <String > attrNames = super._getAttributeNames(); 93 94 attrNames.add( PRINCIPAL_ATTR ); 95 attrNames.add( USER_GROUP_ATTR ); 96 97 return attrNames; 98 } 99 100 public String [] 101 getPrincipalNames() 102 { 103 final String value = (String )getValue( PRINCIPAL_ATTR ); 104 105 final String [] result = (value == null) ? EMPTY_STRING_ARRAY : value.split( " " ); 107 108 return result; 109 } 110 111 public String [] 112 getUserGroupNames() 113 { 114 final String value = (String )getValue( USER_GROUP_ATTR ); 115 116 final String [] result = (value == null) ? EMPTY_STRING_ARRAY : value.split( " " ); 118 119 return result; 120 } 121 } 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | Popular Tags |