/************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * *************************************************************/ import java.io.*; import com.sun.star.comp.helper.RegistryServiceFactory; import com.sun.star.comp.servicemanager.ServiceManager; import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.lang.XServiceInfo; import com.sun.star.lang.XComponent; import com.sun.star.bridge.XUnoUrlResolver; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XNameAccess; import com.sun.star.sdbc.*; import com.sun.star.sdbcx.Privilege; import com.sun.star.sdb.CommandType; import com.sun.star.sdb.XRowSetApproveBroadcaster; public class RowSet { private static XComponentContext xContext = null; private static XMultiComponentFactory xMCF = null; public static void main(String argv[]) throws java.lang.Exception { try { // get the remote office component context xContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); System.out.println("Connected to a running office ..."); xMCF = xContext.getServiceManager(); } catch( Exception e) { System.err.println("ERROR: can't get a component context from a running office ..."); e.printStackTrace(System.out); System.exit(1); } try{ showRowSetEvents(); showRowSetRowCount(); showRowSetPrivileges(); useRowSet(); } catch(com.sun.star.uno.Exception e) { System.err.println(e); e.printStackTrace(); } System.exit(0); } public static void printDataSources() throws com.sun.star.uno.Exception { // create a DatabaseContext and print all DataSource names XNameAccess xNameAccess = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class, xMCF.createInstanceWithContext("com.sun.star.sdb.DatabaseContext", xContext)); String aNames [] = xNameAccess.getElementNames(); for(int i=0;i