This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.admin.model.beans;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import javax.xml.bind.annotation.XmlRootElement;
023import java.io.Serializable;
024import java.util.Locale;
025
026/**
027 * @author Olivier Lamy
028 * @since 1.4-M1
029 */
030@XmlRootElement (name = "managedRepository")
031public class ManagedRepository
032    extends AbstractRepository
033    implements Serializable
034{
035
036    private String location;
037
038    private boolean snapshots = false;
039
040    private boolean releases = true;
041
042    private boolean blockRedeployments = false;
043
044    /**
045     * default model value hourly
046     */
047    private String cronExpression = "0 0 * * * ?";
048
049
050    /**
051     * not need when creating the repo : only available when reading
052     */
053    private ManagedRepository stagingRepository;
054
055    private boolean scanned = true;
056
057
058    /**
059     * default model value
060     */
061    private int retentionPeriod = 100;
062
063    /**
064     * default model value
065     */
066    private int retentionCount = 2;
067
068    private boolean deleteReleasedSnapshots;
069
070    private boolean stageRepoNeeded;
071
072    private boolean resetStats;
073
074    /**
075     * @since 1.4-M3
076     */
077    private boolean skipPackedIndexCreation;
078
079    public ManagedRepository() {
080        super(Locale.getDefault());
081    }
082
083    public ManagedRepository(Locale defaultLocale)
084    {
085        super(defaultLocale);
086    }
087
088
089    public ManagedRepository( Locale defaultLocale, String id, String name, String location, String layout, boolean snapshots,
090                              boolean releases, boolean blockRedeployments, String cronExpression, String indexDir,
091                              boolean scanned, int retentionPeriod, int retentionCount, boolean deleteReleasedSnapshots,
092                              boolean stageRepoNeeded )
093    {
094        super( defaultLocale, id, name, layout );
095
096        this.location = location;
097        this.snapshots = snapshots;
098        this.releases = releases;
099        this.blockRedeployments = blockRedeployments;
100        this.setCronExpression( cronExpression );
101        this.setIndexDirectory( indexDir );
102        this.scanned = scanned;
103        this.retentionPeriod = retentionPeriod;
104        this.retentionCount = retentionCount;
105        this.deleteReleasedSnapshots = deleteReleasedSnapshots;
106        this.stageRepoNeeded = stageRepoNeeded;
107    }
108
109    /**
110     * @since 1.4-M3
111     */
112    public ManagedRepository( Locale defaultLocale, String id, String name, String location, String layout, boolean snapshots,
113                              boolean releases, boolean blockRedeployments, String cronExpression, String indexDir,
114                              boolean scanned, int retentionPeriod, int retentionCount, boolean deleteReleasedSnapshots,
115                              boolean stageRepoNeeded, String description, boolean skipPackedIndexCreation )
116    {
117        this( defaultLocale, id, name, location, layout, snapshots, releases, blockRedeployments, cronExpression, indexDir, scanned,
118            retentionPeriod, retentionCount, deleteReleasedSnapshots, stageRepoNeeded );
119        setDescription( description );
120        setSkipPackedIndexCreation( skipPackedIndexCreation );
121    }
122
123    public String getCronExpression()
124    {
125        return cronExpression;
126    }
127
128    public void setCronExpression( String cronExpression )
129    {
130        this.cronExpression = cronExpression;
131    }
132
133    public String getLocation()
134    {
135        return this.location;
136    }
137
138
139    public boolean isReleases()
140    {
141        return this.releases;
142    }
143
144    /**
145     * Get null
146     */
147    public boolean isSnapshots()
148    {
149        return this.snapshots;
150    }
151
152
153    public void setReleases( boolean releases )
154    {
155        this.releases = releases;
156    }
157
158    public void setSnapshots( boolean snapshots )
159    {
160        this.snapshots = snapshots;
161    }
162
163    public void setLocation( String location )
164    {
165        this.location = location;
166    }
167
168    public boolean isBlockRedeployments()
169    {
170        return blockRedeployments;
171    }
172
173    public void setBlockRedeployments( boolean blockRedeployments )
174    {
175        this.blockRedeployments = blockRedeployments;
176    }
177
178
179    public ManagedRepository getStagingRepository()
180    {
181        return stagingRepository;
182    }
183
184
185    public void setStagingRepository( ManagedRepository stagingRepository )
186    {
187        this.stagingRepository = stagingRepository;
188    }
189
190    public boolean isScanned()
191    {
192        return scanned;
193    }
194
195    public void setScanned( boolean scanned )
196    {
197        this.scanned = scanned;
198    }
199
200
201    public int getRetentionPeriod()
202    {
203        return retentionPeriod;
204    }
205
206    public void setRetentionPeriod( int periodInDays )
207    {
208        this.retentionPeriod = periodInDays;
209    }
210
211    public int getRetentionCount()
212    {
213        return retentionCount;
214    }
215
216    public void setRetentionCount( int retentionCount )
217    {
218        this.retentionCount = retentionCount;
219    }
220
221    public boolean isDeleteReleasedSnapshots()
222    {
223        return deleteReleasedSnapshots;
224    }
225
226    public void setDeleteReleasedSnapshots( boolean deleteReleasedSnapshots )
227    {
228        this.deleteReleasedSnapshots = deleteReleasedSnapshots;
229    }
230
231    public boolean isStageRepoNeeded()
232    {
233        return stageRepoNeeded;
234    }
235
236    public void setStageRepoNeeded( boolean stageRepoNeeded )
237    {
238        this.stageRepoNeeded = stageRepoNeeded;
239    }
240
241    public boolean isResetStats()
242    {
243        return resetStats;
244    }
245
246    public void setResetStats( boolean resetStats )
247    {
248        this.resetStats = resetStats;
249    }
250
251    public boolean isSkipPackedIndexCreation()
252    {
253        return skipPackedIndexCreation;
254    }
255
256    public void setSkipPackedIndexCreation( boolean skipPackedIndexCreation )
257    {
258        this.skipPackedIndexCreation = skipPackedIndexCreation;
259    }
260
261    @Override
262    public String toString()
263    {
264        final StringBuilder sb = new StringBuilder();
265        sb.append( super.toString() );
266        sb.append( "ManagedRepository" );
267        sb.append( "{location='" ).append( location ).append( '\'' );
268        sb.append( ", snapshots=" ).append( snapshots );
269        sb.append( ", releases=" ).append( releases );
270        sb.append( ", blockRedeployments=" ).append( blockRedeployments );
271        sb.append( ", cronExpression='" ).append( cronExpression ).append( '\'' );
272        sb.append( ", stagingRepository=" ).append( stagingRepository );
273        sb.append( ", scanned=" ).append( scanned );
274        sb.append( ", retentionPeriod=" ).append( retentionPeriod );
275        sb.append( ", retentionCount=" ).append( retentionCount );
276        sb.append( ", deleteReleasedSnapshots=" ).append( deleteReleasedSnapshots );
277        sb.append( ", stageRepoNeeded=" ).append( stageRepoNeeded );
278        sb.append( ", resetStats=" ).append( resetStats );
279        sb.append( ", skipPackedIndexCreation=" ).append( skipPackedIndexCreation );
280        sb.append( '}' );
281        return sb.toString();
282    }
283
284
285}