1 23 package com.sun.enterprise.management.config; 24 25 import java.util.Map ; 26 import java.util.Set ; 27 28 import com.sun.enterprise.management.config.AMXConfigImplBase; 29 30 import com.sun.enterprise.management.support.oldconfig.OldDomainMBean; 31 import com.sun.enterprise.management.support.Delegate; 32 import com.sun.enterprise.management.support.AMXAttributeNameMapper; 33 34 35 37 public class ServerConfigBase extends AMXConfigImplBase 38 { 39 public 40 ServerConfigBase( 41 final String j2eeType, 42 final Delegate delegate ) 43 { 44 super( delegate); 45 46 } 47 48 protected void 49 addCustomMappings( final AMXAttributeNameMapper mapper ) 50 { 51 super.addCustomMappings( mapper ); 52 53 mapper.matchName( "ReferencedConfigName", "ConfigRef"); 55 mapper.matchName( "ReferencedNodeAgentName", "NodeAgentRef" ); 56 } 57 58 59 private static final String TEMPLATE_PREFIX = "${"; 60 public boolean 61 isTemplateString( final String s ) 62 { 63 return( s != null && 65 s.startsWith( TEMPLATE_PREFIX ) && 66 s.indexOf( "}" ) >= TEMPLATE_PREFIX.length() + 1 ); 67 } 68 69 public String 70 resolveTemplateString( final String template ) 71 { 72 String result = template; 73 74 if ( isTemplateString( template ) ) 75 { 76 final String myName = getName(); 77 final OldDomainMBean oldDomain = getOldConfigProxies().getOldDomainMBean(); 78 79 try 80 { 81 result = oldDomain.resolveTokens( template, myName); 82 } 83 catch( Exception e ) 84 { 85 getMBeanLogger().warning( "Can't resolve: " + template + ", " + e); 86 e.printStackTrace(); 87 throw new IllegalArgumentException ( template ); 88 } 89 } 90 return( result ); 91 } 92 93 } 94 95 96 97 98 99 100 101 102 | Popular Tags |