[Yanel-dev] Re: [Yanel-commits] rev 22914 - in public/yanel/trunk/src/realms: use-cases/yanel/rti welcome-admin/yanel/resources welcome-admin/yanel/resources/update-webapp welcome-admin/yanel/resources/update-webapp/build welcome-admin/yanel/resources/update-webapp/build/classes welcome-admin/yanel/resources/update-webapp/build/classes/org welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources welcome-admin/yanel/resources/update-webapp/build/lib welcome-admin/yanel/resources/update-webapp/config welcome-admin/yanel/resources/update-webapp/rdf welcome-admin/yanel/resources/update-webapp/src welcome-admin/yanel/resources/update-webapp/src/build welcome-admin/yanel/resources/update-webapp/src/java welcome-admin/yanel/resources/update-webapp/src/java/org welcome-admin/yanel/resources/update-webapp/src/java/org/wyona welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources welcome-admin/yanel/resources/update-webapp/xslt

Josias Thöny josias.thoeny at wyona.com
Fri Feb 23 17:01:01 CET 2007


Hi,

michi at wyona.com wrote:
> Author: michi
> Date: 2007-02-23 15:12:04 +0100 (Fri, 23 Feb 2007)
> New Revision: 22914
> 
> Added:
>    public/yanel/trunk/src/realms/use-cases/yanel/rti/update-webapp.html.yanel-rc
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build.xml

>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/

Did you check in the build dir on purpose?
It's causing some problems with my svn when I build and then try to do 
svn up.

Josias


>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/InstallRDF.class
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/UpdateRDF$UpdateVersions.class
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/UpdateRDF.class
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/UpdateResource.class
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/VersionComparator$1.class
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/VersionComparator$VersionPart.class
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/VersionComparator.class
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/VersionPartTokenizer.class
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/lib/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/lib/yanel-resource-update-0.0.1-dev-rXXX.jar
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/config/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/config/update_de.properties
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/config/update_en.properties
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/rdf/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/rdf/install.rdf
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/rdf/update.rdf
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/resource.xml
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/build/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/build/build.properties
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/build/dependencies.xml
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/InstallRDF.java
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/UpdateRDF.java
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/UpdateResource.java
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/VersionComparator.java
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/test/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/xslt/
>    public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/xslt/update.xsl
> Log:
> update webapp resource added
> 
> Added: public/yanel/trunk/src/realms/use-cases/yanel/rti/update-webapp.html.yanel-rc
> ===================================================================
> --- public/yanel/trunk/src/realms/use-cases/yanel/rti/update-webapp.html.yanel-rc	2007-02-23 14:08:18 UTC (rev 22913)
> +++ public/yanel/trunk/src/realms/use-cases/yanel/rti/update-webapp.html.yanel-rc	2007-02-23 14:12:04 UTC (rev 22914)
> @@ -0,0 +1,5 @@
> +<?xml version="1.0"?>
> +
> +<yanel:resource-config xmlns:yanel="http://www.wyona.org/yanel/rti/1.0">
> +  <yanel:rti name="update-webapp" namespace="http://www.wyona.org/yanel/resource/1.0"/>
> +</yanel:resource-config>
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/InstallRDF.class
> ===================================================================
> (Binary files differ)
> 
> 
> Property changes on: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/InstallRDF.class
> ___________________________________________________________________
> Name: svn:mime-type
>    + application/octet-stream
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/UpdateRDF$UpdateVersions.class
> ===================================================================
> (Binary files differ)
> 
> 
> Property changes on: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/UpdateRDF$UpdateVersions.class
> ___________________________________________________________________
> Name: svn:mime-type
>    + application/octet-stream
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/UpdateRDF.class
> ===================================================================
> (Binary files differ)
> 
> 
> Property changes on: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/UpdateRDF.class
> ___________________________________________________________________
> Name: svn:mime-type
>    + application/octet-stream
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/UpdateResource.class
> ===================================================================
> (Binary files differ)
> 
> 
> Property changes on: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/UpdateResource.class
> ___________________________________________________________________
> Name: svn:mime-type
>    + application/octet-stream
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/VersionComparator$1.class
> ===================================================================
> (Binary files differ)
> 
> 
> Property changes on: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/VersionComparator$1.class
> ___________________________________________________________________
> Name: svn:mime-type
>    + application/octet-stream
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/VersionComparator$VersionPart.class
> ===================================================================
> (Binary files differ)
> 
> 
> Property changes on: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/VersionComparator$VersionPart.class
> ___________________________________________________________________
> Name: svn:mime-type
>    + application/octet-stream
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/VersionComparator.class
> ===================================================================
> (Binary files differ)
> 
> 
> Property changes on: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/VersionComparator.class
> ___________________________________________________________________
> Name: svn:mime-type
>    + application/octet-stream
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/VersionPartTokenizer.class
> ===================================================================
> (Binary files differ)
> 
> 
> Property changes on: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/classes/org/wyona/yanel/impl/resources/VersionPartTokenizer.class
> ___________________________________________________________________
> Name: svn:mime-type
>    + application/octet-stream
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/lib/yanel-resource-update-0.0.1-dev-rXXX.jar
> ===================================================================
> (Binary files differ)
> 
> 
> Property changes on: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build/lib/yanel-resource-update-0.0.1-dev-rXXX.jar
> ___________________________________________________________________
> Name: svn:mime-type
>    + application/octet-stream
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build.xml
> ===================================================================
> --- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build.xml	2007-02-23 14:08:18 UTC (rev 22913)
> +++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/build.xml	2007-02-23 14:12:04 UTC (rev 22914)
> @@ -0,0 +1,52 @@
> +<?xml version="1.0"?>
> +
> +<project name="yanel-resource" default="compile">
> +
> +  <import file="src/build/dependencies.xml"/>
> +
> +  <target name="init" description="Initialize build" depends="dependencies">
> +    <echo>Initialize build</echo>
> +
> +    <dirname property="resource.home.dir" file="${ant.file}"/>
> +    <echo>Resource Home Directory: ${resource.home.dir}</echo>
> +
> +    <property file="${resource.home.dir}/src/build/local.build.properties"/>
> +    <property file="${resource.home.dir}/src/build/build.properties"/>
> +
> +    <path id="classpath">
> +      <pathelement path="${maven2.cp}"/>
> +    </path>
> +    <property name="resource.build.dir" value="${resource.home.dir}/build"/>
> +    <property name="resource.classes.dir" value="${resource.build.dir}/classes"/>
> +    <property name="resource.lib.dir" value="${resource.build.dir}/lib"/>
> +    <property name="resource.java.dir" value="${resource.home.dir}/src/java"/>
> +  </target>
> +
> +  <target name="compile" description="Compile Java classes" depends="init">
> +
> +    <mkdir dir="${resource.classes.dir}"/>
> +    <javac srcdir="${resource.java.dir}" destdir="${resource.classes.dir}"
> +      classpathref="classpath"
> +      debug="true"
> +    />
> +    <mkdir dir="${resource.lib.dir}"/>
> +    <jar destfile="${resource.lib.dir}/yanel-resource-${resource.name}-${resource.version}.jar"
> +      basedir="${resource.classes.dir}"
> +    />
> +  </target>
> +
> +  <target name="clean" depends="init">
> +    <delete dir="${resource.build.dir}"/>
> +  </target>
> +
> +  <target name="copy-dependencies" depends="init">
> +    <copy todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/lib">
> +      <fileset refid="maven2.resource.fileset"/>
> +      <mapper type="flatten"/>
> +    </copy>
> +    
> +    <copy todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes">
> +      <fileset dir="config" includes="update_*.properties"/>
> +    </copy>
> +  </target>
> +</project>
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/config/update_de.properties
> ===================================================================
> --- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/config/update_de.properties	2007-02-23 14:08:18 UTC (rev 22913)
> +++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/config/update_de.properties	2007-02-23 14:12:04 UTC (rev 22914)
> @@ -0,0 +1 @@
> +checkupdtae = Check for Update
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/config/update_en.properties
> ===================================================================
> --- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/config/update_en.properties	2007-02-23 14:08:18 UTC (rev 22913)
> +++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/config/update_en.properties	2007-02-23 14:12:04 UTC (rev 22914)
> @@ -0,0 +1 @@
> +checkupdtae = Check for Update
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/rdf/install.rdf
> ===================================================================
> --- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/rdf/install.rdf	2007-02-23 14:08:18 UTC (rev 22913)
> +++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/rdf/install.rdf	2007-02-23 14:12:04 UTC (rev 22914)
> @@ -0,0 +1,15 @@
> +<?xml version="1.0"?>
> +
> +<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> +     xmlns:em="http://www.mozilla.org/2004/em-rdf#">
> +
> +  <Description about="urn:wyona:install-manifest">
> +    <em:id>yanel at wyona.com</em:id>
> +    <em:version>@VERSION@</em:version>
> +    <em:name>Wyona Yanel</em:name>
> +    <em:description>Everything is Content.</em:description>
> +    <em:contributor>Michael Wechner (Wyona Inc.)</em:contributor>
> +    <em:homepageURL>http://yanel.wyona.org/</em:homepageURL>
> +    <em:updateURL>http://yanel.wyona.org/download/update.rdf</em:updateURL>
> +  </Description>
> +</RDF>
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/rdf/update.rdf
> ===================================================================
> --- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/rdf/update.rdf	2007-02-23 14:08:18 UTC (rev 22913)
> +++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/rdf/update.rdf	2007-02-23 14:12:04 UTC (rev 22914)
> @@ -0,0 +1,29 @@
> +<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> +     xmlns:um="http://www.wyona.org/update-manager/1.0#">
> +
> +  <rdf:Description rdf:about="urn:wyona:application:updates">
> +    <um:versions>
> +      <rdf:Seq>
> +        <rdf:li rdf:resource="urn:wyona:application:update:1.0-dev-r22343"/>
> +        <rdf:li rdf:resource="urn:wyona:application:update:1.0-dev-r22342"/>
> +      </rdf:Seq>
> +    </um:versions>
> +  </rdf:Description>  
> +  
> +  <rdf:Description rdf:about="urn:wyona:application:update:1.0-dev-r22342">
> +    <um:version>1.0-dev-r22342</um:version>
> +    <um:targetApplication>
> +      <rdf:Description rdf:about="urn:wyona:targetapplication:tomcat">
> +        <um:minVersion>5.0.0</um:minVersion>
> +        <um:maxVersion>5.5.*</um:maxVersion>
> +	    <um:updateLink>http://yanel.wyona.org/download/wyona-yanel-jetty-build-0.1.1.xml</um:updateLink>
> +      </rdf:Description>
> +    </um:targetApplication>
> +  </rdf:Description>
> +
> +  <rdf:Description rdf:about="urn:wyona:application:update:1.0-dev-r22343">
> +    <um:version>1.0-dev-r22343</um:version>
> +    <um:updateURL>http://yanel.wyona.org/download/binary-snapshots/unix/wyona-yanel-SNAPSHOT-1.0-dev-r22342-bin.tar.gz</um:updateURL>
> +  </rdf:Description>
> +
> +</rdf:RDF>
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/resource.xml
> ===================================================================
> --- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/resource.xml	2007-02-23 14:08:18 UTC (rev 22913)
> +++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/resource.xml	2007-02-23 14:12:04 UTC (rev 22914)
> @@ -0,0 +1,17 @@
> +<?xml version="1.0"?>
> +
> +<resource xmlns="http://www.wyona.org/yanel/1.0"
> +  name="update-webapp"
> +  namespace="http://www.wyona.org/yanel/resource/1.0"
> +  class="org.wyona.yanel.impl.resources.UpdateResource"
> +  >
> +<description>
> +Check for updates of Yanel webapp
> +</description>
> +
> +<rtd>
> +<!--
> +  <property name="foo" default-value="bar"/>
> +-->
> +</rtd>
> +</resource>
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/build/build.properties
> ===================================================================
> --- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/build/build.properties	2007-02-23 14:08:18 UTC (rev 22913)
> +++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/build/build.properties	2007-02-23 14:12:04 UTC (rev 22914)
> @@ -0,0 +1,2 @@
> +resource.name=update
> +resource.version=0.0.1-dev-rXXX
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/build/dependencies.xml
> ===================================================================
> --- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/build/dependencies.xml	2007-02-23 14:08:18 UTC (rev 22913)
> +++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/build/dependencies.xml	2007-02-23 14:12:04 UTC (rev 22914)
> @@ -0,0 +1,27 @@
> +<?xml version="1.0"?>
> +
> +<project name="wiki-dependencies" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
> +
> +  <target name="dependencies" description="Dependencies">
> +    <artifact:remoteRepository id="wyona.remote.repository" url="http://www.wyona.org/maven2/"/>
> +
> +    <artifact:dependencies pathId="maven2.classpath" filesetId="maven2.fileset">
> +      <remoteRepository refid="wyona.remote.repository"/>
> +      <dependency groupId="wyona-org-yanel" artifactId="yanel-core"
> +                  version="${yanel.source.version}"/>
> +      <dependency groupId="avalon-framework" artifactId="avalon-framework-api" version="4.3"/>
> +      <dependency groupId="avalon-framework" artifactId="avalon-framework-impl" version="4.3"/>                                
> +      <dependency groupId="jena" artifactId="jena"
> +                  version="2.1"/>
> +    </artifact:dependencies>
> +
> +    <artifact:dependencies pathId="maven2.resource.classpath" filesetId="maven2.resource.fileset">
> +      <remoteRepository refid="wyona.remote.repository"/>
> +      <!-- No resource specific libs yet -->
> +    </artifact:dependencies>
> +
> +    <property name="maven2.cp" refid="maven2.classpath"/>
> +    <!--<echo>Maven2 classpath: ${maven2.cp}</echo>-->
> +  </target>
> +
> +</project>
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/InstallRDF.java
> ===================================================================
> --- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/InstallRDF.java	2007-02-23 14:08:18 UTC (rev 22913)
> +++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/InstallRDF.java	2007-02-23 14:12:04 UTC (rev 22914)
> @@ -0,0 +1,115 @@
> +/*
> + * Copyright 2006 Wyona
> + */
> +
> +package org.wyona.yanel.impl.resources;
> +
> +import org.apache.log4j.Category;
> +import java.io.File;
> +import java.io.InputStream;
> +import java.io.FileInputStream;
> +import com.hp.hpl.jena.rdf.model.*;
> +import com.hp.hpl.jena.vocabulary.*;
> +import com.hp.hpl.jena.rdf.model.impl.PropertyImpl;
> +import javax.servlet.http.HttpServletRequest;
> +/**
> + * 
> + */
> +public class InstallRDF {
> +    
> +    private static Category log = Category.getInstance(InstallRDF.class);
> +    private String id;
> +    private String version;
> +    private String installtype;
> +    private String updateURL;
> +    private String osName; //platform
> +    private String javaVersion;
> +    private String targetApplicationId;
> +    private String targetApplicationVersion;
> +    
> +    private String updateManagerNS = "http://www.wyona.org/update-manager/1.0#"; 
> +    
> +    public InstallRDF(InputStream in, HttpServletRequest request){
> +        setServerInfoDetail(request);
> +        
> +        osName = System.getProperty("os.name");
> +        javaVersion = System.getProperty("java.version");
> +        
> +        Model model = ModelFactory.createDefaultModel();
> +        //read the RDF/XML file
> +        model.read(in, "");
> +        parseModel(model);
> +    }
> +
> +    private void parseModel(Model model) {
> +        Resource install = model.getResource("urn:wyona:application:install");
> +        
> +        Property idProperty = new PropertyImpl(updateManagerNS, "id");
> +        id = install.getRequiredProperty(idProperty).getString();
> +        Property versionProperty = new PropertyImpl(updateManagerNS, "version");
> +        version = install.getRequiredProperty(versionProperty).getString();
> +        Property installtypeProperty = new PropertyImpl(updateManagerNS, "installtype");
> +        installtype = install.getRequiredProperty(installtypeProperty).getString();
> +
> +        Property updateURLProperty = new PropertyImpl(updateManagerNS, "updateURL");
> +        updateURL = install.getRequiredProperty(updateURLProperty).getString();
> +
> +        /*Property targetApplicationProperty = new PropertyImpl(updateManagerNS, "targetApplication");
> +        Resource targetApplication = install.getProperty(targetApplicationProperty).getResource();
> +        
> +        Property targetApplicationIdProperty = new PropertyImpl(updateManagerNS, "id");
> +        targetApplicationId = targetApplication.getRequiredProperty(targetApplicationIdProperty).getString();
> +        Property targetApplicationVersionProperty = new PropertyImpl(updateManagerNS, "version");
> +        targetApplicationVersion = targetApplication.getRequiredProperty(targetApplicationVersionProperty).getString();*/
> +        
> +    }
> +
> +    private void setServerInfoDetail(HttpServletRequest request) {
> +        //this needs to be implemented for each servlet container since it doesn't seem the string of getServerInfo() is standardized
> +        String serverInfo = request.getSession().getServletContext().getServerInfo();
> +        
> +        if (serverInfo.startsWith("Apache Tomcat")) {
> +            targetApplicationId  = serverInfo.split("/")[0];
> +            targetApplicationVersion  = serverInfo.split("/")[1];
> +        } else {
> +            targetApplicationId  = serverInfo.split("/")[0];
> +            targetApplicationVersion  = serverInfo.split("/")[1];
> +            log.info("the dedection of the servlet container name and version is just a guess. if there is something wrong please implement your servlets getServerInfo() string. thanks :)");
> +        }
> +        
> +    }
> +    
> +
> +    public String getId() {
> +        return id;
> +    }
> +
> +    public String getInstalltype() {
> +        return installtype;
> +    }
> +
> +    public String getUpdateURL() {
> +        return updateURL;
> +    }
> +
> +    public String getVersion() {
> +        return version;
> +    }
> +
> +    public String getJavaVersion() {
> +        return javaVersion;
> +    }
> +
> +    public String getOsName() {
> +        return osName;
> +    }
> +
> +    public String getTargetApplicationId() {
> +        return targetApplicationId;
> +    }
> +
> +    public String getTargetApplicationVersion() {
> +        return targetApplicationVersion;
> +    }
> +    
> +}
> \ No newline at end of file
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/UpdateRDF.java
> ===================================================================
> --- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/UpdateRDF.java	2007-02-23 14:08:18 UTC (rev 22913)
> +++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/UpdateRDF.java	2007-02-23 14:12:04 UTC (rev 22914)
> @@ -0,0 +1,104 @@
> +/*
> + * Copyright 2006 Wyona
> + */
> +
> +package org.wyona.yanel.impl.resources;
> +
> +import org.apache.log4j.Category;
> +import org.wyona.yanel.impl.resources.VersionComparator;
> +
> +import java.io.File;
> +import java.io.InputStream;
> +import java.io.FileInputStream;
> +import java.util.ArrayList;
> +import com.hp.hpl.jena.rdf.model.*;
> +import com.hp.hpl.jena.vocabulary.*;
> +import com.hp.hpl.jena.rdf.model.impl.PropertyImpl;
> +/**
> + * 
> + */
> +public class UpdateRDF {
> +    
> +    private static Category log = Category.getInstance(InstallRDF.class);
> +    private ArrayList updateVersions = new ArrayList();
> +    private Model updateRdfModel;
> +    private InstallRDF installRdf;
> +    
> +    private String updateManagerNS = "http://www.wyona.org/update-manager/1.0#"; 
> +    
> +    public UpdateRDF(InputStream in, InstallRDF installRdf) throws Exception{
> +        Model model = ModelFactory.createDefaultModel();
> +        //read the RDF/XML file
> +        model.read(in, "");
> +        this.updateRdfModel = model;
> +        this.installRdf = installRdf;
> +        if (installRdf == null) {
> +            throw new Exception("InstallRDF should not be null");
> +        }
> +        setUpdateVersions();
> +    }
> +
> +    private void setUpdateVersions() {
> +        Resource update = updateRdfModel.getResource("urn:wyona:application:updates");
> +        
> +        Property versionsProperty = new PropertyImpl(updateManagerNS, "versions");
> +        Seq versions = update.getProperty(versionsProperty).getSeq();
> +        
> +        NodeIterator iter2 = versions.iterator();
> +        Property versionProperty = new PropertyImpl(updateManagerNS, "version");
> +        Property idProperty = new PropertyImpl(updateManagerNS, "id");
> +        Property targetApplicationProperty = new PropertyImpl(updateManagerNS, "targetApplication");
> +        Property minVersionProperty = new PropertyImpl(updateManagerNS, "minVersion");
> +        Property maxVersionProperty = new PropertyImpl(updateManagerNS, "maxVersion");
> +        Property changeLogProperty = new PropertyImpl(updateManagerNS, "changelog");
> +        Property updateLinkProperty = new PropertyImpl(updateManagerNS, "updateLink");
> +        
> +        while (iter2.hasNext()) {
> +            Resource versionResource = ((Resource) iter2.next());
> +            
> +            //check id
> +            if (versionResource.getProperty(idProperty).getString().equals(installRdf.getId())) {
> +                //check for targetApplicationId
> +                Seq targetApplicationSeq = versionResource.getProperty(targetApplicationProperty).getSeq();
> +                NodeIterator targetApplicationIter = targetApplicationSeq.iterator();
> +                while (targetApplicationIter.hasNext()) {
> +                    Resource targetApplicationResource = ((Resource) targetApplicationIter.next());
> +                    String test1 = targetApplicationResource.getProperty(idProperty).getString();
> +                    String test2 = installRdf.getTargetApplicationId();
> +                    System.out.println("taid: "+test1 +" install: "+ test2);
> +                    
> +                    if (targetApplicationResource.getProperty(idProperty).getString().equals(installRdf.getTargetApplicationId())) {
> +
> +                        //check for minorVersion
> +                        String minVersion = targetApplicationResource.getProperty(minVersionProperty).getString();
> +                        String installVersion = installRdf.getTargetApplicationVersion();
> +                        VersionComparator versionComparator = new VersionComparator(); 
> +                        if (versionComparator.compare(installVersion, minVersion) >= 0) {
> +                            //check for maxVersion
> +                            String maxVersion = targetApplicationResource.getProperty(maxVersionProperty).getString();
> +                            if (versionComparator.compare(maxVersion, installVersion) >= 0) {
> +                                UpdateVersions updateVersions = new UpdateVersions();
> +                                updateVersions.version = versionResource.getProperty(versionProperty).getString();
> +                                updateVersions.changeLog = versionResource.getProperty(changeLogProperty).getString();
> +                                updateVersions.updateLink = targetApplicationResource.getProperty(updateLinkProperty).getString();
> +                                this.updateVersions.add(updateVersions);
> +                            }
> +                        }
> +                    }
> +                }
> +
> +                
> +            }
> +        }
> +    }
> +
> +    public ArrayList getUpdateVersions() {
> +        return updateVersions;
> +    }
> +    
> +    public class UpdateVersions {     
> +        String version;
> +        String changeLog;
> +        String updateLink;
> +    }
> +}
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/UpdateResource.java
> ===================================================================
> --- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/UpdateResource.java	2007-02-23 14:08:18 UTC (rev 22913)
> +++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/UpdateResource.java	2007-02-23 14:12:04 UTC (rev 22914)
> @@ -0,0 +1,228 @@
> +/*
> + * Copyright 2006 Wyona
> + */
> +
> +package org.wyona.yanel.impl.resources;
> +
> +import org.apache.log4j.Category;
> +import org.wyona.yanel.core.Path;
> +import org.wyona.yanel.core.Resource;
> +import org.wyona.yanel.core.ResourceConfiguration;
> +import org.wyona.yanel.core.api.attributes.ViewableV2;
> +import org.wyona.yanel.core.attributes.viewable.View;
> +import org.wyona.yanel.core.attributes.viewable.ViewDescriptor;
> +import javax.servlet.http.HttpServletRequest;
> +
> +import org.wyona.yanel.core.transformation.I18nTransformer;
> +import org.wyona.yanel.impl.resources.UpdateRDF.UpdateVersions;
> +
> +import javax.xml.transform.Transformer;
> +import javax.xml.transform.TransformerConfigurationException;
> +import javax.xml.transform.TransformerException;
> +import javax.xml.transform.TransformerFactory;
> +import javax.xml.transform.TransformerFactoryConfigurationError;
> +import javax.xml.transform.dom.DOMSource;
> +import java.io.ByteArrayOutputStream;
> +import java.io.ByteArrayInputStream;
> +import java.io.FileInputStream;
> +import java.util.ArrayList;
> +
> +import javax.xml.parsers.DocumentBuilder;
> +import javax.xml.parsers.DocumentBuilderFactory;
> +import javax.xml.parsers.SAXParser;
> +import javax.xml.parsers.SAXParserFactory;
> +import java.io.File;
> +import javax.xml.transform.stream.StreamResult;
> +import javax.xml.transform.stream.StreamSource;
> +import java.net.URL;
> +import java.io.InputStream;
> +import org.w3c.dom.Document;
> +import org.w3c.dom.Element;
> +import org.w3c.dom.NodeList;
> +import org.w3c.dom.Node;
> +
> +
> +
> +import com.hp.hpl.jena.rdf.model.*;
> +
> +
> +
> +/**
> + * 
> + */
> +public class UpdateResource extends Resource implements ViewableV2 {
> +
> +    private static Category log = Category.getInstance(UpdateResource.class);
> +    private String defaultLanguage = "en";
> +    private String language = null;
> +    
> +    /**
> +     * 
> +     */
> +    public UpdateResource() {
> +    }
> +
> +    /**
> +     * 
> +     */
> +    public ViewDescriptor[] getViewDescriptors() {
> +        return null;
> +    }
> +
> +    /**
> +     * 
> +     */
> +    public View getView(String viewId) throws Exception {
> +
> +        String path = getPath();
> +        HttpServletRequest request = getRequest();
> +        
> +        String submit = request.getParameter("submit");
> +        String check = request.getParameter("check");
> +        String update = request.getParameter("update");
> +
> +        // Get language
> +        try {
> +            language = request.getParameter("yanel.meta.language");
> +        } catch (Exception e) {
> +            log.debug("language param is not found will use default : " + language);
> +            language = defaultLanguage;
> +        }
> +        if (language == null || ("").equals(language)) {
> +            log.debug("language param is empty or null : " + language);
> +            language = defaultLanguage;
> +        }
> +
> +        Transformer transformer = null;
> +        I18nTransformer i18nTransformer = new I18nTransformer("update", language);
> +        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
> +        View defaultView = new View();
> +        DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
> +        
> +        try {
> +
> +                    //install.rdf
> +                    String WEBINFPath = request.getSession().getServletContext().getRealPath("WEB-INF");
> +                    
> +                    InputStream installRdfIn= new FileInputStream(new File(WEBINFPath + File.separator + "classes" + File.separator + "install.rdf"));
> +                    InstallRDF installRdf = new InstallRDF(installRdfIn, request);
> +
> +                    
> +                    System.out.println(installRdf.getId());
> +                    System.out.println(installRdf.getInstalltype());
> +                    System.out.println(installRdf.getOsName());
> +                    System.out.println(installRdf.getTargetApplicationId());
> +                    System.out.println(installRdf.getTargetApplicationVersion());
> +                    System.out.println(installRdf.getUpdateURL());
> +                    System.out.println(installRdf.getVersion());
> +                    System.out.println(installRdf.getJavaVersion());
> +                    
> +                    
> +                    
> +                    URL UpdateRdfUrl = new URL(installRdf.getUpdateURL());
> +                    InputStream updateRdfIn = UpdateRdfUrl.openStream();
> +                    UpdateRDF updateRdf = new UpdateRDF(updateRdfIn, installRdf);
> +                    
> +
> +                    
> +                    if (installRdf.getInstalltype().equals("source")) {
> +                        StringBuffer message = new StringBuffer();
> +                        message.append("<p>");
> +                        message.append("This Yanel was installed from source. You can only use the updater if you installed yanel from binary. Please use svn up, build.sh");
> +                        message.append("</p>");
> +                        
> +                        byteArrayOutputStream = getOutput(message);
> +                        //transformer = TransformerFactory.newInstance().newTransformer();
> +
> +                        
> +                    } else if (installRdf.getInstalltype().equals("bin-snapshot")) {
> +                        StringBuffer message = new StringBuffer();
> +                        message.append("<p>");
> +                        message.append("This are the updates which you can get:");
> +                        message.append("</p>");
> +                        message.append("<ul>");
> +                        for (int i = 0; i < updateRdf.getUpdateVersions().size(); i++) {
> +                            UpdateVersions test = (UpdateVersions) updateRdf.getUpdateVersions().get(i);
> +                            if (test.version != installRdf.getVersion()) {
> +                                message.append("<li>Version: " + test.version + " ChangeLog: " + test.changeLog + " Update Link: " + test.updateLink + "</li>");
> +                            }
> +                        }
> +                        message.append("</ul>");
> +                        byteArrayOutputStream = getOutput(message);
> +                    }
> +                    //this.installRdf.put("updateURL", installRdf.getChild("Description").getChild("um:updateURL").getValue());
> +                    //this.installRdf.put("version", installRdf.getChild("Description").getChild("um:version").getValue()); 
> +                    //transformer.transform(new StreamSource(InstallRdf), new StreamResult(byteArrayOutputStream));
> +                    
> +                    //update.rdf
> +                    //URL UpdateRdfUrl = new URL(installRdf.getUpdateURL());
> +                    //InputStream UpdateRdf = UpdateRdfUrl.openStream();
> +                    
> +                    //Configuration updateRdf = configBuilder.build(UpdateRdf);
> +                    //Document UpdateRdfDoc = builder.parse(UpdateRdf);
> +                    //transformer = TransformerFactory.newInstance().newTransformer();
> +                    //transformer.transform(new DOMSource(UpdateRdfDoc), new StreamResult(byteArrayOutputStream));
> +                    
> +                    
> +
> +            SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
> +            saxParser.parse(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()),
> +                    i18nTransformer);
> +        } catch (Exception e) {
> +            log.error(e.getMessage(), e);
> +        }
> +
> +        defaultView.setMimeType("application/xhtml+xml");
> +        defaultView.setInputStream(i18nTransformer.getInputStream());
> +        return defaultView;
> +    }
> +
> +    private ByteArrayOutputStream getOutput(StringBuffer insert) throws TransformerConfigurationException {
> +        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
> +        StringBuffer sb = new StringBuffer();
> +        sb.append("<?xml version=\"1.0\"?>");
> +        sb.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
> +        sb.append("<head>");
> +        sb.append("<title>Update Yanel</title>");
> +        sb.append("</head>");
> +        sb.append("<body>");
> +        sb.append(insert);
> +        sb.append("</body>");
> +        sb.append("</html>");
> +        
> +        try {
> +            Transformer transformer = TransformerFactory.newInstance().newTransformer();
> +            transformer.transform(new StreamSource(new java.io.StringBufferInputStream(sb.toString())), new StreamResult(byteArrayOutputStream));
> +        } catch (Exception e) {
> +            log.error(e.getMessage(), e);
> +        }
> +        return byteArrayOutputStream;
> +    }
> +    
> +    public boolean exists() throws Exception {
> +        // NOTE does exists() make sense for this resource?
> +        log.warn("Not implemented yet!");
> +        return true;
> +    }
> +
> +    /**
> +     * 
> +     */
> +    public long getSize() throws Exception {
> +        // NOTE does getSize make sense for this resource?
> +        return getRealm().getRepository().getSize(new Path(getPath()));
> +    }
> +    
> +    /**
> +     * Get property value from resource configuration
> +     */
> +    private String getResourceProperty(String name) throws Exception {
> +        ResourceConfiguration rc = getConfiguration();
> +        if (rc != null) return rc.getProperty(name);
> +        return getRTI().getProperty(name);
> +    }
> +    
> +    public String getMimeType(String viewId){
> +        return "application/xml";
> +    }
> +}
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/VersionComparator.java
> ===================================================================
> --- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/VersionComparator.java	2007-02-23 14:08:18 UTC (rev 22913)
> +++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/VersionComparator.java	2007-02-23 14:12:04 UTC (rev 22914)
> @@ -0,0 +1,268 @@
> +/* ***** BEGIN LICENSE BLOCK *****
> + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
> + *
> + * The contents of this file are subject to the Mozilla Public License Version
> + * 1.1 (the "License"); you may not use this file except in compliance with
> + * the License. You may obtain a copy of the License at
> + * http://www.mozilla.org/MPL/
> + *
> + * Software distributed under the License is distributed on an "AS IS" basis,
> + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
> + * for the specific language governing rights and limitations under the
> + * License.
> + *
> + * The Original Code is Java XPCOM Bindings.
> + *
> + * The Initial Developer of the Original Code is
> + * IBM Corporation.
> + * Portions created by the Initial Developer are Copyright (C) 2005
> + * IBM Corporation. All Rights Reserved.
> + *
> + * Contributor(s):
> + *   Javier Pedemonte (jhpedemonte at gmail.com)
> + *
> + * Alternatively, the contents of this file may be used under the terms of
> + * either the GNU General Public License Version 2 or later (the "GPL"), or
> + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
> + * in which case the provisions of the GPL or the LGPL are applicable instead
> + * of those above. If you wish to allow use of your version of this file only
> + * under the terms of either the GPL or the LGPL, and not to allow others to
> + * use your version of this file under the terms of the MPL, indicate your
> + * decision by deleting the provisions above and replace them with the notice
> + * and other provisions required by the GPL or the LGPL. If you do not delete
> + * the provisions above, a recipient may use your version of this file under
> + * the terms of any one of the MPL, the GPL or the LGPL.
> + *
> + * ***** END LICENSE BLOCK ***** */
> +
> +package org.wyona.yanel.impl.resources;
> +
> +import java.util.Enumeration;
> +import java.util.StringTokenizer;
> +
> +
> +
> +/**
> + * Version strings are dot-separated sequences of version-parts.
> + * <p>
> + * A version-part consists of up to four parts, all of which are optional:
> + * <br><code>
> + * &lt;number-a&gt;&lt;string-b&gt;&lt;number-c&gt;
> + * &lt;string-d (everything else)&gt;
> + * </code> <p>
> + * A version-part may also consist of a single asterisk "*" which indicates
> + * "infinity".
> + * <p>
> + * Numbers are base-10, and are zero if left out.
> + * Strings are compared bytewise.
> + * <p>
> + * For additional backwards compatibility, if "string-b" is "+" then
> + * "number-a" is incremented by 1 and "string-b" becomes "pre".
> + * <p> <pre>
> + * 1.0pre1
> + * < 1.0pre2  
> + *   < 1.0 == 1.0.0 == 1.0.0.0
> + *     < 1.1pre == 1.1pre0 == 1.0+
> + *       < 1.1pre1a
> + *         < 1.1pre1
> + *           < 1.1pre10a
> + *             < 1.1pre10
> + * </pre>
> + * Although not required by this interface, it is recommended that
> + * numbers remain within the limits of a signed char, i.e. -127 to 128.
> + */
> +public class VersionComparator {
> +
> +
> +  /**
> +   * Compare two version strings
> +   * @param A   a version string
> +   * @param B   a version string
> +   * @return a value less than 0 if A < B;
> +   *         the value 0 if A == B;
> +   *         or a value greater than 0 if A > B
> +   */
> +  public int compare(String A, String B) {
> +    int result;
> +    String a = A, b = B;
> +
> +    do {
> +      VersionPart va = new VersionPart();
> +      VersionPart vb = new VersionPart();
> +      a = parseVersionPart(a, va);
> +      b = parseVersionPart(b, vb);
> +
> +      result = compareVersionPart(va, vb);
> +      if (result != 0) {
> +        break;
> +      }
> +    } while (a != null || b != null);
> +
> +    return result;
> +  }
> +
> +  private class VersionPart {
> +    int     numA = 0;
> +    String  strB;
> +    int     numC = 0;
> +    String  extraD;
> +  }
> +
> +  private static String parseVersionPart(String aVersion, VersionPart result) {
> +    if (aVersion == null || aVersion.length() == 0) {
> +      return aVersion;
> +    }
> +
> +    StringTokenizer tok = new StringTokenizer(aVersion.trim(), ".");
> +    String part = tok.nextToken();
> +
> +    if (part.equals("*")) {
> +      result.numA = Integer.MAX_VALUE;
> +      result.strB = "";
> +    } else {
> +      VersionPartTokenizer vertok = new VersionPartTokenizer(part);
> +      try {
> +        result.numA = Integer.parseInt(vertok.nextToken());
> +      } catch (NumberFormatException e) {
> +        // parsing error; default to zero like 'strtol' C function
> +        result.numA = 0;
> +      }
> +
> +      if (vertok.hasMoreElements()) {
> +        String str = vertok.nextToken();
> +
> +        // if part is of type "<num>+"
> +        if (str.charAt(0) == '+') {
> +          result.numA++;
> +          result.strB = "pre";
> +        } else {
> +          // else if part is of type "<num><alpha>..."
> +          result.strB = str;
> +
> +          if (vertok.hasMoreTokens()) {
> +            try {
> +              result.numC = Integer.parseInt(vertok.nextToken());
> +            } catch (NumberFormatException e) {
> +              // parsing error; default to zero like 'strtol' C function
> +              result.numC = 0;
> +            }
> +            if (vertok.hasMoreTokens()) {
> +              result.extraD = vertok.getRemainder();
> +            }
> +          }
> +        }
> +      }
> +    }
> +
> +    if (tok.hasMoreTokens()) {
> +      // return everything after "."
> +      return aVersion.substring(part.length() + 1);
> +    }
> +    return null;
> +  }
> +
> +  private int compareVersionPart(VersionPart va, VersionPart vb) {
> +    int res = compareInt(va.numA, vb.numA);
> +    if (res != 0) {
> +      return res;
> +    }
> +
> +    res = compareString(va.strB, vb.strB);
> +    if (res != 0) {
> +      return res;
> +    }
> +
> +    res = compareInt(va.numC, vb.numC);
> +    if (res != 0) {
> +      return res;
> +    }
> +
> +    return compareString(va.extraD, vb.extraD);
> +  }
> +
> +  private int compareInt(int n1, int n2) {
> +    return n1 - n2;
> +  }
> +
> +  private int compareString(String str1, String str2) {
> +    // any string is *before* no string
> +    if (str1 == null) {
> +      return (str2 != null) ? 1 : 0;
> +    }
> +
> +    if (str2 == null) {
> +      return -1;
> +    }
> +
> +    return str1.compareTo(str2);
> +  }
> +
> +}
> +
> +/**
> + * Specialized tokenizer for Mozilla version strings.  A token can
> + * consist of one of the four sections of a version string: <code>
> + * &lt;number-a&gt;&lt;string-b&gt;&lt;number-c&gt;
> + * &lt;string-d (everything else)&gt;</code>.
> + */
> +class VersionPartTokenizer implements Enumeration {
> +
> +  String part;
> +
> +  public VersionPartTokenizer(String aPart) {
> +    part = aPart;
> +  }
> +
> +  public boolean hasMoreElements() {
> +    return part.length() != 0;
> +  }
> +
> +  public boolean hasMoreTokens() {
> +    return part.length() != 0;
> +  }
> +
> +  public Object nextElement() {
> +    if (part.matches("[\\+\\-]?[0-9].*")) {
> +      // if string starts with a number...
> +      int index = 0;
> +      if (part.charAt(0) == '+' || part.charAt(0) == '-') {
> +        index = 1;
> +      }
> +
> +      while (index < part.length() && Character.isDigit(part.charAt(index))) {
> +        index++;
> +      }
> +
> +      String numPart = part.substring(0, index);
> +      part = part.substring(index);
> +      return numPart;
> +    } else {
> +      // ... or if this is the non-numeric part of version string
> +      int index = 0;
> +      while (index < part.length() && !Character.isDigit(part.charAt(index))) {
> +        index++;
> +      }
> +
> +      String alphaPart = part.substring(0, index);
> +      part = part.substring(index);
> +      return alphaPart;
> +    }
> +  }
> +
> +  public String nextToken() {
> +    return (String) nextElement();
> +  }
> +
> +  /**
> +   * Returns what remains of the original string, without tokenization.  This
> +   * method is useful for getting the <code>&lt;string-d (everything else)&gt;
> +   * </code> section of a version string.
> +   * 
> +   * @return remaining version string
> +   */
> +  public String getRemainder() {
> +    return part;
> +  }
> +
> +}
> +
> 
> Added: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/xslt/update.xsl
> ===================================================================
> 
> 
> _______________________________________________
> Yanel-commits mailing list
> Yanel-commits at wyona.com
> http://wyona.com/cgi-bin/mailman/listinfo/yanel-commits
> 




More information about the Yanel-development mailing list