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