Updated build config and profiles and added keyed error reporting for

tasks.
This commit is contained in:
Willem Cazander 2013-09-01 15:18:11 +02:00
parent 9775c521a4
commit 9e8067c946
15 changed files with 227 additions and 209 deletions

View file

@ -50,7 +50,7 @@ public class EldXsdLanguageTask extends AbstractX4OLanguageTask {
/**
* Executes this language task.
*/
public X4OLanguageTaskExecutor createTaskExecutor(final PropertyConfig config) {
protected X4OLanguageTaskExecutor createTaskExecutorChecked(final PropertyConfig config) {
return new X4OLanguageTaskExecutor() {
public void execute(X4OLanguage language) throws X4OLanguageTaskException {
try {

View file

@ -211,15 +211,15 @@ public final class PropertyConfig implements Cloneable {
return getPropertyKeysRequired().contains(key);
}
public final Collection<String> getPropertyKeysRequired() {
public final List<String> getPropertyKeysRequired() {
return findPropertyKeysRequired(false);
}
public final Collection<String> getPropertyKeysRequiredValues() {
public final List<String> getPropertyKeysRequiredValues() {
return findPropertyKeysRequired(true);
}
private final Collection<String> findPropertyKeysRequired(boolean checkValue) {
private final List<String> findPropertyKeysRequired(boolean checkValue) {
List<String> result = new ArrayList<String>(10);
for (String key:getPropertyKeys()) {
PropertyConfigItem item = getPropertyConfigItem(key);

View file

@ -22,6 +22,8 @@
*/
package org.x4o.xml.lang.task;
import java.util.List;
import org.x4o.xml.io.sax.ext.PropertyConfig;
/**
@ -48,6 +50,34 @@ public abstract class AbstractX4OLanguageTask implements X4OLanguageTask {
this.propertyConfig=propertyConfig;
}
protected abstract X4OLanguageTaskExecutor createTaskExecutorChecked(PropertyConfig config);
/**
* @see org.x4o.xml.lang.task.X4OLanguageTask#createTaskExecutor(org.x4o.xml.io.sax.ext.PropertyConfig)
*/
public X4OLanguageTaskExecutor createTaskExecutor(PropertyConfig config) {
return createTaskExecutorChecked(checkConfig(config));
}
private PropertyConfig checkConfig(PropertyConfig config) {
List<String> keys = config.getPropertyKeysRequiredValues();
if (keys.isEmpty()) {
return config;
}
StringBuffer buf = new StringBuffer(100);
buf.append("Error missing value(s) for key(s) {");
for (int i=0;i<keys.size();i++) {
buf.append('"');
buf.append(keys.get(i));
buf.append('"');
if (i<keys.size()-1) {
buf.append(',');
}
buf.append('}');
}
throw new IllegalArgumentException(buf.toString());
}
/**
* @see org.x4o.xml.lang.task.X4OLanguageTask#createTaskConfig()
*/

View file

@ -23,21 +23,18 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!-- ==================================================================== -->
<!-- ===== Automatic generated schema for language: cel ===== -->
<!-- ==================================================================== -->
<!--
ID: cel-module
ProviderName: Core Element Languag Module
ProviderHost: cel.x4o.org
Namespaces: 2
Uri: http://cel.x4o.org/xml/ns/cel-core
Uri schema: http://cel.x4o.org/xml/ns/cel-core-1.0.xsd
Created on: Sat Aug 24 22:02:08 CEST 2013
-->
<!-- ==================================================================== -->
<!-- ===== Automatic generated schema for language: cel ===== -->
<!-- ==================================================================== -->
<!--
Id: cel-module
ProviderName: Core Element Languag Module
ProviderHost: cel.x4o.org
Namespaces: 2
Uri: http://cel.x4o.org/xml/ns/cel-core
Uri schema http://cel.x4o.org/xml/ns/cel-core-1.0.xsd
Created on: Sun Sep 01 12:08:48 CEST 2013
-->
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:this="http://cel.x4o.org/xml/ns/cel-core"
version="1.0" elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://cel.x4o.org/xml/ns/cel-core">
@ -49,9 +46,9 @@
</choice>
<attribute name="required" type="boolean"/>
<attribute name="defaultValue" type="string"/>
<attribute name="objectConverter" type="string"/>
<attribute name="runResolveEL" type="boolean"/>
<attribute name="runConverters" type="boolean"/>
<attribute name="objectConverter" type="string"/>
<attribute name="runBeanValue" type="boolean"/>
<attribute name="writeOrder" type="integer"/>
<attribute name="description" type="string"/>
@ -75,12 +72,12 @@
</choice>
<attribute name="uri" type="string" use="required"/>
<attribute name="name" type="string"/>
<attribute name="prefixMapping" type="string"/>
<attribute name="schemaUri" type="string"/>
<attribute name="schemaResource" type="string"/>
<attribute name="languageRoot" type="boolean"/>
<attribute name="schemaPrefix" type="string"/>
<attribute name="elementNamespaceInstanceProvider" type="string"/>
<attribute name="prefixMapping" type="string"/>
<attribute name="description" type="string"/>
<attribute name="id" type="string"/>
</complexType>
@ -108,10 +105,10 @@
</choice>
<attribute name="objectClass" type="string"/>
<attribute name="elementClass" type="string"/>
<attribute name="schemaContentMixed" type="boolean"/>
<attribute name="autoAttributes" type="boolean"/>
<attribute name="schemaContentBase" type="string"/>
<attribute name="schemaContentComplex" type="boolean"/>
<attribute name="schemaContentMixed" type="boolean"/>
<attribute name="description" type="string"/>
<attribute name="id" type="string"/>
</complexType>

View file

@ -23,21 +23,18 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!-- ==================================================================== -->
<!-- ===== Automatic generated schema for language: cel ===== -->
<!-- ==================================================================== -->
<!--
ID: cel-module
ProviderName: Core Element Languag Module
ProviderHost: cel.x4o.org
Namespaces: 2
Uri: http://cel.x4o.org/xml/ns/cel-root
Uri schema: http://cel.x4o.org/xml/ns/cel-root-1.0.xsd
Created on: Sat Aug 24 22:02:08 CEST 2013
-->
<!-- ==================================================================== -->
<!-- ===== Automatic generated schema for language: cel ===== -->
<!-- ==================================================================== -->
<!--
Id: cel-module
ProviderName: Core Element Languag Module
ProviderHost: cel.x4o.org
Namespaces: 2
Uri: http://cel.x4o.org/xml/ns/cel-root
Uri schema http://cel.x4o.org/xml/ns/cel-root-1.0.xsd
Created on: Sun Sep 01 12:08:48 CEST 2013
-->
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:cel-core="http://cel.x4o.org/xml/ns/cel-core"
version="1.0" elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://cel.x4o.org/xml/ns/cel-root">

View file

@ -23,21 +23,18 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!-- ==================================================================== -->
<!-- ===== Automatic generated schema for language: eld ===== -->
<!-- ==================================================================== -->
<!--
ID: eld-module
ProviderName: Element Language Definition
ProviderHost: eld.x4o.org
Namespaces: 3
Uri: http://eld.x4o.org/xml/ns/eld-conv
Uri schema: http://eld.x4o.org/xml/ns/eld-conv-0.8.xsd
Created on: Sat Aug 24 21:57:18 CEST 2013
-->
<!-- ==================================================================== -->
<!-- ===== Automatic generated schema for language: eld ===== -->
<!-- ==================================================================== -->
<!--
Id: eld-module
ProviderName: Element Language Definition
ProviderHost: eld.x4o.org
Namespaces: 3
Uri: http://eld.x4o.org/xml/ns/eld-conv
Uri schema http://eld.x4o.org/xml/ns/eld-conv-0.8.xsd
Created on: Sun Sep 01 12:13:10 CEST 2013
-->
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:this="http://eld.x4o.org/xml/ns/eld-conv"
xmlns:lang="http://eld.x4o.org/xml/ns/eld-lang"

View file

@ -23,21 +23,18 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!-- ==================================================================== -->
<!-- ===== Automatic generated schema for language: eld ===== -->
<!-- ==================================================================== -->
<!--
ID: eld-module
ProviderName: Element Language Definition
ProviderHost: eld.x4o.org
Namespaces: 3
Uri: http://eld.x4o.org/xml/ns/eld-lang
Uri schema: http://eld.x4o.org/xml/ns/eld-lang-0.8.xsd
Created on: Sat Aug 24 21:57:18 CEST 2013
-->
<!-- ==================================================================== -->
<!-- ===== Automatic generated schema for language: eld ===== -->
<!-- ==================================================================== -->
<!--
Id: eld-module
ProviderName: Element Language Definition
ProviderHost: eld.x4o.org
Namespaces: 3
Uri: http://eld.x4o.org/xml/ns/eld-lang
Uri schema http://eld.x4o.org/xml/ns/eld-lang-0.8.xsd
Created on: Sun Sep 01 12:13:10 CEST 2013
-->
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
xmlns:this="http://eld.x4o.org/xml/ns/eld-lang"
@ -68,9 +65,9 @@
</attribute>
<attribute name="name" type="string"/>
<attribute name="required" type="boolean"/>
<attribute name="runResolveEL" type="boolean"/>
<attribute name="defaultValue" type="string"/>
<attribute name="objectConverter" type="string"/>
<attribute name="runResolveEL" type="boolean"/>
<attribute name="runConverters" type="boolean"/>
<attribute name="runBeanValue" type="boolean"/>
<attribute name="writeOrder" type="integer"/>
@ -110,13 +107,13 @@
</annotation>
</attribute>
<attribute name="name" type="string"/>
<attribute name="languageRoot" type="boolean"/>
<attribute name="schemaPrefix" type="string"/>
<attribute name="elementNamespaceInstanceProvider" type="string"/>
<attribute name="prefixMapping" type="string"/>
<attribute name="uri" type="string"/>
<attribute name="schemaUri" type="string"/>
<attribute name="schemaResource" type="string"/>
<attribute name="elementNamespaceInstanceProvider" type="string"/>
<attribute name="uri" type="string"/>
<attribute name="languageRoot" type="boolean"/>
<attribute name="schemaPrefix" type="string"/>
<attribute name="description" type="string"/>
</complexType>
<complexType name="descriptionType">
@ -177,10 +174,10 @@
<documentation xml:lang="en">An custom element class to config object.</documentation>
</annotation>
</attribute>
<attribute name="schemaContentMixed" type="boolean"/>
<attribute name="autoAttributes" type="boolean"/>
<attribute name="schemaContentBase" type="string"/>
<attribute name="schemaContentComplex" type="boolean"/>
<attribute name="schemaContentMixed" type="boolean"/>
<attribute name="description" type="string"/>
</complexType>
<complexType name="attributeAliasType">

View file

@ -23,21 +23,18 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!-- ==================================================================== -->
<!-- ===== Automatic generated schema for language: eld ===== -->
<!-- ==================================================================== -->
<!--
ID: eld-module
ProviderName: Element Language Definition
ProviderHost: eld.x4o.org
Namespaces: 3
Uri: http://eld.x4o.org/xml/ns/eld-root
Uri schema: http://eld.x4o.org/xml/ns/eld-root-1.0.xsd
Created on: Sat Aug 24 21:57:18 CEST 2013
-->
<!-- ==================================================================== -->
<!-- ===== Automatic generated schema for language: eld ===== -->
<!-- ==================================================================== -->
<!--
Id: eld-module
ProviderName: Element Language Definition
ProviderHost: eld.x4o.org
Namespaces: 3
Uri: http://eld.x4o.org/xml/ns/eld-root
Uri schema http://eld.x4o.org/xml/ns/eld-root-1.0.xsd
Created on: Sun Sep 01 12:13:10 CEST 2013
-->
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
xmlns:lang="http://eld.x4o.org/xml/ns/eld-lang"