Changeset 80:6237c4f6ba6c in iovar


Ignore:
Timestamp:
Jan 30, 2017, 5:59:12 AM (19 months ago)
Author:
Shawn Wilson <shawn@…>
Branch:
default
Phase:
public
Message:

saw_013017_4 - Updated build process for tracking dependent webapp servlet mappings.

Files:
5 edited
1 moved

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r79 r80  
    22Copyright (C) 2011-2015 Lannocc Technologies
    33@%@~LICENSE~@%@
     4
     5saw_013017_4 - Updated build process for tracking dependent webapp servlet mappings.
    46
    57saw_013017_3 - Fix sample.project.xml for new location of idfree jar.
  • build.xml

    r79 r80  
    5151    <path id="jars.code.tests">
    5252        <fileset dir="${jars.code.tests.dir}" includes="*.jar"/>
     53    </path>
     54    <property name="jars.iovar.dir" location="${jars.dir}/iovar"/>
     55    <path id="jars.iovar">
     56        <fileset dir="${jars.iovar.dir}" includes="*.jar"/>
    5357    </path>
    5458    <property name="jars.run.dir" location="${jars.dir}/run"/>
     
    7478        <path refid="jars.code"/>
    7579        <path refid="jars.common"/>
     80        <path refid="jars.iovar"/>
    7681        <path refid="jars.run"/>
    7782        <path refid="jars.servlet-api"/>
     
    8287        <path refid="jars.code"/>
    8388        <path refid="jars.common"/>
     89        <path refid="jars.iovar"/>
    8490        <path refid="jars.servlet-api"/>
    8591    </path>
     
    185191
    186192    <!-- loads the ant-contrib tasks... needed for 'foreach' -->
    187     <target name="ant.task.contrib">
     193    <target name="ant.task.contrib" depends="tasks.init, code.init">
    188194        <taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="tasks.classpath"/>
    189195    </target>
    190196   
    191     <target name="ant.task.WebBuilder">
     197    <target name="ant.task.WebBuilder" depends="tasks.init, code.init">
    192198        <taskdef name="web-build" classname="${tasks.pkg}.WebBuilder" classpathref="tasks.classpath"/>
    193199    </target>
     
    304310            <fileset dir="${jars.common.dir}" includes="*.url"/>
    305311        </foreach>
     312        <foreach target="project.update.iovar" param="project.update.file">
     313            <fileset dir="${jars.iovar.dir}" includes="*.url"/>
     314        </foreach>
    306315        <foreach target="project.update.run" param="project.update.file">
    307316            <fileset dir="${jars.run.dir}" includes="*.url"/>
     
    319328        <loadfile property="project.update.url" srcFile="${project.update.file}"/>
    320329        <get dest="${jars.common.dir}" src="${project.update.url}" verbose="on" usetimestamp="true"/>
     330    </target>
     331    <target name="project.update.iovar">
     332        <loadfile property="project.update.url" srcFile="${project.update.file}"/>
     333        <get dest="${jars.iovar.dir}" src="${project.update.url}" verbose="on" usetimestamp="true"/>
    321334    </target>
    322335    <target name="project.update.run">
     
    527540                <include name="**/*.class"/>
    528541            </fileset>
    529             <!-- we include the jars/**.url files to other scripts can figure out dependencies from the jar
     542            <!-- we include the jars/**.url files so other scripts can figure out dependencies from the jar
    530543                 (mapped to /sys/jars/*) -->
    531544            <mappedresources>
     
    535548                <globmapper from="*" to="sys/jars/*"/>
    536549            </mappedresources>
     550            <mappedresources>
     551                <fileset dir="${app.dir}" followsymlinks="false">
     552                    <include name="${project.name}.web.xml"/>
     553                </fileset>
     554                <globmapper from="*" to="sys/servlets/*"/>
     555            </mappedresources>
    537556        </jar>
    538557    </target>
     
    540559   
    541560    <target name="app.webxml" depends="ant.task.WebBuilder">
     561        <!-- extract web.xml snippets from any iovar jar dependencies -->
     562        <unzip dest="${tasks.dir}">
     563            <fileset dir="${jars.iovar.dir}">
     564                <include name="**/*.jar"/>
     565            </fileset>
     566            <patternset>
     567                <include name="sys/servlets/**"/>
     568            </patternset>
     569        </unzip>
     570
    542571        <web-build
    543572            dir="${project.dir}"
    544573            src="${project.dir}/etc/web.xml"
     574            include="${tasks.dir}/sys/servlets"
    545575            dst="${app.dir}/web.xml"
    546576            links="${app.dir}/${project.name}.web.xml"
  • nbproject/sample.project.xml

    r79 r80  
    9797            <compilation-unit>
    9898                <package-root>src</package-root>
    99                 <classpath mode="compile">WEB-INF/lib/jars/common/idfree-1.0-dev.jar:WEB-INF/lib/jars/code/commons-fileupload-1.2.1.jar:WEB-INF/lib/jars/code/xstream-1.4.7.jar:WEB-INF/lib/jars/code/httpclient-4.3.3.jar:WEB-INF/lib/jars/code/httpcore-4.3.2.jar:/usr/share/tomcat-servlet-api-2.5/lib/servlet-api.jar:/usr/share/tomcat-6/lib/catalina.jar:/usr/share/ant/lib/ant.jar</classpath>
     99                <classpath mode="compile">WEB-INF/lib/jars/iovar/idfree-1.0-dev.jar:WEB-INF/lib/jars/code/commons-fileupload-1.2.1.jar:WEB-INF/lib/jars/code/xstream-1.4.7.jar:WEB-INF/lib/jars/code/httpclient-4.3.3.jar:WEB-INF/lib/jars/code/httpcore-4.3.2.jar:/usr/share/tomcat-servlet-api-2.5/lib/servlet-api.jar:/usr/share/tomcat-6/lib/catalina.jar:/usr/share/ant/lib/ant.jar</classpath>
    100100                <source-level>1.5</source-level>
    101101            </compilation-unit>
  • src/win/iovar/ant/WebBuilder.java

    r51 r80  
    1616// 3rd-party imports:
    1717import org.apache.tools.ant.*;
     18import org.apache.tools.ant.types.Reference;
    1819
    1920/**
     
    3435    Integer sqlStart;
    3536    String excludeDirs;
     37    Reference classpathRef;
    3638   
    3739    public void setSrc (final File src)
     
    5456        this.include = include;
    5557    }
    56 
     58   
    5759    public void setLinks (final File links)
    5860    {
     
    7981    }
    8082   
     83    /**
     84     * Classpath reference to use when checking to see if links extend Servlet class.
     85     */
     86    public void setClasspathRef (final Reference classpathRef)
     87    {
     88        this.classpathRef = classpathRef;
     89    }
     90   
    8191   
    8292    void validateAttributes () throws BuildException, IOException
     
    8797        if (dir==null) throw new BuildException ("Must specify root directory to search with 'dir' attribute");
    8898        if (! (dir.exists () && dir.isDirectory ())) throw new BuildException ("Search root does not exist or is not a directory: "+dir.getCanonicalPath ());
    89         if (include!=null && ! (include.exists () && include.isFile ())) throw new BuildException ("Include file does not exist or is not a file: "+include.getCanonicalPath ());
     99        if (include!=null && ! (include.exists () && (include.isFile () || include.isDirectory()))) throw new BuildException ("Include file does not exist or is not a file/directory: "+include.getCanonicalPath ());
    90100        if (links!=null && links.exists () && !links.isFile ()) throw new BuildException ("Links target exists but is not a file: "+links.getCanonicalPath ());
    91101        if (startupBegin!=null && startupBegin<0) throw new BuildException ("Startup begin parameter must be positive");
     
    108118                    if (include!=null)
    109119                    {
    110                         out.write ("    <!-- iovar include begin ("+include+") -->");
    111                         out.newLine ();
    112 
    113                         final BufferedReader iin = new BufferedReader (new FileReader (include));
    114                         for (String iline; (iline = iin.readLine ())!=null; )
    115                         {
    116                             out.write (iline);
    117                             out.newLine ();
    118                         }
    119 
    120                         out.write ("    <!-- iovar include end -->");
    121                         out.newLine ();
    122                         out.newLine ();
     120                        if (include.isFile ())
     121                        {
     122                            includeFile (include, out);
     123                        }
     124                        else if (include.isDirectory ())
     125                        {
     126                            for (final File file : include.listFiles ())
     127                            {
     128                                includeFile (file, out);
     129                            }
     130                        }
     131                        else
     132                        {
     133                            throw new IOException ("not a file or directory: " + include);
     134                        }
    123135                    }
    124136
     
    146158                        }
    147159                       
    148                         try
     160                        //try
    149161                        {
    150162                            final int mysql = clname.indexOf ("dev/mysql/");
     
    183195                                out.newLine ();
    184196                            }
    185                             else if (!check || Servlet.class.isAssignableFrom (Class.forName (clname)))
     197                            else if (!check || true /* Servlet.class.isAssignableFrom (Class.forName (clname))*/)
     198                                // It's too cumbersome to try checking for servlet inheritence here...
     199                                //  because the class we're checking may not be in our current classpath.
    186200                            {
    187201                                if (! servlets.contains (clname))
     
    243257                            }
    244258                        }
     259                        /*
    245260                        catch (final ClassNotFoundException e)
    246261                        {
    247262                            log ("class not found: "+clname, Project.MSG_ERR);
    248263                        }
     264                        */
    249265                    }
    250266                    else
     
    280296    }
    281297   
     298    static void includeFile (final File file, final BufferedWriter out) throws IOException
     299    {
     300        out.write ("    <!-- iovar include begin ("+file+") -->");
     301        out.newLine ();
     302
     303        final BufferedReader iin = new BufferedReader (new FileReader (file));
     304        for (String iline; (iline = iin.readLine ())!=null; )
     305        {
     306            out.write (iline);
     307            out.newLine ();
     308        }
     309
     310        out.write ("    <!-- iovar include end -->");
     311        out.newLine ();
     312        out.newLine ();    }
     313   
    282314    Map<File,String> findLinks () throws IOException
    283315    {
  • src/win/iovar/web/bin/List.java

    r76 r80  
    8686        User user; try
    8787        {
    88             user = Authentication.getUser (context, session);
     88            user = Authentication.getUser (context, req.getSession (), session);
    8989        }
    9090        catch (final Authentication.NotLoggedInException e)
Note: See TracChangeset for help on using the changeset viewer.