JBoss Portal SVN: r6966 - in trunk: core and 9 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-04-10 08:56:57 -0400 (Tue, 10 Apr 2007)
New Revision: 6966
Added:
trunk/web/.classpath
trunk/web/.project
Modified:
trunk/bridge/.classpath
trunk/core-samples/.classpath
trunk/core/.classpath
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml
trunk/jems/.classpath
trunk/portlet/.classpath
trunk/server/.classpath
trunk/theme/.classpath
trunk/web/
trunk/widget/.classpath
Log:
Eclipse update.
Removed unused stuff.
Modified: trunk/bridge/.classpath
===================================================================
--- trunk/bridge/.classpath 2007-04-10 10:57:09 UTC (rev 6965)
+++ trunk/bridge/.classpath 2007-04-10 12:56:57 UTC (rev 6966)
@@ -5,7 +5,7 @@
<classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-common.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-jmx.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-system.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-system.jar" sourcepath="/JBoss_AS_4.0.5/system/src/main"/>
<classpathentry kind="lib" path="/thirdparty/portals-bridges/lib/portals-bridges-common.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/api"/>
<classpathentry combineaccessrules="false" kind="src" path="/portlet"/>
Modified: trunk/core/.classpath
===================================================================
--- trunk/core/.classpath 2007-04-10 10:57:09 UTC (rev 6965)
+++ trunk/core/.classpath 2007-04-10 12:56:57 UTC (rev 6966)
@@ -50,5 +50,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/portlet-server"/>
<classpathentry kind="lib" path="/thirdparty/apache-xerces/lib/xml-apis.jar"/>
<classpathentry kind="lib" path="/thirdparty/freemarker/lib/freemarker.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/web"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-04-10 10:57:09 UTC (rev 6965)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-04-10 12:56:57 UTC (rev 6966)
@@ -644,22 +644,6 @@
optional-attribute-name="InstanceContainer"
proxy-type="attribute">portal:container=Instance</depends>
</mbean>
- <mbean
- code="org.jboss.portal.core.impl.model.content.generic.GenericContentProviderRegistry"
- name="portal:service=GenericContentProviderRegistry"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <depends
- optional-attribute-name="Registry"
- proxy-type="attribute">portal:service=ContentProviderRegistry</depends>
- <depends
- optional-attribute-name="CustomizationManager"
- proxy-type="attribute">portal:service=CustomizationManager</depends>
- <depends
- optional-attribute-name="InstanceContainer"
- proxy-type="attribute">portal:container=Instance</depends>
- </mbean>
<!-- Integrate identity -->
<mbean
Modified: trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml 2007-04-10 10:57:09 UTC (rev 6965)
+++ trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml 2007-04-10 12:56:57 UTC (rev 6966)
@@ -65,13 +65,6 @@
<value>divRenderer</value>
</property>
<!--
- | Set the default strategy name (used by the strategy interceptor), see also portal-strategies.xml
- -->
- <property>
- <name>layout.strategyId</name>
- <value>maximizedRegion</value>
- </property>
- <!--
| The default page name, if the property is not explicited then the default page name is "default"
-->
<property>
@@ -146,13 +139,6 @@
<value>divRenderer</value>
</property>
<!--
- | Set the default strategy name (used by the strategy interceptor), see also portal-strategies.xml
- -->
- <property>
- <name>layout.strategyId</name>
- <value>maximizedRegion</value>
- </property>
- <!--
| Set the dashboard property
-->
<property>
@@ -200,13 +186,6 @@
<value>divRenderer</value>
</property>
<!--
- | Set the default strategy name (used by the strategy interceptor), see also portal-strategies.xml
- -->
- <property>
- <name>layout.strategyId</name>
- <value>maximizedRegion</value>
- </property>
- <!--
| The default page name, if the property is not explicited then the default page name is "default"
-->
<property>
@@ -284,13 +263,6 @@
<value>divRenderer</value>
</property>
<!--
- | Set the default strategy name (used by the strategy interceptor), see also portal-strategies.xml
- -->
- <property>
- <name>layout.strategyId</name>
- <value>maximizedRegion</value>
- </property>
- <!--
| The default page name, if the property is not explicited then the default page name is "default"
-->
<property>
Modified: trunk/core-samples/.classpath
===================================================================
--- trunk/core-samples/.classpath 2007-04-10 10:57:09 UTC (rev 6965)
+++ trunk/core-samples/.classpath 2007-04-10 12:56:57 UTC (rev 6966)
@@ -11,5 +11,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/portlet"/>
<classpathentry combineaccessrules="false" kind="src" path="/theme"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-j2ee.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/apache-fileupload/lib/commons-fileupload.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/jems/.classpath
===================================================================
--- trunk/jems/.classpath 2007-04-10 10:57:09 UTC (rev 6965)
+++ trunk/jems/.classpath 2007-04-10 12:56:57 UTC (rev 6966)
@@ -20,7 +20,7 @@
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-common.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-j2ee.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-jmx.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-jmx.jar" sourcepath="/JBoss_AS_4.0.5/jmx/src/main"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-system.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jmx-invoker-adaptor-client.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/common"/>
Modified: trunk/portlet/.classpath
===================================================================
--- trunk/portlet/.classpath 2007-04-10 10:57:09 UTC (rev 6965)
+++ trunk/portlet/.classpath 2007-04-10 12:56:57 UTC (rev 6966)
@@ -25,5 +25,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/test"/>
<classpathentry combineaccessrules="false" kind="src" path="/api"/>
<classpathentry combineaccessrules="false" kind="src" path="/security"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/web"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/server/.classpath
===================================================================
--- trunk/server/.classpath 2007-04-10 10:57:09 UTC (rev 6965)
+++ trunk/server/.classpath 2007-04-10 12:56:57 UTC (rev 6966)
@@ -13,5 +13,7 @@
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-system.jar"/>
<classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/jems"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/web"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/backport-concurrent/lib/jboss-backport-concurrent.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/theme/.classpath
===================================================================
--- trunk/theme/.classpath 2007-04-10 10:57:09 UTC (rev 6965)
+++ trunk/theme/.classpath 2007-04-10 12:56:57 UTC (rev 6966)
@@ -18,5 +18,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/common"/>
<classpathentry combineaccessrules="false" kind="src" path="/portlet"/>
<classpathentry combineaccessrules="false" kind="src" path="/api"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/web"/>
<classpathentry kind="output" path="output/classes"/>
</classpath>
Property changes on: trunk/web
___________________________________________________________________
Name: svn:ignore
+ bin
output
Added: trunk/web/.classpath
===================================================================
--- trunk/web/.classpath (rev 0)
+++ trunk/web/.classpath 2007-04-10 12:56:57 UTC (rev 6966)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/web/.project
===================================================================
--- trunk/web/.project (rev 0)
+++ trunk/web/.project 2007-04-10 12:56:57 UTC (rev 6966)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>web</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Modified: trunk/widget/.classpath
===================================================================
--- trunk/widget/.classpath 2007-04-10 10:57:09 UTC (rev 6965)
+++ trunk/widget/.classpath 2007-04-10 12:56:57 UTC (rev 6966)
@@ -7,5 +7,6 @@
<classpathentry kind="lib" path="/thirdparty/apache-log4j/lib/log4j.jar"/>
<classpathentry kind="lib" path="/thirdparty/oswego-concurrent/lib/concurrent.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/backport-concurrent/lib/jboss-backport-concurrent.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 years, 2 months
JBoss Portal SVN: r6965 - trunk/core/src/main/org/jboss/portlet/content.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-04-10 06:57:09 -0400 (Tue, 10 Apr 2007)
New Revision: 6965
Modified:
trunk/core/src/main/org/jboss/portlet/content/ContentTypeRegistration.java
Log:
- [JBPORTAL-1332] unretister mbean correctly for content driven portlet
Modified: trunk/core/src/main/org/jboss/portlet/content/ContentTypeRegistration.java
===================================================================
--- trunk/core/src/main/org/jboss/portlet/content/ContentTypeRegistration.java 2007-04-10 02:44:49 UTC (rev 6964)
+++ trunk/core/src/main/org/jboss/portlet/content/ContentTypeRegistration.java 2007-04-10 10:57:09 UTC (rev 6965)
@@ -163,6 +163,8 @@
// Stop the mbean
MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
mbeanServer.invoke(scObjectName, "stop", new ObjectName[] {objectName} , new String[] {"javax.management.ObjectName"});
+
+ mbeanServer.unregisterMBean(objectName);
}
catch(Exception e)
{
17 years, 2 months
JBoss Portal SVN: r6964 - in trunk: cms and 14 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-04-09 22:44:49 -0400 (Mon, 09 Apr 2007)
New Revision: 6964
Added:
trunk/cms/src/main/org/jboss/portal/test/cms/security/
trunk/cms/src/main/org/jboss/portal/test/cms/security/IdentityDataLoader.java
trunk/cms/src/main/org/jboss/portal/test/cms/security/SecureCommandTestCase.java
trunk/cms/src/main/org/jboss/portal/test/cms/security/TestManageAccess.java
trunk/cms/src/main/org/jboss/portal/test/cms/security/TestReadAccess.java
trunk/cms/src/main/org/jboss/portal/test/cms/security/TestWriteAccess.java
trunk/cms/src/main/org/jboss/portal/test/cms/workflow/
trunk/cms/src/main/org/jboss/portal/test/cms/workflow/AbstractWorkflowTestCase.java
trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestApprovedPublish.java
trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestDeniedPublish.java
trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestWorkflowEnvironment.java
trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml
trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-workflow.xml
trunk/cms/src/resources/test/db-config.xml
trunk/cms/src/resources/test/domain-identity.hbm.xml
trunk/cms/src/resources/test/jbpm-ehcache.xml
trunk/cms/src/resources/test/jbpm-hibernate.cfg.xml
trunk/cms/src/resources/test/standardidentity-config.xml
Removed:
trunk/cms/src/main/org/jboss/portal/test/cms/commands/SecureCommandTestCase.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestSecureFileGet.java
Modified:
trunk/
trunk/cms/
trunk/cms/build.xml
trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java
trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ApprovalWorkflowInterceptor.java
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateNewVersionCommand.java
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetCommand.java
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetVersionsCommand.java
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/util/VersionUtil.java
trunk/cms/src/main/org/jboss/portal/cms/workflow/FinalizePublish.java
trunk/cms/src/main/org/jboss/portal/cms/workflow/PublishAssignmentHandler.java
trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java
trunk/cms/src/resources/hibernate/domain.hbm.xml
trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml
trunk/cms/src/resources/test/jcr/repository.xml
trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
trunk/workflow/src/resources/portal-workflow-sar/META-INF/jboss-service.xml
Log:
[JBPORTAL-1185],[JBPORTAL-1184],[JBPORTAL-1333]- CMS Security Tests, CMS Workflow Tests, CMS ACL Bug fixes
Property changes on: trunk
___________________________________________________________________
Name: svn:ignore
- .project
.classpath
thirdparty
eclipseBin
myworkspace
bin
+ .project
.classpath
thirdparty
eclipseBin
myworkspace
bin
*.settings
miscellaneous
Property changes on: trunk/cms
___________________________________________________________________
Name: svn:ignore
- output
bin
bin
*.log
+ output
bin
bin
*.log
*.sh
Modified: trunk/cms/build.xml
===================================================================
--- trunk/cms/build.xml 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/build.xml 2007-04-10 02:44:49 UTC (rev 6964)
@@ -382,13 +382,11 @@
</target>
<target name="tests" depends="init">
<execute-tests>
- <x-sysproperty>
-
-<!--
+ <x-sysproperty>
+ <!--
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>
--->
-
+ -->
</x-sysproperty>
<x-test>
<!-- general cms setup related tests -->
@@ -416,8 +414,14 @@
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderGet"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderUpdate"/>
- <!-- cms fine grained security related tests -->
- <!--test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestSecureFileGet"/-->
+ <!-- cms fine grained security related tests -->
+ <test todir="${test.reports}" name="org.jboss.portal.test.cms.security.TestReadAccess"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.cms.security.TestWriteAccess"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.cms.security.TestManageAccess"/>
+
+ <!-- cms workflow related tests -->
+ <test todir="${test.reports}" name="org.jboss.portal.test.cms.workflow.TestApprovedPublish"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.cms.workflow.TestDeniedPublish"/>
</x-test>
<x-classpath>
<path refid="apache.logging.classpath"/>
@@ -459,7 +463,12 @@
<path refid="jboss.cache.classpath"/>
<path refid="jgroups.jgroups.classpath"/>
<!-- fine grained security integration -->
- <path refid="jboss.portal-identity.classpath"/>
+ <path refid="jboss.portal-identity.classpath"/>
+ <path refid="jboss.portal-security.classpath"/>
+ <!-- workflow integration -->
+ <path refid="jbpm.jaronly.classpath"/>
+ <path refid="beanshell.beanshell.classpath"/>
+ <path refid="jboss.portal-workflow.classpath"/>
</x-classpath>
</execute-tests>
</target>
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -60,6 +60,7 @@
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.Role;
import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.jems.as.JNDI;
import org.apache.log4j.Logger;
/**
@@ -87,11 +88,27 @@
*
*/
private String jndiName = null;
+
+ /**
+ *
+ */
+ private JNDI.Binding jndiBinding = null;
/**
*
*/
private AuthorizationManager authorizationManager = null;
+
+ /**
+ *
+ */
+ private String cmsSessionFactory = null;
+
+
+ /**
+ *
+ */
+ private String identitySessionFactory = null;
/**
@@ -157,8 +174,44 @@
{
this.jndiName = jndiName;
}
+
+ /**
+ *
+ * @return
+ */
+ public String getIdentitySessionFactory()
+ {
+ return this.identitySessionFactory;
+ }
+
+ /**
+ *
+ * @param identitySessionFactory
+ */
+ public void setIdentitySessionFactory(String identitySessionFactory)
+ {
+ this.identitySessionFactory = identitySessionFactory;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getCmsSessionFactory()
+ {
+ return cmsSessionFactory;
+ }
/**
+ *
+ * @param cmsSessionFactory
+ */
+ public void setCmsSessionFactory(String cmsSessionFactory)
+ {
+ this.cmsSessionFactory = cmsSessionFactory;
+ }
+
+ /**
*
*/
protected Object invoke(JCRCommand invocation) throws Exception, InvocationException
@@ -179,10 +232,17 @@
PortalPermission cmsPermission = new CMSPermission(securityContext);
Session session = Tools.getOpenSession();
Transaction tx = session.beginTransaction();
- boolean allowAccess = this.authorizationManager.checkPermission(cmsPermission);
- tx.commit();
- Tools.closeSession(session);
-
+ boolean allowAccess = false;
+ try
+ {
+ allowAccess = this.authorizationManager.checkPermission(cmsPermission);
+ }
+ finally
+ {
+ tx.commit();
+ Tools.closeSession(session);
+ }
+
if (allowAccess)
{
Object response = invocation.invokeNext();
@@ -218,37 +278,41 @@
Object filteredResponse = response;
JCRCommand command = (JCRCommand)securityContext.getAttribute("command");
-
+ boolean success = true;
try
{
-
-
if (filteredResponse instanceof Folder)
{
Folder folder = (Folder)filteredResponse;
List filteredFolders = new ArrayList();
List filteredFiles = new ArrayList();
securityContext.removeAttribute("command");
- for (Iterator itr = folder.getFolders().iterator(); itr.hasNext();)
+ if(folder.getFolders()!=null)
{
- Folder cour = (Folder)itr.next();
- securityContext.setAttribute("applyFilter", cour.getBasePath());
- PortalPermission cmsPermission = new CMSPermission(securityContext);
- boolean allow = this.authorizationManager.checkPermission(cmsPermission);
- if (allow)
+ for (Iterator itr = folder.getFolders().iterator(); itr.hasNext();)
{
- filteredFolders.add(cour);
+ Folder cour = (Folder)itr.next();
+ securityContext.setAttribute("applyFilter", cour.getBasePath());
+ PortalPermission cmsPermission = new CMSPermission(securityContext);
+ boolean allow = this.authorizationManager.checkPermission(cmsPermission);
+ if (allow)
+ {
+ filteredFolders.add(cour);
+ }
}
}
- for (Iterator itr = folder.getFiles().iterator(); itr.hasNext();)
+ if(folder.getFiles()!=null)
{
- File cour = (File)itr.next();
- securityContext.setAttribute("applyFilter", cour.getBasePath());
- PortalPermission cmsPermission = new CMSPermission(securityContext);
- boolean allow = this.authorizationManager.checkPermission(cmsPermission);
- if (allow)
+ for (Iterator itr = folder.getFiles().iterator(); itr.hasNext();)
{
- filteredFiles.add(cour);
+ File cour = (File)itr.next();
+ securityContext.setAttribute("applyFilter", cour.getBasePath());
+ PortalPermission cmsPermission = new CMSPermission(securityContext);
+ boolean allow = this.authorizationManager.checkPermission(cmsPermission);
+ if (allow)
+ {
+ filteredFiles.add(cour);
+ }
}
}
folder.setFolders(filteredFolders);
@@ -274,11 +338,19 @@
}
catch (Exception e)
{
- tx.rollback();
+ success = false;
+ throw new RuntimeException(e);
}
finally
{
- tx.commit();
+ if(success)
+ {
+ tx.commit();
+ }
+ else
+ {
+ tx.rollback();
+ }
Tools.closeSession(session);
}
@@ -291,8 +363,14 @@
public void start() throws Exception
{
log.info("AuthorizationManager initialized=" + this.authorizationManager);
+
+ if(this.jndiName != null)
+ {
+ this.jndiBinding = new JNDI.Binding(jndiName, this);
+ this.jndiBinding.bind();
+ }
- Tools.init(this.jndiName);
+ Tools.init(this.cmsSessionFactory);
try
{
@@ -369,6 +447,20 @@
}
}
}
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void stop() throws Exception
+ {
+ if(this.jndiBinding != null)
+ {
+ this.jndiBinding.unbind();
+ this.jndiBinding = null;
+ }
+ Tools.destroy();
+ }
/**
* Parses and produces Permission objects for the default policy
@@ -423,7 +515,7 @@
//since this is at app start up and not on user thread...need to create a transaction context.
InitialContext context = new InitialContext();
- SessionFactory sessionFactory = (SessionFactory)context.lookup("java:/portal/IdentitySessionFactory");
+ SessionFactory sessionFactory = (SessionFactory)context.lookup(this.identitySessionFactory);
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
try
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ApprovalWorkflowInterceptor.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ApprovalWorkflowInterceptor.java 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ApprovalWorkflowInterceptor.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -35,6 +35,7 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.identity.User;
+import org.jboss.portal.jems.as.JNDI;
import org.jboss.portal.workflow.cms.ApprovePublish;
import org.jboss.portal.workflow.cms.Content;
@@ -48,6 +49,34 @@
*/
public class ApprovalWorkflowInterceptor extends CMSInterceptor
{
+ /**
+ *
+ */
+ private String jndiName = null;
+
+ /**
+ *
+ */
+ private JNDI.Binding jndiBinding = null;
+
+ /**
+ *
+ * @return
+ */
+ public String getJNDIName()
+ {
+ return this.jndiName;
+ }
+
+ /**
+ *
+ * @param jndiName
+ */
+ public void setJNDIName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
/**
*
*/
@@ -92,4 +121,30 @@
return returnVal;
}
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void start() throws Exception
+ {
+ if(this.jndiName != null)
+ {
+ this.jndiBinding = new JNDI.Binding(jndiName, this);
+ this.jndiBinding.bind();
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void stop() throws Exception
+ {
+ if(this.jndiBinding != null)
+ {
+ this.jndiBinding.unbind();
+ this.jndiBinding = null;
+ }
+ }
}
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -85,7 +85,6 @@
writeCommands.add(packageName+"FolderCreateCommand");
writeCommands.add(packageName+"FileUpdateCommand");
writeCommands.add(packageName+"StoreArchiveCommand");
- writeCommands.add(packageName+"ContentCreateNewVersionCommand");
writeCommands.add("org.jboss.portal.cms.impl.jcr.composite.NewFileCommand");
writeCommands.add("org.jboss.portal.cms.impl.jcr.composite.UpdateFileCommand");
@@ -94,7 +93,6 @@
manageCommands.add(packageName+"CopyCommand");
manageCommands.add(packageName+"DeleteCommand");
manageCommands.add(packageName+"MoveCommand");
- manageCommands.add(packageName+"RenameCommand");
}
@@ -295,11 +293,7 @@
else if(command instanceof MoveCommand)
{
path = ((MoveCommand)command).msFromPath;
- }
- else if(command instanceof RenameCommand)
- {
- path = ((RenameCommand)command).msPath;
- }
+ }
hasManageAccess = this.computeAccess(user,path,"manage");
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateNewVersionCommand.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateNewVersionCommand.java 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateNewVersionCommand.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -36,7 +36,7 @@
/**
* Creates a new version of the content and labels it "LIVE".
- *
+ *
* @author <a href="mailto:roy@jboss.org">Roy Russo</a>
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
* @author Sohil Shah - sohil.shah(a)jboss.com
@@ -46,12 +46,15 @@
/** The serialVersionUID */
private static final long serialVersionUID = -4055346144913229565L;
+
List mContents = new ArrayList();
+
boolean bMakeLive;
/**
* @param content
- * @param bMakeLive Whether this updated version should be made "LIVE"
+ * @param bMakeLive
+ * Whether this updated version should be made "LIVE"
*/
public ContentCreateNewVersionCommand(Content content, boolean bMakeLive)
{
@@ -72,57 +75,60 @@
{
try
{
- Scope scope = this.context.scope;
-
+ Scope scope = this.context.scope;
+
// create versions
for (int i = 0; i < mContents.size(); i++)
{
- Content content = (Content)mContents.get(i);
- Node contentNode = (Node)context.getSession().getItem(content.getBasePath());
-
- //if the creator of this content is known, record it
- User user = (User)this.context.getAttribute(scope,"user");
- if(user != null)
+ Content content = (Content) mContents.get(i);
+ Node contentNode = (Node) context.getSession().getItem(
+ content.getBasePath());
+
+ // if the creator of this content is known, record it
+ User user = (User) this.context.getAttribute(scope, "user");
+ if (user != null)
{
- contentNode.setProperty("portalcms:user", user.getUserName());
+ contentNode.setProperty("portalcms:user", user.getUserName());
}
-
- contentNode.setProperty("portalcms:size", new StringValue(String.valueOf(content.getBytes().length)));
+
+ contentNode.setProperty("portalcms:size", new StringValue(String
+ .valueOf(content.getBytes().length)));
context.getSession().save();
-
- String processId = (String)context.getAttribute(scope, "processid");
-
- //integration of publish/approval workflow
- if(this.bMakeLive && processId != null && processId.trim().length() != 0)
- {
- //now save workflow related meta data on this version
- //so that this version can be processed later in the execution
- //of the workflow
- contentNode.setProperty("portalcms:processid",processId);
-
- //save
- context.getSession().save();
-
- //create a new version, but dont make it live
- VersionUtil.createVersion(contentNode,false);
+
+ String processId = (String) context
+ .getAttribute(scope, "processid");
+
+ // integration of publish/approval workflow
+ if (this.bMakeLive && processId != null
+ && processId.trim().length() != 0)
+ {
+ // now save workflow related meta data on this version
+ // so that this version can be processed later in the execution
+ // of the workflow
+ contentNode.setProperty("portalcms:processid", processId);
+
+ // save
+ context.getSession().save();
+
+ // create a new version, but dont make it live
+ VersionUtil.createVersion(contentNode, false);
}
else
{
- //remove any processid if they are present on the node
- contentNode.setProperty("portalcms:processid",(String)null);
- contentNode.save();
-
- //not asking to publish the content...no workflow needed
- //even if its activated
- VersionUtil.createVersion(contentNode, this.bMakeLive);
+ // remove any processid if they are present on the node
+ contentNode.setProperty("portalcms:processid", (String) null);
+ contentNode.save();
+
+ // not asking to publish the content...no workflow needed
+ // even if its activated
+ VersionUtil.createVersion(contentNode, this.bMakeLive);
}
}
-
-
+
context.getSession().save();
}
catch (Exception e)
- {
+ {
e.printStackTrace();
throw new RuntimeException(e);
}
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetCommand.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetCommand.java 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetCommand.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -27,6 +27,7 @@
import org.jboss.portal.cms.model.Content;
import org.jboss.portal.cms.util.FileUtil;
import org.jboss.logging.Logger;
+import org.jboss.portal.cms.impl.jcr.util.VersionUtil;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
@@ -106,7 +107,13 @@
{
contentNode = (Node)session.getItem(content.getBasePath());
VersionHistory vh = contentNode.getVersionHistory();
- Version version = vh.getVersionByLabel("LIVE");
+ Version version = VersionUtil.getLiveVersion(vh);
+
+ if(version == null)
+ {
+ return null;
+ }
+
NodeIterator ni = version.getNodes();
contentNode = ni.nextNode();
content.setCreationDate(version.getCreated().getTime());
@@ -118,7 +125,7 @@
else // get version #(?)
{
VersionHistory vh = contentNode.getVersionHistory();
- Version liveVersion = vh.getVersionByLabel("LIVE");
+ Version liveVersion = VersionUtil.getLiveVersion(vh);
VersionIterator vi = vh.getAllVersions();
while (vi.hasNext())
@@ -132,7 +139,7 @@
content.setVersionNumber(version.getName());
content.setVersionPath(version.getPath());
content.setVersionUUID(version.getUUID());
- if (liveVersion.getName().equals(version.getName())) // check if this version is the live one.
+ if(liveVersion != null && liveVersion.getName().equals(version.getName())) // check if this version is the live one.
{
content.setLive(true);
}
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetVersionsCommand.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetVersionsCommand.java 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetVersionsCommand.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -25,6 +25,7 @@
import org.jboss.portal.cms.impl.ContentImpl;
import org.jboss.portal.cms.impl.jcr.JCRCommand;
import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.impl.jcr.util.VersionUtil;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
@@ -64,7 +65,10 @@
Node fileNode = (Node)session.getItem(this.msFilePath);
VersionHistory vh = fileNode.getVersionHistory();
- Version liveVersion = vh.getVersionByLabel("LIVE");
+
+ Version liveVersion = VersionUtil.getLiveVersion(vh);
+
+
Version rootVersion = vh.getRootVersion();
@@ -104,7 +108,7 @@
content.setCreationDate(version.getCreated().getTime());
content.setVersionNumber(version.getName());
- if (liveVersion.getName().equals(version.getName())) // check if this version is the live one.
+ if (liveVersion != null && liveVersion.getName().equals(version.getName())) // check if this version is the live one.
{
content.setLive(true);
}
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/util/VersionUtil.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/util/VersionUtil.java 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/util/VersionUtil.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -216,4 +216,25 @@
e.printStackTrace();
}
}
+
+ /**
+ *
+ * @param history
+ * @return
+ */
+ public static Version getLiveVersion(VersionHistory history)
+ {
+ Version liveVersion = null;
+
+ try
+ {
+ liveVersion = history.getVersionByLabel("LIVE");
+ }
+ catch(Exception e)
+ {
+ liveVersion = null;
+ }
+
+ return liveVersion;
+ }
}
Modified: trunk/cms/src/main/org/jboss/portal/cms/workflow/FinalizePublish.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/workflow/FinalizePublish.java 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/src/main/org/jboss/portal/cms/workflow/FinalizePublish.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -51,22 +51,8 @@
/**
*
*/
- private static Logger log = Logger.getLogger(FinalizePublish.class);
- private static CMS cms = null;
+ private static Logger log = Logger.getLogger(FinalizePublish.class);
- static
- {
- try
- {
- cms = (CMS)new InitialContext().lookup("java:portal/CMS");
- }
- catch (NamingException e)
- {
- log.error("Cannot obtain CMS from JNDI: ", e);
- cms = null;
- }
- }
-
/**
*
*/
@@ -75,6 +61,7 @@
Content content = (Content)executionContext.getContextInstance().getVariable("content");
boolean approved = ((Boolean)executionContext.getContextInstance().getVariable("approved")).booleanValue();
long processId = executionContext.getProcessInstance().getId();
+ CMS cms = this.getCMSService();
if(approved)
{
@@ -144,4 +131,20 @@
return content;
}
+
+ /**
+ *
+ * @return
+ */
+ private CMS getCMSService()
+ {
+ try
+ {
+ return (CMS)new InitialContext().lookup("java:/portal/CMS");
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
}
Modified: trunk/cms/src/main/org/jboss/portal/cms/workflow/PublishAssignmentHandler.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/workflow/PublishAssignmentHandler.java 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/src/main/org/jboss/portal/cms/workflow/PublishAssignmentHandler.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -60,38 +60,6 @@
{
private static Logger log = Logger.getLogger(PublishAssignmentHandler.class);
- /*private static MailModule mailModule = null;
-
- private static IdentityServiceController identityServiceController = null;
- private static MembershipModule membershipModule = null;
- private static UserModule userModule = null;
- private static RoleModule roleModule = null;
- private static UserProfileModule profileModule = null;
- static
- {
- try
- {
- InitialContext context = new InitialContext();
- mailModule = (MailModule)context.lookup("java:portal/MailModule");
-
- identityServiceController = (IdentityServiceController)context.
- lookup("java:/portal/IdentityServiceController");
- membershipModule = (MembershipModule)identityServiceController.getIdentityContext().
- getObject(IdentityContext.TYPE_MEMBERSHIP_MODULE);
- userModule = (UserModule)identityServiceController.getIdentityContext().
- getObject(IdentityContext.TYPE_USER_MODULE);
- roleModule = (RoleModule)identityServiceController.getIdentityContext().
- getObject(IdentityContext.TYPE_ROLE_MODULE);
- profileModule = (UserProfileModule)identityServiceController.getIdentityContext().
- getObject(IdentityContext.TYPE_USER_PROFILE_MODULE);
- }
- catch(Exception e)
- {
- //mailModule = null;
- throw new RuntimeException(e);
- }
- }*/
-
/**
*
*/
@@ -121,58 +89,5 @@
}
}
}
- }
-
- //Now that the Manager Approval/Denial GUI is integrated..no need to use the email
- //as the Manager screen
- /**
- *
- * @param email
- */
- /*private void notifyManagers(ExecutionContext executionContext,String managerRole)
- {
- try
- {
- Set users = membershipModule.getUsers(roleModule.findRoleByName(managerRole));
- if(users != null)
- {
- for(Iterator itr=users.iterator();itr.hasNext();)
- {
- User user = (User)itr.next();
- String email = (String)profileModule.getProperty(user, User.INFO_USER_EMAIL_REAL);
- long processId = executionContext.getProcessInstance().getId();
- String from = (String)executionContext.getContextInstance().getVariable("from");
- String to = email;
- String subject = (String)executionContext.getContextInstance().getVariable("subject");
- String body = (String)executionContext.getContextInstance().getVariable("body");
- Content content = (Content)executionContext.getContextInstance().getVariable("content");
-
- Object[] arguments =
- {
- content.getPath(),
- content.getMimeType(),
- content.getSizeStr(),
- content.getCreationDateStr(),
- content.getUserName(),
- String.valueOf(processId),
- URLEncoder.encode(email, "UTF-8"),
- String.valueOf(processId),
- URLEncoder.encode(email, "UTF-8")
- };
- body = MessageFormat.format(body, arguments);
-
- System.out.println("----------------------------------------");
- System.out.println("Notification being sent to----->"+to);
- System.out.println("----------------------------------------");
-
- //mailModule.send(from,to,subject,body);
- }
- }
- }
- catch(Exception e)
- {
- //eat it for now
- log.error(this, e);
- }
- }*/
+ }
}
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -47,6 +47,12 @@
/** . */
protected TestRuntimeContext runtimeContext;
+
+ /**
+ *
+ *
+ */
+ protected String configuration = "org/jboss/portal/cms/jboss-beans.xml";
public AbstractCMSTestCase()
{
@@ -64,10 +70,12 @@
public void setUp() throws Exception
{
- runtimeContext = new TestRuntimeContext("org/jboss/portal/cms/jboss-beans.xml");
- runtimeContext.addBean("TestBean", this);
+ //Bootstrapping low-level services needed by PortalCMS
+ runtimeContext = new TestRuntimeContext(this.configuration);
runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter);
runtimeContext.addBean("HibernateConfig", HibernateSupport.getConfig(dataSourceConfigParameter.getName()));
+
+ //Start the context
runtimeContext.start();
}
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -36,12 +36,12 @@
*
* @author <a href="mailto:sohil.shah@jboss.com">Sohil Shah</a>
*/
-public class AbstractCommandTestCase extends AbstractCMSTestCase
+public abstract class AbstractCommandTestCase extends AbstractCMSTestCase
{
/**
*
*/
- protected JCRCMS service;
+ protected JCRCMS service = null;
public AbstractCommandTestCase()
{
@@ -65,6 +65,7 @@
service.setConfig(config.getDocumentElement());
service.setRepositoryName("repo");
service.setHomeDir("repotest-" + dataSourceConfigParameter.getName());
+ service.setJNDIName("java:portal/CMS");
service.startService();
}
Deleted: trunk/cms/src/main/org/jboss/portal/test/cms/commands/SecureCommandTestCase.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/SecureCommandTestCase.java 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/SecureCommandTestCase.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -1,61 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.portal.test.cms.commands;
-
-import org.jboss.portal.cms.impl.interceptors.ACLInterceptor;
-import org.jboss.portal.common.invocation.Interceptor;
-import org.jboss.portal.server.impl.invocation.JBossInterceptorStack;
-
-/**
- *
- * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
- *
- */
-public class SecureCommandTestCase extends AbstractCommandTestCase
-{
- /**
- *
- *
- */
- public SecureCommandTestCase()
- {
- super();
- }
-
- /**
- *
- */
- public void setUp() throws Exception
- {
- super.setUp();
-
- //setup the interceptor stack
- CMSInterceptorStackFactory stackFactory = new CMSInterceptorStackFactory();
- ACLInterceptor aclInterceptor = new ACLInterceptor();
- Interceptor[] interceptors = new Interceptor[1];
- interceptors[0] = aclInterceptor;
- JBossInterceptorStack stack = new JBossInterceptorStack(interceptors);
- stackFactory.setInterceptorStack(stack);
-
- service.setStackFactory(stackFactory);
- }
-}
Deleted: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestSecureFileGet.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestSecureFileGet.java 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestSecureFileGet.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -1,104 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.cms.commands;
-
-import junit.framework.TestSuite;
-import org.jboss.portal.cms.CMSException;
-import org.jboss.portal.cms.Command;
-import org.jboss.portal.cms.impl.ContentImpl;
-import org.jboss.portal.cms.impl.FileImpl;
-import org.jboss.portal.cms.model.Content;
-import org.jboss.portal.cms.model.File;
-
-import java.util.Locale;
-import java.util.Map;
-
-
-/**
- *
- * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
- *
- */
-public class TestSecureFileGet extends SecureCommandTestCase
-{
- String rejectPath = "/default/private/license.html";
- String allowedPath = "/default/images/check.gif";
-
-
- /**
- *
- *
- */
- public TestSecureFileGet()
- {
- }
-
- /**
- *
- *
- */
- public static TestSuite suite() throws Exception
- {
- return createTestSuite(TestSecureFileGet.class);
- }
-
- /** Tests retrieval of the version labeled LIVE. */
- public void testFileGet() throws CMSException
- {
- //first run against non-access scenario
- try
- {
- Command getCMD = service.getCommandFactory().createFileGetCommand(rejectPath,Locale.ENGLISH);
- File newfile = (File)service.execute(getCMD);
- }
- catch(CMSException cme)
- {
- //assert and make sure access was not granted
- String cmeMessage = cme.toString();
- boolean accessGranted = true;
- if(cmeMessage.indexOf("Access to this resource is denied")!=-1)
- {
- accessGranted = false;
- }
- this.assertEquals(false,accessGranted);
- }
-
- //now run against scenario where access should be granted
- try
- {
- Command getCMD = service.getCommandFactory().createFileGetCommand(allowedPath,Locale.ENGLISH);
- File newfile = (File)service.execute(getCMD);
- }
- catch(CMSException cme)
- {
- //assert and make sure access was granted
- String cmeMessage = cme.toString();
- boolean accessGranted = true;
- if(cmeMessage.indexOf("Access to this resource is denied")!=-1)
- {
- accessGranted = false;
- }
- this.assertEquals(true,accessGranted);
- }
- }
-}
Added: trunk/cms/src/main/org/jboss/portal/test/cms/security/IdentityDataLoader.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/security/IdentityDataLoader.java (rev 0)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/security/IdentityDataLoader.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -0,0 +1,178 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.cms.security;
+
+import javax.naming.InitialContext;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.IdentityServiceController;
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.db.HibernateRoleImpl;
+import org.jboss.portal.identity.db.HibernateUserImpl;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class IdentityDataLoader
+{
+ /**
+ *
+ */
+ private IdentityServiceController identityServiceController = null;
+
+ /**
+ *
+ */
+ private String identitySessionFactory = null;
+
+ /**
+ *
+ * @return
+ */
+ public IdentityServiceController getIdentityServiceController()
+ {
+ return this.identityServiceController;
+ }
+
+ public void setIdentityServiceController(IdentityServiceController identityServiceController)
+ {
+ this.identityServiceController = identityServiceController;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getIdentitySessionFactory()
+ {
+ return identitySessionFactory;
+ }
+
+ /**
+ *
+ * @param identitySessionFactory
+ */
+ public void setIdentitySessionFactory(String identitySessionFactory)
+ {
+ this.identitySessionFactory = identitySessionFactory;
+ }
+
+ /**
+ *
+ *
+ */
+ public IdentityDataLoader()
+ {
+
+ }
+
+ /**
+ *
+ *
+ */
+ public void start() throws Exception
+ {
+ SessionFactory sessionFactory = (SessionFactory)new InitialContext().lookup(this.identitySessionFactory);
+ this.loadData(sessionFactory,this.identityServiceController);
+ }
+
+ /**
+ *
+ */
+ public void stop() throws Exception
+ {
+ }
+
+ /**
+ *
+ *
+ */
+ private void loadData(SessionFactory sessionFactory,IdentityServiceController service) throws Exception
+ {
+ UserModule userModule = (UserModule)service.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
+
+ Session session = sessionFactory.openSession();
+ Transaction tx = session.beginTransaction();
+ boolean success = false;
+ try
+ {
+ if(userModule.getUserCount()==0)
+ {
+ //
+ HibernateRoleImpl adminRole = new HibernateRoleImpl("Admin", "Administrators");
+ HibernateRoleImpl userRole = new HibernateRoleImpl("User", "Users");
+
+ //
+ HibernateUserImpl admin = new HibernateUserImpl("admin");
+ admin.setPassword(org.jboss.portal.common.util.Tools.md5AsHexString("admin"));
+ admin.setRealEmail("admin(a)portal.com");
+ admin.setViewRealEmail(true);
+ admin.setEnabled(true);
+
+ //
+ admin.getRoles().add(adminRole);
+ adminRole.getUsers().add(admin);
+
+ //
+ HibernateUserImpl user = new HibernateUserImpl("user");
+ user.setPassword(org.jboss.portal.common.util.Tools.md5AsHexString("user"));
+ user.setRealEmail("user(a)portal.com");
+ user.setViewRealEmail(true);
+ user.setEnabled(true);
+
+ //
+ user.getRoles().add(userRole);
+ userRole.getUsers().add(user);
+
+ //
+ session.save(adminRole);
+ session.save(userRole);
+ session.save(admin);
+ session.save(user);
+
+ success = true;
+ }
+ }
+ finally
+ {
+ if(tx != null)
+ {
+ if(success)
+ {
+ tx.commit();
+ }
+ else
+ {
+ tx.rollback();
+ }
+ }
+ if(session != null)
+ {
+ session.close();
+ }
+ }
+ }
+}
Added: trunk/cms/src/main/org/jboss/portal/test/cms/security/SecureCommandTestCase.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/security/SecureCommandTestCase.java (rev 0)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/security/SecureCommandTestCase.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -0,0 +1,112 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.portal.test.cms.security;
+
+import javax.naming.InitialContext;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.jboss.portal.cms.impl.interceptors.ACLInterceptor;
+import org.jboss.portal.cms.impl.jcr.JCRCMS;
+import org.jboss.portal.cms.security.AuthorizationProviderImpl;
+import org.jboss.portal.common.invocation.Interceptor;
+import org.jboss.portal.identity.IdentityServiceController;
+import org.jboss.portal.server.impl.invocation.JBossInterceptorStack;
+
+import org.jboss.portal.test.cms.commands.AbstractCommandTestCase;
+import org.jboss.portal.test.cms.commands.CMSInterceptorStackFactory;
+
+/**
+ *
+ * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
+ *
+ */
+public abstract class SecureCommandTestCase extends AbstractCommandTestCase
+{
+ /**
+ *
+ */
+ public SecureCommandTestCase()
+ {
+ super();
+ }
+
+ /**
+ *
+ */
+ public void setUp() throws Exception
+ {
+ //override the configration location to include workflow services
+ this.configuration = "org/jboss/portal/cms/jboss-beans-security.xml";
+ super.setUp();
+
+ ACLInterceptor aclInterceptor = this.getACLInterceptor();
+
+ //Setup the interceptor stack
+ CMSInterceptorStackFactory stackFactory = new CMSInterceptorStackFactory();
+ Interceptor[] interceptors = new Interceptor[1];
+ interceptors[0] = aclInterceptor;
+ JBossInterceptorStack stack = new JBossInterceptorStack(interceptors);
+ stackFactory.setInterceptorStack(stack);
+
+ this.service.setStackFactory(stackFactory);
+
+ //Register the IdentityService with the JCR service
+ IdentityServiceController identityService = ((AuthorizationProviderImpl)aclInterceptor.getAuthorizationManager().getProvider()).
+ getIdentityServiceController();
+ this.service.setIdentityServiceController(identityService);
+ }
+
+ /**
+ *
+ */
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ protected ACLInterceptor getACLInterceptor() throws Exception
+ {
+ ACLInterceptor aclInterceptor = (ACLInterceptor)new InitialContext().lookup("java:/portal/cms/ACLInterceptor");
+ return aclInterceptor;
+ }
+
+ /**
+ *
+ * @param username
+ */
+ protected void runAs(String username) throws Exception
+ {
+ SessionFactory sessionFactory = (SessionFactory)new InitialContext().lookup("java:/SessionFactory");
+ Session session = sessionFactory.openSession();
+ Transaction tx = session.beginTransaction();
+ JCRCMS.getUserInfo().set(this.service.getUserModule().findUserByUserName(username));
+ tx.commit();
+ session.close();
+ }
+}
\ No newline at end of file
Added: trunk/cms/src/main/org/jboss/portal/test/cms/security/TestManageAccess.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/security/TestManageAccess.java (rev 0)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/security/TestManageAccess.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -0,0 +1,249 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.cms.security;
+
+import junit.framework.TestSuite;
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.model.Folder;
+import org.jboss.portal.cms.impl.FolderImpl;
+
+
+import java.util.Date;
+
+/**
+ *
+ * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
+ *
+ */
+public class TestManageAccess extends SecureCommandTestCase
+{
+ String rejectPath = "/default/private";
+ String allowedPath = "/default/images";
+
+ /**
+ *
+ *
+ */
+ public TestManageAccess()
+ {
+ }
+
+ /**
+ *
+ *
+ */
+ public static TestSuite suite() throws Exception
+ {
+ return createTestSuite(TestManageAccess.class);
+ }
+
+ /**
+ *
+ * @return
+ */
+ private Folder getNewPublicFolder()
+ {
+ //create folder object
+ Folder folder = new FolderImpl();
+ folder.setCreationDate(new Date());
+ folder.setDescription("Folder Description");
+ folder.setTitle("Folder Title");
+ folder.setLastModified(new Date());
+ folder.setName("images");
+ folder.setBasePath(this.allowedPath);
+
+ return folder;
+ }
+
+ /**
+ *
+ * @return
+ */
+ private Folder getNewProtectedFolder()
+ {
+ //create folder object
+ Folder folder = new FolderImpl();
+ folder.setCreationDate(new Date());
+ folder.setDescription("Folder Description");
+ folder.setTitle("Folder Title");
+ folder.setLastModified(new Date());
+ folder.setName("private");
+ folder.setBasePath(this.rejectPath);
+
+ return folder;
+ }
+
+
+ /**
+ *
+ *
+ */
+ private void runManageScenario(Folder folder) throws CMSException
+ {
+ //Copy the specified folder
+ String copySrc = folder.getBasePath();
+ String copyDest = folder.getBasePath() + "/" + "copy";
+ Command copyCommand = this.service.getCommandFactory().createCopyCommand(copySrc,copyDest);
+ this.service.execute(copyCommand);
+
+ //Assert the copy execution
+ Command get = this.service.getCommandFactory().createFolderGetCommand(copySrc);
+ Folder copyFrom = (Folder)this.service.execute(get);
+ get = this.service.getCommandFactory().createFolderGetCommand(copyDest);
+ Folder copyTo = (Folder)this.service.execute(get);
+ assertNotNull(copyFrom);
+ assertNotNull(copyTo);
+
+ //Move a folder
+ String moveSrc = copyDest;
+ String moveDest = folder.getBasePath() + "/" + "move";
+ Command moveCommand = this.service.getCommandFactory().createMoveCommand(moveSrc,moveDest);
+ this.service.execute(moveCommand);
+
+ //Assert the move execution
+ get = this.service.getCommandFactory().createFolderGetCommand(moveSrc);
+ Folder moveFrom = (Folder)this.service.execute(get);
+ get = this.service.getCommandFactory().createFolderGetCommand(moveDest);
+ Folder moveTo = (Folder)this.service.execute(get);
+ assertNull(moveFrom);
+ assertNotNull(moveTo);
+
+ //Delete the folder
+ String delete = moveDest;
+ Command deleteCommand = this.service.getCommandFactory().createDeleteCommand(delete);
+ this.service.execute(deleteCommand);
+
+ //Assert delete execution
+ get = this.service.getCommandFactory().createFolderGetCommand(delete);
+ Folder deletedFolder = (Folder)this.service.execute(get);
+ assertNull(deletedFolder);
+ }
+
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testAnonymous() throws Exception
+ {
+ // first run against non-access scenario
+ try
+ {
+ this.runManageScenario(this.getNewProtectedFolder());
+ assertTrue("Access should not have been granted to" + this.rejectPath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") != -1);
+ }
+
+ // now run against scenario where access should be granted for a registered user
+ //for anonymous, this should still result in an access denied
+ try
+ {
+ this.runManageScenario(this.getNewPublicFolder());
+ assertTrue("Access should not have been granted to" + this.rejectPath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") != -1);
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testUser() throws Exception
+ {
+ this.runAs("user");
+
+ // first run against non-access scenario
+ try
+ {
+ this.runManageScenario(this.getNewProtectedFolder());
+ assertTrue("Access should not have been granted to" + this.rejectPath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") != -1);
+ }
+
+ // now run against scenario where access should be granted for a registered user
+ //for anonymous, this should still result in an access denied
+ try
+ {
+ this.runManageScenario(this.getNewPublicFolder());
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") != -1);
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testAdmin() throws Exception
+ {
+ this.runAs("admin");
+
+ // first run against non-access scenario
+ try
+ {
+ this.runManageScenario(this.getNewProtectedFolder());
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") == -1);
+ }
+
+ // now run against scenario where access should be granted for a registered user
+ //for anonymous, this should still result in an access denied
+ try
+ {
+ this.runManageScenario(this.getNewPublicFolder());
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") == -1);
+ }
+ }
+}
Added: trunk/cms/src/main/org/jboss/portal/test/cms/security/TestReadAccess.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/security/TestReadAccess.java (rev 0)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/security/TestReadAccess.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -0,0 +1,269 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.cms.security;
+
+import java.util.List;
+import junit.framework.TestSuite;
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.model.Folder;
+import org.jboss.portal.cms.model.File;
+
+import java.util.Locale;
+
+/**
+ *
+ * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
+ *
+ */
+public class TestReadAccess extends SecureCommandTestCase
+{
+ String rejectFolderPath = "/default/private";
+ String allowedFolderPath = "/default/images";
+ String rejectFilePath = "/default/private/license.html";
+ String allowedFilePath = "/default/images/check.gif";
+
+ /**
+ *
+ *
+ */
+ public TestReadAccess()
+ {
+ }
+
+ /**
+ *
+ *
+ */
+ public static TestSuite suite() throws Exception
+ {
+ return createTestSuite(TestReadAccess.class);
+ }
+
+
+ /**
+ *
+ *
+ */
+ private void runFileScenario(String filePath) throws CMSException
+ {
+ //Get the specified file
+ Command get = this.service.getCommandFactory().createFileGetCommand(filePath,new Locale(this.service.getDefaultLocale()));
+ File file = (File)this.service.execute(get);
+ assertNotNull(file);
+ assertEquals(file.getBasePath(),filePath);
+
+ //Get a list of file versions
+ get = this.service.getCommandFactory()
+ .createFileGetListCommand(filePath);
+ List versions = (List)this.service.execute(get);
+ assertNotNull(versions);
+ assertTrue(versions.size()>0);
+ }
+
+ /**
+ *
+ * @param folderPath
+ * @throws CMSException
+ */
+ private void runFolderScenario(String folderPath) throws CMSException
+ {
+ //Get the specified folder
+ Command get = this.service.getCommandFactory().createFolderGetCommand(folderPath);
+ Folder folder = (Folder)this.service.execute(get);
+ assertNotNull(folder);
+ assertEquals(folder.getBasePath(),folderPath);
+
+ //Get the specified folder list
+ get = this.service.getCommandFactory().createFolderGetListCommand(folderPath);
+ Folder folderList = (Folder)this.service.execute(get);
+ assertNotNull(folderList);
+ assertTrue(folderList.getFolders()!=null || folderList.getFiles()!=null);
+ }
+
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testAnonymous() throws Exception
+ {
+ try
+ {
+ this.runFileScenario(this.rejectFilePath);
+ assertTrue("Access should not have been granted to" + this.rejectFilePath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") != -1);
+ }
+
+ try
+ {
+ this.runFolderScenario(this.rejectFolderPath);
+ assertTrue("Access should not have been granted to" + this.rejectFolderPath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") != -1);
+ }
+
+ try
+ {
+ this.runFileScenario(this.allowedFilePath);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") == -1);
+ }
+
+ try
+ {
+ this.runFolderScenario(this.allowedFolderPath);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") == -1);
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testUser() throws Exception
+ {
+ this.runAs("user");
+
+ try
+ {
+ this.runFileScenario(this.rejectFilePath);
+ assertTrue("Access should not have been granted to" + this.rejectFilePath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") != -1);
+ }
+
+ try
+ {
+ this.runFolderScenario(this.rejectFolderPath);
+ assertTrue("Access should not have been granted to" + this.rejectFolderPath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") != -1);
+ }
+
+ try
+ {
+ this.runFileScenario(this.allowedFilePath);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") == -1);
+ }
+
+ try
+ {
+ this.runFolderScenario(this.allowedFolderPath);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") == -1);
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testAdmin() throws Exception
+ {
+ this.runAs("admin");
+
+ try
+ {
+ this.runFileScenario(this.rejectFilePath);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") == -1);
+ }
+
+ try
+ {
+ this.runFolderScenario(this.rejectFolderPath);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") == -1);
+ }
+
+ try
+ {
+ this.runFileScenario(this.allowedFilePath);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") == -1);
+ }
+
+ try
+ {
+ this.runFolderScenario(this.allowedFolderPath);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") == -1);
+ }
+ }
+}
Added: trunk/cms/src/main/org/jboss/portal/test/cms/security/TestWriteAccess.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/security/TestWriteAccess.java (rev 0)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/security/TestWriteAccess.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -0,0 +1,297 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.cms.security;
+
+import java.util.List;
+import junit.framework.TestSuite;
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.model.Folder;
+import org.jboss.portal.cms.impl.FolderImpl;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.impl.ContentImpl;
+import org.jboss.portal.cms.model.Content;
+
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ *
+ * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
+ *
+ */
+public class TestWriteAccess extends SecureCommandTestCase
+{
+ String rejectPath = "/default/private";
+ String allowedPath = "/default/images";
+
+ /**
+ *
+ *
+ */
+ public TestWriteAccess()
+ {
+ }
+
+ /**
+ *
+ *
+ */
+ public static TestSuite suite() throws Exception
+ {
+ return createTestSuite(TestWriteAccess.class);
+ }
+
+ /**
+ *
+ * @return
+ */
+ private Folder getNewPublicFolder()
+ {
+ //create folder object
+ Folder folder = new FolderImpl();
+ folder.setCreationDate(new Date());
+ folder.setDescription("Folder Description");
+ folder.setTitle("Folder Title");
+ folder.setLastModified(new Date());
+ folder.setName("Unit Test");
+ folder.setBasePath(this.allowedPath+"/"+folder.getName());
+
+ return folder;
+ }
+
+ /**
+ *
+ * @return
+ */
+ private Folder getNewProtectedFolder()
+ {
+ //create folder object
+ Folder folder = new FolderImpl();
+ folder.setCreationDate(new Date());
+ folder.setDescription("Folder Description");
+ folder.setTitle("Folder Title");
+ folder.setLastModified(new Date());
+ folder.setName("Unit Test");
+ folder.setBasePath(this.rejectPath+"/"+folder.getName());
+
+ return folder;
+ }
+
+ /**
+ *
+ * @param folder
+ * @return
+ */
+ private File getFile(Folder folder,String fileName,String data)
+ {
+ File file = new FileImpl();
+ file.setBasePath(folder.getBasePath()+"/"+fileName);
+
+ Content content = new ContentImpl();
+ content.setEncoding("UTF-8");
+ content.setTitle("English Title");
+ content.setDescription("English Description");
+ content.setBasePath(file.getBasePath() + "/" + Locale.ENGLISH.getLanguage());
+ content.setBytes(data.getBytes());
+ content.setMimeType("text/html");
+ file.setContent(Locale.ENGLISH, content);
+
+ return file;
+ }
+
+ /**
+ *
+ *
+ */
+ private void runWriteScenario(Folder folder) throws CMSException
+ {
+ //Create a new folder
+ Command newFolder = this.service.getCommandFactory().createFolderSaveCommand(folder);
+ this.service.execute(newFolder);
+
+ //Assert the successfull creation of the folder
+ Command get = service.getCommandFactory().createFolderGetCommand(folder.getBasePath());
+ Folder assertFolder = (Folder) service.execute(get);
+ assertNotNull(assertFolder);
+ assertEquals(folder.getDescription(),assertFolder.getDescription());
+ assertEquals(folder.getName(),assertFolder.getName());
+ assertEquals(folder.getBasePath(),assertFolder.getBasePath());
+
+ //Create a new file into the newly created folder
+ File file = this.getFile(assertFolder,"testFile.html","newdata");
+ Command newFile = this.service.getCommandFactory().createNewFileCommand(file,file.getContent());
+ this.service.execute(newFile);
+
+ //Assert the creation of the new file
+ get = this.service.getCommandFactory().createFileGetCommand(file.getBasePath(),file.getContent().getLocale());
+ File assertFile = (File)this.service.execute(get);
+ assertNotNull(assertFile);
+ assertEquals(file.getBasePath(),assertFile.getBasePath());
+ assertEquals(new String(file.getContent().getBytes()),new String(assertFile.getContent().getBytes()));
+
+ //Update the newly created file
+ file = assertFile;
+ file.getContent().setBytes(new String("updateddata").getBytes());
+ Command updateFile = this.service.getCommandFactory().createUpdateFileCommand(file,file.getContent(),true);
+ this.service.execute(updateFile);
+
+ //Assert the updated file
+ get = this.service.getCommandFactory().createFileGetCommand(file.getBasePath(),file.getContent().getLocale());
+ assertFile = (File)this.service.execute(get);
+ assertNotNull(assertFile);
+ assertEquals(file.getBasePath(),assertFile.getBasePath());
+ assertEquals(new String(file.getContent().getBytes()),new String(assertFile.getContent().getBytes()));
+
+ //Get the versions of the file
+ get = this.service.getCommandFactory().createContentGetVersionsCommand(file.getContent().getBasePath());
+ List before = (List)this.service.execute(get);
+
+ //Create a new version of this file
+ file = this.getFile(folder,"testFile.html","newversion");
+ Command fileUpdate = this.service.getCommandFactory().createFileUpdateCommand(file);
+ Command createNewVersion = this.service.getCommandFactory().createContentCreateNewVersionCommand(file.getContent(),true);
+ this.service.execute(fileUpdate);
+ this.service.execute(createNewVersion);
+
+ //Assert new version creation
+ get = this.service.getCommandFactory().createFileGetCommand(file.getBasePath(),file.getContent().getLocale());
+ assertFile = (File)this.service.execute(get);
+ assertNotNull(assertFile);
+ assertEquals(file.getBasePath(),assertFile.getBasePath());
+ assertEquals(new String(file.getContent().getBytes()),new String(assertFile.getContent().getBytes()));
+
+ //Assert number of versions after
+ get = this.service.getCommandFactory().createContentGetVersionsCommand(file.getContent().getBasePath());
+ List after = (List)this.service.execute(get);
+ assertEquals(before.size()+1,after.size());
+ }
+
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testAnonymous() throws Exception
+ {
+ // first run against non-access scenario
+ try
+ {
+ this.runWriteScenario(this.getNewProtectedFolder());
+ assertTrue("Access should not have been granted to" + this.rejectPath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") != -1);
+ }
+
+ // now run against scenario where access should be granted for a registered user
+ //for anonymous, this should still result in an access denied
+ try
+ {
+ this.runWriteScenario(this.getNewPublicFolder());
+ assertTrue("Access should not have been granted to" + this.rejectPath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") != -1);
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testUser() throws Exception
+ {
+ this.runAs("user");
+
+ // first run against non-access scenario
+ try
+ {
+ this.runWriteScenario(this.getNewProtectedFolder());
+ assertTrue("Access should not have been granted to" + this.rejectPath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") != -1);
+ }
+
+ // now run against scenario where access should be granted for a registered user
+ //for anonymous, this should still result in an access denied
+ try
+ {
+ this.runWriteScenario(this.getNewPublicFolder());
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") == -1);
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testAdmin() throws Exception
+ {
+ this.runAs("admin");
+
+ // first run against non-access scenario
+ try
+ {
+ this.runWriteScenario(this.getNewProtectedFolder());
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") == -1);
+ }
+
+ // now run against scenario where access should be granted for a registered user
+ //for anonymous, this should still result in an access denied
+ try
+ {
+ this.runWriteScenario(this.getNewPublicFolder());
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") == -1);
+ }
+ }
+}
Added: trunk/cms/src/main/org/jboss/portal/test/cms/workflow/AbstractWorkflowTestCase.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/workflow/AbstractWorkflowTestCase.java (rev 0)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/workflow/AbstractWorkflowTestCase.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -0,0 +1,185 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.portal.test.cms.workflow;
+
+import javax.naming.InitialContext;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.jboss.portal.cms.impl.interceptors.ApprovalWorkflowInterceptor;
+import org.jboss.portal.common.invocation.Interceptor;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.IdentityServiceController;
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.db.HibernateRoleImpl;
+import org.jboss.portal.identity.db.HibernateUserImpl;
+import org.jboss.portal.server.impl.invocation.JBossInterceptorStack;
+import org.jboss.portal.workflow.cms.ApprovePublish;
+import org.jboss.portal.workflow.cms.ApprovePublishImpl;
+
+import org.jboss.portal.test.cms.commands.AbstractCommandTestCase;
+import org.jboss.portal.test.cms.commands.CMSInterceptorStackFactory;
+
+/**
+ *
+ * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
+ *
+ */
+public abstract class AbstractWorkflowTestCase extends AbstractCommandTestCase
+{
+ /**
+ *
+ */
+ public AbstractWorkflowTestCase()
+ {
+ super();
+ }
+
+ /**
+ *
+ */
+ public void setUp() throws Exception
+ {
+ //override the configration location to include workflow services
+ this.configuration = "org/jboss/portal/cms/jboss-beans-workflow.xml";
+ super.setUp();
+
+ ApprovalWorkflowInterceptor workflowInterceptor = this.getApprovalWorkflowInterceptor();
+ ApprovePublish approvePublish = this.getApprovePublish();
+ IdentityServiceController identityService = ((ApprovePublishImpl)approvePublish).getIdentityServiceController();
+
+ //Setup bootstrapped Identity data into the Identity store
+ SessionFactory sessionFactory = (SessionFactory)new InitialContext().lookup("java:/SessionFactory");
+ this.loadData(sessionFactory,identityService);
+
+ //Setup the interceptor stack
+ CMSInterceptorStackFactory stackFactory = new CMSInterceptorStackFactory();
+ Interceptor[] interceptors = new Interceptor[1];
+ interceptors[0] = workflowInterceptor;
+ JBossInterceptorStack stack = new JBossInterceptorStack(interceptors);
+ stackFactory.setInterceptorStack(stack);
+
+ this.service.setStackFactory(stackFactory);
+ this.service.setApprovePublishWorkflow(approvePublish);
+ this.service.setIdentityServiceController(identityService);
+ }
+
+ /**
+ *
+ */
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ protected ApprovalWorkflowInterceptor getApprovalWorkflowInterceptor() throws Exception
+ {
+ ApprovalWorkflowInterceptor approvalWorkflowInterceptor = (ApprovalWorkflowInterceptor)new InitialContext().lookup("java:/portal/cms/ApprovalWorkflowInterceptor");
+ return approvalWorkflowInterceptor;
+ }
+
+ /**
+ *
+ * @return
+ * @throws Exception
+ */
+ protected ApprovePublish getApprovePublish() throws Exception
+ {
+ return (ApprovePublish)new InitialContext().lookup("java:/portal/ApprovePublishWorkflow");
+ }
+
+ /**
+ *
+ *
+ */
+ private void loadData(SessionFactory sessionFactory,IdentityServiceController service) throws Exception
+ {
+ UserModule userModule = (UserModule)service.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
+
+ Session session = sessionFactory.openSession();
+ Transaction tx = session.beginTransaction();
+ boolean success = false;
+ try
+ {
+ if(userModule.getUserCount()==0)
+ {
+ //
+ HibernateRoleImpl adminRole = new HibernateRoleImpl("Admin", "Administrators");
+ HibernateRoleImpl userRole = new HibernateRoleImpl("User", "Users");
+
+ //
+ HibernateUserImpl admin = new HibernateUserImpl("admin");
+ admin.setPassword(org.jboss.portal.common.util.Tools.md5AsHexString("admin"));
+ admin.setRealEmail("admin(a)portal.com");
+ admin.setViewRealEmail(true);
+ admin.setEnabled(true);
+
+ //
+ admin.getRoles().add(adminRole);
+ adminRole.getUsers().add(admin);
+
+ //
+ HibernateUserImpl user = new HibernateUserImpl("user");
+ user.setPassword(org.jboss.portal.common.util.Tools.md5AsHexString("user"));
+ user.setRealEmail("user(a)portal.com");
+ user.setViewRealEmail(true);
+ user.setEnabled(true);
+
+ //
+ user.getRoles().add(userRole);
+ userRole.getUsers().add(user);
+
+ //
+ session.save(adminRole);
+ session.save(userRole);
+ session.save(admin);
+ session.save(user);
+
+ success = true;
+ }
+ }
+ finally
+ {
+ if(tx != null)
+ {
+ if(success)
+ {
+ tx.commit();
+ }
+ else
+ {
+ tx.rollback();
+ }
+ }
+ if(session != null)
+ {
+ session.close();
+ }
+ }
+ }
+}
Added: trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestApprovedPublish.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestApprovedPublish.java (rev 0)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestApprovedPublish.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -0,0 +1,194 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.cms.workflow;
+
+import java.util.Locale;
+import java.util.Collection;
+import java.util.Set;
+import javax.naming.InitialContext;
+
+import org.hibernate.SessionFactory;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.impl.ContentImpl;
+import org.jboss.portal.workflow.cms.ApprovePublish;
+import org.jboss.portal.cms.impl.jcr.JCRCMS;
+
+/**
+ *
+ * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
+ *
+ */
+public class TestApprovedPublish extends AbstractWorkflowTestCase
+{
+ private String file = "/default/workflow.html";
+ private Transaction tx = null;
+ private Session session = null;
+
+ /**
+ *
+ *
+ */
+ public TestApprovedPublish()
+ {
+ }
+
+ /**
+ *
+ *
+ */
+ public static TestSuite suite() throws Exception
+ {
+ return createTestSuite(TestApprovedPublish.class);
+ }
+
+ /**
+ *
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ JCRCMS.turnOnWorkflow();
+
+ SessionFactory sessionFactory = (SessionFactory)new InitialContext().lookup("java:/SessionFactory");
+ this.session = sessionFactory.openSession();
+ this.tx = session.beginTransaction();
+ }
+
+ /**
+ *
+ */
+ public void tearDown() throws Exception
+ {
+ this.tx.commit();
+ this.session.close();
+
+ super.tearDown();
+ }
+
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void test() throws Exception
+ {
+ //Execute file creation as a regular user/non-manager
+ this.runAs("user");
+
+ //Add a new file to the CMS
+ File file = new FileImpl();
+ file.setBasePath(this.file);
+
+ Content content = new ContentImpl();
+ content.setEncoding("UTF-8");
+ content.setTitle("English Title");
+ content.setDescription("English Description");
+ content.setBasePath(this.file + "/" + Locale.ENGLISH.getLanguage());
+ content.setBytes("newdata".getBytes());
+ content.setMimeType("text/html");
+ file.setContent(Locale.ENGLISH, content);
+
+ Command newFileCommand = this.service.getCommandFactory().createNewFileCommand(file, content);
+ this.service.execute(newFileCommand);
+
+ //Make sure this resource is not published into the CMS yet
+ Command fileGet = this.service.getCommandFactory().createFileGetCommand(this.file, Locale.ENGLISH);
+ File assertFile = (File)this.service.execute(fileGet);
+ assertNull(assertFile.getContent());
+
+ //Check the pending queue for this file
+ ApprovePublish approvePublish = this.service.getApprovePublishWorkflow();
+ Collection queueItems = approvePublish.getPendingQueue(this.file);
+ assertNotNull(queueItems);
+ assertEquals(1,queueItems.size());
+
+ //Approve and publish this file into the CMS
+ Set managers = approvePublish.getManagers();
+ String manager = (String)managers.iterator().next();
+ org.jboss.portal.workflow.cms.Content pendingItem = (org.jboss.portal.workflow.cms.Content)queueItems.iterator().next();
+ approvePublish.processManagerResponse(Long.parseLong(pendingItem.getProcessId()), manager.toLowerCase(), true);
+
+ //Make sure this resource is successfully published into the CMS, and removed from the pending queue
+ assertFile = (File)this.service.execute(fileGet);
+ assertNotNull(assertFile.getContent());
+ assertTrue(assertFile.getContent().isLive());
+ assertFalse(assertFile.getContent().isWaitingForPublishApproval());
+ assertEquals(new String(assertFile.getContent().getBytes()),"newdata");
+ queueItems = approvePublish.getPendingQueue(this.file);
+ if(queueItems != null)
+ {
+ assertTrue(queueItems.isEmpty());
+ }
+
+
+ String currentLiveVersion = assertFile.getContent().getVersionNumber();
+
+
+ //Now testing the update side of it
+ //modify this file
+ file.getContent().setBytes("updateddata".getBytes());
+ Command updateFileCommand = this.service.getCommandFactory().createUpdateFileCommand(file,content,true);
+ this.service.execute(updateFileCommand);
+
+ //Make sure a new LIVE version of this resource is not published into the CMS
+ assertFile = (File)this.service.execute(fileGet);
+ assertEquals(new String(assertFile.getContent().getBytes()),"newdata");
+ assertEquals(assertFile.getContent().getVersionNumber(),currentLiveVersion);
+
+ //Checking pending queue for a version of this file to be approved
+ queueItems = approvePublish.getPendingQueue(this.file);
+ assertNotNull(queueItems);
+ assertEquals(1,queueItems.size());
+
+ //Approve and publish this new version into the CMS
+ pendingItem = (org.jboss.portal.workflow.cms.Content)queueItems.iterator().next();
+ approvePublish.processManagerResponse(Long.parseLong(pendingItem.getProcessId()), manager.toLowerCase(),true);
+
+ //Check for the success of this publish, and removal from the pending queue
+ assertFile = (File)this.service.execute(fileGet);
+ assertFalse(assertFile.getContent().isWaitingForPublishApproval());
+ assertEquals(new String(assertFile.getContent().getBytes()),"updateddata");
+ assertTrue(assertFile.getContent().getVersionNumber() != currentLiveVersion);
+ queueItems = approvePublish.getPendingQueue(this.file);
+ if(queueItems != null)
+ {
+ assertTrue(queueItems.isEmpty());
+ }
+ }
+
+ /**
+ *
+ * @param username
+ */
+ private void runAs(String username) throws Exception
+ {
+ JCRCMS.getUserInfo().set(this.service.getUserModule().findUserByUserName(username));
+ }
+}
Added: trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestDeniedPublish.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestDeniedPublish.java (rev 0)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestDeniedPublish.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -0,0 +1,214 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.cms.workflow;
+
+import java.util.Locale;
+import java.util.Collection;
+import java.util.Set;
+import java.util.List;
+import javax.naming.InitialContext;
+
+import org.hibernate.SessionFactory;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.impl.ContentImpl;
+import org.jboss.portal.workflow.cms.ApprovePublish;
+import org.jboss.portal.cms.impl.jcr.JCRCMS;
+
+/**
+ *
+ * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
+ *
+ */
+public class TestDeniedPublish extends AbstractWorkflowTestCase
+{
+ private String newFile = "/default/workflow.html";
+ private String updateFile = "/default/index.html";
+ private Transaction tx = null;
+ private Session session = null;
+
+ /**
+ *
+ *
+ */
+ public TestDeniedPublish()
+ {
+ }
+
+ /**
+ *
+ *
+ */
+ public static TestSuite suite() throws Exception
+ {
+ return createTestSuite(TestDeniedPublish.class);
+ }
+
+ /**
+ *
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ JCRCMS.turnOnWorkflow();
+
+ SessionFactory sessionFactory = (SessionFactory)new InitialContext().lookup("java:/SessionFactory");
+ this.session = sessionFactory.openSession();
+ this.tx = session.beginTransaction();
+ }
+
+ /**
+ *
+ */
+ public void tearDown() throws Exception
+ {
+ this.tx.commit();
+ this.session.close();
+
+ super.tearDown();
+ }
+
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void test() throws Exception
+ {
+ //Execute file creation as a regular user/non-manager
+ this.runAs("user");
+
+ //Add a new file to the CMS
+ File file = new FileImpl();
+ file.setBasePath(this.newFile);
+
+ Content content = new ContentImpl();
+ content.setEncoding("UTF-8");
+ content.setTitle("English Title");
+ content.setDescription("English Description");
+ content.setBasePath(this.newFile + "/" + Locale.ENGLISH.getLanguage());
+ content.setBytes("newdata".getBytes());
+ content.setMimeType("text/html");
+ file.setContent(Locale.ENGLISH, content);
+
+ Command newFileCommand = this.service.getCommandFactory().createNewFileCommand(file, content);
+ this.service.execute(newFileCommand);
+
+ //Make sure this resource is not published into the CMS yet
+ Command fileGet = this.service.getCommandFactory().createFileGetCommand(this.newFile, Locale.ENGLISH);
+ File assertFile = (File)this.service.execute(fileGet);
+ assertNull(assertFile.getContent());
+
+ //Check the pending queue for this file
+ ApprovePublish approvePublish = this.service.getApprovePublishWorkflow();
+ Collection queueItems = approvePublish.getPendingQueue(this.newFile);
+ assertNotNull(queueItems);
+ assertEquals(1,queueItems.size());
+
+ //Deny the publish of this file into the CMS
+ Set managers = approvePublish.getManagers();
+ String manager = (String)managers.iterator().next();
+ org.jboss.portal.workflow.cms.Content pendingItem = (org.jboss.portal.workflow.cms.Content)queueItems.iterator().next();
+ approvePublish.processManagerResponse(Long.parseLong(pendingItem.getProcessId()), manager.toLowerCase(), false);
+
+ //Make sure this resource is not published into the CMS, and removed from the pending queue
+ assertFile = (File)this.service.execute(fileGet);
+ assertNull(assertFile.getContent());
+ queueItems = approvePublish.getPendingQueue(this.newFile);
+ if(queueItems != null)
+ {
+ assertTrue(queueItems.isEmpty());
+ }
+
+
+ //Check for the existence of a file to be updated first
+ Command existsCommand = this.service.getCommandFactory().createItemExistsCommand(this.updateFile);
+ Boolean exists = (Boolean)this.service.execute(existsCommand);
+ assertTrue(exists.booleanValue());
+
+
+ //Get the file to be updated
+ fileGet = this.service.getCommandFactory().createFileGetCommand(this.updateFile,new Locale(this.service.getDefaultLocale()));
+ File updateFile = (File)this.service.execute(fileGet);
+ assertNotNull(updateFile);
+ assertNotNull(updateFile.getContent());
+ assertTrue(updateFile.getContent().isLive());
+
+ //Get some data related to this CMS in the file before sending in an update
+ Command getVersions = this.service.getCommandFactory().createContentGetVersionsCommand(updateFile.getContent().getBasePath());
+ List versions = (List)this.service.execute(getVersions);
+ String oldLiveVersion = updateFile.getContent().getVersionNumber();
+ String oldContent = new String(updateFile.getContent().getBytes());
+ assertEquals(1,versions.size());
+
+ //Peform the file update
+ updateFile.getContent().setBytes("updateddata".getBytes());
+ Command updateFileCommand = this.service.getCommandFactory().createUpdateFileCommand(updateFile,updateFile.getContent(),true);
+ this.service.execute(updateFileCommand);
+
+
+ //Make sure a new LIVE version of this resource is not published into the CMS
+ assertFile = (File)this.service.execute(fileGet);
+ versions = (List)this.service.execute(getVersions);
+ assertEquals(new String(assertFile.getContent().getBytes()),oldContent);
+ assertEquals(assertFile.getContent().getVersionNumber(),oldLiveVersion);
+ assertEquals(2,versions.size());
+
+ //Checking pending queue for a version of this file to be approved
+ queueItems = approvePublish.getPendingQueue(this.updateFile);
+ assertNotNull(queueItems);
+ assertEquals(1,queueItems.size());
+
+ //Deny publishing of this new version into the CMS
+ pendingItem = (org.jboss.portal.workflow.cms.Content)queueItems.iterator().next();
+ approvePublish.processManagerResponse(Long.parseLong(pendingItem.getProcessId()), manager.toLowerCase(),false);
+
+ //Check for the success of this denial, and removal from the pending queue
+ assertFile = (File)this.service.execute(fileGet);
+ versions = (List)this.service.execute(getVersions);
+ assertEquals(new String(assertFile.getContent().getBytes()),oldContent);
+ assertEquals(assertFile.getContent().getVersionNumber(),oldLiveVersion);
+ assertEquals(2,versions.size());
+ queueItems = approvePublish.getPendingQueue(this.updateFile);
+ if(queueItems != null)
+ {
+ assertTrue(queueItems.isEmpty());
+ }
+ }
+
+ /**
+ *
+ * @param username
+ */
+ private void runAs(String username) throws Exception
+ {
+ JCRCMS.getUserInfo().set(this.service.getUserModule().findUserByUserName(username));
+ }
+}
Added: trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestWorkflowEnvironment.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestWorkflowEnvironment.java (rev 0)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestWorkflowEnvironment.java 2007-04-10 02:44:49 UTC (rev 6964)
@@ -0,0 +1,77 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.cms.workflow;
+
+import java.util.Set;
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.workflow.cms.ApprovePublish;
+
+
+/**
+ *
+ * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
+ *
+ */
+public class TestWorkflowEnvironment extends AbstractWorkflowTestCase
+{
+ String rejectPath = "/default/private/license.html";
+ String allowedPath = "/default/images/check.gif";
+
+
+ /**
+ *
+ *
+ */
+ public TestWorkflowEnvironment()
+ {
+ }
+
+ /**
+ *
+ *
+ */
+ public static TestSuite suite() throws Exception
+ {
+ return createTestSuite(TestWorkflowEnvironment.class);
+ }
+
+ /**
+ *
+ * @throws CMSException
+ */
+ public void test() throws Exception
+ {
+ //Get the ApprovePublish service
+ ApprovePublish service = this.getApprovePublish();
+
+ //Get the list of managers allowed to approve content
+ Set managers = service.getManagers();
+
+ //Assert and make sure there is atleast one portal role that is allowed
+ //to function of content manager
+ this.assertNotNull(managers);
+ this.assertTrue(managers.size()>0);
+ }
+}
Modified: trunk/cms/src/resources/hibernate/domain.hbm.xml
===================================================================
--- trunk/cms/src/resources/hibernate/domain.hbm.xml 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/src/resources/hibernate/domain.hbm.xml 2007-04-10 02:44:49 UTC (rev 6964)
@@ -287,7 +287,7 @@
<property
name="roleId"
column="ROLE_ID"
- type="long"
+ type="string"
not-null="true"
/>
</class>
@@ -302,7 +302,7 @@
<property
name="userId"
column="USER_ID"
- type="long"
+ type="string"
not-null="true"
/>
</class>
Added: trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml
===================================================================
--- trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml (rev 0)
+++ trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml 2007-04-10 02:44:49 UTC (rev 6964)
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
+ xmlns="urn:jboss:bean-deployer">
+
+ <bean name="DataSourceConfig" class="org.jboss.portal.test.framework.embedded.DataSourceSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>DataSourceConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="HibernateConfig" class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>HibernateConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="JNDISupport" class="org.jboss.portal.test.framework.embedded.JNDISupport">
+ </bean>
+
+ <bean name="TransactionManagerSupport" class="org.jboss.portal.test.framework.embedded.TransactionManagerSupport">
+ </bean>
+
+ <bean name="ConnectionManagerSupport" class="org.jboss.portal.test.framework.embedded.ConnectionManagerSupport">
+ <property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
+ </bean>
+
+ <bean name="DataSourceSupport" class="org.jboss.portal.test.framework.embedded.DataSourceSupport">
+ <property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
+ <property name="connectionManagerReference"><inject bean="ConnectionManagerSupport"
+ property="connectionManagerReference"/></property>
+ <property name="config"><inject bean="DataSourceConfig"/></property>
+ </bean>
+
+ <bean name="HibernateSupport" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config"><inject bean="HibernateConfig"/></property>
+ <property name="jNDIName">java:/SessionFactory</property>
+ <property name="mappings">
+ <list elementClass="java.lang.String">
+ <value>domain.hbm.xml</value>
+ <value>domain-identity.hbm.xml</value>
+ </list>
+ </property>
+ </bean>
+
+ <bean name="IdentityServiceController" class="org.jboss.portal.identity.IdentityServiceControllerImpl">
+ <property name="configFile">db-config.xml</property>
+ <property name="defaultConfigFile">standardidentity-config.xml</property>
+ <property name="registerMBeans">false</property>
+ </bean>
+
+ <bean name="IdentityDataLoader" class="org.jboss.portal.test.cms.security.IdentityDataLoader">
+ <property name="identityServiceController"><inject bean="IdentityServiceController"/></property>
+ <property name="identitySessionFactory">java:/SessionFactory</property>
+ </bean>
+
+ <!-- setup for cms security testing -->
+ <bean name="AuthorizationProvider" class="org.jboss.portal.cms.security.AuthorizationProviderImpl">
+ <property name="identityServiceController"><inject bean="IdentityServiceController"/></property>
+ </bean>
+
+ <bean name="AuthorizationManager" class="org.jboss.portal.cms.security.AuthorizationManagerImpl">
+ <property name="provider"><inject bean="AuthorizationProvider"/></property>
+ <property name="jNDIName">java:portal/cms/AuthorizationManager</property>
+ </bean>
+
+ <bean name="ACLInterceptor" class="org.jboss.portal.cms.impl.interceptors.ACLInterceptor">
+ <property name="authorizationManager"><inject bean="AuthorizationManager"/></property>
+ <property name="jNDIName">java:/portal/cms/ACLInterceptor</property>
+ <property name="cmsSessionFactory">java:/SessionFactory</property>
+ <property name="identitySessionFactory">java:/SessionFactory</property>
+ <property name="defaultPolicy">
+ <![CDATA[
+ <policy>
+ <!-- permissions on the root cms node -->
+ <criteria name="path" value="/">
+ <permission name="cms" action="read">
+ <role name="Anonymous"/>
+ </permission>
+ <permission name="cms" action="write">
+ <role name="User"/>
+ </permission>
+ <permission name="cms" action="manage">
+ <role name="Admin"/>
+ </permission>
+ </criteria>
+ <!-- permissions on the default cms node -->
+ <criteria name="path" value="/default">
+ <permission name="cms" action="read">
+ <role name="Anonymous"/>
+ </permission>
+ <permission name="cms" action="write">
+ <role name="User"/>
+ </permission>
+ <permission name="cms" action="manage">
+ <role name="Admin"/>
+ </permission>
+ </criteria>
+ <!-- permissions on the private/protected node -->
+ <criteria name="path" value="/default/private">
+ <permission name="cms" action="manage">
+ <role name="Admin"/>
+ </permission>
+ </criteria>
+ </policy>
+ ]]>
+ </property>
+ </bean>
+</deployment>
Property changes on: trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-workflow.xml
===================================================================
--- trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-workflow.xml (rev 0)
+++ trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-workflow.xml 2007-04-10 02:44:49 UTC (rev 6964)
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
+ xmlns="urn:jboss:bean-deployer">
+
+ <bean name="DataSourceConfig" class="org.jboss.portal.test.framework.embedded.DataSourceSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>DataSourceConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="HibernateConfig" class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>HibernateConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="JNDISupport" class="org.jboss.portal.test.framework.embedded.JNDISupport">
+ </bean>
+
+ <bean name="TransactionManagerSupport" class="org.jboss.portal.test.framework.embedded.TransactionManagerSupport">
+ </bean>
+
+ <bean name="ConnectionManagerSupport" class="org.jboss.portal.test.framework.embedded.ConnectionManagerSupport">
+ <property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
+ </bean>
+
+ <bean name="DataSourceSupport" class="org.jboss.portal.test.framework.embedded.DataSourceSupport">
+ <property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
+ <property name="connectionManagerReference"><inject bean="ConnectionManagerSupport"
+ property="connectionManagerReference"/></property>
+ <property name="config"><inject bean="DataSourceConfig"/></property>
+ </bean>
+
+ <bean name="HibernateSupport" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config"><inject bean="HibernateConfig"/></property>
+ <property name="jNDIName">java:/SessionFactory</property>
+ <property name="mappings">
+ <list elementClass="java.lang.String">
+ <value>domain.hbm.xml</value>
+ <value>domain-identity.hbm.xml</value>
+ <value>org/jbpm/graph/action/Script.hbm.xml</value>
+ <value>org/jbpm/identity/User.hbm.xml</value>
+ <value>org/jbpm/identity/Group.hbm.xml</value>
+ <value>org/jbpm/identity/Membership.hbm.xml</value>
+ <value>org/jbpm/db/hibernate.queries.hbm.xml</value>
+ <value>org/jbpm/graph/def/ProcessDefinition.hbm.xml</value>
+ <value>org/jbpm/graph/def/Node.hbm.xml</value>
+ <value>org/jbpm/graph/def/Transition.hbm.xml</value>
+ <value>org/jbpm/graph/def/Event.hbm.xml</value>
+ <value>org/jbpm/graph/def/Action.hbm.xml</value>
+ <value>org/jbpm/graph/def/SuperState.hbm.xml</value>
+ <value>org/jbpm/graph/def/ExceptionHandler.hbm.xml</value>
+ <value>org/jbpm/instantiation/Delegation.hbm.xml</value>
+ <value>org/jbpm/graph/node/StartState.hbm.xml</value>
+ <value>org/jbpm/graph/node/EndState.hbm.xml</value>
+ <value>org/jbpm/graph/node/ProcessState.hbm.xml</value>
+ <value>org/jbpm/graph/node/Decision.hbm.xml</value>
+ <value>org/jbpm/graph/node/Fork.hbm.xml</value>
+ <value>org/jbpm/graph/node/Join.hbm.xml</value>
+ <value>org/jbpm/graph/node/State.hbm.xml</value>
+ <value>org/jbpm/graph/node/TaskNode.hbm.xml</value>
+ <value>org/jbpm/context/def/ContextDefinition.hbm.xml</value>
+ <value>org/jbpm/context/def/VariableAccess.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/def/Swimlane.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/def/Task.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/def/TaskController.hbm.xml</value>
+ <value>org/jbpm/module/def/ModuleDefinition.hbm.xml</value>
+ <value>org/jbpm/bytes/ByteArray.hbm.xml</value>
+ <value>org/jbpm/file/def/FileDefinition.hbm.xml</value>
+ <value>org/jbpm/scheduler/def/CreateTimerAction.hbm.xml</value>
+ <value>org/jbpm/scheduler/def/CancelTimerAction.hbm.xml</value>
+ <value>org/jbpm/graph/exe/Comment.hbm.xml</value>
+ <value>org/jbpm/graph/exe/ProcessInstance.hbm.xml</value>
+ <value>org/jbpm/graph/exe/Token.hbm.xml</value>
+ <value>org/jbpm/graph/exe/RuntimeAction.hbm.xml</value>
+ <value>org/jbpm/module/exe/ModuleInstance.hbm.xml</value>
+ <value>org/jbpm/context/exe/ContextInstance.hbm.xml</value>
+ <value>org/jbpm/context/exe/TokenVariableMap.hbm.xml</value>
+ <value>org/jbpm/context/exe/VariableInstance.hbm.xml</value>
+ <value>org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml</value>
+ <value>org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml</value>
+ <value>org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml</value>
+ <value>org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml</value>
+ <value>org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml</value>
+ <value>org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml</value>
+ <value>org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml</value>
+ <value>org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml</value>
+ <value>org/jbpm/msg/Message.hbm.xml</value>
+ <value>org/jbpm/msg/db/TextMessage.hbm.xml</value>
+ <value>org/jbpm/command/ExecuteActionCommand.hbm.xml</value>
+ <value>org/jbpm/command/ExecuteNodeCommand.hbm.xml</value>
+ <value>org/jbpm/command/SignalCommand.hbm.xml</value>
+ <value>org/jbpm/command/TaskInstanceEndCommand.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/exe/PooledActor.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml</value>
+ <value>org/jbpm/scheduler/exe/Timer.hbm.xml</value>
+ <value>org/jbpm/logging/log/ProcessLog.hbm.xml</value>
+ <value>org/jbpm/logging/log/MessageLog.hbm.xml</value>
+ <value>org/jbpm/logging/log/CompositeLog.hbm.xml</value>
+ <value>org/jbpm/graph/log/ActionLog.hbm.xml</value>
+ <value>org/jbpm/graph/log/NodeLog.hbm.xml</value>
+ <value>org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml</value>
+ <value>org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml</value>
+ <value>org/jbpm/graph/log/ProcessStateLog.hbm.xml</value>
+ <value>org/jbpm/graph/log/SignalLog.hbm.xml</value>
+ <value>org/jbpm/graph/log/TokenCreateLog.hbm.xml</value>
+ <value>org/jbpm/graph/log/TokenEndLog.hbm.xml</value>
+ <value>org/jbpm/graph/log/TransitionLog.hbm.xml</value>
+ <value>org/jbpm/context/log/VariableLog.hbm.xml</value>
+ <value>org/jbpm/context/log/VariableCreateLog.hbm.xml</value>
+ <value>org/jbpm/context/log/VariableDeleteLog.hbm.xml</value>
+ <value>org/jbpm/context/log/VariableUpdateLog.hbm.xml</value>
+ <value>org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml</value>
+ <value>org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml</value>
+ <value>org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml</value>
+ <value>org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml</value>
+ <value>org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml</value>
+ <value>org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml</value>
+ <value>org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/log/TaskLog.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml</value>
+ </list>
+ </property>
+ </bean>
+
+ <bean name="IdentityServiceController" class="org.jboss.portal.identity.IdentityServiceControllerImpl">
+ <property name="configFile">db-config.xml</property>
+ <property name="defaultConfigFile">standardidentity-config.xml</property>
+ <property name="registerMBeans">false</property>
+ </bean>
+
+
+ <!-- setup for cms workflow testing -->
+ <bean name="WorkflowService" class="org.jboss.portal.workflow.service.WorkflowServiceImpl">
+ <property name="jbpmConfigurationXml">
+ <![CDATA[
+ <jbpm-configuration>
+ <jbpm-context>
+ <service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory"/>
+ </jbpm-context>
+ <string name="resource.hibernate.cfg.xml" value="jbpm-hibernate.cfg.xml"/>
+ <string name="resource.business.calendar" value="org/jbpm/calendar/jbpm.business.calendar.properties"/>
+ <string name="resource.default.modules" value="org/jbpm/graph/def/jbpm.default.modules.properties"/>
+ <string name="resource.converter" value="org/jbpm/db/hibernate/jbpm.converter.properties"/>
+ <string name="resource.action.types" value="org/jbpm/graph/action/action.types.xml"/>
+ <string name="resource.node.types" value="org/jbpm/graph/node/node.types.xml"/>
+ <string name="resource.varmapping" value="org/jbpm/context/exe/jbpm.varmapping.xml"/>
+ </jbpm-configuration>
+ ]]>
+ </property>
+ </bean>
+
+ <bean name="ApprovePublish" class="org.jboss.portal.workflow.cms.ApprovePublishImpl">
+ <property name="workflowService"><inject bean="WorkflowService"/></property>
+ <property name="identityServiceController"><inject bean="IdentityServiceController"/></property>
+ <property name="overwrite">false</property>
+ <property name="managerRoles">Admin</property>
+ <property name="jNDIName">java:/portal/ApprovePublishWorkflow</property>
+ <property name="process">
+ <![CDATA[
+ <!-- cms approval workflow -->
+ <process-definition name="approval_workflow">
+ <start-state>
+ <transition to="request_approval"/>
+ </start-state>
+ <task-node name="request_approval" signal="first">
+ <task name="approve_publish">
+ <assignment class="org.jboss.portal.cms.workflow.PublishAssignmentHandler"/>
+ <event type="task-start">
+ <action class="org.jboss.portal.cms.workflow.FinalizePublish"/>
+ </event>
+ <exception-handler>
+ <action class="org.jboss.portal.workflow.cms.TaskExceptionHandler"/>
+ </exception-handler>
+ </task>
+ <transition name="approval" to="end"/>
+ <transition name="rejection" to="end"/>
+ </task-node>
+ <end-state name="end"/>
+ </process-definition>
+ ]]>
+ </property>
+ </bean>
+
+ <bean class="org.jboss.portal.cms.impl.interceptors.ApprovalWorkflowInterceptor" name="ApprovalWorkflowInterceptor">
+ <property name="jNDIName">java:/portal/cms/ApprovalWorkflowInterceptor</property>
+ </bean>
+</deployment>
Property changes on: trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-workflow.xml
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml
===================================================================
--- trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml 2007-04-10 02:44:49 UTC (rev 6964)
@@ -63,18 +63,8 @@
<property name="jNDIName">java:/SessionFactory</property>
<property name="mappings">
<list elementClass="java.lang.String">
- <value>domain.hbm.xml</value>
+ <value>domain.hbm.xml</value>
</list>
</property>
- </bean>
-
- <!--
- <bean name="TestBean" class="org.jboss.portal.test.identity.db.DBUserTestCase">
- <constructor factoryMethod="getBean">
- <factory bean="BeanFactory"/>
- <parameter>TestBean</parameter>
- </constructor>
- <property name="hibernate"><inject bean="HibernateSupport"/></property>
- </bean>
- -->
+ </bean>
</deployment>
Added: trunk/cms/src/resources/test/db-config.xml
===================================================================
--- trunk/cms/src/resources/test/db-config.xml (rev 0)
+++ trunk/cms/src/resources/test/db-config.xml 2007-04-10 02:44:49 UTC (rev 6964)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+ <!--<!DOCTYPE identity-configuration PUBLIC
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">-->
+
+
+<identity-configuration>
+ <datasources/>
+ <modules>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>DB</implementation>
+ <config/>
+ </module>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>Role</type>
+ <implementation>DB</implementation>
+ <config/>
+ </module>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>Membership</type>
+ <implementation>DB</implementation>
+ <config/>
+ </module>
+ </modules>
+ <options/>
+</identity-configuration>
Added: trunk/cms/src/resources/test/domain-identity.hbm.xml
===================================================================
--- trunk/cms/src/resources/test/domain-identity.hbm.xml (rev 0)
+++ trunk/cms/src/resources/test/domain-identity.hbm.xml 2007-04-10 02:44:49 UTC (rev 6964)
@@ -0,0 +1,177 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class
+ name="org.jboss.portal.identity.db.HibernateUserImpl"
+ table="jbp_users">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <id
+ name="key"
+ column="jbp_uid"
+ type="java.lang.Long">
+ <generator class="native">
+ <param name="sequence">user_seq</param>
+ </generator>
+ </id>
+ <property
+ name="userName"
+ column="jbp_uname"
+ type="java.lang.String"
+ update="false"
+ insert="true"
+ unique="true"/>
+ <map
+ name="dynamic"
+ table="jbp_user_prop"
+ lazy="false"
+ sort="unsorted"
+ cascade="all">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <key column="jbp_uid"/>
+ <index
+ column="jbp_name"
+ type="java.lang.String"/>
+ <element
+ column="jbp_value"
+ type="java.lang.String"
+ not-null="false"
+ unique="false"/>
+ </map>
+ <property
+ name="givenName"
+ column="jbp_givenname"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="familyName"
+ column="jbp_familyname"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="password"
+ column="jbp_password"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="realEmail"
+ column="jbp_realemail"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="fakeEmail"
+ column="jbp_fakeemail"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="registrationDate"
+ column="jbp_regdate"
+ type="java.util.Date"
+ update="false"
+ insert="true"
+ unique="false"/>
+ <property
+ name="viewRealEmail"
+ column="jbp_viewrealemail"
+ type="boolean"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="enabled"
+ column="jbp_enabled"
+ type="boolean"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <set
+ name="roles"
+ table="jbp_role_membership"
+ lazy="false"
+ inverse="false"
+ cascade="none"
+ sort="unsorted">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <key column="jbp_uid"/>
+ <many-to-many
+ class="org.jboss.portal.identity.db.HibernateRoleImpl"
+ column="jbp_rid"
+ outer-join="true"/>
+ </set>
+ </class>
+ <class
+ name="org.jboss.portal.identity.db.HibernateRoleImpl"
+ table="jbp_roles">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <id
+ name="key"
+ column="jbp_rid"
+ type="java.lang.Long">
+ <generator class="native">
+ <param name="sequence">user_seq</param>
+ </generator>
+ </id>
+ <property
+ name="name"
+ column="jbp_name"
+ type="java.lang.String"
+ update="false"
+ insert="true"
+ unique="true"/>
+ <property
+ name="displayName"
+ column="jbp_displayname"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="true"/>
+ <set
+ name="users"
+ table="jbp_role_membership"
+ lazy="true"
+ inverse="true"
+ cascade="none"
+ sort="unsorted">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <key column="jbp_rid"/>
+ <many-to-many
+ class="org.jboss.portal.identity.db.HibernateUserImpl"
+ column="jbp_uid"
+ outer-join="false"/>
+ </set>
+ </class>
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/cms/src/resources/test/jbpm-ehcache.xml
===================================================================
--- trunk/cms/src/resources/test/jbpm-ehcache.xml (rev 0)
+++ trunk/cms/src/resources/test/jbpm-ehcache.xml 2007-04-10 02:44:49 UTC (rev 6964)
@@ -0,0 +1,61 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<ehcache>
+
+ <!-- Sets the path to the directory where cache .data files are created.
+
+ If the path is a Java System Property it is replaced by
+ its value in the running VM.
+
+ The following properties are translated:
+ user.home - User's home directory
+ user.dir - User's current working directory
+ java.io.tmpdir - Default temp file path -->
+ <diskStore path="java.io.tmpdir/workflow"/>
+
+
+ <!--Default Cache configuration. These will applied to caches programmatically created through
+ the CacheManager.
+
+ The following attributes are required for defaultCache:
+
+ maxInMemory - Sets the maximum number of objects that will be created in memory
+ eternal - Sets whether elements are eternal. If eternal, timeouts are ignored and the element
+ is never expired.
+ timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only used
+ if the element is not eternal. Idle time is now - last accessed time
+ timeToLiveSeconds - Sets the time to live for an element before it expires. Is only used
+ if the element is not eternal. TTL is now - creation time
+ overflowToDisk - Sets whether elements can overflow to disk when the in-memory cache
+ has reached the maxInMemory limit.
+
+ -->
+ <defaultCache
+ maxElementsInMemory="10000"
+ eternal="false"
+ timeToIdleSeconds="120"
+ timeToLiveSeconds="120"
+ overflowToDisk="false"
+ />
+</ehcache>
Added: trunk/cms/src/resources/test/jbpm-hibernate.cfg.xml
===================================================================
--- trunk/cms/src/resources/test/jbpm-hibernate.cfg.xml (rev 0)
+++ trunk/cms/src/resources/test/jbpm-hibernate.cfg.xml 2007-04-10 02:44:49 UTC (rev 6964)
@@ -0,0 +1,168 @@
+<?xml version='1.0' encoding='utf-8'?>
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+ <session-factory>
+ <!-- jdbc connection properties -->
+ <property name="connection.datasource">java:/DefaultDS</property>
+
+ <!-- other hibernate properties -->
+ <property name="show_sql">false</property>
+ <property name="hibernate.format_sql">true</property>
+ <property name="hibernate.use_sql_comments">true</property>
+
+ <!-- caching properties -->
+ <property name="cache.use_second_level_cache">true</property>
+ <property name="cache.use_query_cache">true</property>
+ <property name="cache.provider_configuration_file_resource_path">jbpm-ehcache.xml</property>
+ <property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
+
+ <!-- managed environment transaction configuration -->
+ <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
+ <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
+
+ <!-- ############################################ -->
+ <!-- # mapping files with external dependencies # -->
+ <!-- ############################################ -->
+
+ <!-- following mapping file has a dependendy on -->
+ <!-- 'bsh-{version}.jar'. -->
+ <!-- uncomment this if you don't have bsh on your -->
+ <!-- classpath. you won't be able to use the -->
+ <!-- script element in process definition files -->
+ <mapping resource="org/jbpm/graph/action/Script.hbm.xml"/>
+
+ <!-- following mapping files have a dependendy on -->
+ <!-- 'jbpm-identity-{version}.jar', mapping files -->
+ <!-- of the pluggable jbpm identity component. -->
+ <!-- comment out the following 3 lines if you don't-->
+ <!-- want to use the default jBPM identity mgmgt -->
+ <!-- component -->
+ <mapping resource="org/jbpm/identity/User.hbm.xml"/>
+ <mapping resource="org/jbpm/identity/Group.hbm.xml"/>
+ <mapping resource="org/jbpm/identity/Membership.hbm.xml"/>
+
+ <!-- ###################### -->
+ <!-- # jbpm mapping files # -->
+ <!-- ###################### -->
+
+ <!-- hql queries and type defs -->
+ <mapping resource="org/jbpm/db/hibernate.queries.hbm.xml"/>
+
+ <!-- graph.def mapping files -->
+ <mapping resource="org/jbpm/graph/def/ProcessDefinition.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Node.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Transition.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Event.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Action.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/SuperState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml"/>
+ <mapping resource="org/jbpm/instantiation/Delegation.hbm.xml"/>
+
+ <!-- graph.node mapping files -->
+ <mapping resource="org/jbpm/graph/node/StartState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/EndState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/ProcessState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/Decision.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/Fork.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/Join.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/State.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/TaskNode.hbm.xml"/>
+
+ <!-- context.def mapping files -->
+ <mapping resource="org/jbpm/context/def/ContextDefinition.hbm.xml"/>
+ <mapping resource="org/jbpm/context/def/VariableAccess.hbm.xml"/>
+
+ <!-- taskmgmt.def mapping files -->
+ <mapping resource="org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/def/Swimlane.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/def/Task.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/def/TaskController.hbm.xml"/>
+
+ <!-- module.def mapping files -->
+ <mapping resource="org/jbpm/module/def/ModuleDefinition.hbm.xml"/>
+
+ <!-- bytes mapping files -->
+ <mapping resource="org/jbpm/bytes/ByteArray.hbm.xml"/>
+
+ <!-- file.def mapping files -->
+ <mapping resource="org/jbpm/file/def/FileDefinition.hbm.xml"/>
+
+ <!-- scheduler.def mapping files -->
+ <mapping resource="org/jbpm/scheduler/def/CreateTimerAction.hbm.xml"/>
+ <mapping resource="org/jbpm/scheduler/def/CancelTimerAction.hbm.xml"/>
+
+ <!-- graph.exe mapping files -->
+ <mapping resource="org/jbpm/graph/exe/Comment.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/exe/ProcessInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/exe/Token.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/exe/RuntimeAction.hbm.xml"/>
+
+ <!-- module.exe mapping files -->
+ <mapping resource="org/jbpm/module/exe/ModuleInstance.hbm.xml"/>
+
+ <!-- context.exe mapping files -->
+ <mapping resource="org/jbpm/context/exe/ContextInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/TokenVariableMap.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/VariableInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml"/>
+
+ <!-- msg.db mapping files -->
+ <mapping resource="org/jbpm/msg/Message.hbm.xml"/>
+ <mapping resource="org/jbpm/msg/db/TextMessage.hbm.xml"/>
+ <mapping resource="org/jbpm/command/ExecuteActionCommand.hbm.xml"/>
+ <mapping resource="org/jbpm/command/ExecuteNodeCommand.hbm.xml"/>
+ <mapping resource="org/jbpm/command/SignalCommand.hbm.xml"/>
+ <mapping resource="org/jbpm/command/TaskInstanceEndCommand.hbm.xml"/>
+
+ <!-- taskmgmt.exe mapping files -->
+ <mapping resource="org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/exe/PooledActor.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml"/>
+
+ <!-- scheduler.exe mapping files -->
+ <mapping resource="org/jbpm/scheduler/exe/Timer.hbm.xml"/>
+
+ <!-- logging mapping files -->
+ <mapping resource="org/jbpm/logging/log/ProcessLog.hbm.xml"/>
+ <mapping resource="org/jbpm/logging/log/MessageLog.hbm.xml"/>
+ <mapping resource="org/jbpm/logging/log/CompositeLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ActionLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/NodeLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ProcessStateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/SignalLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/TokenCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/TokenEndLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/TransitionLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableDeleteLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml"/>
+ </session-factory>
+</hibernate-configuration>
Modified: trunk/cms/src/resources/test/jcr/repository.xml
===================================================================
--- trunk/cms/src/resources/test/jcr/repository.xml 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/src/resources/test/jcr/repository.xml 2007-04-10 02:44:49 UTC (rev 6964)
@@ -62,11 +62,11 @@
<!--
persistence manager of the workspace.
- Use XMLPersistenceManager for LocalFileSystem Store and HibernatePersistenceManager .
+ Use XMLPersistenceManager for LocalFileSystem Store and HibernatePersistenceManager/JBossCachePersistenceManager .
-->
<!-- HibernatePersistentManager: uses RDBMS + Hibernate for storage -->
- <PersistenceManager class="org.jboss.portal.cms.hibernate.state.HibernatePersistenceManager">
+ <PersistenceManager class="org.jboss.portal.cms.hibernate.state.JBossCachePersistenceManager">
<param name="schemaObjectPrefix" value="WSP"/>
<param name="JNDIName" value="java:/SessionFactory"/>
<param name="externalBLOBs" value="false"/>
@@ -110,11 +110,11 @@
<!--
Configures the persistence manager to be used for persisting version state.
- Use XMLPersistenceManager for LocalFileSystem Store and HibernatePersistenceManager for HibernateStore.
+ Use XMLPersistenceManager for LocalFileSystem Store and HibernatePersistenceManager/JBossCachePersistenceManager for HibernateStore.
-->
<!-- HibernatePersistentManager: uses RDBMS + Hibernate for storage -->
- <PersistenceManager class="org.jboss.portal.cms.hibernate.state.HibernatePersistenceManager">
+ <PersistenceManager class="org.jboss.portal.cms.hibernate.state.JBossCachePersistenceManager">
<param name="schemaObjectPrefix" value="Version"/>
<param name="JNDIName" value="java:/SessionFactory"/>
<param name="externalBLOBs" value="false"/>
Added: trunk/cms/src/resources/test/standardidentity-config.xml
===================================================================
--- trunk/cms/src/resources/test/standardidentity-config.xml (rev 0)
+++ trunk/cms/src/resources/test/standardidentity-config.xml 2007-04-10 02:44:49 UTC (rev 6964)
@@ -0,0 +1,229 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+
+<!--<!DOCTYPE identity-configuration PUBLIC
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">-->
+
+<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <!--name of service and class for creating mbean-->
+ <service-name>portal:service=Module,type=LDAPConnectionContext</service-name>
+ <class>org.jboss.portal.identity.ldap.LDAPConnectionContext</class>
+ <config>
+ <option>
+ <name>host</name>
+ <value>jboss.com</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>389</value>
+ </option>
+ <option>
+ <name>contextFactory</name>
+ <value>com.sun.jndi.ldap.LdapCtxFactory</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ <option>
+ <name>jNDIName</name>
+ <value>java:/portal/LDAPConnectionContext</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
+ <modules>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>DB</implementation>
+
+ <!--name of service and class for creating mbean-->
+ <service-name>portal:service=Module,type=User</service-name>
+ <class>org.jboss.portal.identity.db.HibernateUserModuleImpl</class>
+
+ <!--set of options that are passed to a class constructor-->
+ <config>
+ <option>
+ <name>sessionFactoryJNDIName</name>
+ <value>java:/SessionFactory</value>
+ </option>
+ <option>
+ <name>jNDIName</name>
+ <value>java:/portal/UserModule</value>
+ </option>
+ </config>
+ </module>
+
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>Role</type>
+ <implementation>DB</implementation>
+
+ <!--name of service and class for creating mbean-->
+ <service-name>portal:service=Module,type=Role</service-name>
+ <class>org.jboss.portal.identity.db.HibernateRoleModuleImpl</class>
+
+ <!--set of options that are passed to a class constructor-->
+ <config>
+ <option>
+ <name>sessionFactoryJNDIName</name>
+ <value>java:/SessionFactory</value>
+ </option>
+ <option>
+ <name>jNDIName</name>
+ <value>java:/portal/RoleModule</value>
+ </option>
+ </config>
+ </module>
+
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>Membership</type>
+ <implementation>DB</implementation>
+
+ <!--name of service and class for creating mbean-->
+ <service-name>portal:service=Module,type=Membership</service-name>
+ <class>org.jboss.portal.identity.db.HibernateMembershipModuleImpl</class>
+
+ <!--set of options that are passed to a class constructor-->
+ <config>
+ <option>
+ <name>sessionFactoryJNDIName</name>
+ <value>java:/SessionFactory</value>
+ </option>
+ <option>
+ <name>jNDIName</name>
+ <value>java:/portal/MembershipModule</value>
+ </option>
+ </config>
+ </module>
+ </modules>
+
+ <options>
+ <!--Common options section-->
+ <option-group>
+ <group-name>common</group-name>
+ <option>
+ <name>userCtxDN</name>
+ <value>ou=People,dc=example,dc=com</value>
+ </option>
+ <option>
+ <name>uidAttributeID</name>
+ <value>uid</value>
+ </option>
+ <option>
+ <name>passwordAttributeID</name>
+ <value>userPassword</value>
+ </option>
+ <option>
+ <name>roleCtxDN</name>
+ <value>ou=Roles,dc=example,dc=com</value>
+ </option>
+ <option>
+ <name>ridAttributeID</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>roleDisplayNameAttributeID</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>membershipAttributeID</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>membershipAttributeIsDN</name>
+ <value>true</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>userCreateAttibutes</group-name>
+ <option>
+ <name>objectClass</name>
+ <value>top</value>
+ <value>uidObject</value>
+ <value>person</value>
+ <value>inetUser</value>
+ </option>
+ <!--Schema requires those to have initial value-->
+ <!--<option>
+ <name>cn</name>
+ <value>none</value>
+ </option>-->
+ <option>
+ <name>sn</name>
+ <value>none</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>roleCreateAttibutes</group-name>
+ <option>
+ <name>objectClass</name>
+ <value>top</value>
+ <value>groupOfNames</value>
+ </option>
+ <!--Schema requires those to have initial value-->
+ <!--<option>
+ <name>cn</name>
+ <value>none</value>
+ </option>-->
+ <!--Some directory servers require this attribute to be valid DN-->
+ <!--For safety reasons point to the admin user here-->
+ <!--<option>
+ <name>member</name>
+ <value>uid=dummynonexistinguser,ou=People,dc=jboss,dc=org</value>
+ </option>-->
+ </option-group>
+ </options>
+</identity-configuration>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modified: trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-04-10 02:44:49 UTC (rev 6964)
@@ -58,10 +58,12 @@
<depends>portal:service=JAASLoginModule</depends>
<depends>portal:service=Hibernate,type=CMS</depends>
<depends optional-attribute-name="IdentityServiceController" proxy-type="attribute">portal:service=Module,type=IdentityServiceController</depends>
+
<!-- Add this to activate publish/approval workflow integration -->
<!--
<depends optional-attribute-name="ApprovePublishWorkflow" proxy-type="attribute">portal:service=ApprovePublish,type=Workflow</depends>
-->
+
<depends optional-attribute-name="StackFactory" proxy-type="attribute">portal:service=InterceptorStackFactory,type=Cms</depends>
<attribute name="DoChecking">true</attribute>
<attribute name="DefaultContentLocation">portal/cms/conf/default-content/default/</attribute>
@@ -101,7 +103,7 @@
<!-- HibernateStore: uses RDBMS + Hibernate for storage -->
<FileSystem class="org.jboss.portal.cms.hibernate.HibernateStore">
<param name="schemaObjectPrefix" value="CMSEntry"/>
- <param name="JNDIName" value="java:portal/cms/CMSSessionFactory"/>
+ <param name="JNDIName" value="java:/portal/cms/CMSSessionFactory"/>
</FileSystem>
<!-- LocalFileSystem: uses FileSystem for storage. -->
<!--<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
@@ -116,7 +118,7 @@
<!-- HibernatePersistentManager: uses RDBMS + Hibernate for storage -->
<PersistenceManager class="org.jboss.portal.cms.hibernate.state.JBossCachePersistenceManager">
<param name="schemaObjectPrefix" value="WSP"/>
- <param name="JNDIName" value="java:portal/cms/CMSSessionFactory"/>
+ <param name="JNDIName" value="java:/portal/cms/CMSSessionFactory"/>
<param name="externalBLOBs" value="false"/>
</PersistenceManager>
@@ -146,7 +148,7 @@
<!-- HibernateStore: uses RDBMS + Hibernate for storage -->
<FileSystem class="org.jboss.portal.cms.hibernate.HibernateStore">
<param name="schemaObjectPrefix" value="VersionEntry"/>
- <param name="JNDIName" value="java:portal/cms/CMSSessionFactory"/>
+ <param name="JNDIName" value="java:/portal/cms/CMSSessionFactory"/>
</FileSystem>
<!-- LocalFileSystem: uses FileSystem for storage. -->
@@ -164,7 +166,7 @@
<!-- HibernatePersistentManager: uses RDBMS + Hibernate for storage -->
<PersistenceManager class="org.jboss.portal.cms.hibernate.state.JBossCachePersistenceManager">
<param name="schemaObjectPrefix" value="Version"/>
- <param name="JNDIName" value="java:portal/cms/CMSSessionFactory"/>
+ <param name="JNDIName" value="java:/portal/cms/CMSSessionFactory"/>
<param name="externalBLOBs" value="false"/>
</PersistenceManager>
@@ -472,7 +474,9 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <attribute name="JNDIName">java:portal/cms/CMSSessionFactory</attribute>
+ <attribute name="JNDIName">java:/portal/cms/ACLInterceptor</attribute>
+ <attribute name="CmsSessionFactory">java:/portal/cms/CMSSessionFactory</attribute>
+ <attribute name="IdentitySessionFactory">java:/portal/IdentitySessionFactory</attribute>
<attribute name="DefaultPolicy">
<![CDATA[
<policy>
@@ -522,7 +526,8 @@
name="portal:service=Interceptor,type=Cms,name=ApprovalWorkflow"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
+ <xmbean/>
+ <attribute name="JNDIName">java:/portal/cms/ApprovalWorkflowInterceptor</attribute>
<depends>portal:service=Hibernate,type=CMS</depends>
</mbean>
Modified: trunk/workflow/src/resources/portal-workflow-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/workflow/src/resources/portal-workflow-sar/META-INF/jboss-service.xml 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/workflow/src/resources/portal-workflow-sar/META-INF/jboss-service.xml 2007-04-10 02:44:49 UTC (rev 6964)
@@ -119,9 +119,11 @@
approve/reject content publish requests
-->
<attribute name="ManagerRoles">Admin</attribute>
+ <attribute name="JNDIName">java:portal/ApprovePublishWorkflow</attribute>
<!-- Now that a manager GUI is integrated..no need for email based manager screen -->
- <!--attribute name="From">do-not-reply(a)jboss.com</attribute>
+<!--
+ <attribute name="From">do-not-reply(a)jboss.com</attribute>
<attribute name="Subject">Content Approval Requested</attribute>
<attribute name="Body">
<![CDATA[
@@ -143,7 +145,7 @@
<a href="http://localhost/workflow/reject?pId={7}&manager={8}">Reject</a>
]]>
- </attribute-->
- <attribute name="JNDIName">java:portal/ApprovePublishWorkflow</attribute>
+ </attribute>
+-->
</mbean>
</server>
17 years, 2 months
JBoss Portal SVN: r6962 - in trunk: theme/src/main/org/jboss/portal/theme/impl/render/dynamic and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-08 17:51:01 -0400 (Sun, 08 Apr 2007)
New Revision: 6962
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaConstants.java
Log:
more todo
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-04-08 21:18:18 UTC (rev 6961)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-04-08 21:51:01 UTC (rev 6962)
@@ -77,6 +77,9 @@
import java.util.ArrayList;
/**
+ * todo:
+ * 1/ interpret more responses types
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaConstants.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaConstants.java 2007-04-08 21:18:18 UTC (rev 6961)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaConstants.java 2007-04-08 21:51:01 UTC (rev 6962)
@@ -26,6 +26,8 @@
* todo:
* 1/ dirty view state detections
* 2/ clarify dyna options inheritance semantics
+ * 3/ handle security direction provided by the server when the user is not authenticated anymore
+ * 4/ disabling based on the user agent capabilities
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
17 years, 3 months
JBoss Portal SVN: r6961 - in trunk: theme/src/main/org/jboss/portal/test/theme and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-08 17:18:18 -0400 (Sun, 08 Apr 2007)
New Revision: 6961
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java
trunk/theme/src/main/org/jboss/portal/test/theme/TestServlet.java
trunk/theme/src/main/org/jboss/portal/test/theme/tmp/render/TestRenderedMarkup.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaConstants.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaDecorationRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaPortletRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRenderStatus.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/tag/ThemeTagHandler.java
Log:
- renamed a few constants
- added minimal todo for dyna
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java 2007-04-08 17:32:15 UTC (rev 6960)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java 2007-04-08 21:18:18 UTC (rev 6961)
@@ -75,7 +75,7 @@
String url = serverContext.renderURL(baseServerURL, serverContext.getURLContext(), URLFormat.newInstance(true, true));
//
- pageProps.put(DynaConstants.DYNA_RESOURCE_BASE_URL, "/portal-ajax/dyna");
+ pageProps.put(DynaConstants.RESOURCE_BASE_URL, "/portal-ajax/dyna");
pageProps.put(DynaConstants.SERVER_BASE_URL, url);
pageProps.put(DynaConstants.VIEW_STATE, viewId);
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/TestServlet.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/TestServlet.java 2007-04-08 17:32:15 UTC (rev 6960)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/TestServlet.java 2007-04-08 21:18:18 UTC (rev 6961)
@@ -138,7 +138,7 @@
//
pageRenderCtx.setLayoutState(null);
- pageRenderCtx.getPageProperties().put(DynaConstants.DYNA_RESOURCE_BASE_URL, request.getContextPath() + "/dyna");
+ pageRenderCtx.getPageProperties().put(DynaConstants.RESOURCE_BASE_URL, request.getContextPath() + "/dyna");
pageRenderCtx.getPageProperties().put(DynaConstants.SERVER_BASE_URL, testContext.getServerBaseURL());
//
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/tmp/render/TestRenderedMarkup.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/tmp/render/TestRenderedMarkup.java 2007-04-08 17:32:15 UTC (rev 6960)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/tmp/render/TestRenderedMarkup.java 2007-04-08 21:18:18 UTC (rev 6961)
@@ -128,7 +128,7 @@
{
//
Map pageProps = new HashMap();
- pageProps.put(DynaConstants.DYNA_RESOURCE_BASE_URL, "/portal-ajax");
+ pageProps.put(DynaConstants.RESOURCE_BASE_URL, "/portal-ajax");
pageProps.put(DynaConstants.SERVER_BASE_URL, "http://localhost:8080/portal-ajax/ajax");
//
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaConstants.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaConstants.java 2007-04-08 17:32:15 UTC (rev 6960)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaConstants.java 2007-04-08 21:18:18 UTC (rev 6961)
@@ -23,25 +23,29 @@
package org.jboss.portal.theme.impl.render.dynamic;
/**
+ * todo:
+ * 1/ dirty view state detections
+ * 2/ clarify dyna options inheritance semantics
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
public final class DynaConstants
{
- /** . */
- public static final String DYNA_RESOURCE_BASE_URL = "theme.dyna.resource_base_url";
+ /** The base url property for the resources. */
+ public static final String RESOURCE_BASE_URL = "theme.dyna.resource_base_url";
- /** . */
+ /** The base server URL. */
public static final String SERVER_BASE_URL = "theme.dyna.server_base_url";
/** The id for view state. */
public static final String VIEW_STATE = "theme.dyna.view_state";
/** . */
- public static final String DYNA_RENDER_OPTIONS = "dyna_render_options";
+ public static final String RENDER_OPTIONS = "dyna_render_options";
/** . */
- public static final String DYNA_RENDER_STATUS = "dyna_render_status";
+ public static final String RENDER_STATUS = "dyna_render_status";
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaDecorationRenderer.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaDecorationRenderer.java 2007-04-08 17:32:15 UTC (rev 6960)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaDecorationRenderer.java 2007-04-08 21:18:18 UTC (rev 6961)
@@ -52,7 +52,7 @@
public void render(RendererContext rendererContext, DecorationRendererContext drc) throws RenderException
{
- DynaRenderOptions regionOptions = (DynaRenderOptions)rendererContext.getAttribute(DynaConstants.DYNA_RENDER_OPTIONS);
+ DynaRenderOptions regionOptions = (DynaRenderOptions)rendererContext.getAttribute(DynaConstants.RENDER_OPTIONS);
//
PrintWriter markup = rendererContext.getWriter();
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaPortletRenderer.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaPortletRenderer.java 2007-04-08 17:32:15 UTC (rev 6960)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaPortletRenderer.java 2007-04-08 21:18:18 UTC (rev 6961)
@@ -59,7 +59,7 @@
private void doDND(RendererContext rendererContext, PortletRendererContext prc) throws RenderException
{
- DynaRenderOptions regionOptions = (DynaRenderOptions)rendererContext.getAttribute(DynaConstants.DYNA_RENDER_OPTIONS);
+ DynaRenderOptions regionOptions = (DynaRenderOptions)rendererContext.getAttribute(DynaConstants.RENDER_OPTIONS);
//
if (regionOptions.isDnDEnabled())
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java 2007-04-08 17:32:15 UTC (rev 6960)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java 2007-04-08 21:18:18 UTC (rev 6961)
@@ -90,7 +90,7 @@
DynaRenderOptions options = DynaRenderOptions.getOptions(dndValue, asyncWindowValue);
//
- rendererContext.setAttribute(DynaConstants.DYNA_RENDER_OPTIONS, options);
+ rendererContext.setAttribute(DynaConstants.RENDER_OPTIONS, options);
DynaRenderStatus.set(rendererContext, true);
}
}
@@ -100,14 +100,14 @@
{
if (DynaRenderStatus.get(rendererContext))
{
- rendererContext.setAttribute(DynaConstants.DYNA_RENDER_OPTIONS, null);
+ rendererContext.setAttribute(DynaConstants.RENDER_OPTIONS, null);
}
}
public void renderHeader(RendererContext rendererContext, RegionRendererContext rrc) throws RenderException
{
PrintWriter markup = rendererContext.getWriter();
- String jsBase = rendererContext.getProperty(DynaConstants.DYNA_RESOURCE_BASE_URL);
+ String jsBase = rendererContext.getProperty(DynaConstants.RESOURCE_BASE_URL);
String serverBaseURL = rendererContext.getProperty(DynaConstants.SERVER_BASE_URL);
String viewState = rendererContext.getProperty(DynaConstants.VIEW_STATE);
@@ -162,7 +162,7 @@
delegate.renderHeader(rendererContext, rrc);
//
- DynaRenderOptions options = (DynaRenderOptions)rendererContext.getAttribute(DynaConstants.DYNA_RENDER_OPTIONS);
+ DynaRenderOptions options = (DynaRenderOptions)rendererContext.getAttribute(DynaConstants.RENDER_OPTIONS);
//
if (options.isDnDEnabled())
@@ -189,7 +189,7 @@
{
if (DynaRenderStatus.get(rendererContext))
{
- DynaRenderOptions options = (DynaRenderOptions)rendererContext.getAttribute(DynaConstants.DYNA_RENDER_OPTIONS);
+ DynaRenderOptions options = (DynaRenderOptions)rendererContext.getAttribute(DynaConstants.RENDER_OPTIONS);
//
if (options.isDnDEnabled())
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRenderStatus.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRenderStatus.java 2007-04-08 17:32:15 UTC (rev 6960)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRenderStatus.java 2007-04-08 21:18:18 UTC (rev 6961)
@@ -33,19 +33,19 @@
public static boolean get(RendererContext rendererContext)
{
- Boolean status = (Boolean)rendererContext.getAttribute(DynaConstants.DYNA_RENDER_STATUS);
+ Boolean status = (Boolean)rendererContext.getAttribute(DynaConstants.RENDER_STATUS);
return status == null || status.booleanValue();
}
public static boolean remove(RendererContext rendererContext)
{
- Boolean status = (Boolean)rendererContext.getAttribute(DynaConstants.DYNA_RENDER_STATUS);
- rendererContext.setAttribute(DynaConstants.DYNA_RENDER_STATUS, null);
+ Boolean status = (Boolean)rendererContext.getAttribute(DynaConstants.RENDER_STATUS);
+ rendererContext.setAttribute(DynaConstants.RENDER_STATUS, null);
return status == null || status.booleanValue();
}
public static void set(RendererContext rendererContext, boolean status)
{
- rendererContext.setAttribute(DynaConstants.DYNA_RENDER_STATUS, Boolean.valueOf(status));
+ rendererContext.setAttribute(DynaConstants.RENDER_STATUS, Boolean.valueOf(status));
}
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java 2007-04-08 17:32:15 UTC (rev 6960)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java 2007-04-08 21:18:18 UTC (rev 6961)
@@ -57,7 +57,7 @@
/** @see org.jboss.portal.theme.render.renderer.WindowRenderer#render */
public void render(RendererContext rendererContext, WindowRendererContext wrc) throws RenderException
{
- DynaRenderOptions regionOptions = (DynaRenderOptions)rendererContext.getAttribute(DynaConstants.DYNA_RENDER_OPTIONS);
+ DynaRenderOptions regionOptions = (DynaRenderOptions)rendererContext.getAttribute(DynaConstants.RENDER_OPTIONS);
//
String dndValue = rendererContext.getProperty(DynaRenderOptions.DND_ENABLED);
Modified: trunk/theme/src/main/org/jboss/portal/theme/tag/ThemeTagHandler.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/tag/ThemeTagHandler.java 2007-04-08 17:32:15 UTC (rev 6960)
+++ trunk/theme/src/main/org/jboss/portal/theme/tag/ThemeTagHandler.java 2007-04-08 21:18:18 UTC (rev 6961)
@@ -86,7 +86,7 @@
PortalTheme theme = themeContext.getTheme();
//
- String jsBase = rendererContext.getProperty(DynaConstants.DYNA_RESOURCE_BASE_URL);
+ String jsBase = rendererContext.getProperty(DynaConstants.RESOURCE_BASE_URL);
out.print("<link rel=\"stylesheet\" id=\"dyna_css\" href=\"" + jsBase + "/style.css\" type=\"text/css\"/>\n");
// If no theme provided we use what may be on the tag
17 years, 3 months
JBoss Portal SVN: r6960 - trunk/theme/src/bin/portal-ajax-war/dyna.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-08 13:32:15 -0400 (Sun, 08 Apr 2007)
New Revision: 6960
Modified:
trunk/theme/src/bin/portal-ajax-war/dyna/dyna.js
Log:
fix temporarily the ajax DnD that was not updating state
Modified: trunk/theme/src/bin/portal-ajax-war/dyna/dyna.js
===================================================================
--- trunk/theme/src/bin/portal-ajax-war/dyna/dyna.js 2007-04-08 17:24:01 UTC (rev 6959)
+++ trunk/theme/src/bin/portal-ajax-war/dyna/dyna.js 2007-04-08 17:32:15 UTC (rev 6960)
@@ -18,7 +18,7 @@
{
}
}
- new Ajax.Request(server_base_url, options);
+ new Ajax.Request(server_base_url + "/ajax", options);
}
function snapshot() {
17 years, 3 months
JBoss Portal SVN: r6959 - in trunk: core/src/main/org/jboss/portal/core/aspects/controller and 25 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-08 13:24:01 -0400 (Sun, 08 Apr 2007)
New Revision: 6959
Added:
trunk/core/src/main/org/jboss/portal/core/controller/ControllerResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandlerException.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ThrowableResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/command/response/ThrowableResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/handler/
trunk/core/src/main/org/jboss/portal/core/controller/handler/AbstractResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/handler/AjaxResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/handler/CommandForward.java
trunk/core/src/main/org/jboss/portal/core/controller/handler/HTTPResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/handler/HandlerResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseForward.java
trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/theme/
trunk/core/src/main/org/jboss/portal/core/theme/PageRendition.java
trunk/core/src/main/org/jboss/portal/core/theme/WindowRendition.java
Removed:
trunk/core/src/main/org/jboss/portal/core/controller/AjaxResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/CommandForward.java
trunk/core/src/main/org/jboss/portal/core/controller/HTTPResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/HandlerResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/AbstractResponseHandler.java
trunk/theme/src/main/org/jboss/portal/theme/page/PageRendition.java
Modified:
trunk/core-cms/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/InternalCMSContentProvider.java
trunk/core-samples/src/resources/portal-samples-war/WEB-INF/default-object.xml
trunk/core/src/main/org/jboss/portal/core/aspects/controller/NavigationalStateInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PolicyEnforcementInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeInterceptor.java
trunk/core/src/main/org/jboss/portal/core/controller/Controller.java
trunk/core/src/main/org/jboss/portal/core/controller/ControllerCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java
trunk/core/src/main/org/jboss/portal/core/controller/ControllerInterceptor.java
trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandlerSelector.java
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/command/SignOutCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/response/SignOutResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/command/response/StreamContentResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java
trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java
trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/action/InvokePortletInstanceActionCommand.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/action/InvokePortletInstanceRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/render/RenderPortletInstanceCommand.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/response/UpdatePortletInstanceResponse.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/ImportPageToDashboardCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowActionCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/MoveWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderPageCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdatePageResponse.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowResponse.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewDashboardCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewPageCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/content/ContentRenderer.java
Log:
update command response stuff to handle throwable as any other kind of response allowing a more flexible handling of exceptions
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/NavigationalStateInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/NavigationalStateInterceptor.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/NavigationalStateInterceptor.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -25,6 +25,7 @@
import org.jboss.portal.core.controller.ControllerInterceptor;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.model.portal.ns.PortalObjectNavigationalStateContext;
import org.jboss.portal.common.invocation.InvocationException;
@@ -36,9 +37,9 @@
*/
public class NavigationalStateInterceptor extends ControllerInterceptor
{
- public Object invoke(ControllerCommand cmd) throws Exception, InvocationException
+ public ControllerResponse invoke(ControllerCommand cmd) throws Exception, InvocationException
{
- Object ret = cmd.invokeNext();
+ ControllerResponse ret = (ControllerResponse)cmd.invokeNext();
// We commit the nav state changes only for the classic controller at the base of the pipeline
ControllerContext controllerContext = cmd.getControllerContext();
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -29,6 +29,7 @@
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ControllerInterceptor;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.controller.command.SignOutCommand;
import org.jboss.portal.core.impl.model.portal.PortalObjectImpl;
import org.jboss.portal.core.model.CustomizationManager;
@@ -44,12 +45,12 @@
import org.jboss.portal.core.model.portal.command.render.RenderPageCommand;
import org.jboss.portal.core.model.portal.command.view.ViewDashboardCommand;
import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
+import org.jboss.portal.core.theme.PageRendition;
import org.jboss.portal.identity.User;
import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.security.PortalSecurityException;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.theme.page.PageRendition;
import org.jboss.portal.theme.ThemeConstants;
import org.jboss.portal.theme.impl.render.dynamic.DynaRenderOptions;
import org.jboss.portal.theme.page.Region;
@@ -101,9 +102,9 @@
this.portalAuthorizationManagerFactory = portalAuthorizationManagerFactory;
}
- public Object invoke(ControllerCommand cmd) throws Exception
+ public ControllerResponse invoke(ControllerCommand cmd) throws Exception
{
- Object resp = cmd.invokeNext();
+ ControllerResponse resp = (ControllerResponse)cmd.invokeNext();
// Insert navigation portlet in the page
if (resp instanceof PageRendition)
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PolicyEnforcementInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PolicyEnforcementInterceptor.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PolicyEnforcementInterceptor.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -28,6 +28,7 @@
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerInterceptor;
import org.jboss.portal.core.controller.ControllerSecurityException;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.security.PortalSecurityException;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
@@ -58,14 +59,14 @@
* @throws org.jboss.portal.common.invocation.InvocationException
*
*/
- public Object invoke(ControllerCommand cmd) throws Exception, InvocationException
+ public ControllerResponse invoke(ControllerCommand cmd) throws Exception, InvocationException
{
try
{
PortalAuthorizationManagerFactory pamf = cmd.getControllerContext().getController().getPortalAuthorizationManagerFactory();
PortalAuthorizationManager pam = pamf.getManager();
cmd.enforceSecurity(pam);
- return cmd.invokeNext();
+ return (ControllerResponse)cmd.invokeNext();
}
catch (PortalSecurityException e)
{
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -39,6 +39,7 @@
import org.jboss.portal.core.controller.CommandRedirectionException;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerInterceptor;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowActionCommand;
import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.model.portal.command.WindowCommand;
@@ -73,7 +74,7 @@
this.listenerRegistry = listenerRegistry;
}
- public Object invoke(ControllerCommand cmd) throws Exception, InvocationException
+ public ControllerResponse invoke(ControllerCommand cmd) throws Exception, InvocationException
{
PortalObjectNode node = Navigation.getCurrentNode();
@@ -184,7 +185,7 @@
}
else
{
- return cmd.invokeNext();
+ return (ControllerResponse)cmd.invokeNext();
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeInterceptor.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeInterceptor.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -25,6 +25,7 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerInterceptor;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.model.portal.command.render.RenderPageCommand;
import org.jboss.portal.core.model.portal.command.WindowCommand;
import org.jboss.portal.core.model.portal.Page;
@@ -37,7 +38,7 @@
public class PortalNodeInterceptor extends ControllerInterceptor
{
- public Object invoke(ControllerCommand cmd) throws Exception, InvocationException
+ public ControllerResponse invoke(ControllerCommand cmd) throws Exception, InvocationException
{
// Get the next node
PortalObjectNode next = getNode(cmd);
@@ -51,7 +52,7 @@
Navigation.setCurrentNode(next);
// Invoke
- return cmd.invokeNext();
+ return (ControllerResponse)cmd.invokeNext();
}
finally
{
Deleted: trunk/core/src/main/org/jboss/portal/core/controller/AjaxResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/AjaxResponse.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/AjaxResponse.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -1,58 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.controller;
-
-import org.jboss.portal.core.controller.HandlerResponse;
-import org.jboss.portal.theme.impl.render.dynamic.DynaResponse;
-import org.jboss.portal.theme.impl.render.dynamic.JSONMarshaller;
-import org.jboss.portal.server.ServerInvocationContext;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class AjaxResponse extends HandlerResponse
-{
-
- /** . */
- private static final JSONMarshaller marshaller = new JSONMarshaller();
-
- /** The response to the client. */
- private final DynaResponse dynaResponse;
-
- public AjaxResponse(DynaResponse dynaResponse)
- {
- this.dynaResponse = dynaResponse;
- }
-
- public void sendResponse(ServerInvocationContext ctx) throws IOException, ServletException
- {
- HttpServletResponse resp = ctx.getClientResponse();
- resp.setContentType("text/html");
- marshaller.write(dynaResponse, resp.getWriter());
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/controller/CommandForward.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/CommandForward.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/CommandForward.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -1,61 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.controller;
-
-import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.core.controller.ControllerCommand;
-
-/**
- * Forward to a new command.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class CommandForward extends HandlerResponse
-{
- /** . */
- private final ControllerCommand cmd;
-
- /** . */
- private final URLContext urlCtx;
-
- public CommandForward(ControllerCommand cmd, URLContext urlCtx)
- {
- if (cmd == null)
- {
- throw new IllegalArgumentException("No command provided");
- }
- this.cmd = cmd;
- this.urlCtx = urlCtx;
- }
-
- public ControllerCommand getCommand()
- {
- return cmd;
- }
-
- public URLContext getURLContext()
- {
- return urlCtx;
- }
-}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/Controller.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/Controller.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/Controller.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -25,6 +25,13 @@
import org.jboss.portal.theme.PageService;
import org.jboss.portal.core.controller.command.mapper.CommandFactory;
import org.jboss.portal.core.controller.command.mapper.URLFactory;
+import org.jboss.portal.core.controller.command.response.ThrowableResponse;
+import org.jboss.portal.core.controller.handler.HandlerResponse;
+import org.jboss.portal.core.controller.handler.ResponseForward;
+import org.jboss.portal.core.controller.handler.HTTPResponse;
+import org.jboss.portal.core.controller.handler.CommandForward;
+import org.jboss.portal.core.controller.handler.ResponseHandler;
+import org.jboss.portal.core.controller.handler.AjaxResponse;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.content.ContentRendererRegistry;
import org.jboss.portal.core.model.instance.InstanceContainer;
@@ -35,12 +42,8 @@
import org.jboss.portal.server.RequestController;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerException;
-import org.jboss.portal.server.ServerURL;
-import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.web.spi.ServletContainerContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.IOException;
@@ -213,85 +216,100 @@
* Handle a command which means it executes the command and reacts upon the response created by the command.
*
* @param controllerContext the controller context
- * @param cmd the command
+ * @param command the command
* @throws org.jboss.portal.server.ServerException
*/
- protected void processCommand(ControllerContext controllerContext, ControllerCommand cmd) throws ServerException
+ protected void processCommand(ControllerContext controllerContext, ControllerCommand command) throws ServerException
{
- HandlerResponse handlerResp = executeCommand(controllerContext, cmd);
+ ControllerResponse response = executeCommand(controllerContext, command);
//
- if (handlerResp == null)
+ if (response == null)
{
return;
}
+ if (response instanceof ThrowableResponse)
+ {
+ ThrowableResponse throwableResponse = (ThrowableResponse)response;
+ Throwable t = throwableResponse.getThrowable();
- // Find out if we can execute in the same server invocation
- if (handlerResp instanceof CommandForward)
+ // Handle the special exception here
+ if (t instanceof CommandRedirectionException)
+ {
+ CommandRedirectionException commandRedirection = (CommandRedirectionException)t;
+ processHandlerResponse(
+ controllerContext,
+ command,
+ new CommandForward(commandRedirection.getRedirection(), null));
+ }
+ }
+
+ //
+ processCommandResponse(controllerContext, command, response);
+ }
+
+ protected void processCommandResponse(
+ ControllerContext controllerContext,
+ ControllerCommand command,
+ ControllerResponse response) throws ServerException
+ {
+ // Handle the result
+ HandlerResponse handlerResponse;
+ try
{
- CommandForward forward = (CommandForward)handlerResp;
- processCommand(controllerContext, forward.getCommand());
+ handlerResponse = responseHandler.processCommandResponse(controllerContext, command, response);
}
- else if (handlerResp instanceof HTTPResponse)
+ catch (ResponseHandlerException e)
{
- HTTPResponse hr = (HTTPResponse)handlerResp;
- sendResponse(controllerContext, hr);
+ throw new ServerException(e);
}
- else if (handlerResp instanceof AjaxResponse)
+
+ // Might be null if no handling done
+ if (handlerResponse == null)
{
- AjaxResponse ar = (AjaxResponse)handlerResp;
- sendResponse(controllerContext, ar);
+ return;
}
+
+ //
+ processHandlerResponse(controllerContext, command, handlerResponse);
}
- protected HandlerResponse executeCommand(ControllerContext controllerContext, ControllerCommand command) throws ServerException
+ protected void processHandlerResponse(ControllerContext controllerContext, ControllerCommand command, HandlerResponse handlerResponse) throws ServerException
{
- URLContext urlContext = controllerContext.getServerInvocation().getServerContext().getURLContext();
-
- try
+ // Find out if we can execute in the same server invocation
+ if (handlerResponse instanceof CommandForward)
{
- // Execute command
- Object commandResponse = controllerContext.execute(command);
-
- // Handle the result, might be null if no handling done
- return responseHandler.processCommandResponse(controllerContext, command, commandResponse);
+ CommandForward forward = (CommandForward)handlerResponse;
+ processCommand(controllerContext, forward.getCommand());
}
- catch (CommandRedirectionException e)
+ else if (handlerResponse instanceof ResponseForward)
{
- // Handle the redirection as forward
- return new CommandForward(e.getRedirection(), null);
+ ResponseForward forward = (ResponseForward)handlerResponse;
+ ControllerResponse response = forward.getResponse();
+ processCommandResponse(controllerContext, command, response);
}
- catch (ControllerSecurityException e)
+ else if (handlerResponse instanceof HTTPResponse)
{
- if (urlContext.isAuthenticated())
- {
- return new HTTPResponse.SetStatusCode(HttpServletResponse.SC_UNAUTHORIZED);
- }
- else
- {
- urlContext = URLContext.newInstance(urlContext.isSecure(), true);
- ServerURL serverURL = getURLFactory().doMapping(controllerContext.getServerInvocation(), command);
- String url = controllerContext.getServerInvocation().getResponse().renderURL(serverURL, urlContext, null);
- return new HTTPResponse.SendRedirect(url);
- }
+ HTTPResponse hr = (HTTPResponse)handlerResponse;
+ sendResponse(controllerContext, hr);
}
- catch (ResourceNotFoundException e)
+ else if (handlerResponse instanceof AjaxResponse)
{
- log.error("Resource not found " + e.getRef(), e);
- return new HTTPResponse.SetStatusCode(HttpServletResponse.SC_NOT_FOUND);
+ AjaxResponse ar = (AjaxResponse)handlerResponse;
+ sendResponse(controllerContext, ar);
}
- catch (ControllerException e)
+ }
+
+ protected ControllerResponse executeCommand(ControllerContext controllerContext, ControllerCommand command)
+ {
+ try
{
- throw new ServerException(e);
+ return controllerContext.execute(command);
}
- catch (ServletException e)
+ catch (Throwable t)
{
- throw new ServerException(e);
+ return new ThrowableResponse(t);
}
- catch (IOException e)
- {
- throw new ServerException(e);
- }
}
/**
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ControllerCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ControllerCommand.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ControllerCommand.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -133,7 +133,7 @@
}
/** Execute the command. */
- public abstract Object execute() throws ControllerException;
+ public abstract ControllerResponse execute() throws ControllerException;
public static void rethrow(Exception e) throws ControllerException, InvocationException, RuntimeException
{
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -32,7 +32,6 @@
import org.jboss.portal.identity.User;
import org.jboss.portal.core.aspects.server.UserInterceptor;
import org.jboss.portal.core.model.portal.ns.PortalObjectNavigationalStateContext;
-import org.jboss.portal.core.CoreConstants;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
@@ -97,7 +96,7 @@
addResolver(ControllerCommand.PRINCIPAL_SCOPE, serverInvocation.getContext());
}
- public Object execute(ControllerCommand command) throws ControllerException, InvocationException
+ public ControllerResponse execute(ControllerCommand command) throws ControllerException, InvocationException
{
if (command == null)
{
@@ -119,7 +118,7 @@
InterceptorStack commandStack = controller.getStackFactory().getInterceptorStack();
//
- return command.invoke(commandStack);
+ return (ControllerResponse)command.invoke(commandStack);
}
catch (Exception e)
{
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ControllerInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ControllerInterceptor.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ControllerInterceptor.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -38,5 +38,5 @@
return invoke((ControllerCommand)invocation);
}
- public abstract Object invoke(ControllerCommand cmd) throws Exception, InvocationException;
+ public abstract ControllerResponse invoke(ControllerCommand cmd) throws Exception, InvocationException;
}
Added: trunk/core/src/main/org/jboss/portal/core/controller/ControllerResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ControllerResponse.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ControllerResponse.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ControllerResponse
+{
+}
Deleted: trunk/core/src/main/org/jboss/portal/core/controller/HTTPResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/HTTPResponse.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/HTTPResponse.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -1,119 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.controller;
-
-import org.jboss.portal.server.ServerInvocationContext;
-import org.jboss.portal.common.util.Tools;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.ServletException;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Response that sends a response to the http stream.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public abstract class HTTPResponse extends HandlerResponse
-{
-
- public abstract void sendResponse(ServerInvocationContext ctx) throws IOException, ServletException;
-
- public static class SetStatusCode extends HTTPResponse
- {
-
- /** . */
- private final int statusCode;
-
- public SetStatusCode(int statusCode)
- {
- this.statusCode = statusCode;
- }
-
- public void sendResponse(ServerInvocationContext ctx) throws IOException
- {
- HttpServletResponse resp = ctx.getClientResponse();
- resp.sendError(statusCode);
- }
- }
-
- public static class SendRedirect extends HTTPResponse
- {
-
- /** . */
- private final String redirect;
-
- public SendRedirect(String redirect)
- {
- this.redirect = redirect;
- }
-
- public void sendResponse(ServerInvocationContext ctx) throws IOException
- {
- HttpServletResponse resp = ctx.getClientResponse();
- resp.sendRedirect(redirect);
- }
- }
-
- public static class SendBinary extends HTTPResponse
- {
-
- /** . */
- private final String contentType;
-
- /** . */
- private final InputStream in;
-
- public SendBinary(String contentType, InputStream inputStream)
- {
- this.contentType = contentType;
- this.in = inputStream;
- }
-
- public void sendResponse(ServerInvocationContext ctx) throws IOException
- {
- HttpServletResponse resp = ctx.getClientResponse();
- resp.setContentType(contentType);
- ServletOutputStream sout = null;
- try
- {
- sout = resp.getOutputStream();
- byte[] buf = new byte[2048];
- int len;
- while ((len = in.read(buf)) > 0)
- {
- sout.write(buf, 0, len);
- }
- sout.flush();
- }
- finally
- {
- Tools.safeClose(in);
- Tools.safeClose(sout);
- }
- }
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/controller/HandlerResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/HandlerResponse.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/HandlerResponse.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -1,33 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.controller;
-
-/**
- * The response from a a response handler.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public abstract class HandlerResponse
-{
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandler.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandler.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -1,39 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.controller;
-
-import org.jboss.portal.server.ServerException;
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.ControllerContext;
-
-import javax.servlet.ServletException;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface ResponseHandler
-{
- public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand command, Object commandResponse) throws IOException, ServletException, ServerException;
-}
Added: trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandlerException.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandlerException.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandlerException.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -0,0 +1,49 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ResponseHandlerException extends Exception
+{
+ public ResponseHandlerException()
+ {
+ }
+
+ public ResponseHandlerException(String message)
+ {
+ super(message);
+ }
+
+ public ResponseHandlerException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public ResponseHandlerException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandlerSelector.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandlerSelector.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ResponseHandlerSelector.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -22,12 +22,9 @@
******************************************************************************/
package org.jboss.portal.core.controller;
-import org.jboss.portal.server.ServerException;
+import org.jboss.portal.core.controller.handler.ResponseHandler;
+import org.jboss.portal.core.controller.handler.HandlerResponse;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import java.io.IOException;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
@@ -61,15 +58,15 @@
this.ajaxResponseHandler = ajaxResponseHandler;
}
- public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand command, Object commandResponse) throws IOException, ServletException, ServerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand command, ControllerResponse response) throws ResponseHandlerException
{
if (ControllerContext.AJAX_TYPE == controllerContext.getType())
{
- return ajaxResponseHandler.processCommandResponse(controllerContext, command, commandResponse);
+ return ajaxResponseHandler.processCommandResponse(controllerContext, command, response);
}
else
{
- return classicResponseHandler.processCommandResponse(controllerContext, command, commandResponse);
+ return classicResponseHandler.processCommandResponse(controllerContext, command, response);
}
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -26,9 +26,10 @@
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerInterceptor;
import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.model.portal.command.render.RenderPageCommand;
import org.jboss.portal.core.model.portal.ns.PortalObjectNavigationalStateContext;
-import org.jboss.portal.theme.page.PageRendition;
+import org.jboss.portal.core.theme.PageRendition;
import org.jboss.portal.theme.impl.render.dynamic.DynaConstants;
import org.jboss.portal.theme.impl.render.dynamic.DynaRenderOptions;
import org.jboss.portal.server.ServerURL;
@@ -48,9 +49,9 @@
/** . */
private static final DynaRenderOptions AJAX_OPTIONS = DynaRenderOptions.getOptions(Boolean.TRUE, Boolean.TRUE);
- public Object invoke(ControllerCommand cmd) throws Exception, InvocationException
+ public ControllerResponse invoke(ControllerCommand cmd) throws Exception, InvocationException
{
- Object response = cmd.invokeNext();
+ ControllerResponse response = (ControllerResponse)cmd.invokeNext();
// Configure ajax if needed
if (response instanceof PageRendition)
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -22,17 +22,18 @@
******************************************************************************/
package org.jboss.portal.core.controller.ajax;
-import org.jboss.portal.core.controller.ResponseHandler;
-import org.jboss.portal.core.controller.HandlerResponse;
+import org.jboss.portal.core.controller.handler.ResponseHandler;
+import org.jboss.portal.core.controller.handler.HandlerResponse;
+import org.jboss.portal.core.controller.handler.AjaxResponse;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.CommandForward;
-import org.jboss.portal.core.controller.AjaxResponse;
+import org.jboss.portal.core.controller.ControllerResponse;
+import org.jboss.portal.core.controller.ResponseHandlerException;
+import org.jboss.portal.core.controller.handler.CommandForward;
import org.jboss.portal.core.controller.portlet.PortletResponseHandler;
import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
import org.jboss.portal.core.model.portal.command.response.UpdateWindowResponse;
import org.jboss.portal.core.model.portal.command.response.UpdatePageResponse;
-import org.jboss.portal.core.model.portal.command.PortalObjectCommand;
import org.jboss.portal.core.model.portal.command.render.RenderPageCommand;
import org.jboss.portal.core.model.portal.command.render.RenderWindowCommand;
import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
@@ -47,7 +48,7 @@
import org.jboss.portal.core.ns.NavigationalStateChange;
import org.jboss.portal.core.ns.NavigationalStateObjectChange;
import org.jboss.portal.core.ns.NavigationalStateKey;
-import org.jboss.portal.server.ServerException;
+import org.jboss.portal.core.theme.WindowRendition;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.RenderResponse;
@@ -69,8 +70,6 @@
import org.jboss.portal.theme.page.WindowContext;
import org.jboss.portal.theme.page.Region;
-import javax.servlet.ServletException;
-import java.io.IOException;
import java.io.StringWriter;
import java.util.Set;
import java.util.HashSet;
@@ -141,12 +140,12 @@
public HandlerResponse processCommandResponse(
ControllerContext controllerContext,
- ControllerCommand command,
- Object commandResponse) throws IOException, ServletException, ServerException
+ ControllerCommand commeand,
+ ControllerResponse response) throws ResponseHandlerException
{
- if (commandResponse instanceof PortletWindowResponse)
+ if (response instanceof PortletWindowResponse)
{
- PortletWindowResponse pwr = (PortletWindowResponse)commandResponse;
+ PortletWindowResponse pwr = (PortletWindowResponse)response;
PortletInvocationResponse pir = pwr.getResult();
if (pir instanceof RenderResponse)
{
@@ -166,27 +165,23 @@
}
else
{
- throw new Error("todo " + commandResponse);
+ throw new Error("todo " + response);
}
}
- else if (commandResponse instanceof UpdatePageResponse)
+ else if (response instanceof UpdatePageResponse)
{
- UpdatePageResponse upr = (UpdatePageResponse)commandResponse;
+ UpdatePageResponse upr = (UpdatePageResponse)response;
ViewPageCommand rpc = new ViewPageCommand(upr.getPageId());
String url = controllerContext.renderURL(rpc, null, null);
UpdatePageLocationResponse dresp = new UpdatePageLocationResponse(url);
return new AjaxResponse(dresp);
}
- else if (commandResponse instanceof UpdateWindowResponse)
+ else if (response instanceof UpdateWindowResponse)
{
- // We make an assumption here, the window result should carry somehow the window id
- PortalObjectCommand pocmd = (PortalObjectCommand)command;
+ UpdateWindowResponse upw = (UpdateWindowResponse)response;
- //
- ServerInvocation invocation = controllerContext.getServerInvocation();
-
// Obtain page and portal
- final Window window = (Window)portalObjectContainer.getObject(pocmd.getTargetId());
+ final Window window = (Window)portalObjectContainer.getObject(upw.getWindowId());
Page page = (Page)window.getParent();
Portal portal = page.getPortal();
@@ -288,16 +283,20 @@
PageResult res = new PageResult(page.getName(), page.getProperties(), portal.getProperties());
//
+ ServerInvocation invocation = controllerContext.getServerInvocation();
+
+ //
for (Iterator i = windowToRefresh.iterator();i.hasNext();)
{
final PortalObject _window = (PortalObject)i.next();
RenderWindowCommand rwc = new RenderWindowCommand(_window.getId());
try
{
- Object wresp = controllerContext.execute(rwc);
- if (wresp instanceof WindowResult)
+ ControllerResponse wresp = controllerContext.execute(rwc);
+ if (wresp instanceof WindowRendition)
{
- final WindowResult windowResult = (WindowResult)wresp;
+ WindowRendition rendition = (WindowRendition)wresp;
+ final WindowResult windowResult = rendition.getWindow();
//
WindowContext wc = new WindowContext(
Deleted: trunk/core/src/main/org/jboss/portal/core/controller/classic/AbstractResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/classic/AbstractResponseHandler.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/AbstractResponseHandler.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -1,34 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.controller.classic;
-
-import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.core.controller.ResponseHandler;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public abstract class AbstractResponseHandler extends AbstractJBossService implements ResponseHandler
-{
-}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -22,21 +22,23 @@
******************************************************************************/
package org.jboss.portal.core.controller.classic;
-import org.jboss.portal.server.ServerException;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerInvocationContext;
import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.theme.page.PageRendition;
+import org.jboss.portal.core.theme.PageRendition;
import org.jboss.portal.core.controller.command.response.SignOutResponse;
import org.jboss.portal.core.controller.command.response.StreamContentResponse;
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.core.controller.HTTPResponse;
-import org.jboss.portal.core.controller.HandlerResponse;
-import org.jboss.portal.core.controller.ResponseHandler;
-import org.jboss.portal.core.controller.CommandForward;
+import org.jboss.portal.core.controller.ResponseHandlerException;
+import org.jboss.portal.core.controller.ControllerResponse;
+import org.jboss.portal.core.controller.handler.AbstractResponseHandler;
+import org.jboss.portal.core.controller.handler.HTTPResponse;
+import org.jboss.portal.core.controller.handler.HandlerResponse;
+import org.jboss.portal.core.controller.handler.ResponseHandler;
+import org.jboss.portal.core.controller.handler.CommandForward;
import org.jboss.portal.core.controller.portlet.PortletResponseHandler;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
@@ -62,15 +64,15 @@
public HandlerResponse processCommandResponse(
ControllerContext controllerContext,
ControllerCommand command,
- Object commandResponse) throws IOException, ServletException, ServerException
+ ControllerResponse commandResponse) throws ResponseHandlerException
{
- HandlerResponse response = processHandlers(controllerContext, command, commandResponse);
+ HandlerResponse handlerResponse = processHandlers(controllerContext, command, commandResponse);
// Handle redirection here
- if (response instanceof CommandForward)
+ if (handlerResponse instanceof CommandForward)
{
- CommandForward forward = (CommandForward)response;
+ CommandForward forward = (CommandForward)handlerResponse;
URLContext urlContext = controllerContext.getServerInvocation().getServerContext().getURLContext();
if (requiresRedirect(command, urlContext, forward))
{
@@ -80,13 +82,13 @@
}
//
- return response;
+ return handlerResponse;
}
private HandlerResponse processHandlers(
ControllerContext controllerContext,
ControllerCommand command,
- Object commandResponse) throws IOException, ServletException, ServerException
+ ControllerResponse commandResponse) throws ResponseHandlerException
{
for (int i = 0;i < handlers.length;i++)
{
@@ -104,12 +106,12 @@
private static class OtherResponseHandler implements ResponseHandler
{
- public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand command, Object commandResponse) throws IOException, ServletException, ServerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand cdmand, ControllerResponse response) throws ResponseHandlerException
{
final ServerInvocation invocation = controllerContext.getServerInvocation();
- if (commandResponse instanceof PageRendition)
+ if (response instanceof PageRendition)
{
- final PageRendition rendition = (PageRendition)commandResponse;
+ final PageRendition rendition = (PageRendition)response;
// Defer execution of rendition to the right place which is in the classic controller send response
return new HTTPResponse()
@@ -122,10 +124,10 @@
}
};
}
- else if (commandResponse instanceof SignOutResponse)
+ else if (response instanceof SignOutResponse)
{
// Get the optional signout location
- String location = ((SignOutResponse)commandResponse).getLocation();
+ String location = ((SignOutResponse)response).getLocation();
// Indicate that we want a sign out to be done
invocation.getResponse().setWantSignOut(true);
@@ -143,9 +145,9 @@
//
return new HTTPResponse.SendRedirect(location);
}
- else if (commandResponse instanceof StreamContentResponse)
+ else if (response instanceof StreamContentResponse)
{
- StreamContentResponse scr = (StreamContentResponse)commandResponse;
+ StreamContentResponse scr = (StreamContentResponse)response;
return new HTTPResponse.SendBinary(scr.getContentType(), scr.getInputStream());
}
else
@@ -158,6 +160,7 @@
// Unhardcode this
private ResponseHandler[] handlers = new ResponseHandler[]
{
+ new ThrowableResponseHandler(),
new OtherResponseHandler(),
new PortletInstanceResponseHandler(),
new PortalObjectResponseHandler(),
Added: trunk/core/src/main/org/jboss/portal/core/controller/classic/ThrowableResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/classic/ThrowableResponseHandler.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ThrowableResponseHandler.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -0,0 +1,94 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller.classic;
+
+import org.jboss.portal.core.controller.handler.ResponseHandler;
+import org.jboss.portal.core.controller.handler.HandlerResponse;
+import org.jboss.portal.core.controller.handler.HTTPResponse;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ResponseHandlerException;
+import org.jboss.portal.core.controller.ControllerSecurityException;
+import org.jboss.portal.core.controller.ResourceNotFoundException;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ControllerResponse;
+import org.jboss.portal.core.controller.command.response.ThrowableResponse;
+import org.jboss.portal.server.ServerURL;
+import org.jboss.portal.server.request.URLContext;
+
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ThrowableResponseHandler implements ResponseHandler
+{
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand command, ControllerResponse response) throws ResponseHandlerException
+ {
+ if (response instanceof ThrowableResponse)
+ {
+ ThrowableResponse tr = (ThrowableResponse)response;
+ Throwable t = tr.getThrowable();
+ URLContext urlContext = controllerContext.getServerInvocation().getServerContext().getURLContext();
+
+ //
+ if (t instanceof ControllerSecurityException)
+ {
+ if (urlContext.isAuthenticated())
+ {
+ return new HTTPResponse.SetStatusCode(HttpServletResponse.SC_UNAUTHORIZED);
+ }
+ else
+ {
+ urlContext = URLContext.newInstance(urlContext.isSecure(), true);
+ ServerURL serverURL = controllerContext.getController().getURLFactory().doMapping(controllerContext.getServerInvocation(), command);
+ String url = controllerContext.getServerInvocation().getResponse().renderURL(serverURL, urlContext, null);
+ return new HTTPResponse.SendRedirect(url);
+ }
+ }
+ else if (t instanceof ResourceNotFoundException)
+ {
+ ResourceNotFoundException rnfe = (ResourceNotFoundException)t;
+ // log.error("Resource not found " + e.getRef(), e);
+ return new HTTPResponse.SetStatusCode(HttpServletResponse.SC_NOT_FOUND);
+ }
+ else if (t instanceof ControllerException)
+ {
+ ControllerException ce = (ControllerException)t;
+ throw new ResponseHandlerException(ce);
+ }
+ else if (t instanceof Exception)
+ {
+ Exception e = (Exception)t;
+ throw new ResponseHandlerException(e);
+ }
+ else
+ {
+ // todo
+ t.printStackTrace();
+ }
+ }
+ return null;
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/SignOutCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/SignOutCommand.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/SignOutCommand.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -24,6 +24,7 @@
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.command.response.SignOutResponse;
@@ -58,7 +59,7 @@
return info;
}
- public Object execute() throws ControllerException
+ public ControllerResponse execute() throws ControllerException
{
if (location != null)
{
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/response/SignOutResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/response/SignOutResponse.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/response/SignOutResponse.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -22,11 +22,13 @@
******************************************************************************/
package org.jboss.portal.core.controller.command.response;
+import org.jboss.portal.core.controller.ControllerResponse;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class SignOutResponse
+public class SignOutResponse extends ControllerResponse
{
/** Location is a URL to navigate to after signing out or null to indicate default behavior. */
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/response/StreamContentResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/response/StreamContentResponse.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/response/StreamContentResponse.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -22,13 +22,15 @@
******************************************************************************/
package org.jboss.portal.core.controller.command.response;
+import org.jboss.portal.core.controller.ControllerResponse;
+
import java.io.InputStream;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class StreamContentResponse
+public class StreamContentResponse extends ControllerResponse
{
/** . */
Added: trunk/core/src/main/org/jboss/portal/core/controller/command/response/ThrowableResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/response/ThrowableResponse.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/response/ThrowableResponse.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller.command.response;
+
+import org.jboss.portal.core.controller.ControllerResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ThrowableResponse extends ControllerResponse
+{
+
+ /** . */
+ private final Throwable throwable;
+
+ public ThrowableResponse(Throwable throwable)
+ {
+ this.throwable = throwable;
+ }
+
+ public Throwable getThrowable()
+ {
+ return throwable;
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/controller/handler/AbstractResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/handler/AbstractResponseHandler.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/controller/handler/AbstractResponseHandler.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller.handler;
+
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.core.controller.handler.ResponseHandler;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractResponseHandler extends AbstractJBossService implements ResponseHandler
+{
+}
Added: trunk/core/src/main/org/jboss/portal/core/controller/handler/AjaxResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/handler/AjaxResponse.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/controller/handler/AjaxResponse.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller.handler;
+
+import org.jboss.portal.core.controller.handler.HandlerResponse;
+import org.jboss.portal.theme.impl.render.dynamic.DynaResponse;
+import org.jboss.portal.theme.impl.render.dynamic.JSONMarshaller;
+import org.jboss.portal.server.ServerInvocationContext;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AjaxResponse extends HandlerResponse
+{
+
+ /** . */
+ private static final JSONMarshaller marshaller = new JSONMarshaller();
+
+ /** The response to the client. */
+ private final DynaResponse dynaResponse;
+
+ public AjaxResponse(DynaResponse dynaResponse)
+ {
+ this.dynaResponse = dynaResponse;
+ }
+
+ public void sendResponse(ServerInvocationContext ctx) throws IOException, ServletException
+ {
+ HttpServletResponse resp = ctx.getClientResponse();
+ resp.setContentType("text/html");
+ marshaller.write(dynaResponse, resp.getWriter());
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/controller/handler/CommandForward.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/handler/CommandForward.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/controller/handler/CommandForward.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -0,0 +1,61 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller.handler;
+
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.core.controller.ControllerCommand;
+
+/**
+ * Forward to a new command.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CommandForward extends HandlerResponse
+{
+ /** . */
+ private final ControllerCommand cmd;
+
+ /** . */
+ private final URLContext urlCtx;
+
+ public CommandForward(ControllerCommand cmd, URLContext urlCtx)
+ {
+ if (cmd == null)
+ {
+ throw new IllegalArgumentException("No command provided");
+ }
+ this.cmd = cmd;
+ this.urlCtx = urlCtx;
+ }
+
+ public ControllerCommand getCommand()
+ {
+ return cmd;
+ }
+
+ public URLContext getURLContext()
+ {
+ return urlCtx;
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/controller/handler/HTTPResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/handler/HTTPResponse.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/controller/handler/HTTPResponse.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -0,0 +1,119 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller.handler;
+
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.common.util.Tools;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.ServletException;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Response that sends a response to the http stream.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class HTTPResponse extends HandlerResponse
+{
+
+ public abstract void sendResponse(ServerInvocationContext ctx) throws IOException, ServletException;
+
+ public static class SetStatusCode extends HTTPResponse
+ {
+
+ /** . */
+ private final int statusCode;
+
+ public SetStatusCode(int statusCode)
+ {
+ this.statusCode = statusCode;
+ }
+
+ public void sendResponse(ServerInvocationContext ctx) throws IOException
+ {
+ HttpServletResponse resp = ctx.getClientResponse();
+ resp.sendError(statusCode);
+ }
+ }
+
+ public static class SendRedirect extends HTTPResponse
+ {
+
+ /** . */
+ private final String redirect;
+
+ public SendRedirect(String redirect)
+ {
+ this.redirect = redirect;
+ }
+
+ public void sendResponse(ServerInvocationContext ctx) throws IOException
+ {
+ HttpServletResponse resp = ctx.getClientResponse();
+ resp.sendRedirect(redirect);
+ }
+ }
+
+ public static class SendBinary extends HTTPResponse
+ {
+
+ /** . */
+ private final String contentType;
+
+ /** . */
+ private final InputStream in;
+
+ public SendBinary(String contentType, InputStream inputStream)
+ {
+ this.contentType = contentType;
+ this.in = inputStream;
+ }
+
+ public void sendResponse(ServerInvocationContext ctx) throws IOException
+ {
+ HttpServletResponse resp = ctx.getClientResponse();
+ resp.setContentType(contentType);
+ ServletOutputStream sout = null;
+ try
+ {
+ sout = resp.getOutputStream();
+ byte[] buf = new byte[2048];
+ int len;
+ while ((len = in.read(buf)) > 0)
+ {
+ sout.write(buf, 0, len);
+ }
+ sout.flush();
+ }
+ finally
+ {
+ Tools.safeClose(in);
+ Tools.safeClose(sout);
+ }
+ }
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/controller/handler/HandlerResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/handler/HandlerResponse.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/controller/handler/HandlerResponse.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller.handler;
+
+/**
+ * The response from a a response handler.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class HandlerResponse
+{
+}
Added: trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseForward.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseForward.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseForward.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller.handler;
+
+import org.jboss.portal.core.controller.ControllerResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ResponseForward extends HandlerResponse
+{
+
+ /** . */
+ private ControllerResponse response;
+
+ public ResponseForward(ControllerResponse response)
+ {
+ this.response = response;
+ }
+
+ public ControllerResponse getResponse()
+ {
+ return response;
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandler.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandler.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller.handler;
+
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.ResponseHandlerException;
+import org.jboss.portal.core.controller.ControllerResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ResponseHandler
+{
+ public HandlerResponse processCommandResponse(
+ ControllerContext controllerContext,
+ ControllerCommand command,
+ ControllerResponse response) throws ResponseHandlerException;
+}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponse.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponse.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -23,6 +23,7 @@
package org.jboss.portal.core.controller.portlet;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.core.controller.ControllerResponse;
/**
* Controller response provided by a portlet.
@@ -30,7 +31,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public abstract class PortletResponse
+public abstract class PortletResponse extends ControllerResponse
{
/** . */
Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -24,10 +24,12 @@
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.core.controller.HTTPResponse;
-import org.jboss.portal.core.controller.CommandForward;
-import org.jboss.portal.core.controller.classic.AbstractResponseHandler;
-import org.jboss.portal.core.controller.HandlerResponse;
+import org.jboss.portal.core.controller.ControllerResponse;
+import org.jboss.portal.core.controller.ResponseHandlerException;
+import org.jboss.portal.core.controller.handler.HTTPResponse;
+import org.jboss.portal.core.controller.handler.CommandForward;
+import org.jboss.portal.core.controller.handler.AbstractResponseHandler;
+import org.jboss.portal.core.controller.handler.HandlerResponse;
import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowActionCommand;
import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
@@ -35,7 +37,6 @@
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.instance.command.response.PortletInstanceResponse;
import org.jboss.portal.core.model.instance.command.action.InvokePortletInstanceRenderCommand;
-import org.jboss.portal.server.ServerException;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -48,9 +49,7 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.Mode;
-import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -85,12 +84,12 @@
}
}
- public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand command, Object commandResponse) throws IOException, ServletException, ServerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand command, ControllerResponse response) throws ResponseHandlerException
{
- if (commandResponse instanceof PortletResponse)
+ if (response instanceof PortletResponse)
{
ServerInvocation invocation = controllerContext.getServerInvocation();
- PortletResponse pr = (PortletResponse)commandResponse;
+ PortletResponse pr = (PortletResponse)response;
PortletInvocationResponse pir = pr.getResult();
//
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -38,8 +38,10 @@
import org.jboss.portal.core.controller.ResourceNotFoundException;
import org.jboss.portal.core.controller.ControllerException;
import org.jboss.portal.core.controller.ResourceAccessDeniedException;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
import org.jboss.portal.core.ns.NavigationalStateKey;
+import org.jboss.portal.core.theme.WindowRendition;
import org.jboss.portal.server.config.ServerConfig;
import org.jboss.portal.server.ServerInvocationContext;
import org.jboss.portal.server.request.URLContext;
@@ -146,7 +148,7 @@
*/
protected abstract Instance getViewModePortletInstance(RenderWindowCommand command);
- public Object renderWindow(RenderWindowCommand cmd) throws Exception
+ public ControllerResponse renderWindow(RenderWindowCommand cmd) throws Exception
{
Window window = cmd.getWindow();
Portal portal = cmd.getPortal();
@@ -169,7 +171,7 @@
String contentChars;
String headerChars = null;
Map actionMap = new HashMap();
- Map windowProps = new HashMap(window.getDeclaredProperties());
+ Map windowProps = new HashMap(window.getProperties());
//
try
@@ -282,21 +284,21 @@
// Update window props after render if needed
Boolean asynchronous = (Boolean)invocation.getAttribute(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, "asynchronous");
- if (asynchronous != null)
+ if (asynchronous != null && Boolean.FALSE.equals(asynchronous))
{
DynaRenderOptions options = DynaRenderOptions.getOptions(null, asynchronous);
options.setOptions(windowProps);
}
//
- return new WindowResult(
+ return new WindowRendition(new WindowResult(
windowTitle,
contentChars,
actionMap,
windowProps,
headerChars,
windowNS.getWindowState(),
- windowNS.getMode());
+ windowNS.getMode()));
}
else if (response instanceof ErrorResponse)
{
@@ -313,7 +315,7 @@
{
contentChars = Exceptions.toHTML(t, true);
}
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps, headerChars, windowNS.getWindowState(), windowNS.getMode());
+ return new WindowRendition(new WindowResult(windowTitle, contentChars, actionMap, windowProps, headerChars, windowNS.getWindowState(), windowNS.getMode()));
}
}
else if (response instanceof UnavailableResponse)
@@ -325,7 +327,7 @@
actionMap = new HashMap();
actionMap.put(ActionRendererContext.MODES_KEY, Collections.EMPTY_LIST);
actionMap.put(ActionRendererContext.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps, headerChars, windowNS.getWindowState(), windowNS.getMode());
+ return new WindowRendition(new WindowResult(windowTitle, contentChars, actionMap, windowProps, headerChars, windowNS.getWindowState(), windowNS.getMode()));
}
}
else if (response instanceof InsufficientPrivilegesResponse)
@@ -350,7 +352,7 @@
actionMap.put(ActionRendererContext.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
windowTitle = "Access denied";
contentChars = "Access denied";
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps, headerChars, windowNS.getWindowState(), windowNS.getMode());
+ return new WindowRendition(new WindowResult(windowTitle, contentChars, actionMap, windowProps, headerChars, windowNS.getWindowState(), windowNS.getMode()));
}
}
catch (ResourceNotFoundException e)
@@ -365,7 +367,7 @@
actionMap.put(ActionRendererContext.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
windowTitle = "Cannot render";
contentChars = "Object not found " + e.getRef();
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps, headerChars, windowNS.getWindowState(), windowNS.getMode());
+ return new WindowRendition(new WindowResult(windowTitle, contentChars, actionMap, windowProps, headerChars, windowNS.getWindowState(), windowNS.getMode()));
}
}
catch (ControllerException e)
@@ -381,7 +383,7 @@
{
windowTitle = "An internal error occured while rendering window '" + window + "'";
contentChars = Exceptions.toHTML(e, true);
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps, headerChars, windowNS.getWindowState(), windowNS.getMode());
+ return new WindowRendition(new WindowResult(windowTitle, contentChars, actionMap, windowProps, headerChars, windowNS.getWindowState(), windowNS.getMode()));
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -34,8 +34,10 @@
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.impl.model.content.InternalContentProvider;
import org.jboss.portal.core.ns.NavigationalStateKey;
+import org.jboss.portal.core.theme.WindowRendition;
import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.theme.page.WindowResult;
@@ -152,7 +154,7 @@
{
}
- public Object renderWindow(RenderWindowCommand cmd) throws Exception
+ public ControllerResponse renderWindow(RenderWindowCommand cmd) throws Exception
{
ControllerContext context = cmd.getControllerContext();
Window window = cmd.getWindow();
@@ -189,12 +191,13 @@
}
//
- Object o = super.renderWindow(cmd);
+ ControllerResponse o = super.renderWindow(cmd);
//
- if (o instanceof WindowResult && getDecorateContent() == false)
+ if (o instanceof WindowRendition && getDecorateContent() == false)
{
- WindowResult result = (WindowResult)o;
+ WindowRendition rendition = (WindowRendition)o;
+ WindowResult result = rendition.getWindow();
//
Map props = result.getProperties();
Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -22,12 +22,14 @@
******************************************************************************/
package org.jboss.portal.core.model.instance;
-import org.jboss.portal.core.controller.ResponseHandler;
-import org.jboss.portal.core.controller.HandlerResponse;
+import org.jboss.portal.core.controller.handler.ResponseHandler;
+import org.jboss.portal.core.controller.handler.HandlerResponse;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.HTTPResponse;
+import org.jboss.portal.core.controller.handler.HTTPResponse;
import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ControllerResponse;
+import org.jboss.portal.core.controller.ResponseHandlerException;
import org.jboss.portal.core.model.instance.command.response.UpdatePortletInstanceResponse;
import org.jboss.portal.core.model.instance.command.render.RenderPortletInstanceCommand;
import org.jboss.portal.server.ServerException;
@@ -35,7 +37,7 @@
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.web.ServletContextDispatcher;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.theme.page.PageRendition;
+import org.jboss.portal.core.theme.PageRendition;
import javax.servlet.ServletException;
import java.io.IOException;
@@ -46,13 +48,13 @@
*/
public class PortletInstanceResponseHandler implements ResponseHandler
{
- public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand command, Object commandResponse) throws IOException, ServletException, ServerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand codmmand, ControllerResponse response) throws ResponseHandlerException
{
- if (commandResponse instanceof UpdatePortletInstanceResponse)
+ if (response instanceof UpdatePortletInstanceResponse)
{
try
{
- UpdatePortletInstanceResponse upir = (UpdatePortletInstanceResponse)commandResponse;
+ UpdatePortletInstanceResponse upir = (UpdatePortletInstanceResponse)response;
RenderPortletInstanceCommand render= new RenderPortletInstanceCommand(upir.getInstanceId(), upir.getNavigationalState());
final PageRendition rendition = (PageRendition)controllerContext.execute(render);
final ServerInvocation invocation = controllerContext.getServerInvocation();
Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/command/action/InvokePortletInstanceActionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/action/InvokePortletInstanceActionCommand.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/action/InvokePortletInstanceActionCommand.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -23,6 +23,7 @@
package org.jboss.portal.core.model.instance.command.action;
import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.controller.portlet.PortletContextFactory;
import org.jboss.portal.core.controller.portlet.InvokePortletCommandFactory;
import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
@@ -75,7 +76,7 @@
return null;
}
- public Object execute() throws ControllerException
+ public ControllerResponse execute() throws ControllerException
{
try
{
@@ -101,7 +102,7 @@
}
catch (PortletInvokerException e)
{
- return new ControllerException(e);
+ throw new ControllerException(e);
}
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/command/action/InvokePortletInstanceRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/action/InvokePortletInstanceRenderCommand.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/action/InvokePortletInstanceRenderCommand.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -23,6 +23,7 @@
package org.jboss.portal.core.model.instance.command.action;
import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.model.instance.command.response.UpdatePortletInstanceResponse;
import org.jboss.portal.core.model.instance.command.PortletInstanceCommand;
@@ -45,7 +46,7 @@
return null;
}
- public Object execute() throws ControllerException
+ public ControllerResponse execute() throws ControllerException
{
return new UpdatePortletInstanceResponse(instanceId, navigationalState);
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/command/render/RenderPortletInstanceCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/render/RenderPortletInstanceCommand.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/render/RenderPortletInstanceCommand.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -26,9 +26,11 @@
import org.jboss.portal.core.model.instance.InvokePortletInstanceCommandFactory;
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.controller.portlet.PortletContextFactory;
import org.jboss.portal.core.controller.portlet.InvokePortletCommandFactory;
import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
+import org.jboss.portal.core.theme.PageRendition;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.invocation.RenderInvocation;
@@ -44,7 +46,6 @@
import org.jboss.portal.theme.page.PageResult;
import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.page.PageRendition;
import org.jboss.portal.common.NotYetImplemented;
import java.util.Map;
@@ -68,7 +69,7 @@
return null;
}
- public Object execute() throws ControllerException
+ public ControllerResponse execute() throws ControllerException
{
try
Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/command/response/UpdatePortletInstanceResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/response/UpdatePortletInstanceResponse.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/response/UpdatePortletInstanceResponse.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -23,12 +23,13 @@
package org.jboss.portal.core.model.instance.command.response;
import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.core.controller.ControllerResponse;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class UpdatePortletInstanceResponse
+public class UpdatePortletInstanceResponse extends ControllerResponse
{
/** . */
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -22,21 +22,22 @@
******************************************************************************/
package org.jboss.portal.core.model.portal;
-import org.jboss.portal.core.controller.classic.AbstractResponseHandler;
-import org.jboss.portal.core.controller.CommandForward;
-import org.jboss.portal.core.controller.HandlerResponse;
+import org.jboss.portal.core.controller.handler.AbstractResponseHandler;
+import org.jboss.portal.core.controller.handler.CommandForward;
+import org.jboss.portal.core.controller.handler.HandlerResponse;
+import org.jboss.portal.core.controller.handler.HTTPResponse;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.HTTPResponse;
+import org.jboss.portal.core.controller.ControllerResponse;
+import org.jboss.portal.core.controller.ResponseHandlerException;
import org.jboss.portal.core.model.portal.command.response.UpdatePageResponse;
import org.jboss.portal.core.model.portal.command.response.UpdateWindowResponse;
import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
import org.jboss.portal.core.model.portal.command.render.RenderPageCommand;
-import org.jboss.portal.server.ServerException;
+import org.jboss.portal.core.theme.PageRendition;
import org.jboss.portal.server.ServerInvocationContext;
import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.theme.page.PageRendition;
import org.jboss.portal.web.ServletContextDispatcher;
import org.jboss.portal.common.util.MarkupInfo;
@@ -50,11 +51,11 @@
public class PortalObjectResponseHandler extends AbstractResponseHandler
{
- public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand command, Object commandResponse) throws IOException, ServletException, ServerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand ceommand, ControllerResponse response) throws ResponseHandlerException
{
- if (commandResponse instanceof UpdatePageResponse)
+ if (response instanceof UpdatePageResponse)
{
- UpdatePageResponse uvr = (UpdatePageResponse)commandResponse;
+ UpdatePageResponse uvr = (UpdatePageResponse)response;
try
{
@@ -79,9 +80,9 @@
return null;
}
}
- else if (commandResponse instanceof UpdateWindowResponse)
+ else if (response instanceof UpdateWindowResponse)
{
- UpdateWindowResponse uwmr = (UpdateWindowResponse)commandResponse;
+ UpdateWindowResponse uwmr = (UpdateWindowResponse)response;
PortalObjectContainer portalObjectContainer = controllerContext.getController().getPortalObjectContainer();
PortalObject window = portalObjectContainer.getObject(uwmr.getWindowId());
Page page = (Page)window.getParent();
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/ImportPageToDashboardCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/ImportPageToDashboardCommand.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/ImportPageToDashboardCommand.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -25,6 +25,7 @@
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.DuplicatePortalObjectException;
@@ -73,7 +74,7 @@
dashboardPortal = manager.getDashboard(user);
}
- public Object execute() throws ControllerException
+ public ControllerResponse execute() throws ControllerException
{
String name = target.getName();
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowActionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowActionCommand.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowActionCommand.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -28,6 +28,7 @@
import org.jboss.portal.identity.User;
import org.jboss.portal.core.controller.ControllerException;
import org.jboss.portal.core.controller.ResourceNotFoundException;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
@@ -140,7 +141,7 @@
}
}
- public Object execute() throws ControllerException
+ public ControllerResponse execute() throws ControllerException
{
try
{
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowRenderCommand.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowRenderCommand.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -28,6 +28,7 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.model.portal.command.response.UpdateWindowResponse;
import org.jboss.portal.core.model.portal.command.action.InvokeWindowCommand;
import org.jboss.portal.core.model.portal.PortalObjectId;
@@ -80,7 +81,7 @@
return info;
}
- public Object execute() throws InvocationException
+ public ControllerResponse execute() throws InvocationException
{
InvocationContext ctx = getContext();
PortalObjectId windowId = window.getId();
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/MoveWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/MoveWindowCommand.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/MoveWindowCommand.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -23,6 +23,7 @@
package org.jboss.portal.core.model.portal.command.action;
import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.model.portal.PortalObject;
@@ -70,7 +71,7 @@
return info;
}
- public Object execute() throws ControllerException
+ public ControllerResponse execute() throws ControllerException
{
// For now just update the navigational state of the page
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderPageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderPageCommand.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderPageCommand.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -26,6 +26,7 @@
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ControllerException;
import org.jboss.portal.core.controller.ControllerSecurityException;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
import org.jboss.portal.core.model.portal.Page;
@@ -40,7 +41,8 @@
import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.theme.LayoutService;
-import org.jboss.portal.theme.page.PageRendition;
+import org.jboss.portal.core.theme.PageRendition;
+import org.jboss.portal.core.theme.WindowRendition;
import org.jboss.portal.theme.PortalLayout;
import org.jboss.portal.theme.PortalTheme;
import org.jboss.portal.theme.ServerRegistrationID;
@@ -150,7 +152,7 @@
*
* @throws InvocationException
*/
- public Object execute() throws ControllerException, InvocationException
+ public ControllerResponse execute() throws ControllerException, InvocationException
{
ServerInvocation sinv = context.getServerInvocation();
HttpServletRequest request = sinv.getServerContext().getClientRequest();
@@ -217,7 +219,7 @@
RenderWindowCommand renderCmd = new RenderWindowCommand(window.getId());
//
- Object res = null;
+ ControllerResponse res = null;
//
if (renderCmd != null)
@@ -230,9 +232,10 @@
{
// Skip
}
- else if (res instanceof WindowResult)
+ else if (res instanceof WindowRendition)
{
- WindowResult result = (WindowResult)res;
+ WindowRendition rendition = (WindowRendition)res;
+ WindowResult result = rendition.getWindow();
String region = window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION);
String order = window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER);
WindowContext wc = new WindowContext(
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -25,6 +25,7 @@
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.command.WindowCommand;
import org.jboss.portal.core.model.portal.content.ContentRendererRegistry;
@@ -73,7 +74,7 @@
return info;
}
- public Object execute() throws ControllerException
+ public ControllerResponse execute() throws ControllerException
{
ContentRendererRegistry registry = context.getController().getContentRendererRegistry();
ContentType contentType = window.getContentType();
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdatePageResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdatePageResponse.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdatePageResponse.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -23,12 +23,13 @@
package org.jboss.portal.core.model.portal.command.response;
import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.controller.ControllerResponse;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class UpdatePageResponse
+public class UpdatePageResponse extends ControllerResponse
{
/** . */
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowResponse.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowResponse.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -23,12 +23,13 @@
package org.jboss.portal.core.model.portal.command.response;
import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.controller.ControllerResponse;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class UpdateWindowResponse
+public class UpdateWindowResponse extends ControllerResponse
{
/** . */
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewDashboardCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewDashboardCommand.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewDashboardCommand.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -24,6 +24,7 @@
import org.jboss.portal.core.controller.ControllerException;
import org.jboss.portal.core.controller.ControllerSecurityException;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
import org.jboss.portal.core.model.portal.command.response.UpdatePageResponse;
@@ -104,7 +105,7 @@
}
}
- public Object execute() throws ControllerException
+ public ControllerResponse execute() throws ControllerException
{
return new UpdatePageResponse(dashboardPage.getId());
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewPageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewPageCommand.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewPageCommand.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -28,6 +28,7 @@
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ControllerResponse;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -49,7 +50,7 @@
return info;
}
- public Object execute() throws ControllerException
+ public ControllerResponse execute() throws ControllerException
{
return new UpdatePageResponse(page.getId());
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/content/ContentRenderer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/content/ContentRenderer.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/content/ContentRenderer.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -23,6 +23,7 @@
package org.jboss.portal.core.model.portal.content;
import org.jboss.portal.core.model.portal.command.render.RenderWindowCommand;
+import org.jboss.portal.core.controller.ControllerResponse;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -30,5 +31,5 @@
*/
public interface ContentRenderer
{
- Object renderWindow(RenderWindowCommand cmd) throws Exception;
+ ControllerResponse renderWindow(RenderWindowCommand cmd) throws Exception;
}
Added: trunk/core/src/main/org/jboss/portal/core/theme/PageRendition.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/theme/PageRendition.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/theme/PageRendition.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -0,0 +1,93 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.theme;
+
+import org.jboss.portal.theme.PageService;
+import org.jboss.portal.theme.render.RendererContext;
+import org.jboss.portal.theme.render.RenderException;
+import org.jboss.portal.theme.render.ThemeContext;
+import org.jboss.portal.theme.PortalLayout;
+import org.jboss.portal.theme.PortalTheme;
+import org.jboss.portal.theme.page.PageResult;
+import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.web.ServletContextDispatcher;
+import org.jboss.portal.core.controller.ControllerResponse;
+
+import javax.servlet.ServletException;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PageRendition extends ControllerResponse
+{
+
+ /** . */
+ private PortalLayout layout;
+
+ /** . */
+ private PageResult pageResult;
+
+ /** . */
+ private PortalTheme theme;
+
+ /** . */
+ private PageService pageService;
+
+ public PageRendition(
+ PortalLayout layout,
+ PortalTheme theme,
+ PageResult markupResult,
+ PageService pageService)
+ {
+ this.layout = layout;
+ this.theme = theme;
+ this.pageResult = markupResult;
+ this.pageService = pageService;
+ }
+
+ /** Performs the page rendition. */
+ public void render(MarkupInfo markupInfo, ServletContextDispatcher dispatcher) throws IOException, ServletException
+ {
+ ThemeContext themeContext = new ThemeContext(theme, pageService.getThemeService());
+
+ //
+ RendererContext rendererContext = layout.getRenderContext(themeContext, markupInfo, dispatcher);
+
+ //
+ try
+ {
+ rendererContext.render(pageResult);
+ }
+ catch (RenderException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public PageResult getPageResult()
+ {
+ return pageResult;
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/theme/WindowRendition.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/theme/WindowRendition.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/theme/WindowRendition.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.theme;
+
+import org.jboss.portal.theme.page.WindowResult;
+import org.jboss.portal.core.controller.ControllerResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class WindowRendition extends ControllerResponse
+{
+
+ /** . */
+ private final WindowResult window;
+
+ public WindowRendition(WindowResult window)
+ {
+ this.window = window;
+ }
+
+ public WindowResult getWindow()
+ {
+ return window;
+ }
+}
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -31,6 +31,7 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
import org.jboss.portal.core.controller.command.response.StreamContentResponse;
@@ -69,7 +70,7 @@
return info;
}
- public Object execute() throws InvocationException, ControllerException
+ public ControllerResponse execute() throws InvocationException, ControllerException
{
try
{
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/content/InternalCMSContentProvider.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/content/InternalCMSContentProvider.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/content/InternalCMSContentProvider.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -27,6 +27,7 @@
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.content.spi.portlet.ContentPortlet;
import org.jboss.portal.core.cms.CMSObjectCommandFactory;
+import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.Mode;
/**
@@ -88,7 +89,7 @@
super.start();
}
- public Object renderWindow(RenderWindowCommand cmd) throws Exception
+ public ControllerResponse renderWindow(RenderWindowCommand cmd) throws Exception
{
try
{
Modified: trunk/core-samples/src/resources/portal-samples-war/WEB-INF/default-object.xml
===================================================================
--- trunk/core-samples/src/resources/portal-samples-war/WEB-INF/default-object.xml 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/core-samples/src/resources/portal-samples-war/WEB-INF/default-object.xml 2007-04-08 17:24:01 UTC (rev 6959)
@@ -65,6 +65,255 @@
<page-name>Test</page-name>
<properties>
<property>
+ <name>order</name>
+ <value>3</value>
+ </property>
+ </properties>
+ <window>
+ <window-name>TestPortletWindow</window-name>
+ <instance-ref>TestPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>CatalogPortletWindow</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <page>
+ <page-name>event test</page-name>
+ <listener>test_listener</listener>
+ <window>
+ <window-name>CatalogPortletWindow</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>PortletAWindow</window-name>
+ <instance-ref>PortletAInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>PortletBWindow</window-name>
+ <instance-ref>PortletBInstance</instance-ref>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ </page>
+ <page>
+ <page-name>page event test</page-name>
+ <listener>window_event_listener</listener>
+ <window>
+ <window-name>CatalogPortletWindow1</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>CatalogPortletWindow2</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>1</height>
+ </window>
+ <window>
+ <window-name>CatalogPortletWindow3</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>2</height>
+ </window>
+ <window>
+ <window-name>CatalogPortletWindow4</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>CatalogPortletWindow5</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ <window>
+ <window-name>CatalogPortletWindow6</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>center</region>
+ <height>2</height>
+ </window>
+ </page>
+ <page>
+ <page-name>secure test</page-name>
+ <window>
+ <window-name>CatalogPortletWindow</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>SecuredTestPortletWindow</window-name>
+ <instance-ref>SecuredTestPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
+ <page>
+ <page-name>exception test</page-name>
+ <window>
+ <window-name>CatalogPortletWindow</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>ExceptionPortletWindow</window-name>
+ <instance-ref>ExceptionPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
+ <page>
+ <page-name>cache test</page-name>
+ <window>
+ <window-name>CatalogPortletWindow</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>CachedCounterPortletWindow</window-name>
+ <instance-ref>CachedCounterPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>CounterPortletWindow</window-name>
+ <instance-ref>CounterPortletInstance</instance-ref>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ </page>
+ <page>
+ <page-name>session test</page-name>
+ <window>
+ <window-name>CatalogPortletWindow</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>PortletSessionPortletWindow</window-name>
+ <instance-ref>PortletSessionPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
+ <page>
+ <page-name>missing portlet</page-name>
+ <window>
+ <window-name>CatalogPortletWindow</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>MissingPortletWindow</window-name>
+ <instance-ref>MissingPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
+ <page>
+ <page-name>URL portlet</page-name>
+ <window>
+ <window-name>CatalogPortletWindow</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>URLPortletWindow</window-name>
+ <instance-ref>URLPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>AsyncURLPortletWindow</window-name>
+ <instance-ref>AsyncURLPortletInstance</instance-ref>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ </page>
+ <page>
+ <page-name>missing instance</page-name>
+ <window>
+ <window-name>CatalogPortletWindow</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>MissingInstanceWindow</window-name>
+ <instance-ref>MissingInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
+ <page>
+ <page-name>charset test</page-name>
+ <window>
+ <window-name>CatalogPortletWindow</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>CharsetPortletWindow</window-name>
+ <instance-ref>CharsetPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
+ <page>
+ <page-name>encoding test</page-name>
+ <window>
+ <window-name>CatalogPortletWindow</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>EncodingPortletWindow</window-name>
+ <instance-ref>EncodingPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
+ <page>
+ <page-name>header test</page-name>
+ <window>
+ <window-name>CatalogPortletWindow</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>HeaderContentPortletWindow</window-name>
+ <instance-ref>HeaderContentPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
+ </page>
+ </deployment>
+ <deployment>
+ <parent-ref>default</parent-ref>
+ <if-exists>keep</if-exists>
+ <page>
+ <page-name>TestWithAjax</page-name>
+ <properties>
+ <property>
<name>theme.dyna.async_window_enabled</name>
<value>true</value>
</property>
@@ -242,6 +491,12 @@
<region>center</region>
<height>0</height>
</window>
+ <window>
+ <window-name>AsyncURLPortletWindow</window-name>
+ <instance-ref>AsyncURLPortletInstance</instance-ref>
+ <region>center</region>
+ <height>1</height>
+ </window>
</page>
<page>
<page-name>missing instance</page-name>
Deleted: trunk/theme/src/main/org/jboss/portal/theme/page/PageRendition.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/PageRendition.java 2007-04-08 14:22:53 UTC (rev 6958)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/PageRendition.java 2007-04-08 17:24:01 UTC (rev 6959)
@@ -1,91 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.theme.page;
-
-import org.jboss.portal.theme.PageService;
-import org.jboss.portal.theme.render.RendererContext;
-import org.jboss.portal.theme.render.RenderException;
-import org.jboss.portal.theme.render.ThemeContext;
-import org.jboss.portal.theme.PortalLayout;
-import org.jboss.portal.theme.PortalTheme;
-import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.web.ServletContextDispatcher;
-
-import javax.servlet.ServletException;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class PageRendition
-{
-
- /** . */
- private PortalLayout layout;
-
- /** . */
- private PageResult pageResult;
-
- /** . */
- private PortalTheme theme;
-
- /** . */
- private PageService pageService;
-
- public PageRendition(
- PortalLayout layout,
- PortalTheme theme,
- PageResult markupResult,
- PageService pageService)
- {
- this.layout = layout;
- this.theme = theme;
- this.pageResult = markupResult;
- this.pageService = pageService;
- }
-
- /** Performs the page rendition. */
- public void render(MarkupInfo markupInfo, ServletContextDispatcher dispatcher) throws IOException, ServletException
- {
- ThemeContext themeContext = new ThemeContext(theme, pageService.getThemeService());
-
- //
- RendererContext rendererContext = layout.getRenderContext(themeContext, markupInfo, dispatcher);
-
- //
- try
- {
- rendererContext.render(pageResult);
- }
- catch (RenderException e)
- {
- e.printStackTrace();
- }
- }
-
- public PageResult getPageResult()
- {
- return pageResult;
- }
-}
17 years, 3 months
JBoss Portal SVN: r6958 - trunk/core/src/main/org/jboss/portal/core/controller/ajax.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-08 10:22:53 -0400 (Sun, 08 Apr 2007)
New Revision: 6958
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
Log:
if an async ViewPageCommand is triggered, we update the page location
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-04-08 14:16:18 UTC (rev 6957)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-04-08 14:22:53 UTC (rev 6958)
@@ -31,6 +31,7 @@
import org.jboss.portal.core.controller.portlet.PortletResponseHandler;
import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
import org.jboss.portal.core.model.portal.command.response.UpdateWindowResponse;
+import org.jboss.portal.core.model.portal.command.response.UpdatePageResponse;
import org.jboss.portal.core.model.portal.command.PortalObjectCommand;
import org.jboss.portal.core.model.portal.command.render.RenderPageCommand;
import org.jboss.portal.core.model.portal.command.render.RenderWindowCommand;
@@ -168,6 +169,14 @@
throw new Error("todo " + commandResponse);
}
}
+ else if (commandResponse instanceof UpdatePageResponse)
+ {
+ UpdatePageResponse upr = (UpdatePageResponse)commandResponse;
+ ViewPageCommand rpc = new ViewPageCommand(upr.getPageId());
+ String url = controllerContext.renderURL(rpc, null, null);
+ UpdatePageLocationResponse dresp = new UpdatePageLocationResponse(url);
+ return new AjaxResponse(dresp);
+ }
else if (commandResponse instanceof UpdateWindowResponse)
{
// We make an assumption here, the window result should carry somehow the window id
17 years, 3 months
JBoss Portal SVN: r6957 - in trunk: core/src/main/org/jboss/portal/core/aspects/controller/node and 22 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-08 10:16:18 -0400 (Sun, 08 Apr 2007)
New Revision: 6957
Added:
trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/PortletInstanceCommand.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/action/
trunk/core/src/main/org/jboss/portal/core/model/instance/command/action/InvokePortletInstanceActionCommand.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/action/InvokePortletInstanceRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/render/
trunk/core/src/main/org/jboss/portal/core/model/instance/command/render/RenderPortletInstanceCommand.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/response/UpdatePortletInstanceResponse.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/
trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/ImportPageToDashboardCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowActionCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokeWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/MoveWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/
trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderPageCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdatePageResponse.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowResponse.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/
trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewDashboardCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewPageCommand.java
Removed:
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceActionCommand.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceCommand.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/ImportPageToDashboardCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/MoveWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/ViewDashboardCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateViewResponse.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java
Modified:
trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactoryService.java
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/InternalCMSContentProvider.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java
trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java
trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/InternalPortletContentProvider.java
trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceURLFactory.java
trunk/core/src/main/org/jboss/portal/core/model/instance/InvokePortletInstanceCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/DashboardCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/content/ContentRenderer.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
Log:
improve request/response command protocol : commands like RenderPageCommand and RenderWindowCommand are not triggered by command factories, instead they are just used programmatically in order to build something (markup usually under some form). So ViewPageCommand has been introduced instead and it is the responsibility of the response handler to translate a ViewPageCommand response into a programmatic RenderPageCommand
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -32,7 +32,7 @@
import org.jboss.portal.core.controller.command.SignOutCommand;
import org.jboss.portal.core.impl.model.portal.PortalObjectImpl;
import org.jboss.portal.core.model.CustomizationManager;
-import org.jboss.portal.core.model.instance.command.InvokePortletInstanceRenderCommand;
+import org.jboss.portal.core.model.instance.command.action.InvokePortletInstanceRenderCommand;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalContainer;
@@ -40,9 +40,10 @@
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.PortalObjectPermission;
import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.command.ImportPageToDashboardCommand;
-import org.jboss.portal.core.model.portal.command.RenderPageCommand;
-import org.jboss.portal.core.model.portal.command.ViewDashboardCommand;
+import org.jboss.portal.core.model.portal.command.action.ImportPageToDashboardCommand;
+import org.jboss.portal.core.model.portal.command.render.RenderPageCommand;
+import org.jboss.portal.core.model.portal.command.view.ViewDashboardCommand;
+import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
import org.jboss.portal.identity.User;
import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.security.PortalSecurityException;
@@ -50,7 +51,6 @@
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.theme.page.PageRendition;
import org.jboss.portal.theme.ThemeConstants;
-import org.jboss.portal.theme.impl.render.dynamic.DynaConstants;
import org.jboss.portal.theme.impl.render.dynamic.DynaRenderOptions;
import org.jboss.portal.theme.page.Region;
import org.jboss.portal.theme.page.WindowContext;
@@ -211,7 +211,7 @@
String label;
if (isDashboard)
{
- RenderPageCommand _rpc = new RenderPageCommand(new PortalObjectId(new String[]{"default", "default"}));
+ ViewPageCommand _rpc = new ViewPageCommand(new PortalObjectId(new String[]{"default", "default"}));
pageURL = controllerCtx.renderURL(_rpc, null, null);
label = "Portal";
}
@@ -239,7 +239,7 @@
if (admin)
{
- RenderPageCommand showDefault = new RenderPageCommand(new PortalObjectId(new String[]{"default"}));
+ ViewPageCommand showDefault = new ViewPageCommand(new PortalObjectId(new String[]{"default"}));
showDefaultURL = controllerCtx.renderURL(showDefault, null, null);
}
else
@@ -249,7 +249,7 @@
{
if (controller.getPortalAuthorizationManagerFactory().getManager().checkPermission(perm))
{
- RenderPageCommand showadmin = new RenderPageCommand(new PortalObjectId(new String[]{"admin"}));
+ ViewPageCommand showadmin = new ViewPageCommand(new PortalObjectId(new String[]{"admin"}));
showadminURL = controllerCtx.renderURL(showadmin, null, null);
}
}
@@ -349,7 +349,7 @@
PortalObjectPermission perm = new PortalObjectPermission(id, PortalObjectPermission.VIEW_MASK);
if (portalAuthorizationManagerFactory.getManager().checkPermission(perm))
{
- RenderPageCommand cmd = new RenderPageCommand(navElement.getId());
+ ViewPageCommand cmd = new ViewPageCommand(navElement.getId());
String childURL = rpc.getControllerContext().renderURL(cmd, null, null);
html.append("<li");
// if we were able to detect the selected node in the hierarchie level of the nav elements,
@@ -382,7 +382,7 @@
PortalObject child = (PortalObject)j.next();
if (child.getType() == PortalObject.TYPE_PAGE)
{
- RenderPageCommand renderCmd = new RenderPageCommand(child.getId());
+ ViewPageCommand renderCmd = new ViewPageCommand(child.getId());
String subChildURL = rpc.getControllerContext().renderURL(renderCmd, null, null);
html.append("<li>").append("<a href='").append(subChildURL).append("'>").append(child.getName()).append("</a></li>");
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -39,10 +39,10 @@
import org.jboss.portal.core.controller.CommandRedirectionException;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerInterceptor;
-import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
-import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowActionCommand;
+import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.model.portal.command.WindowCommand;
-import org.jboss.portal.core.model.portal.command.RenderPageCommand;
+import org.jboss.portal.core.model.portal.command.render.RenderPageCommand;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.ns.WindowNavigationalState;
import org.jboss.portal.core.event.PortalEventListenerRegistry;
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeInterceptor.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeInterceptor.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -25,7 +25,7 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerInterceptor;
-import org.jboss.portal.core.model.portal.command.RenderPageCommand;
+import org.jboss.portal.core.model.portal.command.render.RenderPageCommand;
import org.jboss.portal.core.model.portal.command.WindowCommand;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Window;
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -28,8 +28,8 @@
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.server.request.URLFormat;
import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.core.model.portal.command.RenderPageCommand;
-import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
import org.jboss.portal.core.model.portal.PortalObjectId;
/**
@@ -145,7 +145,7 @@
public String toString()
{
- RenderPageCommand cmd = new RenderPageCommand(id);
+ ViewPageCommand cmd = new ViewPageCommand(id);
URLContext urlContext = getURLContext();
return controllerContext.renderURL(cmd, urlContext, URLFormat.newInstance(relative, true));
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxCommandFactory.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxCommandFactory.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -25,7 +25,7 @@
import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.command.MoveWindowCommand;
+import org.jboss.portal.core.model.portal.command.action.MoveWindowCommand;
import org.jboss.portal.server.ServerInvocation;
import javax.servlet.http.HttpServletRequest;
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -26,7 +26,7 @@
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerInterceptor;
import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.core.model.portal.command.RenderPageCommand;
+import org.jboss.portal.core.model.portal.command.render.RenderPageCommand;
import org.jboss.portal.core.model.portal.ns.PortalObjectNavigationalStateContext;
import org.jboss.portal.theme.page.PageRendition;
import org.jboss.portal.theme.impl.render.dynamic.DynaConstants;
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -30,10 +30,11 @@
import org.jboss.portal.core.controller.AjaxResponse;
import org.jboss.portal.core.controller.portlet.PortletResponseHandler;
import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
-import org.jboss.portal.core.model.portal.command.response.UpdateWindowMarkupResponse;
+import org.jboss.portal.core.model.portal.command.response.UpdateWindowResponse;
import org.jboss.portal.core.model.portal.command.PortalObjectCommand;
-import org.jboss.portal.core.model.portal.command.RenderPageCommand;
-import org.jboss.portal.core.model.portal.command.RenderWindowCommand;
+import org.jboss.portal.core.model.portal.command.render.RenderPageCommand;
+import org.jboss.portal.core.model.portal.command.render.RenderWindowCommand;
+import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Portal;
@@ -56,7 +57,6 @@
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.theme.impl.render.dynamic.response.UpdatePageLocationResponse;
import org.jboss.portal.theme.impl.render.dynamic.response.UpdatePageStateResponse;
-import org.jboss.portal.theme.impl.render.dynamic.DynaRenderStatus;
import org.jboss.portal.theme.LayoutService;
import org.jboss.portal.theme.PortalLayout;
import org.jboss.portal.theme.PageService;
@@ -168,7 +168,7 @@
throw new Error("todo " + commandResponse);
}
}
- else if (commandResponse instanceof UpdateWindowMarkupResponse)
+ else if (commandResponse instanceof UpdateWindowResponse)
{
// We make an assumption here, the window result should carry somehow the window id
PortalObjectCommand pocmd = (PortalObjectCommand)command;
@@ -250,7 +250,7 @@
//
if (refresh)
{
- RenderPageCommand rpc = new RenderPageCommand(page.getId());
+ ViewPageCommand rpc = new ViewPageCommand(page.getId());
String url = controllerContext.renderURL(rpc, null, null);
UpdatePageLocationResponse dresp = new UpdatePageLocationResponse(url);
return new AjaxResponse(dresp);
Modified: trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -42,7 +42,8 @@
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.PortalObjectResponseHandler;
-import org.jboss.portal.core.model.portal.command.RenderPageCommand;
+import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
+import org.jboss.portal.core.model.instance.PortletInstanceResponseHandler;
import org.jboss.portal.web.ServletContextDispatcher;
import org.jboss.portal.common.util.MarkupInfo;
@@ -134,7 +135,7 @@
{
PortalObjectContainer portalObjectContainer = controllerContext.getController().getPortalObjectContainer();
Portal portal = (Portal)portalObjectContainer.getObject(defaultPortalPath);
- RenderPageCommand renderCmd = new RenderPageCommand(portal.getId());
+ ViewPageCommand renderCmd = new ViewPageCommand(portal.getId());
URLContext urlContext = invocation.getServerContext().getURLContext();
location = controllerContext.renderURL(renderCmd, urlContext.asNonAuthenticated(), null);
}
@@ -158,6 +159,7 @@
private ResponseHandler[] handlers = new ResponseHandler[]
{
new OtherResponseHandler(),
+ new PortletInstanceResponseHandler(),
new PortalObjectResponseHandler(),
new PortletResponseHandler()
};
Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -36,8 +36,8 @@
import org.jboss.portal.portlet.spi.RenderContext;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
-import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowActionCommand;
+import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.Mode;
Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -28,13 +28,13 @@
import org.jboss.portal.core.controller.CommandForward;
import org.jboss.portal.core.controller.classic.AbstractResponseHandler;
import org.jboss.portal.core.controller.HandlerResponse;
-import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
-import org.jboss.portal.core.model.portal.command.RenderPageCommand;
-import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowActionCommand;
+import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.instance.command.response.PortletInstanceResponse;
-import org.jboss.portal.core.model.instance.command.InvokePortletInstanceRenderCommand;
+import org.jboss.portal.core.model.instance.command.action.InvokePortletInstanceRenderCommand;
import org.jboss.portal.server.ServerException;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.request.URLContext;
@@ -142,7 +142,7 @@
// Redirect to the same page
InvokePortletWindowActionCommand iwac = (InvokePortletWindowActionCommand)command;
Page page = iwac.getPage();
- RenderPageCommand renderCmd = new RenderPageCommand(page.getId());
+ ViewPageCommand renderCmd = new ViewPageCommand(page.getId());
boolean secure = invocation.getServerContext().getURLContext().isSecure();
URLContext urlContext = URLContext.newInstance(secure, false);
location = controllerContext.renderURL(renderCmd, urlContext, null);
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -26,8 +26,8 @@
import org.jboss.portal.core.model.content.Content;
import org.jboss.portal.core.model.content.spi.ContentProvider;
import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.model.portal.command.RenderWindowCommand;
-import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.render.RenderWindowCommand;
+import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.portal.Portal;
@@ -46,7 +46,6 @@
import org.jboss.portal.server.request.URLFormat;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.NoSuchPortletException;
-import org.jboss.portal.portlet.Properties;
import org.jboss.portal.portlet.info.WindowStateInfo;
import org.jboss.portal.portlet.info.ModeInfo;
import org.jboss.portal.portlet.invocation.RenderInvocation;
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -30,7 +30,7 @@
import org.jboss.portal.core.model.content.spi.portlet.ContentPortlet;
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.core.model.portal.command.RenderWindowCommand;
+import org.jboss.portal.core.model.portal.command.render.RenderWindowCommand;
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.controller.ControllerContext;
@@ -44,7 +44,6 @@
import java.util.Iterator;
import java.util.Map;
-import java.util.HashMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/InternalPortletContentProvider.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/InternalPortletContentProvider.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/InternalPortletContentProvider.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -40,7 +40,7 @@
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.command.RenderWindowCommand;
+import org.jboss.portal.core.model.portal.command.render.RenderWindowCommand;
import org.jboss.portal.identity.User;
/**
Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceCommandFactory.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceCommandFactory.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -24,8 +24,8 @@
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
-import org.jboss.portal.core.model.instance.command.InvokePortletInstanceActionCommand;
-import org.jboss.portal.core.model.instance.command.InvokePortletInstanceRenderCommand;
+import org.jboss.portal.core.model.instance.command.action.InvokePortletInstanceActionCommand;
+import org.jboss.portal.core.model.instance.command.action.InvokePortletInstanceRenderCommand;
import org.jboss.portal.portlet.impl.PortletRequestDecoder;
import org.jboss.portal.server.ServerInvocation;
Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceURLFactory.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceURLFactory.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -24,9 +24,9 @@
import org.jboss.portal.core.controller.command.mapper.URLFactoryDelegate;
import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.model.instance.command.InvokePortletInstanceRenderCommand;
-import org.jboss.portal.core.model.instance.command.InvokePortletInstanceActionCommand;
-import org.jboss.portal.core.model.instance.command.InvokePortletInstanceCommand;
+import org.jboss.portal.core.model.instance.command.action.InvokePortletInstanceRenderCommand;
+import org.jboss.portal.core.model.instance.command.action.InvokePortletInstanceActionCommand;
+import org.jboss.portal.core.model.instance.command.PortletInstanceCommand;
import org.jboss.portal.server.ServerURL;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.AbstractServerURL;
@@ -73,9 +73,9 @@
}
//
- if (cmd instanceof InvokePortletInstanceCommand)
+ if (cmd instanceof PortletInstanceCommand)
{
- InvokePortletInstanceCommand iic = (InvokePortletInstanceCommand)cmd;
+ PortletInstanceCommand iic = (PortletInstanceCommand)cmd;
if (iic.getInstanceId().equals(instanceId))
{
AbstractServerURL url = new AbstractServerURL();
Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/InvokePortletInstanceCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/InvokePortletInstanceCommandFactory.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/InvokePortletInstanceCommandFactory.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -24,8 +24,8 @@
import org.jboss.portal.core.controller.portlet.InvokePortletCommandFactory;
import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.model.instance.command.InvokePortletInstanceRenderCommand;
-import org.jboss.portal.core.model.instance.command.InvokePortletInstanceActionCommand;
+import org.jboss.portal.core.model.instance.command.action.InvokePortletInstanceRenderCommand;
+import org.jboss.portal.core.model.instance.command.action.InvokePortletInstanceActionCommand;
import org.jboss.portal.portlet.ActionURL;
import org.jboss.portal.portlet.RenderURL;
Added: trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -0,0 +1,76 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.instance;
+
+import org.jboss.portal.core.controller.ResponseHandler;
+import org.jboss.portal.core.controller.HandlerResponse;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.HTTPResponse;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.model.instance.command.response.UpdatePortletInstanceResponse;
+import org.jboss.portal.core.model.instance.command.render.RenderPortletInstanceCommand;
+import org.jboss.portal.server.ServerException;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.web.ServletContextDispatcher;
+import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.theme.page.PageRendition;
+
+import javax.servlet.ServletException;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletInstanceResponseHandler implements ResponseHandler
+{
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand command, Object commandResponse) throws IOException, ServletException, ServerException
+ {
+ if (commandResponse instanceof UpdatePortletInstanceResponse)
+ {
+ try
+ {
+ UpdatePortletInstanceResponse upir = (UpdatePortletInstanceResponse)commandResponse;
+ RenderPortletInstanceCommand render= new RenderPortletInstanceCommand(upir.getInstanceId(), upir.getNavigationalState());
+ final PageRendition rendition = (PageRendition)controllerContext.execute(render);
+ final ServerInvocation invocation = controllerContext.getServerInvocation();
+ return new HTTPResponse()
+ {
+ public void sendResponse(ServerInvocationContext ctx) throws IOException, ServletException
+ {
+ ServletContextDispatcher dispatcher = new ServletContextDispatcher(invocation.getServerContext().getClientRequest(), invocation.getServerContext().getClientResponse(), invocation.getRequest().getServer().getServletContainerContext());
+ MarkupInfo markupInfo = (MarkupInfo)invocation.getResponse().getContentInfo();
+ rendition.render(markupInfo, dispatcher);
+ }
+ };
+ }
+ catch (ControllerException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+}
Deleted: trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceActionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceActionCommand.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceActionCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -1,106 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.instance.command;
-
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.portlet.PortletContextFactory;
-import org.jboss.portal.core.controller.portlet.InvokePortletCommandFactory;
-import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.model.instance.InvokePortletInstanceCommandFactory;
-import org.jboss.portal.core.model.instance.command.response.PortletInstanceResponse;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.PortletParameters;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class InvokePortletInstanceActionCommand extends InvokePortletInstanceCommand
-{
-
- /** The interaction state. */
- private StateString interactionState;
-
- /** The nform. */
- private PortletParameters form;
-
- public InvokePortletInstanceActionCommand(String instanceId, StateString navigationalState, StateString interactionState, PortletParameters form)
- {
- super(instanceId, navigationalState);
-
- //
- this.interactionState = interactionState;
- this.form = form;
- }
-
- public StateString getInteractionState()
- {
- return interactionState;
- }
-
- public PortletParameters getForm()
- {
- return form;
- }
-
- public CommandInfo getInfo()
- {
- return null;
- }
-
- public Object execute() throws ControllerException
- {
- try
- {
- PortletContextFactory pcf1 = new PortletContextFactory(context);
- InvokePortletCommandFactory pcf2 = new InvokePortletInstanceCommandFactory(instanceId);
-
- //
- ActionInvocation action = PortletInvocationFactory.createAction(
- context,
- Mode.VIEW,
- WindowState.MAXIMIZED,
- navigationalState,
- interactionState,
- form,
- pcf1,
- pcf2);
-
- //
- PortletInvocationResponse response = instance.invoke(action);
-
- //
- return new PortletInstanceResponse(instanceId, response);
- }
- catch (PortletInvokerException e)
- {
- return new ControllerException(e);
- }
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceCommand.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -1,81 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.instance.command;
-
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.portlet.StateString;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public abstract class InvokePortletInstanceCommand extends ControllerCommand
-{
-
- /** The instance id. */
- protected String instanceId;
-
- /** The navigational state. */
- protected StateString navigationalState;
-
- /** The instance displayed. */
- protected Instance instance;
-
- protected InvokePortletInstanceCommand(String instanceId, StateString navigationalState)
- {
- if (instanceId == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- this.instanceId = instanceId;
- this.navigationalState = navigationalState;
-
- }
-
- public String getInstanceId()
- {
- return instanceId;
- }
-
- protected void create() throws ControllerException
- {
- InstanceContainer container = context.getController().getInstanceContainer();
-
- //
- instance = container.getDefinition(instanceId);
- if (instance == null)
- {
- throw new ControllerException("Configurator portlet instance " + instanceId + " not found");
- }
- }
-
- public StateString getNavigationalState()
- {
- return navigationalState;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -1,123 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.instance.command;
-
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.portlet.PortletContextFactory;
-import org.jboss.portal.core.controller.portlet.InvokePortletCommandFactory;
-import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.model.instance.InvokePortletInstanceCommandFactory;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
-import org.jboss.portal.portlet.invocation.response.ErrorResponse;
-import org.jboss.portal.theme.page.PageRendition;
-import org.jboss.portal.theme.LayoutService;
-import org.jboss.portal.theme.PortalLayout;
-import org.jboss.portal.theme.ThemeConstants;
-import org.jboss.portal.theme.PageService;
-import org.jboss.portal.theme.page.PageResult;
-import org.jboss.portal.theme.page.WindowResult;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.Mode;
-import org.jboss.portal.common.NotYetImplemented;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collections;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class InvokePortletInstanceRenderCommand extends InvokePortletInstanceCommand
-{
-
- public InvokePortletInstanceRenderCommand(String instanceId, StateString navigationalState)
- {
- super(instanceId, navigationalState);
- }
-
- public CommandInfo getInfo()
- {
- return null;
- }
-
- public Object execute() throws ControllerException
- {
- try
- {
- PortletContextFactory pcf1 = new PortletContextFactory(context);
- InvokePortletCommandFactory pcf2 = new InvokePortletInstanceCommandFactory(instanceId);
- RenderInvocation render = PortletInvocationFactory.createRender(context, Mode.VIEW, WindowState.MAXIMIZED, navigationalState, pcf1, pcf2);
- PortletInvocationResponse response = instance.invoke(render);
-
- // For now let the controller handle non fragment response
- String content;
- if (response instanceof FragmentResponse)
- {
- content = ((FragmentResponse)response).getContent();
- }
- else if (response instanceof ErrorResponse)
- {
- content = ((ErrorResponse)response).toHTML();
- }
- else
- {
- throw new NotYetImplemented();
- }
-
- //
- PageService ps = context.getController().getPageService();
- LayoutService ls = ps.getLayoutService();
- PortalLayout layout = ls.getLayout("generic", true);
- Map pageProperties = new HashMap();
- Map portalProperties = new HashMap();
- portalProperties.put("theme.renderSetId", "divRenderer");
- portalProperties.put("theme.id", "renaissance");
- PageResult result = new PageResult("BILTO", pageProperties, portalProperties);
-
- //
- Map windowProps = new HashMap();
- windowProps.put(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER, "emptyRenderer");
- windowProps.put(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER, "emptyRenderer");
- windowProps.put(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER, "emptyRenderer");
-
- //
- WindowResult res = new WindowResult("", content, Collections.EMPTY_MAP, windowProps, null, WindowState.MAXIMIZED, Mode.VIEW);
- WindowContext blah = new WindowContext("BILTO", "BILTO", "maximized", 0, res);
- result.addWindowContext(blah);
-
- //
- return new PageRendition(layout, null, result, ps);
- }
- catch (PortletInvokerException e)
- {
- return new ControllerException(e);
- }
- }
-}
Added: trunk/core/src/main/org/jboss/portal/core/model/instance/command/PortletInstanceCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/PortletInstanceCommand.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/PortletInstanceCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.instance.command;
+
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.portlet.StateString;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class PortletInstanceCommand extends ControllerCommand
+{
+
+ /** The instance id. */
+ protected String instanceId;
+
+ /** The navigational state. */
+ protected StateString navigationalState;
+
+ /** The instance displayed. */
+ protected Instance instance;
+
+ protected PortletInstanceCommand(String instanceId, StateString navigationalState)
+ {
+ if (instanceId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.instanceId = instanceId;
+ this.navigationalState = navigationalState;
+
+ }
+
+ public String getInstanceId()
+ {
+ return instanceId;
+ }
+
+ protected void create() throws ControllerException
+ {
+ InstanceContainer container = context.getController().getInstanceContainer();
+
+ //
+ instance = container.getDefinition(instanceId);
+ if (instance == null)
+ {
+ throw new ControllerException("Configurator portlet instance " + instanceId + " not found");
+ }
+ }
+
+ public StateString getNavigationalState()
+ {
+ return navigationalState;
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/model/instance/command/action/InvokePortletInstanceActionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/action/InvokePortletInstanceActionCommand.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/action/InvokePortletInstanceActionCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -0,0 +1,107 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.instance.command.action;
+
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.portlet.PortletContextFactory;
+import org.jboss.portal.core.controller.portlet.InvokePortletCommandFactory;
+import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.model.instance.InvokePortletInstanceCommandFactory;
+import org.jboss.portal.core.model.instance.command.response.PortletInstanceResponse;
+import org.jboss.portal.core.model.instance.command.PortletInstanceCommand;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletParameters;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class InvokePortletInstanceActionCommand extends PortletInstanceCommand
+{
+
+ /** The interaction state. */
+ private StateString interactionState;
+
+ /** The nform. */
+ private PortletParameters form;
+
+ public InvokePortletInstanceActionCommand(String instanceId, StateString navigationalState, StateString interactionState, PortletParameters form)
+ {
+ super(instanceId, navigationalState);
+
+ //
+ this.interactionState = interactionState;
+ this.form = form;
+ }
+
+ public StateString getInteractionState()
+ {
+ return interactionState;
+ }
+
+ public PortletParameters getForm()
+ {
+ return form;
+ }
+
+ public CommandInfo getInfo()
+ {
+ return null;
+ }
+
+ public Object execute() throws ControllerException
+ {
+ try
+ {
+ PortletContextFactory pcf1 = new PortletContextFactory(context);
+ InvokePortletCommandFactory pcf2 = new InvokePortletInstanceCommandFactory(instanceId);
+
+ //
+ ActionInvocation action = PortletInvocationFactory.createAction(
+ context,
+ Mode.VIEW,
+ WindowState.MAXIMIZED,
+ navigationalState,
+ interactionState,
+ form,
+ pcf1,
+ pcf2);
+
+ //
+ PortletInvocationResponse response = instance.invoke(action);
+
+ //
+ return new PortletInstanceResponse(instanceId, response);
+ }
+ catch (PortletInvokerException e)
+ {
+ return new ControllerException(e);
+ }
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/model/instance/command/action/InvokePortletInstanceRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/action/InvokePortletInstanceRenderCommand.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/action/InvokePortletInstanceRenderCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -0,0 +1,52 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.instance.command.action;
+
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.model.instance.command.response.UpdatePortletInstanceResponse;
+import org.jboss.portal.core.model.instance.command.PortletInstanceCommand;
+import org.jboss.portal.portlet.StateString;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class InvokePortletInstanceRenderCommand extends PortletInstanceCommand
+{
+
+ public InvokePortletInstanceRenderCommand(String instanceId, StateString navigationalState)
+ {
+ super(instanceId, navigationalState);
+ }
+
+ public CommandInfo getInfo()
+ {
+ return null;
+ }
+
+ public Object execute() throws ControllerException
+ {
+ return new UpdatePortletInstanceResponse(instanceId, navigationalState);
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/model/instance/command/render/RenderPortletInstanceCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/render/RenderPortletInstanceCommand.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/render/RenderPortletInstanceCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -0,0 +1,125 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.instance.command.render;
+
+import org.jboss.portal.core.model.instance.command.PortletInstanceCommand;
+import org.jboss.portal.core.model.instance.InvokePortletInstanceCommandFactory;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.portlet.PortletContextFactory;
+import org.jboss.portal.core.controller.portlet.InvokePortletCommandFactory;
+import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.response.ErrorResponse;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.theme.PageService;
+import org.jboss.portal.theme.LayoutService;
+import org.jboss.portal.theme.PortalLayout;
+import org.jboss.portal.theme.ThemeConstants;
+import org.jboss.portal.theme.page.PageResult;
+import org.jboss.portal.theme.page.WindowResult;
+import org.jboss.portal.theme.page.WindowContext;
+import org.jboss.portal.theme.page.PageRendition;
+import org.jboss.portal.common.NotYetImplemented;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class RenderPortletInstanceCommand extends PortletInstanceCommand
+{
+
+ public RenderPortletInstanceCommand(String instanceId, StateString navigationalState)
+ {
+ super(instanceId, navigationalState);
+ }
+
+ public CommandInfo getInfo()
+ {
+ return null;
+ }
+
+ public Object execute() throws ControllerException
+ {
+
+ try
+ {
+ PortletContextFactory pcf1 = new PortletContextFactory(context);
+ InvokePortletCommandFactory pcf2 = new InvokePortletInstanceCommandFactory(instanceId);
+ RenderInvocation render = PortletInvocationFactory.createRender(context, Mode.VIEW, WindowState.MAXIMIZED, navigationalState, pcf1, pcf2);
+ PortletInvocationResponse response = instance.invoke(render);
+
+ // For now let the controller handle non fragment response
+ String content;
+ if (response instanceof FragmentResponse)
+ {
+ content = ((FragmentResponse)response).getContent();
+ }
+ else if (response instanceof ErrorResponse)
+ {
+ content = ((ErrorResponse)response).toHTML();
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+
+ //
+ PageService ps = context.getController().getPageService();
+ LayoutService ls = ps.getLayoutService();
+ PortalLayout layout = ls.getLayout("generic", true);
+ Map pageProperties = new HashMap();
+ Map portalProperties = new HashMap();
+ portalProperties.put("theme.renderSetId", "divRenderer");
+ portalProperties.put("theme.id", "renaissance");
+ PageResult result = new PageResult("BILTO", pageProperties, portalProperties);
+
+ //
+ Map windowProps = new HashMap();
+ windowProps.put(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER, "emptyRenderer");
+ windowProps.put(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER, "emptyRenderer");
+ windowProps.put(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER, "emptyRenderer");
+
+ //
+ WindowResult res = new WindowResult("", content, Collections.EMPTY_MAP, windowProps, null, WindowState.MAXIMIZED, Mode.VIEW);
+ WindowContext blah = new WindowContext("BILTO", "BILTO", "maximized", 0, res);
+ result.addWindowContext(blah);
+
+ //
+ return new PageRendition(layout, null, result, ps);
+ }
+ catch (PortletInvokerException e)
+ {
+ throw new ControllerException(e);
+ }
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/model/instance/command/response/UpdatePortletInstanceResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/response/UpdatePortletInstanceResponse.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/response/UpdatePortletInstanceResponse.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.instance.command.response;
+
+import org.jboss.portal.portlet.StateString;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UpdatePortletInstanceResponse
+{
+
+ /** . */
+ private String instanceId;
+
+ /** The navigational state. */
+ protected StateString navigationalState;
+
+ public UpdatePortletInstanceResponse(String instanceId, StateString navigationalState)
+ {
+ this.instanceId = instanceId;
+ this.navigationalState = navigationalState;
+ }
+
+ public String getInstanceId()
+ {
+ return instanceId;
+ }
+
+
+ public StateString getNavigationalState()
+ {
+ return navigationalState;
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/DashboardCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/DashboardCommandFactory.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/DashboardCommandFactory.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -23,7 +23,7 @@
package org.jboss.portal.core.model.portal;
import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.model.portal.command.ViewDashboardCommand;
+import org.jboss.portal.core.model.portal.command.view.ViewDashboardCommand;
import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
import org.jboss.portal.server.ServerInvocation;
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -23,7 +23,7 @@
package org.jboss.portal.core.model.portal;
import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.model.portal.command.RenderPageCommand;
+import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
import org.jboss.portal.core.controller.command.mapper.CommandFactory;
import org.jboss.portal.server.ServerInvocation;
@@ -79,7 +79,7 @@
throw new IllegalStateException("Default page does not exist");
}
PortalObjectId id = page.getId();
- cmd = new RenderPageCommand(id);
+ cmd = new ViewPageCommand(id);
}
return cmd;
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -26,10 +26,10 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
-import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
-import org.jboss.portal.core.model.portal.command.RenderPageCommand;
-import org.jboss.portal.core.model.portal.command.ImportPageToDashboardCommand;
+import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowActionCommand;
+import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.action.ImportPageToDashboardCommand;
+import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
import org.jboss.portal.core.model.portal.ns.WindowNavigationalState;
import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
import org.jboss.portal.core.ns.NavigationalStateKey;
@@ -182,7 +182,7 @@
}
else
{
- cmd = new RenderPageCommand(id);
+ cmd = new ViewPageCommand(id);
}
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -27,10 +27,18 @@
import org.jboss.portal.core.controller.HandlerResponse;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.core.model.portal.command.response.UpdateViewResponse;
-import org.jboss.portal.core.model.portal.command.response.UpdateWindowMarkupResponse;
-import org.jboss.portal.core.model.portal.command.RenderPageCommand;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.HTTPResponse;
+import org.jboss.portal.core.model.portal.command.response.UpdatePageResponse;
+import org.jboss.portal.core.model.portal.command.response.UpdateWindowResponse;
+import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
+import org.jboss.portal.core.model.portal.command.render.RenderPageCommand;
import org.jboss.portal.server.ServerException;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.theme.page.PageRendition;
+import org.jboss.portal.web.ServletContextDispatcher;
+import org.jboss.portal.common.util.MarkupInfo;
import javax.servlet.ServletException;
import java.io.IOException;
@@ -44,19 +52,40 @@
public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand command, Object commandResponse) throws IOException, ServletException, ServerException
{
- if (commandResponse instanceof UpdateViewResponse)
+ if (commandResponse instanceof UpdatePageResponse)
{
- UpdateViewResponse uvr = (UpdateViewResponse)commandResponse;
- RenderPageCommand renderCmd = new RenderPageCommand(uvr.getPageId());
- return new CommandForward(renderCmd, null);
+ UpdatePageResponse uvr = (UpdatePageResponse)commandResponse;
+
+ try
+ {
+ RenderPageCommand rpc = new RenderPageCommand(uvr.getPageId());
+ final PageRendition rendition = (PageRendition)controllerContext.execute(rpc);
+ final ServerInvocation invocation = controllerContext.getServerInvocation();
+ return new HTTPResponse()
+ {
+ public void sendResponse(ServerInvocationContext ctx) throws IOException, ServletException
+ {
+ ServletContextDispatcher dispatcher = new ServletContextDispatcher(invocation.getServerContext().getClientRequest(), invocation.getServerContext().getClientResponse(), invocation.getRequest().getServer().getServletContainerContext());
+ MarkupInfo markupInfo = (MarkupInfo)invocation.getResponse().getContentInfo();
+ rendition.render(markupInfo, dispatcher);
+ }
+ };
+ }
+ catch (ControllerException e)
+ {
+ e.printStackTrace();
+
+ // todo
+ return null;
+ }
}
- else if (commandResponse instanceof UpdateWindowMarkupResponse)
+ else if (commandResponse instanceof UpdateWindowResponse)
{
- UpdateWindowMarkupResponse uwmr = (UpdateWindowMarkupResponse)commandResponse;
+ UpdateWindowResponse uwmr = (UpdateWindowResponse)commandResponse;
PortalObjectContainer portalObjectContainer = controllerContext.getController().getPortalObjectContainer();
PortalObject window = portalObjectContainer.getObject(uwmr.getWindowId());
Page page = (Page)window.getParent();
- RenderPageCommand rpc = new RenderPageCommand(page.getId());
+ ViewPageCommand rpc = new ViewPageCommand(page.getId());
return new CommandForward(rpc, null);
}
else
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -26,12 +26,12 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.common.text.FastURLEncoder;
import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowCommand;
-import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
-import org.jboss.portal.core.model.portal.command.RenderPageCommand;
+import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowActionCommand;
+import org.jboss.portal.core.model.portal.command.action.InvokeWindowCommand;
+import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.render.RenderPageCommand;
import org.jboss.portal.core.model.portal.command.PortalObjectCommand;
-import org.jboss.portal.core.model.portal.command.ImportPageToDashboardCommand;
+import org.jboss.portal.core.model.portal.command.action.ImportPageToDashboardCommand;
import org.jboss.portal.core.controller.command.mapper.URLFactoryDelegate;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.impl.PortletRequestEncoder;
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/command/ImportPageToDashboardCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/ImportPageToDashboardCommand.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/ImportPageToDashboardCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -1,111 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal.command;
-
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.Portal;
-import org.jboss.portal.core.model.portal.DuplicatePortalObjectException;
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.command.response.UpdateViewResponse;
-import org.jboss.portal.core.model.CustomizationManager;
-import org.jboss.portal.identity.User;
-
-import java.util.Iterator;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class ImportPageToDashboardCommand extends PageCommand
-{
-
- /** . */
- private static final CommandInfo info = new ActionCommandInfo(false);
-
- /** . */
- private Portal dashboardPortal;
-
- public ImportPageToDashboardCommand(PortalObjectId pageId)
- {
- super(pageId);
- }
-
- public CommandInfo getInfo()
- {
- return info;
- }
-
- public void create() throws ControllerException
- {
- super.create();
-
- //
- CustomizationManager manager = getControllerContext().getController().getCustomizationManager();
-
- //
- User user = getControllerContext().getUser();
-
- //
- dashboardPortal = manager.getDashboard(user);
- }
-
- public Object execute() throws ControllerException
- {
- String name = target.getName();
-
- //
- PortalObject dashboardPage = dashboardPortal.getChild(name);
-
- //
- if (dashboardPage == null)
- {
- try
- {
- // Copy page
- dashboardPage = target.copy(dashboardPortal, name, false);
-
- // Copy children windows only
- for (Iterator i = target.getChildren().iterator();i.hasNext();)
- {
- PortalObject child = (PortalObject)i.next();
- if (child.getType() == PortalObject.TYPE_WINDOW)
- {
- child.copy(dashboardPage, child.getName(), false);
- }
- }
- }
- catch (DuplicatePortalObjectException e)
- {
- log.error("Unexpected exception during the copy of a page to a dashboard page", e);
-
- //
- throw new ControllerException(e);
- }
- }
-
- return new UpdateViewResponse(dashboardPage.getId());
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -1,174 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal.command;
-
-import org.jboss.logging.Logger;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.identity.User;
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.ResourceNotFoundException;
-import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
-import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.model.content.Content;
-import org.jboss.portal.portlet.NoSuchPortletException;
-import org.jboss.portal.portlet.PortletParameters;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class InvokePortletWindowActionCommand extends InvokeWindowCommand
-{
-
- /** . */
- private static final Logger log = Logger.getLogger(InvokePortletWindowActionCommand.class);
-
- /** . */
- private static final CommandInfo info = new ActionCommandInfo(false);
-
- /** . */
- private StateString navigationalState;
-
- /** . */
- private StateString interactionState;
-
- /** . */
- private PortletParameters formParameters;
-
- /** The instance. */
- protected Instance instance;
-
- public InvokePortletWindowActionCommand(
- PortalObjectId windowId,
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- StateString interactionState,
- PortletParameters formParameters)
- throws IllegalArgumentException
- {
- super(windowId, mode, windowState);
- this.navigationalState = navigationalState;
- this.interactionState = interactionState;
- this.formParameters = formParameters;
- }
-
- public StateString getNavigationalState()
- {
- return navigationalState;
- }
-
- public StateString getInteractionState()
- {
- return interactionState;
- }
-
- public void setInteractionState(StateString interactionState)
- {
- this.interactionState = interactionState;
- }
-
- public PortletParameters getFormParameters()
- {
- return formParameters;
- }
-
- public void setFormParameters(PortletParameters formParameters)
- {
- this.formParameters = formParameters;
- }
-
- public CommandInfo getInfo()
- {
- return info;
- }
-
- public void create() throws ControllerException
- {
- super.create();
-
- // We need the user id
- User user = getControllerContext().getUser();
-
- // Get instance
- instance = context.getController().getCustomizationManager().getInstance(window, user);
-
- // No instance means we can't continue
- if (instance == null)
- {
- String ref = null;
- Content content = window.getContent();
- if (content != null)
- {
- ref = content.getURI();
- }
- if (ref == null)
- {
- ref = window.getId().toString();
- }
- throw new ResourceNotFoundException(ref);
- }
- }
-
- public Object execute() throws ControllerException
- {
- try
- {
- PortletInvocation invocation = PortletInvocationFactory.createAction(
- context,
- mode,
- windowState,
- navigationalState,
- interactionState,
- formParameters,
- window,
- portal);
-
- //
- PortletInvocationResponse response = instance.invoke(invocation);
-
- //
- return new PortletWindowResponse(targetId, response);
- }
- catch (PortletInvokerException e)
- {
- if (e instanceof NoSuchPortletException)
- {
- throw new ResourceNotFoundException(((NoSuchPortletException)e).getPortletId());
- }
- else
- {
- throw new ControllerException(e);
- }
- }
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -1,124 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal.command;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.common.invocation.InvocationContext;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
-import org.jboss.portal.core.model.portal.command.response.UpdateWindowMarkupResponse;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.ns.WindowNavigationalState;
-import org.jboss.portal.core.ns.NavigationalStateKey;
-import org.jboss.portal.portlet.StateString;
-
-/**
- * Simply update the navigational state of the window. No invocation to the underlying is done.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class InvokePortletWindowRenderCommand extends InvokeWindowCommand
-{
-
- private static final CommandInfo info = new ViewCommandInfo();
-
- /** . */
- protected final StateString navigationalState;
-
- public InvokePortletWindowRenderCommand(
- PortalObjectId windowId,
- Mode mode,
- WindowState windowState,
- StateString navigationalState)
- throws IllegalArgumentException
- {
- super(windowId, mode, windowState);
- this.navigationalState = navigationalState;
- }
-
- public InvokePortletWindowRenderCommand(
- PortalObjectId windowId,
- Mode mode,
- WindowState windowState)
- throws IllegalArgumentException
- {
- super(windowId, mode, windowState);
- this.navigationalState = null;
- }
-
- public StateString getNavigationalState()
- {
- return navigationalState;
- }
-
- public CommandInfo getInfo()
- {
- return info;
- }
-
- public Object execute() throws InvocationException
- {
- InvocationContext ctx = getContext();
- PortalObjectId windowId = window.getId();
- NavigationalStateKey nsKey = new NavigationalStateKey(WindowNavigationalState.class, windowId);
-
- //
- WindowNavigationalState oldNS = (WindowNavigationalState)ctx.getAttribute(NAVIGATIONAL_STATE_SCOPE, nsKey);
-
- //
- StateString newState = oldNS != null ? oldNS.getNavigationalState() : null;
- WindowState newWindowState = oldNS != null ? oldNS.getWindowState() : null;
- Mode newMode = oldNS != null ? oldNS.getMode() : null;
-
- //
- if (navigationalState != null)
- {
- newState = navigationalState;
- }
-
- //
- if (this.mode != null)
- {
- newMode = this.mode;
- }
-
- //
- if (this.windowState != null)
- {
- newWindowState = this.windowState;
- }
-
- // Create new NS
- WindowNavigationalState newNS = new WindowNavigationalState(newWindowState, newMode, newState);
-
- // Update NS
- ctx.setAttribute(NAVIGATIONAL_STATE_SCOPE, nsKey, newNS);
-
-
- //
- return new UpdateWindowMarkupResponse(windowId);
- }
-}
\ No newline at end of file
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowCommand.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -1,58 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal.command;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public abstract class InvokeWindowCommand extends WindowCommand
-{
-
- /** . */
- protected final Mode mode;
-
- /** . */
- protected final WindowState windowState;
-
- public InvokeWindowCommand(PortalObjectId windowId, Mode mode, WindowState windowState) throws IllegalArgumentException
- {
- super(windowId);
- this.mode = mode;
- this.windowState = windowState;
- }
-
- public Mode getMode()
- {
- return mode;
- }
-
- public WindowState getWindowState()
- {
- return windowState;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/command/MoveWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/MoveWindowCommand.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/MoveWindowCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -1,142 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal.command;
-
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.theme.ThemeConstants;
-
-import java.util.Iterator;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class MoveWindowCommand extends WindowCommand
-{
-
- /** . */
- private static final CommandInfo info = new ActionCommandInfo(false);
-
- /** . */
- private int fromPos;
-
- /** . */
- private String fromRegion;
-
- /** . */
- private int toPos;
-
- /** . */
- private String toRegion;
-
- public MoveWindowCommand(PortalObjectId windowId, int fromPos, String fromRegion, int toPos, String toRegion)
- throws IllegalArgumentException
- {
- super(windowId);
- this.fromPos = fromPos;
- this.fromRegion = fromRegion;
- this.toPos = toPos;
- this.toRegion = toRegion;
- }
-
- public CommandInfo getInfo()
- {
- return info;
- }
-
- public Object execute() throws ControllerException
- {
-
- // For now just update the navigational state of the page
-// PageNavigationalState pns = (PageNavigationalState)getContext().getAttribute(NAVIGATIONAL_STATE_SCOPE, page.getId());
-
- //
-/*
- for (Iterator i = pns.getWindowContexts().iterator(); i.hasNext();)
- {
- WindowContext windowCtx = (WindowContext)i.next();
- String windowRegion = windowCtx.getRegionName();
- if (targetId.equals(windowCtx.getId()))
- {
- windowCtx.setRegionName(toRegion);
- windowCtx.setOrder(toPos);
- }
- else if (fromRegion.equals(windowRegion) && fromPos < windowCtx.getOrder())
- {
- windowCtx.setOrder(windowCtx.getOrder() - 1);
- }
- else if (toRegion.equals(windowRegion) && toPos <= windowCtx.getOrder())
- {
- windowCtx.setOrder(windowCtx.getOrder() + 1);
- }
- }
-*/
-
- //
- if (isDashboard())
- {
- for (Iterator i = page.getChildren().iterator(); i.hasNext();)
- {
- PortalObject child = (PortalObject)i.next();
- if (child.getType() == PortalObject.TYPE_WINDOW)
- {
- Window window = (Window)child;
- PortalObjectId windowId = window.getId();
- String regionId = window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION);
- String posAsString = window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER);
- if (regionId != null && posAsString != null)
- {
- try
- {
- int pos = Integer.parseInt(posAsString);
- if (targetId.equals(windowId))
- {
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION, toRegion);
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, Integer.toString(toPos));
- }
- else if (fromRegion.equals(regionId) && fromPos < pos)
- {
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, Integer.toString(toPos - 1));
- }
- else if (toRegion.equals(regionId) && toPos <= pos)
- {
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, Integer.toString(toPos + 1));
- }
- }
- catch (NumberFormatException e)
- {
- }
- }
- }
- }
- }
-
- //
- return null;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -1,379 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal.command;
-
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.ControllerSecurityException;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.PortalObjectPermission;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.identity.User;
-import org.jboss.portal.identity.UserProfileModule;
-import org.jboss.portal.security.PortalSecurityException;
-import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.theme.LayoutService;
-import org.jboss.portal.theme.page.PageRendition;
-import org.jboss.portal.theme.PortalLayout;
-import org.jboss.portal.theme.PortalTheme;
-import org.jboss.portal.theme.ServerRegistrationID;
-import org.jboss.portal.theme.ThemeConstants;
-import org.jboss.portal.theme.ThemeService;
-import org.jboss.portal.theme.PageService;
-import org.jboss.portal.theme.page.PageResult;
-import org.jboss.portal.theme.page.WindowResult;
-import org.jboss.portal.theme.page.WindowContext;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-/**
- * Render a full page.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public final class RenderPageCommand extends PageCommand
-{
-
- /** . */
- private static final CommandInfo info = new ViewCommandInfo();
-
- /** The windows to render. */
- private Collection windows;
-
- /** . */
- private PortalLayout layout;
-
- /** . */
- private boolean personalizable;
-
- public RenderPageCommand(PortalObjectId pageId)
- {
- super(pageId);
- }
-
- /**
- * Get the command info (runtime info about the command)
- *
- * @return info about the command
- */
- public CommandInfo getInfo()
- {
- return info;
- }
-
- /**
- * Get the layout that was determined for this request (based on portal and page properties)
- *
- * @return the layout to use for this request
- */
- public PortalLayout getLayout()
- {
- return layout;
- }
-
- /**
- * Returns the modifiable list of windows.
- *
- * @return the windows on the page
- */
- public Collection getWindows()
- {
- return windows;
- }
-
- /**
- * initialize the command
- *
- * @throws InvocationException
- */
- public void create() throws ControllerException
- {
- super.create();
-
- // All windows on the page
- windows = new ArrayList(getPage().getChildren(PortalObject.WINDOW_MASK));
-
- //
- LayoutService layoutService = context.getController().getPageService().getLayoutService();
- layout = getLayout(layoutService, page);
- }
-
- public void enforceSecurity(PortalAuthorizationManager pam) throws ControllerSecurityException, PortalSecurityException
- {
- //
- super.enforceSecurity(pam);
-
- // Check if the user can personalize the page
- PortalObjectId uri = page.getId();
- PortalObjectPermission perm = new PortalObjectPermission(uri, PortalObjectPermission.PERSONALIZE_MASK);
- personalizable = pam.checkPermission(perm);
- }
-
- /**
- * execute the command
- *
- * @throws InvocationException
- */
- public Object execute() throws ControllerException, InvocationException
- {
- ServerInvocation sinv = context.getServerInvocation();
- HttpServletRequest request = sinv.getServerContext().getClientRequest();
- try
- {
- //
- PageService pageService = context.getController().getPageService();
-
- // The theme for the page
- PortalTheme theme = null;
-
- //
- if (personalizable)
- {
- ControllerContext controllerCtx = (ControllerContext)getContext();
- User user = controllerCtx.getUser();
- if (user != null)
- {
- UserProfileModule userProfileModule = null;
-
- //MARK: identity code change
- try
- {
- userProfileModule = (UserProfileModule)new InitialContext().lookup("java:portal/UserProfileModule");
- }
- catch (NamingException ignore)
- {
- // Name is not bound anymore, it could happen during a shutdown, we don't do anything
- }
-
- //
- String themeId = (String)userProfileModule.getProperty(user, User.INFO_USER_THEME);
-
- if (themeId != null)
- {
- theme = getTheme(themeId);
- }
- }
- }
-
- // If nothing get it from the object properties
- if (theme == null)
- {
- String themeId = page.getProperty(ThemeConstants.PORTAL_PROP_THEME);
- theme = getTheme(themeId);
- }
-
- // Call the portlet container to create the markup fragment(s) for each portlet that needs to render itself
- PageResult pageResult = new PageResult(
- getPage().getName(),
- new HashMap(getPage().getDeclaredProperties()),
- new HashMap(getPage().getPortal().getDeclaredProperties()));
-
- // Render the windows
- for (Iterator i = windows.iterator(); i.hasNext();)
- {
- PortalObject o = (PortalObject)i.next();
- if (o instanceof Window)
- {
- Window window = (Window)o;
- boolean visible = true;
- if (visible)
- {
- RenderWindowCommand renderCmd = new RenderWindowCommand(window.getId());
-
- //
- Object res = null;
-
- //
- if (renderCmd != null)
- {
- res = context.execute(renderCmd);
- }
-
- //
- if (res == null)
- {
- // Skip
- }
- else if (res instanceof WindowResult)
- {
- WindowResult result = (WindowResult)res;
- String region = window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION);
- String order = window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER);
- WindowContext wc = new WindowContext(
- window.getName(),
- window.getId().toString(PortalObjectId.LEGACY_BASE64_FORMAT),
- region,
- Integer.parseInt(order),
- result);
- pageResult.addWindowContext(wc);
- }
- else
- {
- return res;
- }
- }
- }
- }
-
- //
- return new PageRendition(layout, theme, pageResult, pageService);
- }
- catch (Exception e)
- {
- rethrow(e);
- }
-
- //
- return null;
- }
-
- private PortalTheme getTheme(String themeIdString)
- {
- //
- ThemeService service = context.getController().getPageService().getThemeService();
-
- PortalTheme theme;
-
- // If the id is provided in the form of context.name then look up the theme via a registration id
- if (themeIdString == null)
- {
- theme = service.getDefaultTheme();
- }
- else if (themeIdString.lastIndexOf(".") > 0)
- {
- ServerRegistrationID themeId = ServerRegistrationID.createID(ServerRegistrationID.TYPE_THEME, parseId(themeIdString));
- theme = service.getTheme(themeId, true);
- }
- else
- {
- // Otherwise use the ordinary theme name provided and lookup the theme via the name
- theme = service.getTheme(themeIdString, true);
- }
-
- // Last Chance
- if (theme == null)
- {
- theme = service.getTheme("renaissance", true);
- }
-
- // We don't like that situation
- if (theme == null)
- {
- throw new IllegalStateException("No Theme found for " + themeIdString);
- }
-
- //
- return theme;
- }
-
- /**
- * Get the portal layout to use for the provided page. <p>The name of the layout to use can be defined as a property
- * in the portal, or the individual page. The page property overwrites the portal property. If no property was set, a
- * default layout with the name "nodesk" is assumed.</p>
- *
- * @param layoutService the layout service that allows access to the layout
- * @param page the page that hosts the markup container to render (the page, region, window,...)
- * @return a <code>PortalLayout</code> for the defined layout name
- */
- public static PortalLayout getLayout(LayoutService layoutService, Page page)
- {
- String layoutIdString = page.getProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
-
- //
- PortalLayout layout;
-
- if (layoutIdString == null)
- {
- layout = layoutService.getDefaultLayout();
- }
- else if (layoutIdString.lastIndexOf(".") > 0)
- {
- // if the id is provided in the form of context.name then look up the layout via a registration id
- ServerRegistrationID layoutID = ServerRegistrationID.createID(ServerRegistrationID.TYPE_LAYOUT, parseId(layoutIdString));
- layout = layoutService.getLayout(layoutID, true);
- }
- else
- {
- // otherwise use the ordinary layout name provided and lookup the layout via the name
- layout = layoutService.getLayout(layoutIdString, true);
- }
-
- // Last Chance
- if (layout == null)
- {
- layout = layoutService.getLayout("generic", true);
- }
-
- // We don't like that situation
- if (layout == null)
- {
- throw new IllegalStateException("NO LAYOUT FOUND FOR " + layoutIdString);
- }
-
- //
- return layout;
- }
-
- /**
- * parse the provided String for '.' as a separator. For each token, add an entry to a String[] that will be returned
- * as the result
- *
- * @param layoutIDString the string to be examined
- * @return an array of Strings
- */
- private static String[] parseId(String layoutIDString)
- {
- List names = new ArrayList();
- StringTokenizer tokens = new StringTokenizer(layoutIDString, ".");
- if (tokens.countTokens() > 1)
- {
- while (tokens.hasMoreElements())
- {
- names.add(tokens.nextToken());
- }
- }
- else
- {
- names.add(layoutIDString);
- }
-
- String[] id = new String[names.size()];
- names.toArray(id);
- return id;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -1,98 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal.command;
-
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.content.ContentRendererRegistry;
-import org.jboss.portal.core.model.portal.content.ContentRenderer;
-import org.jboss.portal.core.model.content.ContentType;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class RenderWindowCommand extends WindowCommand
-{
-
- /** . */
- public static final String WINDOW_ACCESS_DENIED = "core.render.window_access_denied";
-
- /** . */
- public static final String WINDOW_UNAVAILABLE = "core.render.window_unavailable";
-
- /** . */
- public static final String WINDOW_ERROR = "core.render.window_error";
-
- /** . */
- public static final String WINDOW_INTERNAL_ERROR = "core.render.window_internal_error";
-
- /** . */
- public static final String WINDOW_NOT_FOUND = "core.render.window_not_found";
-
- /** . */
- public static final String HIDE = "hide";
-
- /** . */
- public static final String SHOW = "show";
-
- /** . */
- private static final CommandInfo info = new ViewCommandInfo();
-
- public RenderWindowCommand(PortalObjectId windowId)
- throws IllegalArgumentException
- {
- super(windowId);
- }
-
- public CommandInfo getInfo()
- {
- return info;
- }
-
- public Object execute() throws ControllerException
- {
- ContentRendererRegistry registry = context.getController().getContentRendererRegistry();
- ContentType contentType = window.getContentType();
- ContentRenderer renderer = registry.getRenderer(contentType);
-
- //
- if (renderer == null)
- {
- return null;
- }
- else
- {
- try
- {
- return renderer.renderWindow(this);
- }
- catch (Exception e)
- {
- throw new ControllerException(e);
- }
- }
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/command/ViewDashboardCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/ViewDashboardCommand.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/ViewDashboardCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -1,110 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal.command;
-
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.ControllerSecurityException;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
-import org.jboss.portal.core.model.portal.command.response.UpdateViewResponse;
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.model.portal.Portal;
-import org.jboss.portal.core.model.CustomizationManager;
-import org.jboss.portal.security.PortalSecurityException;
-import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
-import org.jboss.portal.identity.User;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class ViewDashboardCommand extends DashboardCommand
-{
-
- /** . */
- private static final CommandInfo info = new ViewCommandInfo();
-
- /** . */
- private Portal dashboardPortal;
-
- /** . */
- private Page dashboardPage;
-
- /** . */
- private User user;
-
- public ViewDashboardCommand()
- {
- }
-
- public CommandInfo getInfo()
- {
- return info;
- }
-
- public Portal getDashboardPortal()
- {
- return dashboardPortal;
- }
-
- public Page getDashboardPage()
- {
- return dashboardPage;
- }
-
- /**
- * Initialize the command
- *
- * @throws org.jboss.portal.common.invocation.InvocationException
- *
- */
- public void create() throws ControllerException
- {
- super.create();
-
- //
- CustomizationManager manager = getControllerContext().getController().getCustomizationManager();
-
- //
- user = getControllerContext().getUser();
-
- //
- dashboardPortal = manager.getDashboard(user);
-
- //
- dashboardPage = dashboardPortal.getDefaultPage();
- }
-
- public void enforceSecurity(PortalAuthorizationManager pam) throws ControllerSecurityException, PortalSecurityException
- {
- if (user == null)
- {
- throw new ControllerSecurityException("User needs to be authenticated to view a dashboard");
- }
- }
-
- public Object execute() throws ControllerException
- {
- return new UpdateViewResponse(dashboardPage.getId());
- }
-}
\ No newline at end of file
Added: trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/ImportPageToDashboardCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/ImportPageToDashboardCommand.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/ImportPageToDashboardCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -0,0 +1,112 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.command.action;
+
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.DuplicatePortalObjectException;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.command.response.UpdatePageResponse;
+import org.jboss.portal.core.model.portal.command.PageCommand;
+import org.jboss.portal.core.model.CustomizationManager;
+import org.jboss.portal.identity.User;
+
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ImportPageToDashboardCommand extends PageCommand
+{
+
+ /** . */
+ private static final CommandInfo info = new ActionCommandInfo(false);
+
+ /** . */
+ private Portal dashboardPortal;
+
+ public ImportPageToDashboardCommand(PortalObjectId pageId)
+ {
+ super(pageId);
+ }
+
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ public void create() throws ControllerException
+ {
+ super.create();
+
+ //
+ CustomizationManager manager = getControllerContext().getController().getCustomizationManager();
+
+ //
+ User user = getControllerContext().getUser();
+
+ //
+ dashboardPortal = manager.getDashboard(user);
+ }
+
+ public Object execute() throws ControllerException
+ {
+ String name = target.getName();
+
+ //
+ PortalObject dashboardPage = dashboardPortal.getChild(name);
+
+ //
+ if (dashboardPage == null)
+ {
+ try
+ {
+ // Copy page
+ dashboardPage = target.copy(dashboardPortal, name, false);
+
+ // Copy children windows only
+ for (Iterator i = target.getChildren().iterator();i.hasNext();)
+ {
+ PortalObject child = (PortalObject)i.next();
+ if (child.getType() == PortalObject.TYPE_WINDOW)
+ {
+ child.copy(dashboardPage, child.getName(), false);
+ }
+ }
+ }
+ catch (DuplicatePortalObjectException e)
+ {
+ log.error("Unexpected exception during the copy of a page to a dashboard page", e);
+
+ //
+ throw new ControllerException(e);
+ }
+ }
+
+ return new UpdatePageResponse(dashboardPage.getId());
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowActionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowActionCommand.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowActionCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -0,0 +1,175 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.command.action;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ResourceNotFoundException;
+import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
+import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
+import org.jboss.portal.core.model.portal.command.action.InvokeWindowCommand;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.content.Content;
+import org.jboss.portal.portlet.NoSuchPortletException;
+import org.jboss.portal.portlet.PortletParameters;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 6912 $
+ */
+public class InvokePortletWindowActionCommand extends InvokeWindowCommand
+{
+
+ /** . */
+ private static final Logger log = Logger.getLogger(InvokePortletWindowActionCommand.class);
+
+ /** . */
+ private static final CommandInfo info = new ActionCommandInfo(false);
+
+ /** . */
+ private StateString navigationalState;
+
+ /** . */
+ private StateString interactionState;
+
+ /** . */
+ private PortletParameters formParameters;
+
+ /** The instance. */
+ protected Instance instance;
+
+ public InvokePortletWindowActionCommand(
+ PortalObjectId windowId,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState,
+ StateString interactionState,
+ PortletParameters formParameters)
+ throws IllegalArgumentException
+ {
+ super(windowId, mode, windowState);
+ this.navigationalState = navigationalState;
+ this.interactionState = interactionState;
+ this.formParameters = formParameters;
+ }
+
+ public StateString getNavigationalState()
+ {
+ return navigationalState;
+ }
+
+ public StateString getInteractionState()
+ {
+ return interactionState;
+ }
+
+ public void setInteractionState(StateString interactionState)
+ {
+ this.interactionState = interactionState;
+ }
+
+ public PortletParameters getFormParameters()
+ {
+ return formParameters;
+ }
+
+ public void setFormParameters(PortletParameters formParameters)
+ {
+ this.formParameters = formParameters;
+ }
+
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ public void create() throws ControllerException
+ {
+ super.create();
+
+ // We need the user id
+ User user = getControllerContext().getUser();
+
+ // Get instance
+ instance = context.getController().getCustomizationManager().getInstance(window, user);
+
+ // No instance means we can't continue
+ if (instance == null)
+ {
+ String ref = null;
+ Content content = window.getContent();
+ if (content != null)
+ {
+ ref = content.getURI();
+ }
+ if (ref == null)
+ {
+ ref = window.getId().toString();
+ }
+ throw new ResourceNotFoundException(ref);
+ }
+ }
+
+ public Object execute() throws ControllerException
+ {
+ try
+ {
+ PortletInvocation invocation = PortletInvocationFactory.createAction(
+ context,
+ mode,
+ windowState,
+ navigationalState,
+ interactionState,
+ formParameters,
+ window,
+ portal);
+
+ //
+ PortletInvocationResponse response = instance.invoke(invocation);
+
+ //
+ return new PortletWindowResponse(targetId, response);
+ }
+ catch (PortletInvokerException e)
+ {
+ if (e instanceof NoSuchPortletException)
+ {
+ throw new ResourceNotFoundException(((NoSuchPortletException)e).getPortletId());
+ }
+ else
+ {
+ throw new ControllerException(e);
+ }
+ }
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowActionCommand.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowRenderCommand.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowRenderCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -0,0 +1,125 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.command.action;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.invocation.InvocationContext;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
+import org.jboss.portal.core.model.portal.command.response.UpdateWindowResponse;
+import org.jboss.portal.core.model.portal.command.action.InvokeWindowCommand;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.ns.WindowNavigationalState;
+import org.jboss.portal.core.ns.NavigationalStateKey;
+import org.jboss.portal.portlet.StateString;
+
+/**
+ * Simply update the navigational state of the window. No invocation to the underlying is done.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 6912 $
+ */
+public class InvokePortletWindowRenderCommand extends InvokeWindowCommand
+{
+
+ private static final CommandInfo info = new ActionCommandInfo(true);
+
+ /** . */
+ protected final StateString navigationalState;
+
+ public InvokePortletWindowRenderCommand(
+ PortalObjectId windowId,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState)
+ throws IllegalArgumentException
+ {
+ super(windowId, mode, windowState);
+ this.navigationalState = navigationalState;
+ }
+
+ public InvokePortletWindowRenderCommand(
+ PortalObjectId windowId,
+ Mode mode,
+ WindowState windowState)
+ throws IllegalArgumentException
+ {
+ super(windowId, mode, windowState);
+ this.navigationalState = null;
+ }
+
+ public StateString getNavigationalState()
+ {
+ return navigationalState;
+ }
+
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ public Object execute() throws InvocationException
+ {
+ InvocationContext ctx = getContext();
+ PortalObjectId windowId = window.getId();
+ NavigationalStateKey nsKey = new NavigationalStateKey(WindowNavigationalState.class, windowId);
+
+ //
+ WindowNavigationalState oldNS = (WindowNavigationalState)ctx.getAttribute(NAVIGATIONAL_STATE_SCOPE, nsKey);
+
+ //
+ StateString newState = oldNS != null ? oldNS.getNavigationalState() : null;
+ WindowState newWindowState = oldNS != null ? oldNS.getWindowState() : null;
+ Mode newMode = oldNS != null ? oldNS.getMode() : null;
+
+ //
+ if (navigationalState != null)
+ {
+ newState = navigationalState;
+ }
+
+ //
+ if (this.mode != null)
+ {
+ newMode = this.mode;
+ }
+
+ //
+ if (this.windowState != null)
+ {
+ newWindowState = this.windowState;
+ }
+
+ // Create new NS
+ WindowNavigationalState newNS = new WindowNavigationalState(newWindowState, newMode, newState);
+
+ // Update NS
+ ctx.setAttribute(NAVIGATIONAL_STATE_SCOPE, nsKey, newNS);
+
+
+ //
+ return new UpdateWindowResponse(windowId);
+ }
+}
\ No newline at end of file
Property changes on: trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowRenderCommand.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokeWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokeWindowCommand.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokeWindowCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.command.action;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.command.WindowCommand;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 6007 $
+ */
+public abstract class InvokeWindowCommand extends WindowCommand
+{
+
+ /** . */
+ protected final Mode mode;
+
+ /** . */
+ protected final WindowState windowState;
+
+ public InvokeWindowCommand(PortalObjectId windowId, Mode mode, WindowState windowState) throws IllegalArgumentException
+ {
+ super(windowId);
+ this.mode = mode;
+ this.windowState = windowState;
+ }
+
+ public Mode getMode()
+ {
+ return mode;
+ }
+
+ public WindowState getWindowState()
+ {
+ return windowState;
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokeWindowCommand.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/MoveWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/MoveWindowCommand.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/MoveWindowCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -0,0 +1,143 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.command.action;
+
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.command.WindowCommand;
+import org.jboss.portal.theme.ThemeConstants;
+
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class MoveWindowCommand extends WindowCommand
+{
+
+ /** . */
+ private static final CommandInfo info = new ActionCommandInfo(false);
+
+ /** . */
+ private int fromPos;
+
+ /** . */
+ private String fromRegion;
+
+ /** . */
+ private int toPos;
+
+ /** . */
+ private String toRegion;
+
+ public MoveWindowCommand(PortalObjectId windowId, int fromPos, String fromRegion, int toPos, String toRegion)
+ throws IllegalArgumentException
+ {
+ super(windowId);
+ this.fromPos = fromPos;
+ this.fromRegion = fromRegion;
+ this.toPos = toPos;
+ this.toRegion = toRegion;
+ }
+
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ public Object execute() throws ControllerException
+ {
+
+ // For now just update the navigational state of the page
+// PageNavigationalState pns = (PageNavigationalState)getContext().getAttribute(NAVIGATIONAL_STATE_SCOPE, page.getId());
+
+ //
+/*
+ for (Iterator i = pns.getWindowContexts().iterator(); i.hasNext();)
+ {
+ WindowContext windowCtx = (WindowContext)i.next();
+ String windowRegion = windowCtx.getRegionName();
+ if (targetId.equals(windowCtx.getId()))
+ {
+ windowCtx.setRegionName(toRegion);
+ windowCtx.setOrder(toPos);
+ }
+ else if (fromRegion.equals(windowRegion) && fromPos < windowCtx.getOrder())
+ {
+ windowCtx.setOrder(windowCtx.getOrder() - 1);
+ }
+ else if (toRegion.equals(windowRegion) && toPos <= windowCtx.getOrder())
+ {
+ windowCtx.setOrder(windowCtx.getOrder() + 1);
+ }
+ }
+*/
+
+ //
+ if (isDashboard())
+ {
+ for (Iterator i = page.getChildren().iterator(); i.hasNext();)
+ {
+ PortalObject child = (PortalObject)i.next();
+ if (child.getType() == PortalObject.TYPE_WINDOW)
+ {
+ Window window = (Window)child;
+ PortalObjectId windowId = window.getId();
+ String regionId = window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION);
+ String posAsString = window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER);
+ if (regionId != null && posAsString != null)
+ {
+ try
+ {
+ int pos = Integer.parseInt(posAsString);
+ if (targetId.equals(windowId))
+ {
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION, toRegion);
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, Integer.toString(toPos));
+ }
+ else if (fromRegion.equals(regionId) && fromPos < pos)
+ {
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, Integer.toString(toPos - 1));
+ }
+ else if (toRegion.equals(regionId) && toPos <= pos)
+ {
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, Integer.toString(toPos + 1));
+ }
+ }
+ catch (NumberFormatException e)
+ {
+ }
+ }
+ }
+ }
+ }
+
+ //
+ return null;
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderPageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderPageCommand.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderPageCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -0,0 +1,380 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.command.render;
+
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ControllerSecurityException;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.PortalObjectPermission;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.command.PageCommand;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.security.PortalSecurityException;
+import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.theme.LayoutService;
+import org.jboss.portal.theme.page.PageRendition;
+import org.jboss.portal.theme.PortalLayout;
+import org.jboss.portal.theme.PortalTheme;
+import org.jboss.portal.theme.ServerRegistrationID;
+import org.jboss.portal.theme.ThemeConstants;
+import org.jboss.portal.theme.ThemeService;
+import org.jboss.portal.theme.PageService;
+import org.jboss.portal.theme.page.PageResult;
+import org.jboss.portal.theme.page.WindowResult;
+import org.jboss.portal.theme.page.WindowContext;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+/**
+ * Render a full page.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 6942 $
+ */
+public final class RenderPageCommand extends PageCommand
+{
+
+ /** . */
+ private static final CommandInfo info = new ViewCommandInfo();
+
+ /** The windows to render. */
+ private Collection windows;
+
+ /** . */
+ private PortalLayout layout;
+
+ /** . */
+ private boolean personalizable;
+
+ public RenderPageCommand(PortalObjectId pageId)
+ {
+ super(pageId);
+ }
+
+ /**
+ * Get the command info (runtime info about the command)
+ *
+ * @return info about the command
+ */
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ /**
+ * Get the layout that was determined for this request (based on portal and page properties)
+ *
+ * @return the layout to use for this request
+ */
+ public PortalLayout getLayout()
+ {
+ return layout;
+ }
+
+ /**
+ * Returns the modifiable list of windows.
+ *
+ * @return the windows on the page
+ */
+ public Collection getWindows()
+ {
+ return windows;
+ }
+
+ /**
+ * initialize the command
+ *
+ * @throws InvocationException
+ */
+ public void create() throws ControllerException
+ {
+ super.create();
+
+ // All windows on the page
+ windows = new ArrayList(getPage().getChildren(PortalObject.WINDOW_MASK));
+
+ //
+ LayoutService layoutService = context.getController().getPageService().getLayoutService();
+ layout = getLayout(layoutService, page);
+ }
+
+ public void enforceSecurity(PortalAuthorizationManager pam) throws ControllerSecurityException, PortalSecurityException
+ {
+ //
+ super.enforceSecurity(pam);
+
+ // Check if the user can personalize the page
+ PortalObjectId uri = page.getId();
+ PortalObjectPermission perm = new PortalObjectPermission(uri, PortalObjectPermission.PERSONALIZE_MASK);
+ personalizable = pam.checkPermission(perm);
+ }
+
+ /**
+ * execute the command
+ *
+ * @throws InvocationException
+ */
+ public Object execute() throws ControllerException, InvocationException
+ {
+ ServerInvocation sinv = context.getServerInvocation();
+ HttpServletRequest request = sinv.getServerContext().getClientRequest();
+ try
+ {
+ //
+ PageService pageService = context.getController().getPageService();
+
+ // The theme for the page
+ PortalTheme theme = null;
+
+ //
+ if (personalizable)
+ {
+ ControllerContext controllerCtx = (ControllerContext)getContext();
+ User user = controllerCtx.getUser();
+ if (user != null)
+ {
+ UserProfileModule userProfileModule = null;
+
+ //MARK: identity code change
+ try
+ {
+ userProfileModule = (UserProfileModule)new InitialContext().lookup("java:portal/UserProfileModule");
+ }
+ catch (NamingException ignore)
+ {
+ // Name is not bound anymore, it could happen during a shutdown, we don't do anything
+ }
+
+ //
+ String themeId = (String)userProfileModule.getProperty(user, User.INFO_USER_THEME);
+
+ if (themeId != null)
+ {
+ theme = getTheme(themeId);
+ }
+ }
+ }
+
+ // If nothing get it from the object properties
+ if (theme == null)
+ {
+ String themeId = page.getProperty(ThemeConstants.PORTAL_PROP_THEME);
+ theme = getTheme(themeId);
+ }
+
+ // Call the portlet container to create the markup fragment(s) for each portlet that needs to render itself
+ PageResult pageResult = new PageResult(
+ getPage().getName(),
+ new HashMap(getPage().getDeclaredProperties()),
+ new HashMap(getPage().getPortal().getDeclaredProperties()));
+
+ // Render the windows
+ for (Iterator i = windows.iterator(); i.hasNext();)
+ {
+ PortalObject o = (PortalObject)i.next();
+ if (o instanceof Window)
+ {
+ Window window = (Window)o;
+ boolean visible = true;
+ if (visible)
+ {
+ RenderWindowCommand renderCmd = new RenderWindowCommand(window.getId());
+
+ //
+ Object res = null;
+
+ //
+ if (renderCmd != null)
+ {
+ res = context.execute(renderCmd);
+ }
+
+ //
+ if (res == null)
+ {
+ // Skip
+ }
+ else if (res instanceof WindowResult)
+ {
+ WindowResult result = (WindowResult)res;
+ String region = window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION);
+ String order = window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER);
+ WindowContext wc = new WindowContext(
+ window.getName(),
+ window.getId().toString(PortalObjectId.LEGACY_BASE64_FORMAT),
+ region,
+ Integer.parseInt(order),
+ result);
+ pageResult.addWindowContext(wc);
+ }
+ else
+ {
+ return res;
+ }
+ }
+ }
+ }
+
+ //
+ return new PageRendition(layout, theme, pageResult, pageService);
+ }
+ catch (Exception e)
+ {
+ rethrow(e);
+ }
+
+ //
+ return null;
+ }
+
+ private PortalTheme getTheme(String themeIdString)
+ {
+ //
+ ThemeService service = context.getController().getPageService().getThemeService();
+
+ PortalTheme theme;
+
+ // If the id is provided in the form of context.name then look up the theme via a registration id
+ if (themeIdString == null)
+ {
+ theme = service.getDefaultTheme();
+ }
+ else if (themeIdString.lastIndexOf(".") > 0)
+ {
+ ServerRegistrationID themeId = ServerRegistrationID.createID(ServerRegistrationID.TYPE_THEME, parseId(themeIdString));
+ theme = service.getTheme(themeId, true);
+ }
+ else
+ {
+ // Otherwise use the ordinary theme name provided and lookup the theme via the name
+ theme = service.getTheme(themeIdString, true);
+ }
+
+ // Last Chance
+ if (theme == null)
+ {
+ theme = service.getTheme("renaissance", true);
+ }
+
+ // We don't like that situation
+ if (theme == null)
+ {
+ throw new IllegalStateException("No Theme found for " + themeIdString);
+ }
+
+ //
+ return theme;
+ }
+
+ /**
+ * Get the portal layout to use for the provided page. <p>The name of the layout to use can be defined as a property
+ * in the portal, or the individual page. The page property overwrites the portal property. If no property was set, a
+ * default layout with the name "nodesk" is assumed.</p>
+ *
+ * @param layoutService the layout service that allows access to the layout
+ * @param page the page that hosts the markup container to render (the page, region, window,...)
+ * @return a <code>PortalLayout</code> for the defined layout name
+ */
+ public static PortalLayout getLayout(LayoutService layoutService, Page page)
+ {
+ String layoutIdString = page.getProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
+
+ //
+ PortalLayout layout;
+
+ if (layoutIdString == null)
+ {
+ layout = layoutService.getDefaultLayout();
+ }
+ else if (layoutIdString.lastIndexOf(".") > 0)
+ {
+ // if the id is provided in the form of context.name then look up the layout via a registration id
+ ServerRegistrationID layoutID = ServerRegistrationID.createID(ServerRegistrationID.TYPE_LAYOUT, parseId(layoutIdString));
+ layout = layoutService.getLayout(layoutID, true);
+ }
+ else
+ {
+ // otherwise use the ordinary layout name provided and lookup the layout via the name
+ layout = layoutService.getLayout(layoutIdString, true);
+ }
+
+ // Last Chance
+ if (layout == null)
+ {
+ layout = layoutService.getLayout("generic", true);
+ }
+
+ // We don't like that situation
+ if (layout == null)
+ {
+ throw new IllegalStateException("NO LAYOUT FOUND FOR " + layoutIdString);
+ }
+
+ //
+ return layout;
+ }
+
+ /**
+ * parse the provided String for '.' as a separator. For each token, add an entry to a String[] that will be returned
+ * as the result
+ *
+ * @param layoutIDString the string to be examined
+ * @return an array of Strings
+ */
+ private static String[] parseId(String layoutIDString)
+ {
+ List names = new ArrayList();
+ StringTokenizer tokens = new StringTokenizer(layoutIDString, ".");
+ if (tokens.countTokens() > 1)
+ {
+ while (tokens.hasMoreElements())
+ {
+ names.add(tokens.nextToken());
+ }
+ }
+ else
+ {
+ names.add(layoutIDString);
+ }
+
+ String[] id = new String[names.size()];
+ names.toArray(id);
+ return id;
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderPageCommand.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -0,0 +1,99 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.command.render;
+
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.command.WindowCommand;
+import org.jboss.portal.core.model.portal.content.ContentRendererRegistry;
+import org.jboss.portal.core.model.portal.content.ContentRenderer;
+import org.jboss.portal.core.model.content.ContentType;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class RenderWindowCommand extends WindowCommand
+{
+
+ /** . */
+ public static final String WINDOW_ACCESS_DENIED = "core.render.window_access_denied";
+
+ /** . */
+ public static final String WINDOW_UNAVAILABLE = "core.render.window_unavailable";
+
+ /** . */
+ public static final String WINDOW_ERROR = "core.render.window_error";
+
+ /** . */
+ public static final String WINDOW_INTERNAL_ERROR = "core.render.window_internal_error";
+
+ /** . */
+ public static final String WINDOW_NOT_FOUND = "core.render.window_not_found";
+
+ /** . */
+ public static final String HIDE = "hide";
+
+ /** . */
+ public static final String SHOW = "show";
+
+ /** . */
+ private static final CommandInfo info = new ViewCommandInfo();
+
+ public RenderWindowCommand(PortalObjectId windowId)
+ throws IllegalArgumentException
+ {
+ super(windowId);
+ }
+
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ public Object execute() throws ControllerException
+ {
+ ContentRendererRegistry registry = context.getController().getContentRendererRegistry();
+ ContentType contentType = window.getContentType();
+ ContentRenderer renderer = registry.getRenderer(contentType);
+
+ //
+ if (renderer == null)
+ {
+ return null;
+ }
+ else
+ {
+ try
+ {
+ return renderer.renderWindow(this);
+ }
+ catch (Exception e)
+ {
+ throw new ControllerException(e);
+ }
+ }
+ }
+}
Copied: trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdatePageResponse.java (from rev 6949, trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateViewResponse.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdatePageResponse.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdatePageResponse.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.command.response;
+
+import org.jboss.portal.core.model.portal.PortalObjectId;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UpdatePageResponse
+{
+
+ /** . */
+ private PortalObjectId pageId;
+
+ public UpdatePageResponse(PortalObjectId pageId)
+ {
+ if (pageId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.pageId = pageId;
+ }
+
+ public PortalObjectId getPageId()
+ {
+ return pageId;
+ }
+}
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateViewResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateViewResponse.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateViewResponse.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -1,50 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal.command.response;
-
-import org.jboss.portal.core.model.portal.PortalObjectId;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class UpdateViewResponse
-{
-
- /** . */
- private PortalObjectId pageId;
-
- public UpdateViewResponse(PortalObjectId pageId)
- {
- if (pageId == null)
- {
- throw new IllegalArgumentException();
- }
- this.pageId = pageId;
- }
-
- public PortalObjectId getPageId()
- {
- return pageId;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -1,51 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal.command.response;
-
-import org.jboss.portal.core.model.portal.PortalObjectId;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class UpdateWindowMarkupResponse
-{
-
- /** . */
- private final PortalObjectId windowId;
-
-
- public UpdateWindowMarkupResponse(PortalObjectId windowId)
- {
- if (windowId == null)
- {
- throw new IllegalArgumentException();
- }
- this.windowId = windowId;
- }
-
- public PortalObjectId getWindowId()
- {
- return windowId;
- }
-}
Copied: trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowResponse.java (from rev 6949, trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowResponse.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowResponse.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.command.response;
+
+import org.jboss.portal.core.model.portal.PortalObjectId;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UpdateWindowResponse
+{
+
+ /** . */
+ private final PortalObjectId windowId;
+
+ public UpdateWindowResponse(PortalObjectId windowId)
+ {
+ if (windowId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.windowId = windowId;
+ }
+
+ public PortalObjectId getWindowId()
+ {
+ return windowId;
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewDashboardCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewDashboardCommand.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewDashboardCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -0,0 +1,111 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.command.view;
+
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ControllerSecurityException;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.model.portal.command.response.UpdatePageResponse;
+import org.jboss.portal.core.model.portal.command.DashboardCommand;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.CustomizationManager;
+import org.jboss.portal.security.PortalSecurityException;
+import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
+import org.jboss.portal.identity.User;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ViewDashboardCommand extends DashboardCommand
+{
+
+ /** . */
+ private static final CommandInfo info = new ViewCommandInfo();
+
+ /** . */
+ private Portal dashboardPortal;
+
+ /** . */
+ private Page dashboardPage;
+
+ /** . */
+ private User user;
+
+ public ViewDashboardCommand()
+ {
+ }
+
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ public Portal getDashboardPortal()
+ {
+ return dashboardPortal;
+ }
+
+ public Page getDashboardPage()
+ {
+ return dashboardPage;
+ }
+
+ /**
+ * Initialize the command
+ *
+ * @throws org.jboss.portal.common.invocation.InvocationException
+ *
+ */
+ public void create() throws ControllerException
+ {
+ super.create();
+
+ //
+ CustomizationManager manager = getControllerContext().getController().getCustomizationManager();
+
+ //
+ user = getControllerContext().getUser();
+
+ //
+ dashboardPortal = manager.getDashboard(user);
+
+ //
+ dashboardPage = dashboardPortal.getDefaultPage();
+ }
+
+ public void enforceSecurity(PortalAuthorizationManager pam) throws ControllerSecurityException, PortalSecurityException
+ {
+ if (user == null)
+ {
+ throw new ControllerSecurityException("User needs to be authenticated to view a dashboard");
+ }
+ }
+
+ public Object execute() throws ControllerException
+ {
+ return new UpdatePageResponse(dashboardPage.getId());
+ }
+}
\ No newline at end of file
Added: trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewPageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewPageCommand.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewPageCommand.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.command.view;
+
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.command.response.UpdatePageResponse;
+import org.jboss.portal.core.model.portal.command.PageCommand;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.controller.ControllerException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ViewPageCommand extends PageCommand
+{
+
+ /** . */
+ private static final CommandInfo info = new ViewCommandInfo();
+
+ public ViewPageCommand(PortalObjectId pageId)
+ {
+ super(pageId);
+ }
+
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ public Object execute() throws ControllerException
+ {
+ return new UpdatePageResponse(page.getId());
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/content/ContentRenderer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/content/ContentRenderer.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/content/ContentRenderer.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.core.model.portal.content;
-import org.jboss.portal.core.model.portal.command.RenderWindowCommand;
+import org.jboss.portal.core.model.portal.command.render.RenderWindowCommand;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-04-08 14:16:18 UTC (rev 6957)
@@ -837,7 +837,7 @@
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<attribute name="Path">/dashboard</attribute>
- <attribute name="ClassNames">org.jboss.portal.core.model.portal.command.ViewDashboardCommand</attribute>
+ <attribute name="ClassNames">org.jboss.portal.core.model.portal.command.view.ViewDashboardCommand</attribute>
<depends
optional-attribute-name="Factory"
proxy-type="attribute">portal:urlFactory=Delegating</depends>
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2007-04-08 14:16:18 UTC (rev 6957)
@@ -52,12 +52,8 @@
</header-content>
</portlet>
- <!-- We don't want the catalog portlet to be asynchronous as it targets the whole page -->
<portlet>
<portlet-name>CatalogPortlet</portlet-name>
- <ajax>
- <asynchronous>false</asynchronous>
- </ajax>
<transaction>
<trans-attribute>Required</trans-attribute>
</transaction>
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactoryService.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactoryService.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactoryService.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -25,7 +25,7 @@
import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.cms.command.StreamContentCommand;
import org.jboss.portal.core.cms.ui.CMSPortlet;
import org.jboss.portal.cms.CMS;
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/content/InternalCMSContentProvider.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/content/InternalCMSContentProvider.java 2007-04-08 12:59:16 UTC (rev 6956)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/content/InternalCMSContentProvider.java 2007-04-08 14:16:18 UTC (rev 6957)
@@ -23,7 +23,7 @@
package org.jboss.portal.core.cms.content;
import org.jboss.portal.core.impl.model.content.generic.InternalGenericContentProvider;
-import org.jboss.portal.core.model.portal.command.RenderWindowCommand;
+import org.jboss.portal.core.model.portal.command.render.RenderWindowCommand;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.content.spi.portlet.ContentPortlet;
import org.jboss.portal.core.cms.CMSObjectCommandFactory;
17 years, 3 months
JBoss Portal SVN: r6956 - trunk/core/src/resources/portal-core-war/WEB-INF.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-08 08:59:16 -0400 (Sun, 08 Apr 2007)
New Revision: 6956
Modified:
trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
Log:
mark the catalog portlet as not asynch as it provides links to pages.
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2007-04-08 12:54:10 UTC (rev 6955)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2007-04-08 12:59:16 UTC (rev 6956)
@@ -51,8 +51,13 @@
</script>
</header-content>
</portlet>
+
+ <!-- We don't want the catalog portlet to be asynchronous as it targets the whole page -->
<portlet>
<portlet-name>CatalogPortlet</portlet-name>
+ <ajax>
+ <asynchronous>false</asynchronous>
+ </ajax>
<transaction>
<trans-attribute>Required</trans-attribute>
</transaction>
17 years, 3 months