# HG changeset patch # User Sebastien Jodogne <s.jodogne@gmail.com> # Date 1718356442 -7200 # Node ID 10406d66d1c61b633459b217b9046870011a4b97 # Parent 09f60b487512062b612c844600c3db47bf43f490 cppcheck diff -r 09f60b487512 -r 10406d66d1c6 JavaSDK/be/uclouvain/orthanc/Callbacks.java --- a/JavaSDK/be/uclouvain/orthanc/Callbacks.java Fri Jun 14 10:50:52 2024 +0200 +++ b/JavaSDK/be/uclouvain/orthanc/Callbacks.java Fri Jun 14 11:14:02 2024 +0200 @@ -30,13 +30,36 @@ * Wrapper around the callbacks provided by the Orthanc SDK. **/ public class Callbacks { + /** + * Callback to react to changes. + **/ public interface OnChange { + /** + * Signature of a callback function that is triggered when a + * change happens to some DICOM resource. + * @param changeType The type of change. + * @param resourceType The type of resource affected by this change. + * @param resourceId The identifier of the affected resource, if any. + **/ public void call(ChangeType changeType, ResourceType resourceType, String resourceId); } + /** + * Callback to serve a resource in the REST API. + **/ public interface OnRestRequest { + /** + * Signature of a callback function that answers a REST request. + * @param output Output containing the answer that is sent to the REST client. + * @param method The HTTP method. + * @param uri The URI, starting from the root of the Orthanc server. + * @param regularExpressionGroups The actual values of the groups matched by the regular expression. + * @param headers The HTTP headers of the request. + * @param getParameters The parameters of a GET request. + * @param body The body of the request (only applicable to POST and PUT methods). + **/ public void call(RestOutput output, HttpMethod method, String uri, @@ -46,8 +69,18 @@ byte[] body); } + /** + * Register a callback to monitor changes. + * @param callback The callback to handle the change. + **/ public static native void register(OnChange callback); + /** + * Register a REST callback. Note that the callback will NOT be + * invoked in mutual exclusion. + * @param pathRegularExpression Regular expression for the URI. May contain groups. + * @param callback The callback to handle the REST call. + **/ public static native void register(String pathRegularExpression, OnRestRequest callback); } diff -r 09f60b487512 -r 10406d66d1c6 NEWS --- a/NEWS Fri Jun 14 10:50:52 2024 +0200 +++ b/NEWS Fri Jun 14 11:14:02 2024 +0200 @@ -1,4 +1,6 @@ Pending changes in the mainline =============================== +=> Minimum SDK version: 1.10.0 <= + * Initial release diff -r 09f60b487512 -r 10406d66d1c6 Plugin/JavaEnvironment.cpp --- a/Plugin/JavaEnvironment.cpp Fri Jun 14 10:50:52 2024 +0200 +++ b/Plugin/JavaEnvironment.cpp Fri Jun 14 11:14:02 2024 +0200 @@ -123,8 +123,8 @@ { if (GetValue().ThrowNew(FindClass(fqn), message.c_str()) != 0) { - std::string message = "Cannot throw exception " + fqn; - OrthancPluginLogError(context_, message.c_str()); + std::string tmp = "Cannot throw exception " + fqn; + OrthancPluginLogError(context_, tmp.c_str()); } } diff -r 09f60b487512 -r 10406d66d1c6 Plugin/JavaEnvironment.h --- a/Plugin/JavaEnvironment.h Fri Jun 14 10:50:52 2024 +0200 +++ b/Plugin/JavaEnvironment.h Fri Jun 14 11:14:02 2024 +0200 @@ -38,9 +38,9 @@ JNIEnv *env_; public: - JavaEnvironment(JNIEnv* env); + explicit JavaEnvironment(JNIEnv* env); - JavaEnvironment(JavaVirtualMachine& jvm); + explicit JavaEnvironment(JavaVirtualMachine& jvm); ~JavaEnvironment(); diff -r 09f60b487512 -r 10406d66d1c6 Plugin/JavaVirtualMachine.h --- a/Plugin/JavaVirtualMachine.h Fri Jun 14 10:50:52 2024 +0200 +++ b/Plugin/JavaVirtualMachine.h Fri Jun 14 11:14:02 2024 +0200 @@ -35,7 +35,7 @@ JavaVM *jvm_; public: - JavaVirtualMachine(const std::string& classPath); + explicit JavaVirtualMachine(const std::string& classPath); ~JavaVirtualMachine(); diff -r 09f60b487512 -r 10406d66d1c6 Plugin/Mutex.h --- a/Plugin/Mutex.h Fri Jun 14 10:50:52 2024 +0200 +++ b/Plugin/Mutex.h Fri Jun 14 11:14:02 2024 +0200 @@ -47,7 +47,7 @@ Mutex& mutex_; public: - Locker(Mutex& mutex) : + explicit Locker(Mutex& mutex) : mutex_(mutex) { mutex_.Lock(); diff -r 09f60b487512 -r 10406d66d1c6 Plugin/OrthancString.h --- a/Plugin/OrthancString.h Fri Jun 14 10:50:52 2024 +0200 +++ b/Plugin/OrthancString.h Fri Jun 14 11:14:02 2024 +0200 @@ -33,7 +33,7 @@ char* str_; public: - OrthancString(char* str) : + explicit OrthancString(char* str) : str_(str) { }