| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 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; |
| 23 |
import java.io.*; |
| 24 |
import java.net.*; |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
public class TestComponent implements XServiceInfo, XTypeProvider |
| 44 |
{ |
| 45 |
public static final String __serviceName="JavaTestComponent"; |
| 46 |
|
| 47 |
|
| 48 |
public com.sun.star.uno.Type[] getTypes( ) |
| 49 |
{ |
| 50 |
Type[] retValue= new Type[2]; |
| 51 |
retValue[0]= new Type( XServiceInfo.class); |
| 52 |
retValue[1]= new Type( XTypeProvider.class); |
| 53 |
return retValue; |
| 54 |
} |
| 55 |
|
| 56 |
public byte[] getImplementationId( ) |
| 57 |
{ |
| 58 |
return new byte[0]; |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
public String getImplementationName( ) |
| 64 |
{ |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
File f= new File("c:/temp/javasecurity.txt"); |
| 69 |
try { |
| 70 |
f.createNewFile(); |
| 71 |
|
| 72 |
|
| 73 |
URL url= new URL("http://localhost:8080/index.html"); |
| 74 |
url.openStream(); |
| 75 |
|
| 76 |
url= new URL("http://www.w3.org/index.html"); |
| 77 |
url.openStream(); |
| 78 |
}catch( MalformedURLException mue) { |
| 79 |
}catch( IOException e) { |
| 80 |
String s= e.getMessage(); |
| 81 |
System.out.println(s); |
| 82 |
} |
| 83 |
|
| 84 |
return __serviceName; |
| 85 |
} |
| 86 |
|
| 87 |
public boolean supportsService( String ServiceName ) |
| 88 |
{ |
| 89 |
|
| 90 |
return false; |
| 91 |
} |
| 92 |
|
| 93 |
|
| 94 |
public String[] getSupportedServiceNames( ) |
| 95 |
{ |
| 96 |
String[] retValue= new String[0]; |
| 97 |
return retValue; |
| 98 |
} |
| 99 |
|
| 100 |
public static XSingleServiceFactory __getServiceFactory(String implName, |
| 101 |
XMultiServiceFactory multiFactory, |
| 102 |
XRegistryKey regKey) |
| 103 |
{ |
| 104 |
XSingleServiceFactory xSingleServiceFactory = null; |
| 105 |
|
| 106 |
if (implName.equals( TestComponent.class.getName()) ) |
| 107 |
xSingleServiceFactory = FactoryHelper.getServiceFactory( TestComponent.class, |
| 108 |
TestComponent.__serviceName, |
| 109 |
multiFactory, |
| 110 |
regKey); |
| 111 |
|
| 112 |
return xSingleServiceFactory; |
| 113 |
} |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) |
| 124 |
{ |
| 125 |
return FactoryHelper.writeRegistryServiceInfo( TestComponent.class.getName(), |
| 126 |
TestComponent.__serviceName, regKey); |
| 127 |
} |
| 128 |
|
| 129 |
} |