Return-Path: Delivered-To: apmail-avalon-cvs-archive@www.apache.org Received: (qmail 23250 invoked from network); 4 Mar 2004 03:27:46 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 4 Mar 2004 03:27:46 -0000 Received: (qmail 83568 invoked by uid 500); 4 Mar 2004 03:27:27 -0000 Delivered-To: apmail-avalon-cvs-archive@avalon.apache.org Received: (qmail 83520 invoked by uid 500); 4 Mar 2004 03:27:27 -0000 Mailing-List: contact cvs-help@avalon.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon CVS List" Reply-To: "Avalon Developers List" Delivered-To: mailing list cvs@avalon.apache.org Received: (qmail 83506 invoked from network); 4 Mar 2004 03:27:26 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 4 Mar 2004 03:27:26 -0000 Received: (qmail 23152 invoked by uid 1438); 4 Mar 2004 03:27:44 -0000 Date: 4 Mar 2004 03:27:44 -0000 Message-ID: <20040304032744.23151.qmail@minotaur.apache.org> From: mcconnell@apache.org To: avalon-cvs@apache.org Subject: cvs commit: avalon/repository/impl/src/java/org/apache/avalon/repository/impl ArtifactSequenceParameter.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N mcconnell 2004/03/03 19:27:44 Added: repository/impl/src/java/org/apache/avalon/repository/impl ArtifactSequenceParameter.java Log: Add support for the addition of factory artifacts in the repository criteria. Revision Changes Path 1.1 avalon/repository/impl/src/java/org/apache/avalon/repository/impl/ArtifactSequenceParameter.java Index: ArtifactSequenceParameter.java =================================================================== /* * Copyright 2004 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. */ package org.apache.avalon.repository.impl; import java.util.ArrayList; import java.util.StringTokenizer; import org.apache.avalon.repository.Artifact; import org.apache.avalon.util.criteria.Parameter; import org.apache.avalon.util.criteria.CriteriaException; /** * A parameter descriptor that supports transformation of a * a string to a string array based on a supplied token. * * @author Avalon Development Team * @version $Revision: 1.1 $ */ public class ArtifactSequenceParameter extends Parameter { //-------------------------------------------------------------- // immutable state //-------------------------------------------------------------- private final String m_delimiter; //-------------------------------------------------------------- // constructors //-------------------------------------------------------------- /** * Transform a string to a string array. * @param key the parameter key * @param delimiter the delimiter character * @param defaults the default string array */ public ArtifactSequenceParameter( final String key, final String delimiter, Artifact[] defaults ) { super( key, Artifact[].class, defaults ); m_delimiter = delimiter; } /** * Resolve a supplied string or string array to a artifact array value. * @param value the value to resolve * @exception CriteriaException if an error occurs */ public Object resolve( Object value ) throws CriteriaException { if( value == null ) return null; if( value instanceof Artifact[] ) { return value; } if( value instanceof String[] ) { String[] specs = (String[]) value; Artifact[] artifacts = new Artifact[ specs.length ]; for( int i=0; i