Author: rahul
Date: Tue Dec 19 14:37:01 2006
New Revision: 488836

URL: http://svn.apache.org/viewvc?view=rev&rev=488836
Log:
 * Added DTD for dialog-configs for the Commons SCXML implementation.
 * Made the ConfigurationParser validating (removed related TODOs and FIXMEs).
SHALE-348

Added:
    shale/framework/trunk/shale-dialog-scxml/src/main/resources/org/
    shale/framework/trunk/shale-dialog-scxml/src/main/resources/org/apache/
    
shale/framework/trunk/shale-dialog-scxml/src/main/resources/org/apache/shale/
    
shale/framework/trunk/shale-dialog-scxml/src/main/resources/org/apache/shale/dialog/
    
shale/framework/trunk/shale-dialog-scxml/src/main/resources/org/apache/shale/dialog/scxml/
    
shale/framework/trunk/shale-dialog-scxml/src/main/resources/org/apache/shale/dialog/scxml/dialog-scxml-config_1_0.dtd
Modified:
    
shale/framework/trunk/shale-dialog-scxml/src/main/java/org/apache/shale/dialog/scxml/config/ConfigurationParser.java

Modified: 
shale/framework/trunk/shale-dialog-scxml/src/main/java/org/apache/shale/dialog/scxml/config/ConfigurationParser.java
URL: 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-dialog-scxml/src/main/java/org/apache/shale/dialog/scxml/config/ConfigurationParser.java?view=diff&rev=488836&r1=488835&r2=488836
==============================================================================
--- 
shale/framework/trunk/shale-dialog-scxml/src/main/java/org/apache/shale/dialog/scxml/config/ConfigurationParser.java
 (original)
+++ 
shale/framework/trunk/shale-dialog-scxml/src/main/java/org/apache/shale/dialog/scxml/config/ConfigurationParser.java
 Tue Dec 19 14:37:01 2006
@@ -76,6 +76,14 @@
     // -------------------------------------------------------------- 
Properties
 
     /**
+     * <p>Registration information for the DTD we will use to validate.</p>
+     */
+    private static final String[] REGISTRATIONS =
+    { "-//Apache Software Foundation//DTD Shale SCXML Dialog Configuration 
1.0//EN",
+      "/org/apache/shale/dialog/scxml/dialog-scxml-config_1_0.dtd" };
+
+
+    /**
      * <p>Default FQCN for dialog data.</p>
      */
     private static final String DEFAULT_DIALOG_DATA_CLASS_NAME = 
"java.util.HashMap";
@@ -140,9 +148,8 @@
 
     /**
      * <p>Flag indicating whether we should do a validating parse or not.</p>
-     * FIXME - Change to true (also in Javadoc below), see to do listed below.
      */
-    private boolean validating = false;
+    private boolean validating = true;
 
 
     /**
@@ -163,10 +170,7 @@
      * @param validating New flag value
      */
     public void setValidating(boolean validating) {
-        // TODO:
-        // Need a scxml-config DTD for Shale, ignore validity check requests
-        // Will need to be fixed if this class comes out of sandbox
-        //this.validating = validating;
+        this.validating = validating;
     }
 
 
@@ -211,6 +215,12 @@
         digester.setNamespaceAware(false);
         digester.setUseContextClassLoader(true);
         digester.setValidating(isValidating());
+
+        // Register local copy of our DTDs
+        for (int i = 0; i < REGISTRATIONS.length; i += 2) {
+            URL url = this.getClass().getResource(REGISTRATIONS[i + 1]);
+            digester.register(REGISTRATIONS[i], url);
+        }
 
         // Configure processing rules
 

Added: 
shale/framework/trunk/shale-dialog-scxml/src/main/resources/org/apache/shale/dialog/scxml/dialog-scxml-config_1_0.dtd
URL: 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-dialog-scxml/src/main/resources/org/apache/shale/dialog/scxml/dialog-scxml-config_1_0.dtd?view=auto&rev=488836
==============================================================================
--- 
shale/framework/trunk/shale-dialog-scxml/src/main/resources/org/apache/shale/dialog/scxml/dialog-scxml-config_1_0.dtd
 (added)
+++ 
shale/framework/trunk/shale-dialog-scxml/src/main/resources/org/apache/shale/dialog/scxml/dialog-scxml-config_1_0.dtd
 Tue Dec 19 14:37:01 2006
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ 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.
+
+ $Id$
+
+-->
+
+<!--
+
+ DTD for dialog definitions used by the "org.apache.shale.dialog.scxml"
+ package.
+ To support validation of your configuration file, include the following
+ DOCTYPE element at the beginning (after the "xml" declaration):
+    
+ <!DOCTYPE dialogs PUBLIC
+  "-//Apache Software Foundation//DTD Shale SCXML Dialog Configuration 1.0//EN"
+  "http://shale.apache.org/dtds/dialog-scxml-config_1_0.dtd";>
+
+-->
+
+
+<!-- ====================== Top Level Elements ============================= 
-->
+
+
+<!-- The "dialogs" element is the root of a single configuration file, and
+     contains zero or more "dialog" elements defining the SCXML-based dialogs
+     in the application.
+-->
+<!ELEMENT dialogs (dialog*)>
+
+
+<!-- The "dialog" element defines a particular reusable dialog.  The
+     following attributes are defined:
+
+     dataclassname              Fully qualified class name of a JavaBean class
+                                to be instantiated as the initial value of the
+                                "data" property when a new SCXMLDialogContext
+                                is initialized.  [java.util.HashMap]
+
+     name                       Name of this dialog (must be unique among
+                                all defined dialogs).
+
+     scxmlconfig                The relative location to the SCXML dialog
+                                configuration file (relative to the
+                                SCXML dialog configuration file that is
+                                validated by this DTD)
+-->
+<!ELEMENT dialog EMPTY>
+<!ATTLIST dialog                dataclassname   CDATA          #IMPLIED>
+<!ATTLIST dialog                name            CDATA          #REQUIRED>
+<!ATTLIST dialog                scxmlconfig     CDATA          #REQUIRED>
+


Reply via email to