1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package com.sun.star.comp.test.deployment.passive_java; 25 26 import com.sun.star.frame.DispatchDescriptor; 27 import com.sun.star.frame.XDispatch; 28 import com.sun.star.frame.XDispatchProvider; 29 import com.sun.star.lang.XServiceInfo; 30 import com.sun.star.lib.uno.helper.WeakBase; 31 import com.sun.star.uno.UnoRuntime; 32 import com.sun.star.uno.XComponentContext; 33 import com.sun.star.util.URL; 34 35 public final class Provider extends WeakBase 36 implements XServiceInfo, XDispatchProvider 37 { Provider(XComponentContext context)38 public Provider(XComponentContext context) { 39 this.context = context; 40 } 41 getImplementationName()42 public String getImplementationName() { return implementationName; } 43 supportsService(String ServiceName)44 public boolean supportsService(String ServiceName) { 45 return ServiceName.equals(getSupportedServiceNames()[0]); //TODO 46 } 47 getSupportedServiceNames()48 public String[] getSupportedServiceNames() { 49 return serviceNames; 50 } 51 queryDispatch( URL URL, String TargetFrameName, int SearchFlags)52 public XDispatch queryDispatch( 53 URL URL, String TargetFrameName, int SearchFlags) 54 { 55 return UnoRuntime.queryInterface( 56 XDispatch.class, 57 context.getValueByName( 58 "/singletons/" + 59 "com.sun.star.test.deployment.passive_java_singleton")); 60 } 61 queryDispatches(DispatchDescriptor[] Requests)62 public XDispatch[] queryDispatches(DispatchDescriptor[] Requests) { 63 XDispatch[] s = new XDispatch[Requests.length]; 64 for (int i = 0; i < s.length; ++i) { 65 s[i] = queryDispatch( 66 Requests[i].FeatureURL, Requests[i].FrameName, 67 Requests[i].SearchFlags); 68 } 69 return s; 70 } 71 72 private final XComponentContext context; 73 74 static final String implementationName = 75 "com.sun.star.comp.test.deployment.passive_java"; 76 77 static final String[] serviceNames = new String[] { 78 "com.sun.star.test.deployment.passive_java" }; 79 } 80