This repository has been archived by the owner on Aug 11, 2020. It is now read-only.
/
MutableConfiguration.java
177 lines (147 loc) · 6.75 KB
/
MutableConfiguration.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
/*
* 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.configuration.application;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import org.sonatype.configuration.ConfigurationException;
import org.sonatype.configuration.validation.InvalidConfigurationException;
import org.sonatype.nexus.configuration.model.CRemoteNexusInstance;
import org.sonatype.nexus.configuration.model.CRepository;
import org.sonatype.nexus.proxy.NoSuchRepositoryException;
import org.sonatype.nexus.proxy.registry.RepositoryTypeDescriptor;
import org.sonatype.nexus.proxy.repository.Repository;
import org.sonatype.nexus.tasks.descriptors.ScheduledTaskDescriptor;
public interface MutableConfiguration
{
// ----------------------------------------------------------------------------------------------------------
// Security (TODO: this should be removed, security has to be completely "paralell" and not interleaved!)
// ----------------------------------------------------------------------------------------------------------
boolean isSecurityEnabled();
void setSecurityEnabled( boolean enabled )
throws IOException;
boolean isAnonymousAccessEnabled();
/**
* Configures anonymous access in atomic way.
*
* @param enabled {@code true} to enable and {@code false} to disable it.
* @param username the username of the user to be used as "anonymous" user. If {@code enabled} parameter is
* {@code true}, this value must be non-null.
* @param password the password of the user to be used as "anonymous" user. If {@code enabled} parameter is
* {@code true}, this value must be non-null.
* @throws InvalidConfigurationException if {@code enabled} parameter is {@code true}, but passed in username or
* password parameters are empty ({@code null} or empty string).
*/
void setAnonymousAccess( boolean enabled, String username, String password )
throws InvalidConfigurationException;
String getAnonymousUsername();
String getAnonymousPassword();
/**
* Set anonymous access.
*
* @param val
* @throws IOException
* @deprecated Use {@link #setAnonymousAccess(boolean, String, String)} instead.
*/
@Deprecated
void setAnonymousAccessEnabled( boolean enabled )
throws IOException;
/**
* Set anonymous username.
*
* @param val
* @throws InvalidConfigurationException
* @deprecated Use {@link #setAnonymousAccess(boolean, String, String)} instead.
*/
@Deprecated
void setAnonymousUsername( String val )
throws InvalidConfigurationException;
/**
* Set anonymous password.
*
* @param val
* @throws InvalidConfigurationException
* @deprecated Use {@link #setAnonymousAccess(boolean, String, String)} instead.
*/
@Deprecated
void setAnonymousPassword( String val )
throws InvalidConfigurationException;
List<String> getRealms();
void setRealms( List<String> realms )
throws InvalidConfigurationException;
// ----------------------------------------------------------------------------
// Scheduled Tasks
// ----------------------------------------------------------------------------
List<ScheduledTaskDescriptor> listScheduledTaskDescriptors();
ScheduledTaskDescriptor getScheduledTaskDescriptor( String id );
// ----------------------------------------------------------------------------------------------------------
// Repositories
// ----------------------------------------------------------------------------------------------------------
/**
* Sets the default (applied to all that has no exceptions set with {
* {@link #setRepositoryMaxInstanceCount(RepositoryTypeDescriptor, int)} method) maxInstanceCount. Any positive
* integer limits the max count of live instances, any less then 0 integer removes the limitation. Note: setting
* limitations on already booted instance will not "enforce" the limitation!
*
* @param count
*/
void setDefaultRepositoryMaxInstanceCount( int count );
/**
* Limits the maxInstanceCount for the passed in repository type. Any positive integer limits the max count of live
* instances, any less then 0 integer removes the limitation. Note: setting limitations on already booted instance
* will not "enforce" the limitation!
*
* @param rtd
* @param count
*/
void setRepositoryMaxInstanceCount( RepositoryTypeDescriptor rtd, int count );
/**
* Returns the count limit for the passed in repository type.
*
* @param rtd
* @return
*/
int getRepositoryMaxInstanceCount( RepositoryTypeDescriptor rtd );
// CRepository: CRUD
/**
* Creates a repository live instance out of the passed in model. It validates, registers it with repository
* registry and puts it into configuration. And finally saves configuration.
*
* @return the repository instance.
* @throws ConfigurationException
* @throws IOException
*/
Repository createRepository( CRepository settings )
throws ConfigurationException, IOException;
/**
* Removes repository from configuration, checks it's dependants too (ie shadows), updates groups and path mappings
* (Routes on UI) if needed.
*
* @param id
* @throws NoSuchRepositoryException
* @throws IOException
* @throws ConfigurationException
*/
void deleteRepository( String id )
throws NoSuchRepositoryException, IOException, ConfigurationException;
// FIXME: This will be removed: NEXUS-2363 vvvvv
// CRemoteNexusInstance
Collection<CRemoteNexusInstance> listRemoteNexusInstances();
CRemoteNexusInstance readRemoteNexusInstance( String alias )
throws IOException;
void createRemoteNexusInstance( CRemoteNexusInstance settings )
throws IOException;
void deleteRemoteNexusInstance( String alias )
throws IOException;
// FIXME: This will be removed: NEXUS-2363 ^^^^^
}