public class JavaLoader
extends java.lang.Object
JavaLoader
class provides the functionality of the com.sun.star.loader.Java
service. Therefor the JavaLoader
activates external UNO components which are implemented in Java.
The loader is used by the ServiceManger
.
com.sun.star.loader.XImplementationLoader
,
com.sun.star.loader.Java
,
ServiceManager
,
com.sun.star.lang.ServiceManager
Modifier and Type | Field and Description |
---|---|
protected XMultiServiceFactory |
multiServiceFactory |
Constructor and Description |
---|
JavaLoader()
Creates a new instance of the
JavaLoader class. |
JavaLoader(XMultiServiceFactory factory)
Creates a new
JavaLoader object. |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
activate(java.lang.String implementationName,
java.lang.String implementationLoaderUrl,
java.lang.String locationUrl,
XRegistryKey xKey)
Provides a components factory.
|
java.lang.String |
getImplementationName()
Supplies the implementation name of the component.
|
static XSingleServiceFactory |
getServiceFactory(java.lang.String implName,
XMultiServiceFactory multiFactory,
XRegistryKey regKey)
Supplies the factory for the
JavaLoader |
java.lang.String[] |
getSupportedServiceNames()
Supplies a list of all service names supported by the component
|
void |
initialize(java.lang.Object[] args)
Unlike the original intention, the method could be called every time a new
com.sun.star.lang.XMultiServiceFactory should be set at the loader. |
boolean |
supportsService(java.lang.String serviceName)
Verifies if a given service is supported by the component.
|
boolean |
writeRegistryInfo(XRegistryKey regKey,
java.lang.String implementationLoaderUrl,
java.lang.String locationUrl)
Registers the component in a registry under a given root key.
|
static boolean |
writeRegistryServiceInfo(XRegistryKey regKey)
Registers the
JavaLoader at the registry. |
public JavaLoader()
JavaLoader
class.
public JavaLoader(XMultiServiceFactory factory)
JavaLoader
object. The specified com.sun.star.lang.XMultiServiceFactory
is the ServiceManager
service which can be deliviert to all components the JavaLoader
is
loading.
To set the MultiServiceFactory
you can use the com.sun.star.lang.XInitialization
interface, either.
factory
- the ServiceManager
com.sun.star.lang.ServiceManager
,
com.sun.star.lang.ServiceManager
,
com.sun.star.lang.XInitialization
public void initialize(java.lang.Object[] args) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException
com.sun.star.lang.XMultiServiceFactory
should be set at the loader.
args
- - the first parameter (args[0]) specifices the ServiceManager
com.sun.star.uno.Exception
com.sun.star.uno.RuntimeException
com.sun.star.lang.XInitialization
,
com.sun.star.lang.ServiceManager
public java.lang.String getImplementationName() throws com.sun.star.uno.RuntimeException
com.sun.star.uno.RuntimeException
com.sun.star.lang.XServiceInfo
public boolean supportsService(java.lang.String serviceName) throws com.sun.star.uno.RuntimeException
serviceName
- the name of the service that should be checkedcom.sun.star.uno.RuntimeException
com.sun.star.lang.XServiceInfo
public java.lang.String[] getSupportedServiceNames() throws com.sun.star.uno.RuntimeException
com.sun.star.uno.RuntimeException
com.sun.star.lang.XServiceInfo
public java.lang.Object activate(java.lang.String implementationName, java.lang.String implementationLoaderUrl, java.lang.String locationUrl, XRegistryKey xKey) throws CannotActivateFactoryException, com.sun.star.uno.RuntimeException
JavaLoader
tries to load the class first. If a loacation URL is given the
RegistrationClassFinder is used to load the class. Otherwise the class is loaded thru the Class.forName
method.
To get the factory the inspects the class for the optional static member functions __getServiceFactory resp.
getServiceFactory (DEPRECATED).
If the function can not be found a default factory @see ComponentFactoryWrapper will be created.
implementationName
- the implementation (class) name of the componentimplementationLoaderUrl
- the URL of the implementation loader. Not used.locationUrl
- points to an archive (JAR file) which contains a componentxKey
- CannotActivateFactoryException
com.sun.star.uno.RuntimeException
com.sun.star.lang.XImplementationLoader
,
com.sun.star.com.loader.RegistrationClassFinder
public boolean writeRegistryInfo(XRegistryKey regKey, java.lang.String implementationLoaderUrl, java.lang.String locationUrl) throws CannotRegisterImplementationException, com.sun.star.uno.RuntimeException
regKey
- the root key under that the component should be registred.implementationLoaderUrl
- specifies the loader, the component is loaded by.locationUrl
- points to an archive (JAR file) which contains a componentCannotRegisterImplementationException
com.sun.star.uno.RuntimeException
ComponentFactoryWrapper
public static XSingleServiceFactory getServiceFactory(java.lang.String implName, XMultiServiceFactory multiFactory, XRegistryKey regKey)
JavaLoader
implName
- the name of the desired componentmultiFactory
- the ServiceManager
is delivered to the factoryregKey
- not used - can be nullJavaLoader
public static boolean writeRegistryServiceInfo(XRegistryKey regKey)
JavaLoader
at the registry.
regKey
- root key under which the JavaLoader
should be regidstered