134dd1e25SAndrew Rist /**************************************************************
2*002e2b2bSmseidel  *
334dd1e25SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
434dd1e25SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
534dd1e25SAndrew Rist  * distributed with this work for additional information
634dd1e25SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
734dd1e25SAndrew Rist  * to you under the Apache License, Version 2.0 (the
834dd1e25SAndrew Rist  * "License"); you may not use this file except in compliance
934dd1e25SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*002e2b2bSmseidel  *
1134dd1e25SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*002e2b2bSmseidel  *
1334dd1e25SAndrew Rist  * Unless required by applicable law or agreed to in writing,
1434dd1e25SAndrew Rist  * software distributed under the License is distributed on an
1534dd1e25SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1634dd1e25SAndrew Rist  * KIND, either express or implied.  See the License for the
1734dd1e25SAndrew Rist  * specific language governing permissions and limitations
1834dd1e25SAndrew Rist  * under the License.
19*002e2b2bSmseidel  *
2034dd1e25SAndrew Rist  *************************************************************/
2134dd1e25SAndrew Rist 
2234dd1e25SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir public class FirstConnection extends java.lang.Object {
25cdf0e10cSrcweir 
main(String[] args)26cdf0e10cSrcweir     public static void main(String[] args) {
27cdf0e10cSrcweir         try {
28cdf0e10cSrcweir             // get the remote office component context
29cdf0e10cSrcweir             com.sun.star.uno.XComponentContext xContext =
30cdf0e10cSrcweir                 com.sun.star.comp.helper.Bootstrap.bootstrap();
31cdf0e10cSrcweir 
32cdf0e10cSrcweir             System.out.println("Connected to a running office ...");
33*002e2b2bSmseidel 
34cdf0e10cSrcweir             com.sun.star.lang.XMultiComponentFactory xMCF =
35cdf0e10cSrcweir                 xContext.getServiceManager();
36cdf0e10cSrcweir 
37cdf0e10cSrcweir             String available = (null != xMCF ? "available" : "not available");
38cdf0e10cSrcweir             System.out.println( "remote ServiceManager is " + available );
39cdf0e10cSrcweir         }
40cdf0e10cSrcweir         catch (java.lang.Exception e){
41cdf0e10cSrcweir             e.printStackTrace();
42cdf0e10cSrcweir         }
43cdf0e10cSrcweir         finally {
44cdf0e10cSrcweir             System.exit(0);
45cdf0e10cSrcweir         }
46cdf0e10cSrcweir     }
47cdf0e10cSrcweir }
48