You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by sc...@apache.org on 2010/03/03 19:39:54 UTC
svn commit: r918617 [1/2] - in /incubator/wookie/trunk/parser: ./ java/
java/ant/ java/ant/lib/ java/src-test/ java/src/ java/src/org/
java/src/org/apache/ java/src/org/apache/wookie/
java/src/org/apache/wookie/w3c/ java/src/org/apache/wookie/w3c/excep...
Author: scottbw
Date: Wed Mar 3 18:39:52 2010
New Revision: 918617
URL: http://svn.apache.org/viewvc?rev=918617&view=rev
Log:
Refactoring W3C widget parser as separate sub-project: creating subproject
Added:
incubator/wookie/trunk/parser/
incubator/wookie/trunk/parser/java/ (with props)
incubator/wookie/trunk/parser/java/README.txt
incubator/wookie/trunk/parser/java/ant/
incubator/wookie/trunk/parser/java/ant/lib/
incubator/wookie/trunk/parser/java/ant/lib/commons-compress-1.0.jar (with props)
incubator/wookie/trunk/parser/java/ant/lib/icu4j-4_2_1.jar (with props)
incubator/wookie/trunk/parser/java/build.properties
incubator/wookie/trunk/parser/java/build.xml
incubator/wookie/trunk/parser/java/ivy.xml
incubator/wookie/trunk/parser/java/src/
incubator/wookie/trunk/parser/java/src-test/
incubator/wookie/trunk/parser/java/src/org/
incubator/wookie/trunk/parser/java/src/org/apache/
incubator/wookie/trunk/parser/java/src/org/apache/wookie/
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAccessEntity.java
- copied, changed from r912033, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IAccessEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAuthorEntity.java
- copied, changed from r887150, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IAuthorEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IContentEntity.java
- copied, changed from r891760, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IContentEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IDescriptionEntity.java
- copied, changed from r887150, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IDescriptionEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IFeatureEntity.java
- copied, changed from r887150, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IFeatureEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IIconEntity.java
- copied, changed from r891760, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IIconEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILicenseEntity.java
- copied, changed from r887150, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/ILicenseEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILocalizedElement.java
- copied, changed from r891031, incubator/wookie/trunk/src/org/apache/wookie/beans/ILocalizedElement.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILocalizedEntity.java
- copied, changed from r891760, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/ILocalizedEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IManifestModelBase.java
- copied, changed from r887150, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IManifestModelBase.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/INameEntity.java
- copied, changed from r887150, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/INameEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IParamEntity.java
- copied, changed from r887150, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IParamEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IPreferenceEntity.java
- copied, changed from r887150, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IPreferenceEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IStartPageProcessor.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IW3CXMLConfiguration.java
- copied, changed from r912033, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IW3CXMLConfiguration.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidget.java
- copied, changed from r912033, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IManifestModel.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidgetFactory.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/BadManifestException.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/BadWidgetZipFileException.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/InvalidContentTypeException.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/InvalidStartFileException.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/
- copied from r887150, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/AbstractLocalizedEntity.java
- copied, changed from r891760, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/AbstractLocalizedEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/AccessEntity.java
- copied, changed from r912033, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/AccessEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/AuthorEntity.java
- copied, changed from r888635, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/AuthorEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/ContentEntity.java
- copied, changed from r891923, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/ContentEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/DescriptionEntity.java
- copied, changed from r891760, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/DescriptionEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/FeatureEntity.java
- copied, changed from r888635, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/FeatureEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/IconEntity.java
- copied, changed from r891989, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/IconEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/LicenseEntity.java
- copied, changed from r891760, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/LicenseEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/NameEntity.java
- copied, changed from r894252, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/NameEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/WidgetManifestModel.java
- copied, changed from r912033, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/WidgetManifestModel.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/ContentTypeUtils.java
- copied, changed from r896423, incubator/wookie/trunk/src/org/apache/wookie/util/ContentTypeUtils.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/IRIValidator.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/LocalizationUtils.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/NumberUtils.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/RandomGUID.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/UnicodeUtils.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/WidgetPackageUtils.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/XmlUtils.java
- copied, changed from r888585, incubator/wookie/trunk/src/org/apache/wookie/util/XmlUtils.java
Removed:
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/LocalizedEntity.java
Modified:
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/ParamEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/PreferenceEntity.java
Propchange: incubator/wookie/trunk/parser/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Mar 3 18:39:52 2010
@@ -0,0 +1,2 @@
+dist
+build
Added: incubator/wookie/trunk/parser/java/README.txt
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/README.txt?rev=918617&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/README.txt (added)
+++ incubator/wookie/trunk/parser/java/README.txt Wed Mar 3 18:39:52 2010
@@ -0,0 +1,18 @@
+Wookie W3C Widget Parser
+========================
+
+This is the standalone parser package for W3C Widgets developed as part of Apache Wookie (incubating).
+
+Usage
+=====
+
+To process a W3C Widget (.wgt) file, instantiate a W3CWidgetFactory as follows:
+
+W3CWidgetFactory fac = new W3CWidgetFactory();
+fac.setOutputFolder = my_output_dir; // folder on the local file system widgets will be saved into
+fac.setStartPageProcessor = new MyStartPageProcessorImpl(); // class that injects scripts or does any other start file post-processing
+fac.setLocales = new String[]{"en","fr","nl"}; // supported locales
+fac.setLocalPath = "/wservices"; // local base path for widget URL
+fac.setFeatures = new String[]{"http://wave.google.com"}; // supported features
+W3CWidget widget = fac.parse(new File(my_widget_package_file));
+
Added: incubator/wookie/trunk/parser/java/ant/lib/commons-compress-1.0.jar
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/ant/lib/commons-compress-1.0.jar?rev=918617&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/wookie/trunk/parser/java/ant/lib/commons-compress-1.0.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/parser/java/ant/lib/icu4j-4_2_1.jar
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/ant/lib/icu4j-4_2_1.jar?rev=918617&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/wookie/trunk/parser/java/ant/lib/icu4j-4_2_1.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/parser/java/build.properties
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/build.properties?rev=918617&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/build.properties (added)
+++ incubator/wookie/trunk/parser/java/build.properties Wed Mar 3 18:39:52 2010
@@ -0,0 +1,5 @@
+version=0.1.0-SNAPSHOT
+
+# build configuration properties
+build.dir=../../build
+ivy.repository.dir=../../ant
Added: incubator/wookie/trunk/parser/java/build.xml
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/build.xml?rev=918617&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/build.xml (added)
+++ incubator/wookie/trunk/parser/java/build.xml Wed Mar 3 18:39:52 2010
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (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.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project default="compile-core" basedir="." name="wookie-w3c-widget-parser">
+ <description>
+ Ivy based build system for Apache Wookie W3C Widget Parser.
+ </description>
+
+ <property file="local.build.properties" />
+ <property file="build.properties" />
+
+ <import file="../../ant/ivy-java-common.xml" />
+
+ <target name="pre-compile-core" description="Run before compile-core. intended to be overridden if your project needs any post compile processing"/>
+
+</project>
\ No newline at end of file
Added: incubator/wookie/trunk/parser/java/ivy.xml
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/ivy.xml?rev=918617&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/ivy.xml (added)
+++ incubator/wookie/trunk/parser/java/ivy.xml Wed Mar 3 18:39:52 2010
@@ -0,0 +1,32 @@
+<ivy-module version="2.0">
+ <info organisation="org.apache.incubator" module="wookieW3CParser" revision="0.1.0-SNAPSHOT"/>
+
+ <configurations>
+ <conf name="deploy"/>
+ <conf name="default" extends="deploy"/>
+ <conf name="test" extends="default"/>
+ </configurations>
+
+ <dependencies>
+ <dependency org="antlr" name="antlr" rev="2.7.7" conf="deploy->default">
+ </dependency>
+ <dependency org="com.ibm.icu" name="icu4j" rev="4_2_1" conf="deploy->default">
+ </dependency>
+ <dependency org="commons-logging" name="commons-logging" rev="1.1.1" conf="deploy->default">
+ </dependency>
+ <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.5.2" conf="deploy->default">
+ </dependency>
+ <dependency org="commons-lang" name="commons-lang" rev="2.4" conf="deploy->default">
+ </dependency>
+ <dependency org="commons-compress" name="commons-compress" rev="1.0" conf="deploy->default">
+ </dependency>
+ <dependency org="commons-io" name="commons-io" rev="1.4" conf="deploy->default">
+ </dependency>
+ <dependency org="commons-fileupload" name="commons-fileupload" rev="1.0" conf="deploy->default">
+ </dependency>
+ <dependency org="org.jdom" name="jdom" rev="1.1" conf="deploy->default">
+ </dependency>
+ <dependency org="org.mortbay.jetty" name="servlet-api-2.5" rev="6.1.3" conf="default->default">
+ </dependency>
+ </dependencies>
+</ivy-module>
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAccessEntity.java (from r912033, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IAccessEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAccessEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAccessEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IAccessEntity.java&r1=912033&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IAccessEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAccessEntity.java Wed Mar 3 18:39:52 2010
@@ -12,7 +12,7 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel;
+package org.apache.wookie.w3c;
/**
* @author Paul Sharples
* @version $Id: IAccessEntity.java,v 1.3 2009-09-02 18:37:31 scottwilson Exp $
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAuthorEntity.java (from r887150, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IAuthorEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAuthorEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAuthorEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IAuthorEntity.java&r1=887150&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IAuthorEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAuthorEntity.java Wed Mar 3 18:39:52 2010
@@ -12,7 +12,7 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel;
+package org.apache.wookie.w3c;
/**
* @author Paul Sharples
* @version $Id: IAuthorEntity.java,v 1.3 2009-09-02 18:37:30 scottwilson Exp $
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IContentEntity.java (from r891760, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IContentEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IContentEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IContentEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IContentEntity.java&r1=891760&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IContentEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IContentEntity.java Wed Mar 3 18:39:52 2010
@@ -12,10 +12,10 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel;
+package org.apache.wookie.w3c;
import org.apache.commons.compress.archivers.zip.ZipFile;
-import org.apache.wookie.exceptions.BadManifestException;
+import org.apache.wookie.w3c.exceptions.BadManifestException;
import org.jdom.Element;
/**
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IDescriptionEntity.java (from r887150, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IDescriptionEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IDescriptionEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IDescriptionEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IDescriptionEntity.java&r1=887150&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IDescriptionEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IDescriptionEntity.java Wed Mar 3 18:39:52 2010
@@ -12,7 +12,7 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel;
+package org.apache.wookie.w3c;
/**
* @author Paul Sharples
* @version $Id: IDescriptionEntity.java,v 1.3 2009-09-02 18:37:30 scottwilson Exp $
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IFeatureEntity.java (from r887150, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IFeatureEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IFeatureEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IFeatureEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IFeatureEntity.java&r1=887150&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IFeatureEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IFeatureEntity.java Wed Mar 3 18:39:52 2010
@@ -12,7 +12,7 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel;
+package org.apache.wookie.w3c;
/**
* @author Paul Sharples
* @version $Id: IFeatureEntity.java,v 1.3 2009-09-02 18:37:30 scottwilson Exp $
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IIconEntity.java (from r891760, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IIconEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IIconEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IIconEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IIconEntity.java&r1=891760&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IIconEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IIconEntity.java Wed Mar 3 18:39:52 2010
@@ -12,10 +12,10 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel;
+package org.apache.wookie.w3c;
import org.apache.commons.compress.archivers.zip.ZipFile;
-import org.apache.wookie.exceptions.BadManifestException;
+import org.apache.wookie.w3c.exceptions.BadManifestException;
import org.jdom.Element;
/**
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILicenseEntity.java (from r887150, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/ILicenseEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILicenseEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILicenseEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/ILicenseEntity.java&r1=887150&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/ILicenseEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILicenseEntity.java Wed Mar 3 18:39:52 2010
@@ -12,7 +12,7 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel;
+package org.apache.wookie.w3c;
/**
* @author Paul Sharples
* @version $Id: ILicenseEntity.java,v 1.3 2009-09-02 18:37:30 scottwilson Exp $
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILocalizedElement.java (from r891031, incubator/wookie/trunk/src/org/apache/wookie/beans/ILocalizedElement.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILocalizedElement.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILocalizedElement.java&p1=incubator/wookie/trunk/src/org/apache/wookie/beans/ILocalizedElement.java&r1=891031&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/beans/ILocalizedElement.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILocalizedElement.java Wed Mar 3 18:39:52 2010
@@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.wookie.beans;
+package org.apache.wookie.w3c;
/**
* An element that can be localized by language tag
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILocalizedEntity.java (from r891760, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/ILocalizedEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILocalizedEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILocalizedEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/ILocalizedEntity.java&r1=891760&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/ILocalizedEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILocalizedEntity.java Wed Mar 3 18:39:52 2010
@@ -11,9 +11,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel;
+package org.apache.wookie.w3c;
-import org.apache.wookie.beans.ILocalizedElement;
public interface ILocalizedEntity extends IManifestModelBase, ILocalizedElement {
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IManifestModelBase.java (from r887150, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IManifestModelBase.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IManifestModelBase.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IManifestModelBase.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IManifestModelBase.java&r1=887150&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IManifestModelBase.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IManifestModelBase.java Wed Mar 3 18:39:52 2010
@@ -11,9 +11,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel;
+package org.apache.wookie.w3c;
-import org.apache.wookie.exceptions.BadManifestException;
+import org.apache.wookie.w3c.exceptions.BadManifestException;
import org.jdom.Element;
public interface IManifestModelBase {
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/INameEntity.java (from r887150, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/INameEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/INameEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/INameEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/INameEntity.java&r1=887150&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/INameEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/INameEntity.java Wed Mar 3 18:39:52 2010
@@ -12,7 +12,7 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel;
+package org.apache.wookie.w3c;
/**
* @author Paul Sharples
* @version $Id: INameEntity.java,v 1.3 2009-09-02 18:37:31 scottwilson Exp $
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IParamEntity.java (from r887150, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IParamEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IParamEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IParamEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IParamEntity.java&r1=887150&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IParamEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IParamEntity.java Wed Mar 3 18:39:52 2010
@@ -12,7 +12,7 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel;
+package org.apache.wookie.w3c;
/**
* @author Paul Sharples
* @version $Id: IParamEntity.java,v 1.3 2009-09-02 18:37:31 scottwilson Exp $
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IPreferenceEntity.java (from r887150, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IPreferenceEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IPreferenceEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IPreferenceEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IPreferenceEntity.java&r1=887150&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IPreferenceEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IPreferenceEntity.java Wed Mar 3 18:39:52 2010
@@ -12,7 +12,7 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel;
+package org.apache.wookie.w3c;
/**
* @author Paul Sharples
* @version $Id: IPreferenceEntity.java,v 1.3 2009-09-02 18:37:30 scottwilson Exp $
Added: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IStartPageProcessor.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IStartPageProcessor.java?rev=918617&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IStartPageProcessor.java (added)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IStartPageProcessor.java Wed Mar 3 18:39:52 2010
@@ -0,0 +1,21 @@
+package org.apache.wookie.w3c;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Processes widget start pages to inject scripts and other assets required for widget runtime operation.
+ */
+public interface IStartPageProcessor {
+
+ /**
+ * Process a start file ready for deployment.
+ * @param startFile the start file
+ * @param model the widget information model
+ * @throws IOException if there is a problem reading or writing to the start file, or if the start file cannot be parsed
+ * with the HTML processor used
+ */
+ public abstract void processStartFile(File startFile, W3CWidget model)
+ throws Exception;
+
+}
\ No newline at end of file
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IW3CXMLConfiguration.java (from r912033, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IW3CXMLConfiguration.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IW3CXMLConfiguration.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IW3CXMLConfiguration.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IW3CXMLConfiguration.java&r1=912033&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IW3CXMLConfiguration.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IW3CXMLConfiguration.java Wed Mar 3 18:39:52 2010
@@ -12,7 +12,7 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel;
+package org.apache.wookie.w3c;
/**
* Constants for widget elements found in the config.xml file
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidget.java (from r912033, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IManifestModel.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidget.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidget.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IManifestModel.java&r1=912033&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/IManifestModel.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidget.java Wed Mar 3 18:39:52 2010
@@ -12,18 +12,18 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel;
+package org.apache.wookie.w3c;
import java.util.List;
-import org.apache.wookie.exceptions.BadManifestException;
+import org.apache.wookie.w3c.exceptions.BadManifestException;
import org.jdom.Element;
/**
* @author Paul Sharples
* @version $Id: IManifestModel.java,v 1.3 2009-09-02 18:37:31 scottwilson Exp $
*/
-public interface IManifestModel extends IManifestModelBase{
+public interface W3CWidget extends IManifestModelBase{
public List<IAccessEntity> getAccessList();
public List<IContentEntity> getContentList();
Added: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidgetFactory.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidgetFactory.java?rev=918617&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidgetFactory.java (added)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidgetFactory.java Wed Mar 3 18:39:52 2010
@@ -0,0 +1,99 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wookie.w3c;
+
+import java.io.File;
+
+import org.apache.wookie.w3c.exceptions.BadManifestException;
+import org.apache.wookie.w3c.exceptions.BadWidgetZipFileException;
+import org.apache.wookie.w3c.util.WidgetPackageUtils;
+
+/**
+ * Factory for parsing W3C Widget packages (.wgt files).
+ */
+public class W3CWidgetFactory {
+
+ private String outputDirectory;
+ private IStartPageProcessor startPageProcessor;
+ private String[] locales;
+ private String localPath;
+ private String[] features;
+
+ public String[] getFeatures() {
+ return features;
+ }
+
+ public void setFeatures(String[] features) {
+ this.features = features;
+ }
+
+ public W3CWidgetFactory(){
+ // Defaults
+ this.locales = new String[]{"en"};
+ this.features = new String[];
+ this.localPath = "/widgets";
+ this.outputDirectory = null;
+ this.startPageProcessor = new IStartPageProcessor(){
+ public void processStartFile(File startFile, W3CWidget model)
+ throws Exception {
+ }
+
+ };
+ }
+
+ public String getOutputDirectory() {
+ return outputDirectory;
+ }
+
+ public void setOutputDirectory(String outputDirectory) {
+ this.outputDirectory = outputDirectory;
+ }
+
+ public IStartPageProcessor getStartPageProcessor() {
+ return startPageProcessor;
+ }
+
+ public void setStartPageProcessor(IStartPageProcessor startPageProcessor) {
+ this.startPageProcessor = startPageProcessor;
+ }
+
+ public String[] getLocales() {
+ return locales;
+ }
+
+ public void setLocales(String[] locales) {
+ this.locales = locales;
+ }
+
+ public String getLocalPath() {
+ return localPath;
+ }
+
+ public void setLocalPath(String localPath) {
+ this.localPath = localPath;
+ };
+
+ /**
+ * Parse a given ZipFile and return a W3CWidget object representing the processed information in the package.
+ * The widget will be saved in the outputFolder.
+ *
+ * @param zipFile
+ * @return the widget model
+ * @throws BadWidgetZipFileException if there is a problem with the zip package
+ * @throws BadManifestException if there is a problem with the config.xml manifest file in the package
+ */
+ public W3CWidget parse(File zipFile) throws BadWidgetZipFileException, BadManifestException{
+ return WidgetPackageUtils.processWidgetPackage(zipFile, localPath, outputDirectory, locales, startPageProcessor, features);
+ }
+}
Added: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/BadManifestException.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/BadManifestException.java?rev=918617&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/BadManifestException.java (added)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/BadManifestException.java Wed Mar 3 18:39:52 2010
@@ -0,0 +1,43 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.wookie.w3c.exceptions;
+/**
+ * Thrown when there is a problem with a manifest file
+ * @author Paul Sharples
+ * @version $Id: BadManifestException.java,v 1.2 2009-07-28 16:05:23 scottwilson Exp $
+ */
+public class BadManifestException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public BadManifestException() {
+ super();
+ }
+
+ public BadManifestException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public BadManifestException(String message) {
+ super(message);
+ }
+
+ public BadManifestException(Throwable cause) {
+ super(cause);
+ }
+
+
+
+}
Added: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/BadWidgetZipFileException.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/BadWidgetZipFileException.java?rev=918617&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/BadWidgetZipFileException.java (added)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/BadWidgetZipFileException.java Wed Mar 3 18:39:52 2010
@@ -0,0 +1,40 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.wookie.w3c.exceptions;
+/**
+ * Thrown when there is a problem with a zip
+ * @author Paul Sharples
+ * @version $Id: BadWidgetZipFileException.java,v 1.2 2009-07-28 16:05:23 scottwilson Exp $
+ */
+public class BadWidgetZipFileException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public BadWidgetZipFileException() {
+ super();
+ }
+
+ public BadWidgetZipFileException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public BadWidgetZipFileException(String message) {
+ super(message);
+ }
+
+ public BadWidgetZipFileException(Throwable cause) {
+ super(cause);
+ }
+}
Added: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/InvalidContentTypeException.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/InvalidContentTypeException.java?rev=918617&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/InvalidContentTypeException.java (added)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/InvalidContentTypeException.java Wed Mar 3 18:39:52 2010
@@ -0,0 +1,42 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wookie.w3c.exceptions;
+
+
+/**
+ * Thrown when a widget manifest sets an invalid content type
+ * @author scott
+ *
+ */
+public class InvalidContentTypeException extends BadManifestException {
+
+ private static final long serialVersionUID = 1L;
+
+ public InvalidContentTypeException() {
+ super();
+ }
+
+ public InvalidContentTypeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidContentTypeException(String message) {
+ super(message);
+ }
+
+ public InvalidContentTypeException(Throwable cause) {
+ super(cause);
+ }
+
+}
Added: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/InvalidStartFileException.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/InvalidStartFileException.java?rev=918617&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/InvalidStartFileException.java (added)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/exceptions/InvalidStartFileException.java Wed Mar 3 18:39:52 2010
@@ -0,0 +1,41 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wookie.w3c.exceptions;
+
+/**
+ * Thrown when a widget has no valid start file
+ * @author scott
+ *
+ */
+public class InvalidStartFileException extends BadManifestException {
+
+ private static final long serialVersionUID = 1L;
+
+ public InvalidStartFileException() {
+ super();
+ }
+
+ public InvalidStartFileException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidStartFileException(String message) {
+ super(message);
+ }
+
+ public InvalidStartFileException(Throwable cause) {
+ super(cause);
+ }
+
+}
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/AbstractLocalizedEntity.java (from r891760, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/AbstractLocalizedEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/AbstractLocalizedEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/AbstractLocalizedEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/AbstractLocalizedEntity.java&r1=891760&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/AbstractLocalizedEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/AbstractLocalizedEntity.java Wed Mar 3 18:39:52 2010
@@ -11,12 +11,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel.impl;
+package org.apache.wookie.w3c.impl;
-import org.apache.wookie.manifestmodel.ILocalizedEntity;
-import org.apache.wookie.manifestmodel.IW3CXMLConfiguration;
-import org.apache.wookie.util.LocalizationUtils;
-import org.apache.wookie.util.UnicodeUtils;
+import org.apache.wookie.w3c.ILocalizedEntity;
+import org.apache.wookie.w3c.IW3CXMLConfiguration;
+import org.apache.wookie.w3c.util.LocalizationUtils;
+import org.apache.wookie.w3c.util.UnicodeUtils;
import org.jdom.Element;
import org.jdom.Namespace;
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/AccessEntity.java (from r912033, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/AccessEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/AccessEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/AccessEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/AccessEntity.java&r1=912033&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/AccessEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/AccessEntity.java Wed Mar 3 18:39:52 2010
@@ -12,14 +12,14 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel.impl;
+package org.apache.wookie.w3c.impl;
import java.net.URI;
-import org.apache.wookie.manifestmodel.IAccessEntity;
-import org.apache.wookie.manifestmodel.IW3CXMLConfiguration;
-import org.apache.wookie.util.IRIValidator;
-import org.apache.wookie.util.UnicodeUtils;
+import org.apache.wookie.w3c.IAccessEntity;
+import org.apache.wookie.w3c.IW3CXMLConfiguration;
+import org.apache.wookie.w3c.util.IRIValidator;
+import org.apache.wookie.w3c.util.UnicodeUtils;
import org.jdom.Attribute;
import org.jdom.Element;
/**
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/AuthorEntity.java (from r888635, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/AuthorEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/AuthorEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/AuthorEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/AuthorEntity.java&r1=888635&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/AuthorEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/AuthorEntity.java Wed Mar 3 18:39:52 2010
@@ -12,13 +12,13 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel.impl;
+package org.apache.wookie.w3c.impl;
-import org.apache.wookie.manifestmodel.IAuthorEntity;
-import org.apache.wookie.manifestmodel.IW3CXMLConfiguration;
-import org.apache.wookie.util.IRIValidator;
-import org.apache.wookie.util.UnicodeUtils;
-import org.apache.wookie.util.XmlUtils;
+import org.apache.wookie.w3c.IAuthorEntity;
+import org.apache.wookie.w3c.IW3CXMLConfiguration;
+import org.apache.wookie.w3c.util.IRIValidator;
+import org.apache.wookie.w3c.util.UnicodeUtils;
+import org.apache.wookie.w3c.util.XmlUtils;
import org.jdom.Element;
/**
* @author Paul Sharples
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/ContentEntity.java (from r891923, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/ContentEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/ContentEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/ContentEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/ContentEntity.java&r1=891923&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/ContentEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/ContentEntity.java Wed Mar 3 18:39:52 2010
@@ -12,16 +12,16 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel.impl;
+package org.apache.wookie.w3c.impl;
import org.apache.commons.compress.archivers.zip.ZipFile;
import org.apache.commons.lang.StringUtils;
-import org.apache.wookie.exceptions.BadManifestException;
-import org.apache.wookie.exceptions.InvalidContentTypeException;
-import org.apache.wookie.manifestmodel.IContentEntity;
-import org.apache.wookie.manifestmodel.IW3CXMLConfiguration;
-import org.apache.wookie.util.UnicodeUtils;
-import org.apache.wookie.util.WidgetPackageUtils;
+import org.apache.wookie.w3c.IContentEntity;
+import org.apache.wookie.w3c.IW3CXMLConfiguration;
+import org.apache.wookie.w3c.exceptions.BadManifestException;
+import org.apache.wookie.w3c.exceptions.InvalidContentTypeException;
+import org.apache.wookie.w3c.util.UnicodeUtils;
+import org.apache.wookie.w3c.util.WidgetPackageUtils;
import org.jdom.Element;
/**
* @author Paul Sharples
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/DescriptionEntity.java (from r891760, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/DescriptionEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/DescriptionEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/DescriptionEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/DescriptionEntity.java&r1=891760&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/DescriptionEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/DescriptionEntity.java Wed Mar 3 18:39:52 2010
@@ -12,12 +12,12 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel.impl;
+package org.apache.wookie.w3c.impl;
-import org.apache.wookie.manifestmodel.IDescriptionEntity;
-import org.apache.wookie.manifestmodel.IW3CXMLConfiguration;
-import org.apache.wookie.util.UnicodeUtils;
-import org.apache.wookie.util.XmlUtils;
+import org.apache.wookie.w3c.IDescriptionEntity;
+import org.apache.wookie.w3c.IW3CXMLConfiguration;
+import org.apache.wookie.w3c.util.UnicodeUtils;
+import org.apache.wookie.w3c.util.XmlUtils;
import org.jdom.Element;
/**
* @author Paul Sharples
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/FeatureEntity.java (from r888635, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/FeatureEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/FeatureEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/FeatureEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/FeatureEntity.java&r1=888635&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/FeatureEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/FeatureEntity.java Wed Mar 3 18:39:52 2010
@@ -12,18 +12,17 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel.impl;
+package org.apache.wookie.w3c.impl;
import java.util.ArrayList;
import java.util.List;
-import org.apache.wookie.beans.ServerFeature;
-import org.apache.wookie.exceptions.BadManifestException;
-import org.apache.wookie.manifestmodel.IFeatureEntity;
-import org.apache.wookie.manifestmodel.IParamEntity;
-import org.apache.wookie.manifestmodel.IW3CXMLConfiguration;
-import org.apache.wookie.util.IRIValidator;
-import org.apache.wookie.util.UnicodeUtils;
+import org.apache.wookie.w3c.IFeatureEntity;
+import org.apache.wookie.w3c.IParamEntity;
+import org.apache.wookie.w3c.IW3CXMLConfiguration;
+import org.apache.wookie.w3c.exceptions.BadManifestException;
+import org.apache.wookie.w3c.util.IRIValidator;
+import org.apache.wookie.w3c.util.UnicodeUtils;
import org.jdom.Element;
/**
* @author Paul Sharples
@@ -34,11 +33,13 @@
private String fName;
private boolean fRequired;
private List<IParamEntity> fParams;
+ private String[] features; // the set of platform-supported features
- public FeatureEntity(){
+ public FeatureEntity(String[] features){
fName = "";
fRequired = false;
fParams = new ArrayList<IParamEntity>();
+ this.features = features;
}
public FeatureEntity(String name, boolean required,
@@ -109,7 +110,11 @@
}
}
// Not supported?
- if (ServerFeature.findByName(fName)==null){
+ boolean supported = false;
+ for (String supportedFeature: features){
+ if(fName.equalsIgnoreCase(supportedFeature)) supported = true;
+ }
+ if (!supported){
if (fRequired){
throw new BadManifestException();
} else {
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/IconEntity.java (from r891989, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/IconEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/IconEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/IconEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/IconEntity.java&r1=891989&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/IconEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/IconEntity.java Wed Mar 3 18:39:52 2010
@@ -12,16 +12,16 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel.impl;
+package org.apache.wookie.w3c.impl;
import org.apache.commons.compress.archivers.zip.ZipFile;
-import org.apache.wookie.exceptions.BadManifestException;
-import org.apache.wookie.manifestmodel.IIconEntity;
-import org.apache.wookie.manifestmodel.IW3CXMLConfiguration;
-import org.apache.wookie.util.ContentTypeUtils;
-import org.apache.wookie.util.NumberUtils;
-import org.apache.wookie.util.UnicodeUtils;
-import org.apache.wookie.util.WidgetPackageUtils;
+import org.apache.wookie.w3c.IIconEntity;
+import org.apache.wookie.w3c.IW3CXMLConfiguration;
+import org.apache.wookie.w3c.exceptions.BadManifestException;
+import org.apache.wookie.w3c.util.ContentTypeUtils;
+import org.apache.wookie.w3c.util.NumberUtils;
+import org.apache.wookie.w3c.util.UnicodeUtils;
+import org.apache.wookie.w3c.util.WidgetPackageUtils;
import org.jdom.Element;
/**
* @author Paul Sharples
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/LicenseEntity.java (from r891760, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/LicenseEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/LicenseEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/LicenseEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/LicenseEntity.java&r1=891760&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/LicenseEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/LicenseEntity.java Wed Mar 3 18:39:52 2010
@@ -12,12 +12,12 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel.impl;
+package org.apache.wookie.w3c.impl;
-import org.apache.wookie.manifestmodel.ILicenseEntity;
-import org.apache.wookie.manifestmodel.IW3CXMLConfiguration;
-import org.apache.wookie.util.UnicodeUtils;
-import org.apache.wookie.util.XmlUtils;
+import org.apache.wookie.w3c.ILicenseEntity;
+import org.apache.wookie.w3c.IW3CXMLConfiguration;
+import org.apache.wookie.w3c.util.UnicodeUtils;
+import org.apache.wookie.w3c.util.XmlUtils;
import org.jdom.Element;
/**
* @author Paul Sharples
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/NameEntity.java (from r894252, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/NameEntity.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/NameEntity.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/NameEntity.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/NameEntity.java&r1=894252&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/NameEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/NameEntity.java Wed Mar 3 18:39:52 2010
@@ -12,12 +12,12 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel.impl;
+package org.apache.wookie.w3c.impl;
-import org.apache.wookie.manifestmodel.INameEntity;
-import org.apache.wookie.manifestmodel.IW3CXMLConfiguration;
-import org.apache.wookie.util.UnicodeUtils;
-import org.apache.wookie.util.XmlUtils;
+import org.apache.wookie.w3c.INameEntity;
+import org.apache.wookie.w3c.IW3CXMLConfiguration;
+import org.apache.wookie.w3c.util.UnicodeUtils;
+import org.apache.wookie.w3c.util.XmlUtils;
import org.jdom.Element;
/**
Modified: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/ParamEntity.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/ParamEntity.java?rev=918617&r1=887150&r2=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/ParamEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/ParamEntity.java Wed Mar 3 18:39:52 2010
@@ -12,12 +12,12 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel.impl;
+package org.apache.wookie.w3c.impl;
-import org.apache.wookie.exceptions.BadManifestException;
-import org.apache.wookie.manifestmodel.IParamEntity;
-import org.apache.wookie.manifestmodel.IW3CXMLConfiguration;
-import org.apache.wookie.util.UnicodeUtils;
+import org.apache.wookie.w3c.IParamEntity;
+import org.apache.wookie.w3c.IW3CXMLConfiguration;
+import org.apache.wookie.w3c.exceptions.BadManifestException;
+import org.apache.wookie.w3c.util.UnicodeUtils;
import org.jdom.Element;
/**
* @author Paul Sharples
Modified: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/PreferenceEntity.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/PreferenceEntity.java?rev=918617&r1=887150&r2=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/PreferenceEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/PreferenceEntity.java Wed Mar 3 18:39:52 2010
@@ -12,12 +12,12 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel.impl;
+package org.apache.wookie.w3c.impl;
-import org.apache.wookie.exceptions.BadManifestException;
-import org.apache.wookie.manifestmodel.IPreferenceEntity;
-import org.apache.wookie.manifestmodel.IW3CXMLConfiguration;
-import org.apache.wookie.util.UnicodeUtils;
+import org.apache.wookie.w3c.IPreferenceEntity;
+import org.apache.wookie.w3c.IW3CXMLConfiguration;
+import org.apache.wookie.w3c.exceptions.BadManifestException;
+import org.apache.wookie.w3c.util.UnicodeUtils;
import org.jdom.Element;
/**
* @author Paul Sharples
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/WidgetManifestModel.java (from r912033, incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/WidgetManifestModel.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/WidgetManifestModel.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/WidgetManifestModel.java&p1=incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/WidgetManifestModel.java&r1=912033&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/manifestmodel/impl/WidgetManifestModel.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/WidgetManifestModel.java Wed Mar 3 18:39:52 2010
@@ -12,7 +12,7 @@
* limitations under the License.
*/
-package org.apache.wookie.manifestmodel.impl;
+package org.apache.wookie.w3c.impl;
import java.io.IOException;
import java.io.StringReader;
@@ -22,27 +22,26 @@
import org.apache.commons.compress.archivers.zip.ZipFile;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
-import org.apache.wookie.beans.ServerFeature;
-import org.apache.wookie.exceptions.BadManifestException;
-import org.apache.wookie.manifestmodel.IAccessEntity;
-import org.apache.wookie.manifestmodel.IAuthorEntity;
-import org.apache.wookie.manifestmodel.IContentEntity;
-import org.apache.wookie.manifestmodel.IDescriptionEntity;
-import org.apache.wookie.manifestmodel.IFeatureEntity;
-import org.apache.wookie.manifestmodel.IIconEntity;
-import org.apache.wookie.manifestmodel.ILicenseEntity;
-import org.apache.wookie.manifestmodel.ILocalizedEntity;
-import org.apache.wookie.manifestmodel.IManifestModel;
-import org.apache.wookie.manifestmodel.INameEntity;
-import org.apache.wookie.manifestmodel.IParamEntity;
-import org.apache.wookie.manifestmodel.IPreferenceEntity;
-import org.apache.wookie.manifestmodel.IW3CXMLConfiguration;
-import org.apache.wookie.util.IRIValidator;
-import org.apache.wookie.util.LocalizationUtils;
-import org.apache.wookie.util.NumberUtils;
-import org.apache.wookie.util.RandomGUID;
-import org.apache.wookie.util.UnicodeUtils;
-import org.apache.wookie.util.WidgetPackageUtils;
+import org.apache.wookie.w3c.util.LocalizationUtils;
+import org.apache.wookie.w3c.IAccessEntity;
+import org.apache.wookie.w3c.IAuthorEntity;
+import org.apache.wookie.w3c.IContentEntity;
+import org.apache.wookie.w3c.IDescriptionEntity;
+import org.apache.wookie.w3c.IFeatureEntity;
+import org.apache.wookie.w3c.IIconEntity;
+import org.apache.wookie.w3c.ILicenseEntity;
+import org.apache.wookie.w3c.ILocalizedEntity;
+import org.apache.wookie.w3c.W3CWidget;
+import org.apache.wookie.w3c.INameEntity;
+import org.apache.wookie.w3c.IParamEntity;
+import org.apache.wookie.w3c.IPreferenceEntity;
+import org.apache.wookie.w3c.IW3CXMLConfiguration;
+import org.apache.wookie.w3c.exceptions.BadManifestException;
+import org.apache.wookie.w3c.util.IRIValidator;
+import org.apache.wookie.w3c.util.NumberUtils;
+import org.apache.wookie.w3c.util.RandomGUID;
+import org.apache.wookie.w3c.util.UnicodeUtils;
+import org.apache.wookie.w3c.util.WidgetPackageUtils;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.Namespace;
@@ -52,7 +51,7 @@
* for a widget, including all sub-objects
* @author Paul Sharples
*/
-public class WidgetManifestModel implements IManifestModel {
+public class WidgetManifestModel implements W3CWidget {
static Logger fLogger = Logger.getLogger(WidgetManifestModel.class.getName());
@@ -62,6 +61,7 @@
private Integer fWidth;
private String fViewModes;
private String fLang;
+ private String[] features;
private List<INameEntity> fNamesList;
private List<IDescriptionEntity> fDescriptionsList;
private IAuthorEntity fAuthor;
@@ -81,9 +81,10 @@
* @throws IOException
* @throws BadManifestException
*/
- public WidgetManifestModel (String xmlText, String[] locales, ZipFile zip) throws JDOMException, IOException, BadManifestException {
+ public WidgetManifestModel (String xmlText, String[] locales, String[] features, ZipFile zip) throws JDOMException, IOException, BadManifestException {
super();
this.zip = zip;
+ this.features = features;
fNamesList = new ArrayList<INameEntity>();
fDescriptionsList = new ArrayList<IDescriptionEntity>();
fLicensesList = new ArrayList<ILicenseEntity>();
@@ -377,7 +378,7 @@
// FEATURE IS OPTIONAL - can be many
if(tag.equals(IW3CXMLConfiguration.FEATURE_ELEMENT)) {
- IFeatureEntity feature = new FeatureEntity();
+ IFeatureEntity feature = new FeatureEntity(this.features);
feature.fromXML(child);
if (feature.getName()!=null) fFeaturesList.add(feature);
}
Copied: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/ContentTypeUtils.java (from r896423, incubator/wookie/trunk/src/org/apache/wookie/util/ContentTypeUtils.java)
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/ContentTypeUtils.java?p2=incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/ContentTypeUtils.java&p1=incubator/wookie/trunk/src/org/apache/wookie/util/ContentTypeUtils.java&r1=896423&r2=918617&rev=918617&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/util/ContentTypeUtils.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/ContentTypeUtils.java Wed Mar 3 18:39:52 2010
@@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.wookie.util;
+package org.apache.wookie.w3c.util;
import java.io.File;
Added: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/IRIValidator.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/IRIValidator.java?rev=918617&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/IRIValidator.java (added)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/IRIValidator.java Wed Mar 3 18:39:52 2010
@@ -0,0 +1,46 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wookie.w3c.util;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+/**
+ * IRI checking utility
+ * This should be replaced with a "real" IRI implementation
+ * as soon as one becomes available.
+ *
+ * @author Scott Wilson
+ *
+ */
+public class IRIValidator {
+
+ public static boolean isValidIRI(String str){
+ URI iri;
+ if (str == null) return false;
+ try {
+ iri = new URI(str);
+ if (iri.getScheme() == null) return false;
+ return true;
+ } catch (Exception e) {
+ // Scheme only is allowed for an IRI
+ try {
+ iri = new URI(str, null, null);
+ return true;
+ } catch (URISyntaxException e1) {
+ return false;
+ }
+ }
+ }
+}
Added: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/LocalizationUtils.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/LocalizationUtils.java?rev=918617&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/LocalizationUtils.java (added)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/LocalizationUtils.java Wed Mar 3 18:39:52 2010
@@ -0,0 +1,198 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wookie.w3c.util;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.log4j.Logger;
+import org.apache.wookie.w3c.ILocalizedElement;
+
+import com.ibm.icu.util.GlobalizationPreferences;
+import com.ibm.icu.util.ULocale;
+
+/**
+ * Utilities for localization
+ * @author Scott Wilson
+ *
+ */
+public class LocalizationUtils {
+ static Logger _logger = Logger.getLogger(LocalizationUtils.class.getName());
+
+ /**
+ * Returns the first (best) match for an element given the set of locales, or null
+ * if there are no suitable elements.
+ * @param locales
+ * @param elements
+ * @return an ILocalizedElement, or null if there are no valid entries
+ */
+ public static ILocalizedElement getLocalizedElement(ILocalizedElement[] elements,String[] locales){
+ if (elements == null) return null;
+ elements = processElementsByLocales(elements,locales);
+ if (elements.length == 0) return null;
+ return elements[0];
+ }
+
+ /**
+ * Filters and sorts a list of localized elements using the given locale list; only localized elements
+ * are returned unless no appropriate localized elements are found, in which case nonlocalized elements
+ * are returned
+ *
+ * @param locales
+ * @return the sorted and filtered set of elements
+ */
+ public static ILocalizedElement[] processElementsByLocales(ILocalizedElement[] elements,String[] locales){
+ if (elements == null) return null;
+ List<ULocale> localesList = getProcessedLocaleList(locales);
+ Arrays.sort(elements, new LocaleComparator(localesList));
+ return filter(elements,localesList);
+ }
+
+ /**
+ * Sorts an array of localized elements using default locales (*). This places
+ * any localized elements first, then any unlocalized elements
+ * @return
+ */
+ public static ILocalizedElement[] processElementsByDefaultLocales(ILocalizedElement[] elements){
+ if (elements == null) return null;
+ List<ULocale> localesList = getDefaultLocaleList();
+ Arrays.sort(elements, new LocaleComparator(localesList));
+ return filter(elements,localesList);
+ }
+
+ /**
+ * Comparator that sorts elements based on priority in the given locale list,
+ * with the assumption that earlier in the list means a higher priority.
+ */
+ static class LocaleComparator implements Comparator<ILocalizedElement>{
+ private List<ULocale> locales;
+ public LocaleComparator(List<ULocale> locales){
+ this.locales = locales;
+ }
+ public int compare(ILocalizedElement o1, ILocalizedElement o2) {
+ // check non-localized values for comparison
+ if (o1.getLang()!=null && o2.getLang() == null) return -1;
+ if (o1.getLang()==null && o2.getLang()!= null) return 1;
+ if (o1.getLang()==null && o2.getLang()==null) return 0;
+
+ // get index position of locales
+ int o1i = -1;
+ int o2i = -1;
+ for (int i=0;i<locales.size();i++){
+ if (o1.getLang().equalsIgnoreCase(locales.get(i).toLanguageTag())) o1i = i;
+ if (o2.getLang().equalsIgnoreCase(locales.get(i).toLanguageTag())) o2i = i;
+ }
+ // put non-matched after matched
+ if (o1i == -1 && o2i > -1) return 1;
+ if (o1i > -1 && o2i == -1) return -1;
+
+ // order by match
+ return o1i - o2i;
+ }
+ }
+
+ /**
+ * Filters a set of elements using the locales and returns a copy of the array
+ * containing only elements that match the locales, or that are not localized
+ * if there are no matches
+ * @param elements
+ * @param locales
+ * @return a copy of the array of elements only containing the filtered elements
+ */
+ protected static ILocalizedElement[] filter(ILocalizedElement[] elements, List<ULocale> locales){
+ for (ILocalizedElement element:elements){
+ String lang = element.getLang();
+ boolean found = false;
+ for(ULocale locale:locales){
+ if (locale.toLanguageTag().equalsIgnoreCase(lang)) found = true;
+ }
+ if (!found && lang != null) elements = (ILocalizedElement[])ArrayUtils.removeElement(elements, element);
+ }
+ // Strip out non-localized elements only if there are localized elements left
+ if (elements.length > 0){
+ if (elements[0].getLang() != null){
+ for (ILocalizedElement element:elements){
+ if (element.getLang()==null) elements = (ILocalizedElement[])ArrayUtils.removeElement(elements, element);
+ }
+ }
+ }
+ return elements;
+ }
+
+
+ /**
+ * Converts an array of language tags to a list of ULocale instances
+ * ordered according to priority, availability and fallback
+ * rules. For example "en-us-posix" will be returned as a List
+ * containing the ULocales for "en-us-posix", "en-us", and "en".
+ * @param locales
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ public static List<ULocale> getProcessedLocaleList(String[] locales){
+ if (locales == null) return getDefaultLocaleList();
+ GlobalizationPreferences prefs = new GlobalizationPreferences();
+
+ ArrayList<ULocale> ulocales = new ArrayList<ULocale>();
+ for (String locale:locales){
+ if (locale != null){
+ try {
+ ULocale ulocale = ULocale.forLanguageTag(locale);
+ if (!ulocale.getLanguage().equals(""))
+ ulocales.add(ulocale);
+ } catch (Exception e) {
+ // There can be intermittent problems with the internal
+ // functioning of the ULocale class with some
+ // language tags; best to just log these and continue
+ _logger.error("icu4j:ULocale.forLanguageTag("+locale+") threw Exception:",e);
+ }
+ }
+ }
+ if (ulocales.isEmpty()) return getDefaultLocaleList();
+ prefs.setLocales(ulocales.toArray(new ULocale[ulocales.size()]));
+ return prefs.getLocales();
+ }
+
+ /**
+ * Gets the default locales list
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ protected static List<ULocale> getDefaultLocaleList(){
+ GlobalizationPreferences prefs = new GlobalizationPreferences();
+ return prefs.getLocales();
+ }
+
+ /**
+ * Validates a given language tag. Empty and null values are considered false.
+ * @param tag
+ * @return true if a valid language tag, otherwise false
+ */
+ public static boolean isValidLanguageTag(String tag){
+ try {
+ ULocale locale = ULocale.forLanguageTag(tag);
+ if (locale.toLanguageTag() == null) return false;
+ // We don't accept "x" extensions (private use tags)
+ if(locale.getExtension("x".charAt(0))!=null) return false;
+ if (!locale.toLanguageTag().equalsIgnoreCase(tag)) return false;
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+}
Added: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/NumberUtils.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/NumberUtils.java?rev=918617&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/NumberUtils.java (added)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/NumberUtils.java Wed Mar 3 18:39:52 2010
@@ -0,0 +1,48 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wookie.w3c.util;
+
+
+import antlr.StringUtils;
+
+/**
+ * Utility for handling numbers according to W3C processing rules
+ * @author scott
+ *
+ */
+public class NumberUtils {
+
+ public static int processNonNegativeInteger(String in) throws NumberFormatException {
+ int result = 0;
+ in = UnicodeUtils.normalizeSpaces(in);
+ StringUtils.stripFront(in, " ");
+
+ if (in.length() == 0) throw new NumberFormatException("no non-space characters");
+
+ for (int pos=0;pos<in.length();pos++){
+ String nextchar = in.substring(pos, pos+1);
+ // If the nextchar is not one of U+0030 (0) .. U+0039 (9), then return result.
+ try {
+ int i = Integer.parseInt(nextchar);
+ result = result * 10 + i;
+ } catch (Exception e) {
+ return result;
+ }
+ }
+
+ return result;
+
+ }
+
+}
Added: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/RandomGUID.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/RandomGUID.java?rev=918617&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/RandomGUID.java (added)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/RandomGUID.java Wed Mar 3 18:39:52 2010
@@ -0,0 +1,246 @@
+/*
+ * (c) 2009 Marc A Mnich
+ * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.wookie.w3c.util;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.util.Random;
+
+
+/**
+ * RandomGUID
+ * @version 1.2.1 11/05/02
+ * @author Marc A. Mnich
+ *
+ * From www.JavaExchange.com, Open Software licensing
+ *
+ * 11/05/02 -- Performance enhancement from Mike Dubman.
+ * Moved InetAddr.getLocal to static block. Mike has measured
+ * a 10 fold improvement in run time.
+ * 01/29/02 -- Bug fix: Improper seeding of nonsecure Random object
+ * caused duplicate GUIDs to be produced. Random object
+ * is now only created once per JVM.
+ * 01/19/02 -- Modified random seeding and added new constructor
+ * to allow secure random feature.
+ * 01/14/02 -- Added random function seeding with JVM run time
+ *
+ * In the multitude of java GUID generators, I found none that
+ * guaranteed randomness. GUIDs are guaranteed to be globally unique
+ * by using ethernet MACs, IP addresses, time elements, and sequential
+ * numbers. GUIDs are not expected to be random and most often are
+ * easy/possible to guess given a sample from a given generator.
+ * SQL Server, for example generates GUID that are unique but
+ * sequencial within a given instance.
+ *
+ * GUIDs can be used as security devices to hide things such as
+ * files within a filesystem where listings are unavailable (e.g. files
+ * that are served up from a Web server with indexing turned off).
+ * This may be desireable in cases where standard authentication is not
+ * appropriate. In this scenario, the RandomGUIDs are used as directories.
+ * Another example is the use of GUIDs for primary keys in a database
+ * where you want to ensure that the keys are secret. Random GUIDs can
+ * then be used in a URL to prevent hackers (or users) from accessing
+ * records by guessing or simply by incrementing sequential numbers.
+ *
+ * There are many other possiblities of using GUIDs in the realm of
+ * security and encryption where the element of randomness is important.
+ * This class was written for these purposes but can also be used as a
+ * general purpose GUID generator as well.
+ *
+ * RandomGUID generates truly random GUIDs by using the system's
+ * IP address (name/IP), system time in milliseconds (as an integer),
+ * and a very large random number joined together in a single String
+ * that is passed through an MD5 hash. The IP address and system time
+ * make the MD5 seed globally unique and the random number guarantees
+ * that the generated GUIDs will have no discernable pattern and
+ * cannot be guessed given any number of previously generated GUIDs.
+ * It is generally not possible to access the seed information (IP, time,
+ * random number) from the resulting GUIDs as the MD5 hash algorithm
+ * provides one way encryption.
+ *
+ * ----> Security of RandomGUID: <-----
+ * RandomGUID can be called one of two ways -- with the basic java Random
+ * number generator or a cryptographically strong random generator
+ * (SecureRandom). The choice is offered because the secure random
+ * generator takes about 3.5 times longer to generate its random numbers
+ * and this performance hit may not be worth the added security
+ * especially considering the basic generator is seeded with a
+ * cryptographically strong random seed.
+ *
+ * Seeding the basic generator in this way effectively decouples
+ * the random numbers from the time component making it virtually impossible
+ * to predict the random number component even if one had absolute knowledge
+ * of the System time. Thanks to Ashutosh Narhari for the suggestion
+ * of using the static method to prime the basic random generator.
+ *
+ * Using the secure random option, this class compies with the statistical
+ * random number generator tests specified in FIPS 140-2, Security
+ * Requirements for Cryptographic Modules, secition 4.9.1.
+ *
+ * I converted all the pieces of the seed to a String before handing
+ * it over to the MD5 hash so that you could print it out to make
+ * sure it contains the data you expect to see and to give a nice
+ * warm fuzzy. If you need better performance, you may want to stick
+ * to byte[] arrays.
+ *
+ * I believe that it is important that the algorithm for
+ * generating random GUIDs be open for inspection and modification.
+ * This class is free for all uses.
+ *
+ *
+ * - Marc
+ */
+/**
+* @version $Id: RandomGUID.java,v 1.3 2009-09-02 18:37:31 scottwilson Exp $
+*/
+public class RandomGUID {
+
+ public String valueBeforeMD5 = "";
+ public String valueAfterMD5 = "";
+ private static Random myRand;
+ private static SecureRandom mySecureRand;
+
+ private static String s_id;
+
+ /*
+ * Static block to take care of one time secureRandom seed.
+ * It takes a few seconds to initialize SecureRandom. You might
+ * want to consider removing this static block or replacing
+ * it with a "time since first loaded" seed to reduce this time.
+ * This block will run only once per JVM instance.
+ */
+
+ static {
+ mySecureRand = new SecureRandom();
+ long secureInitializer = mySecureRand.nextLong();
+ myRand = new Random(secureInitializer);
+ try {
+ s_id = InetAddress.getLocalHost().toString();
+ } catch (UnknownHostException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ /*
+ * Default constructor. With no specification of security option,
+ * this constructor defaults to lower security, high performance.
+ */
+ public RandomGUID() {
+ getRandomGUID(false);
+ }
+
+ /*
+ * Constructor with security option. Setting secure true
+ * enables each random number generated to be cryptographically
+ * strong. Secure false defaults to the standard Random function seeded
+ * with a single cryptographically strong random number.
+ */
+ public RandomGUID(boolean secure) {
+ getRandomGUID(secure);
+ }
+
+ /*
+ * Method to generate the random GUID
+ */
+ private void getRandomGUID(boolean secure) {
+ MessageDigest md5 = null;
+ StringBuffer sbValueBeforeMD5 = new StringBuffer();
+
+ try {
+ md5 = MessageDigest.getInstance("MD5");
+ } catch (NoSuchAlgorithmException e) {
+ System.out.println("Error: " + e);
+ }
+
+ try {
+ long time = System.currentTimeMillis();
+ long rand = 0;
+
+ if (secure) {
+ rand = mySecureRand.nextLong();
+ } else {
+ rand = myRand.nextLong();
+ }
+
+ // This StringBuffer can be a long as you need; the MD5
+ // hash will always return 128 bits. You can change
+ // the seed to include anything you want here.
+ // You could even stream a file through the MD5 making
+ // the odds of guessing it at least as great as that
+ // of guessing the contents of the file!
+ sbValueBeforeMD5.append(s_id);
+ sbValueBeforeMD5.append(":");
+ sbValueBeforeMD5.append(Long.toString(time));
+ sbValueBeforeMD5.append(":");
+ sbValueBeforeMD5.append(Long.toString(rand));
+
+ valueBeforeMD5 = sbValueBeforeMD5.toString();
+ md5.update(valueBeforeMD5.getBytes());
+
+ byte[] array = md5.digest();
+ StringBuffer sb = new StringBuffer();
+ for (int j = 0; j < array.length; ++j) {
+ int b = array[j] & 0xFF;
+ if (b < 0x10) sb.append('0');
+ sb.append(Integer.toHexString(b));
+ }
+
+ valueAfterMD5 = sb.toString();
+
+ } catch (Exception e) {
+ System.out.println("Error:" + e);
+ }
+ }
+
+
+ /*
+ * Convert to the standard format for GUID
+ * (Useful for SQL Server UniqueIdentifiers, etc.)
+ * Example: C2FEEEAC-CFCD-11D1-8B05-00600806D9B6
+ *
+ */
+ public String toString() {
+ String raw = valueAfterMD5.toUpperCase();
+ StringBuffer sb = new StringBuffer();
+ sb.append(raw.substring(0, 8));
+ sb.append("-");
+ sb.append(raw.substring(8, 12));
+ sb.append("-");
+ sb.append(raw.substring(12, 16));
+ sb.append("-");
+ sb.append(raw.substring(16, 20));
+ sb.append("-");
+ sb.append(raw.substring(20));
+
+ return sb.toString();
+ }
+
+ /*
+ * Demonstraton and self test of class
+ */
+ public static void main(String args[]) {
+ for (int i=0; i< 100; i++) {
+ RandomGUID myGUID = new RandomGUID();
+ System.out.println("Seeding String=" + myGUID.valueBeforeMD5);
+ System.out.println("rawGUID=" + myGUID.valueAfterMD5);
+ System.out.println("RandomGUID=" + myGUID.toString());
+ }
+ }
+}