~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * @copyright
 
3
 * ====================================================================
 
4
 *    Licensed to the Apache Software Foundation (ASF) under one
 
5
 *    or more contributor license agreements.  See the NOTICE file
 
6
 *    distributed with this work for additional information
 
7
 *    regarding copyright ownership.  The ASF licenses this file
 
8
 *    to you under the Apache License, Version 2.0 (the
 
9
 *    "License"); you may not use this file except in compliance
 
10
 *    with the License.  You may obtain a copy of the License at
 
11
 *
 
12
 *      http://www.apache.org/licenses/LICENSE-2.0
 
13
 *
 
14
 *    Unless required by applicable law or agreed to in writing,
 
15
 *    software distributed under the License is distributed on an
 
16
 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 
17
 *    KIND, either express or implied.  See the License for the
 
18
 *    specific language governing permissions and limitations
 
19
 *    under the License.
 
20
 * ====================================================================
 
21
 * @endcopyright
 
22
 */
 
23
 
 
24
package org.apache.subversion.javahl.remote;
 
25
 
 
26
import org.apache.subversion.javahl.types.*;
 
27
import org.apache.subversion.javahl.callback.*;
 
28
 
 
29
import org.apache.subversion.javahl.ISVNEditor;
 
30
import org.apache.subversion.javahl.JNIObject;
 
31
import org.apache.subversion.javahl.ClientException;
 
32
import org.apache.subversion.javahl.NativeResources;
 
33
 
 
34
import java.io.InputStream;
 
35
import java.util.Map;
 
36
import java.util.Set;
 
37
 
 
38
/**
 
39
 * Implementation of ISVNEditor that drives commits.
 
40
 * @since 1.9
 
41
 */
 
42
public class CommitEditor extends JNIObject implements ISVNEditor
 
43
{
 
44
    /**
 
45
     * Load the required native library.
 
46
     */
 
47
    static
 
48
    {
 
49
        NativeResources.loadNativeLibrary();
 
50
    }
 
51
 
 
52
    public void dispose()
 
53
    {
 
54
        session.disposeEditor(this);
 
55
        nativeDispose();
 
56
    }
 
57
 
 
58
    public native void addDirectory(String relativePath,
 
59
                                    Iterable<String> children,
 
60
                                    Map<String, byte[]> properties,
 
61
                                    long replacesRevision)
 
62
            throws ClientException;
 
63
 
 
64
    public native void addFile(String relativePath,
 
65
                               Checksum checksum,
 
66
                               InputStream contents,
 
67
                               Map<String, byte[]> properties,
 
68
                               long replacesRevision)
 
69
            throws ClientException;
 
70
 
 
71
    /**
 
72
     * <b>Note:</b> Not implemented.
 
73
     */
 
74
    public native void addSymlink(String relativePath,
 
75
                                  String target,
 
76
                                  Map<String, byte[]> properties,
 
77
                                  long replacesRevision)
 
78
            throws ClientException;
 
79
 
 
80
    public native void addAbsent(String relativePath,
 
81
                                 NodeKind kind,
 
82
                                 long replacesRevision)
 
83
            throws ClientException;
 
84
 
 
85
    public native void alterDirectory(String relativePath,
 
86
                                      long revision,
 
87
                                      Iterable<String> children,
 
88
                                      Map<String, byte[]> properties)
 
89
            throws ClientException;
 
90
 
 
91
    public native void alterFile(String relativePath,
 
92
                                 long revision,
 
93
                                 Checksum checksum,
 
94
                                 InputStream contents,
 
95
                                 Map<String, byte[]> properties)
 
96
            throws ClientException;
 
97
 
 
98
    /**
 
99
     * <b>Note:</b> Not implemented.
 
100
     */
 
101
    public native void alterSymlink(String relativePath,
 
102
                                    long revision,
 
103
                                    String target,
 
104
                                    Map<String, byte[]> properties)
 
105
            throws ClientException;
 
106
 
 
107
    public native void delete(String relativePath,
 
108
                              long revision)
 
109
            throws ClientException;
 
110
 
 
111
    public native void copy(String sourceRelativePath,
 
112
                            long sourceRevision,
 
113
                            String destinationRelativePath,
 
114
                            long replacesRevision)
 
115
            throws ClientException;
 
116
 
 
117
    public native void move(String sourceRelativePath,
 
118
                            long sourceRevision,
 
119
                            String destinationRelativePath,
 
120
                            long replacesRevision)
 
121
            throws ClientException;
 
122
 
 
123
    public native void complete() throws ClientException;
 
124
 
 
125
    public native void abort() throws ClientException;
 
126
 
 
127
    /**
 
128
     * This factory method called from RemoteSession.getCommitEditor.
 
129
     */
 
130
    static final
 
131
        CommitEditor createInstance(RemoteSession session,
 
132
                                    Map<String, byte[]> revisionProperties,
 
133
                                    CommitCallback commitCallback,
 
134
                                    Set<Lock> lockTokens, boolean keepLocks,
 
135
                                    ISVNEditor.ProvideBaseCallback baseCB,
 
136
                                    ISVNEditor.ProvidePropsCallback propsCB,
 
137
                                    ISVNEditor.GetNodeKindCallback kindCB)
 
138
            throws ClientException
 
139
    {
 
140
        long cppAddr = nativeCreateInstance(
 
141
            session, revisionProperties, commitCallback,
 
142
            lockTokens, keepLocks, baseCB, propsCB, kindCB);
 
143
        return new CommitEditor(cppAddr, session);
 
144
    }
 
145
 
 
146
    /**
 
147
     * This constructor is called from the factory to get an instance.
 
148
     */
 
149
    protected CommitEditor(long cppAddr, RemoteSession session)
 
150
    {
 
151
        super(cppAddr);
 
152
        this.session = session;
 
153
    }
 
154
 
 
155
    /** Stores a reference to the session that created this editor. */
 
156
    protected RemoteSession session;
 
157
 
 
158
    @Override
 
159
    public native void finalize() throws Throwable;
 
160
 
 
161
    /*
 
162
     * Wrapped private native implementation declarations.
 
163
     */
 
164
    private native void nativeDispose();
 
165
    private static final native
 
166
        long nativeCreateInstance(RemoteSession session,
 
167
                                  Map<String, byte[]> revisionProperties,
 
168
                                  CommitCallback commitCallback,
 
169
                                  Set<Lock> lockTokens, boolean keepLocks,
 
170
                                  ISVNEditor.ProvideBaseCallback baseCB,
 
171
                                  ISVNEditor.ProvidePropsCallback propsCB,
 
172
                                  ISVNEditor.GetNodeKindCallback kindCB)
 
173
            throws ClientException;
 
174
}