1 23 package com.sun.enterprise.management.config; 24 25 import java.util.Set ; 26 27 import javax.management.ObjectName ; 28 import javax.management.Attribute ; 29 30 import com.sun.appserv.management.base.XTypes; 31 import com.sun.appserv.management.config.SecurityMapConfig; 32 33 import com.sun.appserv.management.util.misc.GSetUtil; 34 import com.sun.appserv.management.util.misc.ExceptionUtil; 35 import com.sun.appserv.management.util.misc.StringUtil; 36 37 import com.sun.enterprise.management.config.AMXConfigImplBase; 38 39 import com.sun.enterprise.management.support.Delegate; 40 import com.sun.enterprise.management.support.AMXAttributeNameMapper; 41 42 import com.sun.enterprise.management.support.oldconfig.OldSecurityMap; 43 44 47 public final class SecurityMapConfigImpl extends AMXConfigImplBase 48 { 49 public 50 SecurityMapConfigImpl( final Delegate delegate ) 51 { 52 super( delegate ); 53 } 54 55 protected void 56 addCustomMappings( final AMXAttributeNameMapper mapper ) 57 { 58 super.addCustomMappings( mapper ); 59 60 mapper.matchName( "PrincipalNames", "Principal" ); 61 mapper.matchName( "UserGroupNames", "UserGroup" ); 62 } 63 64 private SecurityMapConfig 65 self() 66 { 67 return (SecurityMapConfig)getSelf(); 68 } 69 70 public void 71 createPrincipal( final String principal ) 72 { 73 final String [] existing = self().getPrincipalNames(); 74 75 final Set <String > newSet = GSetUtil.newSet( existing ); 76 newSet.add( principal ); 77 78 final String [] newOnes = GSetUtil.toStringArray( newSet ); 79 80 delegateSetAttributeNoThrow( "PrincipalNames", newOnes ); 81 } 82 83 public void 84 removePrincipal( final String principal ) 85 { 86 final String [] existing = self().getPrincipalNames(); 87 88 final Set <String > newSet = GSetUtil.newSet( existing ); 89 newSet.remove( principal ); 90 91 final String [] newOnes = GSetUtil.toStringArray( newSet ); 92 93 delegateSetAttributeNoThrow( "PrincipalNames", newOnes ); 94 } 95 96 public void 97 createUserGroup( final String userGroup ) 98 { 99 final String [] existing = self().getUserGroupNames(); 100 101 final Set <String > newSet = GSetUtil.newSet( existing ); 102 newSet.add( userGroup ); 103 104 final String [] newOnes = GSetUtil.toStringArray( newSet ); 105 106 delegateSetAttributeNoThrow( "UserGroupNames", newOnes ); 107 } 108 109 public void 110 removeUserGroup( final String userGroup ) 111 { 112 final String [] existing = self().getUserGroupNames(); 113 114 final Set <String > newSet = GSetUtil.newSet( existing ); 115 newSet.remove( userGroup ); 116 117 final String [] newOnes = GSetUtil.toStringArray( newSet ); 118 119 delegateSetAttributeNoThrow( "UserGroupNames", newOnes ); 120 } 121 122 129 } 130 131 132 133 | Popular Tags |