summaryrefslogtreecommitdiff
path: root/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRepos.java
blob: 2fc28c25171bd054a67c77ada99e9500dc2a01fe (plain)
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
/**
 * @copyright
 * ====================================================================
 *    Licensed to the Apache Software Foundation (ASF) under one
 *    or more contributor license agreements.  See the NOTICE file
 *    distributed with this work for additional information
 *    regarding copyright ownership.  The ASF licenses this file
 *    to you under the Apache License, Version 2.0 (the
 *    "License"); you may not use this file except in compliance
 *    with the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing,
 *    software distributed under the License is distributed on an
 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *    KIND, either express or implied.  See the License for the
 *    specific language governing permissions and limitations
 *    under the License.
 * ====================================================================
 * @endcopyright
 */

package org.apache.subversion.javahl;

import java.util.Set;
import java.io.OutputStream;
import java.io.InputStream;
import java.io.File;

import org.apache.subversion.javahl.callback.ReposNotifyCallback;
import org.apache.subversion.javahl.callback.ReposFreezeAction;
import org.apache.subversion.javahl.types.*;

public interface ISVNRepos {

	/**
	 * interface to receive the messages
	 */
	public static interface MessageReceiver
	{
	    /**
	     * receive one message line
	     * @param message   one line of message
	     */
	    public void receiveMessageLine(String message);
	}

	/**
	 * release the native peer (should not depend on finalize)
	 */
	public abstract void dispose();

	/**
	 * Filesystem in a Berkeley DB
	 */
	public static final String BDB = "bdb";
	/**
	 * Filesystem in the filesystem
	 */
	public static final String FSFS = "fsfs";

	/**
	 * @return Version information about the underlying native libraries.
	 */
	public abstract Version getVersion();

	/**
	 * create a subversion repository.
	 * @param path                  the path where the repository will been
	 *                              created.
	 * @param disableFsyncCommit    disable to fsync at the commit (BDB).
	 * @param keepLog               keep the log files (BDB).
	 * @param configPath            optional path for user configuration files.
	 * @param fstype                the type of the filesystem (BDB or FSFS)
	 * @throws ClientException  throw in case of problem
	 */
	public abstract void create(File path, boolean disableFsyncCommit,
			boolean keepLog, File configPath, String fstype)
			throws ClientException;

	/**
	 * deltify the revisions in the repository
	 * @param path              the path to the repository
	 * @param start             start revision
	 * @param end               end revision
	 * @throws ClientException  throw in case of problem
	 */
	public abstract void deltify(File path, Revision start, Revision end)
			throws ClientException;

	/**
	 * dump the data in a repository
	 * @param path              the path to the repository
	 * @param dataOut           the data will be outputed here
	 * @param start             the first revision to be dumped
	 * @param end               the last revision to be dumped
	 * @param incremental       the dump will be incremantal
	 * @param useDeltas         the dump will contain deltas between nodes
     * @param callback          the callback to recieve notifications
	 * @throws ClientException  throw in case of problem
	 */
	public abstract void dump(File path, OutputStream dataOut,
                Revision start, Revision end, boolean incremental,
                boolean useDeltas, ReposNotifyCallback callback)
			throws ClientException;

	/**
	 * make a hot copy of the repository
	 * @param path              the path to the source repository
	 * @param targetPath        the path to the target repository
	 * @param cleanLogs         clean the unused log files in the source
	 *                          repository
	 * @throws ClientException  throw in case of problem
	 */
	public abstract void hotcopy(File path, File targetPath,
			boolean cleanLogs, boolean incremental) throws ClientException;

	public abstract void hotcopy(File path, File targetPath,
			boolean cleanLogs) throws ClientException;

	/**
	 * list all logfiles (BDB) in use or not)
	 * @param path              the path to the repository
	 * @param receiver          interface to receive the logfile names
	 * @throws ClientException  throw in case of problem
	 */
	public abstract void listDBLogs(File path, MessageReceiver receiver)
			throws ClientException;

	/**
	 * list unused logfiles
	 * @param path              the path to the repository
	 * @param receiver          interface to receive the logfile names
	 * @throws ClientException  throw in case of problem
	 */
	public abstract void listUnusedDBLogs(File path, MessageReceiver receiver)
			throws ClientException;


	/**
	 * load the data of a dump into a repository
	 * @param path              the path to the repository
	 * @param dataInput         the data input source
         * @param start             the first revision to load
         * @param end               the last revision to load
	 * @param ignoreUUID        ignore any UUID found in the input stream
	 * @param forceUUID         set the repository UUID to any found in the
	 *                          stream
	 * @param usePreCommitHook  use the pre-commit hook when processing commits
	 * @param usePostCommitHook use the post-commit hook when processing commits
	 * @param relativePath      the directory in the repository, where the data
	 *                          in put optional.
	 * @param callback          the target for processing messages
	 * @throws ClientException  throw in case of problem
         * @since 1.8
	 */
	public abstract void load(File path, InputStream dataInput,
                                  Revision start, Revision end,
                                  boolean ignoreUUID, boolean forceUUID,
                                  boolean usePreCommitHook,
                                  boolean usePostCommitHook,
                                  String relativePath,
                                  ReposNotifyCallback callback)
        throws ClientException;

	/**
	 * load the data of a dump into a repository
	 * @param path              the path to the repository
	 * @param dataInput         the data input source
	 * @param ignoreUUID        ignore any UUID found in the input stream
	 * @param forceUUID         set the repository UUID to any found in the
	 *                          stream
	 * @param usePreCommitHook  use the pre-commit hook when processing commits
	 * @param usePostCommitHook use the post-commit hook when processing commits
	 * @param relativePath      the directory in the repository, where the data
	 *                          in put optional.
	 * @param callback          the target for processing messages
	 * @throws ClientException  throw in case of problem
         * @note behaves like the 1.8 vesion with the revision
         *       parameters set to Revision.START and Revision.HEAD.
	 */
	public abstract void load(File path, InputStream dataInput,
			boolean ignoreUUID, boolean forceUUID, boolean usePreCommitHook,
            boolean usePostCommitHook, String relativePath,
            ReposNotifyCallback callback)
        throws ClientException;

	/**
	 * list all open transactions in a repository
	 * @param path              the path to the repository
	 * @param receiver          receives one transaction name per call
	 * @throws ClientException  throw in case of problem
	 */
	public abstract void lstxns(File path, MessageReceiver receiver)
			throws ClientException;

	/**
	 * recover the filesystem backend of a repository
	 * @param path              the path to the repository
         * @return youngest revision
	 * @throws ClientException  throw in case of problem
	 */
	public abstract long recover(File path, ReposNotifyCallback callback)
            throws ClientException;

	/**
	 * Take an exclusive lock on each of the listed repositories
	 * to prevent commits; then, while holding all the locks, call
	 * the action.invoke().
	 *
	 * The repositories may or may not be readable by Subversion
	 * while frozen, depending on implementation details of the
	 * repository's filesystem backend.
	 *
	 * Repositories are locked in the listed order.
	 * @param action     describes the action to perform
	 * @param paths	     the set of repository paths
	 * @throws ClientException
         * @since 1.8
	 */
	public abstract void freeze(ReposFreezeAction action,
				    File... paths)
	    throws ClientException;

	/**
	 * remove open transaction in a repository
	 * @param path              the path to the repository
	 * @param transactions      the transactions to be removed
	 * @throws ClientException  throw in case of problem
	 */
	public abstract void rmtxns(File path, String[] transactions)
			throws ClientException;

	/**
	 * Change the value of the revision property <code>propName</code>
	 * to <code>propValue</code>.  By default, does not run
	 * pre-/post-revprop-change hook scripts.
	 *
	 * @param path The path to the repository.
	 * @param rev The revision for which to change a property value.
	 * @param propName The name of the property to change.
	 * @param propValue The new value to set for the property.
	 * @param usePreRevPropChangeHook Whether to run the
	 * <i>pre-revprop-change</i> hook script.
	 * @param usePostRevPropChangeHook Whether to run the
	 * <i>post-revprop-change</i> hook script.
	 * @throws SubversionException If a problem occurs.
	 */
	public abstract void setRevProp(File path, Revision rev, String propName,
			String propValue, boolean usePreRevPropChangeHook,
			boolean usePostRevPropChangeHook) throws SubversionException;

	/**
	 * Verify the repository at <code>path</code> between revisions
	 * <code>start</code> and <code>end</code>.
	 *
	 * @param path              the path to the repository
	 * @param start             the first revision
	 * @param end               the last revision
     * @param callback          the callback to recieve notifications
	 * @throws ClientException If an error occurred.
	 */
	public abstract void verify(File path, Revision start, Revision end,
                ReposNotifyCallback callback)
            throws ClientException;

	/**
	 * list all locks in the repository
	 * @param path              the path to the repository
     * @param depth             the depth to recurse
	 * @throws ClientException  throw in case of problem
	 */
	public abstract Set<Lock> lslocks(File path, Depth depth)
            throws ClientException;

	/**
	 * remove multiple locks from the repository
	 * @param path              the path to the repository
	 * @param locks             the name of the locked items
	 * @throws ClientException  throw in case of problem
	 */
	public abstract void rmlocks(File path, String[] locks)
			throws ClientException;

    /**
     * upgrade the repository format
     * @param path              the path to the repository
     * @param callback          for notification
	 * @throws ClientException  throw in case of problem
     */
    public abstract void upgrade(File path, ReposNotifyCallback callback)
			throws ClientException;

    /**
     * pack the repository
     * @param path              the path to the repository
     * @param callback          for notification
	 * @throws ClientException  throw in case of problem
     */
    public abstract void pack(File path, ReposNotifyCallback callback)
			throws ClientException;

    /**
     * cancel the active operation
     * @throws ClientException
     */
    void cancelOperation() throws ClientException;
}