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/09/01 02:51:37 UTC

cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/cpbuilder/metadata ClassLoaderDef.java ClassloaderSetDef.java ClassloaderDef.java

donaldp     2002/08/31 17:51:37

  Added:       src/java/org/apache/avalon/phoenix/components/cpbuilder/metadata
                        ClassLoaderDef.java ClassloaderSetDef.java
  Removed:     src/java/org/apache/avalon/phoenix/components/cpbuilder/metadata
                        ClassloaderDef.java
  Log:
  Define the set of classloaders
  
  Revision  Changes    Path
  1.1                  jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/cpbuilder/metadata/ClassLoaderDef.java
  
  Index: ClassLoaderDef.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.phoenix.components.cpbuilder.metadata;
  
  import org.apache.avalon.excalibur.extension.Extension;
  
  /**
   * This class defines a specific classloader, made up of
   * {@link EntryDef}, {@link Extension} and
   * {@link FilesetDef} objects.
   *
   * @author <a href="mailto:peter at apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/09/01 00:51:37 $
   */
  public class ClassLoaderDef
  {
      /**
       * The name of the current classloader.
       * This may be used by other ClassLoader definitions to refer
       * to this ClassLoader.
       */
      private final String m_name;
  
      /**
       * The name of the parent classloader.
       */
      private final String m_parent;
  
      /**
       * The Entrys that are added to this ClassLoader.
       */
      private final EntryDef[] m_entrys;
  
      /**
       * The Entrys that are required by this ClassLoader.
       */
      private final Extension[] m_extensions;
  
      /**
       * The Filesets that are added to this ClassLoader.
       */
      private final FilesetDef[] m_filesets;
  
      public ClassLoaderDef( final String name,
                                  final String parent,
                                  final EntryDef[] elements,
                                  final Extension[] extensions,
                                  final FilesetDef[] filesets )
      {
          m_name = name;
          m_parent = parent;
          m_entrys = elements;
          m_extensions = extensions;
          m_filesets = filesets;
      }
  
      /**
       * Return the name of Classloader.
       *
       * @return the name of Classloader.
       * @see #m_name
       */
      public String getName()
      {
          return m_name;
      }
  
      /**
       * Return the name of parent Classloader.
       *
       * @return the name of parent Classloader.
       * @see #m_parent
       */
      public String getParent()
      {
          return m_parent;
      }
  
      /**
       * Return the elements added to Classloader.
       *
       * @return the elements added to Classloader.
       * @see #m_entrys
       */
      public EntryDef[] getEntrys()
      {
          return m_entrys;
      }
  
      /**
       * Return the extensions added to Classloader.
       *
       * @return the extensions added to Classloader.
       * @see #m_extensions
       */
      public Extension[] getExtensions()
      {
          return m_extensions;
      }
  
      /**
       * Return the filesets added to Classloader.
       *
       * @return the filesets added to Classloader.
       * @see #m_filesets
       */
      public FilesetDef[] getFilesets()
      {
          return m_filesets;
      }
  }
  
  
  
  1.1                  jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/cpbuilder/metadata/ClassloaderSetDef.java
  
  Index: ClassloaderSetDef.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.phoenix.components.cpbuilder.metadata;
  
  /**
   * This class defines a set of ClassLoaders and
   * the default ClassLoader to use.
   *
   * @author <a href="mailto:peter at apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/09/01 00:51:37 $
   */
  public class ClassloaderSetDef
  {
      /**
       * The name of the current classloader.
       * This may be used by other ClassLoader definitions to refer
       * to this ClassLoader.
       */
      private final String m_default;
  
      /**
       * The classloaders defined in set.
       */
      private final ClassLoaderDef[] m_classLoaders;
  
      /**
       * Construct set with specified set and ClassLoaders.
       *
       * @param aDefault the name of default ClassLoader
       * @param classLoaders the ClassLoaders in set
       */
      public ClassloaderSetDef( final String aDefault,
                                final ClassLoaderDef[] classLoaders )
      {
          if( null == aDefault )
          {
              throw new NullPointerException( "aDefault" );
          }
          if( null == classLoaders )
          {
              throw new NullPointerException( "classLoaders" );
          }
  
          m_default = aDefault;
          m_classLoaders = classLoaders;
      }
  
      /**
       * Return the default ClassLoader name.
       *
       * @return the default ClassLoader name.
       * @see #m_default
       */
      public String getDefault()
      {
          return m_default;
      }
  
      /**
       * Return the classloaders in set.
       *
       * @return the classloaders in set.
       * @see #m_classLoaders
       */
      public ClassLoaderDef[] getClassLoaders()
      {
          return m_classLoaders;
      }
  
      /**
       * Return the classloader with specified name.
       *
       * @return the classloader with specified name
       */
      public ClassLoaderDef getClassLoader( final String name )
      {
          for( int i = 0; i < m_classLoaders.length; i++ )
          {
              final ClassLoaderDef classLoader = m_classLoaders[ i ];
              if( classLoader.getName().equals( name ) )
              {
                  return classLoader;
              }
          }
          return null;
      }
  }
  
  
  

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