log.println( "creating a test environment" );
XInterface oObj = null;
XDispatchProvider aProv = (XDispatchProvider)
UnoRuntime.queryInterface(XDispatchProvider.class,xDesk);
XDispatch getting = null;
XMultiServiceFactory xMSF = (XMultiServiceFactory) Param.getMSF();
XNameAccess xNameAccess = null;
// we use the first datasource
XDataSource xDS = null;
try {
xNameAccess = (XNameAccess) UnoRuntime.queryInterface(
XNameAccess.class,
xMSF.createInstance("com.sun.star.sdb.DatabaseContext"));
} catch (Exception ex) {
ex.printStackTrace( log );
throw new StatusException( "Could not get Databasecontext", ex );
}
try {
xDS = (XDataSource) UnoRuntime.queryInterface(
XDataSource.class, xNameAccess.getByName( "Bibliography" ));
} catch (NoSuchElementException ex) {
ex.printStackTrace( log );
throw new StatusException( "Could not get XDataSource", ex );
} catch (WrappedTargetException ex) {
ex.printStackTrace( log );
throw new StatusException( "Could not get XDataSource", ex );
}
try {
xNameAccess = (XNameAccess) UnoRuntime.queryInterface(
XNameAccess.class,
xMSF.createInstance("com.sun.star.sdb.DatabaseContext"));
} catch (Exception ex) {
ex.printStackTrace( log );
throw new StatusException( "Could not get DatabaseConext", ex );
}
log.println("check XMultiServiceFactory");
try {
xConn = xDS.getConnection(new String(), new String());
} catch (SQLException ex) {
ex.printStackTrace( log );
throw new StatusException( "Could not get XConnection", ex );
}
log.println( "opening QueryDesign" );
URL the_url = new URL();
the_url.Complete = ".component:DB/QueryDesign";
getting = aProv.queryDispatch(the_url,"Query",12);
PropertyValue[] Args = new PropertyValue[2];
PropertyValue param1 = new PropertyValue();
param1.Name = "DataSourceName";
param1.Value = "Bibliography";
Args[0] = param1;