Hi,

I am trying to create a new rule, which can be defined in xml-rule file
also. The rule is extension to the existing call-param-rule in which we can
pass the constant parameters (mainly string constants) which is currently
not possible with the call-param-rule.
After googleing I found the steps to do it which are:


   - Update the DTD. You should add an element type for your rule. The
   element should have an attribute corresponding to each of the rule's
   initialization parameters.
   - Define an ObjectCreationFactory
   - Extend DigesterRuleParser , and override the addRuleInstances() method
   to add the rules for parsing your new element.

I did all the three steps but still I am not able to call the method with
string constants which I am defining in the rule-xml. I am getting the
values of parameter as null.

Attachments:
*digester-rules.dtd* (This is the updated dtd with the new element added as
call-constant-param-rule. So step 1 is done.
*UpdatedRuleParser.java* (This java file defines the ObjectCreationFactory
(ConstantParamRuleFactory) and also extends the DigesterRuleParser.
*_xelerator_config_rule.xml* (XML file which defines the digester rules).
*_xelerator_config.xml *(XML document which needs to be parsed).
*ConstantParamRule.java* (Extended rule file)

What is it which i am missing or doing wrong.

Thanks in advance.

--wadi
<?xml version="1.0"?>
<!DOCTYPE digester-rules SYSTEM "C:\Users\Nitin\Downloads\digester-rules.dtd">
<digester-rules>
	<pattern value="Xelerator-Config">
		<!--object-create-rule classname="com.hcl.xelerator.configuration.digester.XeleratorConfigBean" /-->
		<pattern value="Transformations/TransformationChain">
			<object-create-rule classname="com.hcl.xelerator.configuration.digester.TransformationChainBean"/>
			<set-properties-rule/>
			<pattern value="Transformation">
				<object-create-rule classname="com.hcl.xelerator.configuration.digester.TransformationBean"/>
				<set-properties-rule/>
				<bean-property-setter-rule pattern="name"/>
				<bean-property-setter-rule pattern="description"/>
				<bean-property-setter-rule pattern="type"/>
				<bean-property-setter-rule pattern="transformationClass"/>
				<call-method-rule methodname="setMyName" paramcount="2">
					<call-constant-param-rule paramnumber="0" param="Blood" />
					<call-constant-param-rule paramnumber="1" param="Blood-2" />
				</call-method-rule>
				<set-next-rule methodname="addTransformation"/>
			</pattern>
			<!--set-next-rule methodname="addTransformationChain"/-->
		</pattern>
		<!--pattern value="ObjectPools/ObjectPoolsType">
	         <object-create-rule classname="com.hcl.xelerator.configuration.digester.ObjectPoolsBean" />
	         <set-properties-rule />
	         <pattern value="ObjectPool">
	         	<object-create-rule classname="com.hcl.xelerator.configuration.digester.ObjectPoolBean" />
	         	<set-properties-rule />
	         	<bean-property-setter-rule pattern="key"/>
	            <bean-property-setter-rule pattern="maxActive"/>
	            <bean-property-setter-rule pattern="minIdle"/>
	            <set-next-rule methodname="addPool" />
	         </pattern>
	         <set-next-rule methodname="addObjectPools" />
	    </pattern>
	    <pattern value="Connections/Connection">
	    	<object-create-rule classname="com.hcl.xelerator.configuration.digester.ConnectionBean" />
	    	<set-properties-rule />
	    	<bean-property-setter-rule pattern="URL" propertyname="url"/>
	    	<bean-property-setter-rule pattern="IPAddress" propertyname="ipAddress"/>
	    	<bean-property-setter-rule pattern="Port" propertyname="port"/>
	    	<bean-property-setter-rule pattern="ConnectorType" propertyname="connectorType"/>
	    	<bean-property-setter-rule pattern="ConnectionTimeout" propertyname="connectionTimeout"/>
	    	<bean-property-setter-rule pattern="WSDLLocation" propertyname="wsdlLocation"/>
	    	<bean-property-setter-rule pattern="EndPoint" propertyname="endPoint"/>
	    	<bean-property-setter-rule pattern="NameSpace" propertyname="nameSpace"/>
	    	<bean-property-setter-rule pattern="ServiceName" propertyname="serviceName"/>
	    	<bean-property-setter-rule pattern="PortName" propertyname="portName"/>
	    	<bean-property-setter-rule pattern="OperationName" propertyname="operationName"/>
	    	<bean-property-setter-rule pattern="ParameterCount" propertyname="parameterCount"/>
	    	<pattern value="Parameter">
	    		<set-properties-rule>
	    			<alias attr-name="javaType" prop-name="parameterJavaType"/>
	    		</set-properties-rule>
	    		<set-properties-rule>
	    			<alias attr-name="index" prop-name="parameterIndex"/>
	    		</set-properties-rule>
	    		<set-properties-rule>
	    			<alias attr-name="name" prop-name="parameterName"/>
	    		</set-properties-rule>
	    	</pattern>
	    	<pattern value="Return">
	    		<set-properties-rule>
	    			<alias attr-name="javaType" prop-name="returnJavaType"/>
	    		</set-properties-rule>
	    	</pattern>
	    	<pattern value="SSL">
	    		<set-properties-rule>
	    			<alias attr-name="enabled" prop-name="sslEnabled"/>
	    		</set-properties-rule>
	    		<pattern value="KeyStore">
	    			<set-properties-rule>
	    				<alias attr-name="location" prop-name="sslKeyStoreLocation"/>
	    			</set-properties-rule>
	    			<set-properties-rule>
	    				<alias attr-name="password" prop-name="sslKeyStorePassword"/>
	    			</set-properties-rule>
	    		</pattern>
	    		<pattern value="TrustStore">
	    			<set-properties-rule>
	    				<alias attr-name="location" prop-name="sslTrustStoreLocation"/>
	    			</set-properties-rule>
	    			<set-properties-rule>
	    				<alias attr-name="password" prop-name="sslTrustStorePassword"/>
	    			</set-properties-rule>
	    		</pattern>
	    	</pattern>
	    	<pattern value="BasicAuth">
	    		<set-properties-rule>
	    			<alias attr-name="enabled" prop-name="basicAuthenticationEnabled"/>
	    		</set-properties-rule>
	    		<bean-property-setter-rule pattern="UserName" propertyname="basicAuthenticationUserName"/>
	    		<bean-property-setter-rule pattern="Password" propertyname="basicAuthenticationPassword"/>
	    	</pattern>
	    	<set-next-rule methodname="addConnection" />
	    </pattern-->
	</pattern>
</digester-rules>
<?xml version="1.0" encoding="UTF-8"?>
<Xelerator-Config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
	<Transformations>
		<TransformationChain name="MY_REQUEST_CHAIN" inUse="true">
			<Transformation inUse="true">
				
			</Transformation>
			<Transformation inUse="true">
				<name>MyTransformation_2</name>
				<description>MyTransformation_2</description>
				<type>REQUEST</type>
				<transformationClass>test.com.transformation.forward.MyTransformation_2</transformationClass>
			</Transformation>
			<Transformation inUse="true">
				<name>MyTransformation_3</name>
				<description>MyTransformation_3</description>
				<type>REQUEST</type>
				<transformationClass>test.com.transformation.forward.MyTransformation_3</transformationClass>
			</Transformation>
		</TransformationChain>
		<TransformationChain name="MY_RESPONSE_CHAIN" inUse="true">
			<Transformation inUse="true">
				<name>MyTransformation_1</name>
				<description>MyTransformation_1</description>
				<type>RESPONSE</type>
				<transformationClass>test.com.transformation.backward.MyTransformation_1</transformationClass>
			</Transformation>
			<Transformation inUse="true">
				<name>MyTransformation_2</name>
				<description>MyTransformation_2</description>
				<type>RESPONSE</type>
				<transformationClass>test.com.transformation.backward.MyTransformation_2</transformationClass>
			</Transformation>
			<Transformation inUse="true">
				<name>MyTransformation_3</name>
				<description>MyTransformation_3</description>
				<type>RESPONSE</type>
				<transformationClass>test.com.transformation.backward.MyTransformation_3</transformationClass>
			</Transformation>
		</TransformationChain>
		<TransformationChain name="MY_RESPONSE_CHAIN" inUse="true">
			<Transformation inUse="true">
				<name>MyTransformation_1</name>
				<description>MyTransformation_1</description>
				<type>RESPONSE</type>
				<transformationClass>test.com.transformation.backward.MyTransformation_1</transformationClass>
			</Transformation>
			<Transformation inUse="true">
				<name>MyTransformation_2</name>
				<description>MyTransformation_2</description>
				<type>RESPONSE</type>
				<transformationClass>test.com.transformation.backward.MyTransformation_2</transformationClass>
			</Transformation>
			<Transformation inUse="true">
				<name>MyTransformation_3</name>
				<description>MyTransformation_3</description>
				<type>RESPONSE</type>
				<transformationClass>test.com.transformation.backward.MyTransformation_3</transformationClass>
			</Transformation>
		</TransformationChain>
		<TransformationChain name="MY_RESPONSE_CHAIN" inUse="true">
			<Transformation inUse="true">
				<name>MyTransformation_1</name>
				<description>MyTransformation_1</description>
				<type>RESPONSE</type>
				<transformationClass>test.com.transformation.backward.MyTransformation_1</transformationClass>
			</Transformation>
			<Transformation inUse="true">
				<name>MyTransformation_2</name>
				<description>MyTransformation_2</description>
				<type>RESPONSE</type>
				<transformationClass>test.com.transformation.backward.MyTransformation_2</transformationClass>
			</Transformation>
			<Transformation inUse="true">
				<name>MyTransformation_3</name>
				<description>MyTransformation_3</description>
				<type>RESPONSE</type>
				<transformationClass>test.com.transformation.backward.MyTransformation_3</transformationClass>
			</Transformation>
		</TransformationChain>
	</Transformations>
	<ObjectPools>
		<ObjectPoolsType type="OBJECT">
			<ObjectPool inUse="true" isKeyBasePool="true">
				<!-- this key is used as JAXBContext package name-->
				<key>test.com.hcl.pools.MyRequestObjects</key>
				<maxActive>20</maxActive>
				<minIdle>25</minIdle>
			</ObjectPool>
			<ObjectPool inUse="true" isKeyBasePool="true">
				<!-- this key is used as JAXBContext package name-->
				<key>test.com.hcl.pools.MyRequestObjects</key>
				<maxActive>2</maxActive>
				<minIdle>2</minIdle>
			</ObjectPool>
			<ObjectPool inUse="true" isKeyBasePool="true">
				<!-- this key is used as JAXBContext package name-->
				<key>test.com.hcl.pools.MyResponseObjects</key>
				<maxActive>5</maxActive>
				<minIdle>2</minIdle>
			</ObjectPool>
		</ObjectPoolsType>
		<ObjectPoolsType type="OBJECT">
			<ObjectPool inUse="true" isKeyBasePool="true">
				<!-- this key is used as JAXBContext package name-->
				<key>test.com.hcl.pools.MyRequestObjects</key>
				<maxActive>2</maxActive>
				<minIdle>2</minIdle>
			</ObjectPool>
			<ObjectPool inUse="true" isKeyBasePool="true">
				<!-- this key is used as JAXBContext package name-->
				<key>test.com.hcl.pools.MyRequestObjects</key>
				<maxActive>5</maxActive>
				<minIdle>1</minIdle>
			</ObjectPool>
			<ObjectPool inUse="true" isKeyBasePool="true">
				<!-- this key is used as JAXBContext package name-->
				<key>test.com.hcl.pools.MyResponseObjects</key>
				<maxActive>5</maxActive>
				<minIdle>2</minIdle>
			</ObjectPool>
		</ObjectPoolsType>
	</ObjectPools>
	<Connections>
		<Connection id="MYHCL" connectionType="HTTP" inUse="true">
			<URL>http://www.myhcl.in/</URL>
			<IPAddress>www.myhcl.in</IPAddress>
			<Port>80</Port>
			<ConnectorType>MYHCL</ConnectorType>
			<ConnectionTimeout>7000</ConnectionTimeout>
		</Connection>
		<Connection id="MYCON" connectionType="HTTP" inUse="true">
			<URL>http://www.myhcl.in/</URL>
			<IPAddress>www.myhcl.in</IPAddress>
			<Port>80</Port>
			<ConnectorType>HTTP</ConnectorType>
			<ConnectionTimeout>7000</ConnectionTimeout>
		</Connection>
		<Connection id="QPX" connectionType="SOCKET" inUse="false">
			<URL/>
			<IPAddress>10.112.67.129</IPAddress>
			<Port>80</Port>
			<ConnectorType>QPX</ConnectorType>
		</Connection>
		<Connection id="AUTHENTICATION" connectionType="WEBSERVICE" inUse="false">
			<URL>http://www.myhcl.in/</URL>
			<IPAddress>www.myhcl.in</IPAddress>
			<Port>80</Port>
			<ConnectorType>HTTP</ConnectorType>
			<ConnectionTimeout>7000</ConnectionTimeout>
			<WSDLLocation>http://10.7.0.16:9083/DirectConnect/Authentication/services/AuthenticationWS?wsdl</WSDLLocation>
			<EndPoint>http://10.7.0.16:9083/DirectConnect/Authentication/services/AuthenticationWS</EndPoint>
			<NameSpace>http://webservice.auth.hcl.com</NameSpace>
			<ServiceName>AuthenticationWSService</ServiceName>
			<PortName>AuthenticationWS</PortName>
			<OperationName>authenticateUser</OperationName>
			<!-- 
				Current Implementation can only handle a request for a single parameter input.	
			 -->
			<ParameterCount>1</ParameterCount>
			<!-- 
				Current only String type supported.	
			 -->
			<Parameter javaType="java.lang.String" index="1" name="requestXML"/>
			<!-- 
				Current Implementation can only handle String response from web service. 
			 -->
			<Return javaType="java.lang.String"/>
			<SSL enabled="true">
				<KeyStore location="E:/Installed/IBM/Rational/SDP/6.0/runtimes/base_v6/profiles/default/etc/DummyServerKeyFile.jks" password="WebAS"/>
				<TrustStore location="E:/Installed/IBM/Rational/SDP/6.0/runtimes/base_v6/profiles/default/etc/DummyServerTrustFile.jks" password="WebAS"/>
			</SSL>
			<BasicAuth enabled="true">
				<UserName>wadi</UserName>
				<Password>wadi1</Password>
			</BasicAuth>
		</Connection>
		<Connection id="DCSOAPBRIDGE" connectionType="HTTP" inUse="false">
			<!--URL for the Router Servlet for SOAP Bridge -->
			<URL>http://10.7.0.16:9086/DCRouterServlet/RouterServletSOAPBridgeCert</URL>
			<!-- same as we have for HTTP Bridge -->
			<SSL enabled="true">
				<KeyStore location="E:/Installed/IBM/Rational/SDP/6.0/runtimes/base_v6/profiles/default/etc/DummyServerKeyFile.jks" password="WebAS"/>
				<TrustStore location="E:/Installed/IBM/Rational/SDP/6.0/runtimes/base_v6/profiles/default/etc/DummyServerTrustFile.jks" password="WebAS"/>
			</SSL>
		</Connection>
	</Connections>
	<Transformations>
	<TransformationChain name="MY_REQUEST_CHAIN" inUse="true">
		<Transformation inUse="true">
			<name>MyTransformation_1</name>
			<description>MyTransformation_1</description>
			<type>REQUEST</type>
			<transformationClass>test.com.transformation.forward.MyTransformation_1</transformationClass>
		</Transformation>
		<Transformation inUse="true">
			<name>MyTransformation_2</name>
			<description>MyTransformation_2</description>
			<type>REQUEST</type>
			<transformationClass>test.com.transformation.forward.MyTransformation_2</transformationClass>
		</Transformation>
		<Transformation inUse="true">
			<name>MyTransformation_3</name>
			<description>MyTransformation_3</description>
			<type>REQUEST</type>
			<transformationClass>test.com.transformation.forward.MyTransformation_3</transformationClass>
		</Transformation>
	</TransformationChain>
	<TransformationChain name="MY_RESPONSE_CHAIN" inUse="true">
		<Transformation inUse="true">
			<name>MyTransformation_1</name>
			<description>MyTransformation_1</description>
			<type>RESPONSE</type>
			<transformationClass>test.com.transformation.backward.MyTransformation_1</transformationClass>
		</Transformation>
		<Transformation inUse="true">
			<name>MyTransformation_2</name>
			<description>MyTransformation_2</description>
			<type>RESPONSE</type>
			<transformationClass>test.com.transformation.backward.MyTransformation_2</transformationClass>
		</Transformation>
		<Transformation inUse="true">
			<name>MyTransformation_3</name>
			<description>MyTransformation_3</description>
			<type>RESPONSE</type>
			<transformationClass>test.com.transformation.backward.MyTransformation_3</transformationClass>
		</Transformation>
	</TransformationChain>
	<TransformationChain name="MY_RESPONSE_CHAIN" inUse="true">
		<Transformation inUse="true">
			<name>MyTransformation_1</name>
			<description>MyTransformation_1</description>
			<type>RESPONSE</type>
			<transformationClass>test.com.transformation.backward.MyTransformation_1</transformationClass>
		</Transformation>
		<Transformation inUse="true">
			<name>MyTransformation_2</name>
			<description>MyTransformation_2</description>
			<type>RESPONSE</type>
			<transformationClass>test.com.transformation.backward.MyTransformation_2</transformationClass>
		</Transformation>
		<Transformation inUse="true">
			<name>MyTransformation_3</name>
			<description>MyTransformation_3</description>
			<type>RESPONSE</type>
			<transformationClass>test.com.transformation.backward.MyTransformation_3</transformationClass>
		</Transformation>
	</TransformationChain>
	<TransformationChain name="MY_RESPONSE_CHAIN" inUse="true">
		<Transformation inUse="true">
			<name>MyTransformation_1</name>
			<description>MyTransformation_1</description>
			<type>RESPONSE</type>
			<transformationClass>test.com.transformation.backward.MyTransformation_1</transformationClass>
		</Transformation>
		<Transformation inUse="true">
			<name>MyTransformation_2</name>
			<description>MyTransformation_2</description>
			<type>RESPONSE</type>
			<transformationClass>test.com.transformation.backward.MyTransformation_2</transformationClass>
		</Transformation>
		<Transformation inUse="true">
			<name>MyTransformation_3</name>
			<description>MyTransformation_3</description>
			<type>RESPONSE</type>
			<transformationClass>test.com.transformation.backward.MyTransformation_3</transformationClass>
		</Transformation>
	</TransformationChain>
</Transformations>
</Xelerator-Config>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to