2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 import com
.sun
.star
.comp
.loader
.FactoryHelper
;
20 import com
.sun
.star
.lang
.*;
21 import com
.sun
.star
.uno
.*;
22 import com
.sun
.star
.registry
.XRegistryKey
;
25 //import com.sun.star.lib.sandbox.*;
28 /** This component implements XTypeProvider for use with StarBasic.
29 * The XServiceInfo is implemented to have an interface in which we can put some
30 * code just for the sake of debugging.
32 * To debug with JPDA (jdk 1.3), put these lines in the java.ini within the [Java] section:
34 * -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y
36 * When the Virtual Machine service is instantiated it will block until the debugger
37 * attaches to it on port 8000. You can chose a different port. You attach to the VM using
40 * jdb -connect com.sun.jdi.SocketAttach:hostname=myhost,port=8000
42 * myhost is the hostname where the VM is running.
44 public class TestComponent
implements XServiceInfo
, XTypeProvider
46 public static final String __serviceName
="JavaTestComponent";
49 public com
.sun
.star
.uno
.Type
[] getTypes( )
51 Type
[] retValue
= new Type
[2];
52 retValue
[0]= new Type( XServiceInfo
.class);
53 retValue
[1]= new Type( XTypeProvider
.class);
57 public byte[] getImplementationId( )
59 return TestComponent
.class.getName().getBytes();
64 public String
getImplementationName( )
66 String a
= "the functions are for debugging";
68 String prop
= System
.getProperty("ftp.proxyHost");
69 prop
= System
.getProperty("ftp.proxyPort");
70 prop
= System
.getProperty("http.proxyHost");
71 prop
= System
.getProperty("http.proxyPort");
72 prop
= System
.getProperty("ftp.nonProxyHosts");
73 prop
= System
.getProperty("http.nonProxyHosts");
74 prop
= System
.getProperty("socksProxyHost");
75 prop
= System
.getProperty("socksProxyPort");
77 prop
= System
.getProperty("stardiv.security.disableSecurity");
78 prop
= System
.getProperty("appletviewer.security.mode");
80 // Test security settings
81 File f
= new File("c:/temp/javasecurity.txt");
86 URL url
= new URL("http://localhost:8080/index.html");
87 InputStream is
= url
.openStream();
89 url
= new URL("http://www.w3.org/index.html");
91 }catch( MalformedURLException mue
) {
92 }catch( IOException e
) {
93 String s
= e
.getMessage();
94 System
.out
.println(s
);
95 }/*catch( SandboxSecurityException sse) {
96 String s= sse.getMessage();
97 System.out.println("s");
101 return __serviceName
;
104 public boolean supportsService( /*IN*/String ServiceName
)
111 public String
[] getSupportedServiceNames( )
113 String
[] retValue
= new String
[0];
117 public static XSingleServiceFactory
__getServiceFactory(String implName
,
118 XMultiServiceFactory multiFactory
,
121 XSingleServiceFactory xSingleServiceFactory
= null;
123 if (implName
.equals( TestComponent
.class.getName()) )
124 xSingleServiceFactory
= FactoryHelper
.getServiceFactory( TestComponent
.class,
125 TestComponent
.__serviceName
,
129 return xSingleServiceFactory
;
133 * Writes the service information into the given registry key.
134 * This method is called by the <code>JavaLoader</code>
136 * @return returns true if the operation succeeded
137 * @param regKey the registryKey
138 * @see com.sun.star.comp.loader.JavaLoader
140 public static boolean __writeRegistryServiceInfo(XRegistryKey regKey
)
142 return FactoryHelper
.writeRegistryServiceInfo( TestComponent
.class.getName(),
143 TestComponent
.__serviceName
, regKey
);