ure ein "Standalone Openoffice" ?

Programmierung unter AOO/LO (StarBasic, Python, Java, ...)

Moderator: Moderatoren

kulrich
Beiträge: 4
Registriert: Fr, 20.01.2006 14:49

ure ein "Standalone Openoffice" ?

Beitrag von kulrich »

Hallo,

Hallo bin gerade dabei mich in die ganze OOo Problematik ein zu arbeiten.
Mein Ziel ist einen universellen Text Extractor ( auch MS Doc's) für eine server Umgebung zu bauen. Ich habe da einige VErständnis schwierigkeiten. Was das das ure.

Ich habe den verdacht mein nicht wissen basiert auf der Frage :
---- Ist ist die ure ein "Standalone Openoffice" ---

Darausleiten sich dann für mich folgende weitere Fragenstellungen ab :
1. Ist eine URE Installation das gleiche wie eine OpenOffice installation ?
2. Wenn ja wi kann ich den "ure" - Server starten und mich ihm verbinden ?

Grüße Kai
Toxitom
********
Beiträge: 3769
Registriert: Di, 12.08.2003 18:07
Wohnort: Wiesbaden
Kontaktdaten:

Beitrag von Toxitom »

Hey Kay,
---- Ist ist die ure ein "Standalone Openoffice" ---
Nein. Das sind zwei komplett verschieden "Schuhe".

Das URE ist relativ "frisch" und ist vergleichbar mit dem .net Framework unter Windows, also quasi eine Bibliothek basierend auf UNO-Objekten etc.

OpenOffice.org ist zwar überwiegend in C geschreiben, die API nutzt jedoch die UNO Schnittstellen (Universal Network Objects). Dadurch ist OOo auf allen Betriebssystemen ansteuerbar. Bisher gab es die UNO-Impementationen nur in Verbindung mit OOo, die waren fest miteinander "verwebt". Ende letzten Jahres dann hat Sun dieses UNO eigenständig freigegeben und bietet es unter dem Namen URE auch ohne OpenOffice.org an. Dadurch kann ein Programmierer UNO Objekte nutzen und erzeugen, ohne das OOo Paket installiert haben zu müssen, also zum Beispiel für eigene Applikationen.

Ich habe es selbst noch nicht ausprobiert, aber ich denke, das URE braucht keine seperate Installation?? Auf jeden fall aber gibt es dort entsprechende "Readme-files" oder Dokumentationen.

Viele Grüße
Thomas
Unterstützer LibreOffice, zertifizierter Trainer und Berater
Bücher: LibreOffice 6- Einstieg und Umstieg
Makros Grundlagen - LibreOffice / OpenOffice Basic
kulrich
Beiträge: 4
Registriert: Fr, 20.01.2006 14:49

Beitrag von kulrich »

Alles Klar,

ICh habe eben probiert openoffice als server zu starten :
Mit

Code: Alles auswählen

.../soffice.exe" -invisible accept=uno:host=localhost,port=8100;urp;StarOffice.ServiceManager
scheint er gestartet zu sein. (keine fehlermenldungen)
Kann ich das irgend wie testen ?

ich kann nähmlich nicht mit

Code: Alles auswählen

[...]
 Object objectInitial = xurlresolver.resolve("uno:host=localhost,port=8100;urp;StarOffice.ServiceManager" );
[...]
den server erreichen.
Ich bekomme dann eine Exception :

Code: Alles auswählen

com.sun.star.connection.ConnectionSetupException: no Connector for host=localhost
	at com.sun.star.comp.connections.Implementation.getConnectionService(Implementation.java:102)
	at com.sun.star.comp.connections.Connector.connect(Connector.java:146)
	at com.sun.star.comp.urlresolver.UrlResolver$_UrlResolver.resolve(UrlResolver.java:133)
	at org.thing.ooo.test.RemoteContact.main(RemoteContact.java:49)
irgend eine Idee ?

Gruß Kai

An bei meine Test Klasse :

Code: Alles auswählen

package org.thing.ooo.test;



	import com.sun.star.beans.PropertyValue;
	import com.sun.star.beans.XPropertySet;
	import com.sun.star.bridge.XUnoUrlResolver;
	import com.sun.star.comp.helper.Bootstrap;
	import com.sun.star.frame.XComponentLoader;
	import com.sun.star.frame.XStorable;
	import com.sun.star.lang.XComponent;
	import com.sun.star.lang.XMultiComponentFactory;
	import com.sun.star.lang.XMultiServiceFactory;
	import com.sun.star.uno.UnoRuntime;
	import com.sun.star.uno.XComponentContext;
	import com.sun.star.util.XCloseable;

	public class RemoteContact {

		public static void main(String[] args) {

	        try {

	        	 /* Bootstraps a component context with the jurt base components
	            registered. Component context to be granted to a component for running.
	            Arbitrary values can be retrieved from the context. */
	         XComponentContext xcomponentcontext =
	             com.sun.star.comp.helper.Bootstrap.createInitialComponentContext( null );
	         
	         /* Gets the service manager instance to be used (or null). This method has
	            been added for convenience, because the service manager is a often used
	            object. */
	         XMultiComponentFactory xmulticomponentfactory =
	             xcomponentcontext.getServiceManager();
	   
	         /* Creates an instance of the component UnoUrlResolver which
	            supports the services specified by the factory. */
	         Object objectUrlResolver =
	             xmulticomponentfactory.createInstanceWithContext(
	                 "com.sun.star.bridge.UnoUrlResolver", xcomponentcontext );
	         
	         // Create a new url resolver
	         XUnoUrlResolver xurlresolver = ( XUnoUrlResolver )
	             UnoRuntime.queryInterface( XUnoUrlResolver.class,
	                                        objectUrlResolver );
	   
	         // Resolves an object that is specified as follow:
	         // uno:<connection description>;<protocol description>;<initial object name>
	         Object objectInitial = xurlresolver.resolve(
	             "uno:host=localhost,port=8100;urp;StarOffice.ServiceManager" );
	         
	         // Create a service manager from the initial object
	         xmulticomponentfactory = ( XMultiComponentFactory )
	             UnoRuntime.queryInterface( XMultiComponentFactory.class, objectInitial );
	         
	         // Query for the XPropertySet interface.
	         XPropertySet xpropertysetMultiComponentFactory = ( XPropertySet )
	             UnoRuntime.queryInterface( XPropertySet.class, xmulticomponentfactory );
	         
	         // Get the default context from the office server.
	         Object objectDefaultContext =
	             xpropertysetMultiComponentFactory.getPropertyValue( "DefaultContext" );
	         
	         // Query for the interface XComponentContext.
	         xcomponentcontext = ( XComponentContext ) UnoRuntime.queryInterface(
	             XComponentContext.class, objectDefaultContext );
	         
	         /* A desktop environment contains tasks with one or more
	            frames in which components can be loaded. Desktop is the
	            environment for components which can instanciate within
	            frames. */
	         XComponentLoader xcomponentloader = ( XComponentLoader )
	             UnoRuntime.queryInterface( XComponentLoader.class,
	                                        xmulticomponentfactory.createInstanceWithContext(
	                                            "com.sun.star.frame.Desktop", xcomponentcontext ) );
	           System.out.println( "Got Desktop" );
	           
	           System.out.println( "Got ComponentLoader" );
	           // Preparing properties for loading the document
	           PropertyValue propertyvalue[] = new PropertyValue[ 1 ];
	           // Setting the flag for hidding the open document
	           propertyvalue[ 0 ] = new PropertyValue();
	           propertyvalue[ 0 ].Name = "Hidden";
	           propertyvalue[ 0 ].Value = new Boolean(true);
	           
	           String foulder = "file:///C:/Dokumente und Einstellungen/k.ulrich/Desktop/";
	          
	           String srcUrl = foulder + "Meetingprotokoll Webreb 060110.doc";
	           
	           System.out.println( "Load Datei ... " + srcUrl );
	           
	           Object objectDocumentToStore = xcomponentloader.loadComponentFromURL( srcUrl, "_blank", 0, propertyvalue );
	           
	           XStorable xstorable = ( XStorable ) UnoRuntime.queryInterface( XStorable.class,  objectDocumentToStore );
	           
	           System.out.println( "Save Datei ... " + srcUrl );
	           
	           // Preparing properties for converting the document
	           propertyvalue = new PropertyValue[ 2 ];
	           // Setting the flag for overwriting
	           propertyvalue[ 0 ] = new PropertyValue();
	           propertyvalue[ 0 ].Name = "Overwrite";
	           propertyvalue[ 0 ].Value = new Boolean(true);
	           // Setting the filter name
	           propertyvalue[ 1 ] = new PropertyValue();
	           propertyvalue[ 1 ].Name = "FilterName";
	           propertyvalue[ 1 ].Value = "swriter: Text";
	           
	           String targetUrl = foulder + "Meetingprotokoll Webreb 060110.txt";
	           
	           // Storing and converting the document
	           xstorable.storeAsURL( targetUrl, propertyvalue );
	           
	           XCloseable xcloseable = (XCloseable)UnoRuntime.queryInterface( XCloseable.class,xstorable );
	           
	           // Closing the converted document
	           if ( xcloseable != null )
	               xcloseable.close(false);
	           else {
	               // If Xcloseable is not supported (older versions,
	               // use dispose() for closing the document
	               XComponent xComponent = ( XComponent ) UnoRuntime.queryInterface(
	                   XComponent.class, xstorable );
	               xComponent.dispose();
	           }
	           
	           System.out.println( "Datei cloesed... " + srcUrl );
	        }catch (java.lang.Exception e){
	            e.printStackTrace();
	        }finally {
	            System.exit(0);
	        }
	    }
	} 

hol.sten
******
Beiträge: 871
Registriert: Fr, 18.11.2005 21:21

Beitrag von hol.sten »

kulrich hat geschrieben:Mit

Code: Alles auswählen

.../soffice.exe" -invisible accept=uno:host=localhost,port=8100;urp;StarOffice.ServiceManager
scheint er gestartet zu sein. (keine fehlermenldungen)
Kann ich das irgend wie testen ?
Taucht im Taskmanager ein soffice-Prozess (OOo 1.1.x) bzw. tauchen dort zwei soffice-Prozesse (OOo 2.0.x) auf?
Gib mal in der Eingabeaufforderung "netstat -a" ein. Siehst du dort irgendwo deinen Port 8100 mit dem Status "ABHÖREN"?
Trifft beides zu, sollte OOo im Listen-Modus bereit stehen.

Zur Info, weil es nicht das Problem sein muss, aber ich starte soffice mit dem Parameter "-accept=socket,host=localhost,port=8100;urp".

With kind regards
hol.sten
Antworten