xref: /trunk/main/odk/examples/DevelopersGuide/Components/JavaComponent/TestComponentA.java (revision 3309286857f19787ae62bd793a98b5af4edd2ad3)
1*34dd1e25SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*34dd1e25SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*34dd1e25SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*34dd1e25SAndrew Rist  * distributed with this work for additional information
6*34dd1e25SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*34dd1e25SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*34dd1e25SAndrew Rist  * "License"); you may not use this file except in compliance
9*34dd1e25SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*34dd1e25SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*34dd1e25SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*34dd1e25SAndrew Rist  * software distributed under the License is distributed on an
15*34dd1e25SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*34dd1e25SAndrew Rist  * KIND, either express or implied.  See the License for the
17*34dd1e25SAndrew Rist  * specific language governing permissions and limitations
18*34dd1e25SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*34dd1e25SAndrew Rist  *************************************************************/
21*34dd1e25SAndrew Rist 
22*34dd1e25SAndrew Rist 
23cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory;
24cdf0e10cSrcweir import com.sun.star.lib.uno.helper.WeakBase;
25cdf0e10cSrcweir import com.sun.star.lang.XServiceInfo;
26cdf0e10cSrcweir import com.sun.star.test.XSomethingA;
27cdf0e10cSrcweir import com.sun.star.uno.Type;
28cdf0e10cSrcweir 
29cdf0e10cSrcweir // TestComponentA use the implementation helper WeakBase
30cdf0e10cSrcweir public class TestComponentA extends WeakBase implements XServiceInfo, XSomethingA {
31cdf0e10cSrcweir     static final String __serviceName= "com.sun.star.test.SomethingA";
32cdf0e10cSrcweir 
33cdf0e10cSrcweir     static byte[] _implementationId;
34cdf0e10cSrcweir 
TestComponentA()35cdf0e10cSrcweir     public TestComponentA() {
36cdf0e10cSrcweir     }
37cdf0e10cSrcweir 
38cdf0e10cSrcweir     // XSomethingA
methodOne(String val)39cdf0e10cSrcweir     public String methodOne(String val) {
40cdf0e10cSrcweir         return val;
41cdf0e10cSrcweir     }
42cdf0e10cSrcweir 
43cdf0e10cSrcweir     //XServiceInfo
getImplementationName( )44cdf0e10cSrcweir     public String getImplementationName(  ) {
45cdf0e10cSrcweir         return getClass().getName();
46cdf0e10cSrcweir     }
47cdf0e10cSrcweir     // XServiceInfo
supportsService( String serviceName )48cdf0e10cSrcweir     public boolean supportsService( /*IN*/String serviceName ) {
49cdf0e10cSrcweir         if ( serviceName.equals( __serviceName))
50cdf0e10cSrcweir             return true;
51cdf0e10cSrcweir         return false;
52cdf0e10cSrcweir     }
53cdf0e10cSrcweir     //XServiceInfo
getSupportedServiceNames( )54cdf0e10cSrcweir     public String[] getSupportedServiceNames(  ) {
55cdf0e10cSrcweir         String[] retValue= new String[0];
56cdf0e10cSrcweir         retValue[0]= __serviceName;
57cdf0e10cSrcweir         return retValue;
58cdf0e10cSrcweir     }
59cdf0e10cSrcweir 
60cdf0e10cSrcweir }
61