proyal 2002/07/31 13:40:20
Added: phyre/src/java/org/apache/avalon/phyre/mbean
MBeanServiceManager.java
Log:
ServiceManager impl that returns MBeans
Revision Changes Path
1.1
jakarta-avalon-apps/phyre/src/java/org/apache/avalon/phyre/mbean/MBeanServiceManager.java
Index: MBeanServiceManager.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.avalon.phyre.mbean;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Royal</a>
*/
public class MBeanServiceManager extends AbstractLogEnabled implements ServiceManager
{
private MBeanManager m_MBeanManager;
public void setMBeanManager( MBeanManager MBeanManager )
{
m_MBeanManager = MBeanManager;
}
public boolean hasService( String role )
{
return m_MBeanManager == null ? false : m_MBeanManager.isRegistered( role );
}
public Object lookup( String role )
throws ServiceException
{
if( m_MBeanManager == null )
{
throw new ServiceException( role, "Invalid MBean ObjectName: " + role );
}
else
{
try
{
return m_MBeanManager.getObject( role );
}
catch( Exception e )
{
throw new ServiceException( role, "Unable to get MBean: " + role, e
);
}
}
}
public void release( Object object )
{
//no-op
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>