public class JavaLoader extends Object implements com.sun.star.loader.XImplementationLoader, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XInitialization
JavaLoader class provides the functionality of the
com.sun.star.loader.Java service.
Therefore the JavaLoader activates external UNO components
which are implemented in Java.
The loader is used by the ServiceManger.
XImplementationLoader,
Java,
ServiceManager| Modifier and Type | Field and Description |
|---|---|
protected com.sun.star.lang.XMultiServiceFactory |
multiServiceFactory |
| Constructor and Description |
|---|
JavaLoader()
Default constructor.
|
JavaLoader(com.sun.star.lang.XMultiServiceFactory factory)
Creates a new
JavaLoader object. |
| Modifier and Type | Method and Description |
|---|---|
Object |
activate(String implementationName,
String implementationLoaderUrl,
String locationUrl,
com.sun.star.registry.XRegistryKey xKey)
Provides a components factory.
|
String |
getImplementationName()
Supplies the implementation name of the component.
|
static com.sun.star.lang.XSingleServiceFactory |
getServiceFactory(String implName,
com.sun.star.lang.XMultiServiceFactory multiFactory,
com.sun.star.registry.XRegistryKey regKey)
Supplies the factory for the
JavaLoader. |
String[] |
getSupportedServiceNames()
Supplies a list of all service names supported by the component.
|
void |
initialize(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(String serviceName)
Verifies if a given service is supported by the component.
|
boolean |
writeRegistryInfo(com.sun.star.registry.XRegistryKey regKey,
String implementationLoaderUrl,
String locationUrl)
Registers the component in a registry under a given root key.
|
static boolean |
writeRegistryServiceInfo(com.sun.star.registry.XRegistryKey regKey)
Registers the
JavaLoader at the registry. |
protected com.sun.star.lang.XMultiServiceFactory multiServiceFactory
public JavaLoader()
Creates a new instance of the JavaLoader class.
public JavaLoader(com.sun.star.lang.XMultiServiceFactory factory)
JavaLoader object.
The specified com.sun.star.lang.XMultiServiceFactory is
the ServiceManager service which can be delivered 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.ServiceManager,
XInitializationpublic void initialize(Object[] args) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException
com.sun.star.lang.XMultiServiceFactory should be set at
the loader.initialize in interface com.sun.star.lang.XInitializationargs - - the first parameter (args[0]) specifies the ServiceManager.com.sun.star.uno.Exceptioncom.sun.star.uno.RuntimeExceptionXInitialization,
ServiceManagerpublic String getImplementationName() throws com.sun.star.uno.RuntimeException
getImplementationName in interface com.sun.star.lang.XServiceInfocom.sun.star.uno.RuntimeExceptionXServiceInfopublic boolean supportsService(String serviceName) throws com.sun.star.uno.RuntimeException
supportsService in interface com.sun.star.lang.XServiceInfoserviceName - the name of the service that should be checked.com.sun.star.uno.RuntimeExceptionXServiceInfopublic String[] getSupportedServiceNames() throws com.sun.star.uno.RuntimeException
getSupportedServiceNames in interface com.sun.star.lang.XServiceInfocom.sun.star.uno.RuntimeExceptionXServiceInfopublic Object activate(String implementationName, String implementationLoaderUrl, String locationUrl, com.sun.star.registry.XRegistryKey xKey) throws com.sun.star.loader.CannotActivateFactoryException, com.sun.star.uno.RuntimeException
The JavaLoader tries to load the class first. If a
location URL is given the RegistrationClassFinder is used to load the
class. Otherwise the class is loaded through the Class.forName method.
To get the factory the inspects the class for the optional static member functions __getServiceFactory resp. getServiceFactory (DEPRECATED).
activate in interface com.sun.star.loader.XImplementationLoaderimplementationName - the implementation (class) name of the component.implementationLoaderUrl - the URL of the implementation loader. Not used.locationUrl - points to an archive (JAR file) which contains a component.xKey - registry key.com.sun.star.loader.CannotActivateFactoryExceptioncom.sun.star.uno.RuntimeExceptionXImplementationLoader,
RegistrationClassFinderpublic boolean writeRegistryInfo(com.sun.star.registry.XRegistryKey regKey,
String implementationLoaderUrl,
String locationUrl)
throws com.sun.star.registry.CannotRegisterImplementationException,
com.sun.star.uno.RuntimeException
If the component supports the optional methods __writeRegistryServiceInfo, writeRegistryServiceInfo (DEPRECATED), the call is delegated to that method. Otherwise a default registration will be accomplished.
writeRegistryInfo in interface com.sun.star.loader.XImplementationLoaderregKey - 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 component.com.sun.star.registry.CannotRegisterImplementationExceptioncom.sun.star.uno.RuntimeExceptionpublic static com.sun.star.lang.XSingleServiceFactory getServiceFactory(String implName, com.sun.star.lang.XMultiServiceFactory multiFactory, com.sun.star.registry.XRegistryKey regKey)
JavaLoader.implName - the name of the desired component.multiFactory - the ServiceManager is delivered to the factory.regKey - not used - can be null.JavaLoader.public static boolean writeRegistryServiceInfo(com.sun.star.registry.XRegistryKey regKey)
JavaLoader at the registry.regKey - root key under which the JavaLoader should be registered.