summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertram Nolte <bnolte@openoffice.org>2001-11-09 08:05:47 +0000
committerBertram Nolte <bnolte@openoffice.org>2001-11-09 08:05:47 +0000
commita60ad11eb28c0eeb3f90f1aa56c962e5694b161d (patch)
treeea8f957da0388da836912e6aed10563cd2722580
parent7c844725b9bb8c9bdc2cd016290ac4774a4b3ad4 (diff)
Added an example for a minimal UNO component.
-rw-r--r--odk/examples/java/MinimalComponent/BuildMinimalComponent.xml64
-rw-r--r--odk/examples/java/MinimalComponent/Makefile100
2 files changed, 164 insertions, 0 deletions
diff --git a/odk/examples/java/MinimalComponent/BuildMinimalComponent.xml b/odk/examples/java/MinimalComponent/BuildMinimalComponent.xml
new file mode 100644
index 00000000..6aa7c5b9
--- /dev/null
+++ b/odk/examples/java/MinimalComponent/BuildMinimalComponent.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ author: Bertram Nolte
+ created: 2001-10-11
+ revision: 1.0
+ -->
+<project name="MinimalComponent" basedir="." default="all">
+
+ <target name="init">
+ <!--
+ In this target you have to change all parts, so that the properties
+ fit to your odk installation and to your service
+ -->
+ <property name="ODKPATH" value="D:/cvs/api/odk"/>
+ <property name="OUTPUTPATH" value="D:/cvs/api/odk/WINexample.out"/>
+ <property name="PACKAGE_NAME" value="org.OpenOffice."/>
+ <property name="JAR_FILE_NAME" value="MinimalComponent"/>
+ <property name="INTERFACE_NAME" value="MinimalComponent"/>
+ <property name="RDB_NAME" value="MinimalComponent.rdb"/>
+ </target>
+ <target depends="init" name="unoidl">
+
+ <exec dir="${ODKPATH}/WINexample.out/misc/" executable="${ODKPATH}/windows/bin/idlc.exe" timeout="600">
+ <arg line="-I. -I${ODKPATH}/idl ${ODKPATH}/examples/java/MinimalComponent/${INTERFACE_NAME}.idl"/>
+ </exec>
+
+ <exec dir="." executable="${ODKPATH}/windows/bin/regmerge.exe" timeout="600">
+ <arg line="./${RDB_NAME} /UCR ./${INTERFACE_NAME}.urd"/>
+ </exec>
+
+ <exec dir="." executable="${ODKPATH}/windows/bin/regmerge.exe" timeout="600">
+ <arg line="./${RDB_NAME} / ${ODKPATH}/windows/bin/applicat.rdb"/>
+ </exec>
+
+ <exec dir="." executable="${ODKPATH}/windows/bin/javamaker.exe" timeout="600">
+ <arg line="-BUCR -O${OUTPUTPATH}/class/${INTERFACE_NAME} -nD ./${RDB_NAME}"/>
+<!--
+ <arg line="-BUCR -T${PACKAGE_NAME}${INTERFACE_NAME} -O${OUTPUTPATH}/class/${INTERFACE_NAME} -nD ./${INTERFACE_NAME}.urd"/>
+ -->
+ </exec>
+
+ </target>
+
+ <target depends="init,unoidl" name="compile">
+ <mkdir dir="classes"/>
+ <javac debug="on" destdir="./classes" srcdir="." >
+ <classpath>
+ <fileset dir="${ODKPATH}/classes/">
+ <include name="**/*.jar"/>
+ </fileset>
+ <pathelement location="./classes"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <target depends="compile,init" name="jar">
+ <jar basedir="./classes" compress="true" jarfile="${JAR_FILE_NAME}.jar" manifest="Manifest">
+ </jar>
+ </target>
+
+ <target depends="compile,init,jar" name="all">
+ <!-- WRITEME -->
+ </target>
+</project>
diff --git a/odk/examples/java/MinimalComponent/Makefile b/odk/examples/java/MinimalComponent/Makefile
new file mode 100644
index 00000000..baf09442
--- /dev/null
+++ b/odk/examples/java/MinimalComponent/Makefile
@@ -0,0 +1,100 @@
+# Builds the java minimal component.
+
+PRJ=..$(PS)..$(PS)..
+SETTINGS=../../../settings
+
+include $(SETTINGS)/settings.mk
+
+include $(SETTINGS)/dk.mk
+include $(SETTINGS)/std.mk
+
+# Define non-platform/compiler specific settings
+
+REGISTERFLAG = $(OUT_MISC)$(PS)minimalcomponent_register_component.flag
+COMPONENTJARFLAG = $(OUT_MISC)$(PS)minimalcomponent_create_component_jar.flag
+TYPEFLAG= $(OUT_MISC)$(PS)minimalcomponent_type_generation.flag
+JAVAFLAG= $(OUT_MISC)$(PS)minimalcomponent_javac.flag
+
+OUT_COMPONENT = $(OUT_CLASS)$(PS)minimalcomponent
+COMPONENT_RDB = $(OUT_BIN)$(PS)MinimalComponent.rdb
+
+COMPONENT_JAR = $(OUT_CLASS)$(PS)MinimalComponent.jar
+COMPONENT_MANIFESTFILE = Manifest
+
+IDLFILES =
+
+# normally the idl file should be stored in a directory tree fitting the module structure,
+# for the example we know the module structure
+PACKAGE = org$(PS)OpenOffice
+
+JAVAFILES = MinimalComponent.java \
+ TestMinimalComponent.java
+
+GENJAVAFILES = $(patsubst %.idl,$(OUT_MISC)$(PS)$(PACKAGE)$(PS)%.java,$(IDLFILES) )
+GENURDFILES = $(patsubst %.idl,$(OUT_MISC)$(PS)%.urd,$(IDLFILES) )
+
+CLASSFILES = $(patsubst %.java,$(OUT_COMPONENT)$(PS)%.class,$(JAVAFILES) )
+
+CLASSFILES += $(patsubst %.java,$(OUT_COMPONENT)$(PS)$(PACKAGE)$(PS)%.class,$(GENJAVAFILES) )
+
+DK_CLASSPATH = $(subst $(EMPTYSTRING) $(EMPTYSTRING),, \
+ $(CLASSES_DIR)$(PS)jurt.jar\
+ $(PATH_SEPARATOR)$(CLASSES_DIR)$(PS)unoil.jar\
+ $(PATH_SEPARATOR)$(CLASSES_DIR)$(PS)ridl.jar\
+ $(PATH_SEPARATOR)$(CLASSES_DIR)$(PS)sandbox.jar\
+ $(PATH_SEPARATOR)$(CLASSES_DIR)$(PS)java_uno.jar\
+ $(PATH_SEPARATOR)$(CLASSES_DIR)$(PS)juh.jar\
+ $(PATH_SEPARATOR)$(CLASSES_DIR)$(PS)jut.jar\
+ $(PATH_SEPARATOR)$(OUT_COMPONENT) \
+ )
+
+OFFICE_FILEURL = $(subst \,/,$(OFFICE_PROGRAM_PATH))
+OFFICE_CLASSPATH = $(subst $(CLASSES_DIR),$(OFFICE_PROGRAM_PATH)$(PS)classes, $(DK_CLASSPATH))
+
+
+# Targets
+.PHONY: ALL
+ALL : register
+
+include $(SETTINGS)/stdtarget.mk
+
+$(OUT_COMPONENT) : $(OUT)
+ $(MKDIR) $@
+
+$(TYPEFLAG) : $(IDLFILES)
+ $(BIN_DIR)$(PS)idlc -I. -I$(IDL_DIR) -O$(OUT_MISC) $^ MinimalComponent.idl
+ $(BIN_DIR)$(PS)regmerge $(COMPONENT_RDB) /UCR $(GENURDFILES) MinimalComponent.urd
+ $(BIN_DIR)$(PS)regmerge $(COMPONENT_RDB) / $(BIN_DIR)$(PS)$(DKREGISTRYNAME)
+ $(BIN_DIR)$(PS)javamaker -BUCR -O$(OUT_MISC) $(COMPONENT_RDB)
+ @echo bla > $@
+
+$(JAVAFLAG) : $(OUT_COMPONENT) $(TYPEFLAG) $(JAVAFILES)
+ javac -classpath $(DK_CLASSPATH) -d $(OUT_COMPONENT) $(GENJAVAFILES) $(JAVAFILES)
+ @echo bla > $@
+
+$(COMPONENTJARFLAG) : $(JAVAFLAG)
+ jar cvfm $(COMPONENT_JAR) $(COMPONENT_MANIFESTFILE) -C $(OUT_COMPONENT) .
+ -$(DEL) $(REGISTERFLAG)
+ @echo bla > $@
+
+$(REGISTERFLAG) : $(COMPONENTJARFLAG)
+ifneq "$(OFFICE_PROGRAM_PATH)" ""
+ $(BIN_DIR)$(PS)regmerge $(OFFICE_PROGRAM_PATH)$(PS)applicat.rdb /UCR $(GENURDFILES) MinimalComponent.rdb
+ $(COPY) $(COMPONENT_JAR) $(OFFICE_PROGRAM_PATH)$(PS)classes
+ java -classpath $(OFFICE_CLASSPATH) com.sun.star.tools.uno.RegComp "$(URLPREFIX)$(OFFICE_FILEURL)/applicat.rdb" register "$(URLPREFIX)$(OFFICE_FILEURL)/classes/MinimalComponent.jar" com.sun.star.loader.Java2
+ @echo bla > $@
+else
+ @echo --------------------------------------------------------------------------------
+ @echo If you want to install your component automatically, please set an
+ @echo OFFICE_PROGRAM_PATH environment variable to a valid office installation.
+ @echo --------------------------------------------------------------------------------
+endif
+
+register: $(REGISTERFLAG)
+ @echo --------------------------------------------------------------------------------
+ @echo Please use the following command to execute
+ @echo java -classpath $(DK_CLASSPATH) TestMinimalComponent
+ @echo --------------------------------------------------------------------------------
+
+run:
+ java -classpath $(DK_CLASSPATH) TestMinimalComponent