Author: scabanovich
Date: 2010-02-10 09:45:57 -0500 (Wed, 10 Feb 2010)
New Revision: 20216
Modified:
trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/ds.meta
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/ds/model/DSConstants.java
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/ds/model/DSEntityRecognizer.java
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/ds/model/DSFileLoaderUtil.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-1253
Modified: trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/ds.meta
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/ds.meta 2010-02-10 10:25:07
UTC (rev 20215)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/ds.meta 2010-02-10 14:45:57
UTC (rev 20216)
@@ -7,8 +7,10 @@
<MAPPING name="FileVersions">
<PAIR name="DSConnectionFactories1.5"
value="FileDSConnectionFactories"/>
<PAIR name="DSConnectionFactories5.0dtd"
value="FileDSConnectionFactories50d"/>
+ <PAIR name="DSConnectionFactories5.0xsd"
value="FileDSConnectionFactories50s"/>
<PAIR name="DSDatasources1.5" value="FileDSDatasources"/>
<PAIR name="DSDatasources5.0dtd"
value="FileDSDatasources50d"/>
+ <PAIR name="DSDatasources5.0xsd"
value="FileDSDatasources50s"/>
</MAPPING>
<MAPPING name="Implementations">
<PAIR name="DS_Datasource"
value="org.jboss.tools.seam.xml.ds.model.DatasourceImpl"/>
@@ -392,6 +394,10 @@
<XModelAttributeReference
attributes="blocking-timeout-millis,idle-timeout-minutes"
entity="DSHALocalTXDatasource" name="timeout"/>
+ <XModelAttribute PROPERTIES="category=advanced"
+ name="allocation-retry" xmlname="allocation-retry.#text"/>
+ <XModelAttribute PROPERTIES="category=advanced"
+ name="allocation-retry-wait-millis"
xmlname="allocation-retry-wait-millis.#text"/>
<XModelAttributeReference attributes="no-tx-separate-pools"
entity="DSHALocalTXDatasource" name="no-tx-separate-pools"/>
<XModelAttributeReference
@@ -579,6 +585,9 @@
<XModelAttributeReference
attributes="blocking-timeout-millis,idle-timeout-minutes"
entity="DSHALocalTXDatasource" name="timeout"/>
+ <XModelAttributeReference
+ attributes="allocation-retry,allocation-retry-wait-millis"
+ entity="DSHALocalTXDatasource50" name="allocation"/>
<XModelAttributeReference attributes="no-tx-separate-pools"
entity="DSHALocalTXDatasource" name="no-tx-separate-pools"/>
<XModelAttribute PROPERTIES="category=advanced"
@@ -859,6 +868,9 @@
entity="DSHALocalTXDatasource" name="validate-on-match"/>
<XModelAttributeReference attributes="idle-timeout-minutes"
entity="DSHALocalTXDatasource" name="idle-timeout"/>
+ <XModelAttributeReference
+ attributes="allocation-retry,allocation-retry-wait-millis"
+ entity="DSHALocalTXDatasource50" name="allocation"/>
<XModelAttributeReference attributes="no-tx-separate-pools"
entity="DSHALocalTXDatasource" name="no-tx-separate-pools"/>
<XModelAttributeReference
@@ -1053,6 +1065,9 @@
entity="DSLocalTXDatasource50" name="background"/>
<XModelAttributeReference attributes="idle-timeout-minutes"
entity="DSHALocalTXDatasource" name="idle-timeout"/>
+ <XModelAttributeReference
+ attributes="allocation-retry,allocation-retry-wait-millis"
+ entity="DSHALocalTXDatasource50" name="allocation"/>
<XModelAttributeReference attributes="prefill,use-fast-fail"
entity="DSLocalTXDatasource" name="prefill"/>
<XModelAttributeReference attributes="metadata,type-mapping"
@@ -1227,6 +1242,9 @@
entity="DSLocalTXDatasource50" name="background"/>
<XModelAttributeReference attributes="idle-timeout-minutes"
entity="DSHALocalTXDatasource" name="idle-timeout"/>
+ <XModelAttributeReference
+ attributes="allocation-retry,allocation-retry-wait-millis"
+ entity="DSHALocalTXDatasource50" name="allocation"/>
<XModelAttributeReference attributes="validate-on-match"
entity="DSHALocalTXDatasource" name="validate-on-match"/>
<XModelAttributeReference
@@ -1401,6 +1419,9 @@
entity="DSLocalTXDatasource50" name="background"/>
<XModelAttributeReference attributes="idle-timeout-minutes"
entity="DSHALocalTXDatasource" name="idle-timeout"/>
+ <XModelAttributeReference
+ attributes="allocation-retry,allocation-retry-wait-millis"
+ entity="DSHALocalTXDatasource50" name="allocation"/>
<XModelAttributeReference attributes="no-tx-separate-pools"
entity="DSHALocalTXDatasource" name="no-tx-separate-pools"/>
<XModelAttributeReference attributes="prefill,use-fast-fail"
@@ -1601,6 +1622,9 @@
entity="DSLocalTXDatasource50" name="background"/>
<XModelAttributeReference attributes="idle-timeout-minutes"
entity="DSHALocalTXDatasource" name="idle-timeout"/>
+ <XModelAttributeReference
+ attributes="allocation-retry,allocation-retry-wait-millis"
+ entity="DSHALocalTXDatasource50" name="allocation"/>
<XModelAttributeReference attributes="validate-on-match"
entity="DSHALocalTXDatasource" name="validate-on-match"/>
<XModelAttributeReference attributes="no-tx-separate-pools"
@@ -1956,6 +1980,154 @@
</XActionItem>
<XDependencies/>
</XModelEntity>
+ <XModelEntity
+ ImplementationLoadingClass="org.jboss.tools.seam.xml.ds.model.DSFileLoader"
+
ImplementingClass="org.jboss.tools.common.model.filesystems.impl.SimpleFileImpl"
+ ObjectEditorClass="%XML%"
+
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.seam.xml.ui.editor.form.SeamXMLFormLayoutData"
+ XMLSUBPATH="connection-factories"
name="FileDSConnectionFactories50s">
+ <XChildrenEntities>
+ <XChildEntity maxCount="1" name="DSLoaderRepository"
required="yes"/>
+ <XChildEntity name="DSTXConnectionFactory50"/>
+ <XChildEntity name="DSNoTXConnectionFactory50"/>
+ </XChildrenEntities>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.ds.file" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="connection-factories"
loader="ElementType" name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general" name="name"
xmlname="NAME"/>
+ <XModelAttribute default="xml" name="extension"
xmlname="EXTENSION">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute TRIM="no" name="comment"
visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ <XModelAttribute loader="ElementType" name="_lateload"
visibility="false">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute default="no" name="isIncorrect"
visibility="false">
+ <Constraint loader="List">
+ <value name="yes"/>
+ <value name="no"/>
+ </Constraint>
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute name="incorrectBody" visibility="false"/>
+ <XModelAttribute PROPERTIES="save=always"
+
default="http://www.jboss.com/xml/ns/javaee" name="xmlns"
xmlname="xmlns"/>
+ <XModelAttribute PROPERTIES="save=always"
+
default="http://www.w3.org/2001/XMLSchema-instance"
name="xmlns:xsi" xmlname="xmlns:xsi"/>
+ <XModelAttribute PROPERTIES="save=always"
+
default="http://www.jboss.com/xml/ns/javaee
http://www.jboss.org/j2ee/schema/jboss-ds_5_0.xsd"
+ name="xsi:schemaLocation" xmlname="xsi:schemaLocation"/>
+ <XModelAttribute name="encoding">
+ <Constraint loader="ListString">
+ <value name="ISO-8859-1"/>
+ <value name="UTF-8"/>
+ </Constraint>
+ <Editor name="ListString"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItem BaseActionName="Open" HandlerClassName="%Open%"
+ ICON="action.empty" displayName="Open" kind="action"
name="Open"/>
+ <XActionItem displayName="Open With" group="1"
kind="list" name="OpenWith">
+ <XActionItem HIDE="always"
+
HandlerClassName="org.jboss.tools.common.meta.action.impl.handlers.OpenWithExternalHandler"
+ ICON="action.empty" PROPERTIES="extension=struts-config"
+ displayName="Open with External Program" kind="action"
name="OpenWithSelected"/>
+ <XActionItem HIDE="always"
+
HandlerClassName="org.jboss.tools.common.meta.action.impl.handlers.OpenWithChoiceHandler"
+ ICON="action.empty" PROPERTIES="extension=struts-config"
+ displayName="Choose Program..." kind="action"
name="OpenWithChoice">
+ <EntityData EntityName="OpenWithHelper">
+ <AttributeData AttributeName="name"/>
+ <AttributeData AttributeName="default"/>
+ </EntityData>
+ </XActionItem>
+ </XActionItem>
+ <XActionItem kind="list" name="EditActions">
+ <XActionItem HIDE="always"
+
HandlerClassName="org.jboss.tools.jsf.model.handlers.RenameFacesConfigHandler"
+ ICON="action.empty" PROPERTIES="validator.edit=true"
+ WizardClassName="%Default%" displayName="Rename..."
kind="action" name="Rename">
+ <EntityData EntityName="FacesConfig">
+ <AttributeData AttributeName="name"/>
+ </EntityData>
+ </XActionItem>
+ <XActionItem
+
HandlerClassName="org.jboss.tools.common.model.filesystems.impl.handlers.RenameEclipseFileHandler"
+ ICON="action.empty" displayName="Rename..."
kind="action" name="RenameEclipse"/>
+ </XActionItem>
+ <XActionItem kind="list" name="SaveActions">
+ <XActionItem HIDE="always" HandlerClassName="%SaveFile%"
+ ICON="action.save" displayName="Save" kind="action"
name="Save"/>
+ </XActionItem>
+ <XActionItem ICON="action.empty" displayName="New"
group="1"
+ kind="list" name="CreateActions">
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="TX Connection Factory..." kind="action"
name="AddTXConnectionFactory">
+ <EntityData EntityName="DSTXConnectionFactory50">
+ <AttributeData AttributeName="jndi-name"/>
+ </EntityData>
+ </XActionItem>
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="No TX Connection Factory..." kind="action"
name="AddNoTXConnectionFactory">
+ <EntityData EntityName="DSNoTXConnectionFactory50">
+ <AttributeData AttributeName="jndi-name"/>
+ </EntityData>
+ </XActionItem>
+ </XActionItem>
+ <XActionItem ICON="action.copy" displayName="Copy"
kind="list" name="CopyActions">
+ <XActionItem BaseActionName="Copy" HandlerClassName="%Copy%"
+ ICON="action.copy" displayName="Copy" kind="action"
name="Copy"/>
+ <XActionItem BaseActionName="Cut" HandlerClassName="%Cut%"
+ ICON="action.cut" displayName="Cut" kind="action"
name="Cut"/>
+ <XActionItem BaseActionName="Paste"
HandlerClassName="%Paste%"
+ ICON="action.paste" displayName="Paste" kind="action"
name="Paste"/>
+ </XActionItem>
+ <XActionItem ICON="action.delete" displayName="Delete"
kind="list" name="DeleteActions">
+ <XActionItem BaseActionName="Delete"
+
HandlerClassName="org.jboss.tools.jsf.model.handlers.DeleteFacesConfigHandler"
+ ICON="action.delete" displayName="Delete"
kind="action" name="Delete"/>
+ </XActionItem>
+ <XActionItem ICON="action.empty" kind="list"
name="Properties">
+ <XActionItem HandlerClassName="%Properties%"
ICON="action.empty"
+ displayName="Properties..." kind="action"
name="Properties"/>
+ </XActionItem>
+ <XActionItem kind="list" name="DiscardActions">
+ <XActionItem HIDE="always"
+
HandlerClassName="org.jboss.tools.jsf.model.handlers.DiscardConfigHandler"
+ ICON="action.delete"
+
PROPERTIES="significanceMessageClass=org.jboss.tools.common.model.filesystems.impl.DiscardFileSignificanceMessage"
+ displayName="Discard Changes" kind="action"
name="Discard"/>
+ </XActionItem>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
+ <XModelEntity name="FileDSConnectionFactories50s_EditorActionList">
+ <XChildrenEntities/>
+ <XEntityRenderer/>
+ <XModelAttributes/>
+ <XActionItem kind="list">
+ <XActionItemReference entity="FileDSConnectionFactories50s"
name="CreateActions"/>
+ <XActionItem ICON="action.empty" kind="list"
name="Properties">
+ <XActionItem HIDE="always" HandlerClassName="%Properties%"
+ ICON="action.empty" displayName="Properties..."
kind="action" name="Properties"/>
+ </XActionItem>
+ <XActionItem kind="list" name="VerifyActions">
+ <XActionItem kind="list" name="StaticActions"/>
+ </XActionItem>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
<XModelEntity name="FileDSConnectionFactories_EditorActionList">
<XChildrenEntities/>
<XEntityRenderer/>
@@ -2320,6 +2492,167 @@
</XActionItem>
<XDependencies/>
</XModelEntity>
+ <XModelEntity
+ ImplementationLoadingClass="org.jboss.tools.seam.xml.ds.model.DSFileLoader"
+
ImplementingClass="org.jboss.tools.common.model.filesystems.impl.SimpleFileImpl"
+ ObjectEditorClass="%XML%"
+
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.seam.xml.ui.editor.form.SeamXMLFormLayoutData"
+ XMLSUBPATH="datasources" name="FileDSDatasources50s">
+ <XChildrenEntities>
+ <XChildEntity maxCount="1" name="DSLoaderRepository"
required="yes"/>
+ <XChildEntity name="DSLocalTXDatasource50"/>
+ <XChildEntity name="DSNoTXDatasource50"/>
+ <XChildEntity name="DSXADatasource50"/>
+ </XChildrenEntities>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.ds.file" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="datasources" loader="ElementType"
name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general" name="name"
xmlname="NAME"/>
+ <XModelAttribute default="xml" name="extension"
xmlname="EXTENSION">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute TRIM="no" name="comment"
visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ <XModelAttribute loader="ElementType" name="_lateload"
visibility="false">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute default="no" name="isIncorrect"
visibility="false">
+ <Constraint loader="List">
+ <value name="yes"/>
+ <value name="no"/>
+ </Constraint>
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute name="incorrectBody" visibility="false"/>
+ <XModelAttribute PROPERTIES="save=always"
+
default="http://www.jboss.com/xml/ns/javaee" name="xmlns"
xmlname="xmlns"/>
+ <XModelAttribute PROPERTIES="save=always"
+
default="http://www.w3.org/2001/XMLSchema-instance"
name="xmlns:xsi" xmlname="xmlns:xsi"/>
+ <XModelAttribute PROPERTIES="save=always"
+
default="http://www.jboss.com/xml/ns/javaee
http://www.jboss.org/j2ee/schema/jboss-ds_5_0.xsd"
+ name="xsi:schemaLocation" xmlname="xsi:schemaLocation"/>
+ <XModelAttribute name="encoding">
+ <Constraint loader="ListString">
+ <value name="ISO-8859-1"/>
+ <value name="UTF-8"/>
+ </Constraint>
+ <Editor name="ListString"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItem BaseActionName="Open" HandlerClassName="%Open%"
+ ICON="action.empty" displayName="Open" kind="action"
name="Open"/>
+ <XActionItem displayName="Open With" group="1"
kind="list" name="OpenWith">
+ <XActionItem HIDE="always"
+
HandlerClassName="org.jboss.tools.common.meta.action.impl.handlers.OpenWithExternalHandler"
+ ICON="action.empty" PROPERTIES="extension=struts-config"
+ displayName="Open with External Program" kind="action"
name="OpenWithSelected"/>
+ <XActionItem HIDE="always"
+
HandlerClassName="org.jboss.tools.common.meta.action.impl.handlers.OpenWithChoiceHandler"
+ ICON="action.empty" PROPERTIES="extension=struts-config"
+ displayName="Choose Program..." kind="action"
name="OpenWithChoice">
+ <EntityData EntityName="OpenWithHelper">
+ <AttributeData AttributeName="name"/>
+ <AttributeData AttributeName="default"/>
+ </EntityData>
+ </XActionItem>
+ </XActionItem>
+ <XActionItem kind="list" name="EditActions">
+ <XActionItem HIDE="always"
+
HandlerClassName="org.jboss.tools.jsf.model.handlers.RenameFacesConfigHandler"
+ ICON="action.empty" PROPERTIES="validator.edit=true"
+ WizardClassName="%Default%" displayName="Rename..."
kind="action" name="Rename">
+ <EntityData EntityName="FacesConfig">
+ <AttributeData AttributeName="name"/>
+ </EntityData>
+ </XActionItem>
+ <XActionItem
+
HandlerClassName="org.jboss.tools.common.model.filesystems.impl.handlers.RenameEclipseFileHandler"
+ ICON="action.empty" displayName="Rename..."
kind="action" name="RenameEclipse"/>
+ </XActionItem>
+ <XActionItem kind="list" name="SaveActions">
+ <XActionItem HIDE="always" HandlerClassName="%SaveFile%"
+ ICON="action.save" displayName="Save" kind="action"
name="Save"/>
+ </XActionItem>
+ <XActionItem ICON="action.empty" displayName="New"
group="1"
+ kind="list" name="CreateActions">
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="Local TX Datasource..." kind="action"
name="AddLocalTXDatasource">
+ <EntityData EntityName="DSLocalTXDatasource50">
+ <AttributeData AttributeName="jndi-name"/>
+ <AttributeData AttributeName="connection-url"/>
+ <AttributeData AttributeName="driver-class"
Mandatory="no"/>
+ </EntityData>
+ </XActionItem>
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="XA Datasource..." kind="action"
name="AddXADatasource">
+ <EntityData EntityName="DSXADatasource50">
+ <AttributeData AttributeName="jndi-name"/>
+ <AttributeData AttributeName="xa-datasource-class"/>
+ </EntityData>
+ </XActionItem>
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="No TX Datasource..." kind="action"
name="AddNoDatasource">
+ <EntityData EntityName="DSNoTXDatasource50">
+ <AttributeData AttributeName="jndi-name"/>
+ <AttributeData AttributeName="connection-url"/>
+ <AttributeData AttributeName="driver-class"
Mandatory="no"/>
+ </EntityData>
+ </XActionItem>
+ </XActionItem>
+ <XActionItem ICON="action.copy" displayName="Copy"
kind="list" name="CopyActions">
+ <XActionItem BaseActionName="Copy" HandlerClassName="%Copy%"
+ ICON="action.copy" displayName="Copy" kind="action"
name="Copy"/>
+ <XActionItem BaseActionName="Cut" HandlerClassName="%Cut%"
+ ICON="action.cut" displayName="Cut" kind="action"
name="Cut"/>
+ <XActionItem BaseActionName="Paste"
HandlerClassName="%Paste%"
+ ICON="action.paste" displayName="Paste" kind="action"
name="Paste"/>
+ </XActionItem>
+ <XActionItem ICON="action.delete" displayName="Delete"
kind="list" name="DeleteActions">
+ <XActionItem BaseActionName="Delete"
+
HandlerClassName="org.jboss.tools.jsf.model.handlers.DeleteFacesConfigHandler"
+ ICON="action.delete" displayName="Delete"
kind="action" name="Delete"/>
+ </XActionItem>
+ <XActionItem ICON="action.empty" kind="list"
name="Properties">
+ <XActionItem HandlerClassName="%Properties%"
ICON="action.empty"
+ displayName="Properties..." kind="action"
name="Properties"/>
+ </XActionItem>
+ <XActionItem kind="list" name="DiscardActions">
+ <XActionItem HIDE="always"
+
HandlerClassName="org.jboss.tools.jsf.model.handlers.DiscardConfigHandler"
+ ICON="action.delete"
+
PROPERTIES="significanceMessageClass=org.jboss.tools.common.model.filesystems.impl.DiscardFileSignificanceMessage"
+ displayName="Discard Changes" kind="action"
name="Discard"/>
+ </XActionItem>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
+ <XModelEntity name="FileDSDatasources50s_EditorActionList">
+ <XChildrenEntities/>
+ <XEntityRenderer/>
+ <XModelAttributes/>
+ <XActionItem kind="list">
+ <XActionItemReference entity="FileDSDatasources50s"
name="CreateActions"/>
+ <XActionItem ICON="action.empty" kind="list"
name="Properties">
+ <XActionItem HIDE="always" HandlerClassName="%Properties%"
+ ICON="action.empty" displayName="Properties..."
kind="action" name="Properties"/>
+ </XActionItem>
+ <XActionItem kind="list" name="VerifyActions">
+ <XActionItem kind="list" name="StaticActions"/>
+ </XActionItem>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
<XModelEntity name="FileDSDatasources_EditorActionList">
<XChildrenEntities/>
<XEntityRenderer/>
@@ -2340,8 +2673,10 @@
<XChildrenEntities>
<XChildEntity name="FileDSDatasources"/>
<XChildEntity name="FileDSDatasources50d"/>
+ <XChildEntity name="FileDSDatasources50s"/>
<XChildEntity name="FileDSConnectionFactories"/>
<XChildEntity name="FileDSConnectionFactories50d"/>
+ <XChildEntity name="FileDSConnectionFactories50s"/>
</XChildrenEntities>
<XActionItem kind="list">
<XActionItem ICON="action.empty" displayName="New"
group="1"
@@ -2388,8 +2723,10 @@
<XChildrenEntities>
<XChildEntity name="FileDSDatasources"/>
<XChildEntity name="FileDSDatasources50d"/>
+ <XChildEntity name="FileDSDatasources50s"/>
<XChildEntity name="FileDSConnectionFactories"/>
<XChildEntity name="FileDSConnectionFactories50d"/>
+ <XChildEntity name="FileDSConnectionFactories50s"/>
</XChildrenEntities>
<XActionItem kind="list">
<XActionItem ICON="action.empty" displayName="New"
group="1"
@@ -2436,8 +2773,10 @@
<XChildrenEntities>
<XChildEntity name="FileDSDatasources"/>
<XChildEntity name="FileDSDatasources50d"/>
+ <XChildEntity name="FileDSDatasources50s"/>
<XChildEntity name="FileDSConnectionFactories"/>
<XChildEntity name="FileDSConnectionFactories50d"/>
+ <XChildEntity name="FileDSConnectionFactories50s"/>
</XChildrenEntities>
<XActionItem kind="list"/>
</XEntityExtension>
@@ -2445,8 +2784,10 @@
<XChildrenEntities>
<XChildEntity name="FileDSDatasources"/>
<XChildEntity name="FileDSDatasources50d"/>
+ <XChildEntity name="FileDSDatasources50s"/>
<XChildEntity name="FileDSConnectionFactories"/>
<XChildEntity name="FileDSConnectionFactories50d"/>
+ <XChildEntity name="FileDSConnectionFactories50s"/>
</XChildrenEntities>
<XActionItem kind="list"/>
</XEntityExtension>
Modified:
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/ds/model/DSConstants.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/ds/model/DSConstants.java 2010-02-10
10:25:07 UTC (rev 20215)
+++
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/ds/model/DSConstants.java 2010-02-10
14:45:57 UTC (rev 20216)
@@ -10,10 +10,14 @@
public String ENT_CONNECTION_FACTORIES_FILE = "FileDSConnectionFactories";
//$NON-NLS-1$
public String SUFF_50_DTD = "50d"; //$NON-NLS-1$
+ public String SUFF_50_XSD = "50s"; //$NON-NLS-1$
public String ENT_DATASOURCES_FILE_50_DTD = ENT_DATASOURCES_FILE + SUFF_50_DTD;
public String ENT_CONNECTION_FACTORIES_FILE_50_DTD = ENT_CONNECTION_FACTORIES_FILE +
SUFF_50_DTD;
+ public String ENT_DATASOURCES_FILE_50_XSD = ENT_DATASOURCES_FILE + SUFF_50_XSD;
+ public String ENT_CONNECTION_FACTORIES_FILE_50_XSD = ENT_CONNECTION_FACTORIES_FILE +
SUFF_50_XSD;
+
public String ATTR_TRACK_CONN = "track-connection-by-tx"; //$NON-NLS-1$
public String ATTR_TRANSACTION = "transaction"; //$NON-NLS-1$
public String ATTR_SECURITY_TYPE = "security-type"; //$NON-NLS-1$
Modified:
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/ds/model/DSEntityRecognizer.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/ds/model/DSEntityRecognizer.java 2010-02-10
10:25:07 UTC (rev 20215)
+++
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/ds/model/DSEntityRecognizer.java 2010-02-10
14:45:57 UTC (rev 20216)
@@ -36,9 +36,33 @@
if("datasources".equals(root)) return ENT_DATASOURCES_FILE_50_DTD;
if("connection-factories".equals(root)) return
ENT_CONNECTION_FACTORIES_FILE_50_DTD;
}
+ } else {
+ if(isDatasourcesSchema(body)) {
+ return ENT_DATASOURCES_FILE_50_XSD;
+ } else if(isConnectionFactoriesSchema(body)) {
+ return ENT_CONNECTION_FACTORIES_FILE_50_XSD;
+ }
+
}
return null;
}
+ private boolean isDatasourcesSchema(String body) {
+ int i = body.indexOf("<datasources"); //$NON-NLS-1$
+ if(i < 0) return false;
+ int j = body.indexOf(">", i); //$NON-NLS-1$
+ if(j < 0) return false;
+ String s = body.substring(i, j);
+ return
s.indexOf("http://www.jboss.org/j2ee/schema/jboss-ds_5_0.xsd") >
0; //$NON-NLS-1$
+ }
+
+ private boolean isConnectionFactoriesSchema(String body) {
+ int i = body.indexOf("<connection-factories"); //$NON-NLS-1$
+ if(i < 0) return false;
+ int j = body.indexOf(">", i); //$NON-NLS-1$
+ if(j < 0) return false;
+ String s = body.substring(i, j);
+ return
s.indexOf("http://www.jboss.org/j2ee/schema/jboss-ds_5_0.xsd") >
0; //$NON-NLS-1$
+ }
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/ds/model/DSFileLoaderUtil.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/ds/model/DSFileLoaderUtil.java 2010-02-10
10:25:07 UTC (rev 20215)
+++
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/ds/model/DSFileLoaderUtil.java 2010-02-10
14:45:57 UTC (rev 20216)
@@ -1,5 +1,8 @@
package org.jboss.tools.seam.xml.ds.model;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
import org.jboss.tools.common.meta.XAttribute;
@@ -9,6 +12,8 @@
import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
import org.jboss.tools.common.xml.XMLUtilities;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
public class DSFileLoaderUtil extends XModelObjectLoaderUtil implements DSConstants {
@@ -25,8 +30,13 @@
public boolean save(Element parent, XModelObject o) {
if(!needToSave(o)) return true;
- boolean b = super.save(parent, o);
+ return super.save(parent, o);
+ }
+
+ public boolean saveChildren(Element element, XModelObject o) {
+ boolean b = super.saveChildren(element, o);
//TODO check dtd
+ moveProperties(element);
return b;
}
@@ -109,4 +119,67 @@
}
return children;
}
+
+ static Set<String> beforeXADatasourceProperty = new HashSet<String>();
+ static Set<String> beforeConnectionProperty = new HashSet<String>();
+ static Set<String> beforeConfigProperty = new HashSet<String>();
+
+ static Map<String, Set<String>> propertiesToMove = new HashMap<String,
Set<String>>();
+
+ static {
+ beforeXADatasourceProperty.add("xa-datasource-class");
+
+ String[] beforeConfigNames = {"connection-definition", "rar-name",
"track-connection-by-tx", "xa-transaction",
"local-transaction", "jndi-name"};
+ for (String n: beforeConfigNames) beforeConfigProperty.add(n);
+
+ String[] beforeConnectionNames = {"driver-class",
"transaction-isolation"};
+ for (String n: beforeConnectionNames) beforeConnectionProperty.add(n);
+
+ propertiesToMove.put("xa-datasource-property", beforeXADatasourceProperty);
+ propertiesToMove.put("connection-property", beforeConnectionProperty);
+ propertiesToMove.put("config-property", beforeConfigProperty);
+ }
+
+ void moveProperties(Element parent) {
+ NodeList ns = parent.getChildNodes();
+ String childName = null;
+ for (int i = 0; i < ns.getLength(); i++) {
+ Node n = ns.item(i);
+ if(!(n instanceof Element)) continue;
+ String name = n.getNodeName();
+ if(propertiesToMove.containsKey(name)) {
+ childName = name;
+ break;
+ }
+ }
+ if(childName != null) {
+ moveChildren(parent, childName, propertiesToMove.get(childName));
+ }
+ }
+
+ void moveChildren(Element parent, String childName, Set<String> namesBeforeChild)
{
+ Element[] ps = XMLUtilities.getChildren(parent, childName);
+ if(ps == null || ps.length == 0) return;
+ Node after = null;
+ Node before = null;
+ NodeList ns = parent.getChildNodes();
+ for (int i = 0; i < ns.getLength(); i++) {
+ Node n = ns.item(i);
+ if(!(n instanceof Element)) continue;
+ if(namesBeforeChild.contains(n.getNodeName())) {
+ after = n;
+ } else {
+ if(after != null) {
+ before = n;
+ break;
+ }
+ }
+
+ }
+ if(before == null || before == ps[0]) return;
+
+ for (int i = 0; i < ps.length; i++) {
+ parent.insertBefore(ps[i], before);
+ }
+ }
}