This project has retired. For details please refer to its Attic page.
Source code
001package 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
021import java.io.File;
022import java.util.Collection;
023
024/**
025 * @author Olivier Lamy
026 */
027public class IndexMergerRequest
028{
029    /**
030     * repositories Ids to merge content
031     */
032    private Collection<String> repositoriesIds;
033
034    /**
035     * will generate a downloadable index
036     */
037    private boolean packIndex;
038
039    /**
040     * original groupId (repositoryGroup id)
041     */
042    private String groupId;
043
044    private String mergedIndexPath = "/.indexer";
045
046    private int mergedIndexTtl;
047
048    private File mergedIndexDirectory;
049
050    private boolean temporary;
051
052    public IndexMergerRequest( Collection<String> repositoriesIds, boolean packIndex, String groupId )
053    {
054        this.repositoriesIds = repositoriesIds;
055        this.packIndex = packIndex;
056        this.groupId = groupId;
057    }
058
059    /**
060     * @since 1.4-M4
061     */
062    public IndexMergerRequest( Collection<String> repositoriesIds, boolean packIndex, String groupId,
063                               String mergedIndexPath, int mergedIndexTtl )
064    {
065        this.repositoriesIds = repositoriesIds;
066        this.packIndex = packIndex;
067        this.groupId = groupId;
068        this.mergedIndexPath = mergedIndexPath;
069        this.mergedIndexTtl = mergedIndexTtl;
070    }
071
072    public Collection<String> getRepositoriesIds()
073    {
074        return repositoriesIds;
075    }
076
077    public void setRepositoriesIds( Collection<String> repositoriesIds )
078    {
079        this.repositoriesIds = repositoriesIds;
080    }
081
082    public boolean isPackIndex()
083    {
084        return packIndex;
085    }
086
087    public void setPackIndex( boolean packIndex )
088    {
089        this.packIndex = packIndex;
090    }
091
092    public String getGroupId()
093    {
094        return groupId;
095    }
096
097    public void setGroupId( String groupId )
098    {
099        this.groupId = groupId;
100    }
101
102    public String getMergedIndexPath()
103    {
104        return mergedIndexPath;
105    }
106
107    public void setMergedIndexPath( String mergedIndexPath )
108    {
109        this.mergedIndexPath = mergedIndexPath;
110    }
111
112    public int getMergedIndexTtl()
113    {
114        return mergedIndexTtl;
115    }
116
117    public void setMergedIndexTtl( int mergedIndexTtl )
118    {
119        this.mergedIndexTtl = mergedIndexTtl;
120    }
121
122    public File getMergedIndexDirectory()
123    {
124        return mergedIndexDirectory;
125    }
126
127    public void setMergedIndexDirectory( File mergedIndexDirectory )
128    {
129        this.mergedIndexDirectory = mergedIndexDirectory;
130    }
131
132    public IndexMergerRequest mergedIndexDirectory( File mergedIndexDirectory )
133    {
134        this.mergedIndexDirectory = mergedIndexDirectory;
135        return this;
136    }
137
138    public boolean isTemporary()
139    {
140        return temporary;
141    }
142
143    public void setTemporary( boolean temporary )
144    {
145        this.temporary = temporary;
146    }
147
148
149    public IndexMergerRequest temporary( boolean temporary )
150    {
151        this.temporary = temporary;
152        return this;
153    }
154
155    @Override
156    public String toString()
157    {
158        final StringBuilder sb = new StringBuilder( "IndexMergerRequest{" );
159        sb.append( "repositoriesIds=" ).append( repositoriesIds );
160        sb.append( ", packIndex=" ).append( packIndex );
161        sb.append( ", groupId='" ).append( groupId ).append( '\'' );
162        sb.append( ", mergedIndexPath='" ).append( mergedIndexPath ).append( '\'' );
163        sb.append( ", mergedIndexTtl=" ).append( mergedIndexTtl );
164        sb.append( ", mergedIndexDirectory=" ).append( mergedIndexDirectory );
165        sb.append( ", temporary=" ).append( temporary );
166        sb.append( '}' );
167        return sb.toString();
168    }
169
170    @Override
171    public boolean equals( Object o )
172    {
173        if ( this == o )
174        {
175            return true;
176        }
177        if ( o == null || getClass() != o.getClass() )
178        {
179            return false;
180        }
181
182        IndexMergerRequest that = (IndexMergerRequest) o;
183
184        return groupId.equals( that.groupId );
185    }
186
187    @Override
188    public int hashCode()
189    {
190        return groupId.hashCode();
191    }
192}