avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leosim...@apache.org
Subject cvs commit: jakarta-avalon-phoenix/proposal/4.0/src/script run.bat run.sh runClient.bat stop.bat
Date Thu, 19 Apr 2001 14:18:46 GMT
leosimons    01/04/19 07:18:46

  Modified:    proposal/4.0/src/java/org/apache/avalon/atlantis/core
                        Embeddor.java
               proposal/4.0/src/java/org/apache/avalon/atlantis/facilities
                        Manager.java
               proposal/4.0/src/java/org/apache/phoenix Shutdown.java
                        Start.java
               proposal/4.0/src/java/org/apache/phoenix/engine
                        PhoenixEmbeddor.java PhoenixKernel.java
               proposal/4.0/src/java/org/apache/phoenix/engine/facilities
                        ManagerImpl.java
  Added:       proposal/4.0 build.bat build.xml readme.txt
               proposal/4.0/lib jmxri.jar jmxtools.jar
               proposal/4.0/src/java/org/apache/jmx/adaptor RMIAdaptor.java
                        RMIAdaptorImpl.java
               proposal/4.0/src/java/org/apache/phoenix/loader
                        PhoenixLoader.java
               proposal/4.0/src/manifest client-Manifest.mf
                        engine-Manifest.mf loader-Manifest.mf
                        shutdown-Manifest.mf
               proposal/4.0/src/script run.bat run.sh runClient.bat
                        stop.bat
  Removed:     proposal/4.0/src/lib jmxri.jar jmxtools.jar
  Log:
  - added jmx rmi adaptor
  - added build and script files
  - adding bootstrap loader files
  - adding jmx support for serverapplications
  - fixing things
  
  Revision  Changes    Path
  1.1                  jakarta-avalon-phoenix/proposal/4.0/build.bat
  
  Index: build.bat
  ===================================================================
  @echo off
  
  echo -------------------
  echo Avalon Build System
  echo -------------------
  
  set _ANT_HOME=%ANT_HOME%
  set ANT_HOME=tools
  
  set CP=%CLASSPATH%
  set CLASSPATH=lib\xerces.jar;lib\oracle.jar
  
  :runAnt
  %ANT_HOME%\bin\ant.bat -logger org.apache.tools.ant.NoBannerLogger -emacs %1 %2 %3 %4 %5 %6 %7 %8
  
  set ANT_HOME=%_ANT_HOME%
  set _ANT_HOME=
  
  set CLASSPATH=%CP%
  
  
  
  1.1                  jakarta-avalon-phoenix/proposal/4.0/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <!--
  ==============================================================================
  
   Avalon build file
  
  Authors:
   Federico Barbieri <scoobie@apache.org>
   Berin Loritsch <bloritsch@apache.org>
   Peter Donald <donaldp@apache.org>
   Leo Simons <mail@leosimons.com>
  
  Legal:
    Copyright (c) 1999-2001 The Apache Software Foundation. All Rights Reserved.
  
  ==============================================================================
  -->
  <project default="main" basedir=".">
  
  	<!-- general properties -->
  	<property name="name" value="Avalon"/>
  	<property name="Name" value="Avalon"/>
  	<property name="version" value="3.2a4-dev"/>
  	<property name="year" value="1999-2001"/>
  	
  	
  	<!-- BUILD Directories -->
  	<property name="build.dir" value="build"/>
  	<property name="build.lib" value="${build.dir}/lib"/>
  	<property name="build.src" value="${build.dir}/src"/>
  	<property name="build.classes" value="${build.dir}/classes"/>
  	<property name="build.javadocs" value="${build.dir}/javadocs"/>
  	<property name="build.docs" value="${build.dir}/docs"/>
  	<property name="build.xdocs" value="${build.dir}/xdocs"/>
  
  	<!-- SOURCE Directories -->
  	<property name="src.dir" value="src"/>
  	<property name="java.dir" value="${src.dir}/java"/>
  	<property name="test.dir" value="${src.dir}/test"/>
  	<property name="lib.dir" value="lib"/>
  	<property name="tools.dir" value="tools"/>
  	<property name="docs.dir" value="docs"/>
  	<property name="www.dir" value="www"/>
  	<property name="javadocs.dir" value="${docs.dir}/framework/api"/>
  	<property name="skins.dir" value="${src.dir}/skins"/>
  	<property name="avalon.skin" value="${skins.dir}/avalon/"/>
  	<property name="xdocs.dir" value="${src.dir}/xdocs"/>
  	<property name="stylesheets.dir" value="${skins.dir}"/> 
  	<property name="manifest.dir" value="${src.dir}/manifest"/> 
  	<property name="script.dir" value="${src.dir}/script"/> 
  	<property name="conf.dir" value="${src.dir}/conf"/> 
  	
  	<!-- DISTRIBUTION Directories -->
      <property name="dist.dir" value="dist"/>
      <property name="dist.bin" value="${dist.dir}/bin"/>
      <property name="dist.apps" value="${dist.dir}/apps"/>
      <property name="dist.lib" value="${dist.dir}/lib"/>
      <property name="dist.docs" value="${dist.dir}/docs"/>
      <property name="dist.conf" value="${dist.dir}/conf"/>
      <property name="dist.javadocs" value="${dist.dir}/docs/api"/>
      <property name="dist.client" value="${dist.dir}/client"/>
  
      <!-- SOURCE DISTRIBUTION Directories -->
  	<property name="src.dist.dir" value="dist-src"/>
      <property name="src.dist.src" value="${src.dist.dir}/src"/>
      <property name="src.dist.docs" value="${src.dist.dir}/docs"/>
      <property name="src.dist.javadocs" value="${src.dist.dir}/docs/api"/>
      <property name="src.dist.lib" value="${src.dist.dir}/lib"/>
      <property name="src.dist.tools" value="${src.dist.dir}/tools"/>
    
  	<!-- PATH to all required libraries and sources for compile -->
  	<path id="project.class.path">
  		<fileset dir="${lib.dir}">
  			<include name="*.jar" />
  		</fileset>
  		<pathelement path="${build.classes}" />
  	</path>
  	
  	<!-- PATH to all required ant tasks -->
  	<path id="tools.class.path">
  		<pathelement path="${tools.dir}/lib/" />
  		<fileset dir="${tools.dir}/lib">
  			<include name="*.jar" />
  		</fileset>
  	</path>
  
  	<!--
  		/===================================================================\
  		|   Main target - create build and distribution                     |
  		\===================================================================/
  	-->
  	<target name="main" depends="dist-lite" />
  	
  	<!--
  		/===================================================================\
  		|   Build target - create build                                     |
  		\===================================================================/
  	-->
  	<target name="build" depends="prepare">
  		<mkdir dir="${build.classes}"/>
  		<javac srcdir="${java.dir}"
  			destdir="${build.classes}"
  			debug="${debug}"
  			optimize="${optimize}"
  			deprecation="${deprecation}">
  				<classpath refid="project.class.path" />
  				<exclude name="org/apache/avalon/datasource/J2eeDataSource.java"
  					unless="j2ee.present"/>
  		</javac>
  	</target>
  
  	<!-- prepare for build -->
  	<target name="prepare" depends="check-datasource">
  		<tstamp/>
  	    <mkdir dir="${build.dir}"/>
  	</target>
  	<!-- are jndi and jdbc present ? -->
  	<target name="check-environment">
  		<available property="jndi.present" classname="javax.naming.Context">
  			<classpath refid="project.class.path"/>
  		</available>
  		<available property="datasource.present" classname="javax.sql.DataSource">
  			<classpath refid="project.class.path"/>
  		</available>
  	</target>
  	<!-- do we have j2ee? -->
  	<target name="check-datasource" depends="check-environment" if="datasource.present">
  		<property name="j2ee.present" value="true"/>
  	</target>
  	
  	<!--
  		/===================================================================\
  		|   Jar target - create all libraries                               |
  		\===================================================================/
  	-->
  	<target name="jar" depends="build">
  		<mkdir dir="${build.lib}"/>
  		
  		<!-- avalon -->
  		<jar jarfile="${build.lib}/avalonapi.jar" basedir="${build.classes}">
  	    	<include name="org/apache/avalon/**"/>
  	    	<include name="org/apache/framework/**"/>
  	    	<exclude name="**/test/*"/>
  		</jar>
  
  		<!-- phoenix -->
  		<jar jarfile="${build.lib}/phoenix-client.jar" basedir="${build.classes}">
  			<include name="org/apache/phoenix/*"/>
  		</jar>
  		<jar jarfile="${build.lib}/phoenix-engine.jar"
  			basedir="${build.classes}"
  			manifest="${manifest.dir}/engine-Manifest.mf" >
  				<include name="org/apache/phoenix/**"/>
  				<exclude name="org/apache/phoenix/engine/loader/**" />
  		</jar>
  		<jar jarfile="${build.lib}/phoenix-loader.jar"
  			basedir="${build.classes}"
  			manifest="${manifest.dir}/loader-Manifest.mf" >
  				<include name="org/apache/phoenix/engine/loader/**" />
  		</jar>
  		<jar jarfile="${build.lib}/phoenix-shutdown.jar"
  			basedir="${build.classes}"
  			manifest="${manifest.dir}/shutdown-Manifest.mf" >
  				<include name="org/apache/phoenix/*" />
  				<include name="org/apache/avalon/atlantis/core/*" />
  		</jar>
  		
  		<!-- logkit -->
  		<jar jarfile="${build.lib}/logkit.jar" basedir="${build.classes}">
  			<include name="org/apache/log/**" />
  		</jar>
  		<!-- jmx -->
  		<jar jarfile="${build.lib}/jmx.jar" basedir="${build.classes}">
  			<include name="org/apache/jmx/**" />
  		</jar>
  		<jar jarfile="${build.lib}/jmx-client.jar"
  			 basedir="${build.classes}"
  			 manifest="${manifest.dir}/client-Manifest.mf" >
  				<include name="org/apache/jmx/**" />
  				<include name="org/apache/framework/**" />
  				<include name="org/apache/avalon/**" />
  		</jar>
  		
  	</target>
  	<!--
  		/===================================================================\
  		|   Dist target - create distribution                               |
  		\===================================================================/
  	-->
  	<target name="dist" depends="dist-lite,docs">
  		<mkdir dir="${dist.docs}"/>
  		<copy todir="${dist.docs}">
  			<fileset dir="${build.docs}"/>
  		</copy>
  
  		<mkdir dir="${dist.javadocs}"/>
  		<copy todir="${dist.javadocs}">
  			<fileset dir="${build.javadocs}"/>
  		</copy>
  	</target>
  	
  	<!-- distribution without the documentation -->
  	<target name="dist-lite" depends="jar">
  		<mkdir dir="${dist.dir}"/>
  		<mkdir dir="${dist.lib}"/>
  		<mkdir dir="${dist.bin}"/>
  		<mkdir dir="${dist.conf}"/>
  		<mkdir dir="${dist.client}"/>
  
  		<copy file="${build.lib}/avalonapi.jar" tofile="${dist.lib}/avalonapi-${version}.jar"/>
  		<copy file="${build.lib}/phoenix-client.jar" tofile="${dist.lib}/phoenix-client.jar"/>
  		<copy file="${build.lib}/phoenix-engine.jar" tofile="${dist.bin}/phoenix-engine.jar"/>
  		<copy file="${build.lib}/phoenix-loader.jar" tofile="${dist.bin}/phoenix-loader.jar"/>
  		<copy file="${build.lib}/phoenix-shutdown.jar" tofile="${dist.bin}/phoenix-shutdown.jar"/>
  		<copy file="${build.lib}/logkit.jar" tofile="${dist.lib}/logkit.jar"/>
  		<copy file="${build.lib}/jmx.jar" tofile="${dist.lib}/jmx.jar"/>
  		<copy file="${build.lib}/jmx-client.jar" tofile="${dist.client}/jmx-client.jar"/>
  		<copy todir="${dist.lib}">
  			<fileset dir="${lib.dir}" />
  		</copy>
  		<copy todir="${dist.conf}">
  			<fileset dir="${conf.dir}" />
  		</copy>
  
  		<copy file="${script.dir}/run.bat" todir="${dist.bin}"/>
  		<copy file="${script.dir}/stop.bat" todir="${dist.bin}"/>
  		<copy file="${script.dir}/run.sh" todir="${dist.bin}"/>
  		<copy file="${script.dir}/runClient.bat" todir="${dist.client}"/>
  
  		<chmod dir="${dist.dir}" perm="go-rwx" />
  		<chmod file="${dist.bin}/run.sh" perm="u+x"/>
  		<chmod file="${dist.bin}/run.bat" perm="u-x"/>
  		<chmod file="${dist.bin}/stop.bat" perm="u-x"/>
  		<chmod file="${dist.client}/runClient.bat" perm="u-x"/>
  		<fixcrlf srcdir="${dist.dir}" cr="add" includes="**/*.bat" />
  		<fixcrlf srcdir="${dist.dir}" cr="remove" includes="**/*.sh" />
  		<fixcrlf srcdir="${dist.client}" cr="add" includes="**/*.bat" />
  		<fixcrlf srcdir="${dist.client}" cr="remove" includes="**/*.sh" />
  	</target>
  
  	<!--
  		/===================================================================\
  		|   Docs target - create documentation                              |
  		\===================================================================/
  	-->
  	<target name="docs" depends="javadocs">
  	</target>
  	
  	<!-- create javadocs -->
  	<target name="javadocs">
  		<delete dir="${build.javadocs}"/>
  		<mkdir dir="${build.javadocs}"/>
  
  		<javadoc packagenames="org.apache.*"
  			sourcepath="${java.dir}"
  			destdir="${build.javadocs}">
  				<classpath refid="project.class.path" />
  				<doclet name="com.sun.tools.doclets.standard.Standard">
  					<param name="-author"/>
  					<param name="-version"/>
  					<param name="-use"/>
  					<param name="-doctitle" value="${Name}"/>
  					<param name="-windowtitle" value="${Name} Server Framework"/>
  					<param name="-bottom" 
  						value="&quot;Copyright &#169; 2001 Apache Jakarta Project. All Rights Reserved.&quot;"/>
  				</doclet>
  		</javadoc>
  	</target>
  	
  	<!-- process xdocs -->
  <!--  <target name="xdocs">
  		<mkdir dir="${build.xdocs}"/>
  		<mkdir dir="${build.docs}"/>
  
  		<filter token="year" value="${year}"/>
  		<filter token="AVALON_BASE" value="http://jakarta.apache.org/avalon"/>
  		<filter token="FRAMEWORK_BASE" value="http://jakarta.apache.org/avalon/framework"/>
  
  		<copy todir="${build.xdocs}" filtering="on">
  			<fileset dir="${xdocs.dir}">
  				<exclude name="**/images/**"/>
  			</fileset>
  		</copy>
  		<copy todir="${build.docs}" filtering="off">
  			<fileset dir="${xdocs.dir}">
  				<include name="**/images/**"/>
  			</fileset>
  		</copy>
  
  		<stylebook targetdirectory="${build.docs}"
  			book="${build.xdocs}/book.xml"
  			skindirectory="${avalon.skin}">
  				<classpath refid="project.class.path" />
  		</stylebook>
  	</target>-->
  
  </project>
  
  
  
  
  
  
  1.1                  jakarta-avalon-phoenix/proposal/4.0/readme.txt
  
  Index: readme.txt
  ===================================================================
  hi!
  
  This is a sort of 'pre-alpha' of what might be the next version
  of Phoenix. Add the latest sources from the avalon proposal CVS,
  as well as the sources from logkit to the source tree. Then add
  the files from the lib and tool dirs from the avalon, logkit and
  phoenix trees to their respective dirs.
  
  You can build using build.bat.
  
  Only tested on windows 98 first edition; unix and NT scripting is out-
  of-date.
  
  
  1.1                  jakarta-avalon-phoenix/proposal/4.0/lib/jmxri.jar
  
  	<<Binary file>>
  
  
  1.1                  jakarta-avalon-phoenix/proposal/4.0/lib/jmxtools.jar
  
  	<<Binary file>>
  
  
  1.2       +9 -0      jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/avalon/atlantis/core/Embeddor.java
  
  Index: Embeddor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/avalon/atlantis/core/Embeddor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Embeddor.java	2001/04/17 11:38:36	1.1
  +++ Embeddor.java	2001/04/19 14:18:14	1.2
  @@ -12,6 +12,7 @@
   import org.apache.framework.parameters.Parametizable;
   import org.apache.framework.lifecycle.Initializable;
   import org.apache.framework.lifecycle.Executable;
  +import org.apache.framework.lifecycle.Disposable;
   
   
   /**
  @@ -21,4 +22,12 @@
   public interface Embeddor
       extends Parametizable, Initializable, Executable
   {
  +    /**
  +     * Provide a reference to the class that loads the Embeddor.
  +     * Call immediately before init().
  +     *
  +     * The stop() method of Embeddor calls dispose() on this
  +     * object. You may pass a null value to avoid this.
  +     */
  +    public void setRunner( Disposable runner );
   }
  
  
  
  1.2       +5 -0      jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/avalon/atlantis/facilities/Manager.java
  
  Index: Manager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/avalon/atlantis/facilities/Manager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Manager.java	2001/04/17 11:38:39	1.1
  +++ Manager.java	2001/04/19 14:18:18	1.2
  @@ -32,4 +32,9 @@
        * </ul>
        */
       public void contextualize( Context context ) throws ContextException;
  +
  +    /**
  +     * Get a reference to the MBeanServer this manager manages.
  +     */
  +    public MBeanServer getMBeanServer();
   }
  
  
  
  1.1                  jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/jmx/adaptor/RMIAdaptor.java
  
  Index: RMIAdaptor.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 file.
   */
  package org.apache.jmx.adaptor;
  
  import java.rmi.Remote;
  import java.rmi.RemoteException;
  import java.util.Set;
  import java.io.ObjectInputStream;
  
  import javax.management.*;
  
  /**
   * This is the RMI connection representing an MBeanServer. It is
   * identical to the <code>MBeanServer</code> interface, except
   * it throws exceptions related to remote operations.
   *
   * @author <a href="mailto:mail@leosimons.com">Leo Simons</a>
   */
  public interface RMIAdaptor extends Remote
  {
      /**
       * Instantiates an object using the list of all class loaders registered
       * in the MBean server ({@link javax.management.loading.DefaultLoaderRepository Default Loader Repository}).
       * The object's class should have a public constructor.
       * It returns a reference to the newly created object.
       * The newly created object is not registered in the MBean server.
       *
       * @param className The class name of the object to be instantiated.
       *
       * @return The newly instantiated object.
       *
       * @exception ReflectionException Wraps a <CODE>java.lang.ClassNotFoundException</CODE> or the <CODE>java.lang.Exception</CODE> that
       * occurred when trying to invoke the object's constructor.
       * @exception MBeanException The constructor of the object has thrown an exception
       * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The className passed in parameter is null.
       *
       */
      public Object instantiate(String className) throws ReflectionException, MBeanException, RemoteException;
  
      /**
       * Instantiates an object using the class Loader specified by its <CODE>ObjectName</CODE>.
       * If the loader name is null, the ClassLoader that loaded the MBean Server will be used.
       * The object's class should have a public constructor.
       * It returns a reference to the newly created object.
       * The newly created object is not registered in the MBean server.
       *
       * @param className The class name of the MBean to be instantiated.
       * @param loaderName The object name of the class loader to be used.
       *
       * @return The newly instantiated object.
       *
       * @exception ReflectionException Wraps a <CODE>java.lang.ClassNotFoundException</CODE> or the <CODE>java.lang.Exception</CODE> that
       * occurred when trying to invoke the object's constructor.
       * @exception MBeanException The constructor of the object has thrown an exception.
       * @exception InstanceNotFoundException The specified class loader is not registered in the MBaenServer.
       * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The className passed in parameter is null.
       *
       */
      public Object instantiate(String className, ObjectName loaderName)
          throws ReflectionException, MBeanException, InstanceNotFoundException, RemoteException;
  
      /**
       * Instantiates an object using the list of all class loaders registered
       * in the MBean server ({@link javax.management.loading.DefaultLoaderRepository Default Loader Repository}).
       * The object's class should have a public constructor.
       * The call returns a reference to the newly created object.
       * The newly created object is not registered in the MBean server.
       *
       * @param className The class name of the object to be instantiated.
       * @param params An array containing the parameters of the constructor to be invoked.
       * @param signature An array containing the signature of the constructor to be invoked.
       *
       * @return The newly instantiated object.
       *
       * @exception ReflectionException Wraps a <CODE>java.lang.ClassNotFoundException</CODE> or the <CODE>java.lang.Exception</CODE> that
       * occurred when trying to invoke the object's constructor.
       * @exception MBeanException The constructor of the object has thrown an exception
       * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The className passed in parameter is null.
       *
       */
      public Object instantiate(String className, Object params[], String signature[])
          throws ReflectionException, MBeanException, RemoteException;
  
      /**
       * Instantiates an object. The class loader to be used is identified by its object
       * name. If the object name of the loader is null, the ClassLoader that loaded the MBean server will be used.
       * The object's class should have a public constructor.
       * The call returns a reference to the newly created object.
       * The newly created object is not registered in the MBean server.
       *
       * @param className The class name of the object to be instantiated.
       * @param params An array containing the parameters of the constructor to be invoked.
       * @param signature An array containing the signature of the constructor to be invoked.
       * @param loaderName The object name of the class loader to be used.
       *
       * @return The newly instantiated object.
       *
       * @exception ReflectionException Wraps a <CODE>java.lang.ClassNotFoundException</CODE> or the <CODE>java.lang.Exception</CODE> that
       * occurred when trying to invoke the object's constructor.
       * @exception MBeanException The constructor of the object has thrown an exception
       * @exception InstanceNotFoundException The specified class loader is not registered in the MBean server.
       * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The className passed in parameter is null.
       *
       */
      public Object instantiate(String className, ObjectName loaderName, Object params[], String signature[])
          throws ReflectionException, MBeanException, InstanceNotFoundException, RemoteException;
  
      /**
       * Instantiates and registers an MBean in the MBean server.
       * The MBean server will use the {@link javax.management.loading.DefaultLoaderRepository Default Loader Repository}
       * to load the class of the MBean.
       * An object name is associated to the MBean.
       * If the object name given is null, the MBean can automatically provide its
       * own name by implementing the {@link javax.management.MBeanRegistration MBeanRegistration} interface.
       * The call returns an <CODE>ObjectInstance</CODE> object representing the newly created MBean.
       *
       * @param className The class name of the MBean to be instantiated.
       * @param name The object name of the MBean. May be null.
       *
       * @return  An <CODE>ObjectInstance</CODE>, containing the <CODE>ObjectName</CODE> and the Java class name
       * of the newly instantiated MBean.
       *
       * @exception ReflectionException Wraps a <CODE>java.lang.ClassNotFoundException</CODE> or a <CODE><CODE>java.lang.Exception</CODE></CODE> that occurred
       * when trying to invoke the MBean's constructor.
       * @exception InstanceAlreadyExistsException The MBean is already under the control of the MBean server.
       * @exception MBeanRegistrationException The <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE> interface) method of the MBean
       * has thrown an exception. The MBean will not be registered.
       * @exception MBeanException The constructor of the MBean has thrown an exception
       * @exception NotCompliantMBeanException This class is not a JMX compliant MBean
       * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>:
       * The className passed in parameter is null, the <CODE>ObjectName</CODE> passed in parameter contains a pattern or no <CODE>ObjectName</CODE> is specified
       * for the MBean.
       *
       */
      public ObjectInstance createMBean(String className, ObjectName name)
          throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, RemoteException;
  
      /**
       * Instantiates and registers an MBean in the MBean server.
       * The class loader to be used is identified by its object  name. An object name is associated to the MBean.
       * If the object name  of the loader is null, the ClassLoader that loaded the MBean server will be used.
       * If the MBean's object name given is null, the MBean can automatically provide its
       * own name by implementing the {@link javax.management.MBeanRegistration MBeanRegistration} interface.
       * The call returns an <CODE>ObjectInstance</CODE> object representing the newly created MBean.
       *
       * @param className The class name of the MBean to be instantiated.
       * @param name The object name of the MBean. May be null.
       * @param loaderName The object name of the class loader to be used.
       *
       * @return  An <CODE>ObjectInstance</CODE>, containing the <CODE>ObjectName</CODE> and the Java class name
       * of the newly instantiated MBean.
       *
       * @exception ReflectionException  Wraps a <CODE>java.lang.ClassNotFoundException</CODE> or a <CODE>java.lang.Exception</CODE> that occurred
       * when trying to invoke the MBean's constructor.
       * @exception InstanceAlreadyExistsException The MBean is already under the control of the MBean server.
       * @exception MBeanRegistrationException The <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE>  interface) method of the MBean
       * has thrown an exception. The MBean will not be registered.
       * @exception MBeanException The constructor of the MBean has thrown an exception
       * @exception NotCompliantMBeanException This class is not a JMX compliant MBean
       * @exception InstanceNotFoundException The specified class loader is not registered in the MBean server.
       * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The className passed in parameter is null,
       * the <CODE>ObjectName</CODE> passed in parameter contains a pattern or no <CODE>ObjectName</CODE> is specified for the MBean.
       */
      public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName)
          throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException,
          InstanceNotFoundException, RemoteException;
  
  
      /**
       * Instantiates and registers an MBean in the MBean server.
       * The MBean server will use the {@link javax.management.loading.DefaultLoaderRepository Default Loader Repository}
       * to load the class of the MBean.
       * An object name is associated to the MBean.
       * If the object name given is null, the MBean can automatically provide its
       * own name by implementing the {@link javax.management.MBeanRegistration MBeanRegistration} interface.
       * The call returns an <CODE>ObjectInstance</CODE> object representing the newly created MBean.
       *
       * @param className The class name of the MBean to be instantiated.
       * @param name The object name of the MBean. May be null.
       * @param params An array containing the parameters of the constructor to be invoked.
       * @param signature An array containing the signature of the constructor to be invoked.
       *
       * @return  An <CODE>ObjectInstance</CODE>, containing the <CODE>ObjectName</CODE> and the Java class name
       * of the newly instantiated MBean.
       *
       * @exception ReflectionException Wraps a <CODE>java.lang.ClassNotFoundException</CODE> or a <CODE>java.lang.Exception</CODE> that occurred
       * when trying to invoke the MBean's constructor.
       * @exception InstanceAlreadyExistsException The MBean is already under the control of the MBean server.
       * @exception MBeanRegistrationException The <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE>  interface) method of the MBean
       * has thrown an exception. The MBean will not be registered.
       * @exception MBeanException The constructor of the MBean has thrown an exception
       * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The className passed in parameter is null,
       * the <CODE>ObjectName</CODE> passed in parameter contains a pattern or no <CODE>ObjectName</CODE> is specified for the MBean.
       *
       */
      public ObjectInstance createMBean(String className, ObjectName name, Object params[], String signature[])
          throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, RemoteException;
  
      /**
       * Instantiates and registers an MBean in the MBean server.
       * The class loader to be used is identified by its object
       * name. An object name is associated to the MBean. If the object name
       * of the loader is not specified, the ClassLoader that loaded the MBean server will be used.
       * If  the MBean object name given is null, the MBean can automatically provide its
       * own name by implementing the {@link javax.management.MBeanRegistration MBeanRegistration} interface.
       * The call returns an <CODE>ObjectInstance</CODE> object representing the newly created MBean.
       *
       * @param className The class name of the MBean to be instantiated.
       * @param name The object name of the MBean. May be null.
       * @param params An array containing the parameters of the constructor to be invoked.
       * @param signature An array containing the signature of the constructor to be invoked.
       * @param loaderName The object name of the class loader to be used.
       *
       * @return  An <CODE>ObjectInstance</CODE>, containing the <CODE>ObjectName</CODE> and the Java class name
       * of the newly instantiated MBean.
       *
       * @exception ReflectionException Wraps a <CODE>java.lang.ClassNotFoundException</CODE> or a <CODE>java.lang.Exception</CODE> that occurred
       * when trying to invoke the MBean's constructor.
       * @exception InstanceAlreadyExistsException The MBean is already under the control of the MBean server.
       * @exception MBeanRegistrationException The <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE>  interface) method of the MBean
       * has thrown an exception. The MBean will not be registered.
       * @exception MBeanException The constructor of the MBean has thrown an exception
       * @exception InstanceNotFoundException The specified class loader is not registered in the MBean server.
       * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The className passed in parameter is null,
       * the <CODE>ObjectName</CODE> passed in parameter contains a pattern or no <CODE>ObjectName</CODE> is specified for the MBean.
       *
       */
      public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object params[], String signature[])
          throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException,
          InstanceNotFoundException, RemoteException;
  
      /**
       * Registers a pre-existing object as an MBean with the MBean server. If the object name given is
       * null, the MBean may automatically provide its own name by implementing the
       * {@link javax.management.MBeanRegistration MBeanRegistration}  interface.
       * The call returns an <CODE>ObjectInstance</CODE> object representing the registered MBean.
       *
       * @param object The  MBean to be registered as an MBean.
       * @param name The object name of the MBean. May be null.
       *
       * @return  The <CODE>ObjectInstance</CODE> for the MBean that has been registered.
       *
       * @exception InstanceAlreadyExistsException The MBean is already under the control of the MBean server.
       * @exception MBeanRegistrationException The <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE>  interface) method of the MBean
       * has thrown an exception. The MBean will not be registered.
       * @exception NotCompliantMBeanException This object is not a JMX compliant MBean
       * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The object passed in parameter is null or
       * no object name is specified.
       *
       */
      public ObjectInstance registerMBean(Object object, ObjectName name)
          throws InstanceAlreadyExistsException, MBeanRegistrationException,
          NotCompliantMBeanException, RemoteException;
  
      /**
       * De-registers an MBean from the MBean server. The MBean is identified by
       * its object name. Once the method has been invoked, the MBean may
       * no longer be accessed by its object name.
       *
       * @param name The object name of the MBean to be de-registered.
       *
       * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server.
       * @exception MBeanRegistrationException The preDeregister ((<CODE>MBeanRegistration</CODE>  interface) method of the MBean
       * has thrown an exception.
       * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The object name in parameter is null or
       * the MBean you are when trying to de-register is the {@link javax.management.MBeanServerDelegate MBeanServerDelegate} MBean.
       *
       */
      public void unregisterMBean(ObjectName name)
          throws InstanceNotFoundException, MBeanRegistrationException, RemoteException;
  
      /**
       * Gets the <CODE>ObjectInstance</CODE> for a given MBean registered with the MBean server.
       *
       * @param name The object name of the MBean.
       *
       * @return The <CODE>ObjectInstance</CODE> associated to the MBean specified by <VAR>name</VAR>.
       *
       * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server.
       */
      public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException, RemoteException;
  
      /**
       * Gets MBeans controlled by the MBean server. This method allows any
       * of the following to be obtained: All MBeans, a set of MBeans specified
       * by pattern matching on the <CODE>ObjectName</CODE> and/or a Query expression, a
       * specific MBean. When the object name is null or no domain and key properties are specified,
       * all objects are to be selected (and filtered if a query is specified). It returns the
       * set of <CODE>ObjectInstance</CODE> objects (containing the <CODE>ObjectName</CODE> and the Java Class name) for
       * the selected MBeans.
       *
       * @param name The object name pattern identifying the MBeans to be retrieved. If
       * null or no domain and key properties are specified, all the MBeans registered will be retrieved.
       * @param query The query expression to be applied for selecting MBeans. If null
       * no query expression will be applied for selecting MBeans.
       *
       * @return  A set containing the <CODE>ObjectInstance</CODE> objects for the selected MBeans.
       * If no MBean satisfies the query an empty list is returned.
       *
       */
      public Set queryMBeans(ObjectName name, QueryExp query) throws RemoteException;
  
      /**
       * Gets the names of MBeans controlled by the MBean server. This method
       * enables any of the following to be obtained: The names of all MBeans,
       * the names of a set of MBeans specified by pattern matching on the
       * <CODE>ObjectName</CODE> and/or a Query expression, a specific MBean name (equivalent to
       * testing whether an MBean is registered). When the object name is
       * null or no domain and key properties are specified, all objects are selected (and filtered if a
       * query is specified). It returns the set of ObjectNames for the MBeans
       * selected.
       *
       * @param name The object name pattern identifying the MBeans to be retrieved. If
       * null or no domain and key properties are specified, all the MBeans registered will be retrieved.
       * @param query The query expression to be applied for selecting MBeans. If null
       * no query expression will be applied for selecting MBeans.
       *
       * @return  A set containing the ObjectNames for the MBeans selected.
       * If no MBean satisfies the query, an empty list is returned.
       *
       */
      public Set queryNames(ObjectName name, QueryExp query) throws RemoteException;
  
      /**
       * Checks whether an MBean, identified by its object name, is already registered
       * with the MBean server.
       *
       * @param name The object name of the MBean to be checked.
       *
       * @return  True if the MBean is already registered in the MBean server, false otherwise.
       *
       * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The object name in parameter is null.
       *
       */
      public boolean isRegistered(ObjectName name) throws RemoteException;
  
  
      /**
       * Returns the number of MBeans registered in the MBean server.
       */
      public Integer getMBeanCount() throws RemoteException;
  
      /**
       * Gets the value of a specific attribute of a named MBean. The MBean
       * is identified by its object name.
       *
       * @param name The object name of the MBean from which the attribute is to be retrieved.
       * @param attribute A String specifying the name of the attribute to be
       * retrieved.
       *
       * @return  The value of the retrieved attribute.
       *
       * @exception AttributeNotFoundException The attribute specified is not accessible in the MBean.
       * @exception MBeanException  Wraps an exception thrown by the MBean's getter.
       * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server.
       * @exception ReflectionException  Wraps a <CODE>java.lang.Exception</CODE> thrown when trying to invoke the setter.
       * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The object name in parameter is null or
       * the attribute in parameter is null.
       */
      public Object getAttribute(ObjectName name, String attribute) throws
      MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException, RemoteException;
  
  
      /**
       * Enables the values of several attributes of a named MBean. The MBean
       * is identified by its object name.
       *
       * @param name The object name of the MBean from which the attributes are
       * retrieved.
       * @param attributes A list of the attributes to be retrieved.
       *
       * @return The list of the retrieved attributes.
       *
       * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server.
       * @exception ReflectionException An exception occurred when trying to invoke the getAttributes method of a Dynamic MBean.
       * @exception RuntimeOperationsException Wrap a <CODE>java.lang.IllegalArgumentException</CODE>: The object name in parameter is null or
       * attributes in parameter is null.
       *
       */
      public AttributeList getAttributes(ObjectName name, String[] attributes)
          throws InstanceNotFoundException, ReflectionException;
  
      /**
       * Sets the value of a specific attribute of a named MBean. The MBean
       * is identified by its object name.
       *
       * @param name The name of the MBean within which the attribute is to be set.
       * @param attribute The identification of the attribute to be set and the value it is to be set to.
       *
       * @return  The value of the attribute that has been set.
       *
       * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server.
       * @exception AttributeNotFoundException The attribute specified is not accessible in the MBean.
       * @exception InvalidAttributeValueException The value specified for the attribute is not valid.
       * @exception MBeanException Wraps an exception thrown by the MBean's setter.
       * @exception ReflectionException  Wraps a <CODE>java.lang.Exception</CODE> thrown when trying to invoke the setter.
       * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The object name in parameter is null or
       * the attribute in parameter is null.
       */
      public void setAttribute(ObjectName name, Attribute attribute) throws
      InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException,
      ReflectionException, RemoteException;
  
      /**
       * Sets the values of several attributes of a named MBean. The MBean is
       * identified by its object name.
       *
       * @param name The object name of the MBean within which the attributes are to
       * be set.
       * @param attributes A list of attributes: The identification of the
       * attributes to be set and  the values they are to be set to.
       *
       * @return  The list of attributes that were set, with their new values.
       *
       * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server.
       * @exception ReflectionException An exception occurred when trying to invoke the getAttributes method of a Dynamic MBean.
       * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The object name in parameter is null or
       * attributes in parameter is null.
       *
       */
      public AttributeList setAttributes(ObjectName name, AttributeList attributes)
          throws InstanceNotFoundException, ReflectionException, RemoteException;
  
      /**
       * Invokes an operation on an MBean.
       *
       * @param name The object name of the MBean on which the method is to be invoked.
       * @param operationName The name of the operation to be invoked.
       * @param params An array containing the parameters to be set when the operation is
       * invoked
       * @param signature An array containing the signature of the operation. The class objects will
       * be loaded using the same class loader as the one used for loading the MBean on which the operation was invoked.
       *
       * @return  The object returned by the operation, which represents the result ofinvoking the operation on the
       * MBean specified.
       *
       * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server.
       * @exception MBeanException  Wraps an exception thrown by the MBean's invoked method.
       * @exception ReflectionException  Wraps a <CODE>java.lang.Exception</CODE> thrown while trying to invoke the method.
       *
       */
      public Object invoke(ObjectName name, String operationName, Object params[],
                              String signature[])
          throws InstanceNotFoundException, MBeanException, ReflectionException, RemoteException;
  
      /**
       * Returns the default domain used for naming the MBean.
       * The default domain name is used as the domain part in the ObjectName
       * of MBeans if no domain is specified by the user.
       */
      public String getDefaultDomain() throws RemoteException;
  
      /**
       * Enables to add a listener to a registered MBean.
       *
       * @param name The name of the MBean on which the listener should be added.
       * @param listener The listener object which will handle the notifications emitted by the registered MBean.
       * @param filter The filter object. If filter is null, no filtering will be performed before handling notifications.
       * @param handback The context to be sent to the listener when a notification is emitted.
       *
       * @exception InstanceNotFoundException The MBean name provided does not match any of the registered MBeans.
       *
       */
      public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback)
          throws InstanceNotFoundException, RemoteException;
  
      /**
       * Enables to add a listener to a registered MBean.
       *
       * @param name The name of the MBean on which the listener should be added.
       * @param listener The object name of the listener which will handle the notifications emitted by the registered MBean.
       * @param filter The filter object. If filter is null, no filtering will be performed before handling notifications.
       * @param handback The context to be sent to the listener when a notification is emitted.
       *
       * @exception InstanceNotFoundException The MBean name of the notification listener or of the notification broadcaster
       * does not match any of the registered MBeans.
       */
      public void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback)
          throws InstanceNotFoundException, RemoteException;
  
  
      /**
       * Enables to remove a listener from a registered MBean.
       *
       * @param name The name of the MBean on which the listener should be removed.
       * @param listener The listener object which will handle the notifications emitted by the registered MBean.
       * This method will remove all the information related to this listener.
       *
       * @exception InstanceNotFoundException The MBean name provided does not match any of the registered MBeans.
       * @exception ListenerNotFoundException The listener is not registered in the MBean.
       */
      public void removeNotificationListener(ObjectName name, NotificationListener listener)
          throws InstanceNotFoundException, ListenerNotFoundException, RemoteException;
  
      /**
       * Enables to remove a listener from a registered MBean.
       *
       * @param name The name of the MBean on which the listener should be removed.
       * @param listener The object name of the listener which will handle the notifications emitted by the registered MBean.
       * This method will remove all the information related to this listener.
       *
       * @exception InstanceNotFoundException The MBean name provided does not match any of the registered MBeans.
       * @exception ListenerNotFoundException The listener is not registered in the MBean.
       */
      public void removeNotificationListener(ObjectName name, ObjectName listener)
          throws InstanceNotFoundException, ListenerNotFoundException, RemoteException;
  
      /**
       * This method discovers the attributes and operations that an MBean exposes
       * for management.
       *
       * @param name The name of the MBean to analyze
       *
       * @return  An instance of <CODE>MBeanInfo</CODE> allowing the retrieval of all attributes and operations
       * of this MBean.
       *
       * @exception IntrospectionException An exception occurs during introspection.
       * @exception InstanceNotFoundException The MBean specified is not found.
       * @exception ReflectionException An exception occurred when trying to invoke the getMBeanInfo of a Dynamic MBean.
       */
      public MBeanInfo getMBeanInfo(ObjectName name) throws
          InstanceNotFoundException, IntrospectionException, ReflectionException, RemoteException;
  
      /** Returns true if the MBean specified is an instance of the specified class, false otherwise.
       *
       * @param name The <CODE>ObjectName</CODE> of the MBean.
       * @param className The name of the class.
       *
       * @return true if the MBean specified is an instance of the specified class, false otherwise.
       *
       * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server.
       */
      public boolean isInstanceOf(ObjectName name, String className) throws InstanceNotFoundException, RemoteException;
  
      /**
       * De-serializes a byte array in the context of the class loader
       * of an MBean.
       *
       * @param name The name of the MBean whose class loader should be used for the de-serialization.
       * @param data The byte array to be de-sererialized.
       *
       * @return  The de-serialized object stream.
       *
       * @exception InstanceNotFoundException The MBean specified is not found.
       * @exception OperationsException Any of the usual Input/Output related exceptions.
       *
       */
      public ObjectInputStream deserialize(ObjectName name, byte[] data)
      throws InstanceNotFoundException, OperationsException, RemoteException;
  
      /**
       * De-serializes a byte array in the context of a given MBean class loader.
       * The class loader is the one that loaded the class with name "className".
       *
       * @param name The name of the class whose class loader should be used for the de-serialization.
       * @param data The byte array to be de-sererialized.
       *
       * @return  The de-serialized object stream.
       *
       * @exception OperationsException Any of the usual Input/Output related exceptions.
       * @exception ReflectionException The specified class could not be loaded by the default loader repository
       *
       */
      public ObjectInputStream deserialize(String className, byte[] data)
      throws OperationsException, ReflectionException, RemoteException;
  
  
      /**
       * De-serializes a byte array in the context of a given MBean class loader.
       * The class loader is the one that loaded the class with name "className".
       * The name of the class loader to be used for loading the specified class is specified.
       * If null, the MBean Server's class loader will be used.
       *
       * @param name The name of the class whose class loader should be used for the de-serialization.
       * @param data The byte array to be de-sererialized.
       * @param loaderName The name of the class loader to be used for loading the specified class.
       * If null, the MBean Server's class loader will be used.
       *
       * @return  The de-serialized object stream.
       *
       * @exception InstanceNotFoundException The specified class loader MBean is not found.
       * @exception OperationsException Any of the usual Input/Output related exceptions.
       * @exception ReflectionException The specified class could not be loaded by the specified class loader.
       *
       */
      public ObjectInputStream deserialize(String className, ObjectName loaderName, byte[] data)
      throws InstanceNotFoundException, OperationsException, ReflectionException, RemoteException;
  
  }
  
  
  1.1                  jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/jmx/adaptor/RMIAdaptorImpl.java
  
  Index: RMIAdaptorImpl.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 file.
   */
  package org.apache.jmx.adaptor;
  
  import java.rmi.Remote;
  import java.rmi.RemoteException;
  import java.rmi.server.UnicastRemoteObject;
  import java.util.Set;
  import java.io.ObjectInputStream;
  
  import javax.management.*;
  
  /**
   * This is the RMI connection representing an MBeanServer. It is
   * identical to the <code>MBeanServer</code> interface, except
   * it throws exceptions related to remote operations.
   *
   * @author <a href="mailto:mail@leosimons.com">Leo Simons</a>
   */
  public class RMIAdaptorImpl extends UnicastRemoteObject implements RMIAdaptor
  {
      private MBeanServer server;
  
      public RMIAdaptorImpl(MBeanServer server) throws RemoteException {
          super();
          this.server = server;
      }
  
  
      /////////////////////////////////
      /// RMIADAPTOR IMPLEMENTATION ///
      /////////////////////////////////
      public Object instantiate(String className)
          throws ReflectionException, MBeanException, RemoteException {
              return server.instantiate(className);
          }
      public Object instantiate(String className, ObjectName loaderName)
          throws ReflectionException, MBeanException, InstanceNotFoundException, RemoteException {
              return server.instantiate(className, loaderName);
          }
      public Object instantiate(String className, Object params[], String[] signature)
          throws ReflectionException, MBeanException, RemoteException {
              return server.instantiate(className, params, signature);
          }
      public Object instantiate(  String className,
                                  ObjectName loaderName,
                                  Object params[],
                                  String[] signature)
          throws ReflectionException, MBeanException, InstanceNotFoundException, RemoteException {
              return server.instantiate(className,loaderName, params, signature);
          }
  
      public ObjectInstance createMBean(String className, ObjectName name)
          throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException,
          MBeanException, NotCompliantMBeanException, RemoteException {
              return server.createMBean(className,name);
          }
      public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName)
          throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException,
          MBeanException, NotCompliantMBeanException, InstanceNotFoundException, RemoteException {
              return server.createMBean(className, name, loaderName);
          }
      public ObjectInstance createMBean(  String className,
                                          ObjectName name,
                                          Object[] params,
                                          String[] signature)
          throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException,
          MBeanException, NotCompliantMBeanException, RemoteException {
              return server.createMBean(className, name, params, signature);
          }
      public ObjectInstance createMBean(  String className,
                                          ObjectName name,
                                          ObjectName loaderName,
                                          Object[] params,
                                          String[] signature)
          throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException,
          MBeanException, NotCompliantMBeanException, InstanceNotFoundException, RemoteException {
              return server.createMBean(className, name, loaderName, params, signature);
          }
  
      public ObjectInstance registerMBean(Object object, ObjectName name)
          throws InstanceAlreadyExistsException, MBeanRegistrationException,
          NotCompliantMBeanException, RemoteException {
              return server.registerMBean(object, name);
          }
  
      public void unregisterMBean(ObjectName name)
          throws InstanceNotFoundException, MBeanRegistrationException, RemoteException {
              server.unregisterMBean(name);
          }
  
      public ObjectInstance getObjectInstance(ObjectName name)
          throws InstanceNotFoundException, RemoteException {
              return server.getObjectInstance(name);
          }
  
      public Set queryMBeans(ObjectName name, QueryExp query) throws RemoteException {
          return server.queryMBeans(name, query);
      }
      public Set queryNames(ObjectName name, QueryExp query) throws RemoteException {
          return server.queryMBeans(name, query);
      }
  
      public boolean isRegistered(ObjectName name) throws RemoteException {
          return server.isRegistered(name);
      }
  
      public Integer getMBeanCount() throws RemoteException {
          return server.getMBeanCount();
      }
      public Object getAttribute(ObjectName name, String attribute)
          throws MBeanException, AttributeNotFoundException, InstanceNotFoundException,
          ReflectionException, RemoteException {
              return server.getAttribute(name, attribute);
          }
      public AttributeList getAttributes(ObjectName name, String[] attributes)
          throws InstanceNotFoundException, ReflectionException {
              return server.getAttributes(name, attributes);
          }
      public void setAttribute(ObjectName name, Attribute attribute)
          throws InstanceNotFoundException, AttributeNotFoundException,
          InvalidAttributeValueException, MBeanException, ReflectionException, RemoteException {
              server.setAttribute(name, attribute);
          }
      public AttributeList setAttributes(ObjectName name, AttributeList attributes)
          throws InstanceNotFoundException, ReflectionException, RemoteException {
              return server.setAttributes(name, attributes);
          }
      public Object invoke(ObjectName name, String operationName, Object[] params, String[] signature)
          throws InstanceNotFoundException, MBeanException, ReflectionException, RemoteException {
              return server.invoke(name, operationName, params, signature);
          }
      public String getDefaultDomain() throws RemoteException {
          return server.getDefaultDomain();
      }
      public void addNotificationListener(    ObjectName name,
                                              NotificationListener listener,
                                              NotificationFilter filter,
                                              Object handback)
          throws InstanceNotFoundException, RemoteException {
              server.addNotificationListener(name, listener, filter, handback);
          }
      public void addNotificationListener(    ObjectName name,
                                              ObjectName listener,
                                              NotificationFilter filter,
                                              Object handback)
          throws InstanceNotFoundException, RemoteException {
              server.addNotificationListener(name, listener, filter, handback);
          }
      public void removeNotificationListener(ObjectName name, NotificationListener listener)
          throws InstanceNotFoundException, ListenerNotFoundException, RemoteException {
              server.removeNotificationListener(name, listener);
          }
      public void removeNotificationListener(ObjectName name, ObjectName listener)
          throws InstanceNotFoundException, ListenerNotFoundException, RemoteException {
              server.removeNotificationListener(name, listener);
          }
      public MBeanInfo getMBeanInfo(ObjectName name)
          throws InstanceNotFoundException, IntrospectionException, ReflectionException,
          RemoteException {
              return server.getMBeanInfo(name);
          }
      public boolean isInstanceOf(ObjectName name, String className)
          throws InstanceNotFoundException, RemoteException {
              return server.isInstanceOf(name,className);
          }
      public ObjectInputStream deserialize(ObjectName name, byte[] data)
          throws InstanceNotFoundException, OperationsException, RemoteException {
              return server.deserialize(name, data);
          }
      public ObjectInputStream deserialize(String className, byte[] data)
          throws OperationsException, ReflectionException, RemoteException {
              return server.deserialize(className, data);
          }
      public ObjectInputStream deserialize(String className, ObjectName loaderName, byte[] data)
          throws InstanceNotFoundException, OperationsException, ReflectionException,
          RemoteException {
              return server.deserialize(className, loaderName, data);
          }
  }
  
  
  1.4       +99 -1     jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/Shutdown.java
  
  Index: Shutdown.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/Shutdown.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Shutdown.java	2001/04/06 15:41:24	1.3
  +++ Shutdown.java	2001/04/19 14:18:22	1.4
  @@ -7,13 +7,111 @@
    */
   package org.apache.phoenix;
   
  +import java.rmi.registry.LocateRegistry;
  +import java.rmi.registry.Registry;
  +import java.rmi.Naming;
  +import java.rmi.Remote;
  +
  +import java.security.AccessController;
  +import java.security.PrivilegedActionException;
  +import java.security.PrivilegedExceptionAction;
  +
  +import javax.management.ObjectName;
  +
  +import org.apache.avalon.atlantis.core.Embeddor;
  +
  +import org.apache.jmx.adaptor.RMIAdaptor;
  +
   /**
    * Class to exit phoenix. Call to shut down the server.
    *
    * @author <a href="mail@leosimons.com">Leo Simons</a>
    */
   public class Shutdown {
  +        private static int registryPort;
  +        private static final int DEFAULT_REGISTRY_PORT =
  +                                                    1111;
  +        private static String computerName;
  +        private static final String DEFAULT_COMPUTER_NAME =
  +                                                    "localhost";
  +        private static String adaptorName;
  +        private static final String DEFAULT_ADAPTOR_NAME =
  +                                                    "phoenix.manager.JMXAdaptor";
       public Shutdown() {
  -        (new Start()).dispose();
  +
  +    }
  +
  +    public void main( final String[] args )
  +    {
  +        final Shutdown shutdown = new Shutdown();
  +
  +        try
  +        {
  +            shutdown.execute( args );
  +        }
  +        catch( final Throwable throwable )
  +        {
  +            System.out.println( "" );
  +            System.out.println( "" );
  +            System.out.println( "There was an uncaught exception:" );
  +            System.out.println( "---------------------------------------------------------" );
  +            System.out.println( throwable.toString() );
  +            //throwable.printStackTrace( System.out  );
  +            System.out.println( "---------------------------------------------------------" );
  +            System.out.println( "Please check the configuration files and restart phoenix." );
  +            System.out.println( "If the problem persists, contact the Avalon project.  See" );
  +            System.out.println( "http://jakarta.apache.org/avalon for more information." );
  +            System.out.println( "" );
  +            System.out.println( "" );
  +            System.exit( 1 );
  +        }
  +    }
  +    /////////////////////////
  +    /// EXECUTION METHODS ///
  +    /////////////////////////
  +    private void execute( final String[] args ) throws Exception
  +    {
  +        try
  +        {
  +            final PrivilegedExceptionAction action = new PrivilegedExceptionAction()
  +            {
  +                public Object run() throws Exception
  +                {
  +                    exec( args );
  +                    return null;
  +                }
  +            };
  +
  +            AccessController.doPrivileged( action );
  +        }
  +        catch( final PrivilegedActionException pae )
  +        {
  +            // only "checked" exceptions will be "wrapped" in a PrivilegedActionException.
  +            throw pae.getException();
  +        }
  +    }
  +    private void exec( final String[] args ) throws Exception
  +    {
  +        this.parseCommandLineOptions( args );
  +
  +        final Registry registry = LocateRegistry.getRegistry(this.registryPort);
  +        final RMIAdaptor remote = (RMIAdaptor)registry.lookup("//"+computerName+":"+registryPort+"/"+adaptorName);
  +        final Embeddor embeddor = (Embeddor)remote.getObjectInstance( new ObjectName( "Embeddor" ) );
  +        embeddor.stop();
  +    }
  +    //////////////////////
  +    /// HELPER METHODS ///
  +    //////////////////////
  +    private void parseCommandLineOptions( final String[] args )
  +    {
  +        // start with the defaults
  +        this.registryPort = this.DEFAULT_REGISTRY_PORT;
  +        this.adaptorName = this.DEFAULT_ADAPTOR_NAME;
  +
  +        // try to get the computer name from system property
  +        if( (this.computerName = System.getProperty( "computer.name" )) == null )
  +            this.computerName = this.DEFAULT_COMPUTER_NAME;
  +
  +        // TODO: parse options
       }
   }
  
  
  
  1.5       +70 -19    jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/Start.java
  
  Index: Start.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/Start.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Start.java	2001/04/17 11:31:17	1.4
  +++ Start.java	2001/04/19 14:18:24	1.5
  @@ -26,10 +26,10 @@
   import org.apache.framework.component.DefaultComponentManager;
   
   import org.apache.avalon.camelot.Entry;
  -import org.apache.avalon.util.cli.CLOptionDescriptor;
  -import org.apache.avalon.util.cli.CLArgsParser;
  -import org.apache.avalon.util.cli.CLOption;
  -import org.apache.avalon.util.cli.CLUtil;
  +import org.apache.avalon.cli.CLOptionDescriptor;
  +import org.apache.avalon.cli.CLArgsParser;
  +import org.apache.avalon.cli.CLOption;
  +import org.apache.avalon.cli.CLUtil;
   
   import org.apache.avalon.atlantis.core.Embeddor;
   import org.apache.phoenix.engine.PhoenixEmbeddor;
  @@ -47,6 +47,8 @@
    */
   public class Start implements Disposable
   {
  +    // classloader
  +    private static ClassLoader cl;
       // embeddor
       private static Embeddor embeddor;
           // embeddor configuration settings
  @@ -55,13 +57,13 @@
                                                       "org.apache.phoenix.engine.PhoenixEmbeddor";
           private static String deployerClass;
           private static final String DEFAULT_DEPLOYER_CLASS =
  -                                                    "org.apache.phoenix.engine.DefaultSarDeployer";
  +                                                    "org.apache.phoenix.engine.deployer.DefaultDeployer";
           private static String mBeanServerClass;
           private static final String DEFAULT_MBEANSERVER_CLASS =
                                                       "org.apache.jmx.MBeanServerImpl";
           private static String kernelClass;
           private static final String DEFAULT_KERNEL_CLASS =
  -                                                    "org.apache.phoenix.engine.DefaultKernel";
  +                                                    "org.apache.phoenix.engine.PhoenixKernel";
           private static String configurationSource;
           private static final String DEFAULT_CONFIGURATION_SOURCE =
                                                       "../conf/server.xml";
  @@ -71,8 +73,16 @@
           private static String applicationSource;
           private static final String DEFAULT_APPLICATON_SOURCE =
                                                       "../apps";
  +        private static int registryPort;
  +        private static final int DEFAULT_REGISTRY_PORT =
  +                                                    1111;
  +        private static String computerName;
  +        private static final String DEFAULT_COMPUTER_NAME =
  +                                                    "localhost";
  +        private static String adaptorName;
  +        private static final String DEFAULT_ADAPTOR_NAME =
  +                                                    "phoenix.manager.JMXAdaptor";
   
  -
       // monitor these for status changes
       private static boolean singleton = false;
       private static boolean shutdown = false;
  @@ -105,17 +115,31 @@
           }
           catch( final Throwable throwable )
           {
  +            System.out.println( "" );
  +            System.out.println( "" );
               System.out.println( "There was an uncaught exception:" );
               System.out.println( "---------------------------------------------------------" );
               System.out.println( throwable.toString() );
  +            //throwable.printStackTrace( System.out  );
               System.out.println( "---------------------------------------------------------" );
               System.out.println( "Please check the configuration files and restart phoenix." );
               System.out.println( "If the problem persists, contact the Avalon project.  See" );
               System.out.println( "http://jakarta.apache.org/avalon for more information." );
  +            System.out.println( "" );
  +            System.out.println( "" );
               System.exit( 1 );
           }
       }
   
  +    /**
  +     * Sets the classloader to be used for loading all phoenix and application
  +     * classes.
  +     */
  +    public void setClassLoader( ClassLoader cl )
  +    {
  +        this.cl = cl;
  +    }
  +
       /////////////////////////
       /// LIFECYCLE METHODS ///
       /////////////////////////
  @@ -132,6 +156,13 @@
       /////////////////////////
       private void execute( final String[] args ) throws Exception
       {
  +        System.out.println( " " );
  +        System.out.println( "-----------------" );
  +        System.out.print(   "Phoenix 3.2a4-dev" );
  +        System.out.println( " " );
  +        System.out.println( "-----------------" );
  +        System.out.print( "   Starting up" );
  +
           try
           {
               final PrivilegedExceptionAction action = new PrivilegedExceptionAction()
  @@ -156,6 +187,7 @@
           this.parseCommandLineOptions( args );
           this.createEmbeddor();
   
  +        System.out.print( "." );
           final Parameters parameters = new Parameters();
               parameters.setParameter( "kernel-class", this.kernelClass );
               parameters.setParameter( "deployer-class", this.deployerClass );
  @@ -163,11 +195,22 @@
               parameters.setParameter( "kernel-configuration-source", this.configurationSource );
               parameters.setParameter( "log-destination", this.logDestination );
               parameters.setParameter( "application-source", this.applicationSource );
  +            parameters.setParameter( "registry-port", new String( ""+this.registryPort ) );
  +            parameters.setParameter( "computer-name", this.computerName );
  +            parameters.setParameter( "adaptor-name", this.adaptorName );
   
           // run Embeddor lifecycle
           this.embeddor.parametize( parameters );
  +        System.out.print( "." );
           this.embeddor.init();
   
  +        this.embeddor.setRunner( (Disposable)this );
  +        System.out.print( "." );
  +
  +        System.out.print( "done." );
  +        System.out.println( "" );
  +        System.out.println( "" );
  +
           this.embeddor.start();
   
           while( !this.shutdown )
  @@ -178,7 +221,11 @@
               try { synchronized( this ) { wait(); } }
               catch( final InterruptedException e ) {}
           }
  -        embeddor.stop();
  +        System.out.print( "done." ); // shutting down, that is.
  +        this.embeddor = null;
  +        System.out.println( "" );
  +        System.out.println( "Bye-bye!" );
  +        System.out.println( "" );
           System.exit( 0 );
       }
       //////////////////////
  @@ -194,6 +241,14 @@
           this.configurationSource = this.DEFAULT_CONFIGURATION_SOURCE;
           this.logDestination = this.DEFAULT_LOG_DESTINATION;
           this.applicationSource = this.DEFAULT_APPLICATON_SOURCE;
  +        this.registryPort = this.DEFAULT_REGISTRY_PORT;
  +        this.adaptorName = this.DEFAULT_ADAPTOR_NAME;
  +
  +        // try to get the computer name from system property
  +        if( (this.computerName = System.getProperty( "computer.name" )) == null )
  +            this.computerName = this.DEFAULT_COMPUTER_NAME;
  +
  +
           // TODO: update code below to set the code above
   
           // setup parser and get arguments
  @@ -265,17 +320,13 @@
           System.out.println( "\tAvailable options:");
           System.out.println( CLUtil.describeOptions( commandLineOptions ) );
       }
  -    private void createEmbeddor() throws ConfigurationException
  +    private void createEmbeddor() throws Exception
       {
  -        try
  -        {
  -            Thread.currentThread().setContextClassLoader( getClass().getClassLoader() );
  -            this.embeddor = (Embeddor)Class.forName( this.embeddorClass ).newInstance();
  -        }
  -        catch( final Exception e )
  -        {
  -            throw new ConfigurationException( "Failed to create Embeddor of class " +
  -                                              this.embeddorClass, e );
  -        }
  +        //Thread.currentThread().setContextClassLoader( getClass().getClassLoader() );
  +        //this.embeddor = (Embeddor)Class.forName( this.embeddorClass ).newInstance();
  +        //this.embeddor = new PhoenixEmbeddor();
  +        Thread.currentThread().setContextClassLoader( this.cl );
  +        final Class clazz = Thread.currentThread().getContextClassLoader().loadClass( this.embeddorClass );
  +        this.embeddor = (Embeddor)clazz.newInstance();
       }
   }
  
  
  
  1.6       +59 -10    jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/PhoenixEmbeddor.java
  
  Index: PhoenixEmbeddor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/PhoenixEmbeddor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PhoenixEmbeddor.java	2001/04/17 11:31:43	1.5
  +++ PhoenixEmbeddor.java	2001/04/19 14:18:28	1.6
  @@ -30,6 +30,7 @@
   import org.apache.framework.lifecycle.StartException;
   import org.apache.framework.lifecycle.StopException;
   import org.apache.framework.lifecycle.InitializationException;
  +import org.apache.framework.lifecycle.Disposable;
   
   import org.apache.framework.CascadingException;
   
  @@ -43,7 +44,7 @@
   import org.apache.avalon.atlantis.core.Embeddor;
   import org.apache.phoenix.engine.facilities.ManagerImpl;
   
  -import org.apache.log.format.AvalonLogFormatter;
  +import org.apache.avalon.aut.log.AvalonLogFormatter;
   import org.apache.log.output.FileOutputLogTarget;
   import org.apache.log.Logger;
   import org.apache.log.LogKit;
  @@ -66,7 +67,8 @@
   public class PhoenixEmbeddor
       extends AbstractLoggable implements Embeddor
   {
  -    private Parameters         parameters;
  +    private Parameters      parameters;
  +    private Disposable      runner;
   
       private Logger          logger;
       private Deployer        deployer;
  @@ -108,6 +110,12 @@
        * kernel.</li>
        * <li><b>log-destination</b>, the file to save log
        * messages in. If omitted, no logs are written.</li>
  +     * <li><b>registry-port</b>, the port that the rmiregistry should
  +     * listen on and RMI objects should be registered on.</li>
  +     * <li><b>computer-name</b>, the network name of this
  +     * computer.</li>
  +     * <li><b>adaptor-name</b>, the name used to register the
  +     * JMX RMI adaptor with in the rmiregistry.</li>
        * <li>TODO: <b>facilities-directory</b>, the directory in
        * which the  facilities you wish to load into the kernel
        * are stored (in .far format).<br />
  @@ -133,6 +141,12 @@
       {
           this.createComponents();
       }
  +
  +    public void setRunner( Disposable runner )
  +    {
  +        this.runner = runner;
  +    }
  +
       /**
        * This is the main method of the embeddor. It sets up the core
        * components, and then deploys the <code>Facilities</code>. These
  @@ -150,8 +164,10 @@
           this.runDeployer();
   
           kernel.start();
  +
  +        logger.info("...Phoenix started.");
           // loop until <code>Shutdown</code> is created.
  -        while( this.shutdown )
  +        while( !this.shutdown )
           {
               // loop
   
  @@ -169,6 +185,7 @@
        */
       public void stop()
       {
  +        System.out.print( "   Shutting down..." );
           this.shutdown = true;
           synchronized( this ) { notifyAll(); }
       }
  @@ -200,8 +217,10 @@
       private void setupComponents() throws StartException
       {
           try { this.setupLogger(); }
  -        catch( Exception e ) {  logger.fatalError( "Unable to setup logger!", e );
  -                                throw new StartException( "Unable to setup logger!", e ); }
  +        catch( Exception e ) {  throw new StartException( "Unable to setup logger!", e ); }
  +
  +        logger.info("Starting Phoenix...");
  +
           try { this.setupDeployer(); }
           catch( Exception e ) {  logger.fatalError( "Unable to setup deployer!", e );
                                   throw new StartException( "Unable to setup deployer!",e ); }
  @@ -234,7 +253,6 @@
               LogKit.addLogTarget( logDest, logTarget );
               this.logger = LogKit.createLogger( LogKit.createCategory( "Phoenix", Priority.DEBUG ),
                                               new LogTarget[] { logTarget } );
  -            this.logger.info( "Loader started" );
           }
           catch( final Exception e )
           {
  @@ -278,7 +296,8 @@
           if( this.deployer instanceof Composer )
           {
               final DefaultComponentManager componentManager = new DefaultComponentManager();
  -            componentManager.put( "org.apache.avalon.camelot.Container", (Container)this.kernel );
  +            componentManager.addComponentInstance( "org.apache.avalon.camelot.Container", (Container)this.kernel  );
  +//            componentManager.put( "org.apache.avalon.camelot.Container", (Container)this.kernel );
               ((Composer)this.deployer).compose( componentManager );
           }
       }
  @@ -338,11 +357,18 @@
       {
           this.manager = new ManagerImpl();
           setupLogger( this.manager );
  +
           this.managerContext = new DefaultContext();
           this.managerContext.put("javax.management.MBeanServer", this.mBeanServer );
           this.managerContext.put("org.apache.framework.atlantis.core.Embeddor", this );
           this.managerContext.put("org.apache.framework.atlantis.core.Kernel", this.kernel );
           this.managerContext.put("org.apache.avalon.camelot.Deployer", this.deployer );
  +        this.managerContext.put( "java.rmi.registry.port",
  +            this.parameters.getParameter( "registry-port", null ) );
  +        this.managerContext.put( "java.rmi.registry.name",
  +            this.parameters.getParameter( "computer-name", null ) );
  +        this.managerContext.put( "org.apache.jmx.adaptor.name",
  +            this.parameters.getParameter( "adaptor-name", null ) );
           try
           {
               this.manager.contextualize( this.managerContext );
  @@ -393,6 +419,14 @@
               catch( Exception e ) { throw new StartException(
                           "Unable to configuration kernel from "+kernelConfigLocation, e ); }
           }
  +        if( this.kernel instanceof Contextualizable )
  +        {
  +            // TODO: until we make the Deployer load the facilities into the kernel,
  +            // create them here and put them in the kernel's Context.
  +            this.createKernelContext();
  +            final Contextualizable contextualizable = (Contextualizable)this.kernel;
  +            contextualizable.contextualize( this.kernelContext );
  +        }
   
           try
           {
  @@ -403,7 +437,13 @@
               throw new StartException( "There was a fatal error; phoenix could not be started", e );
           }
       }
  +    private void createKernelContext()
  +    {
  +        this.kernelContext = new DefaultContext();
   
  +        kernelContext.put( "facilities.manager", this.manager );
  +    }
  +
       /**
        * Stop()s and disposes() the Kernel and Manager, dereferences
        * the other components and calls garbage-collect.
  @@ -412,9 +452,15 @@
       {
           try
           {
  -            kernel.stop();
  -            kernel.dispose();
  -            manager.stop();
  +            if( kernel != null )
  +            {
  +                kernel.stop();
  +                kernel.dispose();
  +            }
  +            System.out.print(".");
  +            if( manager != null )
  +                manager.stop();
  +            System.out.print(".");
   
               kernel = null;
               manager = null;
  @@ -426,6 +472,9 @@
               this.logger.error( "There was an error while attempting to shut down phoenix", e );
           }
           logger = null;
  +        System.out.print(".");
  +        this.runner.dispose();
  +        this.runner = null;
           System.gc(); // make sure resources are released
       }
   }
  
  
  
  1.5       +44 -1     jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/PhoenixKernel.java
  
  Index: PhoenixKernel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/PhoenixKernel.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PhoenixKernel.java	2001/04/17 11:31:44	1.4
  +++ PhoenixKernel.java	2001/04/19 14:18:29	1.5
  @@ -9,7 +9,11 @@
   
   import java.util.Iterator;
   
  +import javax.management.DynamicMBean;
  +import javax.management.ObjectName;
  +
   import org.apache.framework.context.Context;
  +import org.apache.framework.context.ContextException;
   import org.apache.framework.configuration.Configuration;
   import org.apache.framework.lifecycle.Interruptable;
   
  @@ -19,9 +23,12 @@
   
   import org.apache.avalon.atlantis.applications.Application;
   import org.apache.avalon.atlantis.core.ServerKernel;
  +import org.apache.avalon.atlantis.facilities.Manager;
   
   import org.apache.log.Logger;
   
  +import org.apache.jmx.introspector.DynamicMBeanFactory;
  +
   /**
    * This is the default Kernel for Phoenix. It uses Camelot for container/
    * deployer stuff.
  @@ -33,6 +40,9 @@
       // Stoppable, Disposable, Container, Component, Loggable, Kernel,
       // Contextualizable and ServerApplication
   {
  +    private Logger logger = null;
  +    private Manager manager = null;
  +
       public PhoenixKernel()
       {
       }
  @@ -41,9 +51,21 @@
       /////////////////////////
       public void setLogger( Logger logger )
       {
  +        this.logger = logger;
       }
  -    public void contextualize( Context context )
  +    /**
  +     * TODO: this is temporary until facilities are supplied through the container
  +     * methods.
  +     *
  +     * The supplied Context should contain:
  +     * <ul>
  +     * <li><b>facilities.manager</b>, a reference to a Manager Facility</li>
  +     * </ul>
  +     */
  +    public void contextualize( Context context ) throws ContextException
       {
  +        try { this.manager = (Manager)context.get( "facilities.manager" ); }
  +        catch( Exception e ) { throw new ContextException( "Invalid context - no Manager Facility supplied!" ); }
       }
       public void configure( Configuration configuration )
       {
  @@ -78,9 +100,30 @@
       }
       public void add( String name, Entry entry ) throws ContainerException
       {
  +
  +        // JMX REGISTRATION OF APPLICATION
  +        try
  +        {
  +        DynamicMBean mBean = DynamicMBeanFactory.create( entry.getInstance() );
  +        this.manager.getMBeanServer().registerMBean( mBean, new ObjectName( name ) );
  +        }
  +        catch( Exception e )
  +        {
  +            this.logger.error( "There was an error adding "+name+" to the JMX Manager", e );
  +        }
  +
       }
       public void remove( String name ) throws ContainerException
       {
  +        // JMX DEREGISTRATION OF APPLICATION
  +        try
  +        {
  +        this.manager.getMBeanServer().unregisterMBean( new ObjectName( name ) );
  +        }
  +        catch( Exception e )
  +        {
  +            this.logger.error( "There was an error removing "+name+" from the JMX Manager", e );
  +        }
       }
       public Entry getEntry( String name ) throws ContainerException
       {
  
  
  
  1.4       +58 -2     jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/facilities/ManagerImpl.java
  
  Index: ManagerImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/facilities/ManagerImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ManagerImpl.java	2001/04/17 11:32:05	1.3
  +++ ManagerImpl.java	2001/04/19 14:18:33	1.4
  @@ -7,6 +7,10 @@
    */
   package org.apache.phoenix.engine.facilities;
   
  +import java.rmi.registry.LocateRegistry;
  +import java.rmi.registry.Registry;
  +import java.rmi.Naming;
  +
   import javax.management.MBeanServer;
   import javax.management.ObjectName;
   
  @@ -24,6 +28,8 @@
   import org.apache.log.Logger;
   
   import org.apache.jmx.introspector.DynamicMBeanFactory;
  +import org.apache.jmx.adaptor.RMIAdaptor;
  +import org.apache.jmx.adaptor.RMIAdaptorImpl;
   
   /**
    *
  @@ -36,6 +42,12 @@
       private Embeddor embeddor;
       private Deployer deployer;
       private Kernel kernel;
  +    private RMIAdaptor adaptor;
  +        private Registry rmiRegistry;
  +        private int registryPort;
  +        private String computerName;
  +        private String adaptorName;
  +        private String registryString;
   
       public ManagerImpl()
       {
  @@ -66,6 +78,20 @@
           catch( Exception e ) {
               logger.error( "Invalid context - no Deployer supplied", e );
               throw new ContextException( "Invalid context - no Deployer supplied", e ); }
  +
  +        try { this.registryPort = (new Integer((String)context.get( "java.rmi.registry.port" ))).intValue(); }
  +        catch( Exception e ) {
  +            logger.error( "Invalid context - no port for RMI Registry supplied", e );
  +            throw new ContextException( "Invalid context - no port for RMI Registry supplied", e ); }
  +        try { this.computerName = (String)context.get( "java.rmi.registry.name" ); }
  +        catch( Exception e ) {
  +            logger.error( "Invalid context - no computer name for RMI Adaptor supplied", e );
  +            throw new ContextException( "Invalid context - no computer name for RMI Adaptor supplied", e ); }
  +        try { this.adaptorName = (String)context.get( "org.apache.jmx.adaptor.name" ); }
  +        catch( Exception e ) {
  +            logger.error( "Invalid context - no name for RMI Adaptor supplied", e );
  +            throw new ContextException( "Invalid context - no name for RMI Adaptor supplied", e ); }
  +        this.registryString = "//"+computerName+":"+registryPort+"/"+adaptorName;
       }
       public void start() throws StartException
       {
  @@ -97,18 +123,48 @@
                   new ObjectName( "Logger" ) );
           }
           catch( Exception e ) { logger.error( "Unable to register MBean for Logger", e ); }
  +
  +        // create a RMI adaptor for the MBeanServer and expose it
  +        try
  +        {
  +            this.adaptor = new RMIAdaptorImpl( this.mBeanServer );
  +
  +            // TODO: improve this!
  +            this.rmiRegistry = LocateRegistry.createRegistry( registryPort );
  +            Naming.bind(this.registryString, this.adaptor);
  +        }
  +        catch( Exception e ) { logger.error( "Unable to bind JMX RMI Adaptor", e ); }
       }
       public void stop() throws StopException
       {
  -        try {
  +        try
  +        {
               mBeanServer.unregisterMBean( new ObjectName( "Embeddor" ) );
               mBeanServer.unregisterMBean( new ObjectName( "Kernel" ) );
               mBeanServer.unregisterMBean( new ObjectName( "Deployer" ) );
               mBeanServer.unregisterMBean( new ObjectName( "Logger" ) );
           }
           catch( Exception e )
  +        {
  +            if( logger != null )
  +                logger.error( "error unregistering MBeans", e );
  +        }
  +        try
  +        {
  +            Naming.unbind(this.registryString);
  +        }
  +        catch( Exception e )
           {
  -            logger.error( "error unregistering MBeans", e );
  +            if( logger != null )
  +                logger.error( "Unable to unbind JMX RMI Adaptor", e );
           }
  +    }
  +
  +    ///////////////////////
  +    /// MANAGER METHODS ///
  +    ///////////////////////
  +    public MBeanServer getMBeanServer()
  +    {
  +        return this.mBeanServer;
       }
   }
  
  
  
  1.1                  jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/loader/PhoenixLoader.java
  
  Index: PhoenixLoader.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 file.
   */
  package org.apache.phoenix.engine.loader;
  
  import java.io.File;
  import java.io.FilenameFilter;
  import java.lang.reflect.Method;
  import java.net.URL;
  import java.net.URLClassLoader;
  import java.security.AccessControlContext;
  import java.security.AccessController;
  import java.security.CodeSource;
  import java.security.PermissionCollection;
  import java.security.Permissions;
  import java.security.Policy;
  import java.security.PrivilegedActionException;
  import java.security.PrivilegedExceptionAction;
  import java.security.ProtectionDomain;
  import java.security.Security;
  import java.util.ArrayList;
  import java.util.Enumeration;
  import java.util.StringTokenizer;
  
  /**
   * PhoenixLoader is the class that bootstraps and installs the security manager.
   * It also a default policy that gives all code all permssions.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public final class PhoenixLoader
  {
      protected final static boolean         ENABLE_SECURITY_MANAGER =
          !Boolean.getBoolean("phoenix.insecure");
  
      protected final static String          RESTRICTED_PACKAGES =
          System.getProperty( "phoenix.restricted.packages",
                              Security.getProperty("package.access") );
  
      protected final static String          MAIN_JAR =
          System.getProperty( "phoenix.mainJar", "phoenix-engine.jar" );
  
      protected final static String          LIB_DIR =
          System.getProperty( "phoenix.libDir", "../lib" );
  
      protected final static String          MAIN_CLASS =
          System.getProperty( "phoenix.mainClass", "org.apache.phoenix.Start" );
  
      public final static void main( final String args[] )
          throws Exception
      {
          //setup restricted packages
          Security.setProperty( "phoenix.access", RESTRICTED_PACKAGES );
  
          //setup new Policy manager
          Policy.setPolicy( new FreeNEasyPolicy() );
  
          final File loaderDir = findLoaderDir();
          final String avalonHome =
              loaderDir.getAbsoluteFile().getParentFile() + File.separator;
          System.setProperty( "phoenix.home", avalonHome );
  
          final ArrayList urls = new ArrayList();
  
          // add main jar
          final File mainJar = new File( loaderDir, MAIN_JAR );
          final URL mainJarURL = mainJar.toURL();
          urls.add( mainJarURL );
  
          // add library jars
          final File libDir = new File( LIB_DIR );
          final File[] libFiles = libDir.listFiles();
          for( int i = 0; i < libFiles.length; i++ )
          {
              if( libFiles[i].getName().endsWith( ".jar" ) )
              {
                  final URL libFile = libFiles[i].toURL();
                  urls.add( libFile );
              }
          }
          final URL[] urlArr = new URL[0];
          final URL[] jars = (URL[])urls.toArray( urlArr );
  
          final URLClassLoader classLoader = new URLClassLoader( jars );
  
  
          runSystem( classLoader, args );
      }
  
      /**
       * load class and retrieve appropriate main method.
       */
      protected static void runSystem( final ClassLoader classLoader, final String[] args )
      {
          try
          {
              final Class clazz = classLoader.loadClass( MAIN_CLASS );
              final Method method = clazz.getMethod( "main", new Class[] { args.getClass() } );
              final Method setCl = clazz.getMethod( "setClassLoader", new Class[] { ClassLoader.class } );
  
              final Object instance = clazz.newInstance();
  
              // Set security manager unless it has been disabled by system property
              if( ENABLE_SECURITY_MANAGER )
              {
                  //System.setSecurityManager( new SecurityManager() );
              }
  
              //kick the tires and light the fires....
              try
              {
                  final PrivilegedExceptionAction action = new PrivilegedExceptionAction()
                  {
                      public Object run() throws Exception
                      {
                          setCl.invoke( instance, new Object[] { classLoader }  );
                          method.invoke( instance, new Object[] { args } );
                          return null;
                      }
                  };
  
                  AccessController.doPrivileged( action );
              }
              catch( final PrivilegedActionException pae )
              {
                  // only "checked" exceptions will be "wrapped" in a PrivilegedActionException.
                  throw pae.getException();
              }
          }
          catch( final Exception throwable )
          {
              throwable.printStackTrace( System.err );
          }
      }
  
      /**
       *  Finds the avalon-loader.jar file in the classpath.
       */
      protected final static File findLoaderDir()
          throws Exception
      {
          final String classpath = System.getProperty( "java.class.path" );
          final String pathSeparator = System.getProperty( "path.separator" );
          final StringTokenizer tokenizer = new StringTokenizer( classpath, pathSeparator );
  
          while( tokenizer.hasMoreTokens() )
          {
              final String element = tokenizer.nextToken();
  
              if( element.endsWith( "phoenix-loader.jar" ) )
              {
                  File file = (new File( element )).getCanonicalFile();
                  file = file.getParentFile();
                  return file;
              }
          }
  
          throw new Exception( "Unable to locate avalon-loader.jar in classpath" );
      }
  
      /**
       * Default polic class to give every code base all permssions.
       * Will be replaced once the kernel loads.
       */
      private static class FreeNEasyPolicy
          extends Policy
      {
          public PermissionCollection getPermissions( final CodeSource codeSource )
          {
              final Permissions permissions = new Permissions();
              permissions.add( new java.security.AllPermission() );
              return permissions;
          }
  
          public void refresh() {}
      }
  }
  
  
  
  1.1                  jakarta-avalon-phoenix/proposal/4.0/src/manifest/client-Manifest.mf
  
  Index: client-Manifest.mf
  ===================================================================
  Manifest-Version: 1.0
  Created-By: Jakarta-Apache Avalon/Phoenix Project
  
  
  
  
  1.1                  jakarta-avalon-phoenix/proposal/4.0/src/manifest/engine-Manifest.mf
  
  Index: engine-Manifest.mf
  ===================================================================
  Manifest-Version: 1.0
  Created-By: Jakarta-Apache Avalon/Phoenix Project
  
  
  
  
  1.1                  jakarta-avalon-phoenix/proposal/4.0/src/manifest/loader-Manifest.mf
  
  Index: loader-Manifest.mf
  ===================================================================
  Manifest-Version: 1.0
  Main-Class: org.apache.phoenix.engine.loader.PhoenixLoader
  Created-By: Jakarta-Apache Avalon/Phoenix Project
  
  
  
  
  1.1                  jakarta-avalon-phoenix/proposal/4.0/src/manifest/shutdown-Manifest.mf
  
  Index: shutdown-Manifest.mf
  ===================================================================
  Manifest-Version: 1.0
  Main-Class: org.apache.phoenix.Shutdown
  Created-By: Jakarta-Apache Avalon/Phoenix Project
  
  
  
  
  1.1                  jakarta-avalon-phoenix/proposal/4.0/src/script/run.bat
  
  Index: run.bat
  ===================================================================
  @echo off
  rem
  rem Phoenix start script.
  rem
  rem Author: Peter Donald [donaldp@apache.org]
  rem
  rem The user may choose to supply parameters to the JVM (such as memory settings)
  rem via setting the environment variable PHOENIX_JVM_OPTS
  rem
  
  rem
  rem Determine if JAVA_HOME is set and if so then use it
  rem
  if not "%JAVA_HOME%"=="" goto found_java
  
  set PHOENIX_JAVACMD=java
  goto file_locate
  
  :found_java
  set PHOENIX_JAVACMD=%JAVA_HOME%\bin\java
  
  :file_locate
  
  rem
  rem Locate where phoenix is in filesystem
  rem
  if not "%OS%"=="Windows_NT" goto start
  
  rem %~dp0 is name of current script under NT
  set PHOENIX_HOME=%~dp0
  
  rem : operator works similar to make : operator
  set PHOENIX_HOME=%PHOENIX_HOME:\bin\=%
  
  :start
  
  if not "%PHOENIX_HOME%" == "" goto phoenix_home
  
  echo.
  echo Warning: PHOENIX_HOME environment variable is not set.
  echo   This needs to be set for Win9x as it's command prompt 
  echo   scripting bites
  echo.
  goto end
  
  :phoenix_home
  
  rem echo "Home directory: %PHOENIX_HOME%"
  rem echo "Home ext directory: %PHOENIX_HOME%\lib"
  
  rem
  rem This is needed as some JVM vendors do foolish things
  rem like placing jaxp/jaas/xml-parser jars in ext dir
  rem thus breaking Phoenix
  rem
  
  rem Kicking the tires and lighting the fires!!!
  %PHOENIX_JAVACMD% -Djava.ext.dirs=%PHOENIX_HOME%\lib %PHOENIX_JVM_OPTS% -jar %PHOENIX_HOME%\bin\phoenix-loader.jar %1 %2 %3 %4 %5 %6 %7 %8 %9
  
  :end
  
  
  1.1                  jakarta-avalon-phoenix/proposal/4.0/src/script/run.sh
  
  Index: run.sh
  ===================================================================
  #! /bin/sh
  #
  # Phoenix start script.
  #
  # Author: Peter Donald <donaldp@apache.org>
  #
  # The user may choose to supply parameters to the JVM (such as memory settings)
  # via setting the environment variable PHOENIX_JVM_OPTS
  #
  
  # Checking for JAVA_HOME is required on *nix due
  # to some distributions stupidly including kaffe in /usr/bin
  if [ "$JAVA_HOME" = "" ] ; then
    echo "ERROR: JAVA_HOME not found in your environment."
    echo
    echo "Please, set the JAVA_HOME variable in your environment to match the"
    echo "location of the Java Virtual Machine you want to use."
    exit 1
  fi
  
  #
  # Locate where phoenix is in filesystem
  #
  THIS_PROG=`dirname $0`
  
  if [ "$THIS_PROG" = "." ] ; then
    THIS_PROG=$PWD
  fi
  
  PHOENIX_HOME=$THIS_PROG/..
  unset THIS_PROG
  
  # echo "Home directory: $PHOENIX_HOME"
  # echo "Home ext directory: $PHOENIX_HOME/lib"
  
  #
  # Command to overide JVM ext dir
  #
  # This is needed as some JVM vendors do foolish things
  # like placing jaxp/jaas/xml-parser jars in ext dir
  # thus breaking Phoenix
  #
  JVM_OPTS="-Djava.ext.dirs=$PHOENIX_HOME/lib $PHOENIX_JVM_OPTS"
  
  # Kicking the tires and lighting the fires!!!
  $JAVA_HOME/bin/java $JVM_OPTS -jar $PHOENIX_HOME/bin/phoenix-loader.jar $*
  
  
  
  1.1                  jakarta-avalon-phoenix/proposal/4.0/src/script/runClient.bat
  
  Index: runClient.bat
  ===================================================================
  @echo off
  rem
  rem Phoenix start script.
  rem
  rem Author: Leo Simons [mail@leosimons.com]
  
  echo THIS DOES _NOT_ WORK YET! Sorry.
  goto end
  
  rem
  rem Determine if JAVA_HOME is set and if so then use it
  rem
  if not "%JAVA_HOME%"=="" goto found_java
  
  set PHOENIX_JAVACMD=java
  goto file_locate
  
  :found_java
  set PHOENIX_JAVACMD=%JAVA_HOME%\bin\java
  
  :file_locate
  
  rem
  rem Locate where phoenix is in filesystem
  rem
  if not "%OS%"=="Windows_NT" goto start
  
  rem %~dp0 is name of current script under NT
  set PHOENIX_HOME=%~dp0
  
  rem : operator works similar to make : operator
  set PHOENIX_HOME=%PHOENIX_HOME:\bin\=%
  
  :start
  
  if not "%PHOENIX_HOME%" == "" goto phoenix_home
  
  echo.
  echo Warning: PHOENIX_HOME environment variable is not set.
  echo   This needs to be set for Win9x as it's command prompt 
  echo   scripting bites
  echo.
  goto end
  
  :phoenix_home
  
  rem echo "Home directory: %PHOENIX_HOME%"
  rem echo "Home ext directory: %PHOENIX_HOME%\lib"
  
  rem
  rem This is needed as some JVM vendors do foolish things
  rem like placing jaxp/jaas/xml-parser jars in ext dir
  rem thus breaking Phoenix
  rem
  
  rem Kicking the tires and lighting the fires!!!
  %PHOENIX_JAVACMD% -Djava.ext.dirs=%PHOENIX_HOME%\lib %PHOENIX_JVM_OPTS% -jar %PHOENIX_HOME%\bin\phoenix-loader.jar %1 %2 %3 %4 %5 %6 %7 %8 %9
  
  :end
  
  
  1.1                  jakarta-avalon-phoenix/proposal/4.0/src/script/stop.bat
  
  Index: stop.bat
  ===================================================================
  @echo off
  rem
  rem Phoenix shutdown script.
  rem
  rem Author: Leo Simons [mail@leosimons.com]
  
  echo THIS DOES _NOT_ WORK YET! Sorry.
  goto end
  
  rem
  rem Determine if JAVA_HOME is set and if so then use it
  rem
  if not "%JAVA_HOME%"=="" goto found_java
  
  set PHOENIX_JAVACMD=java
  goto file_locate
  
  :found_java
  set PHOENIX_JAVACMD=%JAVA_HOME%\bin\java
  
  :file_locate
  set PHOENIX_HOME=..\
  
  rem
  rem Locate where phoenix is in filesystem
  rem
  if not "%OS%"=="Windows_NT" goto start
  
  rem %~dp0 is name of current script under NT
  set PHOENIX_HOME=%~dp0
  
  rem : operator works similar to make : operator
  set PHOENIX_HOME=%PHOENIX_HOME:\bin\=%
  
  :start
  
  if not "%PHOENIX_HOME%" == "" goto phoenix_home
  
  echo.
  echo Warning: PHOENIX_HOME environment variable is not set.
  echo   This needs to be set for Win9x as it's command prompt 
  echo   scripting bites
  echo.
  goto end
  
  :phoenix_home
  
  rem echo "Home directory: %PHOENIX_HOME%"
  rem echo "Home ext directory: %PHOENIX_HOME%\lib"
  
  rem
  rem This is needed as some JVM vendors do foolish things
  rem like placing jaxp/jaas/xml-parser jars in ext dir
  rem thus breaking Phoenix
  rem
  
  rem figure out the machine name...
  if not "%1" == "" goto run_phoenix
  
  echo.
  echo Warning: you must supply the network name of your
  echo   computer as an argument. This is needed to be able
  echo   to talk to the RMI Registry.
  echo.
  goto end
  
  :run_phoenix
  
  rem Kicking the tires and lighting the fires!!!
  
  %PHOENIX_JAVACMD% -Djava.ext.dirs=%PHOENIX_HOME%\lib -Dcomputer.name=%1 %PHOENIX_JVM_OPTS% -cp %PHOENIX_HOME%\lib\jmx.jar -jar phoenix-shutdown.jar %2 %3 %4 %5 %6 %7 %8 %9
  
  :end
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Mime
View raw message