bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / jvmaccess / unovirtualmachine.hxx
blobefddbee3eeb039519ed0c822d1c7b23136985176
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_JVMACCESS_UNOVIRTUALMACHINE_HXX
21 #define INCLUDED_JVMACCESS_UNOVIRTUALMACHINE_HXX
23 #include <jvmaccess/jvmaccessdllapi.h>
24 #include <sal/config.h>
25 #include <salhelper/simplereferenceobject.hxx>
26 #include <rtl/ref.hxx>
28 namespace jvmaccess {
30 class VirtualMachine;
32 /** An encapsulating wrapper around a Java virtual machine and an appropriate
33 UNO class loader.
35 class JVMACCESS_DLLPUBLIC UnoVirtualMachine: public salhelper::SimpleReferenceObject {
36 public:
37 /** An exception indicating failure to create a UnoVirtualMachine.
39 class JVMACCESS_DLLPUBLIC CreationException final
41 public:
42 CreationException();
44 CreationException(CreationException const &);
46 ~CreationException();
48 CreationException & operator =(CreationException const &);
51 /** Create a wrapper around a Java virtual machine and an appropriate UNO
52 class loader.
54 @param virtualMachine
55 A Java virtual machine wrapper. Must not be null.
57 @param classLoader
58 A local or global JNI reference, relative to the given virtualMachine,
59 to an appropriate UNO class loader instance. Must not be null. This
60 parameter should be of type jobject, not void *, but the exact
61 definition of jobject is different for different JDK versions, so that
62 the mangled C++ name of the constructor would depend on the JDK version
63 used at compile time.
65 @exception CreationException
66 Thrown in case creation fails (due to a JNI problem).
68 UnoVirtualMachine(
69 rtl::Reference< jvmaccess::VirtualMachine > const & virtualMachine,
70 void * classLoader);
72 /** Get the Java virtual machine wrapper.
74 @return
75 The Java virtual machine wrapper. Will never be null.
77 const rtl::Reference< jvmaccess::VirtualMachine >& getVirtualMachine() const;
79 /** Get the UNO class loader.
81 @return
82 A global JNI reference to the UNO class loader. (The JNI reference must
83 not be deleted by client code.) Will never be null. This should be of
84 type jobject, not void *, but the exact definition of jobject is
85 different for different JDK versions, so that the mangled C++ name of
86 the function would depend on the JDK version used at compile time.
88 void * getClassLoader() const { return m_classLoader;}
90 private:
91 UnoVirtualMachine(UnoVirtualMachine const &) = delete;
92 UnoVirtualMachine& operator =(UnoVirtualMachine const &) = delete;
94 virtual ~UnoVirtualMachine() override;
96 rtl::Reference< jvmaccess::VirtualMachine > m_virtualMachine;
97 void * m_classLoader;
102 #endif
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */