Author: chris.laprun(a)jboss.com
Date: 2010-04-07 06:05:09 -0400 (Wed, 07 Apr 2010)
New Revision: 13904
Modified:
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BehaviorBackedServiceFactory.java
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractJNDIServiceFactory.java
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/services/CachingServiceFactory.java
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceFactory.java
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceWrapper.java
branches/Enterprise_Portal_Platform_4_3/wsrp/src/resources/portal-wsrp-sar/dtd/jboss-wsrp-consumer_2_6.dtd
branches/Enterprise_Portal_Platform_4_3/wsrp/src/resources/portal-wsrp-sar/xsd/jboss-wsrp-consumer_2_6.xsd
branches/Enterprise_Portal_Platform_4_3/wsrp/src/resources/tests/test-deployment-lib-jar/test-wsrp.xml
Log:
- JBEPP-291: Added option to configure WS timeout from WSRP consumer descriptors.
Modified:
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java
===================================================================
---
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java 2010-03-11
03:52:34 UTC (rev 13903)
+++
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java 2010-04-07
10:05:09 UTC (rev 13904)
@@ -85,6 +85,7 @@
assertEquals(consumer.getProducerId(), info.getId());
EndpointConfigurationInfo endInfo = info.getEndpointConfigurationInfo();
assertNotNull(endInfo);
+ assertEquals(4000, endInfo.getServiceFactory().getWSOperationTimeOut());
assertEquals("http://www.example.com",
endInfo.getServiceDescriptionURL());
assertEquals("http://www.example.com", endInfo.getMarkupURL());
assertEquals("http://www.example.com", endInfo.getRegistrationURL());
@@ -108,7 +109,7 @@
endInfo = info.getEndpointConfigurationInfo();
assertNotNull(endInfo);
assertTrue(endInfo.usesWSDL());
- assertEquals("http://wsrp.bea.com:7001/producer/producer?WSDL",
endInfo.getWsdlDefinitionURL());
+
assertEquals("http://portalstandards.oracle.com/portletapp/portlets?...;,
endInfo.getWsdlDefinitionURL());
RegistrationInfo regInfo = info.getRegistrationInfo();
assertNotNull(regInfo);
assertNull(regInfo.isRegistrationRequired());
Modified:
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BehaviorBackedServiceFactory.java
===================================================================
---
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BehaviorBackedServiceFactory.java 2010-03-11
03:52:34 UTC (rev 13903)
+++
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BehaviorBackedServiceFactory.java 2010-04-07
10:05:09 UTC (rev 13904)
@@ -164,6 +164,16 @@
// do nothing
}
+ public void setWSOperationTimeOut(int msBeforeTimeOut)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getWSOperationTimeOut()
+ {
+ return ServiceFactory.DEFAULT_TIMEOUT_MS;
+ }
+
public void create() throws Exception
{
throw new NotYetImplemented();
Modified:
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
===================================================================
---
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java 2010-03-11
03:52:34 UTC (rev 13903)
+++
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java 2010-04-07
10:05:09 UTC (rev 13904)
@@ -78,6 +78,7 @@
/** Whether we're using information from a WSDL or not. */
private boolean usingWSDL = true;
private boolean isModifiedWSDL;
+ private int wsTimeoutMS;
// todo: public for tests
public EndpointConfigurationInfo()
@@ -278,6 +279,7 @@
}
startServiceFactoryIfNeeded();
+ serviceFactory.setWSOperationTimeOut(wsTimeoutMS);
}
}
@@ -490,4 +492,9 @@
return remoteHostAddress;
}
+
+ public void setWSOperationTimeOut(int wsTimeoutMS)
+ {
+ this.wsTimeoutMS = wsTimeoutMS;
+ }
}
Modified:
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
===================================================================
---
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2010-03-11
03:52:34 UTC (rev 13903)
+++
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2010-04-07
10:05:09 UTC (rev 13904)
@@ -29,6 +29,7 @@
import org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo;
import org.jboss.portal.wsrp.consumer.ProducerInfo;
import org.jboss.portal.wsrp.consumer.RegistrationInfo;
+import org.jboss.portal.wsrp.services.ServiceFactory;
import org.jboss.util.StringPropertyReplacer;
import org.jboss.xb.binding.GenericObjectModelFactory;
import org.jboss.xb.binding.UnmarshallingContext;
@@ -168,8 +169,23 @@
}
}
+ String wsTimeout = attrs.getValue("ws-timeout");
+ Integer wsTimeoutMS = ServiceFactory.DEFAULT_TIMEOUT_MS;
+ if (wsTimeout != null)
+ {
+ try
+ {
+ wsTimeoutMS = new Integer(wsTimeout);
+ }
+ catch (NumberFormatException e)
+ {
+ log.info("Ignoring bad WS timeout value " + wsTimeout + "
for producer '" + id + "'");
+ }
+ }
+
// consumer didn't exist in the database, so create one and configure it
consumer = consumerRegistry.createConsumer(id, expirationCacheSeconds);
+
consumer.getProducerInfo().getEndpointConfigurationInfo().setWSOperationTimeOut(wsTimeoutMS);
return consumer;
}
Modified:
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractJNDIServiceFactory.java
===================================================================
---
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractJNDIServiceFactory.java 2010-03-11
03:52:34 UTC (rev 13903)
+++
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractJNDIServiceFactory.java 2010-04-07
10:05:09 UTC (rev 13904)
@@ -60,6 +60,9 @@
/** Whether or not this ServiceFactory is availble to provide services */
protected boolean available = true;
+ /** Timeout before WS operations are considered as failed. */
+ private int msBeforeTimeOut;
+
static
{
// fix-me: this is hardcoded from values from
portal-wsrp-client.jar/META-INF/jboss-client.xml... NOT GOOD!
@@ -193,4 +196,19 @@
{
this.portJNDIMapping = portJNDIMapping;
}
+
+ public void setWSOperationTimeOut(int msBeforeTimeOut)
+ {
+ if (msBeforeTimeOut < 0)
+ {
+ msBeforeTimeOut = DEFAULT_TIMEOUT_MS;
+ }
+
+ this.msBeforeTimeOut = msBeforeTimeOut;
+ }
+
+ public int getWSOperationTimeOut()
+ {
+ return msBeforeTimeOut;
+ }
}
Modified:
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/services/CachingServiceFactory.java
===================================================================
---
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/services/CachingServiceFactory.java 2010-03-11
03:52:34 UTC (rev 13903)
+++
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/services/CachingServiceFactory.java 2010-04-07
10:05:09 UTC (rev 13904)
@@ -177,4 +177,22 @@
}
delegate.setPortletManagementURL(portletManagementURL);
}
+
+ public void setWSOperationTimeOut(int msBeforeTimeOut)
+ {
+ if (delegate == null)
+ {
+ throw new IllegalStateException("No delegate service factory");
+ }
+ delegate.setWSOperationTimeOut(msBeforeTimeOut);
+ }
+
+ public int getWSOperationTimeOut()
+ {
+ if (delegate == null)
+ {
+ throw new IllegalStateException("No delegate service factory");
+ }
+ return delegate.getWSOperationTimeOut();
+ }
}
Modified:
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceFactory.java
===================================================================
---
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceFactory.java 2010-03-11
03:52:34 UTC (rev 13903)
+++
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceFactory.java 2010-04-07
10:05:09 UTC (rev 13904)
@@ -34,6 +34,8 @@
*/
public interface ServiceFactory extends Service
{
+ int DEFAULT_TIMEOUT_MS = 10000;
+
<T extends Remote> T getService(Class<T> clazz) throws Exception;
/**
@@ -69,4 +71,14 @@
void setRegistrationURL(String registrationURL);
void setPortletManagementURL(String portletManagementURL);
+
+ /**
+ * Number of milliseconds before a WS operation is considered as having timed out.
+ *
+ * @param msBeforeTimeOut number of milliseconds to wait for a WS operation to return
before timing out. Will be set
+ * to {@link #DEFAULT_TIMEOUT_MS} if negative.
+ */
+ void setWSOperationTimeOut(int msBeforeTimeOut);
+
+ int getWSOperationTimeOut();
}
Modified:
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceWrapper.java
===================================================================
---
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceWrapper.java 2010-03-11
03:52:34 UTC (rev 13903)
+++
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceWrapper.java 2010-04-07
10:05:09 UTC (rev 13904)
@@ -45,7 +45,6 @@
{
protected T service;
protected ManageableServiceFactory parentFactory;
- private static final String TIMEOUT_MS = "3000"; //todo: expose timeout so
that it can be changed from the GUI
protected ServiceWrapper(Object service, ManageableServiceFactory parentFactory)
{
@@ -57,7 +56,7 @@
Class serviceClass = service.getClass();
// org.jboss.ws.timeout corresponds to StubExt.PROPERTY_CLIENT_TIMEOUT, not using
it here to not be tied to implementation
- ((Stub)service)._setProperty("org.jboss.ws.timeout", TIMEOUT_MS);
+ ((Stub)service)._setProperty("org.jboss.ws.timeout",
parentFactory.getWSOperationTimeOut());
Class tClass =
(Class)((ParameterizedType)getClass().getGenericSuperclass()).getActualTypeArguments()[0];
if (tClass.isAssignableFrom(serviceClass))
{
Modified:
branches/Enterprise_Portal_Platform_4_3/wsrp/src/resources/portal-wsrp-sar/dtd/jboss-wsrp-consumer_2_6.dtd
===================================================================
---
branches/Enterprise_Portal_Platform_4_3/wsrp/src/resources/portal-wsrp-sar/dtd/jboss-wsrp-consumer_2_6.dtd 2010-03-11
03:52:34 UTC (rev 13903)
+++
branches/Enterprise_Portal_Platform_4_3/wsrp/src/resources/portal-wsrp-sar/dtd/jboss-wsrp-consumer_2_6.dtd 2010-04-07
10:05:09 UTC (rev 13904)
@@ -45,6 +45,9 @@
<!-- The period of producer information (such as list of offered portlets) cache
refreshing in seconds. -->
<!ATTLIST wsrp-producer expiration-cache CDATA #IMPLIED>
+<!-- Timeout in milliseconds for WS operations (optional) -->
+<!ATTLIST wsrp-producer ws-timeout CDATA #IMPLIED>
+
<!-- WSRP endpoints configuration information by interface URL. Mutually exclusive
with endpoint-wsdl-url. -->
<!ELEMENT endpoint-config ( service-description-url, markup-url, registration-url?,
portlet-management-url? )>
Modified:
branches/Enterprise_Portal_Platform_4_3/wsrp/src/resources/portal-wsrp-sar/xsd/jboss-wsrp-consumer_2_6.xsd
===================================================================
---
branches/Enterprise_Portal_Platform_4_3/wsrp/src/resources/portal-wsrp-sar/xsd/jboss-wsrp-consumer_2_6.xsd 2010-03-11
03:52:34 UTC (rev 13903)
+++
branches/Enterprise_Portal_Platform_4_3/wsrp/src/resources/portal-wsrp-sar/xsd/jboss-wsrp-consumer_2_6.xsd 2010-04-07
10:05:09 UTC (rev 13904)
@@ -45,7 +45,8 @@
<xs:complexType name="Deployment">
<xs:annotation>
<xs:documentation>Deployment related information. As of Portal 2.6, the
only deployment information relates to
- WSRP remote producers.</xs:documentation>
+ WSRP remote producers.
+ </xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="wsrp-producer" type="wcc:WSRPProducer"
maxOccurs="1" minOccurs="1"/>
@@ -54,24 +55,27 @@
<xs:complexType name="WSRPProducer">
<xs:annotation>
- <xs:documentation>Information on a remote WSRP producer identified by the
mandatory id attribute.</xs:documentation>
+ <xs:documentation>Information on a remote WSRP producer identified by the
mandatory id attribute.
+ </xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:choice>
<xs:element name="endpoint-config"
type="wcc:EndpointConfig">
<xs:annotation>
- <xs:documentation>
- WSRP endpoints configuration information by interface URL. Mutually exclusive
with endpoint-wsdl-url.
- </xs:documentation>
- </xs:annotation>
+ <xs:documentation>
+ WSRP endpoints configuration information by interface URL. Mutually
exclusive with
+ endpoint-wsdl-url.
+ </xs:documentation>
+ </xs:annotation>
</xs:element>
<xs:element name="endpoint-wsdl-url"
type="xs:anyURI">
<xs:annotation>
- <xs:documentation>
- The URL of the WSDL description of the producer's WSRP services. Mutally
exclusive with endpoint-config.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
+ <xs:documentation>
+ The URL of the WSDL description of the producer's WSRP services.
Mutally exclusive with
+ endpoint-config.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
</xs:choice>
<xs:element name="registration-data"
type="wcc:RegistrationData" minOccurs="0">
<xs:annotation>
@@ -89,26 +93,35 @@
</xs:documentation>
</xs:annotation>
</xs:attribute>
- <xs:attribute name="expiration-cache" type="wcc:cacheValue"
use="required">
+ <xs:attribute name="expiration-cache"
type="wcc:positiveIntegerOrMinusOne" use="required">
<xs:annotation>
- <xs:documentation>The period of producer information (such as list of
offered portlets) cache refreshing in seconds.</xs:documentation>
+ <xs:documentation>The period of producer information (such as list of
offered portlets) cache refreshing in
+ seconds.
+ </xs:documentation>
</xs:annotation>
- </xs:attribute>
+ </xs:attribute>
+ <xs:attribute name="ws-timeout"
type="wcc:positiveIntegerOrMinusOne" use="optional">
+ <xs:annotation>
+ <xs:documentation>Timeout in milliseconds for WS operations
(optional).
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
- <xs:simpleType name="cacheValue" id="cacheValue">
- <xs:annotation>
- <xs:documentation>
- Type for cache information. Positive or null integer, allowing -1 as a value to
indicate that cache should not
- be used.
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:integer">
- <xs:minInclusive value="-1"/>
- </xs:restriction>
- </xs:simpleType>
+ <xs:simpleType name="positiveIntegerOrMinusOne"
id="positiveIntegerOrMinusOne">
+ <xs:annotation>
+ <xs:documentation>
+ Type for cache or timeout information. Positive or null integer, allowing -1
as a value to indicate that
+ cache should not
+ be used.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:integer">
+ <xs:minInclusive value="-1"/>
+ </xs:restriction>
+ </xs:simpleType>
- <xs:complexType name="EndpointConfig">
+ <xs:complexType name="EndpointConfig">
<xs:sequence>
<xs:element name="service-description-url"
type="xs:anyURI">
<xs:annotation>
@@ -147,7 +160,8 @@
<xs:annotation>
<xs:documentation>
An optional name (preferably unique) that identifies the Consumer. An
example of such a name would be
- the Consumer's URL. If no consumer-name is provided, one will be
automatically generated by JBoss Portal.
+ the Consumer's URL. If no consumer-name is provided, one will be
automatically generated by JBoss
+ Portal.
</xs:documentation>
</xs:annotation>
</xs:element>
@@ -190,5 +204,5 @@
</xs:annotation>
</xs:element>
</xs:sequence>
- </xs:complexType>
+ </xs:complexType>
</xs:schema>
Modified:
branches/Enterprise_Portal_Platform_4_3/wsrp/src/resources/tests/test-deployment-lib-jar/test-wsrp.xml
===================================================================
---
branches/Enterprise_Portal_Platform_4_3/wsrp/src/resources/tests/test-deployment-lib-jar/test-wsrp.xml 2010-03-11
03:52:34 UTC (rev 13903)
+++
branches/Enterprise_Portal_Platform_4_3/wsrp/src/resources/tests/test-deployment-lib-jar/test-wsrp.xml 2010-04-07
10:05:09 UTC (rev 13904)
@@ -35,7 +35,7 @@
</deployment>
<deployment>
<!-- available -->
- <wsrp-producer id="endpoint1">
+ <wsrp-producer id="endpoint1" ws-timeout="4000">
<endpoint-config>
<service-description-url>http://www.example.com</service-description-url>
<markup-url>http://www.example.com</markup-url>
@@ -56,7 +56,7 @@
<deployment>
<!-- available -->
<wsrp-producer id="producer1" expiration-cache='120'>
-
<endpoint-wsdl-url>http://wsrp.bea.com:7001/producer/producer?WSDL</endpoint-wsdl-url>
+
<
endpoint-wsdl-url>http://portalstandards.oracle.com/portletapp/portlet...
<registration-data>
<consumer-name>JBoss Portal 2.4 Test</consumer-name>
<property>