[JCA Development] - Metadata design - xsds
by Stefano Maestri
Stefano Maestri [http://community.jboss.org/people/maeste] created the discussion
"Metadata design - xsds"
To view the discussion, visit: http://community.jboss.org/message/552535#552535
--------------------------------------------------------------
Hi All,
I'm designing our new metadatas layer and I've imported in the projects XSDs form jboss-metadata-rar.
I've started with jboss-ra_2_0.xsd and I've already done some changes to that one I'd like to share with you because it would guidelines I'd like to follow in next future for our own XSDs (i.e. not included in JCA specs):
diff --git a/common/src/main/resources/schema/jboss-ra_2_0.xsd b/common/src/main/resources/schema/jboss-ra_2_0.xsd
index b8f86cc..3b53927 100644
--- a/common/src/main/resources/schema/jboss-ra_2_0.xsd
+++ b/common/src/main/resources/schema/jboss-ra_2_0.xsd
@@ -5,12 +5,9 @@
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.0">
-
- <xs:import namespace="http://java.sun.com/xml/ns/javaee" schemaLocation="http://java.sun.com/xml/ns/javaee/javaee_5.xsd"/>
-
- <xs:element name="jboss-ra" type="ra:jbossRaType"/>
+ <xs:element name="jboss-ra" type="ra:jboss-ra-type"/>
- <xs:complexType name="jbossRaType">
+ <xs:complexType name="jboss-ra-type">
<xs:sequence>
<xs:element name="ra-config-property" type="ra:ra-config-property-type" minOccurs="0" maxOccurs="unbounded"/>
@@ -26,10 +23,10 @@
<xs:sequence>
<xs:element name="ra-config-property-name" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="ra-config-property-type" type="ra:ra-config-property-typeType" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="ra-config-property-type" type="ra:ra-config-property-type-type" minOccurs="1" maxOccurs="1"/>
<xs:element name="ra-config-property-value" type="xs:string" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
- <xs:attribute name="override-element" type="xs:string" default="resourceadapter"/>
+ <xs:attribute name="override-element" type="ra:override-element-type" default="resourceadapter"/>
</xs:complexType>
<xs:complexType name="bean-validation-groups-type">
@@ -45,31 +42,27 @@
</xs:sequence>
</xs:complexType>
- <xs:complexType name="ra-config-property-typeType">
- <xs:simpleContent>
- <xs:restriction base="javaee:string">
- <xs:enumeration value="java.lang.Boolean"/>
- <xs:enumeration value="java.lang.String"/>
- <xs:enumeration value="java.lang.Integer"/>
- <xs:enumeration value="java.lang.Double"/>
- <xs:enumeration value="java.lang.Byte"/>
- <xs:enumeration value="java.lang.Short"/>
- <xs:enumeration value="java.lang.Long"/>
- <xs:enumeration value="java.lang.Float"/>
- <xs:enumeration value="java.lang.Character"/>
- </xs:restriction>
- </xs:simpleContent>
- </xs:complexType>
+ <xs:simpleType name="ra-config-property-type-type">
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="java.lang.Boolean"/>
+ <xs:enumeration value="java.lang.String"/>
+ <xs:enumeration value="java.lang.Integer"/>
+ <xs:enumeration value="java.lang.Double"/>
+ <xs:enumeration value="java.lang.Byte"/>
+ <xs:enumeration value="java.lang.Short"/>
+ <xs:enumeration value="java.lang.Long"/>
+ <xs:enumeration value="java.lang.Float"/>
+ <xs:enumeration value="java.lang.Character"/>
+ </xs:restriction>
+ </xs:simpleType>
- <xs:complexType name="override-elementType">
- <xs:simpleContent>
- <xs:restriction base="javaee:string">
+ <xs:simpleType name="override-element-type">
+ <xs:restriction base="xs:token">
<xs:enumeration value="connection-definition"/>
<xs:enumeration value="resourceadapter"/>
<xs:enumeration value="activationspec"/>
<xs:enumeration value="adminobject"/>
<xs:enumeration value="authentication-mechanism"/>
</xs:restriction>
- </xs:simpleContent>
- </xs:complexType>
+ </xs:simpleType>
</xs:schema>
As you can see above what I've basically done is
1. removing dependency from j2ee schema. It was used just for j2ee:string that is an xs:token. I think using xs:token keep xsd more readable and easy to understand. Moreover it is the important to build enumeration type as xs:simpleType and so making possible to use them also for attribute type
2. Use of simpletype where it is possible for enumeration making possible to use them for attributes type
3. All element name and type name are lower case
I have elaborated a bit more on this xsd, and I think a great enhancement we can is to define type for ra-config-property at xsd level instead of define 2 different element to express value and type. IOW doing this changes to previous xsd
diff --git a/common/src/main/resources/schema/jboss-ra_2_0.xsd b/common/src/main/resources/schema/jboss-ra_2_0.xsd
index 08c5e17..58572d9 100644
--- a/common/src/main/resources/schema/jboss-ra_2_0.xsd
+++ b/common/src/main/resources/schema/jboss-ra_2_0.xsd
@@ -23,8 +23,17 @@
<xs:sequence>
<xs:element name="ra-config-property-name" type="xs:token" minOccurs="1" maxOccurs="1"/>
- <xs:element name="ra-config-property-type" type="ra:ra-config-property-type-type" minOccurs="1" maxOccurs="1"/>
- <xs:element name="ra-config-property-value" type="xs:token" minOccurs="0" maxOccurs="1"/>
+ <xs:choice>
+ <xs:element name="ra-config-property-booelan" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="ra-config-property-string" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="ra-config-property-integer" type="xs:integer" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="ra-config-property-double" type="xs:double" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="ra-config-property-byte" type="xs:byte" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="ra-config-property-short" type="xs:short" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="ra-config-property-long" type="xs:long" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="ra-config-property-float" type="xs:float" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="ra-config-property-char" type="ra:char" minOccurs="0" maxOccurs="1"/>
+ </xs:choice>
</xs:sequence>
<xs:attribute name="override-element" type="ra:override-element-type" default="resourceadapter"/>
</xs:complexType>
@@ -42,20 +51,13 @@
</xs:sequence>
</xs:complexType>
- <xs:simpleType name="ra-config-property-type-type">
- <xs:restriction base="xs:token">
- <xs:enumeration value="java.lang.Boolean"/>
- <xs:enumeration value="java.lang.String"/>
- <xs:enumeration value="java.lang.Integer"/>
- <xs:enumeration value="java.lang.Double"/>
- <xs:enumeration value="java.lang.Byte"/>
- <xs:enumeration value="java.lang.Short"/>
- <xs:enumeration value="java.lang.Long"/>
- <xs:enumeration value="java.lang.Float"/>
- <xs:enumeration value="java.lang.Character"/>
- </xs:restriction>
- </xs:simpleType>
-
+ <xsi:simpleType name="char">
+ <xsi:restriction base="xsi:string">
+ <xsi:maxLength value="1"/>
+ <xsi:minLength value="1"/>
+ </xsi:restriction>
+ </xsi:simpleType>
+
<xs:simpleType name="override-element-type">
<xs:restriction base="xs:token">
<xs:enumeration value="connection-definition"/>
As you can see the xsd is a bit more verbose, and parsing it will be too. But IMHO it drives to more readable config files and give us the opportunity to effective validate xml and values before èarsing if we decide to.
Look forward for your feedback
S
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/552535#552535]
Start a new discussion in JCA Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 5 months
[JBoss ESB Development] - Supporting config file(s) host specific settings
by Dave Siracusa
Dave Siracusa [http://community.jboss.org/people/davesiracusa] created the discussion
"Supporting config file(s) host specific settings"
To view the discussion, visit: http://community.jboss.org/message/552522#552522
--------------------------------------------------------------
I added support for substitution properties in jboss-esb.xml. At construction time I merge properties from a soa-p.properties file to support host specific changes(sample below). I either look for this file in a directory or load the file from from an embedded .ESB resource in directory name that matches the hostname I'm running on. In order to do this I created a wrapper class which constructs out-of-box actons via reflection.
Perosnally I'd like to refactor and extend this for all config files (jboss-esb.xml, deployment.xml, jbm-queue-service.xml, etc). I think this feature would be helpful to other developers as many of us have development, user testing, staging and production environments where host names, thread settings, JCA retry periods vary from environment to environment. I know I can do this at build time, however it's nicer to have only one .ESB file for all servers.
+Can I override the existing loader/provider, or perhaps you can point me to a central point in the SOA-P source where I can make my changes?+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<service category="Business Profile Services"
name="AddressHub SOAP Proxy"
description="AddressHub SOAP WebService Proxy"
invmScope="GLOBAL">
<property name="maxThreads" value*="@maxthreads-addresshub@"*/>
<listeners>
<http-gateway name="Index-ahsoap" urlPattern="addresshub/soap/*" />
</listeners>
<actions mep="RequestResponse">
<action name="proxy"
class="com.siracusa.soa.esb.bus.bpesb.actions.WrapSoapProxyAction">
<property name="guest-class" value="org.jboss.soa.esb.actions.soap.proxy.SOAPProxy" />
<property name="guest-configuration-rethrow" value="false" />
<property name="guest-wsdl" value=" http://@addresshub-host@/addresshubWebServices/soap?wsdl http://*@addresshub-host@/*addresshubWebServices/soap?wsdl" />
<property name="guest-cacheDoc" value="file://*@wsdl-cache-directory@/*addresshub.html"/>
<property name="guest-docXSL" value="/transforms/wsdl-viewer.xsl"/>
<property name="exceptionMethod" value="exceptionHandler" />
<property name="wsdl" value="file://*@wsdl-cache-directory@/*addresshub.wsdl">
<http-client-property name="max-total-connections" value="100" />
<http-client-property name="max-connections-per-host" value="50" />
</property>
</action>
</actions>
</service>
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/552522#552522]
Start a new discussion in JBoss ESB Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 5 months
Re: [jboss-dev-forums] [JBoss ESB Development] - httprouter issues with GET/POST WADL Services and Web Routing
by jack lista
jack lista [http://community.jboss.org/people/jackalista] replied to the discussion
"httprouter issues with GET/POST WADL Services and Web Routing"
To view the discussion, visit: http://community.jboss.org/message/552426#552426
--------------------------------------------------------------
Hi, Dave, so it looks like there is some stuff missing, processWADLDocRequest(), processWADLRequest(), processXSDRequest(), do I need this stuff? Or should I chop out those branches of code and make them throw exceptions or something? I'm not totally sure of your context as haven't done much work with JBossESB yet, but what I did was to tale your (I'm assuming this is for an Action class, right?) "process(Message msg)" method and slap it in another custom class, from simple_cbr quiclkstart. So I'm guessing that the action that you chopped this out of does more stuff (like WADL stuff, or XSD stuff... true?) than make REST requests, so you only sent me part of it, is that right? So, for ex., here:
if (requestInfo.getQueryParams().containsKey("doc"))
return processWADLDocRequest(message, null);
Does it need to handle these cases? I think there are 3 of them... or can I make them throw exceptions instead and I won't hit them?
THe other thing I wanted to ask you about was configuration of this. I put the method fragment in one of the quickstart MyFooAction classes and renamed it WADLAction.java and slapped your process method in there (please fill me in about the missing methods above, I'm not at all familiar with Jersey). I also put the JerseyClientSingleton class in the same package as the rest of the simple_cbr quickstart. Do I need any configuration in jboss-esb.xml? I think I see what your code is doing for the most part, now let's see if I can get it to work. Thanks too, BTW!
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/552426#552426]
Start a new discussion in JBoss ESB Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 5 months