summaryrefslogtreecommitdiffstats
path: root/stoc/test/javavm/testcomponent
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /stoc/test/javavm/testcomponent
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--stoc/test/javavm/testcomponent/TestComponent.java129
-rw-r--r--stoc/test/javavm/testcomponent/makefile.mk45
-rw-r--r--stoc/test/javavm/testcomponent/manifest1
3 files changed, 175 insertions, 0 deletions
diff --git a/stoc/test/javavm/testcomponent/TestComponent.java b/stoc/test/javavm/testcomponent/TestComponent.java
new file mode 100644
index 000000000..d976323c5
--- /dev/null
+++ b/stoc/test/javavm/testcomponent/TestComponent.java
@@ -0,0 +1,129 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+import com.sun.star.comp.loader.FactoryHelper;
+import com.sun.star.lang.*;
+import com.sun.star.uno.*;
+import com.sun.star.registry.XRegistryKey;
+import java.io.*;
+import java.net.*;
+
+
+/** This component implements XTypeProvider for use with StarBasic.
+ * The XServiceInfo is implemented to have an interface in which we can put some
+ * code just for the sake of debugging.
+ *
+ * To debug with JPDA (jdk 1.3), put these lines in the java.ini within the [Java] section:
+ * -Xdebug
+ * -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y
+ *
+ * When the Virtual Machine service is instantiated it will block until the debugger
+ * attaches to it on port 8000. You can chose a different port. You attach to the VM using
+ * jdb by
+ *
+ * jdb -connect com.sun.jdi.SocketAttach:hostname=myhost,port=8000
+ *
+ * myhost is the hostname where the VM is running.
+*/
+public class TestComponent implements XServiceInfo, XTypeProvider
+{
+ public static final String __serviceName="JavaTestComponent";
+
+ // XTypeProvider
+ public com.sun.star.uno.Type[] getTypes( )
+ {
+ Type[] retValue= new Type[2];
+ retValue[0]= new Type( XServiceInfo.class);
+ retValue[1]= new Type( XTypeProvider.class);
+ return retValue;
+ }
+ // XTypeProvider
+ public byte[] getImplementationId( )
+ {
+ return new byte[0];
+ }
+
+
+ // XServiceName
+ public String getImplementationName( )
+ {
+ // the functions are for debugging
+
+ // Test security settings
+ File f= new File("c:/temp/javasecurity.txt");
+ try {
+ f.createNewFile();
+
+ // local connection
+ URL url= new URL("http://localhost:8080/index.html");
+ url.openStream();
+ // remote connection
+ url= new URL("http://www.w3.org/index.html");
+ url.openStream();
+ }catch( MalformedURLException mue) {
+ }catch( IOException e) {
+ String s= e.getMessage();
+ System.out.println(s);
+ }
+
+ return __serviceName;
+ }
+ // XServiceName
+ public boolean supportsService( /*IN*/String ServiceName )
+ {
+
+ return false;
+ }
+
+ //XServiceName
+ public String[] getSupportedServiceNames( )
+ {
+ String[] retValue= new String[0];
+ return retValue;
+ }
+
+ public static XSingleServiceFactory __getServiceFactory(String implName,
+ XMultiServiceFactory multiFactory,
+ XRegistryKey regKey)
+ {
+ XSingleServiceFactory xSingleServiceFactory = null;
+
+ if (implName.equals( TestComponent.class.getName()) )
+ xSingleServiceFactory = FactoryHelper.getServiceFactory( TestComponent.class,
+ TestComponent.__serviceName,
+ multiFactory,
+ regKey);
+
+ return xSingleServiceFactory;
+ }
+
+ /**
+ * Writes the service information into the given registry key.
+ * This method is called by the <code>JavaLoader</code>
+ * <p>
+ * @return returns true if the operation succeeded
+ * @param regKey the registryKey
+ * @see com.sun.star.comp.loader.JavaLoader
+ */
+ public static boolean __writeRegistryServiceInfo(XRegistryKey regKey)
+ {
+ return FactoryHelper.writeRegistryServiceInfo( TestComponent.class.getName(),
+ TestComponent.__serviceName, regKey);
+ }
+
+}
diff --git a/stoc/test/javavm/testcomponent/makefile.mk b/stoc/test/javavm/testcomponent/makefile.mk
new file mode 100644
index 000000000..89ae042ad
--- /dev/null
+++ b/stoc/test/javavm/testcomponent/makefile.mk
@@ -0,0 +1,45 @@
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This file incorporates work covered by the following license notice:
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership. The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.apache.org/licenses/LICENSE-2.0 .
+#
+
+PRJ=..$/..$/..
+
+PRJNAME = testcomponent
+PACKAGE =
+TARGET = JavaTestComponent
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# Files --------------------------------------------------------
+
+JARFILES = ridl.jar jurt.jar unoil.jar
+
+CUSTOMMANIFESTFILE= manifest
+
+JARTARGET = $(TARGET).jar
+
+JAVAFILES= \
+ TestComponent.java
+
+
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/stoc/test/javavm/testcomponent/manifest b/stoc/test/javavm/testcomponent/manifest
new file mode 100644
index 000000000..1763d7bb9
--- /dev/null
+++ b/stoc/test/javavm/testcomponent/manifest
@@ -0,0 +1 @@
+RegistrationClassName: TestComponent