giacomo 2002/06/19 05:24:00
Modified: src/java/org/apache/avalon/phoenix/components/manager
DefaultManager.java
Log:
Added configurability to DefaultManager because java properties specified
on the commandline via -D are visible on unix systems by the use of
the 'ps' command. This specially concerns the property
named phoenix.admin.passwd but for completeness all other used properties
in the DefaultManager can now be configured in the kernel.xml file.
The drawback of this is that configured values for those properties take
precedence over those specified on the commandline but the default values
used so far still hold.
Revision Changes Path
1.23 +23 -7
jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/manager/DefaultManager.java
Index: DefaultManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/manager/DefaultManager.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- DefaultManager.java 20 May 2002 11:55:23 -0000 1.22
+++ DefaultManager.java 19 Jun 2002 12:24:00 -0000 1.23
@@ -20,6 +20,9 @@
import org.apache.avalon.excalibur.i18n.ResourceManager;
import org.apache.avalon.excalibur.i18n.Resources;
import org.apache.avalon.excalibur.extension.PackageRepository;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.parameters.ParameterException;
import org.apache.avalon.framework.parameters.Parameterizable;
import org.apache.avalon.framework.parameters.Parameters;
@@ -50,7 +53,7 @@
*/
public class DefaultManager
extends AbstractSystemManager
- implements Parameterizable, Serviceable
+ implements Parameterizable, Configurable, Serviceable
{
private static final Resources REZ =
ResourceManager.getPackageResources( DefaultManager.class );
@@ -80,6 +83,7 @@
private Kernel m_kernel;
private ConfigurationRepository m_repository;
private PackageRepository m_extensionManager;
+ private Configuration m_configuration;
public void parameterize( final Parameters parameters )
throws ParameterException
@@ -87,6 +91,12 @@
m_parameters = parameters;
}
+ public void configure( final Configuration configuration )
+ throws ConfigurationException
+ {
+ m_configuration = configuration;
+ }
+
/**
* Retrieve relevant services needed to deploy.
*
@@ -105,7 +115,7 @@
m_extensionManager = (PackageRepository)serviceManager.
lookup( PackageRepository.ROLE );
}
-
+
public void initialize()
throws Exception
{
@@ -114,16 +124,20 @@
try
{
+ final int port = m_configuration.getChild(
"manager-adaptor-port" ).getValueAsInteger( DEFAULT_HTTPADAPTER_PORT );
final HtmlAdaptorServer html =
- new HtmlAdaptorServer( DEFAULT_HTTPADAPTER_PORT );
- if( null != DEFAULT_ADMIN_PASSWD )
+ new HtmlAdaptorServer( port );
+
+ final String adminname = m_configuration.getChild(
"manager-admin-name" ).getValue( DEFAULT_ADMIN_USER );
+ final String adminpasswd = m_configuration.getChild(
"manager-admin-password" ).getValue( DEFAULT_ADMIN_PASSWD );
+ if( null != adminpasswd )
{
- final AuthInfo auth = new AuthInfo( DEFAULT_ADMIN_USER,
DEFAULT_ADMIN_PASSWD );
+ final AuthInfo auth = new AuthInfo( adminname, adminpasswd );
html.addUserAuthenticationInfo( auth );
}
final String stringName =
- "Adaptor:name=html,port=" + DEFAULT_HTTPADAPTER_PORT;
+ "Adaptor:name=html,port=" + port;
final ObjectName name = new ObjectName( stringName );
System.out.println( "Created HTML Adaptor " + name );
m_mBeanServer.registerMBean( html, name );
@@ -151,8 +165,10 @@
public void start()
throws Exception
{
- final int port =
+ final int portp =
m_parameters.getParameterAsInteger( "manager-registry-port",
DEFAULT_REGISTRY_PORT );
+ final int port =
+ m_configuration.getChild( "manager-registry-port"
).getValueAsInteger( portp );
m_name = m_parameters.getParameter( "manager-name",
"Phoenix.JMXAdaptor" );
m_rmiRegistry = LocateRegistry.createRegistry( port );
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>