You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by do...@apache.org on 2002/02/01 13:45:46 UTC

cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/interfaces KernelMBean.java

donaldp     02/02/01 04:45:46

  Modified:    src/java/org/apache/avalon/phoenix/components/kernel
                        DefaultKernel.java Resources.properties
  Added:       src/java/org/apache/avalon/phoenix/interfaces
                        KernelMBean.java
  Log:
  Made Kernel implement a kernel Management interface.
  
  Also made sure that if you tred to remove an application that was not loaded that it would fail.
  
  Revision  Changes    Path
  1.50      +12 -6     jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/kernel/DefaultKernel.java
  
  Index: DefaultKernel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/kernel/DefaultKernel.java,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- DefaultKernel.java	26 Jan 2002 08:22:43 -0000	1.49
  +++ DefaultKernel.java	1 Feb 2002 12:45:46 -0000	1.50
  @@ -22,6 +22,7 @@
   import org.apache.avalon.phoenix.interfaces.ApplicationContext;
   import org.apache.avalon.phoenix.interfaces.ConfigurationRepository;
   import org.apache.avalon.phoenix.interfaces.Kernel;
  +import org.apache.avalon.phoenix.interfaces.KernelMBean;
   import org.apache.avalon.phoenix.interfaces.SystemManager;
   import org.apache.avalon.phoenix.metadata.SarMetaData;
   import org.apache.log.Hierarchy;
  @@ -40,7 +41,7 @@
    */
   public class DefaultKernel
       extends AbstractLogEnabled
  -    implements Kernel, Composable
  +    implements Kernel, KernelMBean, Composable
   {
       private static final Resources REZ =
           ResourceManager.getPackageResources( DefaultKernel.class );
  @@ -206,14 +207,19 @@
           return componentManager;
       }
   
  -    public void removeApplication( String name ) throws Exception
  +    public void removeApplication( String name ) 
  +        throws Exception
       {
  -        final SarEntry entry = (SarEntry)m_entrys.get( name );
  -        if( null != entry )
  +        final SarEntry entry = (SarEntry)m_entrys.remove( name );
  +        if( null == entry ) 
  +        {
  +            final String message =
  +                REZ.getString( "kernel.error.entry.initialize", name );
  +            throw new Exception( message );
  +        }
  +        else
           {
               shutdown( entry );
  -            m_entrys.remove( name );
           }
       }
  -
   }
  
  
  
  1.4       +1 -0      jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/kernel/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/kernel/Resources.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Resources.properties	9 Nov 2001 21:14:30 -0000	1.3
  +++ Resources.properties	1 Feb 2002 12:45:46 -0000	1.4
  @@ -3,6 +3,7 @@
   kernel.error.entry.initialize=Failed to initialize application {0}.
   kernel.error.entry.nostop=Failed to stop application {0} as it is not initialized/started.
   
  +kernel.error.entry.nofind=Unable to locate Application by the name "{0}".
   kernel.error.entry.prepare=Error preparing application {0}.
   kernel.error.entry.badtype=Entry {0} has bad type. Only Entrys of type ServerApplicationEntry may be added to kernel.
   
  
  
  
  1.1                  jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/interfaces/KernelMBean.java
  
  Index: KernelMBean.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.avalon.phoenix.interfaces;
  
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.component.Component;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.phoenix.metadata.SarMetaData;
  import org.apache.log.Hierarchy;
  
  /**
   * This is the interface via which you can manager 
   * the root container of Applications.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   */
  public interface KernelMBean
  {
      String ROLE = "org.apache.avalon.phoenix.interfaces.KernelMBean";
  
      String[] getApplicationNames();
  
      void removeApplication( String name )
          throws Exception;
  }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>