JBoss Portal SVN: r11469 - branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-07-16 16:58:03 -0400 (Wed, 16 Jul 2008)
New Revision: 11469
Modified:
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
Log:
adding support for more than just .html relative links within the rendered CMS content
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2008-07-16 15:12:33 UTC (rev 11468)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2008-07-16 20:58:03 UTC (rev 11469)
@@ -255,7 +255,11 @@
{
String relURI = m.group(3) != null ? m.group(3) : m.group(4);
URLFactory urlFactory = resourceURLFactory;
- if (relURI.endsWith(".html"))
+ if (
+ relURI.endsWith(".html") ||
+ relURI.endsWith(".htm") ||
+ relURI.endsWith(".xhtml")
+ )
{
urlFactory = textURLFactory;
}
15 years, 11 months
JBoss Portal SVN: r11468 - branches/JBoss_Portal_Branch_2_7/core-cms/src/main/org/jboss/portal/core/cms/ui.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-07-16 11:12:33 -0400 (Wed, 16 Jul 2008)
New Revision: 11468
Modified:
branches/JBoss_Portal_Branch_2_7/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
Log:
JBPORTAL-2008 - adding an image from CMS to dashboard renders image's binary representation
Modified: branches/JBoss_Portal_Branch_2_7/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2008-07-16 14:57:17 UTC (rev 11467)
+++ branches/JBoss_Portal_Branch_2_7/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2008-07-16 15:12:33 UTC (rev 11468)
@@ -231,33 +231,57 @@
resp.setContentType("text/html");
if (file != null)
{
- sHTML = file.getContent().getContentAsString();
-
- // clean html and body tags
- sHTML = this.cleanupContent(sHTML);
-
- // begin modifying links
- StringBuffer buffer = new StringBuffer();
- Matcher m = RELATIVE_URI_PATTERN.matcher(sHTML);
- while (m.find())
+ if(file.getContent().getMimeType().startsWith("image/"))
{
- String relURI = m.group(3) != null ? m.group(3) : m.group(4);
- URLFactory urlFactory = resourceURLFactory;
- if (relURI.endsWith(".html"))
+ String imageURI = path;
+ if(imageURI.startsWith("/"))
{
- urlFactory = textURLFactory;
+ imageURI = path.substring(1);
}
- String absoluteURI = urlFactory.createURL("/" + relURI);
- m.appendReplacement(buffer, "$1$2" + FileUtil.cleanDoubleSlashes(absoluteURI) + "$2");
+ String absoluteImageURI = resourceURLFactory.createURL("/" + imageURI);
+ sHTML = "<img src='"+absoluteImageURI+"'/>";
}
- m.appendTail(buffer);
- sHTML = buffer.toString();
-
- // use the content's title, if exists.
- if (file.getContent().getTitle() != null && !"".equals(file.getContent().getTitle()))
+ else if(file.getContent().getMimeType().startsWith("text/"))
{
- resp.setTitle(file.getContent().getTitle());
+ sHTML = file.getContent().getContentAsString();
+
+ // clean html and body tags
+ sHTML = this.cleanupContent(sHTML);
+
+ // begin modifying links
+ StringBuffer buffer = new StringBuffer();
+ Matcher m = RELATIVE_URI_PATTERN.matcher(sHTML);
+ while (m.find())
+ {
+ String relURI = m.group(3) != null ? m.group(3) : m.group(4);
+ URLFactory urlFactory = resourceURLFactory;
+ if (relURI.endsWith(".html"))
+ {
+ urlFactory = textURLFactory;
+ }
+ String absoluteURI = urlFactory.createURL("/" + relURI);
+ m.appendReplacement(buffer, "$1$2" + FileUtil.cleanDoubleSlashes(absoluteURI) + "$2");
+ }
+ m.appendTail(buffer);
+ sHTML = buffer.toString();
+
+ // use the content's title, if exists.
+ if (file.getContent().getTitle() != null && !"".equals(file.getContent().getTitle()))
+ {
+ resp.setTitle(file.getContent().getTitle());
+ }
}
+ else
+ {
+ //Show a link to this resource which opens up in a new window upon clicking
+ String resourceURI = path;
+ if(resourceURI.startsWith("/"))
+ {
+ resourceURI = path.substring(1);
+ }
+ String absoluteResourceURI = resourceURLFactory.createURL("/" + resourceURI);
+ sHTML = "<a href='"+absoluteResourceURI+"' target='_blank'>"+file.getContent().getTitle()+"</a>";
+ }
}
else
{
15 years, 11 months
JBoss Portal SVN: r11467 - branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-07-16 10:57:17 -0400 (Wed, 16 Jul 2008)
New Revision: 11467
Modified:
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
Log:
JBPORTAL-2008 - adding an image from CMS to dashboard renders image's binary representation
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2008-07-16 13:28:08 UTC (rev 11466)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2008-07-16 14:57:17 UTC (rev 11467)
@@ -231,33 +231,57 @@
resp.setContentType("text/html");
if (file != null)
{
- sHTML = file.getContent().getContentAsString();
-
- // clean html and body tags
- sHTML = this.cleanupContent(sHTML);
-
- // begin modifying links
- StringBuffer buffer = new StringBuffer();
- Matcher m = RELATIVE_URI_PATTERN.matcher(sHTML);
- while (m.find())
+ if(file.getContent().getMimeType().startsWith("image/"))
{
- String relURI = m.group(3) != null ? m.group(3) : m.group(4);
- URLFactory urlFactory = resourceURLFactory;
- if (relURI.endsWith(".html"))
+ String imageURI = path;
+ if(imageURI.startsWith("/"))
{
- urlFactory = textURLFactory;
+ imageURI = path.substring(1);
}
- String absoluteURI = urlFactory.createURL("/" + relURI);
- m.appendReplacement(buffer, "$1$2" + FileUtil.cleanDoubleSlashes(absoluteURI) + "$2");
+ String absoluteImageURI = resourceURLFactory.createURL("/" + imageURI);
+ sHTML = "<img src='"+absoluteImageURI+"'/>";
}
- m.appendTail(buffer);
- sHTML = buffer.toString();
-
- // use the content's title, if exists.
- if (file.getContent().getTitle() != null && !"".equals(file.getContent().getTitle()))
+ else if(file.getContent().getMimeType().startsWith("text/"))
{
- resp.setTitle(file.getContent().getTitle());
+ sHTML = file.getContent().getContentAsString();
+
+ // clean html and body tags
+ sHTML = this.cleanupContent(sHTML);
+
+ // begin modifying links
+ StringBuffer buffer = new StringBuffer();
+ Matcher m = RELATIVE_URI_PATTERN.matcher(sHTML);
+ while (m.find())
+ {
+ String relURI = m.group(3) != null ? m.group(3) : m.group(4);
+ URLFactory urlFactory = resourceURLFactory;
+ if (relURI.endsWith(".html"))
+ {
+ urlFactory = textURLFactory;
+ }
+ String absoluteURI = urlFactory.createURL("/" + relURI);
+ m.appendReplacement(buffer, "$1$2" + FileUtil.cleanDoubleSlashes(absoluteURI) + "$2");
+ }
+ m.appendTail(buffer);
+ sHTML = buffer.toString();
+
+ // use the content's title, if exists.
+ if (file.getContent().getTitle() != null && !"".equals(file.getContent().getTitle()))
+ {
+ resp.setTitle(file.getContent().getTitle());
+ }
}
+ else
+ {
+ //Show a link to this resource which opens up in a new window upon clicking
+ String resourceURI = path;
+ if(resourceURI.startsWith("/"))
+ {
+ resourceURI = path.substring(1);
+ }
+ String absoluteResourceURI = resourceURLFactory.createURL("/" + resourceURI);
+ sHTML = "<a href='"+absoluteResourceURI+"' target='_blank'>"+file.getContent().getTitle()+"</a>";
+ }
}
else
{
15 years, 11 months
JBoss Portal SVN: r11466 - modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-07-16 09:28:08 -0400 (Wed, 16 Jul 2008)
New Revision: 11466
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationRequest.java
Log:
very minor javadoc
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationRequest.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationRequest.java 2008-07-16 09:17:16 UTC (rev 11465)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationRequest.java 2008-07-16 13:28:08 UTC (rev 11466)
@@ -25,6 +25,9 @@
import org.jboss.portal.presentation.protocol.ProtocolAction;
/**
+ * Encapsulate a protocol action + more stuff related to the client like http headers (todo). That's
+ * why we have a request encapsulating an action.
+ *
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
15 years, 11 months
JBoss Portal SVN: r11465 - in branches/JBoss_Portal_Branch_2_7: core-identity and 9 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-16 05:17:16 -0400 (Wed, 16 Jul 2008)
New Revision: 11465
Modified:
branches/JBoss_Portal_Branch_2_7/core-identity/.classpath
branches/JBoss_Portal_Branch_2_7/core-search/.classpath
branches/JBoss_Portal_Branch_2_7/core/.classpath
branches/JBoss_Portal_Branch_2_7/jems/.classpath
branches/JBoss_Portal_Branch_2_7/migration/.classpath
branches/JBoss_Portal_Branch_2_7/portlet-server/.classpath
branches/JBoss_Portal_Branch_2_7/registration/.classpath
branches/JBoss_Portal_Branch_2_7/security/.classpath
branches/JBoss_Portal_Branch_2_7/server/.classpath
branches/JBoss_Portal_Branch_2_7/theme/.classpath
branches/JBoss_Portal_Branch_2_7/workflow/.classpath
Log:
Mr Hudson found Mr Eclipse as a drink buddy
Modified: branches/JBoss_Portal_Branch_2_7/core/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/.classpath 2008-07-16 09:15:27 UTC (rev 11464)
+++ branches/JBoss_Portal_Branch_2_7/core/.classpath 2008-07-16 09:17:16 UTC (rev 11465)
@@ -40,7 +40,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/workflow"/>
<classpathentry combineaccessrules="false" kind="src" path="/portlet-server"/>
<classpathentry kind="lib" path="/thirdparty/apache-xerces/lib/xml-apis.jar"/>
- <classpathentry kind="lib" path="/thirdparty/freemarker/lib/freemarker.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/common/lib/portal-common-lib.jar" sourcepath="/module-common-trunk"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/web/lib/portal-web-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/common/lib/portal-common-portal-lib.jar"/>
Modified: branches/JBoss_Portal_Branch_2_7/core-identity/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-identity/.classpath 2008-07-16 09:15:27 UTC (rev 11464)
+++ branches/JBoss_Portal_Branch_2_7/core-identity/.classpath 2008-07-16 09:17:16 UTC (rev 11465)
@@ -43,7 +43,7 @@
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/portlet/lib/portlet-api.jar"/>
<classpathentry kind="lib" path="/thirdparty/sun-jsf/lib/jsf-api.jar"/>
- <classpathentry kind="lib" path="/thirdparty/sun-jsf/lib/jsf-impl.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/sun-jsf/lib/jsf-impl.jar" sourcepath="/jsf-1.2.08"/>
<classpathentry kind="lib" path="/thirdparty/sun-jstl/lib/jstl.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbpm/jpdl/lib/jbpm-jpdl.jar"/>
<classpathentry kind="output" path="bin"/>
Modified: branches/JBoss_Portal_Branch_2_7/core-search/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-search/.classpath 2008-07-16 09:15:27 UTC (rev 11464)
+++ branches/JBoss_Portal_Branch_2_7/core-search/.classpath 2008-07-16 09:17:16 UTC (rev 11465)
@@ -15,7 +15,7 @@
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/common/lib/portal-common-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/common/lib/portal-common-portal-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-lib.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/sun-jsf/lib/jsf-api.jar"/>
<classpathentry kind="lib" path="/thirdparty/portlet/lib/portlet-api.jar"/>
- <classpathentry kind="lib" path="/thirdparty/sun-jsf/lib/jsf-api.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: branches/JBoss_Portal_Branch_2_7/jems/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/jems/.classpath 2008-07-16 09:15:27 UTC (rev 11464)
+++ branches/JBoss_Portal_Branch_2_7/jems/.classpath 2008-07-16 09:17:16 UTC (rev 11465)
@@ -5,7 +5,6 @@
<classpathentry kind="lib" path="/thirdparty/apache-log4j/lib/log4j.jar"/>
<classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
<classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/jsp-api.jar"/>
- <classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
<classpathentry kind="lib" path="/thirdparty/sun-jaf/lib/activation.jar"/>
<classpathentry kind="lib" path="/thirdparty/dom4j/lib/dom4j.jar"/>
<classpathentry kind="lib" path="/thirdparty/apache-httpclient/lib/commons-httpclient.jar"/>
@@ -24,5 +23,6 @@
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-system.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jmx-invoker-adaptor-client.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/common/lib/portal-common-lib.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: branches/JBoss_Portal_Branch_2_7/migration/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/migration/.classpath 2008-07-16 09:15:27 UTC (rev 11464)
+++ branches/JBoss_Portal_Branch_2_7/migration/.classpath 2008-07-16 09:17:16 UTC (rev 11465)
@@ -9,5 +9,6 @@
<classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-common.jar"/>
<classpathentry kind="lib" path="/thirdparty/sun-jsf/lib/jsf-api.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: branches/JBoss_Portal_Branch_2_7/portlet-server/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/.classpath 2008-07-16 09:15:27 UTC (rev 11464)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/.classpath 2008-07-16 09:17:16 UTC (rev 11465)
@@ -16,9 +16,9 @@
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/common/lib/portal-common-portal-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-lib.jar"/>
- <classpathentry kind="lib" path="/thirdparty/portlet/lib/portlet-api.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-federation-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/web/lib/portal-web-lib.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/jems"/>
+ <classpathentry kind="lib" path="/thirdparty/portlet/lib/portlet-api.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: branches/JBoss_Portal_Branch_2_7/registration/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/registration/.classpath 2008-07-16 09:15:27 UTC (rev 11464)
+++ branches/JBoss_Portal_Branch_2_7/registration/.classpath 2008-07-16 09:17:16 UTC (rev 11465)
@@ -7,7 +7,7 @@
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-common.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-system.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-jmx.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/common/lib/portal-common-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/common/lib/portal-common-lib.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: branches/JBoss_Portal_Branch_2_7/security/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/security/.classpath 2008-07-16 09:15:27 UTC (rev 11464)
+++ branches/JBoss_Portal_Branch_2_7/security/.classpath 2008-07-16 09:17:16 UTC (rev 11465)
@@ -14,8 +14,8 @@
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jbosssx.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-system.jar"/>
<classpathentry kind="lib" path="/thirdparty/jgroups/lib/jgroups.jar"/>
- <classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/jems"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/common/lib/portal-common-lib.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
<classpathentry kind="output" path="output/classes"/>
</classpath>
Modified: branches/JBoss_Portal_Branch_2_7/server/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/server/.classpath 2008-07-16 09:15:27 UTC (rev 11464)
+++ branches/JBoss_Portal_Branch_2_7/server/.classpath 2008-07-16 09:17:16 UTC (rev 11465)
@@ -2,7 +2,6 @@
<classpath>
<classpathentry kind="src" path="src/main"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
<classpathentry kind="lib" path="/thirdparty/apache-httpclient/lib/commons-httpclient.jar"/>
<classpathentry kind="lib" path="/thirdparty/apache-log4j/lib/log4j.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss.jar"/>
@@ -15,5 +14,6 @@
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/web/lib/portal-web-lib.jar" sourcepath="/module-web"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/test/lib/portal-test-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/test/lib/portal-test-jboss-lib.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: branches/JBoss_Portal_Branch_2_7/theme/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/theme/.classpath 2008-07-16 09:15:27 UTC (rev 11464)
+++ branches/JBoss_Portal_Branch_2_7/theme/.classpath 2008-07-16 09:17:16 UTC (rev 11465)
@@ -2,7 +2,6 @@
<classpath>
<classpathentry kind="src" path="src/main"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
<classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/jsp-api.jar"/>
<classpathentry kind="lib" path="/thirdparty/oswego-concurrent/lib/concurrent.jar"/>
<classpathentry kind="lib" path="/thirdparty/apache-log4j/lib/log4j.jar"/>
@@ -19,5 +18,6 @@
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/web/lib/portal-web-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/common/lib/portal-common-portal-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/test/lib/portal-test-lib.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
<classpathentry kind="output" path="output/classes"/>
</classpath>
Modified: branches/JBoss_Portal_Branch_2_7/workflow/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/workflow/.classpath 2008-07-16 09:15:27 UTC (rev 11464)
+++ branches/JBoss_Portal_Branch_2_7/workflow/.classpath 2008-07-16 09:17:16 UTC (rev 11465)
@@ -8,10 +8,10 @@
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-system.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-jmx.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-common.jar"/>
- <classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
<classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/common/lib/portal-common-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/identity/lib/portal-identity-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbpm/jpdl/lib/jbpm-jpdl.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
15 years, 11 months
JBoss Portal SVN: r11464 - branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/hibernate/instance.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-16 05:15:27 -0400 (Wed, 16 Jul 2008)
New Revision: 11464
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/hibernate/instance/domain.hbm.xml
Log:
50000000 is too much for Sybase.
Max size of Sybase should be enough (16384).
Changing that value on existing data seems fine
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/hibernate/instance/domain.hbm.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/hibernate/instance/domain.hbm.xml 2008-07-16 09:13:33 UTC (rev 11463)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/hibernate/instance/domain.hbm.xml 2008-07-16 09:15:27 UTC (rev 11464)
@@ -60,7 +60,7 @@
column="SER_STATE"
not-null="false"
unique="false"
- length="50000000"/>
+ length="16384"/>
<map
name="relatedSecurityBindings"
sort="unsorted"
@@ -117,7 +117,7 @@
column="SER_STATE"
not-null="false"
unique="false"
- length="50000000"/>
+ length="16384"/>
<properties
name="user_and_portlet_ref"
unique="true">
15 years, 11 months
JBoss Portal SVN: r11463 - branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-16 05:13:33 -0400 (Wed, 16 Jul 2008)
New Revision: 11463
Removed:
branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/DialectFactory.java
Modified:
branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java
Log:
Removed Dialect factory which was used for auto-discovery of dialect in Hibernate 3.0 (it was forked from 3.1)
Now Sybase should be automatically discovered and the proper dialect should be used
Deleted: branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/DialectFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/DialectFactory.java 2008-07-16 09:09:07 UTC (rev 11462)
+++ branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/DialectFactory.java 2008-07-16 09:13:33 UTC (rev 11463)
@@ -1,119 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.jems.hibernate;
-
-import org.hibernate.HibernateException;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Ripped off hibernate 3.1 that is not in 3.0. A factory for generating Dialect instances.
- *
- * @author Steve Ebersole
- * @version $Revision$
- */
-public class DialectFactory
-{
-
-
- private DialectFactory()
- {
- }
-
- /**
- * Determine the appropriate Dialect to use given the database product name and major version.
- *
- * @param databaseName The name of the database product (obtained from metadata).
- * @param databaseMajorVersion The major version of the database product (obtained from metadata).
- * @return An appropriate dialect instance.
- */
- public static String determineDialect(String databaseName, int databaseMajorVersion)
- {
- if (databaseName == null)
- {
- throw new HibernateException("Hibernate Dialect must be explicitly set");
- }
-
- DatabaseDialectMapper mapper = (DatabaseDialectMapper)MAPPERS.get(databaseName);
- if (mapper == null)
- {
- throw new HibernateException("Hibernate Dialect must be explicitly set for database: " + databaseName);
- }
-
- return mapper.getDialectClass(databaseMajorVersion);
- }
-
- /**
- * For a given database product name, instances of DatabaseDialectMapper know which Dialect to use for different
- * versions.
- */
- public static interface DatabaseDialectMapper
- {
- public String getDialectClass(int majorVersion);
- }
-
- /** A simple DatabaseDialectMapper for dialects which are independent of the underlying database product version. */
- public static class VersionInsensitiveMapper implements DatabaseDialectMapper
- {
- private String dialectClassName;
-
- public VersionInsensitiveMapper(String dialectClassName)
- {
- this.dialectClassName = dialectClassName;
- }
-
- public String getDialectClass(int majorVersion)
- {
- return dialectClassName;
- }
- }
-
- private static final Map MAPPERS = new HashMap();
-
- static
- {
- // TODO : this is the stuff it'd be nice to move to a properties file or some other easily user-editable place
- MAPPERS.put("HSQL Database Engine", new VersionInsensitiveMapper("org.hibernate.dialect.HSQLDialect"));
- MAPPERS.put("DB2/NT", new VersionInsensitiveMapper("org.hibernate.dialect.DB2Dialect"));
- MAPPERS.put("MySQL", new VersionInsensitiveMapper("org.hibernate.dialect.MySQLDialect"));
- MAPPERS.put("PostgreSQL", new VersionInsensitiveMapper("org.hibernate.dialect.PostgreSQLDialect"));
- MAPPERS.put("Microsoft SQL Server Database", new VersionInsensitiveMapper("org.hibernate.dialect.SQLServerDialect"));
- MAPPERS.put("Microsoft SQL Server", new VersionInsensitiveMapper("org.hibernate.dialect.SQLServerDialect"));
- MAPPERS.put("Sybase SQL Server", new VersionInsensitiveMapper("org.hibernate.dialect.SybaseDialect"));
- MAPPERS.put("Informix Dynamic Server", new VersionInsensitiveMapper("org.hibernate.dialect.InformixDialect"));
-
- MAPPERS.put(
- "Oracle",
- new DatabaseDialectMapper()
- {
- public String getDialectClass(int majorVersion)
- {
- return majorVersion > 8
- ? "org.hibernate.dialect.Oracle9Dialect"
- : "org.hibernate.dialect.OracleDialect";
- }
- }
- );
- }
-}
Modified: branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java 2008-07-16 09:09:07 UTC (rev 11462)
+++ branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java 2008-07-16 09:13:33 UTC (rev 11463)
@@ -22,13 +22,16 @@
******************************************************************************/
package org.jboss.portal.jems.hibernate;
-import bsh.EvalError;
-import bsh.Interpreter;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.sql.DatabaseMetaData;
+import java.util.Collection;
+import java.util.Iterator;
+
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
-import org.hibernate.cfg.Environment;
import org.hibernate.exception.SQLGrammarException;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.tool.hbm2ddl.SchemaExport;
@@ -39,14 +42,8 @@
import org.jboss.portal.common.util.LoaderResource;
import org.jboss.portal.jems.as.system.AbstractJBossService;
-import javax.naming.InitialContext;
-import javax.sql.DataSource;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.util.Collection;
-import java.util.Iterator;
+import bsh.EvalError;
+import bsh.Interpreter;
/**
* Configures and binds the hibernate session factory.
@@ -216,31 +213,6 @@
/** During this step the session factory is created and the content creation is triggered. */
protected void startService() throws Exception
{
- // Detect the dialect if necessary
- dialectName = config.getProperty(Environment.DIALECT);
- if (dialectName == null)
- {
- String dataSourceJNDI = config.getProperty(Environment.DATASOURCE);
- log.debug("Detecting dialect with datasource " + dataSourceJNDI + " ...");
- DataSource ds = (DataSource)new InitialContext().lookup(dataSourceJNDI);
- Connection conn = null;
- try
- {
- conn = ds.getConnection();
- DatabaseMetaData meta = conn.getMetaData();
- String databaseName = meta.getDatabaseProductName();
- int databaseMajorVersion = getDatabaseMajorVersion(meta);
- dialectName = DialectFactory.determineDialect(databaseName, databaseMajorVersion);
- config.setProperty(Environment.DIALECT, dialectName);
- log.debug("Detected dialect " + dialectName + ", database is (" + databaseName + "," + databaseMajorVersion + ")");
- }
- finally
- {
- IOTools.safeClose(conn);
- }
- }
- log.debug("Using dialect " + dialectName);
-
//
createSessionFactory();
15 years, 11 months
JBoss Portal SVN: r11462 - branches/JBoss_Portal_Branch_2_7/wsrp.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-16 05:09:07 -0400 (Wed, 16 Jul 2008)
New Revision: 11462
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/build.xml
Log:
aopc complaining about missing class from the common module
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/build.xml 2008-07-15 23:56:13 UTC (rev 11461)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/build.xml 2008-07-16 09:09:07 UTC (rev 11462)
@@ -256,6 +256,7 @@
<pathelement path="${build.classes}"/>
<path refid="hibernate.hibernate.classpath"/>
<path refid="jboss.portal/modules/portlet.classpath"/>
+ <path refid="jboss.portal/modules/common.classpath"/>
</path>
<aopc compilerclasspathref="aop.classpath" verbose="true">
15 years, 11 months
JBoss Portal SVN: r11461 - in branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal: test/wsrp/v1/producer and 2 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-07-15 19:56:13 -0400 (Tue, 15 Jul 2008)
New Revision: 11461
Added:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/MarkupServiceWrapper.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/PortletManagementServiceWrapper.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/RegistrationServiceWrapper.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceDescriptionServiceWrapper.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceWrapper.java
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BehaviorBackedServiceFactory.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractJNDIServiceFactory.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractSOAPServiceFactory.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/CachingServiceFactory.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceFactory.java
Log:
- JBPORTAL-1726:
+ Added wrapper around WSRP endpoints to be able to fail service factory when a non-business error happens.
+ Should investigate implementing using AOP instead.
+ Needs more testing.
- Minor improvements.
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BehaviorBackedServiceFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BehaviorBackedServiceFactory.java 2008-07-15 23:42:02 UTC (rev 11460)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BehaviorBackedServiceFactory.java 2008-07-15 23:56:13 UTC (rev 11461)
@@ -48,6 +48,7 @@
import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
import org.jboss.portal.wsrp.services.ServiceFactory;
+import java.rmi.Remote;
import java.rmi.RemoteException;
/**
@@ -72,23 +73,23 @@
registry.registerMarkupBehavior(new SimpleMarkupBehavior());
}
- public Object getService(Class clazz) throws Exception
+ public <T extends Remote> T getService(Class<T> serviceClass) throws Exception
{
- if (WSRP_v1_ServiceDescription_PortType.class.isAssignableFrom(clazz))
+ if (WSRP_v1_ServiceDescription_PortType.class.isAssignableFrom(serviceClass))
{
- return registry.getServiceDescriptionBehavior();
+ return (T)registry.getServiceDescriptionBehavior();
}
- if (WSRP_v1_Markup_PortType.class.isAssignableFrom(clazz))
+ if (WSRP_v1_Markup_PortType.class.isAssignableFrom(serviceClass))
{
- return registry.getMarkupBehaviorFor(MARKUP);
+ return (T)registry.getMarkupBehaviorFor(MARKUP);
}
- if (WSRP_v1_PortletManagement_PortType.class.isAssignableFrom(clazz))
+ if (WSRP_v1_PortletManagement_PortType.class.isAssignableFrom(serviceClass))
{
- return registry.getPortletManagementBehavior();
+ return (T)registry.getPortletManagementBehavior();
}
- if (WSRP_v1_Registration_PortType.class.isAssignableFrom(clazz))
+ if (WSRP_v1_Registration_PortType.class.isAssignableFrom(serviceClass))
{
- return registry.getRegistrationBehavior();
+ return (T)registry.getRegistrationBehavior();
}
return null;
}
@@ -118,6 +119,11 @@
return false;
}
+ public void setFailed(boolean failed)
+ {
+ // do nothing
+ }
+
public String getServiceDescriptionURL()
{
return SD_URL;
@@ -187,10 +193,10 @@
}
protected String getMarkupString(Mode mode, WindowState windowState, String navigationalState, GetMarkup getMarkup)
- throws UnsupportedWindowStateFault, InvalidCookieFault, InvalidSessionFault, AccessDeniedFault,
- InconsistentParametersFault, InvalidHandleFault, UnsupportedLocaleFault, UnsupportedModeFault,
- OperationFailedFault, MissingParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault,
- UnsupportedMimeTypeFault, RemoteException
+ throws UnsupportedWindowStateFault, InvalidCookieFault, InvalidSessionFault, AccessDeniedFault,
+ InconsistentParametersFault, InvalidHandleFault, UnsupportedLocaleFault, UnsupportedModeFault,
+ OperationFailedFault, MissingParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault,
+ UnsupportedMimeTypeFault, RemoteException
{
return MARKUP;
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2008-07-15 23:42:02 UTC (rev 11460)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2008-07-15 23:56:13 UTC (rev 11461)
@@ -24,7 +24,6 @@
package org.jboss.portal.test.wsrp.v1.producer;
import org.jboss.portal.common.junit.ExtendedAssert;
-import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.registration.RegistrationException;
import org.jboss.portal.registration.RegistrationManager;
import org.jboss.portal.registration.policies.DefaultRegistrationPolicy;
@@ -65,14 +64,12 @@
protected WSRP_v1_PortletManagement_PortType portletManagementService;
private static final String CONSUMER = "test-consumer";
- public V1ProducerBaseTest()
- throws Exception
+ public V1ProducerBaseTest() throws Exception
{
this("V1ProducerBaseTest");
}
- protected V1ProducerBaseTest(String name)
- throws Exception
+ protected V1ProducerBaseTest(String name) throws Exception
{
super(name);
}
@@ -82,19 +79,14 @@
{
super.setUp();
- serviceDescriptionService = getService(WSRP_v1_ServiceDescription_PortType.class);
- markupService = getService(WSRP_v1_Markup_PortType.class);
- registrationService = getService(WSRP_v1_Registration_PortType.class);
- portletManagementService = getService(WSRP_v1_PortletManagement_PortType.class);
+ serviceDescriptionService = getServiceFactory().getService(WSRP_v1_ServiceDescription_PortType.class);
+ markupService = getServiceFactory().getService(WSRP_v1_Markup_PortType.class);
+ registrationService = getServiceFactory().getService(WSRP_v1_Registration_PortType.class);
+ portletManagementService = getServiceFactory().getService(WSRP_v1_PortletManagement_PortType.class);
resetRegistrationInfo();
}
- private <T> T getService(Class<T> serviceClass) throws Exception
- {
- return (T)getServiceFactory().getService(serviceClass);
- }
-
public void tearDown() throws Exception
{
producer.getProducerRegistrationRequirements().clearRegistrationProperties();
@@ -126,13 +118,13 @@
MarkupType[] markupTypes = desc.getMarkupTypes();
ExtendedAssert.assertEquals(1, markupTypes.length);
MarkupType markupType = markupTypes[0];
- assertEquals(new MarkupType(MediaType.TEXT_HTML.getValue(), new String[]{WSRPConstants.VIEW_MODE},
- new String[]{WSRPConstants.NORMAL_WINDOW_STATE, WSRPConstants.MAXIMIZED_WINDOW_STATE, WSRPConstants.MINIMIZED_WINDOW_STATE},
- new String[]{"en"}, null), markupType);
+ assertEquals(new MarkupType("text/html", new String[]{WSRPConstants.VIEW_MODE},
+ new String[]{WSRPConstants.NORMAL_WINDOW_STATE, WSRPConstants.MAXIMIZED_WINDOW_STATE, WSRPConstants.MINIMIZED_WINDOW_STATE},
+ new String[]{"en"}, null), markupType);
}
protected ServiceDescription checkServiceDescriptionWithOnlyBasicPortlet(GetServiceDescription gs)
- throws Exception
+ throws Exception
{
deploy("test-basic-portlet.war");
//Invoke the Web Service
@@ -143,9 +135,9 @@
// Check offered portlets
PortletDescription[] offeredPortlets = sd.getOfferedPortlets();
ExtendedAssert.assertNotNull(offeredPortlets);
- for (int i = 0; i < offeredPortlets.length; i++)
+ for (PortletDescription offeredPortlet : offeredPortlets)
{
- System.out.println("handle " + offeredPortlets[i].getPortletHandle());
+ System.out.println("handle " + offeredPortlet.getPortletHandle());
}
ExtendedAssert.assertEquals(1, offeredPortlets.length);
@@ -159,7 +151,7 @@
}
protected RegistrationContext registerConsumer()
- throws org.jboss.portal.wsrp.core.MissingParametersFault, org.jboss.portal.wsrp.core.OperationFailedFault, java.rmi.RemoteException
+ throws org.jboss.portal.wsrp.core.MissingParametersFault, org.jboss.portal.wsrp.core.OperationFailedFault, java.rmi.RemoteException
{
RegistrationData registrationData = createBaseRegData();
return registrationService.register(registrationData);
@@ -183,7 +175,7 @@
{
// fix-me: http://jira.jboss.com/jira/browse/JBPORTAL-821
RegistrationPropertyDescription regProp = new RegistrationPropertyDescription("regProp",
- new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
+ new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
regProp.setDefaultLabel("Registration Property");
producer.getProducerRegistrationRequirements().addRegistrationProperty(regProp);
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java 2008-07-15 23:42:02 UTC (rev 11460)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java 2008-07-15 23:56:13 UTC (rev 11461)
@@ -34,6 +34,7 @@
import org.jboss.portal.wsrp.services.RemoteSOAPInvokerServiceFactory;
import org.jboss.portal.wsrp.services.ServiceFactory;
+import java.rmi.Remote;
import java.util.BitSet;
/**
@@ -363,38 +364,38 @@
// todo: public for tests
public WSRP_v1_ServiceDescription_PortType getServiceDescriptionService() throws InvokerUnavailableException
{
- return (WSRP_v1_ServiceDescription_PortType)getService(SERVICE_DESCRIPTION, WSRP_v1_ServiceDescription_PortType.class);
+ return getService(WSRP_v1_ServiceDescription_PortType.class);
}
// todo: public for tests
public WSRP_v1_Markup_PortType getMarkupService() throws InvokerUnavailableException
{
- return (WSRP_v1_Markup_PortType)getService(MARKUP, WSRP_v1_Markup_PortType.class);
+ return getService(WSRP_v1_Markup_PortType.class);
}
// todo: public for tests
public WSRP_v1_PortletManagement_PortType getPortletManagementService() throws InvokerUnavailableException
{
- return (WSRP_v1_PortletManagement_PortType)getService(PORTLET_MANAGEMENT, WSRP_v1_PortletManagement_PortType.class);
+ return getService(WSRP_v1_PortletManagement_PortType.class);
}
// todo: public for tests
public WSRP_v1_Registration_PortType getRegistrationService() throws InvokerUnavailableException
{
- return (WSRP_v1_Registration_PortType)getService(REGISTRATION, WSRP_v1_Registration_PortType.class);
+ return getService(WSRP_v1_Registration_PortType.class);
}
- private Object getService(String description, Class clazz) throws InvokerUnavailableException
+ private <T extends Remote> T getService(Class<T> clazz) throws InvokerUnavailableException
{
try
{
- Object service = getServiceFactory().getService(clazz);
+ T service = getServiceFactory().getService(clazz);
clean.set(getIndexFor(clazz));
return service;
}
catch (Exception e)
{
- throw new InvokerUnavailableException("Couldn't access " + description + " service. Cause: "
+ throw new InvokerUnavailableException("Couldn't access " + clazz.getSimpleName() + " service. Cause: "
+ e.getLocalizedMessage(), e);
}
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractJNDIServiceFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractJNDIServiceFactory.java 2008-07-15 23:42:02 UTC (rev 11460)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractJNDIServiceFactory.java 2008-07-15 23:56:13 UTC (rev 11461)
@@ -27,6 +27,8 @@
import org.jboss.portal.jems.as.system.AbstractJBossService;
import javax.naming.InitialContext;
+import javax.xml.rpc.Service;
+import java.rmi.Remote;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
@@ -60,17 +62,17 @@
// fix-me: this is hardcoded from values from portal-wsrp-client.jar/META-INF/jboss-client.xml... NOT GOOD!
DEFAULT_FACTORY_MAPPING = new Properties();
DEFAULT_FACTORY_MAPPING.setProperty(
- "org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType",
- "wsrp-client/service/ServiceDescriptionService");
+ "org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType",
+ "wsrp-client/service/ServiceDescriptionService");
DEFAULT_FACTORY_MAPPING.setProperty(
- "org.jboss.portal.wsrp.core.WSRP_v1_Markup_PortType",
- "wsrp-client/service/MarkupService");
+ "org.jboss.portal.wsrp.core.WSRP_v1_Markup_PortType",
+ "wsrp-client/service/MarkupService");
DEFAULT_FACTORY_MAPPING.setProperty(
- "org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType",
- "wsrp-client/service/RegistrationService");
+ "org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType",
+ "wsrp-client/service/RegistrationService");
DEFAULT_FACTORY_MAPPING.setProperty(
- "org.jboss.portal.wsrp.core.WSRP_v1_PortletManagement_PortType",
- "wsrp-client/service/PortletManagementService");
+ "org.jboss.portal.wsrp.core.WSRP_v1_PortletManagement_PortType",
+ "wsrp-client/service/PortletManagementService");
}
/** A Map recording the mapping between WSRP port type class name and JDNI name of the implementing service. */
@@ -102,7 +104,7 @@
this.env = env;
}
- public Object getService(Class serviceClass) throws Exception
+ protected <T extends Remote> Service getServiceFor(Class<T> serviceClass) throws Exception
{
if (serviceClass == null)
{
@@ -149,7 +151,7 @@
}
//
- return service;
+ return (Service)service;
}
finally
{
@@ -162,6 +164,11 @@
return failed;
}
+ public void setFailed(boolean failed)
+ {
+ this.failed = failed;
+ }
+
public Properties getPortJNDIMapping()
{
return portJNDIMapping;
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractSOAPServiceFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractSOAPServiceFactory.java 2008-07-15 23:42:02 UTC (rev 11460)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractSOAPServiceFactory.java 2008-07-15 23:56:13 UTC (rev 11461)
@@ -25,10 +25,11 @@
import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
import javax.xml.rpc.Service;
+import java.rmi.Remote;
import java.util.Map;
/**
- * Perform common logic to soap based service factories. This one cache the service retrieved from the JNDI lookup.
+ * Perform common logic to soap based service factories. This one caches the service retrieved from the JNDI lookup.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -37,7 +38,7 @@
{
/** Cache the services. */
- private Map services = new ConcurrentReaderHashMap();
+ private Map<String, Service> services = new ConcurrentReaderHashMap();
protected void createService() throws Exception
{
@@ -62,7 +63,7 @@
*/
protected abstract Object getStubFromService(Class serviceClass, Service service) throws Exception;
- public Object getService(Class serviceClass) throws Exception
+ public <T extends Remote> T getService(Class<T> serviceClass) throws Exception
{
if (serviceClass == null)
{
@@ -73,10 +74,10 @@
String key = serviceClass.getName();
// Get the cached service, it's ok because they are thread safe
- Service service = (Service)services.get(key);
+ Service service = services.get(key);
if (service == null)
{
- service = (Service)super.getService(serviceClass);
+ service = super.getServiceFor(serviceClass);
//
if (service != null)
@@ -89,7 +90,7 @@
// and must be customized for every request to this method.
if (service != null)
{
- return getStubFromService(serviceClass, service);
+ return ServiceWrapper.getServiceWrapper(serviceClass, getStubFromService(serviceClass, service), this);
}
else
{
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/CachingServiceFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/CachingServiceFactory.java 2008-07-15 23:42:02 UTC (rev 11460)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/CachingServiceFactory.java 2008-07-15 23:56:13 UTC (rev 11461)
@@ -25,6 +25,7 @@
import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
import org.jboss.portal.jems.as.system.AbstractJBossService;
+import java.rmi.Remote;
import java.util.Map;
/**
@@ -38,12 +39,12 @@
{
/** . */
- private static final Map cache = new ConcurrentReaderHashMap();
+ private static final Map<String, Remote> cache = new ConcurrentReaderHashMap();
/** . */
private ServiceFactory delegate;
- public Object getService(Class clazz) throws Exception
+ public <T extends Remote> T getService(Class<T> clazz) throws Exception
{
if (delegate == null)
{
@@ -55,7 +56,7 @@
}
//
- Object service = cache.get(clazz.getName());
+ Remote service = cache.get(clazz.getName());
if (service == null)
{
service = delegate.getService(clazz);
@@ -64,7 +65,7 @@
cache.put(clazz.getName(), service);
}
}
- return service;
+ return (T)service;
}
public ServiceFactory getDelegate()
@@ -88,6 +89,14 @@
return delegate == null || delegate.isFailed();
}
+ public void setFailed(boolean failed)
+ {
+ if (delegate != null)
+ {
+ delegate.setFailed(failed);
+ }
+ }
+
public String getServiceDescriptionURL()
{
if (delegate != null)
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/MarkupServiceWrapper.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/MarkupServiceWrapper.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/MarkupServiceWrapper.java 2008-07-15 23:56:13 UTC (rev 11461)
@@ -0,0 +1,112 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.wsrp.services;
+
+import org.jboss.portal.wsrp.core.AccessDeniedFault;
+import org.jboss.portal.wsrp.core.BlockingInteractionResponse;
+import org.jboss.portal.wsrp.core.GetMarkup;
+import org.jboss.portal.wsrp.core.InconsistentParametersFault;
+import org.jboss.portal.wsrp.core.InitCookie;
+import org.jboss.portal.wsrp.core.InvalidCookieFault;
+import org.jboss.portal.wsrp.core.InvalidHandleFault;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.InvalidSessionFault;
+import org.jboss.portal.wsrp.core.InvalidUserCategoryFault;
+import org.jboss.portal.wsrp.core.MarkupResponse;
+import org.jboss.portal.wsrp.core.MissingParametersFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.PerformBlockingInteraction;
+import org.jboss.portal.wsrp.core.PortletStateChangeRequiredFault;
+import org.jboss.portal.wsrp.core.ReleaseSessions;
+import org.jboss.portal.wsrp.core.ReturnAny;
+import org.jboss.portal.wsrp.core.UnsupportedLocaleFault;
+import org.jboss.portal.wsrp.core.UnsupportedMimeTypeFault;
+import org.jboss.portal.wsrp.core.UnsupportedModeFault;
+import org.jboss.portal.wsrp.core.UnsupportedWindowStateFault;
+import org.jboss.portal.wsrp.core.WSRP_v1_Markup_PortType;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class MarkupServiceWrapper extends ServiceWrapper<WSRP_v1_Markup_PortType> implements WSRP_v1_Markup_PortType
+{
+ public MarkupServiceWrapper(Object service, ServiceFactory parentFactory)
+ {
+ super(service, parentFactory);
+ }
+
+ public MarkupResponse getMarkup(GetMarkup getMarkup) throws UnsupportedWindowStateFault, InvalidCookieFault, InvalidSessionFault, AccessDeniedFault, InconsistentParametersFault, InvalidHandleFault, UnsupportedLocaleFault, UnsupportedModeFault, OperationFailedFault, MissingParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault, UnsupportedMimeTypeFault, RemoteException
+ {
+ try
+ {
+ return service.getMarkup(getMarkup);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public BlockingInteractionResponse performBlockingInteraction(PerformBlockingInteraction performBlockingInteraction) throws InvalidSessionFault, UnsupportedModeFault, UnsupportedMimeTypeFault, OperationFailedFault, UnsupportedWindowStateFault, UnsupportedLocaleFault, AccessDeniedFault, PortletStateChangeRequiredFault, InvalidRegistrationFault, MissingParametersFault, InvalidUserCategoryFault, InconsistentParametersFault, InvalidHandleFault, InvalidCookieFault, RemoteException
+ {
+ try
+ {
+ return service.performBlockingInteraction(performBlockingInteraction);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public ReturnAny releaseSessions(ReleaseSessions releaseSessions) throws InvalidRegistrationFault, OperationFailedFault, MissingParametersFault, AccessDeniedFault, RemoteException
+ {
+ try
+ {
+ return service.releaseSessions(releaseSessions);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public ReturnAny initCookie(InitCookie initCookie) throws AccessDeniedFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ try
+ {
+ return service.initCookie(initCookie);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+}
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/PortletManagementServiceWrapper.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/PortletManagementServiceWrapper.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/PortletManagementServiceWrapper.java 2008-07-15 23:56:13 UTC (rev 11461)
@@ -0,0 +1,135 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.wsrp.services;
+
+import org.jboss.portal.wsrp.core.AccessDeniedFault;
+import org.jboss.portal.wsrp.core.ClonePortlet;
+import org.jboss.portal.wsrp.core.DestroyPortlets;
+import org.jboss.portal.wsrp.core.DestroyPortletsResponse;
+import org.jboss.portal.wsrp.core.GetPortletDescription;
+import org.jboss.portal.wsrp.core.GetPortletProperties;
+import org.jboss.portal.wsrp.core.GetPortletPropertyDescription;
+import org.jboss.portal.wsrp.core.InconsistentParametersFault;
+import org.jboss.portal.wsrp.core.InvalidHandleFault;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.InvalidUserCategoryFault;
+import org.jboss.portal.wsrp.core.MissingParametersFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.PortletContext;
+import org.jboss.portal.wsrp.core.PortletDescriptionResponse;
+import org.jboss.portal.wsrp.core.PortletPropertyDescriptionResponse;
+import org.jboss.portal.wsrp.core.PropertyList;
+import org.jboss.portal.wsrp.core.SetPortletProperties;
+import org.jboss.portal.wsrp.core.WSRP_v1_PortletManagement_PortType;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class PortletManagementServiceWrapper extends ServiceWrapper<WSRP_v1_PortletManagement_PortType> implements WSRP_v1_PortletManagement_PortType
+{
+ public PortletManagementServiceWrapper(Object service, ServiceFactory parentFactory)
+ {
+ super(service, parentFactory);
+ }
+
+ public PortletDescriptionResponse getPortletDescription(GetPortletDescription getPortletDescription) throws AccessDeniedFault, InvalidHandleFault, InvalidUserCategoryFault, InconsistentParametersFault, MissingParametersFault, InvalidRegistrationFault, OperationFailedFault, RemoteException
+ {
+ try
+ {
+ return service.getPortletDescription(getPortletDescription);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public PortletContext clonePortlet(ClonePortlet clonePortlet) throws InvalidUserCategoryFault, AccessDeniedFault, OperationFailedFault, InvalidHandleFault, InvalidRegistrationFault, InconsistentParametersFault, MissingParametersFault, RemoteException
+ {
+ try
+ {
+ return service.clonePortlet(clonePortlet);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public DestroyPortletsResponse destroyPortlets(DestroyPortlets destroyPortlets) throws InconsistentParametersFault, MissingParametersFault, InvalidRegistrationFault, OperationFailedFault, RemoteException
+ {
+ try
+ {
+ return service.destroyPortlets(destroyPortlets);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public PortletContext setPortletProperties(SetPortletProperties setPortletProperties) throws OperationFailedFault, InvalidHandleFault, MissingParametersFault, InconsistentParametersFault, InvalidUserCategoryFault, AccessDeniedFault, InvalidRegistrationFault, RemoteException
+ {
+ try
+ {
+ return service.setPortletProperties(setPortletProperties);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public PropertyList getPortletProperties(GetPortletProperties getPortletProperties) throws InvalidHandleFault, MissingParametersFault, InvalidRegistrationFault, AccessDeniedFault, OperationFailedFault, InconsistentParametersFault, InvalidUserCategoryFault, RemoteException
+ {
+ try
+ {
+ return service.getPortletProperties(getPortletProperties);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public PortletPropertyDescriptionResponse getPortletPropertyDescription(GetPortletPropertyDescription getPortletPropertyDescription) throws MissingParametersFault, InconsistentParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault, AccessDeniedFault, InvalidHandleFault, OperationFailedFault, RemoteException
+ {
+ try
+ {
+ return service.getPortletPropertyDescription(getPortletPropertyDescription);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+}
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/RegistrationServiceWrapper.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/RegistrationServiceWrapper.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/RegistrationServiceWrapper.java 2008-07-15 23:56:13 UTC (rev 11461)
@@ -0,0 +1,86 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.wsrp.services;
+
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.MissingParametersFault;
+import org.jboss.portal.wsrp.core.ModifyRegistration;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.RegistrationContext;
+import org.jboss.portal.wsrp.core.RegistrationData;
+import org.jboss.portal.wsrp.core.RegistrationState;
+import org.jboss.portal.wsrp.core.ReturnAny;
+import org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class RegistrationServiceWrapper extends ServiceWrapper<WSRP_v1_Registration_PortType> implements WSRP_v1_Registration_PortType
+{
+ public RegistrationServiceWrapper(Object service, ServiceFactory parentFactory)
+ {
+ super(service, parentFactory);
+ }
+
+ public RegistrationContext register(RegistrationData register) throws MissingParametersFault, OperationFailedFault, RemoteException
+ {
+ try
+ {
+ return service.register(register);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public ReturnAny deregister(RegistrationContext deregister) throws OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ try
+ {
+ return service.deregister(deregister);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public RegistrationState modifyRegistration(ModifyRegistration modifyRegistration) throws MissingParametersFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ try
+ {
+ return service.modifyRegistration(modifyRegistration);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java 2008-07-15 23:42:02 UTC (rev 11460)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java 2008-07-15 23:56:13 UTC (rev 11461)
@@ -64,7 +64,6 @@
private static final String BASE = "base"; // some WSDL use WSRPBaseService instead of Markup
private static final String MANAGEMENT = "management";
private static final String REGISTRATION = "registration";
- private boolean available;
public String getWsdlDefinitionURL()
@@ -83,27 +82,24 @@
try
{
initServices();
- available = true;
- failed = false;
+ setFailed(false);
}
catch (MalformedURLException e)
{
- available = false;
- failed = true;
+ setFailed(true);
throw new IllegalArgumentException("Require a well-formed URL specifying where to find the WSRP services definition", e);
}
catch (Exception e)
{
log.info("Couldn't access WSDL information. Service won't be available", e);
- available = false;
- failed = true;
+ setFailed(true);
throw e;
}
}
public boolean isAvailable()
{
- return available && !failed;
+ return !failed;
}
private void initServices() throws MalformedURLException
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceDescriptionServiceWrapper.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceDescriptionServiceWrapper.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceDescriptionServiceWrapper.java 2008-07-15 23:56:13 UTC (rev 11461)
@@ -0,0 +1,57 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.wsrp.services;
+
+import org.jboss.portal.wsrp.core.GetServiceDescription;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.ServiceDescription;
+import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ServiceDescriptionServiceWrapper extends ServiceWrapper<WSRP_v1_ServiceDescription_PortType> implements WSRP_v1_ServiceDescription_PortType
+{
+
+ protected ServiceDescriptionServiceWrapper(Object service, ServiceFactory parentFactory)
+ {
+ super(service, parentFactory);
+ }
+
+ public ServiceDescription getServiceDescription(GetServiceDescription getServiceDescription) throws OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ try
+ {
+ return service.getServiceDescription(getServiceDescription);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceFactory.java 2008-07-15 23:42:02 UTC (rev 11460)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceFactory.java 2008-07-15 23:56:13 UTC (rev 11461)
@@ -24,6 +24,8 @@
import org.jboss.system.Service;
+import java.rmi.Remote;
+
/**
* A factory that gives access to remote services.
*
@@ -32,12 +34,14 @@
*/
public interface ServiceFactory extends Service
{
- Object getService(Class clazz) throws Exception;
+ <T extends Remote> T getService(Class<T> clazz) throws Exception;
boolean isAvailable();
boolean isFailed();
+ void setFailed(boolean failed);
+
String getServiceDescriptionURL();
String getMarkupURL();
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceWrapper.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceWrapper.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceWrapper.java 2008-07-15 23:56:13 UTC (rev 11461)
@@ -0,0 +1,104 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.wsrp.services;
+
+import org.jboss.portal.wsrp.core.WSRP_v1_Markup_PortType;
+import org.jboss.portal.wsrp.core.WSRP_v1_PortletManagement_PortType;
+import org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType;
+import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
+
+import javax.xml.rpc.soap.SOAPFaultException;
+import java.lang.reflect.ParameterizedType;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * Wraps endpoints to be able to intercept RemoteExceptions on WSRP calls and fail the associated service factory if the
+ * error is not a business exception.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ServiceWrapper<T extends Remote>
+{
+ protected T service;
+ protected ServiceFactory parentFactory;
+
+ protected ServiceWrapper(Object service, ServiceFactory parentFactory)
+ {
+ if (service == null)
+ {
+ throw new IllegalArgumentException("Cannot create a ServiceWrapper without a valid service!");
+ }
+
+ Class serviceClass = service.getClass();
+ Class tClass = (Class)((ParameterizedType)getClass().getGenericSuperclass()).getActualTypeArguments()[0];
+ if (tClass.isAssignableFrom(serviceClass))
+ {
+ this.service = (T)service;
+ }
+ else
+ {
+ throw new IllegalArgumentException(service + " is not an instance of " + tClass.getSimpleName());
+ }
+ this.parentFactory = parentFactory;
+ }
+
+ public static <T extends Remote> T getServiceWrapper(Class<T> expectedServiceInterface, Object service, ServiceFactory parentFactory)
+ {
+ ServiceWrapper wrapper;
+ if (WSRP_v1_ServiceDescription_PortType.class.isAssignableFrom(expectedServiceInterface))
+ {
+ wrapper = new ServiceDescriptionServiceWrapper(service, parentFactory);
+ }
+ else if (WSRP_v1_Markup_PortType.class.isAssignableFrom(expectedServiceInterface))
+ {
+ wrapper = new MarkupServiceWrapper(service, parentFactory);
+ }
+ else if (WSRP_v1_Registration_PortType.class.isAssignableFrom(expectedServiceInterface))
+ {
+ wrapper = new RegistrationServiceWrapper(service, parentFactory);
+ }
+ else if (WSRP_v1_PortletManagement_PortType.class.isAssignableFrom(expectedServiceInterface))
+ {
+ wrapper = new PortletManagementServiceWrapper(service, parentFactory);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unknow endpoint interface " + expectedServiceInterface);
+ }
+
+ return (T)wrapper;
+ }
+
+ protected void handleRemoteException(RemoteException e) throws RemoteException
+ {
+ // if the remote exception happens to be a SOAPFaultException, this is a business exception, do NOT fail the factory in this case
+ if (!(e.getCause() instanceof SOAPFaultException))
+ {
+ parentFactory.setFailed(true);
+ }
+
+ throw e;
+ }
+}
15 years, 11 months
JBoss Portal SVN: r11460 - in branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal: test/wsrp/v1/producer and 2 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-07-15 19:42:02 -0400 (Tue, 15 Jul 2008)
New Revision: 11460
Added:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/MarkupServiceWrapper.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/PortletManagementServiceWrapper.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/RegistrationServiceWrapper.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceDescriptionServiceWrapper.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceWrapper.java
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BehaviorBackedServiceFactory.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractJNDIServiceFactory.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractSOAPServiceFactory.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/CachingServiceFactory.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceFactory.java
Log:
- JBPORTAL-1726:
+ Added wrapper around WSRP endpoints to be able to fail service factory when a non-business error happens.
+ Should investigate implementing using AOP instead.
+ Needs more testing.
- Minor improvements.
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BehaviorBackedServiceFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BehaviorBackedServiceFactory.java 2008-07-15 21:20:24 UTC (rev 11459)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BehaviorBackedServiceFactory.java 2008-07-15 23:42:02 UTC (rev 11460)
@@ -48,6 +48,7 @@
import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
import org.jboss.portal.wsrp.services.ServiceFactory;
+import java.rmi.Remote;
import java.rmi.RemoteException;
/**
@@ -72,23 +73,23 @@
registry.registerMarkupBehavior(new SimpleMarkupBehavior());
}
- public Object getService(Class clazz) throws Exception
+ public <T extends Remote> T getService(Class<T> serviceClass) throws Exception
{
- if (WSRP_v1_ServiceDescription_PortType.class.isAssignableFrom(clazz))
+ if (WSRP_v1_ServiceDescription_PortType.class.isAssignableFrom(serviceClass))
{
- return registry.getServiceDescriptionBehavior();
+ return (T)registry.getServiceDescriptionBehavior();
}
- if (WSRP_v1_Markup_PortType.class.isAssignableFrom(clazz))
+ if (WSRP_v1_Markup_PortType.class.isAssignableFrom(serviceClass))
{
- return registry.getMarkupBehaviorFor(MARKUP);
+ return (T)registry.getMarkupBehaviorFor(MARKUP);
}
- if (WSRP_v1_PortletManagement_PortType.class.isAssignableFrom(clazz))
+ if (WSRP_v1_PortletManagement_PortType.class.isAssignableFrom(serviceClass))
{
- return registry.getPortletManagementBehavior();
+ return (T)registry.getPortletManagementBehavior();
}
- if (WSRP_v1_Registration_PortType.class.isAssignableFrom(clazz))
+ if (WSRP_v1_Registration_PortType.class.isAssignableFrom(serviceClass))
{
- return registry.getRegistrationBehavior();
+ return (T)registry.getRegistrationBehavior();
}
return null;
}
@@ -118,6 +119,11 @@
return false;
}
+ public void setFailed(boolean failed)
+ {
+ // do nothing
+ }
+
public String getServiceDescriptionURL()
{
return SD_URL;
@@ -187,10 +193,10 @@
}
protected String getMarkupString(Mode mode, WindowState windowState, String navigationalState, GetMarkup getMarkup)
- throws UnsupportedWindowStateFault, InvalidCookieFault, InvalidSessionFault, AccessDeniedFault,
- InconsistentParametersFault, InvalidHandleFault, UnsupportedLocaleFault, UnsupportedModeFault,
- OperationFailedFault, MissingParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault,
- UnsupportedMimeTypeFault, RemoteException
+ throws UnsupportedWindowStateFault, InvalidCookieFault, InvalidSessionFault, AccessDeniedFault,
+ InconsistentParametersFault, InvalidHandleFault, UnsupportedLocaleFault, UnsupportedModeFault,
+ OperationFailedFault, MissingParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault,
+ UnsupportedMimeTypeFault, RemoteException
{
return MARKUP;
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2008-07-15 21:20:24 UTC (rev 11459)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2008-07-15 23:42:02 UTC (rev 11460)
@@ -64,14 +64,12 @@
protected WSRP_v1_PortletManagement_PortType portletManagementService;
private static final String CONSUMER = "test-consumer";
- public V1ProducerBaseTest()
- throws Exception
+ public V1ProducerBaseTest() throws Exception
{
this("V1ProducerBaseTest");
}
- protected V1ProducerBaseTest(String name)
- throws Exception
+ protected V1ProducerBaseTest(String name) throws Exception
{
super(name);
}
@@ -81,19 +79,14 @@
{
super.setUp();
- serviceDescriptionService = getService(WSRP_v1_ServiceDescription_PortType.class);
- markupService = getService(WSRP_v1_Markup_PortType.class);
- registrationService = getService(WSRP_v1_Registration_PortType.class);
- portletManagementService = getService(WSRP_v1_PortletManagement_PortType.class);
+ serviceDescriptionService = getServiceFactory().getService(WSRP_v1_ServiceDescription_PortType.class);
+ markupService = getServiceFactory().getService(WSRP_v1_Markup_PortType.class);
+ registrationService = getServiceFactory().getService(WSRP_v1_Registration_PortType.class);
+ portletManagementService = getServiceFactory().getService(WSRP_v1_PortletManagement_PortType.class);
resetRegistrationInfo();
}
- private <T> T getService(Class<T> serviceClass) throws Exception
- {
- return (T)getServiceFactory().getService(serviceClass);
- }
-
public void tearDown() throws Exception
{
producer.getProducerRegistrationRequirements().clearRegistrationProperties();
@@ -126,12 +119,11 @@
ExtendedAssert.assertEquals(1, markupTypes.length);
MarkupType markupType = markupTypes[0];
assertEquals(new MarkupType("text/html", new String[]{WSRPConstants.VIEW_MODE},
- new String[]{WSRPConstants.NORMAL_WINDOW_STATE, WSRPConstants.MAXIMIZED_WINDOW_STATE, WSRPConstants.MINIMIZED_WINDOW_STATE},
- new String[]{"en"}, null), markupType);
+ new String[]{WSRPConstants.NORMAL_WINDOW_STATE, WSRPConstants.MAXIMIZED_WINDOW_STATE, WSRPConstants.MINIMIZED_WINDOW_STATE},
+ new String[]{"en"}, null), markupType);
}
- protected ServiceDescription checkServiceDescriptionWithOnlyBasicPortlet(GetServiceDescription gs)
- throws Exception
+ protected ServiceDescription checkServiceDescriptionWithOnlyBasicPortlet(GetServiceDescription gs) throws Exception
{
deploy("test-basic-portlet.war");
//Invoke the Web Service
@@ -142,9 +134,9 @@
// Check offered portlets
PortletDescription[] offeredPortlets = sd.getOfferedPortlets();
ExtendedAssert.assertNotNull(offeredPortlets);
- for (int i = 0; i < offeredPortlets.length; i++)
+ for (PortletDescription offeredPortlet : offeredPortlets)
{
- System.out.println("handle " + offeredPortlets[i].getPortletHandle());
+ System.out.println("handle " + offeredPortlet.getPortletHandle());
}
ExtendedAssert.assertEquals(1, offeredPortlets.length);
@@ -158,7 +150,7 @@
}
protected RegistrationContext registerConsumer()
- throws org.jboss.portal.wsrp.core.MissingParametersFault, org.jboss.portal.wsrp.core.OperationFailedFault, java.rmi.RemoteException
+ throws org.jboss.portal.wsrp.core.MissingParametersFault, org.jboss.portal.wsrp.core.OperationFailedFault, java.rmi.RemoteException
{
RegistrationData registrationData = createBaseRegData();
return registrationService.register(registrationData);
@@ -182,7 +174,7 @@
{
// fix-me: http://jira.jboss.com/jira/browse/JBPORTAL-821
RegistrationPropertyDescription regProp = new RegistrationPropertyDescription("regProp",
- new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
+ new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
regProp.setDefaultLabel("Registration Property");
producer.getProducerRegistrationRequirements().addRegistrationProperty(regProp);
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java 2008-07-15 21:20:24 UTC (rev 11459)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java 2008-07-15 23:42:02 UTC (rev 11460)
@@ -34,6 +34,7 @@
import org.jboss.portal.wsrp.services.RemoteSOAPInvokerServiceFactory;
import org.jboss.portal.wsrp.services.ServiceFactory;
+import java.rmi.Remote;
import java.util.BitSet;
/**
@@ -363,38 +364,38 @@
// todo: public for tests
public WSRP_v1_ServiceDescription_PortType getServiceDescriptionService() throws InvokerUnavailableException
{
- return (WSRP_v1_ServiceDescription_PortType)getService(SERVICE_DESCRIPTION, WSRP_v1_ServiceDescription_PortType.class);
+ return getService(WSRP_v1_ServiceDescription_PortType.class);
}
// todo: public for tests
public WSRP_v1_Markup_PortType getMarkupService() throws InvokerUnavailableException
{
- return (WSRP_v1_Markup_PortType)getService(MARKUP, WSRP_v1_Markup_PortType.class);
+ return getService(WSRP_v1_Markup_PortType.class);
}
// todo: public for tests
public WSRP_v1_PortletManagement_PortType getPortletManagementService() throws InvokerUnavailableException
{
- return (WSRP_v1_PortletManagement_PortType)getService(PORTLET_MANAGEMENT, WSRP_v1_PortletManagement_PortType.class);
+ return getService(WSRP_v1_PortletManagement_PortType.class);
}
// todo: public for tests
public WSRP_v1_Registration_PortType getRegistrationService() throws InvokerUnavailableException
{
- return (WSRP_v1_Registration_PortType)getService(REGISTRATION, WSRP_v1_Registration_PortType.class);
+ return getService(WSRP_v1_Registration_PortType.class);
}
- private Object getService(String description, Class clazz) throws InvokerUnavailableException
+ private <T extends Remote> T getService(Class<T> clazz) throws InvokerUnavailableException
{
try
{
- Object service = getServiceFactory().getService(clazz);
+ T service = getServiceFactory().getService(clazz);
clean.set(getIndexFor(clazz));
return service;
}
catch (Exception e)
{
- throw new InvokerUnavailableException("Couldn't access " + description + " service. Cause: "
+ throw new InvokerUnavailableException("Couldn't access " + clazz.getSimpleName() + " service. Cause: "
+ e.getLocalizedMessage(), e);
}
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractJNDIServiceFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractJNDIServiceFactory.java 2008-07-15 21:20:24 UTC (rev 11459)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractJNDIServiceFactory.java 2008-07-15 23:42:02 UTC (rev 11460)
@@ -27,6 +27,8 @@
import org.jboss.portal.jems.as.system.AbstractJBossService;
import javax.naming.InitialContext;
+import javax.xml.rpc.Service;
+import java.rmi.Remote;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
@@ -60,17 +62,17 @@
// fix-me: this is hardcoded from values from portal-wsrp-client.jar/META-INF/jboss-client.xml... NOT GOOD!
DEFAULT_FACTORY_MAPPING = new Properties();
DEFAULT_FACTORY_MAPPING.setProperty(
- "org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType",
- "wsrp-client/service/ServiceDescriptionService");
+ "org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType",
+ "wsrp-client/service/ServiceDescriptionService");
DEFAULT_FACTORY_MAPPING.setProperty(
- "org.jboss.portal.wsrp.core.WSRP_v1_Markup_PortType",
- "wsrp-client/service/MarkupService");
+ "org.jboss.portal.wsrp.core.WSRP_v1_Markup_PortType",
+ "wsrp-client/service/MarkupService");
DEFAULT_FACTORY_MAPPING.setProperty(
- "org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType",
- "wsrp-client/service/RegistrationService");
+ "org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType",
+ "wsrp-client/service/RegistrationService");
DEFAULT_FACTORY_MAPPING.setProperty(
- "org.jboss.portal.wsrp.core.WSRP_v1_PortletManagement_PortType",
- "wsrp-client/service/PortletManagementService");
+ "org.jboss.portal.wsrp.core.WSRP_v1_PortletManagement_PortType",
+ "wsrp-client/service/PortletManagementService");
}
/** A Map recording the mapping between WSRP port type class name and JDNI name of the implementing service. */
@@ -102,7 +104,7 @@
this.env = env;
}
- public Object getService(Class serviceClass) throws Exception
+ protected <T extends Remote> Service getServiceFor(Class<T> serviceClass) throws Exception
{
if (serviceClass == null)
{
@@ -149,7 +151,7 @@
}
//
- return service;
+ return (Service)service;
}
finally
{
@@ -162,6 +164,11 @@
return failed;
}
+ public void setFailed(boolean failed)
+ {
+ this.failed = failed;
+ }
+
public Properties getPortJNDIMapping()
{
return portJNDIMapping;
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractSOAPServiceFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractSOAPServiceFactory.java 2008-07-15 21:20:24 UTC (rev 11459)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractSOAPServiceFactory.java 2008-07-15 23:42:02 UTC (rev 11460)
@@ -25,10 +25,11 @@
import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
import javax.xml.rpc.Service;
+import java.rmi.Remote;
import java.util.Map;
/**
- * Perform common logic to soap based service factories. This one cache the service retrieved from the JNDI lookup.
+ * Perform common logic to soap based service factories. This one caches the service retrieved from the JNDI lookup.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -37,7 +38,7 @@
{
/** Cache the services. */
- private Map services = new ConcurrentReaderHashMap();
+ private Map<String, Service> services = new ConcurrentReaderHashMap();
protected void createService() throws Exception
{
@@ -62,7 +63,7 @@
*/
protected abstract Object getStubFromService(Class serviceClass, Service service) throws Exception;
- public Object getService(Class serviceClass) throws Exception
+ public <T extends Remote> T getService(Class<T> serviceClass) throws Exception
{
if (serviceClass == null)
{
@@ -73,10 +74,10 @@
String key = serviceClass.getName();
// Get the cached service, it's ok because they are thread safe
- Service service = (Service)services.get(key);
+ Service service = services.get(key);
if (service == null)
{
- service = (Service)super.getService(serviceClass);
+ service = super.getServiceFor(serviceClass);
//
if (service != null)
@@ -89,7 +90,7 @@
// and must be customized for every request to this method.
if (service != null)
{
- return getStubFromService(serviceClass, service);
+ return ServiceWrapper.getServiceWrapper(serviceClass, getStubFromService(serviceClass, service), this);
}
else
{
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/CachingServiceFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/CachingServiceFactory.java 2008-07-15 21:20:24 UTC (rev 11459)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/CachingServiceFactory.java 2008-07-15 23:42:02 UTC (rev 11460)
@@ -25,6 +25,7 @@
import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
import org.jboss.portal.jems.as.system.AbstractJBossService;
+import java.rmi.Remote;
import java.util.Map;
/**
@@ -38,12 +39,12 @@
{
/** . */
- private static final Map cache = new ConcurrentReaderHashMap();
+ private static final Map<String, Remote> cache = new ConcurrentReaderHashMap();
/** . */
private ServiceFactory delegate;
- public Object getService(Class clazz) throws Exception
+ public <T extends Remote> T getService(Class<T> clazz) throws Exception
{
if (delegate == null)
{
@@ -55,7 +56,7 @@
}
//
- Object service = cache.get(clazz.getName());
+ Remote service = cache.get(clazz.getName());
if (service == null)
{
service = delegate.getService(clazz);
@@ -64,7 +65,7 @@
cache.put(clazz.getName(), service);
}
}
- return service;
+ return (T)service;
}
public ServiceFactory getDelegate()
@@ -88,6 +89,14 @@
return delegate == null || delegate.isFailed();
}
+ public void setFailed(boolean failed)
+ {
+ if (delegate != null)
+ {
+ delegate.setFailed(failed);
+ }
+ }
+
public String getServiceDescriptionURL()
{
if (delegate != null)
Added: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/MarkupServiceWrapper.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/MarkupServiceWrapper.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/MarkupServiceWrapper.java 2008-07-15 23:42:02 UTC (rev 11460)
@@ -0,0 +1,112 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.wsrp.services;
+
+import org.jboss.portal.wsrp.core.AccessDeniedFault;
+import org.jboss.portal.wsrp.core.BlockingInteractionResponse;
+import org.jboss.portal.wsrp.core.GetMarkup;
+import org.jboss.portal.wsrp.core.InconsistentParametersFault;
+import org.jboss.portal.wsrp.core.InitCookie;
+import org.jboss.portal.wsrp.core.InvalidCookieFault;
+import org.jboss.portal.wsrp.core.InvalidHandleFault;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.InvalidSessionFault;
+import org.jboss.portal.wsrp.core.InvalidUserCategoryFault;
+import org.jboss.portal.wsrp.core.MarkupResponse;
+import org.jboss.portal.wsrp.core.MissingParametersFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.PerformBlockingInteraction;
+import org.jboss.portal.wsrp.core.PortletStateChangeRequiredFault;
+import org.jboss.portal.wsrp.core.ReleaseSessions;
+import org.jboss.portal.wsrp.core.ReturnAny;
+import org.jboss.portal.wsrp.core.UnsupportedLocaleFault;
+import org.jboss.portal.wsrp.core.UnsupportedMimeTypeFault;
+import org.jboss.portal.wsrp.core.UnsupportedModeFault;
+import org.jboss.portal.wsrp.core.UnsupportedWindowStateFault;
+import org.jboss.portal.wsrp.core.WSRP_v1_Markup_PortType;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class MarkupServiceWrapper extends ServiceWrapper<WSRP_v1_Markup_PortType> implements WSRP_v1_Markup_PortType
+{
+ public MarkupServiceWrapper(Object service, ServiceFactory parentFactory)
+ {
+ super(service, parentFactory);
+ }
+
+ public MarkupResponse getMarkup(GetMarkup getMarkup) throws UnsupportedWindowStateFault, InvalidCookieFault, InvalidSessionFault, AccessDeniedFault, InconsistentParametersFault, InvalidHandleFault, UnsupportedLocaleFault, UnsupportedModeFault, OperationFailedFault, MissingParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault, UnsupportedMimeTypeFault, RemoteException
+ {
+ try
+ {
+ return service.getMarkup(getMarkup);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public BlockingInteractionResponse performBlockingInteraction(PerformBlockingInteraction performBlockingInteraction) throws InvalidSessionFault, UnsupportedModeFault, UnsupportedMimeTypeFault, OperationFailedFault, UnsupportedWindowStateFault, UnsupportedLocaleFault, AccessDeniedFault, PortletStateChangeRequiredFault, InvalidRegistrationFault, MissingParametersFault, InvalidUserCategoryFault, InconsistentParametersFault, InvalidHandleFault, InvalidCookieFault, RemoteException
+ {
+ try
+ {
+ return service.performBlockingInteraction(performBlockingInteraction);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public ReturnAny releaseSessions(ReleaseSessions releaseSessions) throws InvalidRegistrationFault, OperationFailedFault, MissingParametersFault, AccessDeniedFault, RemoteException
+ {
+ try
+ {
+ return service.releaseSessions(releaseSessions);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public ReturnAny initCookie(InitCookie initCookie) throws AccessDeniedFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ try
+ {
+ return service.initCookie(initCookie);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+}
Added: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/PortletManagementServiceWrapper.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/PortletManagementServiceWrapper.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/PortletManagementServiceWrapper.java 2008-07-15 23:42:02 UTC (rev 11460)
@@ -0,0 +1,135 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.wsrp.services;
+
+import org.jboss.portal.wsrp.core.AccessDeniedFault;
+import org.jboss.portal.wsrp.core.ClonePortlet;
+import org.jboss.portal.wsrp.core.DestroyPortlets;
+import org.jboss.portal.wsrp.core.DestroyPortletsResponse;
+import org.jboss.portal.wsrp.core.GetPortletDescription;
+import org.jboss.portal.wsrp.core.GetPortletProperties;
+import org.jboss.portal.wsrp.core.GetPortletPropertyDescription;
+import org.jboss.portal.wsrp.core.InconsistentParametersFault;
+import org.jboss.portal.wsrp.core.InvalidHandleFault;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.InvalidUserCategoryFault;
+import org.jboss.portal.wsrp.core.MissingParametersFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.PortletContext;
+import org.jboss.portal.wsrp.core.PortletDescriptionResponse;
+import org.jboss.portal.wsrp.core.PortletPropertyDescriptionResponse;
+import org.jboss.portal.wsrp.core.PropertyList;
+import org.jboss.portal.wsrp.core.SetPortletProperties;
+import org.jboss.portal.wsrp.core.WSRP_v1_PortletManagement_PortType;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class PortletManagementServiceWrapper extends ServiceWrapper<WSRP_v1_PortletManagement_PortType> implements WSRP_v1_PortletManagement_PortType
+{
+ public PortletManagementServiceWrapper(Object service, ServiceFactory parentFactory)
+ {
+ super(service, parentFactory);
+ }
+
+ public PortletDescriptionResponse getPortletDescription(GetPortletDescription getPortletDescription) throws AccessDeniedFault, InvalidHandleFault, InvalidUserCategoryFault, InconsistentParametersFault, MissingParametersFault, InvalidRegistrationFault, OperationFailedFault, RemoteException
+ {
+ try
+ {
+ return service.getPortletDescription(getPortletDescription);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public PortletContext clonePortlet(ClonePortlet clonePortlet) throws InvalidUserCategoryFault, AccessDeniedFault, OperationFailedFault, InvalidHandleFault, InvalidRegistrationFault, InconsistentParametersFault, MissingParametersFault, RemoteException
+ {
+ try
+ {
+ return service.clonePortlet(clonePortlet);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public DestroyPortletsResponse destroyPortlets(DestroyPortlets destroyPortlets) throws InconsistentParametersFault, MissingParametersFault, InvalidRegistrationFault, OperationFailedFault, RemoteException
+ {
+ try
+ {
+ return service.destroyPortlets(destroyPortlets);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public PortletContext setPortletProperties(SetPortletProperties setPortletProperties) throws OperationFailedFault, InvalidHandleFault, MissingParametersFault, InconsistentParametersFault, InvalidUserCategoryFault, AccessDeniedFault, InvalidRegistrationFault, RemoteException
+ {
+ try
+ {
+ return service.setPortletProperties(setPortletProperties);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public PropertyList getPortletProperties(GetPortletProperties getPortletProperties) throws InvalidHandleFault, MissingParametersFault, InvalidRegistrationFault, AccessDeniedFault, OperationFailedFault, InconsistentParametersFault, InvalidUserCategoryFault, RemoteException
+ {
+ try
+ {
+ return service.getPortletProperties(getPortletProperties);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public PortletPropertyDescriptionResponse getPortletPropertyDescription(GetPortletPropertyDescription getPortletPropertyDescription) throws MissingParametersFault, InconsistentParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault, AccessDeniedFault, InvalidHandleFault, OperationFailedFault, RemoteException
+ {
+ try
+ {
+ return service.getPortletPropertyDescription(getPortletPropertyDescription);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+}
Added: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/RegistrationServiceWrapper.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/RegistrationServiceWrapper.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/RegistrationServiceWrapper.java 2008-07-15 23:42:02 UTC (rev 11460)
@@ -0,0 +1,86 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.wsrp.services;
+
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.MissingParametersFault;
+import org.jboss.portal.wsrp.core.ModifyRegistration;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.RegistrationContext;
+import org.jboss.portal.wsrp.core.RegistrationData;
+import org.jboss.portal.wsrp.core.RegistrationState;
+import org.jboss.portal.wsrp.core.ReturnAny;
+import org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class RegistrationServiceWrapper extends ServiceWrapper<WSRP_v1_Registration_PortType> implements WSRP_v1_Registration_PortType
+{
+ public RegistrationServiceWrapper(Object service, ServiceFactory parentFactory)
+ {
+ super(service, parentFactory);
+ }
+
+ public RegistrationContext register(RegistrationData register) throws MissingParametersFault, OperationFailedFault, RemoteException
+ {
+ try
+ {
+ return service.register(register);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public ReturnAny deregister(RegistrationContext deregister) throws OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ try
+ {
+ return service.deregister(deregister);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public RegistrationState modifyRegistration(ModifyRegistration modifyRegistration) throws MissingParametersFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ try
+ {
+ return service.modifyRegistration(modifyRegistration);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java 2008-07-15 21:20:24 UTC (rev 11459)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java 2008-07-15 23:42:02 UTC (rev 11460)
@@ -64,7 +64,6 @@
private static final String BASE = "base"; // some WSDL use WSRPBaseService instead of Markup
private static final String MANAGEMENT = "management";
private static final String REGISTRATION = "registration";
- private boolean available;
public String getWsdlDefinitionURL()
@@ -83,27 +82,24 @@
try
{
initServices();
- available = true;
- failed = false;
+ setFailed(false);
}
catch (MalformedURLException e)
{
- available = false;
- failed = true;
+ setFailed(true);
throw new IllegalArgumentException("Require a well-formed URL specifying where to find the WSRP services definition", e);
}
catch (Exception e)
{
log.info("Couldn't access WSDL information. Service won't be available", e);
- available = false;
- failed = true;
+ setFailed(true);
throw e;
}
}
public boolean isAvailable()
{
- return available && !failed;
+ return !failed;
}
private void initServices() throws MalformedURLException
Added: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceDescriptionServiceWrapper.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceDescriptionServiceWrapper.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceDescriptionServiceWrapper.java 2008-07-15 23:42:02 UTC (rev 11460)
@@ -0,0 +1,57 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.wsrp.services;
+
+import org.jboss.portal.wsrp.core.GetServiceDescription;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.ServiceDescription;
+import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ServiceDescriptionServiceWrapper extends ServiceWrapper<WSRP_v1_ServiceDescription_PortType> implements WSRP_v1_ServiceDescription_PortType
+{
+
+ protected ServiceDescriptionServiceWrapper(Object service, ServiceFactory parentFactory)
+ {
+ super(service, parentFactory);
+ }
+
+ public ServiceDescription getServiceDescription(GetServiceDescription getServiceDescription) throws OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ try
+ {
+ return service.getServiceDescription(getServiceDescription);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceFactory.java 2008-07-15 21:20:24 UTC (rev 11459)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceFactory.java 2008-07-15 23:42:02 UTC (rev 11460)
@@ -24,6 +24,8 @@
import org.jboss.system.Service;
+import java.rmi.Remote;
+
/**
* A factory that gives access to remote services.
*
@@ -32,12 +34,14 @@
*/
public interface ServiceFactory extends Service
{
- Object getService(Class clazz) throws Exception;
+ <T extends Remote> T getService(Class<T> clazz) throws Exception;
boolean isAvailable();
boolean isFailed();
+ void setFailed(boolean failed);
+
String getServiceDescriptionURL();
String getMarkupURL();
Added: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceWrapper.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceWrapper.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceWrapper.java 2008-07-15 23:42:02 UTC (rev 11460)
@@ -0,0 +1,104 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.wsrp.services;
+
+import org.jboss.portal.wsrp.core.WSRP_v1_Markup_PortType;
+import org.jboss.portal.wsrp.core.WSRP_v1_PortletManagement_PortType;
+import org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType;
+import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
+
+import javax.xml.rpc.soap.SOAPFaultException;
+import java.lang.reflect.ParameterizedType;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * Wraps endpoints to be able to intercept RemoteExceptions on WSRP calls and fail the associated service factory if the
+ * error is not a business exception.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ServiceWrapper<T extends Remote>
+{
+ protected T service;
+ protected ServiceFactory parentFactory;
+
+ protected ServiceWrapper(Object service, ServiceFactory parentFactory)
+ {
+ if (service == null)
+ {
+ throw new IllegalArgumentException("Cannot create a ServiceWrapper without a valid service!");
+ }
+
+ Class serviceClass = service.getClass();
+ Class tClass = (Class)((ParameterizedType)getClass().getGenericSuperclass()).getActualTypeArguments()[0];
+ if (tClass.isAssignableFrom(serviceClass))
+ {
+ this.service = (T)service;
+ }
+ else
+ {
+ throw new IllegalArgumentException(service + " is not an instance of " + tClass.getSimpleName());
+ }
+ this.parentFactory = parentFactory;
+ }
+
+ public static <T extends Remote> T getServiceWrapper(Class<T> expectedServiceInterface, Object service, ServiceFactory parentFactory)
+ {
+ ServiceWrapper wrapper;
+ if (WSRP_v1_ServiceDescription_PortType.class.isAssignableFrom(expectedServiceInterface))
+ {
+ wrapper = new ServiceDescriptionServiceWrapper(service, parentFactory);
+ }
+ else if (WSRP_v1_Markup_PortType.class.isAssignableFrom(expectedServiceInterface))
+ {
+ wrapper = new MarkupServiceWrapper(service, parentFactory);
+ }
+ else if (WSRP_v1_Registration_PortType.class.isAssignableFrom(expectedServiceInterface))
+ {
+ wrapper = new RegistrationServiceWrapper(service, parentFactory);
+ }
+ else if (WSRP_v1_PortletManagement_PortType.class.isAssignableFrom(expectedServiceInterface))
+ {
+ wrapper = new PortletManagementServiceWrapper(service, parentFactory);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unknow endpoint interface " + expectedServiceInterface);
+ }
+
+ return (T)wrapper;
+ }
+
+ protected void handleRemoteException(RemoteException e) throws RemoteException
+ {
+ // if the remote exception happens to be a SOAPFaultException, this is a business exception, do NOT fail the factory in this case
+ if (!(e.getCause() instanceof SOAPFaultException))
+ {
+ parentFactory.setFailed(true);
+ }
+
+ throw e;
+ }
+}
15 years, 11 months