RE: [OT] OSUser : getting started

"J. Matthew Pryor" <[email protected]> Thu, 11 Dec 2003 16:42:33 +1100
Newsgroups gmane.comp.java.open-symphony.devel
Message-ID <[email protected]>
OK well I ended up having to make quite a few changes to build.xml as it
came out of [email protected]

Some of those relate to the fact that I am using Eclipse, but some of them
AFAICT the build.xml file just couldn't have worked, so I am a bit confused

I have attached my changes for anyone who is interested to review

After that, my 2nd problem was an RTFM issue, since I hadn't included
osuser.xml on the classpath of the example.ear

On the feedback front, there was a bit of code in UserManager that got me

    /**
     * Entry-point to Singleton instance
     */
    public static UserManager getInstance() {
        try {
            if (instance == null) {
                instance = new UserManager();
            }
        } catch (RuntimeException e) {
            return null;
        }

        return instance;
    }

The runtime exception in this case was reporting the fact that the
osuser.xml file could not be loaded, and its a bit nasty to just toss the
exception away like that

At the very least a logger.error() would have been nice. I can send diffs
for my changes if somone wants to review/commit them

Thanks for the offers of help. I am up & running now

BTW I am planning on putting together maven build files for OSUser for my
own use, any interest in me submitting it?

Matthew

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of
> Matthew E. Porter
> Sent: Thursday, December 11, 2003 1:57 PM
> To: [email protected]
> Subject: Re: [Opensymphony-developers] [OT] OSUser : getting started
>
>
> We are using for internal applications and it works beautifully.  If
> you have any specific questions, ask the list.  Someone here will be
> happy to respond.
>
>
> Cheers,
>    matthew
>
> On Dec 10, 2003, at 8:39 PM, Hani Suleiman wrote:
>
> > The example should work, please do holler here if it doesn't run.
> > While not much development is going in it right now, quite a few
> > people are using it.
> >
> > On Dec 10, 2003, at 9:24 PM, Nick Faiz wrote:
> >
> >> Matthew,
> >>
> >>             You're not the only one interested in taking first steps
> >> with OSUser.
> >>
> >>             If you are successful with building the example and
> >> making things work, please let me know. I would like to do the same
> >> myself, quite soon.
> >>
> >>  
> >>
> >> Nick     
> >>
> >>  
> >>
> >>  
> >>
> >> -----Original Message-----
> >> From:J. Matthew Pryor [mailto:[email protected]]
> >> Sent:Thursday, 11 December 2003 1:19 PM
> >> To:[email protected]
> >> Subject:[Opensymphony-developers] [OT] OSUser : getting started
> >>
> >>  
> >>
> >> Sorry if this is the wrong place, but the dev list was the only
> >> archive I could find recent posts on relating to OSUser
> >>
> >>  
> >>
> >> Is OSUser active? The lists at java.net seem dead
> >>
> >>  
> >>
> >> I am trying to build the example after getting the source
> >> [email protected] the readme appears to be pretty out of date
> >>
> >>  
> >>
> >> If I have missed something obvious or should post elsewhere, please
> >> let me know
> >>
> >>  
> >>
> >> Again apologies for the OT post
> >>
> >>  
> >>
> >> Matthew
> >
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: SF.net Giveback Program.
> > Does SourceForge.net help you be more productive?  Does it
> > help you create better code?  SHARE THE LOVE, and help us help
> > YOU!  Click Here: http://sourceforge.net/donate/
> > _______________________________________________
> > Opensymphony-developers mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/opensymphony-developers
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive?  Does it
> help you create better code?  SHARE THE LOVE, and help us help
> YOU!  Click Here: http://sourceforge.net/donate/
> _______________________________________________
> Opensymphony-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-developers
build.xml (text/xml, 8.2 KB)
<?xml version="1.0"?>

<!-- OSUser build file - http://www.opensymphony.com/osuser -->

<project name="osuser" default="jar" basedir=".">
  <property file="build.properties"/>
  <path id="cp">
    <fileset dir="${basedir}/lib">
      <include name="**/*.jar"/>
    </fileset>
  </path>

  <path id="jalopy.classpath">
    <fileset dir="${basedir}/lib/build/jalopy">
      <include name="*.jar"/>
    </fileset>
  </path>

  <taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
    <classpath refid="jalopy.classpath"/>
  </taskdef>

  <!-- Setup details -->
  <target name="init">
    <tstamp>
      <format property="release" pattern="-dMMMyy" locale="en" timezone="GMT"/>
    </tstamp>
    <property name="lib" value="${basedir}/lib"/>
    <property name="lib.core" value="${lib}/core"/>
    <property name="lib.build" value="${lib}/build"/>
    <property name="lib.optional" value="${lib}/optional"/>

    <property name="src" value="${basedir}/src"/>
    <property name="src.java" value="${src}/java"/>
    <property name="src.test" value="${src}/test"/>
    <property name="src.etc" value="${src}/etc"/>

    <property name="propertyset.jar" value="propertyset-1.3-dev.jar"/>
    <property name="oscore.jar" value="oscore-2.2.1.jar"/>
    <property name="build" value="build"/>
    <property name="build.test" value="${build}/test"/>
    <property name="build.java" value="${build}/java"/>

    <property name="tmp" value="${basedir}/tmp" />
    <property name="dist" value="${basedir}/dist"/>
    <property name="deployment" value="${basedir}/deployment"/>
    <property name="docs" value="${basedir}/docs"/>

    <property name="clover.initstring" location="testcoverage.db"/>

    <property name="packages" value="com.opensymphony..user.*"/>

    <available property="junit.available" classname="junit.framework.TestCase"/>
    <available property="clover.available" classname="org.apache.tools.ant.taskdefs.CloverCompilerAdapter"/>
  </target>

  <target name="junit-check" depends="init" unless="junit.available">
    <fail message="Cannot run test cases. Please copy lib/build/junit-3.8.1.jar to ${ant.home}/lib"/>
  </target>

  <target name="clover-check" depends="init" unless="clover.available">
    <fail message="Cannot run coverage tests. Please copy lib/build/clover-1.2.3.jar to ${ant.home}/lib"/>
  </target>

  <!-- Remove all built files -->
  <target name="clean" depends="init">
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
    <delete>
      <fileset dir="." includes="testcoverage.db*"/>
    </delete>
  </target>

  <!-- Compile Java -->
  <target name="java" depends="init">
    <mkdir dir="${build.java}/META-INF"/>
    <javac destdir="${build.java}" classpathref="cp" debug="on">
      <src path="${src.java}"/>
    </javac>
    <copy todir="${build.java}">
      <fileset dir="${src.java}">
        <exclude name="**/*.java"/>
        <exclude name="**/package.html"/>
      </fileset>
    </copy>
    <copy file="${src.etc}/ejb/ejb-jar.xml" todir="${build.java}/META-INF"/>
    <copy file="${src.etc}/orion/orion-ejb-jar.xml" todir="${build.java}/META-INF"/>
    <copy file="${src.etc}/jrun/jrun-ejb-jar.xml" todir="${build.java}/META-INF"/>
    <copy todir="${build.java}">
      <fileset dir="${src.etc}/pramati" />
    </copy>
    <copy todir="${build.java}/META-INF">
      <fileset dir="${src.etc}/castor" />
    </copy>
    <copy todir="${build.java}/META-INF">
      <fileset dir="${src.etc}/jboss" />
    </copy>
    <copy todir="${build.java}/META-INF">
      <fileset dir="${src.etc}/weblogic" />
    </copy>
  </target>

  <target name="test" depends="clover-check,junit-check">
    <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>

    <mkdir dir="${build.test}/META-INF"/>
    <javac srcdir="${src.java}" destdir="${build.test}" debug="on" classpathref="cp" compiler="org.apache.tools.ant.taskdefs.CloverCompilerAdapter" />
    <javac srcdir="${src.test}" destdir="${build.test}" classpathref="cp" debug="on"/>
    <copy todir="${build.test}">
      <fileset dir="${src.test}">
        <include name="**/*.xml" />
        <include name="**/*.properties"/>
        <include name="**/*.sql"/>
      </fileset>
    </copy>
    <mkdir dir="${dist}/docs/junit"/>
    <junit printsummary="withOutAndErr" haltonfailure="no" haltonerror="no" showoutput="yes">
      <classpath>
        <pathelement location="${build.test}"/>
        <path refid="cp"/>
      </classpath>

      <formatter type="xml"/>

      <batchtest todir="${dist}/docs/junit">
        <fileset dir="${src.test}">
          <include name="**/*Test.java"/>
          <exclude name="**/Base*Test.java"/>
        </fileset>
      </batchtest>
    </junit>
  </target>

  <target name="format" depends="java">
    <jalopy fileformat="unix" convention="${src.etc}/jalopy.xml" history="file" historymethod="adler32" loglevel="error" threads="2" classpathref="cp">
      <fileset dir="${src.java}">
        <include name="**/*.java"/>
      </fileset>
      <!-- <fileset dir="${src.test}">
          <include name="**/*.java" />

      </fileset>
      -->
    </jalopy>
  </target>

  <!-- Build jar archive -->
  <target name="jar" depends="format">
    <mkdir dir="${dist}"/>
    <jar basedir="${build.java}" jarfile="${dist}/${name}-${version}${release}.jar"/>
  </target>

  <target name="example" depends="jar">
    <mkdir dir="${tmp}"/>
    <!-- copies the osuser jar without the version info attached to the jar
         file name, as that is how its referenced in the
         example/META-INF/application.xml file -->
    <copy tofile="${tmp}/example/${name}.jar">
      <fileset dir="${dist}">
        <include name="${name}*.jar"/>
      </fileset>
    </copy>
    <copy todir="${tmp}/example">
      <fileset dir="${lib}/build/">
        <include name="castor-0.9.3.9.jar"/>
      </fileset>
      <fileset dir="${lib}/core">
        <include name="oscore**"/>
        <include name="prop**"/>
      </fileset>
    </copy>
    <copy todir="${tmp}/example">
      <fileset dir="example">
        <include name="META-INF/**"/>
        <include name="manager/**"/>
      </fileset>
    </copy>
    <mkdir dir="${tmp}/example/lib"/>
    <copy todir="${tmp}/example/lib">
      <fileset dir="${lib}/build/">
        <include name="log4j.jar"/>
      </fileset>
      <fileset dir="${lib}/optional/">
        <include name="*.jar"/>
      </fileset>
      <fileset dir="${lib}/core">
        <include name="common**"/>
      </fileset>
    </copy>
    <jar basedir="example/testclient" jarfile="${tmp}/example/testclient.jar" manifest="example/testclient/META-INF/MANIFEST.MF"/>
    <jar basedir="${tmp}/example/manager" jarfile="${tmp}/example/manager.war"/>
    <copy file="${src.etc}/pramati/pramati-j2ee-server.xml" todir="${tmp}/example/"/>
    <copy file="${src.etc}/pramati/pramati-or-map.xml" todir="${tmp}/example/"/>
    <copy file="${src.etc}/pramati/queries.props" todir="${tmp}/example/"/>
    <jar basedir="${tmp}/example" jarfile="${dist}/osuser_example.ear"/>

  </target>

  <target name="javadocs" depends="init">
    <mkdir dir="${dist}/docs/api"/>
    <javadoc sourcepath="${src.java}" destdir="${dist}/docs/api"
      packagenames="${packages}" classpathref="cp" author="true"
      version="true" windowTitle="${name} ${version} API" doctitle="${name}"
      footer="See &lt;a href=&quot;http://www.opensymphony.com&quot;&gt;www.opensymphony.com&lt;/a&gt; for more information."
      use="true" verbose="false" stylesheetfile="${docs}/api.css" />
  </target>

  <target name="clover.report" depends="test">
    <java classname="com.cortexeb.tools.clover.reporters.html.HtmlReporter" fork="true">
      <arg line="--outputdir ${dist}/docs/clover --showSrc --initstring ${clover.initstring} --title '${name}'"/>
      <classpath refid="cp"/>
    </java>
  </target>

  <target name="junit.report" depends="test">
    <junitreport todir="${dist}/docs/junit">
      <fileset dir="${dist}/docs/junit">
        <include name="TEST-*.xml"/>
      </fileset>
      <report format="frames" todir="${dist}/docs/junit"/>
    </junitreport>
  </target>

  <target name="docs" depends="javadocs, clover.report, junit.report">
    <mkdir dir="${docs}"/>
    <copy todir="${dist}/docs">
      <fileset dir="${docs}"/>
    </copy>
  </target>

</project>