// Copyright 2003-2004 The Apache Software Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. namespace Apache.Avalon.Composition.Data { using System; /// Description of classpath. /// /// /// Avalon Development Team /// /// $Revision: 1.2 $ $Date: 2004/02/28 22:15:36 $ /// [Serializable] public sealed class ClasspathDirective { private static readonly FilesetDirective[] EMPTY_FILESETS; private static readonly RepositoryDirective[] EMPTY_REPOSITORIES; /// The fileset directives private FilesetDirective[] m_filesets; /// The resource references private RepositoryDirective[] m_repositories; /// Create a empty ClasspathDirective. public ClasspathDirective():this(null, null) { } /// Create a ClasspathDirective instance. /// /// /// the filesets to be included in a classloader /// /// the repositories directives to be included in a classloader /// public ClasspathDirective(FilesetDirective[] filesets, RepositoryDirective[] repositories) { if (filesets == null) { m_filesets = EMPTY_FILESETS; } else { m_filesets = filesets; } if (repositories == null) { m_repositories = EMPTY_REPOSITORIES; } else { m_repositories = repositories; } } /// Return the default status of this directive. If TRUE /// the enclosed repository and fileset directives are empty. /// public bool Empty { get { int n = m_repositories.Length + m_filesets.Length; return n == 0; } } /// Return the set of resource directives. /// /// /// the resource directive set /// public RepositoryDirective[] RepositoryDirectives { get { return m_repositories; } } /// Return the set of fileset directives. /// /// /// the fileset directives /// public FilesetDirective[] Filesets { get { return m_filesets; } /// Return an array of files corresponding to the expansion /// of the filesets declared within the directive. /// /// /// the base directory against which relative /// file references will be resolved /// /// the classpath /// /* public File[] expandFileSetDirectives( File base ) throws IOException { ArrayList list = new ArrayList(); // // expand relative to fileset // FilesetDirective[] filesets = getFilesets(); for( int i=0; i 0 ) { for( int j=0; j