summaryrefslogtreecommitdiff
path: root/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp
blob: 125b88daae39c147adaaaaa24a0e909f9b6b032d (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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
/**
 * @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
 *
 * @file org_apache_subversion_javahl_remote_RemoteSession.cpp
 * @brief Implementation of the native methods in the Java class RemoteSession
 */

#include "../include/org_apache_subversion_javahl_remote_RemoteSession.h"

#include "JNIStackElement.h"
#include "JNIUtil.h"
#include "Prompter.h"
#include "RemoteSession.h"
#include "Revision.h"
#include "EnumMapper.h"

#include "svn_private_config.h"

JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_finalize(
    JNIEnv *env, jobject jthis)
{
  JNIEntry(RemoteSession, finalize);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  if (ras != NULL)
    ras->finalize();
}

JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_nativeDispose(
    JNIEnv *env, jobject jthis)
{
  JNIEntry(RemoteSession, nativeDispose);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  if (ras != NULL)
    ras->dispose(jthis);
}

JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_cancelOperation(
    JNIEnv *env, jobject jthis)
{
  JNIEntry(RemoteSession, cancelOperation);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, );

  ras->cancelOperation();
}

JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_reparent(
    JNIEnv *env, jobject jthis, jstring jurl)
{
  JNIEntry(RemoteSession, reparent);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, );

  ras->reparent(jurl);
}

JNIEXPORT jstring JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_getSessionRelativePath(
    JNIEnv *env, jobject jthis, jstring jurl)
{
  JNIEntry(RemoteSession, getSessionRelativePath);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, NULL);

  return ras->getSessionRelativePath(jurl);
}

JNIEXPORT jstring JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_getReposRelativePath(
    JNIEnv *env, jobject jthis, jstring jurl)
{
  JNIEntry(RemoteSession, getReposRelativePath);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, NULL);

  return ras->getReposRelativePath(jurl);
}

JNIEXPORT jstring JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_getSessionUrl(
    JNIEnv *env, jobject jthis)
{
  JNIEntry(RemoteSession, getSessionUrl);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, NULL);

  return ras->getSessionUrl();
}

JNIEXPORT jstring JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_getReposUUID(
    JNIEnv *env, jobject jthis)
{
  JNIEntry(RemoteSession, getReposUUID);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, NULL);

  return ras->getReposUUID();
}

JNIEXPORT jstring JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_getReposRootUrl(
    JNIEnv *env, jobject jthis)
{
  JNIEntry(RemoteSession, getReposRootUrl);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, NULL);

  return ras->getReposRootUrl();
}

JNIEXPORT jlong JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_getLatestRevision(
    JNIEnv *env, jobject jthis)
{
  JNIEntry(RemoteSession, getLatestRevision);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, SVN_INVALID_REVNUM);

  return ras->getLatestRevision();
}

JNIEXPORT jlong JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_getRevisionByTimestamp(
    JNIEnv *env, jobject jthis, jlong timestamp)
{
  JNIEntry(RemoteSession, getRevisionByTimestamp);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, SVN_INVALID_REVNUM);

  return ras->getRevisionByTimestamp(timestamp);
}

JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_nativeChangeRevisionProperty(
    JNIEnv *env, jobject jthis, jlong jrevision, jstring jname,
    jbyteArray jold_value, jbyteArray jvalue)
{
  JNIEntry(RemoteSession, nativeChangeRevisionProperty);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, );

  return ras->changeRevisionProperty(jrevision, jname, jold_value, jvalue);
}

JNIEXPORT jobject JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_getRevisionProperties(
    JNIEnv *env, jobject jthis, jlong jrevision)
{
  JNIEntry(SVNReposAccess, getRevisionProperties);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, NULL);

  return ras->getRevisionProperties(jrevision);
}

JNIEXPORT jbyteArray JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_getRevisionProperty(
    JNIEnv *env, jobject jthis, jlong jrevision, jstring jname)
{
  JNIEntry(SVNReposAccess, getRevisionProperty);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, NULL);

  return ras->getRevisionProperty(jrevision, jname);
}

JNIEXPORT jlong JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_nativeGetFile(
    JNIEnv *env, jobject jthis, jlong jrevision, jstring jpath,
    jobject jcontents, jobject jproperties)
{
  JNIEntry(SVNReposAccess, nativeGetFile);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, SVN_INVALID_REVNUM);

  return ras->getFile(jrevision, jpath, jcontents, jproperties);
}

JNIEXPORT jlong JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_nativeGetDirectory(
    JNIEnv *env, jobject jthis, jlong jrevision, jstring jpath,
    jint jdirent_fields, jobject jdirents, jobject jproperties)
{
  JNIEntry(SVNReposAccess, nativeGetDirectory);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, SVN_INVALID_REVNUM);

  return ras->getDirectory(jrevision, jpath,
                           jdirent_fields, jdirents, jproperties);
}

JNIEXPORT jobject JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_getMergeinfo(
    JNIEnv *env, jobject jthis, jobject jpaths, jlong jrevision,
    jobject jinherit, jboolean jinclude_descendants)
{
  JNIEntry(SVNReposAccess, getMergeinfo);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, NULL);

  return ras->getMergeinfo(jpaths, jrevision, jinherit, jinclude_descendants);
}

// TODO: update
// TODO: switch

JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_nativeStatus(
    JNIEnv *env, jobject jthis, jstring jstatus_target, jlong jrevision,
    jobject jdepth, jobject jstatus_editor, jobject jreporter)
{
  JNIEntry(SVNReposAccess, nativeStatus);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras,);

  ras->status(jthis, jstatus_target, jrevision, jdepth,
              jstatus_editor, jreporter);
}

// TODO: diff

JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_getLog(
    JNIEnv *env, jobject jthis, jobject jpaths,
    jlong jstartrev, jlong jendrev, jint jlimit,
    jboolean jstrict_node_history, jboolean jdiscover_changed_paths,
    jboolean jinclude_merged_revisions,
    jobject jrevprops, jobject jlog_callback)
{
  JNIEntry(SVNReposAccess, getLog);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras,);

  ras->getLog(jpaths, jstartrev, jendrev, jlimit,
              jstrict_node_history, jdiscover_changed_paths,
              jinclude_merged_revisions,
              jrevprops, jlog_callback);
}

JNIEXPORT jobject JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_checkPath(
    JNIEnv *env, jobject jthis, jstring jpath, jlong jrevision)
{
  JNIEntry(SVNReposAccess, checkPath);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, NULL);

  return ras->checkPath(jpath, jrevision);
}

JNIEXPORT jobject JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_stat(
    JNIEnv *env, jobject jthis, jstring jpath, jlong jrevision)
{
  JNIEntry(SVNReposAccess, stat);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, NULL);

  return ras->stat(jpath, jrevision);
}

JNIEXPORT jobject JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_getLocations(
    JNIEnv *env, jobject jthis, jstring jpath, jlong jpeg_revision,
    jobject jlocation_revisions)
{
  JNIEntry(SVNReposAccess, getLocations);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, NULL);

  return ras->getLocations(jpath, jpeg_revision, jlocation_revisions);
}

JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_getLocationSegments(
    JNIEnv *env, jobject jthis, jstring jpath, jlong jpeg_revision,
    jlong jstart_revision, jlong jend_revision, jobject jcallback)
{
  JNIEntry(SVNReposAccess, getLocationSegments);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, );

  if (jcallback == NULL)
    JNIUtil::throwNullPointerException("handler");
  ras->getLocationSegments(jpath, jpeg_revision,
                           jstart_revision, jend_revision,
                           jcallback);
}

JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_getFileRevisions(
    JNIEnv *env, jobject jthis, jstring jpath,
    jlong jstart_revision, jlong jend_revision,
    jboolean jinclude_merged_revisions, jobject jcallback)
{
  JNIEntry(SVNReposAccess, getFileRevisions);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, );

  if (jcallback == NULL)
    JNIUtil::throwNullPointerException("handler");
  ras->getFileRevisions(jpath, jstart_revision, jend_revision,
                        jinclude_merged_revisions, jcallback);
}

// TODO: lock
// TODO: unlock
// TODO: getLock

JNIEXPORT jobject JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_getLocks(
    JNIEnv *env, jobject jthis, jstring jpath, jobject jdepth)
{
  JNIEntry(RemoteSession, getLocks);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, NULL);

  return ras->getLocks(jpath, jdepth);
}

// TODO: replayRange
// TODO: replay
// TODO: getDeletedRevision
// TODO: getInheritedProperties

JNIEXPORT jboolean JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_nativeHasCapability(
    JNIEnv *env, jobject jthis, jstring jcapability)
{
  JNIEntry(RemoteSession, nativeHasCapability);
  RemoteSession *ras = RemoteSession::getCppObject(jthis);
  CPPADDR_NULL_PTR(ras, false);

  return ras->hasCapability(jcapability);
}