Running OpenOffice From Remote Machine

From AlfrescoWiki

Jump to: navigation, search

Sometimes there is a need to run Alfresco and OpenOffice on separate machines.

[edit] Remote Machine Setup

On the remote machine create a script to launch OpenOffice that contains

'<Path to soffice>' "-accept=socket,host=<IP or DNS name>,port=<listening on>;urp;StarOffice.ServiceManager" -nologo -headless &

This will start an instance of OpenOffice running on the machine. If this machine is running headless, follow the instructions here to configure the virtual framebuffer.

Example:

'/usr/bin/soffice' "-accept=socket,host=156.124.12.101,port=8100;urp;StarOffice.ServiceManager" -nologo -headless &

You can use an init script like this as well. If you have a firewall enabled on this machine, make sure your firewall is open for the port specified.

[edit] Alfresco Configuration

On the Alfresco side, you need to create a remote-openoffce-context.xml file in the extensions directory (ex. tomcat/shared/classes/alfresco/extension)

In this file place:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
 
<beans>

        <bean id="openOfficeConnection" class="net.sf.jooreports.openoffice.connection.SocketOpenOfficeConnection">
                <constructor-arg type="java.lang.String" value="156.124.12.101"/>
                <constructor-arg type="int" value="8100"/>
        </bean>

        <bean id="transformer.OpenOffice" class="org.alfresco.extension.repo.content.transform.RemoteOpenOfficeContentTransformer" parent="baseContentTransformer" >
	<property name="connection">
		<ref bean="openOfficeConnection" />
	</property>
	<property name="documentFormatsConfiguration">
		<value>classpath:alfresco/mimetype/openoffice-document-formats.xml</value>
	</property>
</bean>

</beans>

Set the values of the constructor arguments equal to the IP or DNS name and port of the machine running OpenOffice.

Next, you need to install the remoteOpenOffice-0.1.amp file. Use the Alfresco Module Management Tool (alfresco-mmt) to install the amp file.

NOTE: From 2.2 SP1 onwards the RemoteOpenOfficeContentTransformer class will be available ready packaged out of the box. The configuration file mentioned above will be available as a sample extension.