This repository has been archived by the owner on Aug 11, 2020. It is now read-only.
/
AbstractMavenRepositoryConfiguration.java
125 lines (98 loc) · 4.38 KB
/
AbstractMavenRepositoryConfiguration.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
* Sonatype Nexus (TM) Open Source Version
* Copyright (c) 2007-2012 Sonatype, Inc.
* All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
*
* This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
* which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
*
* Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.nexus.proxy.maven;
import java.util.concurrent.TimeUnit;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.sonatype.nexus.proxy.repository.AbstractProxyRepositoryConfiguration;
public abstract class AbstractMavenRepositoryConfiguration
extends AbstractProxyRepositoryConfiguration
{
public static final String REPOSITORY_POLICY = "repositoryPolicy";
public static final String CHECKSUM_POLICY = "checksumPolicy";
public static final String ARTIFACT_MAX_AGE = "artifactMaxAge";
public static final String METADATA_MAX_AGE = "metadataMaxAge";
public static final String DOWNLOAD_REMOTE_INDEX = "downloadRemoteIndex";
public static final String CLEANSE_REPOSITORY_METADATA = "cleanseRepositoryMetadata";
public static final String ROUTING_DISCOVERY_ENABLED = "routingDiscoveryEnabled";
public static final String ROUTING_DISCOVERY_INTERVAL = "routingDiscoveryInterval";
public AbstractMavenRepositoryConfiguration( Xpp3Dom configuration )
{
super( configuration );
}
public RepositoryPolicy getRepositoryPolicy()
{
return RepositoryPolicy.valueOf( getNodeValue( getRootNode(), REPOSITORY_POLICY,
RepositoryPolicy.RELEASE.toString() ).toUpperCase() );
}
public void setRepositoryPolicy( RepositoryPolicy policy )
{
setNodeValue( getRootNode(), REPOSITORY_POLICY, policy.toString() );
}
public ChecksumPolicy getChecksumPolicy()
{
return ChecksumPolicy.valueOf( getNodeValue( getRootNode(), CHECKSUM_POLICY, ChecksumPolicy.WARN.toString() ) );
}
public void setChecksumPolicy( ChecksumPolicy policy )
{
setNodeValue( getRootNode(), CHECKSUM_POLICY, policy.toString() );
}
public int getArtifactMaxAge()
{
return Integer.parseInt( getNodeValue( getRootNode(), ARTIFACT_MAX_AGE, "1440" ) );
}
public void setArtifactMaxAge( int age )
{
setNodeValue( getRootNode(), ARTIFACT_MAX_AGE, String.valueOf( age ) );
}
public int getMetadataMaxAge()
{
return Integer.parseInt( getNodeValue( getRootNode(), METADATA_MAX_AGE, "1440" ) );
}
public void setMetadataMaxAge( int age )
{
setNodeValue( getRootNode(), METADATA_MAX_AGE, String.valueOf( age ) );
}
public boolean isDownloadRemoteIndex()
{
return Boolean.parseBoolean( getNodeValue( getRootNode(), DOWNLOAD_REMOTE_INDEX, Boolean.TRUE.toString() ) );
}
public void setDownloadRemoteIndex( boolean val )
{
setNodeValue( getRootNode(), DOWNLOAD_REMOTE_INDEX, Boolean.toString( val ) );
}
public boolean isCleanseRepositoryMetadata()
{
return Boolean.parseBoolean( getNodeValue( getRootNode(), CLEANSE_REPOSITORY_METADATA, Boolean.FALSE.toString() ) );
}
public void setCleanseRepositoryMetadata( boolean val )
{
setNodeValue( getRootNode(), CLEANSE_REPOSITORY_METADATA, Boolean.toString( val ) );
}
public boolean isRoutingDiscoveryEnabled()
{
return Boolean.parseBoolean( getNodeValue( getRootNode(), ROUTING_DISCOVERY_ENABLED, Boolean.TRUE.toString() ) );
}
public void setRoutingDiscoveryEnabled( boolean val )
{
setNodeValue( getRootNode(), ROUTING_DISCOVERY_ENABLED, Boolean.toString( val ) );
}
public long getRoutingDiscoveryInterval()
{
return Long.parseLong( getNodeValue( getRootNode(), ROUTING_DISCOVERY_INTERVAL,
String.valueOf( TimeUnit.HOURS.toMillis( 24 ) ) ) );
}
public void setRoutingDiscoveryInterval( long val )
{
setNodeValue( getRootNode(), ROUTING_DISCOVERY_INTERVAL, String.valueOf( val ) );
}
}