Adding REST component

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Adding REST component

Alfonso Barreto
I followed this instructions to create this component

https://cwiki.apache.org/confluence/display/OFBIZ/Export+service+using+REST

But got error that the gwt-code is not generated. Modifed the build.xml adding that part but keep getting errors, don't know if I am on the right line, any body who can give me some ideas will be appreciated. Here is the build.XML

****************************************************************************************************************ERROR:
gwt-compile:
     [java] 23/01/2017 12:13:07 PM java.util.prefs.WindowsPreferences <init>
     [java] ADVERTENCIA: Could not open/create prefs root node Software\JavaSoft
\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
     [java] [ERROR] Unable to find 'org/opentaps/gwt/restcomponent/restcomponent
.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a c
lasspath entry for source?

NOTE:  the  route 'org/opentaps/gwt/restcomponent/restcomponent' is not clear where it is defined.
****************************************************************************************************************<?xml version="1.0" encoding="UTF-8"?><project name="OFBiz - RestComponent Component" default="jar" basedir=".">
    <import file="../../common.xml"/>    <!-- ================================================================== -->
    <!-- Initialization of all property settings                            -->
    <!-- ================================================================== -->    <property environment="env"/>
    <property name="desc" value="RestComponent Component"/>
    <property name="name" value="ofbiz-restcomponent"/>
    <property name="component-name" value="ofbiz-restcomponent"/>
    <property name="ofbiz.home.dir" value="../.."/>
    <property name="src.dir" value="src"/>
    <property name="dtd.dir" value="dtd"/>
    <property name="lib.dir" value="lib"/>
    <property name="build.dir" value="build"/>    <target name="init">
        <property environment="env"/>
        <property name="desc" value="RestComponent Component"/>
        <property name="name" value="restcomponent"/>
        <property name="src.dir" value="src"/>
        <property name="dtd.dir" value="dtd"/>
        <property name="lib.dir" value="lib"/>
        <property name="build.dir" value="build"/>
        <property name="gwt.deploy.dir" value="./webapp/restcomponentgwt"/>
        <property name="gwt.module.base" value="org.opentaps.gwt"/>
        <property name="gwt.src.common" value="../../opentaps/opentaps-common/src/common/org/opentaps/gwt"/>
        <property name="gwt.src.constants" value="../../opentaps/opentaps-common/src/constants/org/opentaps/base"/>
        <property name="gwt.src.base" value="./src/org/opentaps/gwt"/>
        <property name="gwt.module.list" value="restcomponent"/>
        <!-- This parameter must point to your ofbiz/ directory or the libraries for the financials app would not be found.
         The default setting would work if you have checked out the financials module into your ofbiz/opentaps/ directory.
         It would NOT work if you checked it out somewhere else and symlinked to it in your opentaps/ directory.
         If you experience build problems, put the full path here -->
        <property name="ofbiz.dir" value="../../"/>
    </target>
   
    <target name="classpath">
    <path id="local.class.path">
        <fileset dir="${lib.dir}" includes="*.jar"/>
        <fileset dir="../../framework/base/lib" includes="*.jar"/>
        <fileset dir="../../framework/base/lib/j2eespecs" includes="*.jar"/>
        <fileset dir="../../framework/base/build/lib" includes="*.jar"/>
        <fileset dir="../../framework/entity/lib" includes="*.jar"/>
        <fileset dir="../../framework/entity/build/lib" includes="*.jar"/>
        <fileset dir="../../framework/security/build/lib" includes="*.jar"/>
        <fileset dir="../../framework/service/lib" includes="*.jar"/>
        <fileset dir="../../framework/service/build/lib" includes="*.jar"/>
        <fileset dir="../../framework/minilang/build/lib" includes="*.jar"/>
        <fileset dir="../../framework/widget/build/lib" includes="*.jar"/>
        <fileset dir="../../framework/webapp/lib" includes="*.jar"/>
        <fileset dir="../../framework/webapp/build/lib" includes="*.jar"/>
    </path>
    </target>     <target name="gwtclasspath" depends="init">
        <path id="gwt.class.path">
            <fileset dir="${ofbiz.dir}/framework/base/lib" includes="*.jar"/>           
            <pathelement location="${ofbiz.dir}/opentaps/opentaps-common/src/constants"/>
            <pathelement location="${ofbiz.dir}/opentaps/opentaps-common/src/common"/>
            <fileset dir="${ofbiz.dir}/opentaps/opentaps-common/lib" includes="gwt*.jar"/>
            <fileset dir="${ofbiz.dir}/opentaps/opentaps-common/lib/gwt-dev" includes="gwt*.jar"/>
        </path>
    </target>
    <!-- ================================================================= -->
    <!-- Targets to create  patch files                                    -->
    <!-- ================================================================= -->    <target name="create-ofbiz-patches" description="Creates patch for framework, application, specialpurpose components">
        <exec executable="svn" output="patches/framework.patch" dir="${ofbiz.home.dir}">
            <arg value="diff"/>
            <arg value="framework"/>
        </exec>
        <exec executable="svn" output="patches/applications.patch" dir="${ofbiz.home.dir}">
            <arg value="diff"/>
            <arg value="applications"/>
        </exec>
        <exec executable="svn" output="patches/specialpurpose.patch" dir="${ofbiz.home.dir}">
            <arg value="diff"/>
            <arg value="specialpurpose"/>
        </exec>
    </target>    <target name="revert-ofbiz-patches" description="Remove any local change in the files or any previously applied local patch.">
        <exec executable="svn" dir="${ofbiz.home.dir}">
            <arg value="revert"/>
            <arg value="-R"/>
            <arg value="framework"/>
        </exec>
        <exec executable="svn" dir="${ofbiz.home.dir}">
            <arg value="revert"/>
            <arg value="-R"/>
            <arg value="applications"/>
        </exec>
        <exec executable="svn" dir="${ofbiz.home.dir}">
            <arg value="revert"/>
            <arg value="-R"/>
            <arg value="specialpurpose"/>
        </exec>
    </target>    <target name="apply-ofbiz-patches" description="Apply the patch to framework, application, specialpurpose components.">
        <fail message="Patch files not found.">
            <condition>
                <or>
                    <not><isset property="component-name"/></not>
                    <not>
                        <resourcecount count="3">
                            <fileset dir="patches" includes="*.patch"/>
                        </resourcecount>
                    </not>
                </or>
            </condition>
        </fail>
        <patch strip="0" patchfile="patches/framework.patch" dir="${ofbiz.home.dir}"/>
        <patch strip="0" patchfile="patches/applications.patch" dir="${ofbiz.home.dir}"/>
        <patch strip="0" patchfile="patches/specialpurpose.patch" dir="${ofbiz.home.dir}"/>
    </target>    <target name="reapply-ofbiz-patches" description="First removes any previously applied patch and then applies the new patch">
        <fail message="Patch files not found.">
            <condition>
                <or>
                    <not><isset property="component-name"/></not>
                    <not>
                        <resourcecount count="3">
                            <fileset dir="patches" includes="*.patch"/>
                        </resourcecount>
                    </not>
                </or>
            </condition>
        </fail>
        <antcall target="revert-ofbiz-patches"/>
        <antcall target="apply-ofbiz-patches"/>
    </target>
   
   
     <!-- ================================================================== -->
    <!-- Removes all created files and directories                          -->
    <!-- ================================================================== -->    <target name="clean" depends="clean-lib">
        <delete dir="${build.dir}"/>
    </target>    <target name="clean-lib" depends="init">
        <delete dir="${build.dir}/lib"/>       
    </target>
   
    <!-- ================================================================== -->
    <!-- Makes sure the needed directory structure is in place              -->
    <!-- ================================================================== -->    <target name="prepare" depends="clean-lib">
        <mkdir dir="${build.dir}/classes"/>        
        <mkdir dir="${build.dir}/lib"/>
    </target>
   
    <target name="prepare-docs" depends="init">
        <mkdir dir="${build.dir}/javadocs"/>       
    </target>
   
    <!-- ================================================================== -->
    <!-- Compilation of the source files                                                                                                                         -->
    <!-- ================================================================== -->                   <target name="classes" depends="prepare,classpath">
     <javac debug="on" deprecation="on" destdir="${build.dir}/classes">
            <classpath>
                <path refid="local.class.path"/>               
            </classpath>
            <src path="${src.dir}"/>
        </javac>
        <!-- also put the DTDs in the jar file... -->
        <copy todir="${build.dir}/classes">
            <fileset dir="${src.dir}" includes="**/*.properties,**/*.xml,**/*.bsh,**/*.logic,**/*.js,**/*.jacl,**/*.py"/>
        </copy>              
                        
    </target>
   
    <target name="jar" depends="classes">
        <jar jarfile="${build.dir}/lib/${name}.jar" basedir="${build.dir}/classes"/>        
    </target>   
   
     <!-- ================================================================== -->
    <!-- Compilation of GWT files                                           -->
    <!-- ================================================================== -->
     <target name="prepare-gwt" depends="gwtclasspath">
      <mkdir dir="${gwt.deploy.dir}"/>
    </target>
   
    <target name="gwt-code" depends="prepare-gwt">
        <subant target="gwt-compile-modules" inheritall="true" inheritrefs="true">
            <filelist dir="." files="../../opentaps/opentaps-common/build.xml"/>
        </subant>
    </target>
    <!-- ================================================================== -->
    <!-- Build JavaDoc                                                      -->
    <!-- ================================================================== -->    <target name="docs" depends="prepare-docs,classpath">
        <javadoc packagenames="org.opentaps.*"
                 classpathref="local.class.path"
                 destdir="${build.dir}/javadocs"
                 Windowtitle="Open Source Strategies - ${desc}">
            <sourcepath path="${src.dir}"/>
        </javadoc>
    </target>
   
    <target name="all" depends="jar,docs"/>  
</Project>