1 23 package com.sun.enterprise.management.config; 24 25 import java.util.Map ; 26 import java.util.HashMap ; 27 import java.io.Serializable ; 28 29 import javax.management.ObjectName ; 30 import javax.management.Attribute ; 31 import javax.management.AttributeList ; 32 33 import com.sun.appserv.management.config.DomainConfig; 34 import com.sun.appserv.management.util.jmx.JMXUtil; 35 36 import com.sun.enterprise.management.support.oldconfig.OldConnectorConnectionPoolMBean; 37 38 41 42 public final class SecurityMapConfigFactory extends ConfigFactory 43 { 44 public 45 SecurityMapConfigFactory( final ConfigFactoryCallback callbacks) 46 { 47 super( callbacks ); 48 } 49 50 private OldConnectorConnectionPoolMBean 51 getOld() 52 { 53 return getOldConfigProxies().getOldConnectorConnectionPool( getContainerName() ); 54 } 55 56 static private final String USERNAME_KEY = "username"; 57 static private final String PASSWORD_KEY = "password"; 58 59 60 public ObjectName 61 create( 62 final String name, 63 final String username, 64 final String password, 65 final String [] principals, 66 final String [] userGroups ) 67 { 68 final String containerName = getContainerName(); 69 70 final OldConnectorConnectionPoolMBean ccp = 71 getOldConfigProxies().getOldConnectorConnectionPool( containerName ); 72 73 final Map <String ,Serializable > params = new HashMap <String ,Serializable >(); 74 params.put( "name", name ); 75 params.put( "pool_name", containerName ); 76 params.put( "principal", principals ); 77 params.put( "user_group", userGroups ); 78 79 final AttributeList attrs = new AttributeList (); 80 for( final String key : params.keySet() ) 81 { 82 attrs.add( new Attribute ( key, params.get( key ) ) ); 83 } 84 85 final String targetName = null; 86 getOld().createSecurityMap( attrs, username, password, targetName ); 87 final ObjectName oldObjectName = ccp.getSecurityMapByName( name ); 89 90 final ObjectName amxName = finish( oldObjectName, null ); 91 92 return( amxName ); 93 } 94 95 96 protected void 97 removeByName( final String name ) 98 { 99 getOld().removeSecurityMapByName( name ); 100 } 101 } 102 103 104 105 106 107 108 109 | Popular Tags |