[opencms-dev] cmsshell and alpha2

Mike Bachrynowski mikeb at tableau.co.uk
Fri Nov 5 10:43:17 CET 2004


I raised bug 426.  I included the correct CLASSPATH (for Windows) for 6
alpha 2.
I suggest a much better way is to use an external Ant task (executed
perhaps by a JSP page in an Admin website).

The object of the below is to extract resources, transform, run tests,
build war and ear files and deploy.  This approach can be used for full
backups and when OpenCms is upgraded to "full export" and "full import".

Here is an Ant procedure
=============================
<project name="OpenCms" default="proc-step10" basedir="../">
    <description> OpenCms Command Line  </description>

  <!-- PROPERTIES -->
  <!-- param-DIR   -->
  <!-- param-IN   -->
  <!-- param-OUT  -->
  <!-- param-ERR  -->

  <property name="dir.in"     value="${param-DIR}" />
  <property name="file.in"    value="${param-IN}"  />
  <property name="file.out"   value="${param-OUT}" />
  <property name="file.err"   value="${param-ERR}" />

  <!-- DOCBOOK BASIC -->
  <target name="proc-step10" description="proc-step10 - OpenCms">
    <echo message="OpenCms command line"/>

    <echo message="- param-DIR - ${param-DIR} "/>
    <echo message="- param-IN  - ${param-IN}  "/>
    <echo message="- param-OUT - ${param-OUT} "/>
    <echo message="- param-ERR - ${param-ERR} "/>

    <echo message="- delete output file - ${file.out} "/>
    <delete file="${file.out}" failonerror="false" />
    <echo message="- delete error file - ${file.err} "/>
    <delete file="${file.err}" failonerror="false" />

    <java classname="${opencms.class}" fork="yes" 
       dir="${dir.in}" 
       input="${file.in}" 
       output="${file.out}"
       error="${file.err}">
       <classpath refid="base.opencms.path"/>
    </java>
    
  </target>

</project>
====================
Here is the Xalan proce
===================
<project name="Xalan" default="proc-step10" basedir="../">
  <description> Xalan Processing </description>

  <!-- PROPERTIES -->
  <!-- param-IN  -->
  <!-- param-OUT -->
  <!-- param-XSL -->

  <!-- TARGETS -->

  <!-- STEP10 - Xalan -->

  <target name="proc-step10"  description="proc-step10 - Xalan" >
    <echo message="Proc - Xalan"/>
    <echo message="- param-IN  - ${param-IN}"  />
    <echo message="- param-OUT - ${param-OUT}" />
    <echo message="- param-XSL - ${param-XSL}" />

    <echo message="-- run Xalan"/>
    <delete file="${param-OUT}" failonerror="false" />
    <java classname="${xalan.run}" fork="yes" >
      <arg value="-in"  /> <arg value="${param-IN}"  />
      <arg value="-out" /> <arg value="${param-OUT}" />
      <arg value="-xsl" /> <arg value="${param-XSL}" />
      <classpath refid="base.xalan.path"/>
    </java>

  </target>
</project>
==================
Here is the Ant build file
====================
<project name="OpenCms" default="step10" basedir="../">
    <description> OpenCms Command Line </description>

  <!-- Properties -->

  <property name="xml.doc"     value="news-2004-11-04b"      />
  <property name="xslt.ctl"    value="opencms-1"      />

  <property name="file.in.1"   value="opencms-in-1"    />
  <property name="file.in.2"   value="opencms-help"    />
  <property name="file.in.3"   value="opencms-export"  />
  
  <property name="file.in.cur"  value="${file.in.3}"  />
  
  <property name="file.in"     location="ctl/${file.in.cur}.txt"
/>
  <property name="file.in.tmp" location="temp/${file.in.cur}-in.txt"
/>
  <property name="file.out"    location="temp/${file.in.cur}-out.txt"
/>
  <property name="file.err"    location="temp/${file.in.cur}-err.txt"
/>
    
  <property name="opencms.class" value="org.opencms.main.CmsShell" />
  <property name="opencms.dir"
value="C:\progs\jakarta-tomcat-5.0.19\webapps\opencms\WEB-INF" />
  <property name="opencms.lib"
value="C:\progs\jakarta-tomcat-5.0.19\webapps\opencms\WEB-INF\lib" />

  <property name="xalan.run"  value="org.apache.xalan.xslt.Process" />
  <property name="xalan.bin"  value="c:\progs\xalan-j_2_5_1\bin"    />

  <property name="xml.in"      location="opencms-xml/${xml.doc}.xml"
/>
  <property name="xml.out"     location="opencms-docbook/${xml.doc}.xml"
/>
  <property name="xml.xsl"     location="ctl/${xslt.ctl}.xslt"   />


  <property name="opencms.user"     value="Admin"  />
  <property name="opencms.password" value="admin"  />
  <property name="export.src.dir"   value="/tableau/news/"  />
  <property name="export.file"
value="/progs/eclipse/workspace/tableau-docbook/temp/opencms-export-news
.zip"  />
  <property name="export.dir"       value="temp${export.src.dir}"  />

  <path id="base.opencms.path">
     <pathelement location="ctl/log4j.xml"/>
     <fileset dir="${opencms.lib}">                <include
name="*.jar"/>     </fileset>
     <!-- fileset dir="C:\progs\apache-ant-1.6.0\lib"> <include
name="*.jar"/> </fileset -->
     <fileset dir="c:\java\j2sdk1.4.2_02\lib">     <include
name="tools.jar"/> </fileset>
     <fileset dir="c:\java\j2sdk1.4.2_02\lib">     <include
name="dt.jar"/>    </fileset>
     <fileset dir="c:\java\j2eesdk1.4_beta2\lib">  <include
name="j2ee.jar"/>  </fileset>
  </path>


  <path id="base.xalan.path">
     <fileset dir="${xalan.bin}">  <include name="*.jar"/> </fileset>
  </path>


  <!-- START TIMESTAMP -->
  <target name="step10" description="step10 - Start Timestamp">
    <tstamp prefix="start">
      <format property="NOW-TSTAMP" pattern="d MMMM yyyy HH:mm:ss"/>
      <format property="RUN-TSTAMP" pattern="yyyyMMdd-HHmmss"
locale="en"/>
    </tstamp>
    <echo message="Start of run - ${start.NOW-TSTAMP}"/>
  </target>

  <!-- OPENCMS SCRIPT CHANGES -->
  <target name="step20" description="step20 - change script for specific
export directory">
    <echo message="OpenCms - export directory - ${export.src.dir}"/>
    <echo message="OpenCms - export zip file - ${export.file}"/>
    <echo message="- delete temporary input file - ${file.in.tmp} "/>
    <delete file="${file.in.tmp}" failonerror="false" />
	<copy file="${file.in}" toFile="${file.in.tmp}">
  		<filterset>
    		<filter token="USER"     value="${opencms.user}"     />
    		<filter token="PASSWORD" value="${opencms.password}" />
    		<filter token="INDIR"    value="${export.src.dir}"   />
    		<filter token="OUTFILE"  value="${export.file}"      />
  		</filterset>
	</copy>
  </target>

  <!-- OPENCMS COMMAND LINE SHELL-->
  <target name="step30" description="step30 - run opencms shell">
    <echo message="OpenCms - ${file.in.cur}"/>
    <ant antfile="bin\proc-opencms.xml" target="proc-step10"
inheritrefs="true">
      <property name="param-DIR"  value="${opencms.dir}" />
      <property name="param-IN"   value="${file.in.tmp}" />
      <property name="param-OUT"  value="${file.out}"    />
      <property name="param-ERR"  value="${file.err}"    />
    </ant>
  </target>

   <!-- UNZIP EXPORT -->
  <target name="step40" description="step40 - unzip export file">
    <echo message="OpenCms - export zip file - ${export.file}"/>
    <echo message="delete directory - ${export.dir}"/>
    <delete dir="${export.dir}" failonerror="false" />
    <echo message="delete directory - ${export.dir}"/>
    <mkdir dir="${export.dir}" />
    <echo message="unzip - ${export.file}"/>
    <unzip src="${export.file}" dest="${export.dir}"/>
  </target>


  <!-- STEP50 - Xalan -->
  <target name="step50" description="step50 Xalan">
    <echo message="Xalan"/>

    <echo message="- call xalan procedure"/>
    <ant antfile="bin/proc-xalan.xml" target="proc-step10">
      <property name="param-IN"   location="${xml.in}"  />
      <property name="param-OUT"  location="${xml.out}" />
      <property name="param-XSL"  location="${xml.xsl}" />
      <reference refid="base.xalan.path"/>
    </ant>

   </target>

  
  <!-- FINAL TIMESTAMP -->
  <target name="step99" description="step99 - Final Timestamp">
    <tstamp prefix="final">
      <format property="NOW-TSTAMP" pattern="d MMMM yyyy HH:mm:ss"/>
    </tstamp>
    <echo message="End of run - ${final.NOW-TSTAMP}"/>
  </target>

 
</project>
============================
The OpenCms script for export
========================
loginUser @USER@ @PASSWORD@
exportResources "@OUTFILE@" "@INDIR@"
Exit
============================
The OpenCms script for help
========================
loginUser @USER@ @PASSWORD@
help *
Exit
============================
Now simple XSLT to transform the OpenCms into Docbook, OTA, BizTalk or
any other schema ...

Hopefully in the future OpenCms xmlcontent schema can be automatically
generated from the standard schema and be held directly in Xindice and
live would be easier still.

Mike 





-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Andy Kriger
Sent: 04 November 2004 20:38
To: 'The OpenCms mailing list'
Subject: RE: [opencms-dev] cmsshell and alpha2

I haven't seen that but I definitely needed to fix the classpath in
cmsshell.sh (most of the jars listed in that file aren't right)

________________________________

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Russ Sarbora
Sent: Thursday, November 04, 2004 3:21 PM
To: opencms-dev at opencms.org
Subject: [opencms-dev] cmsshell and alpha2



I've been trying to get the command line shell running with the alpha2
release but with no luck. Has anybody else experienced this problem?

 

It looks like some problem with the xml configuration files and
Digester. The exception is included below. All the .xml files in my
config directory look valid to me and I have not modified them since
running the setup. 

 

java.lang.reflect.InvocationTargetException

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)

        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:324)

        at
org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:2
16)

        at
org.apache.commons.digester.CallMethodRule.end(CallMethodRule.java:585)

        at org.apache.commons.digester.Rule.end(Rule.java:228)

        at
org.apache.commons.digester.Digester.endElement(Digester.java:1067)

        at
org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)

        at
org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
Source)

        at
org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)

        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(U
nknown Source)

        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis
patcher.dispatch(Unknown Source)

        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unkno
wn Source)

        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)

        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)

        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)

        at
org.apache.commons.digester.Digester.parse(Digester.java:1591)

        at
org.opencms.configuration.CmsConfigurationManager.loadXmlConfiguration(C
msConfigurationManager.java:489)

        at
org.opencms.configuration.CmsConfigurationManager.loadXmlConfiguration(C
msConfigurationManager.java:329)

        at
org.opencms.main.OpenCmsCore.initConfiguration(OpenCmsCore.java:924)

        at
org.opencms.main.OpenCmsCore.upgradeRunlevel(OpenCmsCore.java:1336)





More information about the opencms-dev mailing list