001    package org.apache.archiva.admin.model;
002    /*
003     * Licensed to the Apache Software Foundation (ASF) under one
004     * or more contributor license agreements.  See the NOTICE file
005     * distributed with this work for additional information
006     * regarding copyright ownership.  The ASF licenses this file
007     * to you under the Apache License, Version 2.0 (the
008     * "License"); you may not use this file except in compliance
009     * with the License.  You may obtain a copy of the License at
010     *
011     *   http://www.apache.org/licenses/LICENSE-2.0
012     *
013     * Unless required by applicable law or agreed to in writing,
014     * software distributed under the License is distributed on an
015     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016     * KIND, either express or implied.  See the License for the
017     * specific language governing permissions and limitations
018     * under the License.
019     */
020    
021    import org.apache.archiva.admin.model.beans.AbstractRepository;
022    import org.apache.archiva.admin.model.beans.ManagedRepository;
023    
024    /**
025     * apply basic repository validation : id and name.
026     * Check if already exists.
027     *
028     * @author Olivier Lamy
029     * @since 1.4-M3
030     */
031    public interface RepositoryCommonValidator
032    {
033    
034        String REPOSITORY_ID_VALID_EXPRESSION = "^[a-zA-Z0-9._-]+$";
035    
036        String REPOSITORY_NAME_VALID_EXPRESSION = "^([a-zA-Z0-9.)/_(-]|\\s)+$";
037    
038    
039        void basicValidation( AbstractRepository abstractRepository, boolean update )
040            throws RepositoryAdminException;
041    
042        /**
043         * validate cronExpression and location format
044         *
045         * @param managedRepository
046         * @since 1.4-M2
047         */
048        void validateManagedRepository( ManagedRepository managedRepository )
049            throws RepositoryAdminException;
050    
051        /**
052         * replace some interpolations ${appserver.base} with correct values
053         *
054         * @param directory
055         * @return
056         */
057        String removeExpressions( String directory );
058    
059    }