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

« back to all changes in this revision

Viewing changes to subversion/bindings/javahl/native/EditorCallbacks.hpp

  • 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
#ifndef SVN_JAVAHL_EDITOR_CALLBACKS_HPP
 
25
#define SVN_JAVAHL_EDITOR_CALLBACKS_HPP
 
26
 
 
27
#include "svn_io.h"
 
28
 
 
29
#include "Pool.h"
 
30
 
 
31
#include "jniwrapper/jni_object.hpp"
 
32
 
 
33
namespace JavaHL {
 
34
 
 
35
/**
 
36
 * Object wrapper for the base contents callback interface in
 
37
 * @c org.apache.subversion.javahl.ISVNEditor.
 
38
 *
 
39
 * @since New in 1.9.
 
40
 */
 
41
class ProvideBaseCallback : public ::Java::Object
 
42
{
 
43
public:
 
44
  /**
 
45
   * Constructs a wrapper around @a jthis.
 
46
   * The constructor does not verify the class of the wrapped object.
 
47
   */
 
48
  explicit ProvideBaseCallback(::Java::Env env, jobject jthis)
 
49
    : ::Java::Object(env,
 
50
                     ::Java::ClassCache::get_editor_provide_base_cb(env),
 
51
                     jthis)
 
52
    {}
 
53
 
 
54
  /**
 
55
   * Invokes the callback.
 
56
   */
 
57
  jobject operator()(jstring relpath) const
 
58
    {
 
59
      return m_env.CallObjectMethod(m_jthis, impl().m_mid_get_contents,
 
60
                                    relpath);
 
61
    }
 
62
 
 
63
  class ReturnValue : public ::Java::Object
 
64
  {
 
65
  public:
 
66
    /**
 
67
     * Constructs a wrapper around @a jthis.
 
68
     * The constructor does not verify the class of the wrapped object.
 
69
     */
 
70
    explicit ReturnValue(::Java::Env env, jobject jthis)
 
71
      : Java::Object(env,
 
72
                     ::Java::ClassCache::get_editor_provide_base_cb_ret(env),
 
73
                     jthis)
 
74
      {}
 
75
 
 
76
    /**
 
77
     * Returns an @c svn_stream_t for the contents stream in the
 
78
     * wrapped return value, allocated from @a pool. The wrapped Java
 
79
     * stream will live as long as @a pool.
 
80
     */
 
81
    svn_stream_t* get_global_stream(apr_pool_t* pool) const;
 
82
 
 
83
    /**
 
84
     * Returns an @c svn_stream_t for the contents stream in the
 
85
     * wrapped return value, allocated from @a pool. The wrapped Java
 
86
     * stream will live as long as @a pool.
 
87
     */
 
88
    svn_stream_t* get_global_stream(const SVN::Pool& pool) const
 
89
      {
 
90
        return get_global_stream(pool.getPool());
 
91
      }
 
92
 
 
93
    /**
 
94
     * Returns the revision in the wrapped return value.
 
95
     */
 
96
    jlong get_revision() const
 
97
      {
 
98
        return m_env.GetLongField(m_jthis, impl().m_fid_revision);
 
99
      }
 
100
 
 
101
  private:
 
102
    /**
 
103
     * This object's implementation details.
 
104
     */
 
105
    class ClassImpl : public Object::ClassImpl
 
106
    {
 
107
      friend class ::Java::ClassCacheImpl;
 
108
 
 
109
    protected:
 
110
      explicit ClassImpl(::Java::Env env, jclass cls);
 
111
 
 
112
    public:
 
113
      virtual ~ClassImpl();
 
114
 
 
115
      const ::Java::FieldID m_fid_contents;
 
116
      const ::Java::FieldID m_fid_revision;
 
117
    };
 
118
 
 
119
    const ClassImpl& impl() const
 
120
      {
 
121
        return *dynamic_cast<const ClassImpl*>(m_impl);
 
122
      }
 
123
 
 
124
    friend class ::Java::ClassCacheImpl;
 
125
    static const char* const m_class_name;
 
126
  };
 
127
 
 
128
private:
 
129
  /**
 
130
   * This object's implementation details.
 
131
   */
 
132
  class ClassImpl : public Object::ClassImpl
 
133
  {
 
134
    friend class ::Java::ClassCacheImpl;
 
135
 
 
136
  protected:
 
137
    explicit ClassImpl(::Java::Env env, jclass cls);
 
138
 
 
139
  public:
 
140
    virtual ~ClassImpl();
 
141
 
 
142
    const ::Java::MethodID m_mid_get_contents;
 
143
  };
 
144
 
 
145
  const ClassImpl& impl() const
 
146
    {
 
147
      return *dynamic_cast<const ClassImpl*>(m_impl);
 
148
    }
 
149
 
 
150
  friend class ::Java::ClassCacheImpl;
 
151
  static const char* const m_class_name;
 
152
};
 
153
 
 
154
 
 
155
/**
 
156
 * Object wrapper for the props callback interface in
 
157
 * @c org.apache.subversion.javahl.ISVNEditor.
 
158
 *
 
159
 * @since New in 1.9.
 
160
 */
 
161
class ProvidePropsCallback : public ::Java::Object
 
162
{
 
163
public:
 
164
  /**
 
165
   * Constructs a wrapper around @a jthis.
 
166
   * The constructor does not verify the class of the wrapped object.
 
167
   */
 
168
  explicit ProvidePropsCallback(::Java::Env env, jobject jthis)
 
169
    : ::Java::Object(env,
 
170
                     ::Java::ClassCache::get_editor_provide_props_cb(env),
 
171
                     jthis)
 
172
    {}
 
173
 
 
174
  /**
 
175
   * Invokes the callback.
 
176
   */
 
177
  jobject operator()(jstring relpath) const
 
178
    {
 
179
      return m_env.CallObjectMethod(m_jthis, impl().m_mid_get_props, relpath);
 
180
    }
 
181
 
 
182
  class ReturnValue : public ::Java::Object
 
183
  {
 
184
  public:
 
185
    /**
 
186
     * Constructs a wrapper around @a jthis.
 
187
     * The constructor does not verify the class of the wrapped object.
 
188
     */
 
189
    explicit ReturnValue(::Java::Env env, jobject jthis)
 
190
      : Java::Object(env,
 
191
                     ::Java::ClassCache::get_editor_provide_props_cb_ret(env),
 
192
                     jthis)
 
193
      {}
 
194
 
 
195
    /**
 
196
     * Returns an @c apr_hash_t of the node properties in the wrapped
 
197
     * return value, allocated from @a pool.
 
198
     */
 
199
    apr_hash_t* get_property_hash(apr_pool_t* pool) const;
 
200
 
 
201
    /**
 
202
     * Returns an @c apr_hash_t of the node properties in the wrapped
 
203
     * return value, allocated from @a pool.
 
204
     */
 
205
    apr_hash_t* get_property_hash(const SVN::Pool& pool) const
 
206
      {
 
207
        return get_property_hash(pool.getPool());
 
208
      }
 
209
 
 
210
    /**
 
211
     * Returns the revision in the wrapped return value.
 
212
     */
 
213
    jlong get_revision() const
 
214
      {
 
215
        return m_env.GetLongField(m_jthis, impl().m_fid_revision);
 
216
      }
 
217
 
 
218
  private:
 
219
    /**
 
220
     * This object's implementation details.
 
221
     */
 
222
    class ClassImpl : public Object::ClassImpl
 
223
    {
 
224
      friend class ::Java::ClassCacheImpl;
 
225
 
 
226
    protected:
 
227
      explicit ClassImpl(::Java::Env env, jclass cls);
 
228
 
 
229
    public:
 
230
      virtual ~ClassImpl();
 
231
 
 
232
      const ::Java::FieldID m_fid_properties;
 
233
      const ::Java::FieldID m_fid_revision;
 
234
    };
 
235
 
 
236
    const ClassImpl& impl() const
 
237
      {
 
238
        return *dynamic_cast<const ClassImpl*>(m_impl);
 
239
      }
 
240
 
 
241
    friend class ::Java::ClassCacheImpl;
 
242
    static const char* const m_class_name;
 
243
  };
 
244
 
 
245
private:
 
246
  /**
 
247
   * This object's implementation details.
 
248
   */
 
249
  class ClassImpl : public Object::ClassImpl
 
250
  {
 
251
    friend class ::Java::ClassCacheImpl;
 
252
 
 
253
  protected:
 
254
    explicit ClassImpl(::Java::Env env, jclass cls);
 
255
 
 
256
  public:
 
257
    virtual ~ClassImpl();
 
258
 
 
259
    const ::Java::MethodID m_mid_get_props;
 
260
  };
 
261
 
 
262
  const ClassImpl& impl() const
 
263
    {
 
264
      return *dynamic_cast<const ClassImpl*>(m_impl);
 
265
    }
 
266
 
 
267
  friend class ::Java::ClassCacheImpl;
 
268
  static const char* const m_class_name;
 
269
};
 
270
 
 
271
 
 
272
/**
 
273
 * Object wrapper for the kind callback interface in
 
274
 * @c org.apache.subversion.javahl.ISVNEditor.
 
275
 *
 
276
 * @since New in 1.9.
 
277
 */
 
278
class GetNodeKindCallback : public ::Java::Object
 
279
{
 
280
public:
 
281
  /**
 
282
   * Constructs a wrapper around @a jthis.
 
283
   * The constructor does not verify the class of the wrapped object.
 
284
   */
 
285
  explicit GetNodeKindCallback(::Java::Env env, jobject jthis)
 
286
    : ::Java::Object(env,
 
287
                     ::Java::ClassCache::get_editor_get_kind_cb(env),
 
288
                     jthis)
 
289
    {}
 
290
 
 
291
  /**
 
292
   * Invokes the callback.
 
293
   */
 
294
  jobject operator()(jstring relpath, jlong revision) const
 
295
    {
 
296
      return m_env.CallObjectMethod(m_jthis, impl().m_mid_get_kind,
 
297
                                    relpath, revision);
 
298
    }
 
299
 
 
300
private:
 
301
  /**
 
302
   * This object's implementation details.
 
303
   */
 
304
  class ClassImpl : public Object::ClassImpl
 
305
  {
 
306
    friend class ::Java::ClassCacheImpl;
 
307
 
 
308
  protected:
 
309
    explicit ClassImpl(::Java::Env env, jclass cls);
 
310
 
 
311
  public:
 
312
    virtual ~ClassImpl();
 
313
 
 
314
    const ::Java::MethodID m_mid_get_kind;
 
315
  };
 
316
 
 
317
  const ClassImpl& impl() const
 
318
    {
 
319
      return *dynamic_cast<const ClassImpl*>(m_impl);
 
320
    }
 
321
 
 
322
  friend class ::Java::ClassCacheImpl;
 
323
  static const char* const m_class_name;
 
324
};
 
325
 
 
326
} // namespace JavaHL
 
327
 
 
328
#endif // SVN_JAVAHL_EDITOR_CALLBACKS_HPP