You have to wrap your Java-Class/Java-Application in an UNO-Component.
See the developer guide and the examples coming with it
to see how this is done using the make utility.
package at.bestsolution.oeush;
import com.sun.star.comp.loader.FactoryHelper;
import {%see com.sun.star.lang.XMultiComponentFactory};
import {%see com.sun.star.lang.XMultiServiceFactory};
import {%see com.sun.star.lang.XServiceInfo};
import {%see com.sun.star.lang.XSingleServiceFactory};
import com.sun.star.lib.uno.helper.WeakBase;
import {%see com.sun.star.registry.XRegistryKey};
import {%see com.sun.star.task.XJobExecutor};
import {%see com.sun.star.uno.XComponentContext};
/* Usage in OOBasic:
*
* Sub OracleReports
* Dim Service As Object
* Service = CreateUnoService("at.bestsolution.oeush.OracleReports")
* Service.trigger("")
* End Sub
*
* Registered using pkgchk
*/
public class OracleReports extends WeakBase implements {%see com.sun.star.lang.XServiceInfo|XServiceInfo}, {%see com.sun.star.task.XJobExecutor|XJobExecutor}
{
static final String __serviceName = "at.bestsolution.oeush.OracleReports";
private {%see com.sun.star.uno.XComponentContext|XComponentContext} _xComponentContext;
public OracleReports({%see com.sun.star.uno.XComponentContext|XComponentContext} xComponentContext){
_xComponentContext = xComponentContext;
}
// static component operations
public static {%see com.sun.star.lang.XSingleServiceFactory|XSingleServiceFactory} __getServiceFactory( String implName, {%see com.sun.star.lang.XMultiServiceFactory|XMultiServiceFactory} multiFactory, {%see com.sun.star.registry.XRegistryKey|XRegistryKey} regKey ) {
{%see com.sun.star.lang.XSingleServiceFactory|XSingleServiceFactory} xSingleServiceFactory = null;
if ( implName.equals( OracleReports.class.getName() ) ) {
xSingleServiceFactory = FactoryHelper.getServiceFactory( OracleReports.class, OracleReports.__serviceName, multiFactory, regKey );
}
return xSingleServiceFactory;
}
public static boolean __writeRegistryServiceInfo({%see com.sun.star.registry.XRegistryKey|XRegistryKey} regKey ) {
return FactoryHelper.writeRegistryServiceInfo(
OracleReports.class.getName(), OracleReports.__serviceName, regKey );
}
/*
* {@see com.sun.star.lang.XServiceInfo:getImplementationName}
*/
public String getImplementationName()
{
return getClass().getName();
}
/*
* {@see com.sun.star.lang.XServiceInfo:getSupportedServiceNames}
*/
public String[] getSupportedServiceNames()
{
String[] retValue= new String[0];
retValue[0] = __serviceName;
return retValue;
}
/*
* {@see com.sun.star.lang.XServiceInfo:supportsService}
*/
public boolean supportsService(String serviceName)
{
if ( serviceName.equals( __serviceName))
{
return true;
}
return false;
}
/*
* {@see com.sun.star.task.XJobExecutor:trigger}
*/
public void trigger(String event)
{
XMultiComponentFactory xMultiComponentFactory = _xComponentContext.getServiceManager();
// here you can call your java classes like you would without openoffice
}
}