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 * @file CommitCallback.h 24 * @brief Interface of the class CommitCallback 25 */ 26 27 #ifndef COMMITCALLBACK_H 28 #define COMMITCALLBACK_H 29 30 #include <jni.h> 31 #include "svn_client.h" 32 33 /** 34 * This class holds a Java callback object, which will receive every 35 * log message for which the callback information is requested. 36 */ 37 class CommitCallback 38 { 39 public: 40 CommitCallback(jobject jcallback); 41 ~CommitCallback(); 42 43 static svn_error_t *callback(const svn_commit_info_t *commit_info, 44 void *baton, 45 apr_pool_t *pool); 46 protected: 47 svn_error_t *commitInfo(const svn_commit_info_t *commit_info, 48 apr_pool_t *pool); 49 50 /** 51 * This a local reference to the Java object. 52 */ 53 jobject m_callback; 54 }; 55 56 /** 57 * Like CommitCallback, but maintains a reference to the Java object 58 * across JNI calls. 59 */ 60 class PersistentCommitCallback : protected CommitCallback 61 { 62 public: 63 PersistentCommitCallback(jobject jcallback); 64 ~PersistentCommitCallback(); callback(const svn_commit_info_t * commit_info,void * baton,apr_pool_t * pool)65 static svn_error_t *callback(const svn_commit_info_t *commit_info, 66 void *baton, apr_pool_t *pool) 67 { 68 return CommitCallback::callback(commit_info, baton, pool); 69 } 70 }; 71 72 #endif // COMMITCALLBACK_H 73