001    package org.apache.archiva.indexer.merger;
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 java.util.Collection;
022    
023    /**
024     * @author Olivier Lamy
025     */
026    public class IndexMergerRequest
027    {
028        /**
029         * repositories Ids to merge content
030         */
031        private Collection<String> repositoriesIds;
032    
033        /**
034         * will generate a downloadable index
035         */
036        private boolean packIndex;
037    
038        /**
039         * original groupId (repositoryGroup id)
040         */
041        private String groupId;
042    
043        private String mergedIndexPath = "/.indexer";
044    
045        private int mergedIndexTtl;
046    
047        public IndexMergerRequest( Collection<String> repositoriesIds, boolean packIndex, String groupId )
048        {
049            this.repositoriesIds = repositoriesIds;
050            this.packIndex = packIndex;
051            this.groupId = groupId;
052        }
053    
054        /**
055         * @since 1.4-M4
056         */
057        public IndexMergerRequest(Collection<String> repositoriesIds, boolean packIndex, String groupId,
058                                  String mergedIndexPath, int mergedIndexTtl)
059        {
060            this.repositoriesIds = repositoriesIds;
061            this.packIndex = packIndex;
062            this.groupId = groupId;
063            this.mergedIndexPath = mergedIndexPath;
064            this.mergedIndexTtl = mergedIndexTtl;
065        }
066    
067        public Collection<String> getRepositoriesIds()
068        {
069            return repositoriesIds;
070        }
071    
072        public void setRepositoriesIds( Collection<String> repositoriesIds )
073        {
074            this.repositoriesIds = repositoriesIds;
075        }
076    
077        public boolean isPackIndex()
078        {
079            return packIndex;
080        }
081    
082        public void setPackIndex( boolean packIndex )
083        {
084            this.packIndex = packIndex;
085        }
086    
087        public String getGroupId()
088        {
089            return groupId;
090        }
091    
092        public void setGroupId( String groupId )
093        {
094            this.groupId = groupId;
095        }
096    
097        public String getMergedIndexPath()
098        {
099            return mergedIndexPath;
100        }
101    
102        public void setMergedIndexPath( String mergedIndexPath )
103        {
104            this.mergedIndexPath = mergedIndexPath;
105        }
106    
107        public int getMergedIndexTtl() {
108            return mergedIndexTtl;
109        }
110    
111        public void setMergedIndexTtl(int mergedIndexTtl) {
112            this.mergedIndexTtl = mergedIndexTtl;
113        }
114    
115        @Override
116        public String toString()
117        {
118            final StringBuilder sb = new StringBuilder( "IndexMergerRequest{" );
119            sb.append( "repositoriesIds=" ).append( repositoriesIds );
120            sb.append( ", packIndex=" ).append( packIndex );
121            sb.append( ", groupId='" ).append( groupId ).append( '\'' );
122            sb.append( ", mergedIndexPath='" ).append( mergedIndexPath ).append( '\'' );
123            sb.append( ", mergedIndexTtl='" ).append( mergedIndexTtl ).append( '\'' );
124            sb.append( '}' );
125            return sb.toString();
126        }
127    }