Methods Summary |
---|
private void | addBeanHierarchy(java.util.List configBeans, com.sun.enterprise.config.ConfigBean configBean)
// nulls exist in the array, strange but true
if ( configBean != null )
{
configBeans.add( configBean );
final ConfigBean[] children = configBean.getAllChildBeans();
if ( children != null )
{
for( final ConfigBean child : children )
{
addBeanHierarchy( configBeans, child );
}
}
}
|
private javax.management.ObjectName | configBeanToAMX(com.sun.enterprise.config.ConfigBean configBean)
assert( configBean != null );
ObjectName objectName = null;
try
{
objectName = loadAMX( configBean );
}
catch( Exception e )
{
final Throwable rootCause = ExceptionUtil.getRootCause( e );
sdebug( "Exception of type " + rootCause.getClass().getName() +
" trying to create AMXConfig for " +
configBean.getXPath() +
": " + rootCause.getMessage() );
sdebug( ExceptionUtil.getStackTrace( rootCause ) );
}
return objectName;
|
private java.util.List | configBeansToAMX(java.util.List configBeans)
final List<ObjectName> objectNames = new ArrayList<ObjectName>();
for( final ConfigBean configBean : configBeans )
{
final ObjectName objectName = configBeanToAMX( configBean );
if ( objectName != null )
{
objectNames.add( objectName );
}
}
return objectNames;
|
private java.lang.String | configBeansToString(java.util.List configBeans)
final String[] xPaths = new String[ configBeans.size() ];
int i = 0;
for( final ConfigBean configBean : configBeans )
{
xPaths[ i ] = "" + configBean.getXPath();
++i;
}
Arrays.sort( xPaths );
final String NEWLINE = System.getProperty( "line.separator" );
return StringUtil.toString( NEWLINE, (Object[])xPaths );
|
private void | debug(java.lang.Object o)
AMXDebug.getInstance().getOutput( "AMXLoader" ).println( o );
|
public java.lang.String | getAMXJMXDomainName()
return( BootUtil.getInstance().getAMXJMXDomainName() );
|
private java.util.Map | getConfigBeanAttributes(com.sun.enterprise.config.ConfigBean configBean)
final Map<String,Object> pairs = new HashMap<String,Object>();
try
{
final ConfigDelegate delegate =
mDelegateFactory.createConfigDelegate( configBean );
final MBeanAttributeInfo[] attrInfos = delegate.getMBeanInfo().getAttributes();
for( final MBeanAttributeInfo attrInfo : attrInfos )
{
final String name = attrInfo.getName();
Object value = null;
try
{
value = delegate.getAttribute( name );
}
catch( AttributeNotFoundException e )
{
value = "<NOT FOUND>";
}
pairs.put( name, value );
}
}
catch( Exception e )
{
pairs.put( "EXCEPTION", e.getClass().getName() + ": " + e.getMessage() );
}
return pairs;
|
private com.sun.enterprise.config.ConfigContext | getConfigContext()
return mDelegateFactory.getConfigContext();
|
public com.sun.appserv.management.DomainRoot | getDomainRoot()
return( getProxyFactory().getDomainRoot() );
|
protected java.lang.Class | getImplClass(java.lang.String j2eeType)
final TypeInfo info = TypeInfos.getInstance().getInfo( j2eeType );
assert( info != null );
return( info.getImplClass() );
|
private com.sun.appserv.management.client.ProxyFactory | getProxyFactory()
return ProxyFactory.getInstance( mServer );
|
public void | handleMBeanRegistered(javax.management.ObjectName objectName)
|
public void | handleMBeanUnregistered(javax.management.ObjectName objectName)
mObjectNameToConfigBean.remove( objectName );
|
public void | handleNotification(javax.management.Notification notifIn, java.lang.Object handback)
final String type = notifIn.getType();
if ( notifIn instanceof MBeanServerNotification )
{
final ObjectName objectName = ((MBeanServerNotification)notifIn).getMBeanName();
if ( type.equals( MBeanServerNotification.REGISTRATION_NOTIFICATION ) )
{
handleMBeanRegistered( objectName );
}
else if ( type.equals( MBeanServerNotification.UNREGISTRATION_NOTIFICATION ) )
{
handleMBeanUnregistered( objectName );
}
}
|
public javax.management.ObjectName | loadAMX(com.sun.enterprise.config.ConfigBean configBean)
final ConfigBeanHelperFactory factory =
ConfigBeanHelperFactory.getInstance( mDelegateFactory.getConfigContext() );
final ConfigBeanHelper helper = factory.getHelper( configBean );
final String xPath = helper.getXPath();
final List<String[]> propsList =
helper.getAllObjectNameProps( OldConfigTypes.getIgnoreTypes() );
final String[] firstPair = propsList.iterator().next();
final String type = firstPair[ 0 ];
final String foundName = firstPair[ 1 ];
if ( type == null ||
OldConfigTypes.getIgnoreTypes().contains( type ) )
{
return null;
}
final String j2eeType = oldTypeToJ2EEType( type );
final String name = foundName == null ?
ObjectNames.getSingletonName( j2eeType ) : foundName;
String props = Util.makeRequiredProps( j2eeType, name);
//debug( type + "=" + name + " => " + props );
for( final String[] pair : propsList )
{
final String ancestorType = pair[ 0 ];
final String ancestorNameFound = pair[ 1 ];
if ( ! OldConfigTypes.getIgnoreTypes().contains( ancestorType ) )
{
final String ancestorJ2EEType = oldTypeToJ2EEType( ancestorType );
final String ancestorName = ancestorNameFound == null ?
ObjectNames.getSingletonName( j2eeType ) : ancestorNameFound;
final String prop = Util.makeProp( ancestorJ2EEType, ancestorName );
props = Util.concatenateProps( props, prop );
}
}
// debug( type + "=" + name + " => " + props );
ObjectName objectName = Util.newObjectName( mJMXDomain, props );
final ConfigDelegate delegate =
mDelegateFactory.createConfigDelegate( configBean );
final AMXConfigImplBase amx = (AMXConfigImplBase)newImpl( j2eeType, delegate );
mObjectNameToConfigBean.put( objectName, configBean );
objectName = mServer.registerMBean( amx, objectName ).getObjectName();
return objectName;
|
public void | loadAll()
loadDomainRoot();
final ConfigContext configContext = mDelegateFactory.getConfigContext();
assert( configContext != null );
final ConfigBean domainConfigBean =
configContext.exactLookup( ServerXPathHelper.XPATH_DOMAIN );
assert( domainConfigBean != null );
final List<ConfigBean> configBeans = new ArrayList<ConfigBean>();
addBeanHierarchy( configBeans, domainConfigBean );
debug( configBeansToString( configBeans ) );
// make an AMX MBean for every applicable config bean
final List<ObjectName> objectNames = configBeansToAMX( configBeans );
debug( "loadAll: loaded " + objectNames.size() + "MBeans:" );
debug( CollectionUtil.toString( JMXUtil.objectNamesToStrings( objectNames ), "\n") );
|
private void | loadDomainRoot()
try
{
final TypeInfo info =
TypeInfos.getInstance().getInfo( XTypes.DOMAIN_ROOT );
final Class implClass = info.getImplClass();
final ObjectName objectName = mObjectNames.getDomainRootObjectName( );
final Object impl = implClass.newInstance();
mServer.registerMBean( impl, objectName );
}
catch( Exception e )
{
debug( ExceptionUtil.toString( e ) );
throw new Error( e );
}
|
public javax.management.ObjectName | loadSystemInfo(javax.management.MBeanServer server)
final BootUtil bootUtil = BootUtil.getInstance();
final SystemInfoImpl systemInfo = new SystemInfoImpl( server, bootUtil );
final ObjectName tempName =
mObjectNames.getSingletonObjectName( systemInfo.J2EE_TYPE );
final ObjectName objectName =
mServer.registerMBean( systemInfo, tempName ).getObjectName();
debug( "loaded SystemInfo as " + objectName );
return( objectName );
|
protected java.lang.Object | newImpl(java.lang.String j2eeType, com.sun.enterprise.management.support.Delegate delegate)
Object impl = null;
final Class implClass = getImplClass( j2eeType );
try
{
Constructor constructor = implClass.getConstructor( DELEGATE_CONSTRUCTOR_SIG );
if ( constructor != null )
{
impl = constructor.newInstance( new Object[] { delegate } );
}
}
catch( Exception e )
{
final Throwable rootCause = ExceptionUtil.getRootCause( e );
debug( "newImpl: exception creating new impl: " + e + "\n" +
ExceptionUtil.getStackTrace( rootCause ) );
throw e;
}
return( impl );
|
private java.lang.String | oldTypeToJ2EEType(java.lang.String type)
return OldConfigTypes.getInstance().oldTypeToJ2EEType( type );
|
protected void | sdebug(java.lang.Object o)
debug( o );
System.out.println( "" + o );
|