Kaydet (Commit) 9a362940 authored tarafından Noel Grandin's avatar Noel Grandin

fdo#46808, Adapt java::JavaVirtualMachine UNO service to new style

Change-Id: Ib0329b9cdc4290ce98c4182e8466c1b44b408341
üst 7841fd15
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <osl/interlck.h> #include <osl/interlck.h>
#include <jvmaccess/virtualmachine.hxx> #include <jvmaccess/virtualmachine.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/uno/XComponentContext.hpp>
#include "connectivity/dbtoolsdllapi.hxx" #include "connectivity/dbtoolsdllapi.hxx"
namespace com { namespace sun { namespace star { namespace util { namespace com { namespace sun { namespace star { namespace util {
...@@ -158,12 +158,12 @@ namespace connectivity ...@@ -158,12 +158,12 @@ namespace connectivity
/** creates a java virtual machine /** creates a java virtual machine
@param _rxFactory @param _rxContext
The ORB. The ORB.
@return @return
The JavaVM. The JavaVM.
*/ */
OOO_DLLPUBLIC_DBTOOLS ::rtl::Reference< jvmaccess::VirtualMachine > getJavaVM(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); OOO_DLLPUBLIC_DBTOOLS ::rtl::Reference< jvmaccess::VirtualMachine > getJavaVM(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext);
/** return <TRUE/> if the java class exists, otherwise <FALSE/>. /** return <TRUE/> if the java class exists, otherwise <FALSE/>.
@param _pJVM @param _pJVM
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <cppuhelper/interfacecontainer.h> #include <cppuhelper/interfacecontainer.h>
#include "TConnection.hxx" #include "TConnection.hxx"
#include <comphelper/types.hxx> #include <comphelper/types.hxx>
#include <com/sun/star/java/XJavaVM.hpp> #include <com/sun/star/java/JavaVirtualMachine.hpp>
#include <rtl/process.h> #include <rtl/process.h>
using namespace ::comphelper; using namespace ::comphelper;
...@@ -44,8 +44,8 @@ namespace connectivity ...@@ -44,8 +44,8 @@ namespace connectivity
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang; using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans; using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::java;
using namespace dbtools; using namespace dbtools;
namespace starjava = com::sun::star::java;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
const sal_Unicode CHAR_PLACE = '_'; const sal_Unicode CHAR_PLACE = '_';
const sal_Unicode CHAR_WILD = '%'; const sal_Unicode CHAR_WILD = '%';
...@@ -153,21 +153,16 @@ namespace connectivity ...@@ -153,21 +153,16 @@ namespace connectivity
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
::rtl::Reference< jvmaccess::VirtualMachine > getJavaVM(const Reference<XMultiServiceFactory >& _rxFactory) ::rtl::Reference< jvmaccess::VirtualMachine > getJavaVM(const Reference<XComponentContext >& _rxContext)
{ {
::rtl::Reference< jvmaccess::VirtualMachine > aRet; ::rtl::Reference< jvmaccess::VirtualMachine > aRet;
OSL_ENSURE(_rxFactory.is(),"No XMultiServiceFactory a.v.!"); OSL_ENSURE(_rxContext.is(),"No XMultiServiceFactory a.v.!");
if(!_rxFactory.is()) if(!_rxContext.is())
return aRet; return aRet;
try try
{ {
Reference< starjava::XJavaVM > xVM(_rxFactory->createInstance( Reference< XJavaVM > xVM = JavaVirtualMachine::create(_rxContext);
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.java.JavaVirtualMachine"))), UNO_QUERY);
OSL_ENSURE(_rxFactory.is(),"InitJava: I have no factory!");
if (!xVM.is() || !_rxFactory.is())
throw Exception(); // -2;
Sequence<sal_Int8> processID(16); Sequence<sal_Int8> processID(16);
rtl_getGlobalProcessId( (sal_uInt8*) processID.getArray() ); rtl_getGlobalProcessId( (sal_uInt8*) processID.getArray() );
......
...@@ -257,8 +257,9 @@ IMPLEMENT_SERVICE_INFO(java_sql_Connection,"com.sun.star.sdbcx.JConnection","com ...@@ -257,8 +257,9 @@ IMPLEMENT_SERVICE_INFO(java_sql_Connection,"com.sun.star.sdbcx.JConnection","com
jclass java_sql_Connection::theClass = 0; jclass java_sql_Connection::theClass = 0;
java_sql_Connection::java_sql_Connection( const java_sql_Driver& _rDriver ) java_sql_Connection::java_sql_Connection( const java_sql_Driver& _rDriver )
:java_lang_Object( _rDriver.getContext().getLegacyServiceFactory() ) :java_lang_Object()
,OSubComponent<java_sql_Connection, java_sql_Connection_BASE>((::cppu::OWeakObject*)(&_rDriver), this) ,OSubComponent<java_sql_Connection, java_sql_Connection_BASE>((::cppu::OWeakObject*)(&_rDriver), this)
,m_xContext( _rDriver.getContext().getUNOContext() )
,m_pDriver( &_rDriver ) ,m_pDriver( &_rDriver )
,m_pDriverobject(NULL) ,m_pDriverobject(NULL)
,m_pDriverClassLoader() ,m_pDriverClassLoader()
...@@ -772,7 +773,7 @@ sal_Bool java_sql_Connection::construct(const ::rtl::OUString& url, ...@@ -772,7 +773,7 @@ sal_Bool java_sql_Connection::construct(const ::rtl::OUString& url,
const Sequence< PropertyValue >& info) const Sequence< PropertyValue >& info)
{ {
{ // initialize the java vm { // initialize the java vm
::rtl::Reference< jvmaccess::VirtualMachine > xTest = java_lang_Object::getVM(getORB()); ::rtl::Reference< jvmaccess::VirtualMachine > xTest = java_lang_Object::getVM(m_xContext);
if ( !xTest.is() ) if ( !xTest.is() )
throwGenericSQLException(STR_NO_JAVA,*this); throwGenericSQLException(STR_NO_JAVA,*this);
} }
......
...@@ -50,11 +50,11 @@ using namespace ::com::sun::star::lang; ...@@ -50,11 +50,11 @@ using namespace ::com::sun::star::lang;
return s_VM; return s_VM;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
::rtl::Reference< jvmaccess::VirtualMachine > java_lang_Object::getVM(const Reference<XMultiServiceFactory >& _rxFactory) ::rtl::Reference< jvmaccess::VirtualMachine > java_lang_Object::getVM(const Reference<XComponentContext >& _rxContext)
{ {
::rtl::Reference< jvmaccess::VirtualMachine > xVM = getJavaVM2(); ::rtl::Reference< jvmaccess::VirtualMachine > xVM = getJavaVM2();
if ( !xVM.is() && _rxFactory.is() ) if ( !xVM.is() && _rxContext.is() )
xVM = getJavaVM2(::connectivity::getJavaVM(_rxFactory)); xVM = getJavaVM2(::connectivity::getJavaVM(_rxContext));
return xVM; return xVM;
} }
...@@ -101,8 +101,8 @@ jclass java_lang_Object::getMyClass() const ...@@ -101,8 +101,8 @@ jclass java_lang_Object::getMyClass() const
return theClass; return theClass;
} }
// the actual constructor // the actual constructor
java_lang_Object::java_lang_Object(const Reference<XMultiServiceFactory >& _rxFactory) java_lang_Object::java_lang_Object()
: m_xFactory(_rxFactory),object( 0 ) : object( 0 )
{ {
SDBThreadAttach::addRef(); SDBThreadAttach::addRef();
} }
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <osl/thread.h> #include <osl/thread.h>
#include <com/sun/star/sdbc/SQLException.hpp> #include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <jvmaccess/virtualmachine.hxx> #include <jvmaccess/virtualmachine.hxx>
#include <memory> #include <memory>
...@@ -72,9 +73,6 @@ namespace connectivity ...@@ -72,9 +73,6 @@ namespace connectivity
java_lang_Object& operator= (java_lang_Object&); java_lang_Object& operator= (java_lang_Object&);
java_lang_Object(java_lang_Object&); java_lang_Object(java_lang_Object&);
// Only to destroy the C++ pointer of Java objects derived from JSbxObject
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
protected: protected:
// The Java handle to this class // The Java handle to this class
jobject object; jobject object;
...@@ -90,7 +88,7 @@ namespace connectivity ...@@ -90,7 +88,7 @@ namespace connectivity
java_lang_Object( JNIEnv * pEnv, jobject myObj ); java_lang_Object( JNIEnv * pEnv, jobject myObj );
// The actual ctor // The actual ctor
java_lang_Object(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory=NULL); java_lang_Object();
virtual ~java_lang_Object(); virtual ~java_lang_Object();
...@@ -101,7 +99,6 @@ namespace connectivity ...@@ -101,7 +99,6 @@ namespace connectivity
void clearObject(); void clearObject();
virtual ::rtl::OUString toString() const; virtual ::rtl::OUString toString() const;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() { return m_xFactory; }
static void ThrowSQLException(JNIEnv * pEnv,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> & _rContext); static void ThrowSQLException(JNIEnv * pEnv,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> & _rContext);
static void ThrowLoggedSQLException( static void ThrowLoggedSQLException(
...@@ -110,7 +107,7 @@ namespace connectivity ...@@ -110,7 +107,7 @@ namespace connectivity
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext
); );
static ::rtl::Reference< jvmaccess::VirtualMachine > getVM(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory=NULL); static ::rtl::Reference< jvmaccess::VirtualMachine > getVM(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext=NULL);
static jclass findMyClass(const char* _pClassName); static jclass findMyClass(const char* _pClassName);
void obtainMethodId(JNIEnv* _pEnv, const char* _pMethodName, const char* _pSignature, jmethodID& _inout_MethodID) const; void obtainMethodId(JNIEnv* _pEnv, const char* _pMethodName, const char* _pSignature, jmethodID& _inout_MethodID) const;
......
...@@ -43,6 +43,7 @@ namespace connectivity ...@@ -43,6 +43,7 @@ namespace connectivity
public OAutoRetrievingBase public OAutoRetrievingBase
{ {
friend class OSubComponent<java_sql_Connection, java_sql_Connection_BASE>; friend class OSubComponent<java_sql_Connection, java_sql_Connection_BASE>;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
const java_sql_Driver* m_pDriver; const java_sql_Driver* m_pDriver;
jobject m_pDriverobject; jobject m_pDriverobject;
jdbc::GlobalRef< jobject > jdbc::GlobalRef< jobject >
......
...@@ -100,7 +100,7 @@ OXMLFileBasedDatabase::OXMLFileBasedDatabase( ODBFilter& rImport, ...@@ -100,7 +100,7 @@ OXMLFileBasedDatabase::OXMLFileBasedDatabase( ODBFilter& rImport,
} }
if ( !(sLocation.isEmpty() || sMediaType.isEmpty()) ) if ( !(sLocation.isEmpty() || sMediaType.isEmpty()) )
{ {
::dbaccess::ODsnTypeCollection aTypeCollection(comphelper::getComponentContext(rImport.getORB())); ::dbaccess::ODsnTypeCollection aTypeCollection(comphelper::getComponentContext(rImport.getServiceFactory()));
::rtl::OUString sURL(aTypeCollection.getDatasourcePrefixFromMediaType(sMediaType,sFileTypeExtension)); ::rtl::OUString sURL(aTypeCollection.getDatasourcePrefixFromMediaType(sMediaType,sFileTypeExtension));
sURL += sLocation; sURL += sLocation;
try try
......
...@@ -99,7 +99,7 @@ OXMLTable::OXMLTable( ODBFilter& _rImport ...@@ -99,7 +99,7 @@ OXMLTable::OXMLTable( ODBFilter& _rImport
aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Parent")); aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Parent"));
aValue.Value <<= m_xParentContainer; aValue.Value <<= m_xParentContainer;
aArguments[1] <<= aValue; aArguments[1] <<= aValue;
m_xTable.set(GetOwnImport().getORB()->createInstanceWithArguments(m_sServiceName,aArguments),UNO_QUERY); m_xTable.set(GetOwnImport().getServiceFactory()->createInstanceWithArguments(m_sServiceName,aArguments),UNO_QUERY);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
...@@ -83,8 +83,8 @@ namespace dbaxml ...@@ -83,8 +83,8 @@ namespace dbaxml
{ {
public: public:
typedef enum { E_JAVA, E_CALC } StartType; typedef enum { E_JAVA, E_CALC } StartType;
FastLoader(uno::Reference< lang::XMultiServiceFactory > const & _xFactory,StartType _eType) FastLoader(uno::Reference< uno::XComponentContext > const & _xContext,StartType _eType)
:m_xFactory(_xFactory) :m_xContext(_xContext)
,m_eWhat(_eType) ,m_eWhat(_eType)
{} {}
...@@ -95,7 +95,7 @@ namespace dbaxml ...@@ -95,7 +95,7 @@ namespace dbaxml
virtual void SAL_CALL run(); virtual void SAL_CALL run();
virtual void SAL_CALL onTerminated(); virtual void SAL_CALL onTerminated();
private: private:
uno::Reference< lang::XMultiServiceFactory > m_xFactory; uno::Reference< uno::XComponentContext > m_xContext;
StartType m_eWhat; StartType m_eWhat;
}; };
...@@ -109,7 +109,7 @@ namespace dbaxml ...@@ -109,7 +109,7 @@ namespace dbaxml
s_bFirstTime = false; s_bFirstTime = false;
try try
{ {
::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM(m_xFactory); ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM(m_xContext);
} }
catch (const uno::Exception&) catch (const uno::Exception&)
{ {
...@@ -125,7 +125,7 @@ namespace dbaxml ...@@ -125,7 +125,7 @@ namespace dbaxml
s_bFirstTime = false; s_bFirstTime = false;
try try
{ {
uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create( comphelper::getComponentContext(m_xFactory) ); uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create( m_xContext );
const ::rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank")); const ::rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank"));
sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE; sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE;
uno::Reference< frame::XFrame> xFrame = xDesktop->findFrame(sTarget,nFrameSearchFlag); uno::Reference< frame::XFrame> xFrame = xDesktop->findFrame(sTarget,nFrameSearchFlag);
...@@ -144,7 +144,7 @@ namespace dbaxml ...@@ -144,7 +144,7 @@ namespace dbaxml
aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hidden")); aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hidden"));
aArgs[nLen++].Value <<= sal_True; aArgs[nLen++].Value <<= sal_True;
::comphelper::MimeConfigurationHelper aHelper( comphelper::getComponentContext(m_xFactory) ); ::comphelper::MimeConfigurationHelper aHelper( m_xContext );
SvtModuleOptions aModuleOptions; SvtModuleOptions aModuleOptions;
uno::Reference< frame::XModel > xModel(xFrameLoad->loadComponentFromURL( uno::Reference< frame::XModel > xModel(xFrameLoad->loadComponentFromURL(
aModuleOptions.GetFactoryEmptyDocumentURL( aModuleOptions.ClassifyFactoryByServiceName( aHelper.GetDocServiceNameFromMediaType(MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET) )), aModuleOptions.GetFactoryEmptyDocumentURL( aModuleOptions.ClassifyFactoryByServiceName( aHelper.GetDocServiceNameFromMediaType(MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET) )),
...@@ -169,14 +169,14 @@ namespace dbaxml ...@@ -169,14 +169,14 @@ namespace dbaxml
class DatasourceURLListener : public ::cppu::WeakImplHelper1< beans::XPropertyChangeListener > class DatasourceURLListener : public ::cppu::WeakImplHelper1< beans::XPropertyChangeListener >
{ {
uno::Reference< lang::XMultiServiceFactory > m_xFactory; uno::Reference< uno::XComponentContext > m_xContext;
::dbaccess::ODsnTypeCollection m_aTypeCollection; ::dbaccess::ODsnTypeCollection m_aTypeCollection;
DatasourceURLListener(const DatasourceURLListener&); DatasourceURLListener(const DatasourceURLListener&);
void operator =(const DatasourceURLListener&); void operator =(const DatasourceURLListener&);
protected: protected:
virtual ~DatasourceURLListener(){} virtual ~DatasourceURLListener(){}
public: public:
DatasourceURLListener(uno::Reference< lang::XMultiServiceFactory > const & _xFactory) : m_xFactory(_xFactory),m_aTypeCollection(comphelper::getComponentContext(_xFactory)){} DatasourceURLListener(uno::Reference< uno::XComponentContext > const & _xContext) : m_xContext(_xContext), m_aTypeCollection(_xContext){}
// XPropertyChangeListener // XPropertyChangeListener
virtual void SAL_CALL propertyChange( const beans::PropertyChangeEvent& _rEvent ) throw (uno::RuntimeException) virtual void SAL_CALL propertyChange( const beans::PropertyChangeEvent& _rEvent ) throw (uno::RuntimeException)
{ {
...@@ -186,11 +186,11 @@ namespace dbaxml ...@@ -186,11 +186,11 @@ namespace dbaxml
if ( m_aTypeCollection.needsJVM(sURL) ) if ( m_aTypeCollection.needsJVM(sURL) )
{ {
pCreatorThread = new FastLoader(m_xFactory,FastLoader::E_JAVA); pCreatorThread = new FastLoader(m_xContext, FastLoader::E_JAVA);
} }
else if ( sURL.matchIgnoreAsciiCaseAsciiL("sdbc:calc:",10,0) ) else if ( sURL.matchIgnoreAsciiCaseAsciiL("sdbc:calc:",10,0) )
{ {
pCreatorThread = new FastLoader(m_xFactory,FastLoader::E_CALC); pCreatorThread = new FastLoader(m_xContext, FastLoader::E_CALC);
} }
if ( pCreatorThread ) if ( pCreatorThread )
{ {
...@@ -446,7 +446,7 @@ sal_Bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) ...@@ -446,7 +446,7 @@ sal_Bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
uno::Reference<sdb::XOfficeDatabaseDocument> xOfficeDoc(GetModel(),UNO_QUERY_THROW); uno::Reference<sdb::XOfficeDatabaseDocument> xOfficeDoc(GetModel(),UNO_QUERY_THROW);
m_xDataSource.set(xOfficeDoc->getDataSource(),UNO_QUERY_THROW); m_xDataSource.set(xOfficeDoc->getDataSource(),UNO_QUERY_THROW);
uno::Reference<beans::XPropertyChangeListener> xListener = new DatasourceURLListener(getServiceFactory()); uno::Reference<beans::XPropertyChangeListener> xListener = new DatasourceURLListener( comphelper::getComponentContext(getServiceFactory()));
m_xDataSource->addPropertyChangeListener(PROPERTY_URL,xListener); m_xDataSource->addPropertyChangeListener(PROPERTY_URL,xListener);
uno::Reference< XNumberFormatsSupplier > xNum(m_xDataSource->getPropertyValue(PROPERTY_NUMBERFORMATSSUPPLIER),UNO_QUERY); uno::Reference< XNumberFormatsSupplier > xNum(m_xDataSource->getPropertyValue(PROPERTY_NUMBERFORMATSSUPPLIER),UNO_QUERY);
SetNumberFormatsSupplier(xNum); SetNumberFormatsSupplier(xNum);
......
...@@ -124,7 +124,6 @@ public: ...@@ -124,7 +124,6 @@ public:
virtual void SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps); virtual void SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps);
virtual void SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aConfigProps); virtual void SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aConfigProps);
inline Reference< XMultiServiceFactory > getORB() { return getServiceFactory(); }
inline Reference<XPropertySet> getDataSource() const { return m_xDataSource; } inline Reference<XPropertySet> getDataSource() const { return m_xDataSource; }
inline const TPropertyNameMap& getQuerySettings() const { return m_aQuerySettings;} inline const TPropertyNameMap& getQuerySettings() const { return m_aQuerySettings;}
......
...@@ -318,7 +318,7 @@ namespace dbaui ...@@ -318,7 +318,7 @@ namespace dbaui
{ {
if ( !m_aJavaDriver.GetText().isEmpty() ) if ( !m_aJavaDriver.GetText().isEmpty() )
{ {
::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( Reference<XMultiServiceFactory>(m_pAdminDialog->getORB()->getServiceManager(), UNO_QUERY_THROW) ); ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( m_pAdminDialog->getORB() );
bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_aJavaDriver.GetText()); bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_aJavaDriver.GetText());
} }
} }
......
...@@ -557,7 +557,7 @@ DBG_NAME(OMySQLIntroPageSetup) ...@@ -557,7 +557,7 @@ DBG_NAME(OMySQLIntroPageSetup)
if ( !m_aETDriverClass.GetText().isEmpty() ) if ( !m_aETDriverClass.GetText().isEmpty() )
{ {
// TODO change jvmaccess // TODO change jvmaccess
::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( uno::Reference<lang::XMultiServiceFactory>(m_pAdminDialog->getORB()->getServiceManager(), uno::UNO_QUERY_THROW) ); ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( m_pAdminDialog->getORB() );
bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_aETDriverClass.GetText()); bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_aETDriverClass.GetText());
} }
} }
...@@ -677,7 +677,7 @@ DBG_NAME(OMySQLIntroPageSetup) ...@@ -677,7 +677,7 @@ DBG_NAME(OMySQLIntroPageSetup)
if ( !m_aETDriverClass.GetText().isEmpty() ) if ( !m_aETDriverClass.GetText().isEmpty() )
{ {
// TODO change jvmaccess // TODO change jvmaccess
::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( uno::Reference<lang::XMultiServiceFactory>(m_pAdminDialog->getORB()->getServiceManager(), uno::UNO_QUERY_THROW) ); ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( m_pAdminDialog->getORB() );
bSuccess = xJVM.is() && ::connectivity::existsJavaClassByName(xJVM,m_aETDriverClass.GetText()); bSuccess = xJVM.is() && ::connectivity::existsJavaClassByName(xJVM,m_aETDriverClass.GetText());
} }
} }
......
...@@ -627,7 +627,7 @@ namespace dbaui ...@@ -627,7 +627,7 @@ namespace dbaui
if ( !m_aEDDriverClass.GetText().isEmpty() ) if ( !m_aEDDriverClass.GetText().isEmpty() )
{ {
// TODO change jvmaccess // TODO change jvmaccess
::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( Reference<XMultiServiceFactory>(m_pAdminDialog->getORB()->getServiceManager(), UNO_QUERY_THROW) ); ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( m_pAdminDialog->getORB() );
bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_aEDDriverClass.GetText()); bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_aEDDriverClass.GetText());
} }
} }
......
...@@ -68,9 +68,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,udkapi,udkapi/com/sun/star/io,\ ...@@ -68,9 +68,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,udkapi,udkapi/com/sun/star/io,\
TextInputStream \ TextInputStream \
TextOutputStream \ TextOutputStream \
)) ))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,udkapi,udkapi/com/sun/star/java,\
JavaVirtualMachine \
))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,udkapi,udkapi/com/sun/star/lang,\ $(eval $(call gb_UnoApi_add_idlfiles_noheader,udkapi,udkapi/com/sun/star/lang,\
MultiServiceFactory \ MultiServiceFactory \
RegistryServiceManager \ RegistryServiceManager \
...@@ -122,6 +119,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,udkapi,udkapi/com/sun/star/io,\ ...@@ -122,6 +119,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,udkapi,udkapi/com/sun/star/io,\
SequenceOutputStream \ SequenceOutputStream \
TempFile \ TempFile \
)) ))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,udkapi,udkapi/com/sun/star/java,\
JavaVirtualMachine \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,udkapi,udkapi/com/sun/star/reflection,\ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,udkapi,udkapi/com/sun/star/reflection,\
theCoreReflection \ theCoreReflection \
ProxyFactory \ ProxyFactory \
......
...@@ -19,30 +19,19 @@ ...@@ -19,30 +19,19 @@
#ifndef __com_sun_star_java_JavaVirtualMachine_idl__ #ifndef __com_sun_star_java_JavaVirtualMachine_idl__
#define __com_sun_star_java_JavaVirtualMachine_idl__ #define __com_sun_star_java_JavaVirtualMachine_idl__
#include <com/sun/star/java/XJavaVM.idl>
module com { module sun { module star { module java { module com { module sun { module star { module java {
published interface XJavaVM;
published interface XJavaThreadRegister_11;
/** Exports interfaces to handle a Java VM.
// DocMerge from xml: service com::sun::star::java::JavaVirtualMachine
/** exports interfaces to handle a JavaVM and Java threads.
@deprecated @deprecated
A UNO service seems to be at the wrong abstraction level for this A UNO service seems to be at the wrong abstraction level for this
functionality. This should probably be replaced by an appropriate C/C++ functionality. This should probably be replaced by an appropriate C/C++
API. API.
*/ */
published service JavaVirtualMachine published service JavaVirtualMachine : XJavaVM;
{
// DocMerge: empty anyway
interface XJavaVM;
// DocMerge: empty anyway
interface XJavaThreadRegister_11;
};
}; }; }; }; }; }; }; };
......
...@@ -43,8 +43,7 @@ ...@@ -43,8 +43,7 @@
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <jvmaccess/virtualmachine.hxx> #include <jvmaccess/virtualmachine.hxx>
#include <com/sun/star/java/XJavaVM.hpp> #include <com/sun/star/java/JavaVirtualMachine.hpp>
#include <com/sun/star/java/XJavaThreadRegister_11.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
using namespace ::com::sun::star; using namespace ::com::sun::star;
...@@ -235,14 +234,14 @@ sal_IntPtr SystemChildWindow::GetParentWindowHandle( sal_Bool bUseJava ) ...@@ -235,14 +234,14 @@ sal_IntPtr SystemChildWindow::GetParentWindowHandle( sal_Bool bUseJava )
#ifdef SOLAR_JAVA #ifdef SOLAR_JAVA
else else
{ {
uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() ); uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
if( GetSystemData()->aWindow > 0 ) if( GetSystemData()->aWindow > 0 )
{ {
try try
{ {
::rtl::Reference< ::jvmaccess::VirtualMachine > xVM; ::rtl::Reference< ::jvmaccess::VirtualMachine > xVM;
uno::Reference< java::XJavaVM > xJavaVM( xFactory->createInstance( rtl::OUString("com.sun.star.java.JavaVirtualMachine") ), uno::UNO_QUERY ); uno::Reference< java::XJavaVM > xJavaVM = java::JavaVirtualMachine::create(xContext);;
uno::Sequence< sal_Int8 > aProcessID( 17 ); uno::Sequence< sal_Int8 > aProcessID( 17 );
rtl_getGlobalProcessId( (sal_uInt8*) aProcessID.getArray() ); rtl_getGlobalProcessId( (sal_uInt8*) aProcessID.getArray() );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment