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;
024
025/**
026 * @author Olivier Lamy
027 * @since 1.4-M1
028 */
029@XmlRootElement (name = "managedRepository")
030public class ManagedRepository
031    extends AbstractRepository
032    implements Serializable
033{
034
035    private String location;
036
037    private boolean snapshots = false;
038
039    private boolean releases = true;
040
041    private boolean blockRedeployments = false;
042
043    /**
044     * default model value hourly
045     */
046    private String cronExpression = "0 0 * * * ?";
047
048
049    /**
050     * not need when creating the repo : only available when reading
051     */
052    private ManagedRepository stagingRepository;
053
054    private boolean scanned = true;
055
056
057    /**
058     * default model value
059     */
060    private int daysOlder = 100;
061
062    /**
063     * default model value
064     */
065    private int retentionCount = 2;
066
067    private boolean deleteReleasedSnapshots;
068
069    private boolean stageRepoNeeded;
070
071    private boolean resetStats;
072
073    /**
074     * @since 1.4-M3
075     */
076    private boolean skipPackedIndexCreation;
077
078    public ManagedRepository()
079    {
080        // no op
081    }
082
083    public ManagedRepository( String id, String name, String location, String layout, boolean snapshots,
084                              boolean releases, boolean blockRedeployments, String cronExpression, String indexDir,
085                              boolean scanned, int daysOlder, int retentionCount, boolean deleteReleasedSnapshots,
086                              boolean stageRepoNeeded )
087    {
088        super( id, name, layout );
089
090        this.location = location;
091        this.snapshots = snapshots;
092        this.releases = releases;
093        this.blockRedeployments = blockRedeployments;
094        this.setCronExpression( cronExpression );
095        this.setIndexDirectory( indexDir );
096        this.scanned = scanned;
097        this.daysOlder = daysOlder;
098        this.retentionCount = retentionCount;
099        this.deleteReleasedSnapshots = deleteReleasedSnapshots;
100        this.stageRepoNeeded = stageRepoNeeded;
101    }
102
103    /**
104     * @since 1.4-M3
105     */
106    public ManagedRepository( String id, String name, String location, String layout, boolean snapshots,
107                              boolean releases, boolean blockRedeployments, String cronExpression, String indexDir,
108                              boolean scanned, int daysOlder, int retentionCount, boolean deleteReleasedSnapshots,
109                              boolean stageRepoNeeded, String description, boolean skipPackedIndexCreation )
110    {
111        this( id, name, location, layout, snapshots, releases, blockRedeployments, cronExpression, indexDir, scanned,
112              daysOlder, retentionCount, deleteReleasedSnapshots, stageRepoNeeded );
113        setDescription( description );
114        setSkipPackedIndexCreation( skipPackedIndexCreation );
115    }
116
117    public String getCronExpression()
118    {
119        return cronExpression;
120    }
121
122    public void setCronExpression( String cronExpression )
123    {
124        this.cronExpression = cronExpression;
125    }
126
127    public String getLocation()
128    {
129        return this.location;
130    }
131
132
133    public boolean isReleases()
134    {
135        return this.releases;
136    }
137
138    /**
139     * Get null
140     */
141    public boolean isSnapshots()
142    {
143        return this.snapshots;
144    }
145
146
147    public void setReleases( boolean releases )
148    {
149        this.releases = releases;
150    }
151
152    public void setSnapshots( boolean snapshots )
153    {
154        this.snapshots = snapshots;
155    }
156
157    public void setLocation( String location )
158    {
159        this.location = location;
160    }
161
162    public boolean isBlockRedeployments()
163    {
164        return blockRedeployments;
165    }
166
167    public void setBlockRedeployments( boolean blockRedeployments )
168    {
169        this.blockRedeployments = blockRedeployments;
170    }
171
172
173    public ManagedRepository getStagingRepository()
174    {
175        return stagingRepository;
176    }
177
178
179    public void setStagingRepository( ManagedRepository stagingRepository )
180    {
181        this.stagingRepository = stagingRepository;
182    }
183
184    public boolean isScanned()
185    {
186        return scanned;
187    }
188
189    public void setScanned( boolean scanned )
190    {
191        this.scanned = scanned;
192    }
193
194
195    public int getDaysOlder()
196    {
197        return daysOlder;
198    }
199
200    public void setDaysOlder( int daysOlder )
201    {
202        this.daysOlder = daysOlder;
203    }
204
205    public int getRetentionCount()
206    {
207        return retentionCount;
208    }
209
210    public void setRetentionCount( int retentionCount )
211    {
212        this.retentionCount = retentionCount;
213    }
214
215    public boolean isDeleteReleasedSnapshots()
216    {
217        return deleteReleasedSnapshots;
218    }
219
220    public void setDeleteReleasedSnapshots( boolean deleteReleasedSnapshots )
221    {
222        this.deleteReleasedSnapshots = deleteReleasedSnapshots;
223    }
224
225    public boolean isStageRepoNeeded()
226    {
227        return stageRepoNeeded;
228    }
229
230    public void setStageRepoNeeded( boolean stageRepoNeeded )
231    {
232        this.stageRepoNeeded = stageRepoNeeded;
233    }
234
235    public boolean isResetStats()
236    {
237        return resetStats;
238    }
239
240    public void setResetStats( boolean resetStats )
241    {
242        this.resetStats = resetStats;
243    }
244
245    public boolean isSkipPackedIndexCreation()
246    {
247        return skipPackedIndexCreation;
248    }
249
250    public void setSkipPackedIndexCreation( boolean skipPackedIndexCreation )
251    {
252        this.skipPackedIndexCreation = skipPackedIndexCreation;
253    }
254
255    @Override
256    public String toString()
257    {
258        final StringBuilder sb = new StringBuilder();
259        sb.append( super.toString() );
260        sb.append( "ManagedRepository" );
261        sb.append( "{location='" ).append( location ).append( '\'' );
262        sb.append( ", snapshots=" ).append( snapshots );
263        sb.append( ", releases=" ).append( releases );
264        sb.append( ", blockRedeployments=" ).append( blockRedeployments );
265        sb.append( ", cronExpression='" ).append( cronExpression ).append( '\'' );
266        sb.append( ", stagingRepository=" ).append( stagingRepository );
267        sb.append( ", scanned=" ).append( scanned );
268        sb.append( ", daysOlder=" ).append( daysOlder );
269        sb.append( ", retentionCount=" ).append( retentionCount );
270        sb.append( ", deleteReleasedSnapshots=" ).append( deleteReleasedSnapshots );
271        sb.append( ", stageRepoNeeded=" ).append( stageRepoNeeded );
272        sb.append( ", resetStats=" ).append( resetStats );
273        sb.append( ", skipPackedIndexCreation=" ).append( skipPackedIndexCreation );
274        sb.append( '}' );
275        return sb.toString();
276    }
277
278
279}