gatein SVN: r3245 - portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page.
by do-not-reply@jboss.org
Author: thanh_tung_do
Date: 2010-06-08 05:38:50 -0400 (Tue, 08 Jun 2010)
New Revision: 3245
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java
Log:
GTNPORTAL-1281: remove User page node after delete User page
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java 2010-06-08 09:26:26 UTC (rev 3244)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java 2010-06-08 09:38:50 UTC (rev 3245)
@@ -29,6 +29,8 @@
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.portal.PageNodeEvent;
@@ -302,8 +304,81 @@
datasource.getPage(currentPage);
event.getRequestContext().addUIComponentToUpdateByAjax(uiPageBrowser);
}
+
+ //Update navigation and UserToolbarGroupPortlet if deleted page is dashboard page
+ if(page.getOwnerType().equals(PortalConfig.USER_TYPE)){
+ removePageNode(page, event);
+ }
}
+
+ /**
+ *
+ * This method remove User Page node that reference to page.
+ * If page is exist, remove User Page node.
+ * If page is not exist, do nothing.
+ *
+ * @param page the page is referenced by User Page node
+ * @param event
+ * @throws Exception any exception
+ */
+ private void removePageNode(Page page, Event<UIPageBrowser> event) throws Exception
+ {
+ UIPageBrowser uiPageBrowser = event.getSource();
+ DataStorage dataService = uiPageBrowser.getApplicationComponent(DataStorage.class);
+
+ PageNavigation pageNavigation = null;
+ UIPortalApplication portalApplication = Util.getUIPortalApplication();
+
+ List<PageNavigation> listPageNavigation = portalApplication.getNavigations();
+
+ for (PageNavigation pageNvg : listPageNavigation)
+ {
+ if (pageNvg.getOwnerType().equals(PortalConfig.USER_TYPE))
+ {
+ pageNavigation = pageNvg;
+ break;
+ }
+ }
+ UIPortal uiPortal = Util.getUIPortal();
+
+ PageNode tobeRemoved = null;
+ List<PageNode> nodes = pageNavigation.getNodes();
+ for (PageNode pageNode : nodes)
+ {
+ String pageReference = pageNode.getPageReference();
+ String pageId = page.getPageId();
+
+ if (pageReference != null && pageReference.equals(pageId))
+ {
+ tobeRemoved = pageNode;
+ break;
+ }
+ }
+
+ if (tobeRemoved != null)
+ {
+ // Remove pageNode
+ pageNavigation.getNodes().remove(tobeRemoved);
+
+ // Update navigation and UserToolbarGroupPortlet
+
+ String pageRef = tobeRemoved.getPageReference();
+ if (pageRef != null && pageRef.length() > 0)
+ {
+ // Remove from cache
+ uiPortal.clearUIPage(pageRef);
+ }
+
+ dataService.save(pageNavigation);
+
+ //Update UserToolbarGroupPortlet
+ UIWorkingWorkspace uiWorkingWS = portalApplication.getChild(UIWorkingWorkspace.class);
+ uiWorkingWS.updatePortletsByName("UserToolbarDashboardPortlet");
+
+ }
+ }
}
+
static public class EditInfoActionListener extends EventListener<UIPageBrowser>
{
14 years, 6 months
gatein SVN: r3244 - in portal/trunk: web/portal/src/main/webapp/WEB-INF/classes/locale/portal and 1 other directory.
by do-not-reply@jboss.org
Author: phuong_vu
Date: 2010-06-08 05:26:26 -0400 (Tue, 08 Jun 2010)
New Revision: 3244
Modified:
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_en.properties
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_fr.properties
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_ru.properties
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_uk.properties
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_zh_TW.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ar.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
Log:
GTNPORTAL-1292: Change meaning of labels to be more correct
Modified: portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_en.properties
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_en.properties 2010-06-08 09:09:17 UTC (rev 3243)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_en.properties 2010-06-08 09:26:26 UTC (rev 3244)
@@ -20,5 +20,5 @@
UISiteManagement.action.addNewPortal=Add New Portal
UISiteManagement.label.editLayout=Edit Layout
UISiteManagement.label.editNav=Edit Navigation
-UISiteManagement.label.editPortalProp=Edit Portal's Properties
+UISiteManagement.label.editPortalProp=Edit Portal's Config
UISiteManagement.label.deletePortal=Delete
\ No newline at end of file
Modified: portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_fr.properties
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_fr.properties 2010-06-08 09:09:17 UTC (rev 3243)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_fr.properties 2010-06-08 09:26:26 UTC (rev 3244)
@@ -20,5 +20,5 @@
UISiteManagement.action.addNewPortal=Ajouter Nouveau Portal
UISiteManagement.label.editLayout=Edit Layout
UISiteManagement.label.editNav=Edit Navigation
-UISiteManagement.label.editPortalProp=Edit Portal's Properties
+UISiteManagement.label.editPortalProp=Edit Portal's Config
UISiteManagement.label.deletePortal=Delete
\ No newline at end of file
Modified: portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_ru.properties
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_ru.properties 2010-06-08 09:09:17 UTC (rev 3243)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_ru.properties 2010-06-08 09:26:26 UTC (rev 3244)
@@ -20,5 +20,5 @@
UISiteManagement.action.addNewPortal=Создать портал
UISiteManagement.label.editLayout=Изменить макет
UISiteManagement.label.editNav=Изменить навигацию
-UISiteManagement.label.editPortalProp=Edit Portal's Properties
+UISiteManagement.label.editPortalProp=Edit Portal's Config
UISiteManagement.label.deletePortal=Удалить
Modified: portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_uk.properties
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_uk.properties 2010-06-08 09:09:17 UTC (rev 3243)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_uk.properties 2010-06-08 09:26:26 UTC (rev 3244)
@@ -20,5 +20,5 @@
UISiteManagement.action.addNewPortal=Додати новий портал
UISiteManagement.label.editLayout=Редагувати мапу
UISiteManagement.label.editNav=Редагувати навігацію
-UISiteManagement.label.editPortalProp=Edit Portal's Properties
+UISiteManagement.label.editPortalProp=Edit Portal's Config
UISiteManagement.label.deletePortal=Видалити
\ No newline at end of file
Modified: portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_zh_TW.xml
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_zh_TW.xml 2010-06-08 09:09:17 UTC (rev 3243)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/PortalNavigationPortlet_zh_TW.xml 2010-06-08 09:26:26 UTC (rev 3244)
@@ -7,7 +7,7 @@
<label>
<editLayout>Edit Layout</editLayout>
<editNav>Edit Navigation</editNav>
- <editPortalProp>Edit Portal's Properties</editPortalProp>
+ <editPortalProp>Edit Portal's Config</editPortalProp>
<deletePortal>Delete</deletePortal>
</label>
</UISiteManagement>
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ar.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ar.xml 2010-06-08 09:09:17 UTC (rev 3243)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ar.xml 2010-06-08 09:26:26 UTC (rev 3244)
@@ -213,7 +213,7 @@
<action>
<Abort>Abort</Abort>
<Finish>Finish</Finish>
- <ViewProperties>Portal Properties</ViewProperties>
+ <ViewProperties>Site's Config</ViewProperties>
<SwitchMode>Switch View Mode</SwitchMode>
</action>
</UIPortalComposer>
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2010-06-08 09:09:17 UTC (rev 3243)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2010-06-08 09:26:26 UTC (rev 3244)
@@ -124,7 +124,7 @@
UIPortalComposer.title.UIPortalComposer=Edit Inline Composer
UIPortalComposer.action.Abort=Abort
UIPortalComposer.action.Finish=Finish
-UIPortalComposer.action.ViewProperties=Portal Properties
+UIPortalComposer.action.ViewProperties=Site's Config
UIPortalComposer.action.SwitchMode=Switch View Mode
UITabPane.title.UIApplicationList=Applications
UITabPane.title.UIContainerList=Containers
14 years, 6 months
gatein SVN: r3243 - portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/container.
by do-not-reply@jboss.org
Author: trong.tran
Date: 2010-06-08 05:09:17 -0400 (Tue, 08 Jun 2010)
New Revision: 3243
Modified:
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl
Log:
Fix small display issue in the table autofit column container
Modified: portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl
===================================================================
--- portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl 2010-06-08 08:21:59 UTC (rev 3242)
+++ portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl 2010-06-08 09:09:17 UTC (rev 3243)
@@ -64,7 +64,7 @@
<div class="LeftBar">
<div class="RightBar">
<div class="MiddleBar">
- <div class="FixHeight">
+ <div class="FixHeight ClearFix">
<div class="DragControlArea" title="<%=_ctx.appRes("UIContainer.tooltip.drag")%>" onmousedown="eXo.portal.PortalDragDrop.init.call(this,event);"><span></span></div>
<%
String strTitle = uicomponent.getTitle() != null ?
@@ -73,10 +73,9 @@
%>
<div class="ContainerIcon DefaultContainer16x16Icon"><%=hasPermission ? strTitle : _ctx.appRes("UIPortlet.label.protectedContent")%></div>
<%if(hasPermission) {%>
- <a href="<%=uicomponent.event("DeleteComponent","$uicomponent.id")%>" class="DeleteContainerIcon" title="<%=_ctx.appRes("UIContainer.tooltip.closeContainer")%>"><span></span></a>
<a href="<%=uicomponent.event("EditContainer","$uicomponent.id")%>;eXo.portal.UIPortal.changeComposerSaveButton()" class="EditContainerIcon" title="<%=_ctx.appRes("UIContainer.tooltip.editContainer")%>"><span></span></a>
+ <a href="<%=uicomponent.event("DeleteComponent","$uicomponent.id")%>" class="DeleteContainerIcon" title="<%=_ctx.appRes("UIContainer.tooltip.closeContainer")%>"><span></span></a>
<%}%>
- <div class="ClearBoth"><span></span></div>
</div>
</div>
</div>
14 years, 6 months
gatein SVN: r3242 - portal/trunk/testsuite.
by do-not-reply@jboss.org
Author: hangnguyen
Date: 2010-06-08 04:21:59 -0400 (Tue, 08 Jun 2010)
New Revision: 3242
Modified:
portal/trunk/testsuite/GateIn_v3.1.0_BasicPortlets_TestDefinition.ods
Log:
Update test case for GateIn_v3.1.0 GA
Modified: portal/trunk/testsuite/GateIn_v3.1.0_BasicPortlets_TestDefinition.ods
===================================================================
(Binary files differ)
14 years, 6 months
gatein SVN: r3241 - portal/trunk/testsuite.
by do-not-reply@jboss.org
Author: hangnguyen
Date: 2010-06-07 22:46:01 -0400 (Mon, 07 Jun 2010)
New Revision: 3241
Added:
portal/trunk/testsuite/GateIn_v3.1.0_SniffTests.ods
Log:
Update Snifftest for GateIn_v3.1.0
Added: portal/trunk/testsuite/GateIn_v3.1.0_SniffTests.ods
===================================================================
(Binary files differ)
Property changes on: portal/trunk/testsuite/GateIn_v3.1.0_SniffTests.ods
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years, 6 months
gatein SVN: r3240 - portal/trunk/testsuite.
by do-not-reply@jboss.org
Author: hangnguyen
Date: 2010-06-07 22:44:41 -0400 (Mon, 07 Jun 2010)
New Revision: 3240
Added:
portal/trunk/testsuite/GateIn_v3.1.0_BasicPortlets_TestDefinition.ods
portal/trunk/testsuite/GateIn_v3.1.0_MainFucntions_TestDefinition.ods
Log:
Update test case for GateIn_v3.1.0 GA
Added: portal/trunk/testsuite/GateIn_v3.1.0_BasicPortlets_TestDefinition.ods
===================================================================
(Binary files differ)
Property changes on: portal/trunk/testsuite/GateIn_v3.1.0_BasicPortlets_TestDefinition.ods
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: portal/trunk/testsuite/GateIn_v3.1.0_MainFucntions_TestDefinition.ods
===================================================================
(Binary files differ)
Property changes on: portal/trunk/testsuite/GateIn_v3.1.0_MainFucntions_TestDefinition.ods
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years, 6 months
gatein SVN: r3239 - portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data.
by do-not-reply@jboss.org
Author: hoang_to
Date: 2010-06-07 20:34:26 -0400 (Mon, 07 Jun 2010)
New Revision: 3239
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
Log:
GTNPORTAL-1288: Update Java code in Mapper to fix the ClassCastException
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2010-06-07 15:25:49 UTC (rev 3238)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2010-06-08 00:34:26 UTC (rev 3239)
@@ -798,18 +798,32 @@
String parentId = hierarchyRelationships.get(dstChildId);
if (parentId != null)
{
+ try{
// Get the new parent
- UIContainer parent = session.findObjectById(ObjectType.CONTAINER, parentId);
+ UIContainer parent = session.findObjectById(ObjectType.CONTAINER, parentId);
- // Perform the move
- parent.getComponents().add(dstChild);
+ // Perform the move
+ parent.getComponents().add(dstChild);
- //
- changes.add(new ModelChange.Move(dst.getObjectId(), parentId, dstChildId));
+ //
+ changes.add(new ModelChange.Move(dst.getObjectId(), parentId, dstChildId));
- // julien : we do not need to create an update operation
- // as later the update operation will be created when the object
- // will be processed
+ // julien : we do not need to create an update operation
+ // as later the update operation will be created when the
+ // object
+ // will be processed
+ }
+ catch (ClassCastException ex)
+ {
+ // minhhoang : In case the parentId refers to the page, there
+ // is exception in findObjectId. Hence,
+ // we have a temporary try/catch to handle this exception
+ Page parent = session.findObjectById(ObjectType.PAGE, parentId);
+
+ parent.getRootComponent().getComponents().add(dstChild);
+
+ changes.add(new ModelChange.Move(dst.getObjectId(), parentId, dstChildId));
+ }
}
}
}
14 years, 6 months
gatein SVN: r3238 - in components/wsrp/trunk: common/src/main/java/org/gatein/wsrp/spec/v1 and 11 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-06-07 11:25:49 -0400 (Mon, 07 Jun 2010)
New Revision: 3238
Added:
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPExceptionFactoryTestCase.java
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/v1/
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/v1/V2V1ConverterTestCase.java
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPExceptionFactory.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1TypeFactory.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1ServiceDescriptionService.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorRegistry.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducerImpl.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/BasicPortletManagementBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorRegistry.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducerImpl.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicPortletManagementBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/DestroyClonesPortletManagementBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieNotRequiredMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerGroupInitCookieMarkupBehavior.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/MarkupHandler.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/PortletManagementHandler.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RegistrationHandler.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RequestProcessor.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ServiceDescriptionHandler.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java
Log:
- Mostly synchronization commit:
+ Started fleshing out V2V1Converter
+ Added better way to create exceptions: should replace old way in new code.
+ Added test cases.
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPExceptionFactory.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPExceptionFactory.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPExceptionFactory.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -25,6 +25,8 @@
import org.oasis.wsrp.v2.AccessDenied;
import org.oasis.wsrp.v2.AccessDeniedFault;
+import org.oasis.wsrp.v2.ExportByValueNotSupported;
+import org.oasis.wsrp.v2.ExportNoLongerValid;
import org.oasis.wsrp.v2.Fault;
import org.oasis.wsrp.v2.InconsistentParameters;
import org.oasis.wsrp.v2.InconsistentParametersFault;
@@ -40,10 +42,13 @@
import org.oasis.wsrp.v2.InvalidUserCategoryFault;
import org.oasis.wsrp.v2.MissingParameters;
import org.oasis.wsrp.v2.MissingParametersFault;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.OperationFailedFault;
+import org.oasis.wsrp.v2.OperationNotSupported;
import org.oasis.wsrp.v2.PortletStateChangeRequired;
import org.oasis.wsrp.v2.PortletStateChangeRequiredFault;
+import org.oasis.wsrp.v2.ResourceSuspended;
import org.oasis.wsrp.v2.UnsupportedLocale;
import org.oasis.wsrp.v2.UnsupportedLocaleFault;
import org.oasis.wsrp.v2.UnsupportedMimeType;
@@ -86,6 +91,8 @@
private static final Map<String, ExceptionFactory<? extends Exception, ? extends Fault>> errorCodeToExceptions =
new HashMap<String, ExceptionFactory<? extends Exception, ? extends Fault>>(17);
+ private static final Map<Class<? extends Exception>, ExceptionFactory2<? extends Exception>> exceptionClassToFactory =
+ new HashMap<Class<? extends Exception>, ExceptionFactory2<? extends Exception>>(19);
static
{
@@ -140,6 +147,36 @@
}
}
+ static
+ {
+ try
+ {
+ exceptionClassToFactory.put(AccessDenied.class, new ExceptionFactory2<AccessDenied>(AccessDenied.class));
+ exceptionClassToFactory.put(ExportByValueNotSupported.class, new ExceptionFactory2<ExportByValueNotSupported>(ExportByValueNotSupported.class));
+ exceptionClassToFactory.put(ExportNoLongerValid.class, new ExceptionFactory2<ExportNoLongerValid>(ExportNoLongerValid.class));
+ exceptionClassToFactory.put(InconsistentParameters.class, new ExceptionFactory2<InconsistentParameters>(InconsistentParameters.class));
+ exceptionClassToFactory.put(InvalidCookie.class, new ExceptionFactory2<InvalidCookie>(InvalidCookie.class));
+ exceptionClassToFactory.put(InvalidHandle.class, new ExceptionFactory2<InvalidHandle>(InvalidHandle.class));
+ exceptionClassToFactory.put(InvalidRegistration.class, new ExceptionFactory2<InvalidRegistration>(InvalidRegistration.class));
+ exceptionClassToFactory.put(InvalidSession.class, new ExceptionFactory2<InvalidSession>(InvalidSession.class));
+ exceptionClassToFactory.put(InvalidUserCategory.class, new ExceptionFactory2<InvalidUserCategory>(InvalidUserCategory.class));
+ exceptionClassToFactory.put(MissingParameters.class, new ExceptionFactory2<MissingParameters>(MissingParameters.class));
+ exceptionClassToFactory.put(ModifyRegistrationRequired.class, new ExceptionFactory2<ModifyRegistrationRequired>(ModifyRegistrationRequired.class));
+ exceptionClassToFactory.put(OperationFailed.class, new ExceptionFactory2<OperationFailed>(OperationFailed.class));
+ exceptionClassToFactory.put(OperationNotSupported.class, new ExceptionFactory2<OperationNotSupported>(OperationNotSupported.class));
+ exceptionClassToFactory.put(PortletStateChangeRequired.class, new ExceptionFactory2<PortletStateChangeRequired>(PortletStateChangeRequired.class));
+ exceptionClassToFactory.put(ResourceSuspended.class, new ExceptionFactory2<ResourceSuspended>(ResourceSuspended.class));
+ exceptionClassToFactory.put(UnsupportedLocale.class, new ExceptionFactory2<UnsupportedLocale>(UnsupportedLocale.class));
+ exceptionClassToFactory.put(UnsupportedMimeType.class, new ExceptionFactory2<UnsupportedMimeType>(UnsupportedMimeType.class));
+ exceptionClassToFactory.put(UnsupportedMode.class, new ExceptionFactory2<UnsupportedMode>(UnsupportedMode.class));
+ exceptionClassToFactory.put(UnsupportedWindowState.class, new ExceptionFactory2<UnsupportedWindowState>(UnsupportedWindowState.class));
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Couldn't initialize WSRPExceptionFactory", e);
+ }
+ }
+
private WSRPExceptionFactory()
{
}
@@ -172,6 +209,24 @@
throw exceptionFactory.newInstance(message, cause);
}
+ public static <E extends Exception> E throwWSException(Class<E> exceptionClass, String message, Throwable cause) throws E
+ {
+ throw createWSException(exceptionClass, message, cause);
+ }
+
+ public static <E extends Exception> E createWSException(Class<E> exceptionClass, String message, Throwable cause)
+ {
+ ExceptionFactory2<E> exceptionFactory = (ExceptionFactory2<E>)exceptionClassToFactory.get(exceptionClass);
+
+ if (exceptionFactory == null)
+ {
+ throw new IllegalArgumentException("Unknown exception class: " + exceptionClass);
+ }
+
+ return exceptionFactory.newInstance(message, cause);
+ }
+
+
private abstract static class ExceptionFactory<E extends Exception, F extends Fault>
{
private final Constructor<E> exceptionConstructor;
@@ -200,4 +255,43 @@
}
}
}
+
+ private static class ExceptionFactory2<E extends Exception>
+ {
+ private final Constructor<E> exceptionConstructor;
+ private final Fault fault;
+ private static final String FAULT = "Fault";
+
+ public ExceptionFactory2(Class<E> exceptionClass) throws NoSuchMethodException, IllegalAccessException, InstantiationException, ClassNotFoundException
+ {
+ String faultClassName = exceptionClass.getName() + FAULT;
+
+ Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass(faultClassName);
+ if (Fault.class.isAssignableFrom(clazz))
+ {
+ Class<? extends Fault> faultClass = (Class<Fault>)clazz;
+ exceptionConstructor = exceptionClass.getConstructor(String.class, faultClass, Throwable.class);
+ fault = faultClass.newInstance();
+ }
+ else
+ {
+ throw new IllegalArgumentException("Couldn't create a Fault class based on specified exception class: "
+ + exceptionClass);
+ }
+ }
+
+ public E newInstance(String message, Throwable cause)
+ {
+ try
+ {
+ return exceptionConstructor.newInstance(message, fault, cause);
+ }
+ catch (Exception e)
+ {
+ log.debug("Couldn't instantiate Exception associated with " + fault.getClass().getSimpleName()
+ + ", message: " + message + ", cause: " + cause);
+ return null;
+ }
+ }
+ }
}
\ No newline at end of file
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -27,11 +27,15 @@
import com.google.common.collect.Lists;
import org.gatein.common.NotYetImplemented;
import org.gatein.pc.api.OpaqueStateString;
+import org.gatein.wsrp.WSRPExceptionFactory;
import org.gatein.wsrp.WSRPTypeFactory;
import org.oasis.wsrp.v1.V1ClientData;
import org.oasis.wsrp.v1.V1Extension;
+import org.oasis.wsrp.v1.V1ItemDescription;
+import org.oasis.wsrp.v1.V1LocalizedString;
import org.oasis.wsrp.v1.V1MarkupContext;
import org.oasis.wsrp.v1.V1MarkupParams;
+import org.oasis.wsrp.v1.V1MarkupType;
import org.oasis.wsrp.v1.V1PortletContext;
import org.oasis.wsrp.v1.V1PortletDescription;
import org.oasis.wsrp.v1.V1RegistrationContext;
@@ -40,8 +44,11 @@
import org.oasis.wsrp.v1.V1UserContext;
import org.oasis.wsrp.v2.ClientData;
import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.ItemDescription;
+import org.oasis.wsrp.v2.LocalizedString;
import org.oasis.wsrp.v2.MarkupContext;
import org.oasis.wsrp.v2.MarkupParams;
+import org.oasis.wsrp.v2.MarkupType;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
import org.oasis.wsrp.v2.RegistrationContext;
@@ -55,8 +62,14 @@
*/
public class V2V1Converter
{
- private static final V1ToV2ExtensionFunction V1_TO_V2_EXTENSION_FUNCTION = new V1ToV2ExtensionFunction();
+ private static final V1ToV2Extension V1_TO_V2_EXTENSION = new V1ToV2Extension();
+ private static final V2ToV1Extension V2_TO_V1_EXTENSION = new V2ToV1Extension();
+ private static final V2ToV1MarkupType V2_TO_V1_MARKUPTYPE = new V2ToV1MarkupType();
+ public static final V2ToV1PortletDescription V2_TO_V1_PORTLETDESCRIPTION = new V2ToV1PortletDescription();
+ public static final V2ToV1LocalizedString V2_TO_V1_LOCALIZEDSTRING = new V2ToV1LocalizedString();
+ public static final V2ToV1ItemDescription V2_TO_V1_ITEMDESCRIPTION = new V2ToV1ItemDescription();
+
public static V1PortletDescription toV1PortletDescription(PortletDescription portletDescription)
{
throw new NotYetImplemented();
@@ -81,10 +94,11 @@
markupParams.getValidNewModes().addAll(v1MarkupParams.getValidNewModes());
markupParams.getValidNewWindowStates().addAll(v1MarkupParams.getValidNewWindowStates());
- markupParams.getExtensions().addAll(Lists.transform(v1MarkupParams.getExtensions(), V1_TO_V2_EXTENSION_FUNCTION));
+ markupParams.getExtensions().addAll(Lists.transform(v1MarkupParams.getExtensions(), V1_TO_V2_EXTENSION));
return markupParams;
}
+
private static ClientData toV2ClientData(V1ClientData clientData)
{
throw new NotYetImplemented();
@@ -120,8 +134,50 @@
throw new NotYetImplemented();
}
- private static class V1ToV2ExtensionFunction implements Function<V1Extension, Extension>
+ public static V1RegistrationContext toV1RegistrationContext(RegistrationContext registrationContext)
{
+ if (registrationContext != null)
+ {
+ V1RegistrationContext result = WSRP1TypeFactory.createRegistrationContext(registrationContext.getRegistrationHandle());
+ result.setRegistrationState(registrationContext.getRegistrationState());
+ result.getExtensions().addAll(Lists.transform(registrationContext.getExtensions(), V2_TO_V1_EXTENSION));
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static <E extends Exception> E toV2Exception(Class<E> v2ExceptionClass, Exception v1Exception)
+ {
+ if (!"org.oasis.wsrp.v2".equals(v2ExceptionClass.getPackage().getName()))
+ {
+ throw new IllegalArgumentException("Specified exception class is not a WSRP 2 exception: " + v2ExceptionClass);
+ }
+
+ Class<? extends Exception> v1ExceptionClass = v1Exception.getClass();
+ String v1Name = v1ExceptionClass.getSimpleName();
+ int v1Index = v1Name.indexOf("V1");
+ if (v1Index != 0 && !"org.oasis.wsrp.v1".equals(v1ExceptionClass.getPackage().getName()))
+ {
+ throw new IllegalArgumentException("Specified exception is not a WSRP 1 exception: " + v1Exception);
+ }
+
+ String v2Name = v2ExceptionClass.getSimpleName();
+ // V2 class name should match V1 class name minus "V1"
+ if (!v2Name.equals(v1Name.substring(2)))
+ {
+ throw new IllegalArgumentException("Exception names do not match. Requested: " + v2Name
+ + ", was given: " + v1Name);
+ }
+
+ return WSRPExceptionFactory.createWSException(v2ExceptionClass, v1Exception.getMessage(), v1Exception.getCause());
+ }
+
+
+ private static class V1ToV2Extension implements Function<V1Extension, Extension>
+ {
public Extension apply(V1Extension from)
{
if (from == null)
@@ -136,4 +192,81 @@
}
}
}
+
+ private static class V2ToV1Extension implements Function<Extension, V1Extension>
+ {
+ public V1Extension apply(Extension from)
+ {
+ if (from == null)
+ {
+ return null;
+ }
+ else
+ {
+ V1Extension extension = new V1Extension();
+ extension.setAny(from.getAny());
+ return extension;
+ }
+ }
+ }
+
+ public static class V2ToV1PortletDescription implements Function<PortletDescription, V1PortletDescription>
+ {
+
+ public V1PortletDescription apply(PortletDescription from)
+ {
+ V1PortletDescription result = WSRP1TypeFactory.createPortletDescription(from.getPortletHandle(),
+ Lists.transform(from.getMarkupTypes(), V2_TO_V1_MARKUPTYPE));
+ result.setDescription(V2_TO_V1_LOCALIZEDSTRING.apply(from.getDescription()));
+ result.setDisplayName(V2_TO_V1_LOCALIZEDSTRING.apply(from.getDisplayName()));
+ result.getExtensions().addAll(Lists.transform(from.getExtensions(), V2_TO_V1_EXTENSION));
+ result.getKeywords().addAll(Lists.transform(from.getKeywords(), V2_TO_V1_LOCALIZEDSTRING));
+ result.getUserCategories().addAll(from.getUserCategories());
+ result.getUserProfileItems().addAll(from.getUserProfileItems());
+ result.setDefaultMarkupSecure(from.isDefaultMarkupSecure());
+ result.setDoesUrlTemplateProcessing(from.isDoesUrlTemplateProcessing());
+ result.setTemplatesStoredInSession(from.isTemplatesStoredInSession());
+ result.setHasUserSpecificState(from.isHasUserSpecificState());
+ result.setOnlySecure(from.isOnlySecure());
+ result.setUserContextStoredInSession(from.isUserContextStoredInSession());
+ result.setUsesMethodGet(from.isUsesMethodGet());
+ result.setShortTitle(V2_TO_V1_LOCALIZEDSTRING.apply(from.getShortTitle()));
+ result.setTitle(V2_TO_V1_LOCALIZEDSTRING.apply(from.getTitle()));
+
+ result.setGroupID(from.getGroupID());
+ return null;
+ }
+ }
+
+ public static class V2ToV1ItemDescription implements Function<ItemDescription, V1ItemDescription>
+ {
+
+ public V1ItemDescription apply(ItemDescription from)
+ {
+ V1ItemDescription result = new V1ItemDescription();
+ result.setItemName(from.getItemName());
+ result.setDescription(V2_TO_V1_LOCALIZEDSTRING.apply(from.getDescription()));
+ result.getExtensions().addAll(Lists.transform(from.getExtensions(), V2_TO_V1_EXTENSION));
+ return result;
+ }
+ }
+
+ public static class V2ToV1MarkupType implements Function<MarkupType, V1MarkupType>
+ {
+
+ public V1MarkupType apply(MarkupType from)
+ {
+ return WSRP1TypeFactory.createMarkupType(from.getMimeType(), from.getModes(), from.getWindowStates(), from.getLocales());
+ }
+ }
+
+ public static class V2ToV1LocalizedString implements Function<LocalizedString, V1LocalizedString>
+ {
+
+ public V1LocalizedString apply(LocalizedString from)
+ {
+ return WSRP1TypeFactory.createLocalizedString(from.getLang(), from.getResourceName(), from.getValue());
+
+ }
+ }
}
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1TypeFactory.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1TypeFactory.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1TypeFactory.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -328,6 +328,21 @@
return portletDescription;
}
+ public static V1PortletDescription createPortletDescription(String portletHandle, List<V1MarkupType> markupTypes)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "portlet handle", null);
+ ParameterValidation.throwIllegalArgExceptionIfNull(markupTypes, "MarkupType");
+ if (markupTypes.isEmpty())
+ {
+ throw new IllegalArgumentException("Cannot create a PortletDescription with an empty list of MarkupTypes!");
+ }
+
+ V1PortletDescription portletDescription = new V1PortletDescription();
+ portletDescription.setPortletHandle(portletHandle);
+ portletDescription.getMarkupTypes().addAll(markupTypes);
+ return portletDescription;
+ }
+
private static void checkPortletHandle(String portletHandle)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "portlet handle", "PortletDescription");
Added: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPExceptionFactoryTestCase.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPExceptionFactoryTestCase.java (rev 0)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPExceptionFactoryTestCase.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -0,0 +1,55 @@
+/*
+* 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.gatein.wsrp;
+
+import junit.framework.TestCase;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.OperationFailedFault;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class WSRPExceptionFactoryTestCase extends TestCase
+{
+ public void testCreateWSException() throws Exception
+ {
+ Throwable throwable = new Throwable();
+ OperationFailed operationFailed = WSRPExceptionFactory.createWSException(OperationFailed.class, "foo", throwable);
+ assertNotNull(operationFailed);
+ assertEquals("foo", operationFailed.getMessage());
+ assertNotNull(operationFailed.getFaultInfo());
+ assertEquals(OperationFailedFault.class, operationFailed.getFaultInfo().getClass());
+ assertEquals(throwable, operationFailed.getCause());
+
+ try
+ {
+ WSRPExceptionFactory.createWSException(Exception.class, "foo", null);
+ fail("Should have failed because specified exception is not a WSRP one");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+ }
+}
Added: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/v1/V2V1ConverterTestCase.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/v1/V2V1ConverterTestCase.java (rev 0)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/v1/V2V1ConverterTestCase.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -0,0 +1,91 @@
+/*
+* 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.gatein.wsrp.spec.v1;
+
+import junit.framework.TestCase;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1OperationFailedFault;
+import org.oasis.wsrp.v2.InvalidSession;
+import org.oasis.wsrp.v2.OperationFailed;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class V2V1ConverterTestCase extends TestCase
+{
+ public void testToV2Exception() throws Exception
+ {
+ Throwable throwable = new Throwable();
+ V1OperationFailed v1OF = new V1OperationFailed("foo", new V1OperationFailedFault(), throwable);
+ OperationFailed operationFailed = V2V1Converter.toV2Exception(OperationFailed.class, v1OF);
+ assertNotNull(operationFailed);
+ assertEquals("foo", operationFailed.getMessage());
+ assertEquals(throwable, operationFailed.getCause());
+ }
+
+ public void testToV2ExceptionMismatch()
+ {
+ Throwable throwable = new Throwable();
+ V1OperationFailed v1OF = new V1OperationFailed("foo", new V1OperationFailedFault(), throwable);
+
+ try
+ {
+ V2V1Converter.toV2Exception(InvalidSession.class, v1OF);
+ fail("Should have failed as requested v2 exception doesn't match specified v1");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+ }
+
+ public void testToV2ExceptionWrongRequestedException()
+ {
+ Throwable throwable = new Throwable();
+ V1OperationFailed v1OF = new V1OperationFailed("foo", new V1OperationFailedFault(), throwable);
+
+ try
+ {
+ V2V1Converter.toV2Exception(IllegalArgumentException.class, v1OF);
+ fail("Should have failed as requested exception is not a WSRP 2 exception class");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+ }
+
+ public void testToV2ExceptionWrongV1Exception()
+ {
+ try
+ {
+ V2V1Converter.toV2Exception(OperationFailed.class, new IllegalArgumentException());
+ fail("Should have failed as specified exception is not a WSRP 1 exception");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+ }
+}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1ServiceDescriptionService.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1ServiceDescriptionService.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1ServiceDescriptionService.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -22,8 +22,17 @@
package org.gatein.wsrp.services.v1;
-import org.gatein.common.NotYetImplemented;
import org.gatein.wsrp.services.ServiceDescriptionService;
+import org.gatein.wsrp.spec.v1.V2V1Converter;
+import org.oasis.wsrp.v1.V1CookieProtocol;
+import org.oasis.wsrp.v1.V1Extension;
+import org.oasis.wsrp.v1.V1InvalidRegistration;
+import org.oasis.wsrp.v1.V1ItemDescription;
+import org.oasis.wsrp.v1.V1ModelDescription;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1PortletDescription;
+import org.oasis.wsrp.v1.V1RegistrationContext;
+import org.oasis.wsrp.v1.V1ResourceList;
import org.oasis.wsrp.v1.WSRPV1ServiceDescriptionPortType;
import org.oasis.wsrp.v2.CookieProtocol;
import org.oasis.wsrp.v2.EventDescription;
@@ -68,7 +77,33 @@
Holder<Boolean> mayReturnRegistrationState, Holder<List<Extension>> extensions)
throws InvalidRegistration, ModifyRegistrationRequired, OperationFailed, ResourceSuspended
{
- throw new NotYetImplemented();
+ V1RegistrationContext v1RegistrationContext = V2V1Converter.toV1RegistrationContext(registrationContext);
+ Holder<List<V1PortletDescription>> v1OfferedPortlets = new Holder<List<V1PortletDescription>>();
+ Holder<List<V1ItemDescription>> v1UserCategories = new Holder<List<V1ItemDescription>>();
+ Holder<List<V1ItemDescription>> v1ProfileITems = new Holder<List<V1ItemDescription>>();
+ Holder<List<V1ItemDescription>> v1WindowStates = new Holder<List<V1ItemDescription>>();
+ Holder<List<V1ItemDescription>> v1Modes = new Holder<List<V1ItemDescription>>();
+ Holder<V1CookieProtocol> v1Cookie = new Holder<V1CookieProtocol>();
+ Holder<V1ModelDescription> v1RegistrationProperties = new Holder<V1ModelDescription>();
+ Holder<V1ResourceList> v1Resources = new Holder<V1ResourceList>();
+ Holder<List<V1Extension>> v1Extensions = new Holder<List<V1Extension>>();
+ try
+ {
+ service.getServiceDescription(v1RegistrationContext, desiredLocales, requiresRegistration, v1OfferedPortlets,
+ v1UserCategories,
+ v1ProfileITems,
+ v1WindowStates,
+ v1Modes,
+ v1Cookie, v1RegistrationProperties, locales, v1Resources, v1Extensions);
+ }
+ catch (V1InvalidRegistration v1InvalidRegistration)
+ {
+ throw V2V1Converter.toV2Exception(InvalidRegistration.class, v1InvalidRegistration);
+ }
+ catch (V1OperationFailed v1OperationFailed)
+ {
+ throw V2V1Converter.toV2Exception(OperationFailed.class, v1OperationFailed);
+ }
/*service.getServiceDescription(registrationContext, desiredLocales, portletHandles, userContext,
requiresRegistration, offeredPortlets, userCategoryDescriptions, extensionDescriptions,
customWindowStateDescriptions, customModeDescriptions, requiresInitCookie, registrationPropertyDescription,
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -37,13 +37,11 @@
import org.oasis.wsrp.v2.InconsistentParameters;
import org.oasis.wsrp.v2.InvalidHandle;
import org.oasis.wsrp.v2.InvalidRegistration;
-import org.oasis.wsrp.v2.InvalidRegistrationFault;
import org.oasis.wsrp.v2.InvalidUserCategory;
import org.oasis.wsrp.v2.Lifetime;
import org.oasis.wsrp.v2.MissingParameters;
import org.oasis.wsrp.v2.ModifyRegistrationRequired;
import org.oasis.wsrp.v2.OperationFailed;
-import org.oasis.wsrp.v2.OperationFailedFault;
import org.oasis.wsrp.v2.OperationNotSupported;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
@@ -385,8 +383,7 @@
return;
}
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- value + " is not a valid value for " + PROP_NAME, null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, value + " is not a valid value for " + PROP_NAME, null);
}
@Override
@@ -398,7 +395,7 @@
if (!RegistrationBehavior.REGISTRATION_HANDLE.equals(registrationContext.getRegistrationHandle()))
{
- WSRPExceptionFactory.<InvalidRegistration, InvalidRegistrationFault>throwWSException(WSRPExceptionFactory.INVALID_REGISTRATION, "Invalid registration", null);
+ WSRPExceptionFactory.throwWSException(InvalidRegistration.class, "Invalid registration", null);
}
WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(registrationData, "RegistrationData", null);
@@ -411,7 +408,7 @@
return;
}
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED, value
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, value
+ " is not a valid value for " + PROP_NAME, null);
}
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -56,13 +56,13 @@
import org.gatein.wsrp.test.support.TestPortletInvocationContext;
import org.oasis.wsrp.v1.V1CookieProtocol;
import org.oasis.wsrp.v1.V1Extension;
+import org.oasis.wsrp.v1.V1InvalidHandle;
import org.oasis.wsrp.v1.V1InvalidRegistration;
import org.oasis.wsrp.v1.V1ItemDescription;
import org.oasis.wsrp.v1.V1ModelDescription;
import org.oasis.wsrp.v1.V1OperationFailed;
import org.oasis.wsrp.v1.V1PortletDescription;
import org.oasis.wsrp.v1.V1ResourceList;
-import org.oasis.wsrp.v2.InvalidHandle;
import javax.servlet.http.HttpSession;
import javax.xml.ws.Holder;
@@ -165,7 +165,7 @@
ExtendedAssert.assertEquals(0, behavior.getInitCookieCallCount());
}
- public void testInitCookiePerUser() throws PortletInvokerException, InvalidHandle
+ public void testInitCookiePerUser() throws PortletInvokerException, V1InvalidHandle
{
String handle = PerUserInitCookieMarkupBehavior.PER_USER_INIT_COOKIE_HANDLE;
InitCookieMarkupBehavior behavior = (InitCookieMarkupBehavior)producer.getBehaviorRegistry().getMarkupBehaviorFor(handle);
@@ -179,7 +179,7 @@
ExtendedAssert.assertEquals(1, behavior.getInitCookieCallCount());
}
- public void testInitCookiePerGroup() throws PortletInvokerException, InvalidHandle, V1InvalidRegistration, V1OperationFailed
+ public void testInitCookiePerGroup() throws PortletInvokerException, V1InvalidHandle, V1InvalidRegistration, V1OperationFailed
{
BehaviorRegistry registry = producer.getBehaviorRegistry();
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorRegistry.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorRegistry.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorRegistry.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -23,9 +23,9 @@
package org.gatein.wsrp.test.protocol.v1;
-import org.gatein.wsrp.WSRPExceptionFactory;
-import org.oasis.wsrp.v2.InvalidHandle;
-import org.oasis.wsrp.v2.InvalidHandleFault;
+import org.gatein.wsrp.spec.v1.WSRP1ExceptionFactory;
+import org.oasis.wsrp.v1.V1InvalidHandle;
+import org.oasis.wsrp.v1.V1InvalidHandleFault;
import java.util.HashMap;
import java.util.Map;
@@ -59,13 +59,13 @@
behaviors.clear();
}
- public MarkupBehavior getMarkupBehaviorFor(String handle) throws InvalidHandle
+ public MarkupBehavior getMarkupBehaviorFor(String handle) throws V1InvalidHandle
{
if (behaviors.containsKey(handle))
{
return behaviors.get(handle);
}
- throw WSRPExceptionFactory.<InvalidHandle, InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
+ throw WSRP1ExceptionFactory.<V1InvalidHandle, V1InvalidHandleFault>throwWSException(WSRP1ExceptionFactory.INVALID_HANDLE,
"There is no registered MarkupBehavior for handle '" + handle + "'", null);
}
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducerImpl.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducerImpl.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducerImpl.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -32,7 +32,6 @@
import org.oasis.wsrp.v1.V1InteractionParams;
import org.oasis.wsrp.v1.V1InvalidCookie;
import org.oasis.wsrp.v1.V1InvalidHandle;
-import org.oasis.wsrp.v1.V1InvalidHandleFault;
import org.oasis.wsrp.v1.V1InvalidRegistration;
import org.oasis.wsrp.v1.V1InvalidSession;
import org.oasis.wsrp.v1.V1InvalidUserCategory;
@@ -64,7 +63,6 @@
import org.oasis.wsrp.v1.WSRPV1PortletManagementPortType;
import org.oasis.wsrp.v1.WSRPV1RegistrationPortType;
import org.oasis.wsrp.v1.WSRPV1ServiceDescriptionPortType;
-import org.oasis.wsrp.v2.InvalidHandle;
import javax.jws.WebParam;
import javax.xml.ws.Holder;
@@ -117,14 +115,7 @@
private MarkupBehavior getMarkupBehaviorFor(String portletHandle) throws V1InvalidHandle
{
- try
- {
- return behaviorRegistry.getMarkupBehaviorFor(portletHandle);
- }
- catch (InvalidHandle invalidHandle)
- {
- throw WSRP1ExceptionFactory.<V1InvalidHandle, V1InvalidHandleFault>throwWSException(WSRP1ExceptionFactory.INVALID_HANDLE, "Invalid handle", null);
- }
+ return behaviorRegistry.getMarkupBehaviorFor(portletHandle);
}
private ServiceDescriptionBehavior getServiceDescriptionBehavior()
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/BasicPortletManagementBehavior.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/BasicPortletManagementBehavior.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/BasicPortletManagementBehavior.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -47,7 +47,6 @@
import org.oasis.wsrp.v1.V1ResetProperty;
import org.oasis.wsrp.v1.V1ResourceList;
import org.oasis.wsrp.v1.V1UserContext;
-import org.oasis.wsrp.v2.InvalidHandle;
import javax.jws.WebParam;
import javax.xml.ws.Holder;
@@ -103,16 +102,7 @@
}
// get the POP description...
- MarkupBehavior markupBehaviorFor;
- try
- {
- markupBehaviorFor = registry.getMarkupBehaviorFor(handle);
- }
- catch (InvalidHandle invalidHandle)
- {
- throw WSRP1ExceptionFactory.<V1InvalidHandle, V1InvalidHandleFault>throwWSException(WSRP1ExceptionFactory.INVALID_HANDLE,
- "Invalid handle '" + handle + "'", invalidHandle);
- }
+ MarkupBehavior markupBehaviorFor = registry.getMarkupBehaviorFor(handle);
V1PortletDescription description = markupBehaviorFor.getPortletDescriptionFor(handle);
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorRegistry.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorRegistry.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorRegistry.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -25,7 +25,6 @@
import org.gatein.wsrp.WSRPExceptionFactory;
import org.oasis.wsrp.v2.InvalidHandle;
-import org.oasis.wsrp.v2.InvalidHandleFault;
import java.util.HashMap;
import java.util.Map;
@@ -65,8 +64,7 @@
{
return behaviors.get(handle);
}
- throw WSRPExceptionFactory.<InvalidHandle, InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "There is no registered MarkupBehavior for handle '" + handle + "'", null);
+ throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "There is no registered MarkupBehavior for handle '" + handle + "'", null);
}
public void registerMarkupBehavior(MarkupBehavior behavior)
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducerImpl.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducerImpl.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducerImpl.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -58,7 +58,6 @@
import org.oasis.wsrp.v2.ModelTypes;
import org.oasis.wsrp.v2.ModifyRegistrationRequired;
import org.oasis.wsrp.v2.OperationFailed;
-import org.oasis.wsrp.v2.OperationFailedFault;
import org.oasis.wsrp.v2.OperationNotSupported;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
@@ -192,7 +191,7 @@
// should only be called if we required cookies to be initialized
if (requiresInitCookie == null || CookieProtocol.NONE.equals(requiresInitCookie))
{
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED, "Shouldn't have called initCookie", null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Shouldn't have called initCookie", null);
}
try
@@ -201,7 +200,7 @@
}
catch (InvalidHandle invalidHandle)
{
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED, "Invalid handle", invalidHandle);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Invalid handle", invalidHandle);
}
}
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicPortletManagementBehavior.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicPortletManagementBehavior.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicPortletManagementBehavior.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -41,7 +41,6 @@
import org.oasis.wsrp.v2.ImportedPortlet;
import org.oasis.wsrp.v2.InconsistentParameters;
import org.oasis.wsrp.v2.InvalidHandle;
-import org.oasis.wsrp.v2.InvalidHandleFault;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.InvalidUserCategory;
import org.oasis.wsrp.v2.Lifetime;
@@ -49,7 +48,6 @@
import org.oasis.wsrp.v2.ModelDescription;
import org.oasis.wsrp.v2.ModifyRegistrationRequired;
import org.oasis.wsrp.v2.OperationFailed;
-import org.oasis.wsrp.v2.OperationFailedFault;
import org.oasis.wsrp.v2.OperationNotSupported;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
@@ -128,8 +126,7 @@
if (!BasicMarkupBehavior.PORTLET_HANDLE.equals(handle))
{
- throw WSRPExceptionFactory.<InvalidHandle, InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Can only clone portlet with handle '" + BasicMarkupBehavior.PORTLET_HANDLE + "'", null);
+ throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Can only clone portlet with handle '" + BasicMarkupBehavior.PORTLET_HANDLE + "'", null);
}
portletHandle.value = CLONED_HANDLE;
@@ -205,8 +202,7 @@
if (!(CLONED_HANDLE).equals(handle))
{
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Cannot modify portlet '" + handle + "'", null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Cannot modify portlet '" + handle + "'", null);
}
portletHandle.value = handle;
@@ -236,8 +232,7 @@
}
else
{
- WSRPExceptionFactory.<InvalidHandle, InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Unknown handle '" + handle + "'", null);
+ WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Unknown handle '" + handle + "'", null);
}
incrementCallCount();
@@ -251,8 +246,7 @@
WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(handle, "portlet handle", "PortletContext");
if (handle.length() == 0)
{
- throw WSRPExceptionFactory.<InvalidHandle, InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Portlet handle is empty", null);
+ throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Portlet handle is empty", null);
}
return handle;
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/DestroyClonesPortletManagementBehavior.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/DestroyClonesPortletManagementBehavior.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/DestroyClonesPortletManagementBehavior.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -29,7 +29,6 @@
import org.oasis.wsrp.v2.Extension;
import org.oasis.wsrp.v2.InconsistentParameters;
import org.oasis.wsrp.v2.InvalidHandle;
-import org.oasis.wsrp.v2.InvalidHandleFault;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.InvalidUserCategory;
import org.oasis.wsrp.v2.MissingParameters;
@@ -73,8 +72,7 @@
}
else
{
- throw WSRPExceptionFactory.<InvalidHandle, InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Invalid portlet handle: " + portletContext.getPortletHandle(), null);
+ throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Invalid portlet handle: " + portletContext.getPortletHandle(), null);
}
}
}
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieMarkupBehavior.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieMarkupBehavior.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieMarkupBehavior.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -32,11 +32,9 @@
import org.oasis.wsrp.v2.Extension;
import org.oasis.wsrp.v2.GetMarkup;
import org.oasis.wsrp.v2.InvalidCookie;
-import org.oasis.wsrp.v2.InvalidCookieFault;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.ModifyRegistrationRequired;
import org.oasis.wsrp.v2.OperationFailed;
-import org.oasis.wsrp.v2.OperationFailedFault;
import org.oasis.wsrp.v2.OperationNotSupported;
import org.oasis.wsrp.v2.RegistrationContext;
import org.oasis.wsrp.v2.ResourceSuspended;
@@ -75,7 +73,7 @@
}
// shouldn't happen
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED, "Shouldn't be happen", null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Shouldn't be happen", null);
}
protected String getMarkupString(String handle) throws InvalidCookie, OperationFailed
@@ -84,14 +82,14 @@
{
case 0:
// simulate change of configuration between calls: upon receiving this, the consumer should invoke initCookie
- throw WSRPExceptionFactory.<InvalidCookie, InvalidCookieFault>throwWSException(WSRPExceptionFactory.INVALID_COOKIE, "Simulate invalid cookie", null);
+ throw WSRPExceptionFactory.throwWSException(InvalidCookie.class, "Simulate invalid cookie", null);
case 1:
return handle;
default:
// shouldn't be called more than twice
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED, "Shouldn't be called more than twice", null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Shouldn't be called more than twice", null);
}
}
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieNotRequiredMarkupBehavior.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieNotRequiredMarkupBehavior.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieNotRequiredMarkupBehavior.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -30,7 +30,6 @@
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.ModifyRegistrationRequired;
import org.oasis.wsrp.v2.OperationFailed;
-import org.oasis.wsrp.v2.OperationFailedFault;
import org.oasis.wsrp.v2.OperationNotSupported;
import org.oasis.wsrp.v2.RegistrationContext;
import org.oasis.wsrp.v2.ResourceSuspended;
@@ -67,6 +66,6 @@
public List<Extension> initCookie(@WebParam(name = "registrationContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext, @WebParam(name = "userContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") UserContext userContext) throws AccessDenied, InvalidRegistration, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
super.initCookie(registrationContext, userContext);
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED, "Shouldn't be called", null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Shouldn't be called", null);
}
}
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerGroupInitCookieMarkupBehavior.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerGroupInitCookieMarkupBehavior.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerGroupInitCookieMarkupBehavior.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -30,7 +30,6 @@
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.ModifyRegistrationRequired;
import org.oasis.wsrp.v2.OperationFailed;
-import org.oasis.wsrp.v2.OperationFailedFault;
import org.oasis.wsrp.v2.OperationNotSupported;
import org.oasis.wsrp.v2.RegistrationContext;
import org.oasis.wsrp.v2.ResourceSuspended;
@@ -64,9 +63,7 @@
if (initCookieCallCount > 3)
{
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Service description only defines 3 groups so initCookie should only be called 3 times!",
- new IllegalStateException("Service description only defines 3 groups so initCookie should only be called 3 times!"));
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Service description only defines 3 groups so initCookie should only be called 3 times!", new IllegalStateException("Service description only defines 3 groups so initCookie should only be called 3 times!"));
}
return extensions;
}
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/MarkupHandler.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/MarkupHandler.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/MarkupHandler.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -46,18 +46,14 @@
import org.oasis.wsrp.v2.MarkupResponse;
import org.oasis.wsrp.v2.MissingParameters;
import org.oasis.wsrp.v2.OperationFailed;
-import org.oasis.wsrp.v2.OperationFailedFault;
import org.oasis.wsrp.v2.PerformBlockingInteraction;
import org.oasis.wsrp.v2.PortletStateChangeRequired;
-import org.oasis.wsrp.v2.PortletStateChangeRequiredFault;
import org.oasis.wsrp.v2.ReleaseSessions;
import org.oasis.wsrp.v2.ReturnAny;
import org.oasis.wsrp.v2.UnsupportedLocale;
import org.oasis.wsrp.v2.UnsupportedMimeType;
import org.oasis.wsrp.v2.UnsupportedMode;
-import org.oasis.wsrp.v2.UnsupportedModeFault;
import org.oasis.wsrp.v2.UnsupportedWindowState;
-import org.oasis.wsrp.v2.UnsupportedWindowStateFault;
import javax.portlet.PortletModeException;
import javax.portlet.WindowStateException;
@@ -96,8 +92,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Could not render portlet '" + handle + "'", e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Could not render portlet '" + handle + "'", e);
}
checkForError(response);
@@ -123,13 +118,11 @@
}
catch (PortletStateChangeRequiredException e)
{
- throw WSRPExceptionFactory.<PortletStateChangeRequired, PortletStateChangeRequiredFault>throwWSException(WSRPExceptionFactory.PORTLET_STATE_CHANGE_REQUIRED,
- e.getLocalizedMessage(), e);
+ throw WSRPExceptionFactory.throwWSException(PortletStateChangeRequired.class, e.getLocalizedMessage(), e);
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Could not perform action on portlet '" + handle + "'", e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Could not perform action on portlet '" + handle + "'", e);
}
checkForError(response);
@@ -159,7 +152,7 @@
static void throwOperationFaultOnSessionOperation() throws OperationFailed
{
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED, "JBoss Portal's Producer" +
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "JBoss Portal's Producer" +
" manages sessions completely on the server side, passing or trying to release sessionIDs is therefore an error.",
null);
}
@@ -173,25 +166,21 @@
Throwable cause = errorResult.getCause();
if (cause instanceof PortletModeException)
{
- throw WSRPExceptionFactory.<UnsupportedMode, UnsupportedModeFault>throwWSException(WSRPExceptionFactory.UNSUPPORTED_MODE,
- "Unsupported mode: " + ((PortletModeException)cause).getMode(), null);
+ throw WSRPExceptionFactory.throwWSException(UnsupportedMode.class, "Unsupported mode: " + ((PortletModeException)cause).getMode(), null);
}
if (cause instanceof WindowStateException)
{
- throw WSRPExceptionFactory.<UnsupportedWindowState, UnsupportedWindowStateFault>throwWSException(WSRPExceptionFactory.UNSUPPORTED_WINDOW_STATE,
- "Unsupported window state: " + ((WindowStateException)cause).getState(), null);
+ throw WSRPExceptionFactory.throwWSException(UnsupportedWindowState.class, "Unsupported window state: " + ((WindowStateException)cause).getState(), null);
}
// todo: deal with other exceptions
// we're not sure what happened so throw an OperationFailedFault
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- errorResult.getMessage(), cause);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, errorResult.getMessage(), cause);
}
else if (!(response instanceof HTTPRedirectionResponse || response instanceof FragmentResponse || response instanceof UpdateNavigationalStateResponse))
{
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Unsupported result type: " + response.getClass().getName(), null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Unsupported result type: " + response.getClass().getName(), null);
}
}
}
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/PortletManagementHandler.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/PortletManagementHandler.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/PortletManagementHandler.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -24,7 +24,6 @@
package org.gatein.wsrp.producer;
import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import org.gatein.common.i18n.LocalizedString;
import org.gatein.pc.api.InvalidPortletIdException;
@@ -53,14 +52,11 @@
import org.oasis.wsrp.v2.GetPortletProperties;
import org.oasis.wsrp.v2.GetPortletPropertyDescription;
import org.oasis.wsrp.v2.InconsistentParameters;
-import org.oasis.wsrp.v2.InconsistentParametersFault;
import org.oasis.wsrp.v2.InvalidHandle;
-import org.oasis.wsrp.v2.InvalidHandleFault;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.InvalidUserCategory;
import org.oasis.wsrp.v2.MissingParameters;
import org.oasis.wsrp.v2.OperationFailed;
-import org.oasis.wsrp.v2.OperationFailedFault;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
import org.oasis.wsrp.v2.PortletDescriptionResponse;
@@ -71,7 +67,6 @@
import org.oasis.wsrp.v2.ResetProperty;
import org.oasis.wsrp.v2.SetPortletProperties;
import org.oasis.wsrp.v2.UserContext;
-import org.w3c.dom.Element;
import java.util.ArrayList;
import java.util.Collections;
@@ -184,18 +179,15 @@
}
catch (NoSuchPortletException e)
{
- throw WSRPExceptionFactory.<InvalidHandle, InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Failed to create clone for portlet '" + portletContext.getPortletHandle(), e);
+ throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Failed to create clone for portlet '" + portletContext.getPortletHandle(), e);
}
catch (InvalidPortletIdException e)
{
- throw WSRPExceptionFactory.<InconsistentParameters, InconsistentParametersFault>throwWSException(WSRPExceptionFactory.INCONSISTENT_PARAMETERS,
- "Failed to create clone for portlet '" + portletContext.getPortletHandle(), e);
+ throw WSRPExceptionFactory.throwWSException(InconsistentParameters.class, "Failed to create clone for portlet '" + portletContext.getPortletHandle(), e);
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Failed to create clone for portlet '" + portletContext.getPortletHandle(), e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Failed to create clone for portlet '" + portletContext.getPortletHandle(), e);
}
finally
{
@@ -228,7 +220,7 @@
if (failuresNumber > 0)
{
// for each reason of failure, record the associated portlet handles, expecting one portlet handle per message
- Multimap<String,String> reasonToHandles = HashMultimap.create(failuresNumber, 1);
+ Multimap<String, String> reasonToHandles = HashMultimap.create(failuresNumber, 1);
for (DestroyCloneFailure failure : failuresList)
{
reasonToHandles.put(failure.getMessage(), failure.getPortletId());
@@ -250,8 +242,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Failed to destroy clones", e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Failed to destroy clones", e);
}
finally
{
@@ -323,18 +314,15 @@
}
catch (NoSuchPortletException e)
{
- throw WSRPExceptionFactory.<InvalidHandle, InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Failed to set properties for portlet '" + portletContext.getPortletHandle() + "'", e);
+ throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Failed to set properties for portlet '" + portletContext.getPortletHandle() + "'", e);
}
catch (InvalidPortletIdException e)
{
- throw WSRPExceptionFactory.<InconsistentParameters, InconsistentParametersFault>throwWSException(WSRPExceptionFactory.INCONSISTENT_PARAMETERS,
- "Failed to set properties for portlet '" + portletContext.getPortletHandle() + "'", e);
+ throw WSRPExceptionFactory.throwWSException(InconsistentParameters.class, "Failed to set properties for portlet '" + portletContext.getPortletHandle() + "'", e);
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Failed to set properties for portlet '" + portletContext.getPortletHandle() + "'", e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Failed to set properties for portlet '" + portletContext.getPortletHandle() + "'", e);
}
finally
{
@@ -411,8 +399,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.<InvalidHandle, InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Could not retrieve properties for portlet '" + portletContext + "'", e);
+ throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Could not retrieve properties for portlet '" + portletContext + "'", e);
}
finally
{
@@ -440,8 +427,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.<InvalidHandle, InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Could not retrieve portlet '" + portletContext.getPortletHandle() + "'", e);
+ throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Could not retrieve portlet '" + portletContext.getPortletHandle() + "'", e);
}
finally
{
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RegistrationHandler.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RegistrationHandler.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RegistrationHandler.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -38,11 +38,9 @@
import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.producer.config.ProducerRegistrationRequirements;
import org.oasis.wsrp.v2.InvalidRegistration;
-import org.oasis.wsrp.v2.InvalidRegistrationFault;
import org.oasis.wsrp.v2.MissingParameters;
import org.oasis.wsrp.v2.ModifyRegistration;
import org.oasis.wsrp.v2.OperationFailed;
-import org.oasis.wsrp.v2.OperationFailedFault;
import org.oasis.wsrp.v2.Property;
import org.oasis.wsrp.v2.RegistrationContext;
import org.oasis.wsrp.v2.RegistrationData;
@@ -96,8 +94,7 @@
{
String msg = "Could not register consumer named '" + consumerName + "'";
log.debug(msg, e);
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- msg, e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, msg, e);
}
RegistrationContext registrationContext = WSRPTypeFactory.createRegistrationContext(registration.getRegistrationHandle());
@@ -105,8 +102,7 @@
return registrationContext;
}
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Registration shouldn't be attempted if registration is not required", null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Registration shouldn't be attempted if registration is not required", null);
}
private void updateRegistrationInformation(Registration registration, RegistrationData registrationData)
@@ -173,15 +169,13 @@
catch (RegistrationException e)
{
log.debug(msg, e);
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- msg, e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, msg, e);
}
return new ReturnAny();
}
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Deregistration shouldn't be attempted if registration is not required", null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Deregistration shouldn't be attempted if registration is not required", null);
}
public RegistrationState modifyRegistration(ModifyRegistration modifyRegistration) throws MissingParameters,
@@ -231,8 +225,7 @@
catch (RegistrationException e)
{
log.debug(msg, e);
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- msg, e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, msg, e);
}
@@ -240,8 +233,7 @@
return null;
}
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Modifying a registration shouldn't be attempted if registration is not required", null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Modifying a registration shouldn't be attempted if registration is not required", null);
}
/**
@@ -340,13 +332,12 @@
private void throwOperationFailedFault(String message, RegistrationException e) throws OperationFailed
{
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED, message, e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, message, e);
}
boolean throwInvalidRegistrationFault(String message) throws InvalidRegistration
{
- throw WSRPExceptionFactory.<InvalidRegistration, InvalidRegistrationFault>throwWSException(WSRPExceptionFactory.INVALID_REGISTRATION,
- "Invalid registration: " + message, null);
+ throw WSRPExceptionFactory.throwWSException(InvalidRegistration.class, "Invalid registration: " + message, null);
}
private Map<QName, Object> createRegistrationProperties(RegistrationData registrationData)
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RequestProcessor.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RequestProcessor.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RequestProcessor.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -51,18 +51,14 @@
import org.oasis.wsrp.v2.NamedString;
import org.oasis.wsrp.v2.NavigationalContext;
import org.oasis.wsrp.v2.OperationFailed;
-import org.oasis.wsrp.v2.OperationFailedFault;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
import org.oasis.wsrp.v2.RegistrationContext;
import org.oasis.wsrp.v2.RuntimeContext;
import org.oasis.wsrp.v2.SessionParams;
import org.oasis.wsrp.v2.UnsupportedMimeType;
-import org.oasis.wsrp.v2.UnsupportedMimeTypeFault;
import org.oasis.wsrp.v2.UnsupportedMode;
-import org.oasis.wsrp.v2.UnsupportedModeFault;
import org.oasis.wsrp.v2.UnsupportedWindowState;
-import org.oasis.wsrp.v2.UnsupportedWindowStateFault;
import java.security.Principal;
import java.util.Collections;
@@ -123,8 +119,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Could not retrieve portlet '" + portletContext + "'", e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Could not retrieve portlet '" + portletContext + "'", e);
}
// get portlet description for the desired portlet...
@@ -132,8 +127,7 @@
portletDescription = producer.getPortletDescription(portlet, desiredLocales);
if (Boolean.TRUE.equals(portletDescription.isUsesMethodGet()))
{
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Portlets using GET method in forms are not currently supported.", null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Portlets using GET method in forms are not currently supported.", null);
}
List<MarkupType> markupTypes = portletDescription.getMarkupTypes();
@@ -247,8 +241,7 @@
// no MIME type was found: error!
if (markupType == null)
{
- throw WSRPExceptionFactory.<UnsupportedMimeType, UnsupportedMimeTypeFault>throwWSException(WSRPExceptionFactory.UNSUPPORTED_MIME_TYPE,
- "None of the specified MIME types are supported by portlet '" + portlet.getContext().getId() + "'", null);
+ throw WSRPExceptionFactory.throwWSException(UnsupportedMimeType.class, "None of the specified MIME types are supported by portlet '" + portlet.getContext().getId() + "'", null);
}
// use user-desired locales
@@ -298,8 +291,7 @@
}
catch (IllegalArgumentException e)
{
- throw WSRPExceptionFactory.<UnsupportedMode, UnsupportedModeFault>throwWSException(WSRPExceptionFactory.UNSUPPORTED_MODE,
- "Unsupported mode '" + params.getMode() + "'", e);
+ throw WSRPExceptionFactory.throwWSException(UnsupportedMode.class, "Unsupported mode '" + params.getMode() + "'", e);
}
// get the window state
@@ -310,8 +302,7 @@
}
catch (IllegalArgumentException e)
{
- throw WSRPExceptionFactory.<UnsupportedWindowState, UnsupportedWindowStateFault>throwWSException(WSRPExceptionFactory.UNSUPPORTED_WINDOW_STATE,
- "Unsupported window state '" + params.getMode() + "'", e);
+ throw WSRPExceptionFactory.throwWSException(UnsupportedWindowState.class, "Unsupported window state '" + params.getMode() + "'", e);
}
// get the character set
@@ -484,8 +475,7 @@
}
catch (IllegalArgumentException e)
{
- throw WSRPExceptionFactory.<UnsupportedMimeType, UnsupportedMimeTypeFault>throwWSException(WSRPExceptionFactory.UNSUPPORTED_MIME_TYPE,
- e.getLocalizedMessage(), e);
+ throw WSRPExceptionFactory.throwWSException(UnsupportedMimeType.class, e.getLocalizedMessage(), e);
}
return markupInfo;
}
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ServiceDescriptionHandler.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ServiceDescriptionHandler.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ServiceDescriptionHandler.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -45,7 +45,6 @@
import org.oasis.wsrp.v2.MarkupType;
import org.oasis.wsrp.v2.ModelDescription;
import org.oasis.wsrp.v2.OperationFailed;
-import org.oasis.wsrp.v2.OperationFailedFault;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
import org.oasis.wsrp.v2.RegistrationContext;
@@ -158,7 +157,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.<OperationFailed, OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED, "Could not retrieve portlet '" + portletContext + "'", e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Could not retrieve portlet '" + portletContext + "'", e);
}
}
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java 2010-06-07 11:21:25 UTC (rev 3237)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java 2010-06-07 15:25:49 UTC (rev 3238)
@@ -52,7 +52,6 @@
import org.oasis.wsrp.v2.InitCookie;
import org.oasis.wsrp.v2.InvalidCookie;
import org.oasis.wsrp.v2.InvalidHandle;
-import org.oasis.wsrp.v2.InvalidHandleFault;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.InvalidSession;
import org.oasis.wsrp.v2.InvalidUserCategory;
@@ -373,8 +372,7 @@
}
catch (NoSuchPortletException e)
{
- throw WSRPExceptionFactory.<InvalidHandle, InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Couldn't find portlet with handle '" + portletContext.getId() + "'", null);
+ throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Couldn't find portlet with handle '" + portletContext.getId() + "'", null);
}
finally
{
@@ -383,8 +381,7 @@
if (!isRemotable(portlet))
{
- throw WSRPExceptionFactory.<InvalidHandle, InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Portlet '" + portletContext.getId() + "' is not remotely available.", null);
+ throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Portlet '" + portletContext.getId() + "' is not remotely available.", null);
}
return portlet;
14 years, 6 months
gatein SVN: r3236 - in portal/trunk/component/portal/src/test: resources/portal/portal/test and 1 other directory.
by do-not-reply@jboss.org
Author: hoang_to
Date: 2010-06-07 05:19:05 -0400 (Mon, 07 Jun 2010)
New Revision: 3236
Added:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestMovedPOM.java
Modified:
portal/trunk/component/portal/src/test/resources/portal/portal/test/pages.xml
Log:
GTNPORTAL-1288: Add unit tests on moving child within page, site layout
Added: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestMovedPOM.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestMovedPOM.java (rev 0)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestMovedPOM.java 2010-06-07 09:19:05 UTC (rev 3236)
@@ -0,0 +1,228 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * 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.exoplatform.portal.config;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+
+/**
+ * @author <a href="mailto:hoang281283@gmail.com">Minh Hoang TO</a>
+ * @version $Id$
+ *
+ */
+public class TestMovedPOM extends AbstractPortalTest
+{
+
+ private DataStorage dataStorage;
+
+ private POMSessionManager sessionManager;
+
+ private POMSession session;
+
+ public TestMovedPOM(String name)
+ {
+ super(name);
+ }
+
+ private final static Map<String, String> MOVE_CHILD_IN_PAGE_SCENARIOS;
+
+ private final static Map<String, String> MOVE_CHILD_IN_PORTAL_SCENARIOS;
+
+ /**
+ * Moving child scenario 's parameters is a pair of source container and destination container
+ */
+ static{
+ MOVE_CHILD_IN_PAGE_SCENARIOS = new HashMap<String, String>();
+ MOVE_CHILD_IN_PORTAL_SCENARIOS = new HashMap<String, String>();
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ begin();
+ PortalContainer container = getContainer();
+ dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
+ sessionManager = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ session = sessionManager.openSession();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ session.close();
+ end();
+ super.tearDown();
+ }
+
+ public void testMoveChildInPage() throws Exception
+ {
+ Page page = dataStorage.getPage("portal::test::testMoveChild");
+ assertNotNull(page);
+
+ String testApplication = "application_test";
+ String testContainer = "container_test";
+ int scenarioIndex =0;
+
+ for(String srcContainer : MOVE_CHILD_IN_PAGE_SCENARIOS.keySet())
+ {
+ String dstContainer = MOVE_CHILD_IN_PAGE_SCENARIOS.get(srcContainer);
+ String scenarioName = "Test on page, scenario_" + scenarioIndex;
+
+ executeMoveChildInPageScenario(scenarioName, page, srcContainer, dstContainer, testApplication);
+ executeMoveChildInPageScenario(scenarioName, page, srcContainer, dstContainer, testContainer);
+
+ scenarioIndex++;
+ }
+ }
+
+ public void testMoveChildInPortal() throws Exception
+ {
+ PortalConfig portalConfig = dataStorage.getPortalConfig("test");
+ assertNotNull(portalConfig);
+
+ String testApplication = "site_layout_application_test";
+ String testContainer = "site_layout_container_test";
+
+ int scenarioIndex = 0;
+
+ for(String srcContainer : MOVE_CHILD_IN_PORTAL_SCENARIOS.keySet())
+ {
+ String dstContainer = MOVE_CHILD_IN_PORTAL_SCENARIOS.get(srcContainer);
+ String scenarioName = "Test on site layout, scenario_" + scenarioIndex;
+
+ executeMoveChildInSiteLayoutScenario(scenarioName, portalConfig, srcContainer, dstContainer, testApplication);
+ executeMoveChildInSiteLayoutScenario(scenarioName, portalConfig, srcContainer, dstContainer, testContainer);
+
+ scenarioIndex++;
+ }
+ }
+
+ public void executeMoveChildInSiteLayoutScenario(String scenarioName, PortalConfig portalConfig, String srcContainerName, String dstContainerName, String movedObjectName) throws Exception
+ {
+
+ }
+
+ private void executeMoveChildInPageScenario(String scenarioName, Page page, String srcContainerName, String dstContainerName, String movedObjectName) throws Exception
+ {
+ Container srcContainer = findDescendant(page, Container.class, srcContainerName);
+ Container dstContainer = findDescendant(page, Container.class, dstContainerName);
+ ModelObject movedObject = findDescendant(page, ModelObject.class, movedObjectName);
+
+ assertNotNull("Source container is null in " + scenarioName, srcContainer);
+ assertNotNull("Destination container is null in " + scenarioName, dstContainer);
+ assertNotNull("Moved object is null in " + scenarioName, movedObject);
+
+ moveChild(srcContainer, dstContainer, movedObject);
+ dataStorage.save(page);
+ page = dataStorage.getPage(page.getStorageId());
+
+ Container updatedSrcContainer = findDescendant(page, Container.class, srcContainerName);
+ Container updatedDstContainer = findDescendant(page, Container.class, dstContainerName);
+ ModelObject updatedMovedObject = findDescendant(page, ModelObject.class, movedObjectName);
+
+ assertFalse("Source container still contains moved child in " + scenarioName, checkChildExistence(updatedSrcContainer, movedObjectName));
+ assertTrue("Destination container does not contain moved child in " + scenarioName, checkChildExistence(updatedDstContainer, movedObjectName));
+
+ //Backup the moving changes, needed to run consecutive and pairwise independent scenariosc
+ moveChild(updatedDstContainer, updatedSrcContainer, updatedMovedObject);
+ dataStorage.save(page);
+ page = dataStorage.getPage(page.getStorageId());
+
+ }
+
+ private void moveChild(Container srcContainer, Container dstContainer, ModelObject modelObject) throws Exception
+ {
+ List<ModelObject> children = srcContainer.getChildren();
+ boolean found = false;
+
+ //Clone children list to avoid fail-fast iterator exception
+ for(ModelObject child : new ArrayList<ModelObject>(children))
+ {
+ if(modelObject.getStorageName().equals(modelObject.getStorageName()))
+ {
+ found = true;
+ children.remove(child);
+ break;
+ }
+ }
+
+ if(found)
+ {
+ dstContainer.getChildren().add(modelObject);
+ }
+ }
+
+ private boolean checkChildExistence(Container srcContainer, String childName)
+ {
+ for(ModelObject child : srcContainer.getChildren())
+ {
+ if(childName.equals(child.getStorageName()))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Find descendant by name and type
+ *
+ * @param <T>
+ * @param rootContainer
+ * @param clazz
+ * @param name
+ * @return
+ */
+ private <T> T findDescendant(Container rootContainer, Class<T> clazz, String name)
+ {
+ if(rootContainer.getStorageName().equals(name))
+ {
+ return (T)rootContainer;
+ }
+
+ for(ModelObject child : rootContainer.getChildren())
+ {
+ if(child.getStorageName().equals(name) && (clazz.isAssignableFrom(child.getClass())))
+ {
+ return (T)child;
+ }
+ else if(child instanceof Container)
+ {
+ T re = findDescendant((Container)child, clazz, name);
+ if(re != null)
+ {
+ return re;
+ }
+ }
+ }
+
+ return null;
+ }
+}
Modified: portal/trunk/component/portal/src/test/resources/portal/portal/test/pages.xml
===================================================================
--- portal/trunk/component/portal/src/test/resources/portal/portal/test/pages.xml 2010-06-07 07:44:53 UTC (rev 3235)
+++ portal/trunk/component/portal/src/test/resources/portal/portal/test/pages.xml 2010-06-07 09:19:05 UTC (rev 3236)
@@ -95,4 +95,36 @@
</container>
</page>
+ <page>
+ <page-id>portal::test::testMoveChild</page-id>
+ <owner-type>portal</owner-type>
+ <owner-id>test</owner-id>
+ <name>testMoveChild</name>
+ <title>testMoveChildTitle</title>
+ <factory-id>test_factory_id</factory-id>
+ <access-permissions>test_access_permissions</access-permissions>
+ <edit-permission>test_edit_permission</edit-permission>
+ <container>
+ <name>container_1</name>
+ <title>container_1_title</title>
+ <icon>container_1_icon</icon>
+ <description>container_1_description</description>
+ </container>
+
+ <application>
+ <instance-id>portal#testMoveChild:/web/BannerPortlet/banner</instance-id>
+ <application-type>application_1_type</application-type>
+ <title>application_1_title</title>
+ <access-permissions>application_1_access_permissions</access-permissions>
+ <description>application_1_description</description>
+ </application>
+
+ <container>
+ <name>container_2</name>
+ <title>container_2_title</title>
+ <icon>container_2_icon</icon>
+ <description>container_2_description</description>
+ </container>
+
+ </page>
</page-set>
14 years, 6 months
gatein SVN: r3235 - portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal.
by do-not-reply@jboss.org
Author: kien_nguyen
Date: 2010-06-07 03:44:53 -0400 (Mon, 07 Jun 2010)
New Revision: 3235
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
Log:
GTNPORTAL-1269 Always show skin which selected when add new
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2010-06-07 04:43:45 UTC (rev 3234)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2010-06-07 07:44:53 UTC (rev 3235)
@@ -216,12 +216,10 @@
for (String skin : skinService.getAvailableSkinNames())
{
SelectItemOption<String> skinOption = new SelectItemOption<String>(skin, skin);
- if (uiPortal.getSkin().equals(skin))
- {
- skinOption.setSelected(true);
- }
listSkin.add(skinOption);
}
+ listSkin.get(0).setSelected(true);
+
UIFormSelectBox uiSelectBox = new UIFormSelectBox(FIELD_SKIN, FIELD_SKIN, listSkin);
uiSettingSet.addUIFormInput(uiSelectBox);
14 years, 6 months