Top Description Fields Constructors Methods
com.sun.star.comp.loader

public Class JavaLoader

extends Object
implements com.sun.star.loader.XImplementationLoader, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XInitialization
Class Inheritance
Imports
java.lang.reflect.Method, .InvocationTargetException, java.net.URLDecoder, com.sun.star.loader.CannotActivateFactoryException, com.sun.star.loader.XImplementationLoader, com.sun.star.registry.CannotRegisterImplementationException, com.sun.star.registry.XRegistryKey, com.sun.star.lang.XSingleComponentFactory, com.sun.star.lang.XSingleServiceFactory, com.sun.star.lang.XMultiServiceFactory, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XInitialization, com.sun.star.uno.XComponentContext, com.sun.star.beans.XPropertySet, com.sun.star.util.XMacroExpander, com.sun.star.uno.Type, .UnoRuntime, .AnyConverter, com.sun.star.lib.util.StringHelper

The 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 ServiceManager.

Since
UDK1.0
See Also
com.sun.star.loader.XImplementationLoader, com.sun.star.loader.Java, com.sun.star.comp.servicemanager.ServiceManager

Field Summary

Modifier and TypeField and Description
private static final boolean
private static final String
private com.sun.star.util.XMacroExpander
protected com.sun.star.lang.XMultiServiceFactory
private static String[]

Constructor Summary

AccessConstructor and Description
public
JavaLoader()

Default constructor.

public
JavaLoader(com.sun.star.lang.XMultiServiceFactory
the ServiceManager.
factory
)

Creates a new JavaLoader object.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

the factory for the component com.sun.star.lang.XSingleServiceFactory
activate
(String
the implementation (class) name of the component.
implementationName
,
String
the URL of the implementation loader. Not used.
implementationLoaderUrl
,
String
points to an archive (JAR file) which contains a component.
locationUrl
,
com.sun.star.registry.XRegistryKey
registry key.
xKey
)

Provides a components factory.

private static final void
private String
expand_url(String url)

Expands macrofied url using the macro expander singleton.

public String

Returns:

the implementation name - here the class name.
getImplementationName
()

Supplies the implementation name of the component.

public static com.sun.star.lang.XSingleServiceFactory

Returns:

the factory for the JavaLoader.
getServiceFactory
(String
the name of the desired component.
implName
,
com.sun.star.lang.XMultiServiceFactory
the ServiceManager is delivered to the factory.
multiFactory
,
com.sun.star.registry.XRegistryKey
not used - can be null.
regKey
)

Supplies the factory for the JavaLoader.

public String[]

Returns:

a String array with all supported services.
getSupportedServiceNames
()

Supplies a list of all service names supported by the component.

public void
initialize(Object[]
- the first parameter (args[0]) specifies the ServiceManager.
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.

public boolean

Returns:

true,if service is supported - otherwise false.
supportsService
(String
the name of the service that should be checked.
serviceName
)

Verifies if a given service is supported by the component.

public boolean

Returns:

true if registration is successfully - otherwise false.
writeRegistryInfo
(com.sun.star.registry.XRegistryKey
the root key under that the component should be registered.
regKey
,
String
specifies the loader, the component is loaded by.
implementationLoaderUrl
,
String
points to an archive (JAR file) which contains a component.
locationUrl
)

Registers the component in a registry under a given root key.

public static boolean

Returns:

true if registration succeeded - otherwise false.
writeRegistryServiceInfo
(com.sun.star.registry.XRegistryKey
root key under which the JavaLoader should be registered.
regKey
)

Registers the JavaLoader at the registry.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEBUGback to summary
private static final boolean DEBUG
EXPAND_PROTOCOL_PREFIXback to summary
private static final String EXPAND_PROTOCOL_PREFIX
m_xMacroExpanderback to summary
private com.sun.star.util.XMacroExpander m_xMacroExpander
multiServiceFactoryback to summary
protected com.sun.star.lang.XMultiServiceFactory multiServiceFactory
supportedServicesback to summary
private static String[] supportedServices

Constructor Detail

JavaLoaderback to summary
public JavaLoader()

Default constructor.

Creates a new instance of the JavaLoader class.

JavaLoaderback to summary
public JavaLoader(com.sun.star.lang.XMultiServiceFactory factory)

Creates a new 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.

Parameters
factory:com.sun.star.lang.XMultiServiceFactory

the ServiceManager.

See Also
com.sun.star.comp.servicemanager.ServiceManager, com.sun.star.lang.XInitialization

Method Detail

activateback to summary
public 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

Provides a components factory.

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).

Parameters
implementationName:String

the implementation (class) name of the component.

implementationLoaderUrl:String

the URL of the implementation loader. Not used.

locationUrl:String

points to an archive (JAR file) which contains a component.

xKey:com.sun.star.registry.XRegistryKey

registry key.

Returns:Object

the factory for the component com.sun.star.lang.XSingleServiceFactory

See Also
com.sun.star.loader.XImplementationLoader, com.sun.star.comp.loader.RegistrationClassFinder
DEBUGback to summary
private static final void DEBUG(String dbg)
expand_urlback to summary
private String expand_url(String url) throws RuntimeException

Expands macrofied url using the macro expander singleton.

getImplementationNameback to summary
public String getImplementationName() throws com.sun.star.uno.RuntimeException

Supplies the implementation name of the component.

Returns:String

the implementation name - here the class name.

See Also
com.sun.star.lang.XServiceInfo
getServiceFactoryback to summary
public 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.

Parameters
implName:String

the name of the desired component.

multiFactory:com.sun.star.lang.XMultiServiceFactory

the ServiceManager is delivered to the factory.

regKey:com.sun.star.registry.XRegistryKey

not used - can be null.

Returns:com.sun.star.lang.XSingleServiceFactory

the factory for the JavaLoader.

getSupportedServiceNamesback to summary
public String[] getSupportedServiceNames() throws com.sun.star.uno.RuntimeException

Supplies a list of all service names supported by the component.

Returns:String[]

a String array with all supported services.

See Also
com.sun.star.lang.XServiceInfo
initializeback to summary
public void initialize(Object[] args) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException

Unlike the original intention, the method could be called every time a new com.sun.star.lang.XMultiServiceFactory should be set at the loader.

Parameters
args:Object[]

- the first parameter (args[0]) specifies the ServiceManager.

See Also
com.sun.star.lang.XInitialization, com.sun.star.comp.servicemanager.ServiceManager
supportsServiceback to summary
public boolean supportsService(String serviceName) throws com.sun.star.uno.RuntimeException

Verifies if a given service is supported by the component.

Parameters
serviceName:String

the name of the service that should be checked.

Returns:boolean

true,if service is supported - otherwise false.

See Also
com.sun.star.lang.XServiceInfo
writeRegistryInfoback to summary
public boolean writeRegistryInfo(com.sun.star.registry.XRegistryKey regKey, String implementationLoaderUrl, String locationUrl) throws com.sun.star.registry.CannotRegisterImplementationException, com.sun.star.uno.RuntimeException

Registers the component in a registry under a given root key.

If the component supports the optional methods __writeRegistryServiceInfo, writeRegistryServiceInfo (DEPRECATED), the call is delegated to that method. Otherwise a default registration will be accomplished.

Parameters
regKey:com.sun.star.registry.XRegistryKey

the root key under that the component should be registered.

implementationLoaderUrl:String

specifies the loader, the component is loaded by.

locationUrl:String

points to an archive (JAR file) which contains a component.

Returns:boolean

true if registration is successfully - otherwise false.

writeRegistryServiceInfoback to summary
public static boolean writeRegistryServiceInfo(com.sun.star.registry.XRegistryKey regKey)

Registers the JavaLoader at the registry.

Parameters
regKey:com.sun.star.registry.XRegistryKey

root key under which the JavaLoader should be registered.

Returns:boolean

true if registration succeeded - otherwise false.