[jboss-svn-commits] JBL Code SVN: r9291 - in labs/jbosslabs/trunk/portal-extensions: binaries/maven-repo-addons/tmate/jars and 49 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Feb 2 10:37:58 EST 2007
Author: adamw
Date: 2007-02-02 10:37:57 -0500 (Fri, 02 Feb 2007)
New Revision: 9291
Added:
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/LabsServices.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/PrimatesService.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/ProjectPagesService.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/ProjectsService.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/PropertyService.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/primates/
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/primates/PrimateDTO.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/forge-ejb3.iml
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/maven.xml
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/project.properties
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/project.xml
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/ejb/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/ejb/META-INF/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/ejb/META-INF/persistence.xml
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/AbstractAuthorizationBean.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/InstanceManagerBean.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PortletManagerBean.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PreferencesBean.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/Refresher.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/AddPageAction.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/AddWindowAction.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/CreateInstanceAction.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PortalAction.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PreferenceAction.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PropertyAction.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/ThemePropertyAction.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/ProjectPagesPortletsWatcher.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/ProjectPagesServiceBean.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projects/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projects/ProjectsServiceImpl.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/LabsPropertyEntity.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/PropertyServiceBean.java
labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/TestServlet.java
labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/TestServlet2.java
labs/jbosslabs/trunk/portal-extensions/forge-prj-info/forge-prj-info.iml
Removed:
labs/jbosslabs/trunk/portal-extensions/forge-blog/src/java/org/jboss/portlet/blog/
labs/jbosslabs/trunk/portal-extensions/forge-blog/src/web/WEB-INF/
labs/jbosslabs/trunk/portal-extensions/forge-common/src/ejb/
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/LabsServices.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/PrimatesService.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/ProjectPagesService.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/ProjectsService.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/PropertyService.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/navigation/
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/primates/PrimateDTO.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/propertypersistance/
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/service/
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/soa/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/forge-ejb3.iml
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/maven.xml
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/project.properties
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/project.xml
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/ejb/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/ejb/META-INF/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/ejb/META-INF/persistence.xml
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/AbstractAuthorizationBean.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/InstanceManagerBean.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PortletManagerBean.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PreferencesBean.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/Refresher.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/AddPageAction.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/AddWindowAction.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/CreateInstanceAction.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PortalAction.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PreferenceAction.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PropertyAction.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/ThemePropertyAction.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/ProjectPagesPortletsWatcher.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/ProjectPagesServiceBean.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projects/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projects/ProjectsServiceImpl.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/LabsPropertyEntity.java
labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/PropertyServiceBean.java
labs/jbosslabs/trunk/portal-extensions/forge-forums/
labs/jbosslabs/trunk/portal-extensions/forge-navigation/
labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/AttributesFilter.java
Modified:
labs/jbosslabs/trunk/portal-extensions/binaries/maven-repo-addons/tmate/jars/javasvn.jar
labs/jbosslabs/trunk/portal-extensions/configuration/to-copy/server/default/deploy/jboss-portal.sar/META-INF/jboss-service.xml
labs/jbosslabs/trunk/portal-extensions/forge-ads/src/java/org/jbosslabs/portlet/ads/AdsPortlet.java
labs/jbosslabs/trunk/portal-extensions/forge-blog/maven.xml
labs/jbosslabs/trunk/portal-extensions/forge-common/maven.xml
labs/jbosslabs/trunk/portal-extensions/forge-common/project.properties
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/Constants.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ForgeHelper.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/portlet/JBossLabsPortlet.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersWatcher.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectDescriptor.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Projects.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java
labs/jbosslabs/trunk/portal-extensions/forge-contributor/src/java/org/jboss/forge/contributor/ConServer.java
labs/jbosslabs/trunk/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/CmsLinkParser.java
labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java
labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/jboss-app.xml
labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/portlet-instances.xml
labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/portlet.xml
labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/web.xml
labs/jbosslabs/trunk/portal-extensions/forge-mapper/src/java/org/jboss/labs/mapper/LabsCommandFactory.java
labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/AutologinFilter.java
labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/java/org/jboss/forge/projects/info/Info.java
labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/java/org/jboss/forge/projects/info/ProjectInfoBean.java
labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/java/org/jboss/forge/projects/info/ProjectInfoEditBean.java
labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/web/WEB-INF/portlet.xml
labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/web/WEB-INF/web.xml
labs/jbosslabs/trunk/portal-extensions/forge-sar/src/forge-service.xml
labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/TagMeServlet.java
labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/services/TagMeTools.java
labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/ProjectTools.java
labs/jbosslabs/trunk/portal-extensions/maven.xml
labs/jbosslabs/trunk/portal-extensions/polls/src/java/org/jboss/forge/polls/PollsCacheItem.java
labs/jbosslabs/trunk/portal-extensions/portal-default/src/web/WEB-INF/default-object.xml
labs/jbosslabs/trunk/portal-extensions/portal-default/src/web/WEB-INF/portlet-instances.xml
labs/jbosslabs/trunk/portal-extensions/primates/project.xml
labs/jbosslabs/trunk/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/service/PrimatesServiceImpl.java
labs/jbosslabs/trunk/portal-extensions/project.xml
Log:
MERGE from 9014 of the -newprj branch
Modified: labs/jbosslabs/trunk/portal-extensions/binaries/maven-repo-addons/tmate/jars/javasvn.jar
===================================================================
(Binary files differ)
Modified: labs/jbosslabs/trunk/portal-extensions/configuration/to-copy/server/default/deploy/jboss-portal.sar/META-INF/jboss-service.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/configuration/to-copy/server/default/deploy/jboss-portal.sar/META-INF/jboss-service.xml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/configuration/to-copy/server/default/deploy/jboss-portal.sar/META-INF/jboss-service.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -619,22 +619,6 @@
<attribute name="DashboardContextId">dashboard</attribute>
</mbean>
- <!-- Labs command factory -->
- <mbean
- code="org.jboss.labs.mapper.LabsCommandFactory"
- name="portal:commandFactory=Labs"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <depends>shotoku:service=svn</depends>
- <depends
- optional-attribute-name="NextFactory"
- proxy-type="attribute">portal:commandFactory=DefaultPortal</depends>
- <depends
- optional-attribute-name="Container"
- proxy-type="attribute">portal:container=PortalObject</depends>
- </mbean>
-
<!-- Command factories -->
<mbean
code="org.jboss.portal.core.controller.command.mapper.DelegatingCommandFactoryService"
@@ -933,7 +917,7 @@
proxy-type="attribute">portal:service=PageService</depends>
<depends
optional-attribute-name="CommandFactory"
- proxy-type="attribute">portal:commandFactory=Labs</depends>
+ proxy-type="attribute">portal:commandFactory=DefaultPortal</depends>
<depends
optional-attribute-name="URLFactory"
proxy-type="attribute">portal:urlFactory=Delegating</depends>
Modified: labs/jbosslabs/trunk/portal-extensions/forge-ads/src/java/org/jbosslabs/portlet/ads/AdsPortlet.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ads/src/java/org/jbosslabs/portlet/ads/AdsPortlet.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ads/src/java/org/jbosslabs/portlet/ads/AdsPortlet.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -104,7 +104,6 @@
}
public void prepareRequest(JBossRenderRequest rReq) {
- ForgeHelper.prepareRequest(rReq);
}
protected void displayContent(JBossRenderRequest rReq,
Modified: labs/jbosslabs/trunk/portal-extensions/forge-blog/maven.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-blog/maven.xml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-blog/maven.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -11,14 +11,14 @@
</goal>
<goal name="build">
- <attainGoal name="prj-war-build" />
+ <!--<attainGoal name="prj-war-build" />-->
</goal>
<goal name="deploy">
- <attainGoal name="prj-war-deploy" />
+ <!--<attainGoal name="prj-war-deploy" />-->
</goal>
<goal name="clean">
- <attainGoal name="prj-clean" />
+ <!--<attainGoal name="prj-clean" />-->
</goal>
</project>
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/maven.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/maven.xml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/maven.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -5,7 +5,7 @@
-->
<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:u="jelly:util">
<goal name="all">
-
+ <attainGoal name="prj-all" />
</goal>
<goal name="clean">
@@ -13,8 +13,6 @@
</goal>
<goal name="build">
- <attainGoal name="ejb" />
- <ant:copy file="target/${maven.final.name}.jar" toFile="target/${maven.final.name}.ejb3" />
<attainGoal name="jar" />
</goal>
@@ -24,10 +22,5 @@
<ant:filename name="target/*.jar" />
</ant:fileset>
</ant:copy>
- <ant:copy todir="${local.deploy.dir}" flatten="true">
- <ant:fileset dir=".">
- <ant:filename name="target/*.ejb3" />
- </ant:fileset>
- </ant:copy>
</goal>
</project>
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/project.properties
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/project.properties 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/project.properties 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,5 +1,3 @@
maven.repo.remote=http://repo1.maven.org/maven
maven.junit.fork=yes
-maven.war.src=${basedir}/src/web
-maven.ejb.includes=**/ejb3/*.class,**/propertypersistance/PropertyService.class,**/soa/projects/ProjectsServiceImpl.class
-maven.jar.excludes=**/ejb3/*.class,**/soa/projects/ProjectsServiceImpl.class
\ No newline at end of file
+maven.war.src=${basedir}/src/web
\ No newline at end of file
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/Constants.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/Constants.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/Constants.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -64,33 +64,8 @@
* directory for this portal.
*/
public final static String PROP_SHOTOKU_PORTAL_DIRECTORY = "shotoku.main.directory";
-
- /**
- * An url parameter that should be set when a link does not point
- * to a project site.
- */
- public final static String NO_PROJECT_PARAM_NAME = "noproject";
/**
- * An url parameter+value pair that should be set when a link does not
- * point to a project site.
- */
- public final static String NO_PROJECT_PARAM = Constants.NO_PROJECT_PARAM_NAME + "=" +
- Constants.TRUE_VALUE;
-
- /**
- * Name of the paramter in the URL
- * depicting the selected project.
- */
- public final static String PROJECT_PARAM = "project";
-
- /**
- * An url parameter that should be set when it is known if the projects list
- * should be expanded or not when showing a projects' menu.
- */
- public static final String PROJECT_LIST_PARAM = "prjlist";
-
- /**
* A string representing a true value.
*/
public final static String TRUE_VALUE = "true";
@@ -99,4 +74,8 @@
* A string representing a false value.
*/
public final static String FALSE_VALUE = "false";
+ /**
+ * <code>LABS_PORTAL</code> - name of the portal where the labs page is.
+ */
+ public final static String LABS_PORTAL = "default";
}
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ForgeHelper.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ForgeHelper.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ForgeHelper.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -44,7 +44,6 @@
import javax.portlet.PortletRequest;
import javax.servlet.ServletRequest;
-import org.jboss.forge.common.service.ForgeManagement;
import org.jboss.mx.util.MBeanProxyExt;
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.portlet.JBossRenderRequest;
@@ -106,12 +105,7 @@
*/
public final static String FORGE_SERVICE_NAME = "forge:service=cacheAndUpdate";
- /**
- * <code>LABS_PORTAL</code> - name of the portal where the labs page is.
- */
- public final static String LABS_PORTAL = "default";
-
- private static Vector<String> tempFiles;
+ private static Vector<String> tempFiles;
public static final String FILES_PREFIX = "labsTempFile";
@@ -119,9 +113,7 @@
private static VolatileTempFileRemover vtfRemover;
- static {
- forgeManagement = null;
-
+ static {
tempFiles = new Vector<String>();
volatileTempFiles = new TreeSet<Integer>();
@@ -130,31 +122,6 @@
vtfRemover.start();
}
- /**
- * <code>forgeManagement</code> - here we keep a looked up ForgeManagement
- * instance. This variable is filled with the correct value on first call.
- */
- private static ForgeManagement forgeManagement;
-
- /**
- * Gets an instance of the ForgeManagement class. It is looked up as a
- * mbean, if this is the first invocation of this function.
- *
- * @return An instance of the ForgeManagement class.
- */
- public synchronized static ForgeManagement getForgeManagement() {
- try {
- if (forgeManagement == null)
- forgeManagement = (ForgeManagement) MBeanProxyExt.create(
- ForgeManagement.class, FORGE_SERVICE_NAME,
- MBeanServerLocator.locate());
-
- return forgeManagement;
- } catch (MalformedObjectNameException e) {
- throw new RuntimeException(e);
- }
- }
-
@CacheItem
private static ForgePropertiesWatcher forgeProperties;
@@ -280,17 +247,6 @@
}
/**
- * Prepares a request object for generating a JSP. As for now, the
- * PORTAL_NAME attribute is set to an appropriate value.
- *
- * @param request
- * Request to prepare.
- */
- public static void prepareRequest(JBossRenderRequest request) {
- request.setAttribute(ForgeHelper.PORTAL_NAME, getPortalName(request));
- }
-
- /**
* Sends an e-mail message.
*
* @param recipient
@@ -301,7 +257,6 @@
* Content of the message.
* @param from
* Address of this message's author.
- * @throws MessagingException
*/
public static void postMail(String recipient, String subject,
String message, String from) throws MessagingException {
@@ -428,16 +383,6 @@
if (link == null)
return link;
- // To each link, adding a noproject param, unless it's a project link.
- if ((!link.contains(Constants.NO_PROJECT_PARAM)) &&
- (!Tools.isOutsideLink(link))) {
- // Checking if this is a first parameter.
- if (link.contains("?"))
- return link + "&" + Constants.NO_PROJECT_PARAM;
- else
- return link + "?" + Constants.NO_PROJECT_PARAM;
- }
-
return link;
}
@@ -456,13 +401,6 @@
link = ForgeHelper.createPageLink(portalName, "default");
}
- // Deleting the noproject parameter, as it is not present in the generated links.
- // There are three possibilites: it is the first parameter and there are no more
- // parameters, there are more parameters, or it is a not-first parameter.
- link = removeParameter(link, Constants.NO_PROJECT_PARAM);
- link = removeParameter(link, Constants.PROJECT_LIST_PARAM+"="+Constants.FALSE_VALUE);
- link = removeParameter(link, Constants.PROJECT_LIST_PARAM+"="+Constants.TRUE_VALUE);
-
while (link.contains("//")) {
link = link.replace("//", "/");
}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3 (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-common/src/java/org/jboss/forge/common/ejb3)
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/LabsServices.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-common/src/java/org/jboss/forge/common/ejb3/LabsServices.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/LabsServices.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,60 +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.forge.common.ejb3;
-
-import javax.management.MalformedObjectNameException;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.jboss.forge.common.ejb3.PropertyService;
-import org.jboss.forge.common.ejb3.PrimatesService;
-import org.jboss.forge.common.ejb3.ProjectsService;
-import org.jboss.mx.util.MBeanProxyExt;
-import org.jboss.mx.util.MBeanServerLocator;
-
-/**
- * @author <a href="mailto:tomasz.szymanski at jboss.com">Tomasz Szymanski</a>
- * @author <a href="mailto:ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
- * @author <a href="mailto:adamw at aster.pl">Adam Warski</a>
- */
-
-public class LabsServices {
- public static PrimatesService getPrimatesService() throws MalformedObjectNameException {
- return (PrimatesService) MBeanProxyExt.create(PrimatesService.class,
- PrimatesService.PRIMATES_SERVICE, MBeanServerLocator.locate());
- }
-
- public static PropertyService getPropertyService() throws NamingException {
- return (PropertyService)(new InitialContext()).lookup(PropertyService.PROPERTY_SERVICE);
- }
-
- public static ProjectsService getProjectsService() throws MalformedObjectNameException {
- return (ProjectsService) MBeanProxyExt.create(ProjectsService.class,
- ProjectsService.PROJECTS_SERVICE, MBeanServerLocator.locate());
- }
-
- public static ProjectPagesService getProjectPagesService() throws NamingException {
- return (ProjectPagesService)(new InitialContext()).lookup(
- ProjectPagesService.PROJECT_PAGES_SERVICE);
- }
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/LabsServices.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-common/src/java/org/jboss/forge/common/ejb3/LabsServices.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/LabsServices.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/LabsServices.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,60 @@
+/*
+* 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.forge.common.ejb3;
+
+import javax.management.MalformedObjectNameException;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.forge.common.ejb3.PropertyService;
+import org.jboss.forge.common.ejb3.PrimatesService;
+import org.jboss.forge.common.ejb3.ProjectsService;
+import org.jboss.mx.util.MBeanProxyExt;
+import org.jboss.mx.util.MBeanServerLocator;
+
+/**
+ * @author <a href="mailto:tomasz.szymanski at jboss.com">Tomasz Szymanski</a>
+ * @author <a href="mailto:ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
+ * @author <a href="mailto:adamw at aster.pl">Adam Warski</a>
+ */
+
+public class LabsServices {
+ public static PrimatesService getPrimatesService() throws MalformedObjectNameException {
+ return (PrimatesService) MBeanProxyExt.create(PrimatesService.class,
+ PrimatesService.PRIMATES_SERVICE, MBeanServerLocator.locate());
+ }
+
+ public static PropertyService getPropertyService() throws NamingException {
+ return (PropertyService)(new InitialContext()).lookup(PropertyService.PROPERTY_SERVICE);
+ }
+
+ public static ProjectsService getProjectsService() throws MalformedObjectNameException {
+ return (ProjectsService) MBeanProxyExt.create(ProjectsService.class,
+ ProjectsService.PROJECTS_SERVICE, MBeanServerLocator.locate());
+ }
+
+ public static ProjectPagesService getProjectPagesService() throws NamingException {
+ return (ProjectPagesService)(new InitialContext()).lookup(
+ ProjectPagesService.PROJECT_PAGES_SERVICE);
+ }
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/PrimatesService.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-common/src/java/org/jboss/forge/common/ejb3/PrimatesService.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/PrimatesService.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,50 +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.forge.common.ejb3;
-
-import org.jboss.forge.common.primates.PrimateDTO;
-import org.jboss.portal.identity.User;
-
- /**
- * @author <a href="mailto:tomasz.szymanski at jboss.com">Tomasz Szymanski</a>
- */
-
-public interface PrimatesService {
-
- public static final String PRIMATES_SERVICE = "labs:service=primates";
-
- public PrimateDTO getPrimate(String name, String lastName, String portalName);
-
- public PrimateDTO getPrimate(String nickname, String portalName);
-
- public User getUser(String username);
-
- void create() throws Exception;
-
- void start() throws Exception;
-
- void stop();
-
- void destroy();
-
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/PrimatesService.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-common/src/java/org/jboss/forge/common/ejb3/PrimatesService.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/PrimatesService.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/PrimatesService.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,50 @@
+ /*
+ * 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.forge.common.ejb3;
+
+import org.jboss.forge.common.primates.PrimateDTO;
+import org.jboss.portal.identity.User;
+
+ /**
+ * @author <a href="mailto:tomasz.szymanski at jboss.com">Tomasz Szymanski</a>
+ */
+
+public interface PrimatesService {
+
+ public static final String PRIMATES_SERVICE = "labs:service=primates";
+
+ public PrimateDTO getPrimate(String name, String lastName, String portalName);
+
+ public PrimateDTO getPrimate(String nickname, String portalName);
+
+ public User getUser(String username);
+
+ void create() throws Exception;
+
+ void start() throws Exception;
+
+ void stop();
+
+ void destroy();
+
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/ProjectPagesService.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-common/src/java/org/jboss/forge/common/ejb3/ProjectPagesService.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/ProjectPagesService.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,30 +0,0 @@
-package org.jboss.forge.common.ejb3;
-
-import java.util.Set;
-
-/**
- * @author <a href="mailto:adamw at aster.pl">Adam Warski</a>
- */
-public interface ProjectPagesService {
- public static final String PROJECT_PAGES_SERVICE = "ProjectPagesServiceBean/local";
-
- /**
- * Updates pages and portlets for the given project.
- * @param projectId Project for which to update the pages.
- */
- public void updatePages(String projectId);
-
- /**
- * Removes pages belonging to projects, which are not in the given set.
- * @param projectIds Set of project ids, for which pages shouldn't be
- * deleted.
- */
- public void removeExcessPages(Set<String> projectIds);
-
- /**
- * DEBUG ONLY
- * TODO: remove
- * @return
- */
- public String getTree();
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/ProjectPagesService.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-common/src/java/org/jboss/forge/common/ejb3/ProjectPagesService.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/ProjectPagesService.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/ProjectPagesService.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,30 @@
+package org.jboss.forge.common.ejb3;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:adamw at aster.pl">Adam Warski</a>
+ */
+public interface ProjectPagesService {
+ public static final String PROJECT_PAGES_SERVICE = "ProjectPagesServiceBean/local";
+
+ /**
+ * Updates pages and portlets for the given project.
+ * @param projectId Project for which to update the pages.
+ */
+ public void updatePages(String projectId);
+
+ /**
+ * Removes pages belonging to projects, which are not in the given set.
+ * @param projectIds Set of project ids, for which pages shouldn't be
+ * deleted.
+ */
+ public void removeExcessPages(Set<String> projectIds);
+
+ /**
+ * DEBUG ONLY
+ * TODO: remove
+ * @return
+ */
+ public String getTree();
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/ProjectsService.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-common/src/java/org/jboss/forge/common/ejb3/ProjectsService.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/ProjectsService.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,125 +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.forge.common.ejb3;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.jboss.forge.common.projects.project.BuildResult;
-import org.jboss.forge.common.projects.project.Developers;
-import org.jboss.forge.common.projects.project.Documentation;
-import org.jboss.forge.common.projects.project.Downloads;
-import org.jboss.forge.common.projects.project.Forum;
-import org.jboss.forge.common.projects.project.IssueTracker;
-import org.jboss.forge.common.projects.project.Menu;
-import org.jboss.forge.common.projects.project.Polls;
-import org.jboss.forge.common.projects.project.Project;
-import org.jboss.forge.common.projects.project.RepoMonitor;
-import org.jboss.forge.common.projects.project.Repository;
-import org.jboss.forge.common.projects.project.SupportService;
-
-/**
- * @author <a href="mailto:ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
- * @author <a href="mailto:adamw at aster.pl">Adam Warski</a>
- */
-public interface ProjectsService {
-
- public static final String PROJECTS_SERVICE = "labs:service=projects";
-
- public Collection<Project> getProjects();
-
- public Collection<String> getProjectsIds();
-
- public Project getProjectByName (String projectId);
-
- public Polls getProjectPolls (String projectId);
-
- public Downloads getProjectDownloads (String projectId);
-
- public Menu getProjectMenu (String projectId);
-
- public Developers getProjectDevelopers (String projectId);
-
- public List<String> getProjectJems (String projectId);
-
- public List<Repository> getProjectRepositories (String projectId);
-
- public List<RepoMonitor> getProjectRepoMonitors (String projectId);
-
- public List<IssueTracker> getProjectIssueTrackers (String projectId);
-
- public List<BuildResult> getProjectBuildresults (String projectId);
-
- public List<SupportService> getProjectSupportServices (String projectId);
-
- public List<Forum> getProjectForums (String projectId);
-
- public List<Documentation> getProjectDocumentation (String projectId);
-
- public long getOverallDownloadsForProject(String projectId);
-
- public boolean getPackagedForDownload(String projectId);
-
- /**
- * This method will overwrite existing project definition in xml file
- * with a new one generated from data contained in given Project object.
- * Be aware, data is NOT merged but overwritten!
- */
- public void persistProject(Project project);
-
- /**
- * This method will overwrite existing project Polls definition in xml file
- * with a new one generated from data contained in given Polls object.
- * Be aware, data is NOT merged but overwritten!
- */
- public void persistPolls(Polls polls, String projectId);
-
- /**
- * This method will overwrite existing project Downloads definition in xml file
- * with a new one generated from data contained in given Downloads object.
- * Be aware, data is NOT merged but overwritten!
- */
- public void persistDownloads (Downloads downloads, String projectId);
-
- /**
- * This method will overwrite existing project Menu definition in xml file
- * with a new one generated from data contained in given Menu object.
- * Be aware, data is NOT merged but overwritten!
- */
- public void persistMenu (Menu menu, String projectId);
-
- /**
- * This method will overwrite existing project Developers definition
- * in xml file with a new one generated from data contained in given Developers object.
- * Be aware, data is NOT merged but overwritten!
- */
- public void persistDevelopers (Developers developers, String projectId);
-
-
- // Life cycle methods
-
- public void start () throws Exception;
-
- public void stop () throws Exception;
-
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/ProjectsService.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-common/src/java/org/jboss/forge/common/ejb3/ProjectsService.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/ProjectsService.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/ProjectsService.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,125 @@
+ /*
+ * 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.forge.common.ejb3;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.forge.common.projects.project.BuildResult;
+import org.jboss.forge.common.projects.project.Developers;
+import org.jboss.forge.common.projects.project.Documentation;
+import org.jboss.forge.common.projects.project.Downloads;
+import org.jboss.forge.common.projects.project.Forum;
+import org.jboss.forge.common.projects.project.IssueTracker;
+import org.jboss.forge.common.projects.project.Menu;
+import org.jboss.forge.common.projects.project.Polls;
+import org.jboss.forge.common.projects.project.Project;
+import org.jboss.forge.common.projects.project.RepoMonitor;
+import org.jboss.forge.common.projects.project.Repository;
+import org.jboss.forge.common.projects.project.SupportService;
+
+/**
+ * @author <a href="mailto:ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
+ * @author <a href="mailto:adamw at aster.pl">Adam Warski</a>
+ */
+public interface ProjectsService {
+
+ public static final String PROJECTS_SERVICE = "labs:service=projects";
+
+ public Collection<Project> getProjects();
+
+ public Collection<String> getProjectsIds();
+
+ public Project getProjectByName (String projectId);
+
+ public Polls getProjectPolls (String projectId);
+
+ public Downloads getProjectDownloads (String projectId);
+
+ public Menu getProjectMenu (String projectId);
+
+ public Developers getProjectDevelopers (String projectId);
+
+ public List<String> getProjectJems (String projectId);
+
+ public List<Repository> getProjectRepositories (String projectId);
+
+ public List<RepoMonitor> getProjectRepoMonitors (String projectId);
+
+ public List<IssueTracker> getProjectIssueTrackers (String projectId);
+
+ public List<BuildResult> getProjectBuildresults (String projectId);
+
+ public List<SupportService> getProjectSupportServices (String projectId);
+
+ public List<Forum> getProjectForums (String projectId);
+
+ public List<Documentation> getProjectDocumentation (String projectId);
+
+ public long getOverallDownloadsForProject(String projectId);
+
+ public boolean getPackagedForDownload(String projectId);
+
+ /**
+ * This method will overwrite existing project definition in xml file
+ * with a new one generated from data contained in given Project object.
+ * Be aware, data is NOT merged but overwritten!
+ */
+ public void persistProject(Project project);
+
+ /**
+ * This method will overwrite existing project Polls definition in xml file
+ * with a new one generated from data contained in given Polls object.
+ * Be aware, data is NOT merged but overwritten!
+ */
+ public void persistPolls(Polls polls, String projectId);
+
+ /**
+ * This method will overwrite existing project Downloads definition in xml file
+ * with a new one generated from data contained in given Downloads object.
+ * Be aware, data is NOT merged but overwritten!
+ */
+ public void persistDownloads (Downloads downloads, String projectId);
+
+ /**
+ * This method will overwrite existing project Menu definition in xml file
+ * with a new one generated from data contained in given Menu object.
+ * Be aware, data is NOT merged but overwritten!
+ */
+ public void persistMenu (Menu menu, String projectId);
+
+ /**
+ * This method will overwrite existing project Developers definition
+ * in xml file with a new one generated from data contained in given Developers object.
+ * Be aware, data is NOT merged but overwritten!
+ */
+ public void persistDevelopers (Developers developers, String projectId);
+
+
+ // Life cycle methods
+
+ public void start () throws Exception;
+
+ public void stop () throws Exception;
+
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/PropertyService.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-common/src/java/org/jboss/forge/common/ejb3/PropertyService.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/PropertyService.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,11 +0,0 @@
-package org.jboss.forge.common.ejb3;
-
-public interface PropertyService {
- public static final String PROPERTY_SERVICE = "PropertyServiceBean/local";
-
- public void setProperty(String id, String key, String value);
-
- public String getProperty(String id, String key);
-
- public void removeProperty(String id, String key);
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/PropertyService.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-common/src/java/org/jboss/forge/common/ejb3/PropertyService.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/PropertyService.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/PropertyService.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,11 @@
+package org.jboss.forge.common.ejb3;
+
+public interface PropertyService {
+ public static final String PROPERTY_SERVICE = "PropertyServiceBean/local";
+
+ public void setProperty(String id, String key, String value);
+
+ public String getProperty(String id, String key);
+
+ public void removeProperty(String id, String key);
+}
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/portlet/JBossLabsPortlet.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/portlet/JBossLabsPortlet.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/portlet/JBossLabsPortlet.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -25,32 +25,36 @@
import javax.portlet.PortletException;
import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletConfig;
+import javax.portlet.RenderRequest;
import org.jboss.portlet.JBossPortlet;
import org.jboss.portlet.JBossRenderRequest;
import org.jboss.portlet.JBossRenderResponse;
public abstract class JBossLabsPortlet extends JBossPortlet {
- private final static String errorMsg = "403 - not authorized<br />I'm sorry but you need to login to view this page.";
+ private final static String errorMsg =
+ "403 - not authorized<br />I'm sorry but you need to login to view this page.";
- protected abstract boolean isAllowed(JBossRenderRequest request, JBossRenderResponse response);
-
- protected abstract void labsDoView(JBossRenderRequest request, JBossRenderResponse response) throws PortletException, PortletSecurityException, IOException;
-
- @Override
- protected final void doView(JBossRenderRequest request, JBossRenderResponse response) throws PortletException, PortletSecurityException, IOException {
- if (isAllowed(request, response)) {
- labsDoView(request, response);
- }
- else {
- //show error message
- showErrorMessage(response);
- }
- }
-
- private void showErrorMessage(JBossRenderResponse response) throws IOException{
- response.setContentType("text/html");
- response.getWriter().write(errorMsg);
- }
+ protected abstract boolean isAllowed(JBossRenderRequest request,
+ JBossRenderResponse response);
+ protected abstract void labsDoView(JBossRenderRequest request,
+ JBossRenderResponse response)
+ throws PortletException, IOException;
+
+ @Override
+ protected final void doView(JBossRenderRequest request, JBossRenderResponse response)
+ throws PortletException, IOException {
+ if (isAllowed(request, response)) {
+ labsDoView(request, response);
+ } else {
+ showErrorMessage(response);
+ }
+ }
+
+ private void showErrorMessage(JBossRenderResponse response) throws IOException{
+ response.setContentType("text/html");
+ response.getWriter().write(errorMsg);
+ }
}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/primates (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-common/src/java/org/jboss/forge/common/primates)
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/primates/PrimateDTO.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-common/src/java/org/jboss/forge/common/primates/PrimateDTO.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/primates/PrimateDTO.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,130 +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.forge.common.primates;
-
-import java.util.HashSet;
-import java.util.Iterator;
-
-import java.util.Set;
-
-import org.jboss.portal.core.servlet.jsp.taglib.context.DelegateContext;
-
-/**
- * @author <a href="mailto:tomasz.szymanski at jboss.com">Tomasz Szymanski</a>
- * @author <a href="mailto:ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
- */
-
-public class PrimateDTO {
- private Set<String> logins=new HashSet<String>();
- private String name;
- private String title;
- private Set<String> projects=new HashSet<String>();
- private String mugshot;
- private String status;
- private String bio;
- private String country;
-
- public String getBio() {
- return bio;
- }
-
- public void setBio(String bio) {
- this.bio = bio;
- }
-
- public String getCountry() {
- return country;
- }
-
- public void setCountry(String country) {
- this.country = country;
- }
-
- public String getMugshot() {
- return mugshot;
- }
-
- public void setMugshot(String mugshot) {
- this.mugshot = mugshot;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Set<String> getProjects() {
- return projects;
- }
-
- public void setProjects(Set<String> projects) {
- this.projects = projects;
- }
-
-
- public Set<String> getLogins() {
- return logins;
- }
-
- public void setLogins(Set<String> logins) {
- this.logins = logins;
- }
-
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public PrimateDTO(DelegateContext primate) {
- bio = primate.get("bio");
- country = primate.get("country");
- mugshot = primate.get("mugshot");
- name = primate.get("name");
- Iterator it = primate.childIterator("projects");
- while (it!= null && it.hasNext()) {
- projects.add(((DelegateContext)it.next()).get("project"));
- }
- it = primate.childIterator("logins");
- while (it!= null && it.hasNext()) {
- logins.add(((DelegateContext)it.next()).get("login"));
- }
- status = primate.get("status");
- title = primate.get("title");
- }
-
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/primates/PrimateDTO.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-common/src/java/org/jboss/forge/common/primates/PrimateDTO.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/primates/PrimateDTO.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/primates/PrimateDTO.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,130 @@
+/*
+ * 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.forge.common.primates;
+
+import java.util.HashSet;
+import java.util.Iterator;
+
+import java.util.Set;
+
+import org.jboss.portal.core.servlet.jsp.taglib.context.DelegateContext;
+
+/**
+ * @author <a href="mailto:tomasz.szymanski at jboss.com">Tomasz Szymanski</a>
+ * @author <a href="mailto:ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
+ */
+
+public class PrimateDTO {
+ private Set<String> logins=new HashSet<String>();
+ private String name;
+ private String title;
+ private Set<String> projects=new HashSet<String>();
+ private String mugshot;
+ private String status;
+ private String bio;
+ private String country;
+
+ public String getBio() {
+ return bio;
+ }
+
+ public void setBio(String bio) {
+ this.bio = bio;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ public String getMugshot() {
+ return mugshot;
+ }
+
+ public void setMugshot(String mugshot) {
+ this.mugshot = mugshot;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Set<String> getProjects() {
+ return projects;
+ }
+
+ public void setProjects(Set<String> projects) {
+ this.projects = projects;
+ }
+
+
+ public Set<String> getLogins() {
+ return logins;
+ }
+
+ public void setLogins(Set<String> logins) {
+ this.logins = logins;
+ }
+
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public PrimateDTO(DelegateContext primate) {
+ bio = primate.get("bio");
+ country = primate.get("country");
+ mugshot = primate.get("mugshot");
+ name = primate.get("name");
+ Iterator it = primate.childIterator("projects");
+ while (it!= null && it.hasNext()) {
+ projects.add(((DelegateContext)it.next()).get("project"));
+ }
+ it = primate.childIterator("logins");
+ while (it!= null && it.hasNext()) {
+ logins.add(((DelegateContext)it.next()).get("login"));
+ }
+ status = primate.get("status");
+ title = primate.get("title");
+ }
+
+}
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersWatcher.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersWatcher.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersWatcher.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -26,9 +26,6 @@
import java.util.Set;
import java.util.Map;
-import org.jboss.forge.common.service.NodeWatcher;
-import org.jboss.forge.common.service.ResourceWatcher;
-import org.jboss.shotoku.ContentManager;
import org.jboss.shotoku.cache.ShotokuResourceWatcher;
import org.jboss.shotoku.cache.ChangeType;
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectDescriptor.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectDescriptor.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectDescriptor.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -24,15 +24,7 @@
import java.io.IOException;
import java.util.Set;
-import javax.xml.bind.JAXBContext;
-
-import javax.xml.bind.JAXBException;
-
-import javax.xml.bind.Unmarshaller;
-
import org.apache.xerces.parsers.DOMParser;
-import org.jboss.forge.common.ForgeHelper;
-import org.jboss.forge.common.navigation.Menu;
import org.jboss.forge.common.projects.XmlInputFactory.XmlNotFoundException;
import org.jboss.forge.common.projects.elements.BindingsHandlerIterSingleKey;
import org.jboss.forge.common.projects.elements.ExtendedPropertiesMap;
@@ -66,9 +58,6 @@
private ElementDescriptor thisProject;
- private Node menuNode;
- private Menu menu;
-
private Node repositoryNode;
private Repository repository;
@@ -181,12 +170,6 @@
if (issueTrackerNode != null) {
issueTracker = new IssueTracker(issueTrackerNode);
}
-
- // There should be a menu.
- if (menuNode != null) {
- menu = new Menu(portalName, menuNode, this);
- }
-
}
/**
@@ -247,9 +230,6 @@
}
public void processNode(ElementDescriptor thisElement, Node node) {
- if (Menu.MENU_ELEMENT.equals(node.getNodeName())) {
- setMenuNode(node);
- }
if (Repository.REPOSITORY_ELEMENT.equals(node.getNodeName())) {
setRepositoryNode(node);
}
@@ -270,20 +250,6 @@
return stack;
}
- private void setMenuNode(Node n) {
- menuNode = n;
- }
-
- /**
- * Gets a menu for this project.
- * @return An object representing this project's menu.
- */
- public Menu getMenu() {
- return menu;
- }
-
-
-
/*
private PropertiesHandler getFreezonePropertiesHandler() {
PropertiesHandlerStack ph = new PropertiesHandlerStack();
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Projects.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Projects.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Projects.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -25,7 +25,6 @@
import java.util.Map;
import java.util.Set;
-import org.jboss.forge.common.navigation.Menu;
import org.jboss.forge.common.projects.permissions.PermissionsChecker;
import org.jboss.portal.core.servlet.jsp.taglib.context.DelegateContext;
@@ -232,27 +231,6 @@
}
/**
- * Gets a menu for the given project.
- * @param pc
- * @param projectId
- * @return A menu for the given project or null, if such a project doesn't
- * exist/ isn't accessible with the given permissions.
- */
- public Menu getProjectMenu(PermissionsChecker pc, String projectId) {
- ProjectsDescriptor pds = getProjectsDescriptor();
- if (pds.permissionAllowed(pc, projectId)) {
- ProjectDescriptor pd = pds.getProjectDescriptor(projectId);
- if (pd != null) {
- return pd.getMenu();
- } else {
- return null;
- }
- } else {
- return null;
- }
- }
-
- /**
* Gets a link to the given level.
* @return A link to the given level.
*/
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -27,11 +27,14 @@
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
+import javax.naming.NamingException;
import org.apache.xerces.parsers.DOMParser;
import org.jboss.forge.common.ForgeHelper;
import org.jboss.forge.common.SearchTools;
import org.jboss.forge.common.XmlTools;
+import org.jboss.forge.common.ejb3.LabsServices;
+import org.jboss.forge.common.ejb3.ProjectPagesService;
import org.jboss.forge.common.projects.XmlInputFactory.XmlNotFoundException;
import org.jboss.forge.common.projects.elements.BindingsHandlerIterSingleKey;
import org.jboss.forge.common.projects.elements.ElementDescriptor;
@@ -151,8 +154,19 @@
fillContext(new NullPermissionsChecker());
fillLevels();
} catch (Exception e) {
- log.error("Projects descriptor constructor: " + e);
+ log.error("Projects descriptor constructor.", e);
}
+
+ try {
+ ProjectPagesService pps = LabsServices.getProjectPagesService();
+ for (String projectId : getProjectIds()) {
+ pps.updatePages(projectId);
+ }
+
+ pps.removeExcessPages(getProjectIds());
+ } catch (NamingException e) {
+ log.error("Error getting labs project pages service.", e);
+ }
}
private final static String PROJECT_EL = "project";
@@ -167,14 +181,10 @@
* handler.
*/
private final static Object[][] OUTSIDE_PROPERTIES = {
- { ProjectsHelper.SERVICES_DESC, "service", "services",
- getOPDefaultPropertiesHandler() },
{ ProjectsHelper.CATEGORIES_DESC, "category", "categories",
getOPDefaultPropertiesHandler() },
{ ProjectsHelper.JEMS_DESC, "jems", "jems",
- getOPDefaultPropertiesHandler() },
- /*{ ProjectsHelper.PAGES_DESC, "page", "pages",
- getPagesPropertiesHandler() }*/ };
+ getOPDefaultPropertiesHandler() }};
private static PropertiesHandler getOPDefaultPropertiesHandler() {
PropertiesHandlerStack phs = new PropertiesHandlerStack();
@@ -217,31 +227,6 @@
return phs;
}
- /*private static PropertiesHandler getPagesPropertiesHandler() {
- PropertiesHandlerStack phs = new PropertiesHandlerStack();
- phs.addHandler(new PropertiesHandlerDefault());
- phs.addHandler(new PropertiesHandler() {
- public void fillContext(PropertiesMap properties,
- DelegateContext context, PermissionsChecker pc) {
- if (properties.get("id").getFirstValue().equals("wiki")) {
- context.next("useForgeWiki");
- } else
- context.next("normalPage");
- }
-
- public void processNode(ElementDescriptor thisElement, Node node) {
-
- }
-
- public void collect(PropertiesMap properties, Object data,
- PermissionsChecker pc) {
-
- }
- });
-
- return phs;
- }*/
-
private void addOutsideProperty(XmlInputFactory isf,
DomToXmlTransformer xht, OutsidePropertiesMap opm, Object[] data)
throws SAXException, IOException, XmlNotFoundException {
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -27,12 +27,14 @@
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
+import javax.portlet.RenderRequest;
+import javax.portlet.PortletRequest;
import org.jboss.forge.common.Constants;
import org.jboss.forge.common.ForgeHelper;
import org.jboss.forge.common.projects.permissions.ActionRequestPermissionsChecker;
import org.jboss.forge.common.projects.permissions.RenderRequestPermissionsChecker;
-import org.jboss.forge.common.soa.projects.ProjectsService;
+import org.jboss.forge.common.ejb3.ProjectsService;
import org.jboss.logging.Logger;
import org.jboss.mx.util.MBeanProxyExt;
import org.jboss.mx.util.MBeanServerLocator;
@@ -90,7 +92,6 @@
protected final static String PAGES_DESC = "pages.xml";
protected final static String JEMS_DESC = "jems.xml";
protected final static String CATEGORIES_DESC = "categories.xml";
- protected final static String SERVICES_DESC = "services.xml";
protected final static String DOWNLOADS_DESC = "downloads.xml";
protected final static String DOWNLOADCOUNTER_DESC = "counter.xml";
protected final static String DOWNLOADCOUNTERMAIN_DESC = "counters.xml";
@@ -127,7 +128,11 @@
return projects;
}
- /**
+ private static String getSeletedProjectId(PortletRequest request) {
+ return request.getPreferences().getValue("projectId", "default");
+ }
+
+ /**
* Equivalent to <code>getSelectedProjectId(request, false)</code>.
* @param request
* A request object from which the selected project name will be
@@ -151,10 +156,9 @@
*/
public static String getSelectedProjectId(JBossRenderRequest request,
boolean withDefault) {
- Object projectIdObj = request.getAttribute(Constants.PROJECT_PARAM);
- String projectId = projectIdObj == null ? null : projectIdObj.toString();
+ String projectId = getSeletedProjectId(request);
- if ((withDefault) && ((projectId == null) || ("".equals(projectId)))) {
+ if ((projectId == null) && (withDefault)) {
projectId = DEFAULT_PROJECT;
} else if ((!withDefault) && (DEFAULT_PROJECT.equals(projectId))) {
projectId = null;
@@ -189,13 +193,13 @@
* is selected. False if null should be returned in such case.
* @return Selected project's id, or the default project's id/ null, depending
* on <code>withDefault</code>, if no project is selected.
+ * @deprecated
*/
public static String getSelectedProjectId(JBossActionRequest request,
boolean withDefault) {
- Object projectIdObj = request.getAttribute(Constants.PROJECT_PARAM);
- String projectId = projectIdObj == null ? null : projectIdObj.toString();
+ String projectId = getSeletedProjectId(request);
- if ((withDefault) && (projectId == null)) {
+ if ((projectId == null) && (withDefault)) {
projectId = DEFAULT_PROJECT;
} else if ((!withDefault) && (DEFAULT_PROJECT.equals(projectId))) {
projectId = null;
@@ -206,7 +210,7 @@
projectId = null;
}
- return projectId;
+ return projectId;
}
/**
@@ -217,11 +221,6 @@
* Request to prepare.
*/
public static void prepareRequest(JBossRenderRequest request) {
- ForgeHelper.prepareRequest(request);
- String projectId = getSelectedProjectId(request);
- request.setAttribute(PROJECT_ID, projectId);
- request.setAttribute(LEVEL_ID, getProjects(
- ForgeHelper.getPortalName(request)).getProjectLevel(projectId));
}
/**
Modified: labs/jbosslabs/trunk/portal-extensions/forge-contributor/src/java/org/jboss/forge/contributor/ConServer.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-contributor/src/java/org/jboss/forge/contributor/ConServer.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-contributor/src/java/org/jboss/forge/contributor/ConServer.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -37,8 +37,8 @@
import org.jboss.forge.common.ForgeHelper;
import org.jboss.forge.common.projects.ProjectsHelper;
import org.jboss.forge.common.projects.project.Developers;
-import org.jboss.forge.common.soa.LabsServices;
-import org.jboss.forge.common.soa.projects.ProjectsService;
+import org.jboss.forge.common.ejb3.LabsServices;
+import org.jboss.forge.common.ejb3.ProjectsService;
import org.jboss.portal.api.node.PortalNodeURL;
import org.jboss.portal.identity.User;
import org.jboss.shotoku.ContentManager;
@@ -111,8 +111,7 @@
}
synchronized void resetDesc(String portalName) {
- ForgeHelper.getForgeManagement().forceNodeUpdate(portalName,
- ConServer.class.getName());
+ conf.update(portalName, null, null);
}
private boolean checkString(String s) {
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3 (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3)
Property changes on: labs/jbosslabs/trunk/portal-extensions/forge-ejb3
___________________________________________________________________
Name: svn:ignore
+ target
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/forge-ejb3.iml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/forge-ejb3.iml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/forge-ejb3.iml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
- <component name="ModuleRootManager" />
- <component name="NewModuleRootManager" inherit-compiler-output="true">
- <exclude-output />
- <content url="file://$MODULE_DIR$">
- <sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src/java-portal" isTestSource="false" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module" module-name="forge-common" />
- <orderEntry type="module" module-name="shotoku-aop" />
- <orderEntry type="module" module-name="shotoku-base" />
- <orderEntry type="library" name="jboss" level="application" />
- <orderEntry type="library" name="portal" level="application" />
- <orderEntry type="library" name="portlet" level="application" />
- <orderEntry type="library" name="myfaces" level="application" />
- <orderEntryProperties />
- </component>
-</module>
-
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/forge-ejb3.iml (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/forge-ejb3.iml)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/forge-ejb3.iml (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/forge-ejb3.iml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module version="4" relativePaths="true" type="JAVA_MODULE">
+ <component name="ModuleRootManager" />
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/java-portal" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="forge-common" />
+ <orderEntry type="module" module-name="shotoku-aop" />
+ <orderEntry type="module" module-name="shotoku-base" />
+ <orderEntry type="library" name="jboss" level="application" />
+ <orderEntry type="library" name="portal" level="application" />
+ <orderEntry type="library" name="portlet" level="application" />
+ <orderEntry type="library" name="myfaces" level="application" />
+ <orderEntryProperties />
+ </component>
+</module>
+
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/maven.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/maven.xml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/maven.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,25 +0,0 @@
-<!--
- JBoss, the OpenSource J2EE webOS
- Distributable under LGPL license.
- See terms of license at gnu.org.
- -->
-<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:u="jelly:util">
- <!-- Default war-project goals -->
-
- <goal name="all">
- <attainGoal name="prj-all" />
- </goal>
-
- <goal name="build">
- <attainGoal name="ejb" />
- </goal>
-
- <goal name="deploy">
- <ant:copy file="target/${maven.final.name}.jar"
- tofile="${local.deploy.dir}/${maven.final.name}.ejb3" />
- </goal>
-
- <goal name="clean">
- <attainGoal name="prj-clean" />
- </goal>
-</project>
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/maven.xml (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/maven.xml)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/maven.xml (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/maven.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,25 @@
+<!--
+ JBoss, the OpenSource J2EE webOS
+ Distributable under LGPL license.
+ See terms of license at gnu.org.
+ -->
+<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:u="jelly:util">
+ <!-- Default war-project goals -->
+
+ <goal name="all">
+ <attainGoal name="prj-all" />
+ </goal>
+
+ <goal name="build">
+ <attainGoal name="ejb" />
+ </goal>
+
+ <goal name="deploy">
+ <ant:copy file="target/${maven.final.name}.jar"
+ tofile="${local.deploy.dir}/${maven.final.name}.ejb3" />
+ </goal>
+
+ <goal name="clean">
+ <attainGoal name="prj-clean" />
+ </goal>
+</project>
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/project.properties
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/project.properties 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/project.properties 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,5 +0,0 @@
-maven.repo.remote=http://repo1.maven.org/maven
-maven.junit.fork=yes
-maven.war.src=${basedir}/src/web
-
-maven.final.name=${pom.artifactId}
\ No newline at end of file
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/project.properties (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/project.properties)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/project.properties (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/project.properties 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,5 @@
+maven.repo.remote=http://repo1.maven.org/maven
+maven.junit.fork=yes
+maven.war.src=${basedir}/src/web
+
+maven.final.name=${pom.artifactId}
\ No newline at end of file
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/project.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/project.xml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/project.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,86 +0,0 @@
-<?xml version='1.0' encoding='ISO-8859-1'?>
-<!--
- JBoss, the OpenSource J2EE webOS
- Distributable under LGPL license.
- See terms of license at gnu.org.
- -->
-<project>
- <pomVersion>3</pomVersion>
- <extend>../common.xml</extend>
- <id>forge-ejb3</id>
- <name>Various forge ejb3 components</name>
- <currentVersion>1.0</currentVersion>
- <organization>
- <name>Adam Warski</name>
- <url>http://mamut.net.pl</url>
- </organization>
- <description></description>
-
- <dependencies>
- <dependency>
- <groupId>jboss-forge</groupId>
- <artifactId>forge-common</artifactId>
- <version>1.0</version>
- </dependency>
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>ejb3-persistence</artifactId>
- <jar>ejb3-persistence.jar</jar>
- </dependency>
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-ejb3x</artifactId>
- <jar>jboss-ejb3x.jar</jar>
- </dependency>
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-j2ee</artifactId>
- <jar>jboss-j2ee.jar</jar>
- </dependency>
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-annotations-ejb3</artifactId>
- <jar>jboss-annotations-ejb3.jar</jar>
- </dependency>
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>portal-security-lib</artifactId>
- <jar>portal-security-lib.jar</jar>
- </dependency>
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>portal-theme-lib</artifactId>
- <jar>portal-theme-lib.jar</jar>
- </dependency>
- <dependency>
- <groupId>jaxb</groupId>
- <artifactId>JAXB2</artifactId>
- <version>2.0</version>
- <jar>jaxb-api.jar</jar>
- </dependency>
- <dependency>
- <groupId>jaxb</groupId>
- <artifactId>JAXB2173API</artifactId>
- <version>1.0</version>
- <jar>jsr173_1.0_api.jar</jar>
- </dependency>
- <dependency>
- <groupId>jaxb</groupId>
- <artifactId>Activation</artifactId>
- <version>1.0</version>
- <jar>activation.jar</jar>
- </dependency>
- <dependency>
- <groupId>jaxb</groupId>
- <artifactId>JAXBIMPL</artifactId>
- <version>2.0</version>
- <jar>jaxb-impl.jar</jar>
- </dependency>
- <dependency>
- <groupId>jaxb</groupId>
- <artifactId>XJC</artifactId>
- <version>2.0</version>
- <jar>jaxb-xjc.jar</jar>
- </dependency>
- </dependencies>
-</project>
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/project.xml (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/project.xml)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/project.xml (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/project.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,86 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+<!--
+ JBoss, the OpenSource J2EE webOS
+ Distributable under LGPL license.
+ See terms of license at gnu.org.
+ -->
+<project>
+ <pomVersion>3</pomVersion>
+ <extend>../common.xml</extend>
+ <id>forge-ejb3</id>
+ <name>Various forge ejb3 components</name>
+ <currentVersion>1.0</currentVersion>
+ <organization>
+ <name>Adam Warski</name>
+ <url>http://mamut.net.pl</url>
+ </organization>
+ <description></description>
+
+ <dependencies>
+ <dependency>
+ <groupId>jboss-forge</groupId>
+ <artifactId>forge-common</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>ejb3-persistence</artifactId>
+ <jar>ejb3-persistence.jar</jar>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3x</artifactId>
+ <jar>jboss-ejb3x.jar</jar>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-j2ee</artifactId>
+ <jar>jboss-j2ee.jar</jar>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-annotations-ejb3</artifactId>
+ <jar>jboss-annotations-ejb3.jar</jar>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>portal-security-lib</artifactId>
+ <jar>portal-security-lib.jar</jar>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>portal-theme-lib</artifactId>
+ <jar>portal-theme-lib.jar</jar>
+ </dependency>
+ <dependency>
+ <groupId>jaxb</groupId>
+ <artifactId>JAXB2</artifactId>
+ <version>2.0</version>
+ <jar>jaxb-api.jar</jar>
+ </dependency>
+ <dependency>
+ <groupId>jaxb</groupId>
+ <artifactId>JAXB2173API</artifactId>
+ <version>1.0</version>
+ <jar>jsr173_1.0_api.jar</jar>
+ </dependency>
+ <dependency>
+ <groupId>jaxb</groupId>
+ <artifactId>Activation</artifactId>
+ <version>1.0</version>
+ <jar>activation.jar</jar>
+ </dependency>
+ <dependency>
+ <groupId>jaxb</groupId>
+ <artifactId>JAXBIMPL</artifactId>
+ <version>2.0</version>
+ <jar>jaxb-impl.jar</jar>
+ </dependency>
+ <dependency>
+ <groupId>jaxb</groupId>
+ <artifactId>XJC</artifactId>
+ <version>2.0</version>
+ <jar>jaxb-xjc.jar</jar>
+ </dependency>
+ </dependencies>
+</project>
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src)
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/ejb (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/ejb)
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/ejb/META-INF (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/ejb/META-INF)
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/ejb/META-INF/persistence.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/ejb/META-INF/persistence.xml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/ejb/META-INF/persistence.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<persistence>
- <persistence-unit name="property_persistance">
- <jta-data-source>java:/LabsDS</jta-data-source>
- <properties>
- <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
- <property name="hibernate.hbm2ddl.auto" value="update" />
- </properties>
- </persistence-unit>
-</persistence>
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/ejb/META-INF/persistence.xml (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/ejb/META-INF/persistence.xml)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/ejb/META-INF/persistence.xml (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/ejb/META-INF/persistence.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence>
+ <persistence-unit name="property_persistance">
+ <jta-data-source>java:/LabsDS</jta-data-source>
+ <properties>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
+ <property name="hibernate.hbm2ddl.auto" value="update" />
+ </properties>
+ </persistence-unit>
+</persistence>
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java)
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java/org)
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java/org/jboss)
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java/org/jboss/forge)
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3 (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java/org/jboss/forge/ejb3)
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages)
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/ProjectPagesPortletsWatcher.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/ProjectPagesPortletsWatcher.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/ProjectPagesPortletsWatcher.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,18 +0,0 @@
-package org.jboss.forge.ejb3.projectpages;
-
-import org.jboss.shotoku.cache.ShotokuPropertiesWatcher;
-
-import java.util.Properties;
-
-/**
- * @author <a href="mailto:adamw at aster.pl">Adam Warski</a>
- */
-public class ProjectPagesPortletsWatcher extends ShotokuPropertiesWatcher<String> {
- protected String getConfigFileName() {
- return "configuration/portlets.properties";
- }
-
- public Properties getProperties() {
- return get("");
- }
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/ProjectPagesPortletsWatcher.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/ProjectPagesPortletsWatcher.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/ProjectPagesPortletsWatcher.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/ProjectPagesPortletsWatcher.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,18 @@
+package org.jboss.forge.ejb3.projectpages;
+
+import org.jboss.shotoku.cache.ShotokuPropertiesWatcher;
+
+import java.util.Properties;
+
+/**
+ * @author <a href="mailto:adamw at aster.pl">Adam Warski</a>
+ */
+public class ProjectPagesPortletsWatcher extends ShotokuPropertiesWatcher<String> {
+ protected String getConfigFileName() {
+ return "configuration/portlets.properties";
+ }
+
+ public Properties getProperties() {
+ return get("");
+ }
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/ProjectPagesServiceBean.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/ProjectPagesServiceBean.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/ProjectPagesServiceBean.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,350 +0,0 @@
-package org.jboss.forge.ejb3.projectpages;
-
-import org.jboss.forge.common.ejb3.ProjectPagesService;
-import org.jboss.forge.common.Constants;
-import org.jboss.portal.core.model.portal.*;
-import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.core.model.instance.DuplicateInstanceException;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.security.spi.provider.DomainConfigurator;
-import org.jboss.portal.security.RoleSecurityBinding;
-import org.jboss.portal.security.SecurityConstants;
-import org.jboss.portal.security.AuthorizationDomainRegistry;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.state.PropertyChange;
-import org.jboss.portal.common.value.StringValue;
-import org.jboss.portal.theme.ThemeConstants;
-import org.jboss.annotation.ejb.Depends;
-
-import javax.ejb.Stateless;
-import javax.ejb.TransactionAttribute;
-import javax.ejb.TransactionAttributeType;
-import javax.ejb.Local;
-import java.util.Set;
-import java.util.Collections;
-
-/**
- * @author <a href="mailto:adamw at aster.pl">Adam Warski</a>
- */
- at Stateless
- at Local(ProjectPagesService.class)
- at TransactionAttribute(TransactionAttributeType.REQUIRED)
-public class ProjectPagesServiceBean implements ProjectPagesService {
- @Depends("portal:container=PortalObject")
- private PortalObjectContainer poc;
-
- @Depends("portal:container=Instance")
- private InstanceContainer pic;
-
- @Depends("portal:service=AuthorizationDomainRegistry")
- private AuthorizationDomainRegistry adr;
-
- private ProjectPagesPortletsWatcher pppw;
-
- public ProjectPagesServiceBean() {
- pppw = new ProjectPagesPortletsWatcher();
- }
-
- /*
- * Exceptions.
- */
-
- private class UnknownPortletException extends Exception {
- public UnknownPortletException(String message) {
- super(message);
- }
- }
-
- private class UnknownPortalException extends Exception {
- public UnknownPortalException(Throwable cause) {
- super(cause);
- }
- }
-
- /*
- * Utility functions.
- */
-
- /**
- * Creates a camel-case concatenation of the given words.
- * Null words are ommited.
- * @param words Words to concatenate.
- * @return A camel-case concatenation of the given words.
- */
- private String createCamelCase(String... words) {
- StringBuilder result = new StringBuilder("");
- for (String word : words) {
- if (word == null) { continue; }
- if (word.length() == 1) {
- result.append(word.toUpperCase());
- continue;
- }
-
- result.append(word.substring(0, 1).toUpperCase()).append(
- word.substring(1).toLowerCase());
- }
-
- return result.toString();
- }
-
- /*
- * DEBUG
- */
-
- private String printObject(PortalObject po, String indent) {
- String result = "";
- for (Object o : po.getChildren()) {
- PortalObject child = (PortalObject) o;
- result += (indent
- + child.getId().toString(PortalObjectId.CANONICAL_FORMAT)) + "\n<br />";
- result += printObject(child, indent + " ");
- }
-
- return result;
- }
-
- private String printInstanceDefinitions() {
- String result = "";
- for (Object o : pic.getDefinitions()) {
- Instance instDef = (Instance) o;
- try {
- result += (instDef.getId() + " | " + instDef.getPortlet().getContext().getId()) +
- "\n<br />";
- } catch (PortletInvokerException e) {
- e.printStackTrace();
- }
- }
-
- return result;
- }
-
- private String printPortlets() {
- String result = "";
- try {
- for (Object o : pic.getPortletInvoker().getPortlets()) {
- Portlet p = (Portlet) o;
- result += (p.getContext().getId()) + "\n<br />";
- }
- } catch (PortletInvokerException e) {
- e.printStackTrace();
- }
-
- return result;
- }
-
- public String getTree() {
- String result = "<br />";
- result += printObject(poc.getRootObject(), "");
- result += "<br /><hr /><br />";
- result += printInstanceDefinitions();
- result += "<br /><hr /><br />";
- result += printPortlets();
-
- return result;
- }
-
- /*
- * ****************************************
- * ****************************************
- * ****************************************
- */
-
- /**
- * @return Labs portal.
- */
- private Portal getLabsPortal() {
- PortalObjectId id = PortalObjectId.parse("/" + Constants.LABS_PORTAL,
- PortalObjectId.CANONICAL_FORMAT);
- return (Portal) poc.getObject(id);
- }
-
- /**
- * To the specified portal object, binds permissions, which allow unlogged
- * users to view the object.
- * @param po Portal object, to which permissions should be bound.
- */
- private void setSecurityBindings(PortalObject po) {
- DomainConfigurator configurator = adr.getDomain("portalobject").getConfigurator();
- Set constraints = Collections.singleton(
- new RoleSecurityBinding(PortalObjectPermission.VIEW_RECURSIVE_ACTION,
- SecurityConstants.UNCHECKED_ROLE_NAME));
- configurator.setSecurityBindings(po.getId().toString(PortalObjectId.CANONICAL_FORMAT), constraints);
- }
-
- /**
- * To the specified portlet instance, binds permissions, which allow unlogged
- * users to view the isntance.
- * @param instance Instance, to which permissions should be bound.
- */
- private void setSecurityBindings(Instance instance) {
- DomainConfigurator configurator = adr.getDomain("instance").getConfigurator();
- Set constraints = Collections.singleton(
- new RoleSecurityBinding(PortalObjectPermission.VIEW_ACTION,
- SecurityConstants.UNCHECKED_ROLE_NAME));
- configurator.setSecurityBindings(instance.getId(), constraints);
- }
-
- /**
- * Marks the given portal object as belonging to Labs-handeled objects.
- * @param po Portal object to mark.
- * @param projectId Project id, to which this object belongs.
- */
- private void markAsLabsObject(PortalObject po, String projectId) {
- po.setDeclaredProperty("labs", projectId);
- }
-
- /**
- * Set a preference in the given instance.
- * @param instance Instance in which to set the preference.
- * @param name Name on the preference.
- * @param value Value of the preference.
- * @throws PortletInvokerException In case of a protal exception.
- */
- private void setInstancePreference(Instance instance, String name,
- String value) throws PortletInvokerException {
- instance.setProperties(new PropertyChange[] {
- PropertyChange.newUpdate(name, new StringValue(value)) });
- }
-
- /**
- * Marks the given instance as belonging to Labs-handeled objects.
- * @param instance Instance to mark.
- * @param projectId Project id, to which this instance belongs.
- * @throws PortletInvokerException In case of a portal exception.
- */
- private void markAsLabsObject(Instance instance, String projectId)
- throws PortletInvokerException {
- setInstancePreference(instance, "labs", projectId);
- }
-
- /**
- * Gets a page, with the given name, for the gien project. If such a page
- * does not yet exists, it is created, marked as belonging to this project
- * and necessary security bindings are created.
- * @param projectId Project to which the page should belong.
- * @param pageName Name of the page.
- * @return A specified page for this project.
- */
- private Page getProjectPage(String projectId, String pageName) {
- Portal labsPortal = getLabsPortal();
-
- // Checking if the page already exists.
- Page page = labsPortal.getPage(projectId);
- if (page != null) {
- return page;
- }
-
- try {
- // Trying to create a new page.
- page = labsPortal.createPage(projectId);
-
- // Marking this page as belonging to this project.
- markAsLabsObject(page, projectId);
-
- // Allowing users to view the page.
- setSecurityBindings(page);
-
- return page;
- } catch (DuplicatePortalObjectException e) {
- throw new RuntimeException("WEIRD 1");
- }
- }
-
- private Instance getProjectPortletInstance(String projectId, String pageName,
- String portletName)
- throws UnknownPortletException, UnknownPortalException {
- // Determining the portlet id.
- String portletId = pppw.getProperties().getProperty(portletName);
- if (portletId == null) {
- throw new UnknownPortletException(portletName);
- }
-
- // Constructing the instance id.
- String instanceId = createCamelCase(portletName, projectId, pageName, "instance");
-
- // Checking if the instance already exists.
- Instance instance = pic.getDefinition(instanceId);
- if (instance != null) {
- return instance;
- }
-
- try {
- // Creating the instance.
- instance = pic.createDefinition(instanceId, portletId);
-
- // Creating necessary security bindings.
- setSecurityBindings(instance);
-
- // Marking this instance as belonging to this project.
- markAsLabsObject(instance, projectId);
-
- // Setting preferences for the new instance.
- setInstancePreference(instance, "projectId", projectId);
-
- return instance;
- } catch (DuplicateInstanceException e) {
- throw new RuntimeException("WEIRD 2");
- } catch (PortletInvokerException e) {
- throw new UnknownPortalException(e);
- }
- }
-
- private void addInstanceToPage(String projectId, String pageName, String portletName,
- Page page, Instance instance,
- String region, int order) {
- String windowId = createCamelCase(portletName, projectId, pageName, "window");
-
- Window window = page.getWindow(windowId);
- if (window != null) {
- // The window exists, nothing to do.
- return;
- }
-
- try {
- window = page.createWindow(windowId);
-
- window.setInstanceRef(instance.getId());
-
- // Placing the window on the page, as required.
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION, region);
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, Integer.toString(order));
-
- // Creating necessary security bindings.
- //setSecurityBindings(window);
-
- // Marking this window as belonging to this project.
- markAsLabsObject(window, projectId);
- } catch (DuplicatePortalObjectException e) {
- throw new RuntimeException("WEIRD 3");
- }
- }
-
- private void updateProjectPage(String projectId, String pageName) {
- Page page = getProjectPage(projectId, pageName);
-
- try {
- Instance freezone = getProjectPortletInstance(projectId, null, "freezone");
- Instance downloads = getProjectPortletInstance(projectId, null, "downloads");
- Instance info = getProjectPortletInstance(projectId, null, "info");
-
- addInstanceToPage(projectId, pageName, "freezoneNavigation", page,
- pic.getDefinition("FreezoneNavigationInstance"), "left", 0);
- addInstanceToPage(projectId, pageName, "freezone", page, freezone, "center", 0);
- addInstanceToPage(projectId, pageName, "downloads", page, downloads, "center", 1);
- addInstanceToPage(projectId, pageName, "info", page, info, "center", 2);
- } catch (UnknownPortletException e) {
- e.printStackTrace();
- } catch (UnknownPortalException e) {
- e.printStackTrace();
- }
-
- }
-
- public void updatePages(String projectId) {
- updateProjectPage(projectId, null);
- }
-
- public void removeExcessPages(Set<String> projectIds) {
- }
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/ProjectPagesServiceBean.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/ProjectPagesServiceBean.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/ProjectPagesServiceBean.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projectpages/ProjectPagesServiceBean.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,350 @@
+package org.jboss.forge.ejb3.projectpages;
+
+import org.jboss.forge.common.ejb3.ProjectPagesService;
+import org.jboss.forge.common.Constants;
+import org.jboss.portal.core.model.portal.*;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.core.model.instance.DuplicateInstanceException;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.security.spi.provider.DomainConfigurator;
+import org.jboss.portal.security.RoleSecurityBinding;
+import org.jboss.portal.security.SecurityConstants;
+import org.jboss.portal.security.AuthorizationDomainRegistry;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.state.PropertyChange;
+import org.jboss.portal.common.value.StringValue;
+import org.jboss.portal.theme.ThemeConstants;
+import org.jboss.annotation.ejb.Depends;
+
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.ejb.Local;
+import java.util.Set;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:adamw at aster.pl">Adam Warski</a>
+ */
+ at Stateless
+ at Local(ProjectPagesService.class)
+ at TransactionAttribute(TransactionAttributeType.REQUIRED)
+public class ProjectPagesServiceBean implements ProjectPagesService {
+ @Depends("portal:container=PortalObject")
+ private PortalObjectContainer poc;
+
+ @Depends("portal:container=Instance")
+ private InstanceContainer pic;
+
+ @Depends("portal:service=AuthorizationDomainRegistry")
+ private AuthorizationDomainRegistry adr;
+
+ private ProjectPagesPortletsWatcher pppw;
+
+ public ProjectPagesServiceBean() {
+ pppw = new ProjectPagesPortletsWatcher();
+ }
+
+ /*
+ * Exceptions.
+ */
+
+ private class UnknownPortletException extends Exception {
+ public UnknownPortletException(String message) {
+ super(message);
+ }
+ }
+
+ private class UnknownPortalException extends Exception {
+ public UnknownPortalException(Throwable cause) {
+ super(cause);
+ }
+ }
+
+ /*
+ * Utility functions.
+ */
+
+ /**
+ * Creates a camel-case concatenation of the given words.
+ * Null words are ommited.
+ * @param words Words to concatenate.
+ * @return A camel-case concatenation of the given words.
+ */
+ private String createCamelCase(String... words) {
+ StringBuilder result = new StringBuilder("");
+ for (String word : words) {
+ if (word == null) { continue; }
+ if (word.length() == 1) {
+ result.append(word.toUpperCase());
+ continue;
+ }
+
+ result.append(word.substring(0, 1).toUpperCase()).append(
+ word.substring(1).toLowerCase());
+ }
+
+ return result.toString();
+ }
+
+ /*
+ * DEBUG
+ */
+
+ private String printObject(PortalObject po, String indent) {
+ String result = "";
+ for (Object o : po.getChildren()) {
+ PortalObject child = (PortalObject) o;
+ result += (indent
+ + child.getId().toString(PortalObjectId.CANONICAL_FORMAT)) + "\n<br />";
+ result += printObject(child, indent + " ");
+ }
+
+ return result;
+ }
+
+ private String printInstanceDefinitions() {
+ String result = "";
+ for (Object o : pic.getDefinitions()) {
+ Instance instDef = (Instance) o;
+ try {
+ result += (instDef.getId() + " | " + instDef.getPortlet().getContext().getId()) +
+ "\n<br />";
+ } catch (PortletInvokerException e) {
+ e.printStackTrace();
+ }
+ }
+
+ return result;
+ }
+
+ private String printPortlets() {
+ String result = "";
+ try {
+ for (Object o : pic.getPortletInvoker().getPortlets()) {
+ Portlet p = (Portlet) o;
+ result += (p.getContext().getId()) + "\n<br />";
+ }
+ } catch (PortletInvokerException e) {
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+ public String getTree() {
+ String result = "<br />";
+ result += printObject(poc.getRootObject(), "");
+ result += "<br /><hr /><br />";
+ result += printInstanceDefinitions();
+ result += "<br /><hr /><br />";
+ result += printPortlets();
+
+ return result;
+ }
+
+ /*
+ * ****************************************
+ * ****************************************
+ * ****************************************
+ */
+
+ /**
+ * @return Labs portal.
+ */
+ private Portal getLabsPortal() {
+ PortalObjectId id = PortalObjectId.parse("/" + Constants.LABS_PORTAL,
+ PortalObjectId.CANONICAL_FORMAT);
+ return (Portal) poc.getObject(id);
+ }
+
+ /**
+ * To the specified portal object, binds permissions, which allow unlogged
+ * users to view the object.
+ * @param po Portal object, to which permissions should be bound.
+ */
+ private void setSecurityBindings(PortalObject po) {
+ DomainConfigurator configurator = adr.getDomain("portalobject").getConfigurator();
+ Set constraints = Collections.singleton(
+ new RoleSecurityBinding(PortalObjectPermission.VIEW_RECURSIVE_ACTION,
+ SecurityConstants.UNCHECKED_ROLE_NAME));
+ configurator.setSecurityBindings(po.getId().toString(PortalObjectId.CANONICAL_FORMAT), constraints);
+ }
+
+ /**
+ * To the specified portlet instance, binds permissions, which allow unlogged
+ * users to view the isntance.
+ * @param instance Instance, to which permissions should be bound.
+ */
+ private void setSecurityBindings(Instance instance) {
+ DomainConfigurator configurator = adr.getDomain("instance").getConfigurator();
+ Set constraints = Collections.singleton(
+ new RoleSecurityBinding(PortalObjectPermission.VIEW_ACTION,
+ SecurityConstants.UNCHECKED_ROLE_NAME));
+ configurator.setSecurityBindings(instance.getId(), constraints);
+ }
+
+ /**
+ * Marks the given portal object as belonging to Labs-handeled objects.
+ * @param po Portal object to mark.
+ * @param projectId Project id, to which this object belongs.
+ */
+ private void markAsLabsObject(PortalObject po, String projectId) {
+ po.setDeclaredProperty("labs", projectId);
+ }
+
+ /**
+ * Set a preference in the given instance.
+ * @param instance Instance in which to set the preference.
+ * @param name Name on the preference.
+ * @param value Value of the preference.
+ * @throws PortletInvokerException In case of a protal exception.
+ */
+ private void setInstancePreference(Instance instance, String name,
+ String value) throws PortletInvokerException {
+ instance.setProperties(new PropertyChange[] {
+ PropertyChange.newUpdate(name, new StringValue(value)) });
+ }
+
+ /**
+ * Marks the given instance as belonging to Labs-handeled objects.
+ * @param instance Instance to mark.
+ * @param projectId Project id, to which this instance belongs.
+ * @throws PortletInvokerException In case of a portal exception.
+ */
+ private void markAsLabsObject(Instance instance, String projectId)
+ throws PortletInvokerException {
+ setInstancePreference(instance, "labs", projectId);
+ }
+
+ /**
+ * Gets a page, with the given name, for the gien project. If such a page
+ * does not yet exists, it is created, marked as belonging to this project
+ * and necessary security bindings are created.
+ * @param projectId Project to which the page should belong.
+ * @param pageName Name of the page.
+ * @return A specified page for this project.
+ */
+ private Page getProjectPage(String projectId, String pageName) {
+ Portal labsPortal = getLabsPortal();
+
+ // Checking if the page already exists.
+ Page page = labsPortal.getPage(projectId);
+ if (page != null) {
+ return page;
+ }
+
+ try {
+ // Trying to create a new page.
+ page = labsPortal.createPage(projectId);
+
+ // Marking this page as belonging to this project.
+ markAsLabsObject(page, projectId);
+
+ // Allowing users to view the page.
+ setSecurityBindings(page);
+
+ return page;
+ } catch (DuplicatePortalObjectException e) {
+ throw new RuntimeException("WEIRD 1");
+ }
+ }
+
+ private Instance getProjectPortletInstance(String projectId, String pageName,
+ String portletName)
+ throws UnknownPortletException, UnknownPortalException {
+ // Determining the portlet id.
+ String portletId = pppw.getProperties().getProperty(portletName);
+ if (portletId == null) {
+ throw new UnknownPortletException(portletName);
+ }
+
+ // Constructing the instance id.
+ String instanceId = createCamelCase(portletName, projectId, pageName, "instance");
+
+ // Checking if the instance already exists.
+ Instance instance = pic.getDefinition(instanceId);
+ if (instance != null) {
+ return instance;
+ }
+
+ try {
+ // Creating the instance.
+ instance = pic.createDefinition(instanceId, portletId);
+
+ // Creating necessary security bindings.
+ setSecurityBindings(instance);
+
+ // Marking this instance as belonging to this project.
+ markAsLabsObject(instance, projectId);
+
+ // Setting preferences for the new instance.
+ setInstancePreference(instance, "projectId", projectId);
+
+ return instance;
+ } catch (DuplicateInstanceException e) {
+ throw new RuntimeException("WEIRD 2");
+ } catch (PortletInvokerException e) {
+ throw new UnknownPortalException(e);
+ }
+ }
+
+ private void addInstanceToPage(String projectId, String pageName, String portletName,
+ Page page, Instance instance,
+ String region, int order) {
+ String windowId = createCamelCase(portletName, projectId, pageName, "window");
+
+ Window window = page.getWindow(windowId);
+ if (window != null) {
+ // The window exists, nothing to do.
+ return;
+ }
+
+ try {
+ window = page.createWindow(windowId);
+
+ window.setInstanceRef(instance.getId());
+
+ // Placing the window on the page, as required.
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION, region);
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, Integer.toString(order));
+
+ // Creating necessary security bindings.
+ //setSecurityBindings(window);
+
+ // Marking this window as belonging to this project.
+ markAsLabsObject(window, projectId);
+ } catch (DuplicatePortalObjectException e) {
+ throw new RuntimeException("WEIRD 3");
+ }
+ }
+
+ private void updateProjectPage(String projectId, String pageName) {
+ Page page = getProjectPage(projectId, pageName);
+
+ try {
+ Instance freezone = getProjectPortletInstance(projectId, null, "freezone");
+ Instance downloads = getProjectPortletInstance(projectId, null, "downloads");
+ Instance info = getProjectPortletInstance(projectId, null, "info");
+
+ addInstanceToPage(projectId, pageName, "freezoneNavigation", page,
+ pic.getDefinition("FreezoneNavigationInstance"), "left", 0);
+ addInstanceToPage(projectId, pageName, "freezone", page, freezone, "center", 0);
+ addInstanceToPage(projectId, pageName, "downloads", page, downloads, "center", 1);
+ addInstanceToPage(projectId, pageName, "info", page, info, "center", 2);
+ } catch (UnknownPortletException e) {
+ e.printStackTrace();
+ } catch (UnknownPortalException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ public void updatePages(String projectId) {
+ updateProjectPage(projectId, null);
+ }
+
+ public void removeExcessPages(Set<String> projectIds) {
+ }
+}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projects (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java/org/jboss/forge/ejb3/projects)
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projects/ProjectsServiceImpl.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java/org/jboss/forge/ejb3/projects/ProjectsServiceImpl.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projects/ProjectsServiceImpl.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,308 +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.forge.ejb3.projects;
-
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import javax.ejb.Remote;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-
-import org.jboss.annotation.ejb.Management;
-import org.jboss.annotation.ejb.Service;
-import org.jboss.annotation.ejb.Depends;
-import org.jboss.forge.common.projects.DownloadCounterTools;
-import org.jboss.forge.common.projects.Projects;
-import org.jboss.forge.common.projects.ProjectsHelper;
-import org.jboss.forge.common.projects.project.BuildResult;
-import org.jboss.forge.common.projects.project.Developers;
-import org.jboss.forge.common.projects.project.Documentation;
-import org.jboss.forge.common.projects.project.Downloads;
-import org.jboss.forge.common.projects.project.Forum;
-import org.jboss.forge.common.projects.project.IssueTracker;
-import org.jboss.forge.common.projects.project.Menu;
-import org.jboss.forge.common.projects.project.Polls;
-import org.jboss.forge.common.projects.project.Project;
-import org.jboss.forge.common.projects.project.RepoMonitor;
-import org.jboss.forge.common.projects.project.Repository;
-import org.jboss.forge.common.projects.project.SupportService;
-import org.jboss.forge.common.ejb3.ProjectsService;
-import org.jboss.forge.common.Constants;
-import org.jboss.logging.Logger;
-import org.jboss.shotoku.ContentManager;
-import org.jboss.shotoku.Node;
-import org.jboss.shotoku.aop.Inject;
-
-
-/**
- * @author <a href="mailto:ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
- * @author <a href="mailto:adamw at aster.pl">Adam Warski</a>
- */
- at Service(objectName = ProjectsService.PROJECTS_SERVICE)
- at Management(ProjectsService.class)
- at Remote(ProjectsService.class)
- at Depends(org.jboss.shotoku.tools.Constants.SHOTOKU_SERVICE_NAME)
-public class ProjectsServiceImpl implements ProjectsService {
- private static final Logger log = Logger.getLogger(ProjectsService.class);
-
- private static final JAXBContext jc;
-
- static {
-
- JAXBContext temp = null;
- try {
- temp = JAXBContext.newInstance("org.jboss.forge.common.projects.project");
- } catch (JAXBException e) {
- log.warn("I could not create JAXBContext."+e.getCause());
- } finally {
- jc = temp;
- }
-
- }
-
- @Inject
- private ContentManager cm;
-
- public Collection<Project> getProjects() {
- Projects projectsClass = ProjectsHelper.getProjects(Constants.LABS_PORTAL);
- Map<String,Project> projects = projectsClass.getProjectsDescriptor().getNewProjects();
- return projects.values();
- }
-
- public Project getProjectByName(String projectId) {
- Projects projectsClass = ProjectsHelper.getProjects(Constants.LABS_PORTAL);
- Map<String,Project> projects = projectsClass.getProjectsDescriptor().getNewProjects();
- return projects.get(projectId);
- }
-
- public Polls getProjectPolls (String projectId) {
- Project project = getProjectByName(projectId);
- if (project==null) return null;
- return project.getPolls();
- }
-
- public Downloads getProjectDownloads(String projectId) {
- Project project = getProjectByName(projectId);
- if (project==null) return null;
- return project.getDownloads();
- }
-
- public Menu getProjectMenu(String projectId) {
- Project project = getProjectByName(projectId);
- if (project==null) return null;
- return project.getMenu();
- }
-
- public Developers getProjectDevelopers(String projectId) {
- Project project = getProjectByName(projectId);
- if (project==null) return null;
- return project.getDevelopers();
- }
-
- public List<String> getProjectJems(String projectId) {
- Project project = getProjectByName(projectId);
- if (project==null) return null;
- return project.getJems();
- }
-
- public List<Repository> getProjectRepositories(String projectId) {
- Project project = getProjectByName(projectId);
- if (project==null) return null;
- return project.getRepository();
- }
-
- public List<RepoMonitor> getProjectRepoMonitors(String projectId) {
- Project project = getProjectByName(projectId);
- if (project==null) return null;
- return project.getRepoMonitor();
- }
-
- public List<IssueTracker> getProjectIssueTrackers(String projectId) {
- Project project = getProjectByName(projectId);
- if (project==null) return null;
- return project.getIssueTracker();
- }
-
- public List<BuildResult> getProjectBuildresults(String projectId) {
- Project project = getProjectByName(projectId);
- if (project==null) return null;
- return project.getBuildResults();
- }
-
- public List<SupportService> getProjectSupportServices(String projectId) {
- Project project = getProjectByName(projectId);
- if (project==null) return null;
- return project.getSupportServices();
- }
-
- public List<Forum> getProjectForums(String projectId) {
- Project project = getProjectByName(projectId);
- if (project==null) return null;
- return project.getForums();
- }
-
- public List<Documentation> getProjectDocumentation(String projectId) {
- Project project = getProjectByName(projectId);
- if (project==null) return null;
- return project.getDocumentation();
- }
-
- public long getOverallDownloadsForProject(String projectId) {
- return DownloadCounterTools.getOverallDownloadsForProject(projectId, Constants.LABS_PORTAL);
- }
-
- public boolean getPackagedForDownload(String projectId) {
- Project project = getProjectByName(projectId);
- return project != null && project.isPackagedForDownload();
- }
-
- /**
- * This method will overwrite existing project definition in xml file
- * with a new one generated from data contained in given Project object.
- * Be aware, data is NOT merged but overwritten!
- */
- public void persistProject(Project project) {
- if (project.getId()==null) return;
-
- if (jc==null) return ;
-
- try {
-
- Marshaller m = jc.createMarshaller();
- m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
-
- Node node = cm.getRootDirectory().
- getDirectory(Constants.LABS_PORTAL).
- getDirectory(ProjectsHelper.MEMBERS_DIR).
- getDirectory(project.getId()).
- getNode(ProjectsHelper.PROJECT_DESC);
-
- OutputStream os = node.getOutputStream();
- m.marshal(project,os);
-
- node.save("[PROJECTSSERVICE] Persisting "+project.getId()+" project.");
- log.info("Project "+project.getId()+" has been updated.");
-
- } catch (Exception e) {
- log.warn("I could not update project "+project.getId()+".");
- }
-
- }
-
- /**
- * This method will overwrite existing project Polls definition in xml file
- * with a new one generated from data contained in given Polls object.
- * Be aware, data is NOT merged but overwritten!
- */
- public void persistPolls(Polls polls, String projectId) {
- if (polls==null || projectId==null || projectId.trim().length()==0) return;
-
- Project project = getProjectByName(projectId);
-
- if (project==null) return;
-
- project.setPolls(polls);
-
- persistProject(project);
- }
-
- /**
- * This method will overwrite existing project Downloads definition in xml file
- * with a new one generated from data contained in given Downloads object.
- * Be aware, data is NOT merged but overwritten!
- */
- public void persistDownloads (Downloads downloads, String projectId) {
- if (downloads==null || projectId==null || projectId.trim().length()==0) return;
-
- Project project = getProjectByName(projectId);
-
- if (project==null) return;
-
- project.setDownloads(downloads);
-
- persistProject(project);
- }
-
- /**
- * This method will overwrite existing project Menu definition in xml file
- * with a new one generated from data contained in given Menu object.
- * Be aware, data is NOT merged but overwritten!
- */
- public void persistMenu (Menu menu, String projectId) {
- if (menu==null || projectId==null || projectId.trim().length()==0) return;
-
- Project project = getProjectByName(projectId);
-
- if (project==null) return;
-
- project.setMenu(menu);
-
- persistProject(project);
- }
-
- /**
- * This method will overwrite existing project Developers definition
- * in xml file with a new one generated from data contained in given Developers object.
- * Be aware, data is NOT merged but overwritten!
- */
- public void persistDevelopers (Developers developers, String projectId) {
- if (developers==null || projectId==null || projectId.trim().length()==0) return;
-
- Project project = getProjectByName(projectId);
-
- if (project==null) return;
-
- project.setDevelopers(developers);
-
- persistProject(project);
-
- }
-
- public void start() throws Exception {
-
- log.info("Projects service started");
- }
-
- public void stop() throws Exception {
-
- log.info("Projects service stopped");
- }
-
- public Collection<String> getProjectsIds() {
-
- Collection<String> projectsIds = new ArrayList<String>();
-
- Collection<Project> projects = getProjects();
- for (Project project : projects) {
- projectsIds.add(project.getId());
- }
-
- return projectsIds;
- }
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projects/ProjectsServiceImpl.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java/org/jboss/forge/ejb3/projects/ProjectsServiceImpl.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projects/ProjectsServiceImpl.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projects/ProjectsServiceImpl.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,308 @@
+ /*
+ * 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.forge.ejb3.projects;
+
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Remote;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+
+import org.jboss.annotation.ejb.Management;
+import org.jboss.annotation.ejb.Service;
+import org.jboss.annotation.ejb.Depends;
+import org.jboss.forge.common.projects.DownloadCounterTools;
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.common.projects.ProjectsHelper;
+import org.jboss.forge.common.projects.project.BuildResult;
+import org.jboss.forge.common.projects.project.Developers;
+import org.jboss.forge.common.projects.project.Documentation;
+import org.jboss.forge.common.projects.project.Downloads;
+import org.jboss.forge.common.projects.project.Forum;
+import org.jboss.forge.common.projects.project.IssueTracker;
+import org.jboss.forge.common.projects.project.Menu;
+import org.jboss.forge.common.projects.project.Polls;
+import org.jboss.forge.common.projects.project.Project;
+import org.jboss.forge.common.projects.project.RepoMonitor;
+import org.jboss.forge.common.projects.project.Repository;
+import org.jboss.forge.common.projects.project.SupportService;
+import org.jboss.forge.common.ejb3.ProjectsService;
+import org.jboss.forge.common.Constants;
+import org.jboss.logging.Logger;
+import org.jboss.shotoku.ContentManager;
+import org.jboss.shotoku.Node;
+import org.jboss.shotoku.aop.Inject;
+
+
+/**
+ * @author <a href="mailto:ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
+ * @author <a href="mailto:adamw at aster.pl">Adam Warski</a>
+ */
+ at Service(objectName = ProjectsService.PROJECTS_SERVICE)
+ at Management(ProjectsService.class)
+ at Remote(ProjectsService.class)
+ at Depends(org.jboss.shotoku.tools.Constants.SHOTOKU_SERVICE_NAME)
+public class ProjectsServiceImpl implements ProjectsService {
+ private static final Logger log = Logger.getLogger(ProjectsService.class);
+
+ private static final JAXBContext jc;
+
+ static {
+
+ JAXBContext temp = null;
+ try {
+ temp = JAXBContext.newInstance("org.jboss.forge.common.projects.project");
+ } catch (JAXBException e) {
+ log.warn("I could not create JAXBContext."+e.getCause());
+ } finally {
+ jc = temp;
+ }
+
+ }
+
+ @Inject
+ private ContentManager cm;
+
+ public Collection<Project> getProjects() {
+ Projects projectsClass = ProjectsHelper.getProjects(Constants.LABS_PORTAL);
+ Map<String,Project> projects = projectsClass.getProjectsDescriptor().getNewProjects();
+ return projects.values();
+ }
+
+ public Project getProjectByName(String projectId) {
+ Projects projectsClass = ProjectsHelper.getProjects(Constants.LABS_PORTAL);
+ Map<String,Project> projects = projectsClass.getProjectsDescriptor().getNewProjects();
+ return projects.get(projectId);
+ }
+
+ public Polls getProjectPolls (String projectId) {
+ Project project = getProjectByName(projectId);
+ if (project==null) return null;
+ return project.getPolls();
+ }
+
+ public Downloads getProjectDownloads(String projectId) {
+ Project project = getProjectByName(projectId);
+ if (project==null) return null;
+ return project.getDownloads();
+ }
+
+ public Menu getProjectMenu(String projectId) {
+ Project project = getProjectByName(projectId);
+ if (project==null) return null;
+ return project.getMenu();
+ }
+
+ public Developers getProjectDevelopers(String projectId) {
+ Project project = getProjectByName(projectId);
+ if (project==null) return null;
+ return project.getDevelopers();
+ }
+
+ public List<String> getProjectJems(String projectId) {
+ Project project = getProjectByName(projectId);
+ if (project==null) return null;
+ return project.getJems();
+ }
+
+ public List<Repository> getProjectRepositories(String projectId) {
+ Project project = getProjectByName(projectId);
+ if (project==null) return null;
+ return project.getRepository();
+ }
+
+ public List<RepoMonitor> getProjectRepoMonitors(String projectId) {
+ Project project = getProjectByName(projectId);
+ if (project==null) return null;
+ return project.getRepoMonitor();
+ }
+
+ public List<IssueTracker> getProjectIssueTrackers(String projectId) {
+ Project project = getProjectByName(projectId);
+ if (project==null) return null;
+ return project.getIssueTracker();
+ }
+
+ public List<BuildResult> getProjectBuildresults(String projectId) {
+ Project project = getProjectByName(projectId);
+ if (project==null) return null;
+ return project.getBuildResults();
+ }
+
+ public List<SupportService> getProjectSupportServices(String projectId) {
+ Project project = getProjectByName(projectId);
+ if (project==null) return null;
+ return project.getSupportServices();
+ }
+
+ public List<Forum> getProjectForums(String projectId) {
+ Project project = getProjectByName(projectId);
+ if (project==null) return null;
+ return project.getForums();
+ }
+
+ public List<Documentation> getProjectDocumentation(String projectId) {
+ Project project = getProjectByName(projectId);
+ if (project==null) return null;
+ return project.getDocumentation();
+ }
+
+ public long getOverallDownloadsForProject(String projectId) {
+ return DownloadCounterTools.getOverallDownloadsForProject(projectId, Constants.LABS_PORTAL);
+ }
+
+ public boolean getPackagedForDownload(String projectId) {
+ Project project = getProjectByName(projectId);
+ return project != null && project.isPackagedForDownload();
+ }
+
+ /**
+ * This method will overwrite existing project definition in xml file
+ * with a new one generated from data contained in given Project object.
+ * Be aware, data is NOT merged but overwritten!
+ */
+ public void persistProject(Project project) {
+ if (project.getId()==null) return;
+
+ if (jc==null) return ;
+
+ try {
+
+ Marshaller m = jc.createMarshaller();
+ m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+
+ Node node = cm.getRootDirectory().
+ getDirectory(Constants.LABS_PORTAL).
+ getDirectory(ProjectsHelper.MEMBERS_DIR).
+ getDirectory(project.getId()).
+ getNode(ProjectsHelper.PROJECT_DESC);
+
+ OutputStream os = node.getOutputStream();
+ m.marshal(project,os);
+
+ node.save("[PROJECTSSERVICE] Persisting "+project.getId()+" project.");
+ log.info("Project "+project.getId()+" has been updated.");
+
+ } catch (Exception e) {
+ log.warn("I could not update project "+project.getId()+".");
+ }
+
+ }
+
+ /**
+ * This method will overwrite existing project Polls definition in xml file
+ * with a new one generated from data contained in given Polls object.
+ * Be aware, data is NOT merged but overwritten!
+ */
+ public void persistPolls(Polls polls, String projectId) {
+ if (polls==null || projectId==null || projectId.trim().length()==0) return;
+
+ Project project = getProjectByName(projectId);
+
+ if (project==null) return;
+
+ project.setPolls(polls);
+
+ persistProject(project);
+ }
+
+ /**
+ * This method will overwrite existing project Downloads definition in xml file
+ * with a new one generated from data contained in given Downloads object.
+ * Be aware, data is NOT merged but overwritten!
+ */
+ public void persistDownloads (Downloads downloads, String projectId) {
+ if (downloads==null || projectId==null || projectId.trim().length()==0) return;
+
+ Project project = getProjectByName(projectId);
+
+ if (project==null) return;
+
+ project.setDownloads(downloads);
+
+ persistProject(project);
+ }
+
+ /**
+ * This method will overwrite existing project Menu definition in xml file
+ * with a new one generated from data contained in given Menu object.
+ * Be aware, data is NOT merged but overwritten!
+ */
+ public void persistMenu (Menu menu, String projectId) {
+ if (menu==null || projectId==null || projectId.trim().length()==0) return;
+
+ Project project = getProjectByName(projectId);
+
+ if (project==null) return;
+
+ project.setMenu(menu);
+
+ persistProject(project);
+ }
+
+ /**
+ * This method will overwrite existing project Developers definition
+ * in xml file with a new one generated from data contained in given Developers object.
+ * Be aware, data is NOT merged but overwritten!
+ */
+ public void persistDevelopers (Developers developers, String projectId) {
+ if (developers==null || projectId==null || projectId.trim().length()==0) return;
+
+ Project project = getProjectByName(projectId);
+
+ if (project==null) return;
+
+ project.setDevelopers(developers);
+
+ persistProject(project);
+
+ }
+
+ public void start() throws Exception {
+
+ log.info("Projects service started");
+ }
+
+ public void stop() throws Exception {
+
+ log.info("Projects service stopped");
+ }
+
+ public Collection<String> getProjectsIds() {
+
+ Collection<String> projectsIds = new ArrayList<String>();
+
+ Collection<Project> projects = getProjects();
+ for (Project project : projects) {
+ projectsIds.add(project.getId());
+ }
+
+ return projectsIds;
+ }
+}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance)
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/LabsPropertyEntity.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/LabsPropertyEntity.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/LabsPropertyEntity.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,33 +0,0 @@
-package org.jboss.forge.ejb3.propertypersistance;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
- at Entity
- at Table(name = "jblab_properties")
-public class LabsPropertyEntity {
-
- private String propKey;
-
- private String propValue;
-
- @Id
- public String getPropKey() {
- return propKey;
- }
-
- public void setPropKey(String propKey) {
- this.propKey = propKey;
- }
-
- public String getPropValue() {
- return propValue;
- }
-
- public void setPropValue(String propValue) {
- this.propValue = propValue;
- }
-
-
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/LabsPropertyEntity.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/LabsPropertyEntity.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/LabsPropertyEntity.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/LabsPropertyEntity.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,33 @@
+package org.jboss.forge.ejb3.propertypersistance;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+ at Entity
+ at Table(name = "jblab_properties")
+public class LabsPropertyEntity {
+
+ private String propKey;
+
+ private String propValue;
+
+ @Id
+ public String getPropKey() {
+ return propKey;
+ }
+
+ public void setPropKey(String propKey) {
+ this.propKey = propKey;
+ }
+
+ public String getPropValue() {
+ return propValue;
+ }
+
+ public void setPropValue(String propValue) {
+ this.propValue = propValue;
+ }
+
+
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/PropertyServiceBean.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/PropertyServiceBean.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/PropertyServiceBean.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,47 +0,0 @@
-package org.jboss.forge.ejb3.propertypersistance;
-
-import javax.ejb.Stateless;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-import org.jboss.forge.common.ejb3.PropertyService;
-
- at Stateless
-public class PropertyServiceBean implements PropertyService {
-
- @PersistenceContext(unitName = "property_persistance")
- protected EntityManager manager;
-
- public String getProperty(String id, String key) {
- LabsPropertyEntity entity = manager.find(LabsPropertyEntity.class, id
- + key);
-
- if (entity != null) {
- return entity.getPropValue();
- } else
- return null;
- }
-
- public void removeProperty(String id, String key) {
- LabsPropertyEntity entity = manager.find(LabsPropertyEntity.class, id
- + key);
-
- if (entity != null) {
- manager.remove(entity);
- }
- }
-
- public void setProperty(String id, String key, String value) {
- LabsPropertyEntity entity = manager.find(LabsPropertyEntity.class, id
- + key);
-
- if (entity == null)
- entity = new LabsPropertyEntity();
-
- entity.setPropKey(id + key);
- entity.setPropValue(value);
-
- manager.persist(entity);
- }
-
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/PropertyServiceBean.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/PropertyServiceBean.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/PropertyServiceBean.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/propertypersistance/PropertyServiceBean.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,47 @@
+package org.jboss.forge.ejb3.propertypersistance;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.jboss.forge.common.ejb3.PropertyService;
+
+ at Stateless
+public class PropertyServiceBean implements PropertyService {
+
+ @PersistenceContext(unitName = "property_persistance")
+ protected EntityManager manager;
+
+ public String getProperty(String id, String key) {
+ LabsPropertyEntity entity = manager.find(LabsPropertyEntity.class, id
+ + key);
+
+ if (entity != null) {
+ return entity.getPropValue();
+ } else
+ return null;
+ }
+
+ public void removeProperty(String id, String key) {
+ LabsPropertyEntity entity = manager.find(LabsPropertyEntity.class, id
+ + key);
+
+ if (entity != null) {
+ manager.remove(entity);
+ }
+ }
+
+ public void setProperty(String id, String key, String value) {
+ LabsPropertyEntity entity = manager.find(LabsPropertyEntity.class, id
+ + key);
+
+ if (entity == null)
+ entity = new LabsPropertyEntity();
+
+ entity.setPropKey(id + key);
+ entity.setPropValue(value);
+
+ manager.persist(entity);
+ }
+
+}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal)
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org)
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss)
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal)
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core)
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet)
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management)
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/AbstractAuthorizationBean.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/AbstractAuthorizationBean.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/AbstractAuthorizationBean.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,156 +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.portlet.management;
-
-import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.faces.el.PropertyAccessor;
-import org.jboss.portal.security.RoleSecurityBinding;
-import org.jboss.portal.security.spi.provider.DomainConfigurator;
-import org.jboss.portal.security.spi.provider.SecurityConfigurationException;
-
-import javax.faces.model.SelectItem;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public abstract class AbstractAuthorizationBean
-{
-
- public DomainConfigurator getDomainConfigurator()
- {
- throw new UnsupportedOperationException("Implement me");
- }
-
- public PropertyAccessor getForRole()
- {
- return new PropertyAccessor()
- {
- public Class getType(Object propertyName)
- {
- return String[].class;
- }
-
- public Object getValue(Object propertyName)
- {
- return getActionsForRole((String)propertyName);
- }
-
- public void setValue(Object propertyName, Object value)
- {
- setActionsForRole((String)propertyName, (String[])value);
- }
- };
- }
-
- public void setActionsForRole(String roleName, String[] actions)
- {
- String uri = getURI();
- if (uri != null)
- {
- Set constraints = getDomainConfigurator().getSecurityBindings(uri);
- Map newConstraints = new HashMap();
- if (constraints != null)
- {
- for (Iterator i = constraints.iterator(); i.hasNext();)
- {
- RoleSecurityBinding binding = (RoleSecurityBinding)i.next();
- newConstraints.put(binding.getRoleName(), binding);
- }
- }
- Set blah = Tools.toSet(actions);
- newConstraints.put(roleName, new RoleSecurityBinding(blah, roleName));
- try
- {
- getDomainConfigurator().setSecurityBindings(uri, new HashSet(newConstraints.values()));
- }
- catch (SecurityConfigurationException e)
- {
- e.printStackTrace();
- }
- }
- }
-
- public String[] getActionsForRole(String roleName)
- {
- String uri = getURI();
- if (uri != null)
- {
- Set constraints = getDomainConfigurator().getSecurityBindings(uri);
- if (constraints != null)
- {
- Set actions = new HashSet();
- for (Iterator i = constraints.iterator(); i.hasNext();)
- {
- RoleSecurityBinding binding = (RoleSecurityBinding)i.next();
- if (binding.getRoleName().equals(roleName))
- {
- actions.addAll(binding.getActions());
- }
- }
- return (String[])actions.toArray(new String[actions.size()]);
- }
- else
- {
- return new String[0];
- }
- }
- else
- {
- return null;
- }
- }
-
- /** Return the roles. */
- public String[] getRoles()
- {
- String uri = getURI();
- if (uri != null)
- {
- Set roleNames = new HashSet();
- Set constraints = getDomainConfigurator().getSecurityBindings(uri);
- if (constraints != null)
- {
- for (Iterator i = constraints.iterator(); i.hasNext();)
- {
- RoleSecurityBinding binding = (RoleSecurityBinding)i.next();
- roleNames.add(binding.getRoleName());
- }
- }
- return (String[])roleNames.toArray(new String[roleNames.size()]);
- }
- else
- {
- return null;
- }
- }
-
- public abstract SelectItem[] getAvailableActions();
-
- protected abstract String getURI();
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/AbstractAuthorizationBean.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/AbstractAuthorizationBean.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/AbstractAuthorizationBean.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/AbstractAuthorizationBean.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,156 @@
+/******************************************************************************
+ * 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.portlet.management;
+
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.faces.el.PropertyAccessor;
+import org.jboss.portal.security.RoleSecurityBinding;
+import org.jboss.portal.security.spi.provider.DomainConfigurator;
+import org.jboss.portal.security.spi.provider.SecurityConfigurationException;
+
+import javax.faces.model.SelectItem;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public abstract class AbstractAuthorizationBean
+{
+
+ public DomainConfigurator getDomainConfigurator()
+ {
+ throw new UnsupportedOperationException("Implement me");
+ }
+
+ public PropertyAccessor getForRole()
+ {
+ return new PropertyAccessor()
+ {
+ public Class getType(Object propertyName)
+ {
+ return String[].class;
+ }
+
+ public Object getValue(Object propertyName)
+ {
+ return getActionsForRole((String)propertyName);
+ }
+
+ public void setValue(Object propertyName, Object value)
+ {
+ setActionsForRole((String)propertyName, (String[])value);
+ }
+ };
+ }
+
+ public void setActionsForRole(String roleName, String[] actions)
+ {
+ String uri = getURI();
+ if (uri != null)
+ {
+ Set constraints = getDomainConfigurator().getSecurityBindings(uri);
+ Map newConstraints = new HashMap();
+ if (constraints != null)
+ {
+ for (Iterator i = constraints.iterator(); i.hasNext();)
+ {
+ RoleSecurityBinding binding = (RoleSecurityBinding)i.next();
+ newConstraints.put(binding.getRoleName(), binding);
+ }
+ }
+ Set blah = Tools.toSet(actions);
+ newConstraints.put(roleName, new RoleSecurityBinding(blah, roleName));
+ try
+ {
+ getDomainConfigurator().setSecurityBindings(uri, new HashSet(newConstraints.values()));
+ }
+ catch (SecurityConfigurationException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public String[] getActionsForRole(String roleName)
+ {
+ String uri = getURI();
+ if (uri != null)
+ {
+ Set constraints = getDomainConfigurator().getSecurityBindings(uri);
+ if (constraints != null)
+ {
+ Set actions = new HashSet();
+ for (Iterator i = constraints.iterator(); i.hasNext();)
+ {
+ RoleSecurityBinding binding = (RoleSecurityBinding)i.next();
+ if (binding.getRoleName().equals(roleName))
+ {
+ actions.addAll(binding.getActions());
+ }
+ }
+ return (String[])actions.toArray(new String[actions.size()]);
+ }
+ else
+ {
+ return new String[0];
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /** Return the roles. */
+ public String[] getRoles()
+ {
+ String uri = getURI();
+ if (uri != null)
+ {
+ Set roleNames = new HashSet();
+ Set constraints = getDomainConfigurator().getSecurityBindings(uri);
+ if (constraints != null)
+ {
+ for (Iterator i = constraints.iterator(); i.hasNext();)
+ {
+ RoleSecurityBinding binding = (RoleSecurityBinding)i.next();
+ roleNames.add(binding.getRoleName());
+ }
+ }
+ return (String[])roleNames.toArray(new String[roleNames.size()]);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public abstract SelectItem[] getAvailableActions();
+
+ protected abstract String getURI();
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/InstanceManagerBean.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/InstanceManagerBean.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/InstanceManagerBean.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,475 +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.portlet.management;
-
-import org.jboss.logging.Logger;
-import org.jboss.portal.common.util.LocalizedString;
-import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.common.value.Value;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.core.model.instance.NoSuchInstanceException;
-import org.jboss.portal.faces.matrix.Cell;
-import org.jboss.portal.faces.matrix.Row;
-import org.jboss.portal.faces.matrix.RowSetModel;
-import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.identity.Role;
-import org.jboss.portal.identity.RoleModule;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.info.MetaInfo;
-import org.jboss.portal.portlet.info.PreferencesInfo;
-import org.jboss.portal.portlet.state.PropertyMap;
-import org.jboss.portal.security.AuthorizationDomainRegistry;
-import org.jboss.portal.security.SecurityConstants;
-import org.jboss.portal.security.spi.provider.DomainConfigurator;
-
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.model.SelectItem;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
- * @version $Revision: 5915 $
- */
-public class InstanceManagerBean
-{
-
- /** . */
- private Logger log = Logger.getLogger(getClass());
-
- /** . */
- private InstanceContainer instanceContainer;
-
- /** . */
- private String selectedId;
-
- /** . */
- private String selectedPlugin;
-
- /** . */
- private AuthorizationDomainRegistry authorizationDomainRegistry;
-
- /** . */
- private RoleModule roleModule;
-
- /** . */
- private PreferencesBean selectedPreferences;
-
- /** . */
- private AbstractAuthorizationBean auth = new AuthorizationBean();
-
- /** . */
- private Integer selectedRow;
-
- private String sortColumn;
-
- private boolean sortAscending;
-
- public InstanceManagerBean()
- {
- }
-
- public String getSortColumn()
- {
- return sortColumn;
- }
-
- public void setSortColumn(String sortColumn)
- {
- this.sortColumn = sortColumn;
- }
-
- public boolean getSortAscending()
- {
- return sortAscending;
- }
-
- public void setSortAscending(boolean sortAscending)
- {
- this.sortAscending = sortAscending;
- }
-
- public Integer getSelectedRow()
- {
- return selectedRow;
- }
-
- public void setSelectedRow(Integer selectedRow)
- {
- this.selectedRow = selectedRow;
- }
-
- public InstanceContainer getInstanceContainer()
- {
- return instanceContainer;
- }
-
- public void setInstanceContainer(InstanceContainer instanceContainer)
- {
- this.instanceContainer = instanceContainer;
- }
-
- public String getSelectedId()
- {
- return selectedId;
- }
-
- public void setSelectedId(String selectedId)
- {
- this.selectedId = selectedId;
- }
-
- public AuthorizationDomainRegistry getAuthorizationDomainRegistry()
- {
- return authorizationDomainRegistry;
- }
-
- public void setAuthorizationDomainRegistry(AuthorizationDomainRegistry authorizationDomainRegistry)
- {
- this.authorizationDomainRegistry = authorizationDomainRegistry;
- }
-
- public RoleModule getRoleModule()
- {
- return roleModule;
- }
-
- public void setRoleModule(RoleModule roleModule)
- {
- this.roleModule = roleModule;
- }
-
- public DomainConfigurator getDomainConfigurator()
- {
- return authorizationDomainRegistry.getDomain("instance").getConfigurator();
- }
-
- public Instance getSelectedInstance()
- {
- if (selectedId != null)
- {
- return instanceContainer.getDefinition(selectedId);
- }
- else
- {
- return null;
- }
- }
-
- public PreferencesBean getSelectedPreferences()
- {
- return selectedPreferences;
- }
-
- public String getSelectedPlugin()
- {
- return selectedPlugin;
- }
-
- public void setSelectedPlugin(String selectedPlugin)
- {
- this.selectedPlugin = selectedPlugin;
- }
-
- public void selectPlugin()
- {
- // Get id
- Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
- selectedPlugin = (String)pmap.get("plugin");
- }
-
- public AbstractAuthorizationBean getAuth()
- {
- return auth;
- }
-
- /** Return an array of all instances known in this container. */
- public Collection getInstances()
- {
- List instances = new ArrayList();
- for (Iterator i = instanceContainer.getDefinitions().iterator(); i.hasNext();)
- {
- Instance instance = (Instance)i.next();
- try
- {
- Portlet portlet = instance.getPortlet();
- Object[] line = new Object[]
- {
- instance,
- portlet,
- };
- instances.add(line);
- }
- catch (PortletInvokerException e)
- {
- log.warn("Couldn't access portlet invoker associated to instance " + instance.getId()
- + ". This instance won't be listed.\nReason:\n\t" + e.getLocalizedMessage());
- }
- }
-
- try
- {
- sortInstances(instances, sortColumn, sortAscending);
- }
- catch (Exception e)
- {
- log.warn("Error during sorting instances list");
- }
-
- return instances;
- }
-
- public void selectInstance()
- {
- FacesContext ctx = FacesContext.getCurrentInstance();
- ExternalContext ectx = ctx.getExternalContext();
- Map params = ectx.getRequestParameterMap();
- selectedId = (String)params.get("id");
- selectedPreferences = null;
- selectedPlugin = "preferences";
- }
-
- public void deleteInstance()
- {
- FacesContext ctx = FacesContext.getCurrentInstance();
- ExternalContext ectx = ctx.getExternalContext();
- Map params = ectx.getRequestParameterMap();
- String id = (String)params.get("id");
-
- if (id == null)
- {
- // Error
- }
-
- try
- {
- instanceContainer.destroyDefinition(id);
-
- //
- if (id.equals(selectedId))
- {
- selectedId = null;
- selectedPreferences = null;
- }
- }
- catch (NoSuchInstanceException e)
- {
- e.printStackTrace();
- }
- catch (PortletInvokerException e)
- {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- }
-
- /** Refresh the selected prefs. */
- public void refresh()
- {
- selectedPreferences = null;
-
- //
- Instance selectedInstance = getSelectedInstance();
- if (selectedInstance != null)
- {
- PreferencesInfo prefsInfo = null;
- try
- {
- prefsInfo = selectedInstance.getPortlet().getInfo().getPreferences();
- }
- catch (PortletInvokerException e)
- {
- log.warn("Couldn't access portlet invoker associated to instance " + selectedInstance.getId()
- + ". This instance won't be refreshed.\nReason:\n\t" + e.getLocalizedMessage());
- }
-
- if (prefsInfo != null)
- {
- RowSetModel model = new RowSetModel(null, prefsInfo.getKeys().size());
-
- //
- PropertyMap prefs;
- try
- {
- prefs = getSelectedInstance().getProperties();
- }
- catch (PortletInvokerException e)
- {
- throw new Error("Handle me gracefully please", e);
- }
-
- //
- int index = 0;
- for (Iterator i = prefsInfo.getKeys().iterator(); i.hasNext(); index++)
- {
- String key = (String)i.next();
-
- // Get info for this key
-// PreferenceInfo info = prefsInfo.getPreference(key);
-// boolean readOnly = info.isReadOnly();
- boolean readOnly = false;
-// Value value = info.getValue();
-
- // Get value from the state
- Value value = prefs.getProperty(key);
-
- //
- Row row = model.getRow(index);
- row.setReadOnly(readOnly);
-
- //
- Cell cell = row.getCell();
- cell.setHandback("" + i);
- cell.setValue(value.asStringArray());
-
- //
- row.setHandback(key);
- row.setKey(key);
- row.setName("Description");
- row.setReadOnly(false);
- row.setValue(value.asStringArray());
- }
-
- //
- selectedPreferences = new PreferencesBean(model);
-
- //
- if (selectedRow != null)
- {
- selectedPreferences.selectRow(selectedRow);
- }
- }
- }
- }
-
- public static void sortInstances(List instances, final String column, final boolean ascending)
- {
- Comparator comparator = new Comparator()
- {
- public int compare(Object o1, Object o2)
- {
- if (column == null)
- {
- return 0;
- }
- if (column.equals("id"))
- {
- Instance i1 = (Instance)((Object[])o1)[0];
- Instance i2 = (Instance)((Object[])o2)[0];
- return ascending ? i1.getId().compareToIgnoreCase(i2.getId()) : i2.getId()
- .compareToIgnoreCase(i1.getId());
- }
- if (column.equals("portlet"))
- {
- Portlet p1 = (Portlet)((Object[])o1)[1];
- Portlet p2 = (Portlet)((Object[])o2)[1];
-
- LocalizedString displayName = p1.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
- FacesContext ctx = FacesContext.getCurrentInstance();
- Locale locale = ctx.getExternalContext().getRequestLocale();
- String name1 = displayName.getString(locale, true);
- displayName = p2.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
- String name2 = displayName.getString(locale, true);
-
- if (name1 == null || name2 == null)
- {
- return 0;
- }
-
- return ascending ? name1.compareToIgnoreCase(name2) : name2
- .compareToIgnoreCase(name1);
- }
-
- else
- {
- return 0;
- }
- }
- };
- Collections.sort(instances, comparator);
- }
-
- public class AuthorizationBean extends AbstractAuthorizationBean
- {
-
- public DomainConfigurator getDomainConfigurator()
- {
- return InstanceManagerBean.this.getDomainConfigurator();
- }
-
- protected String getURI()
- {
- Instance instance = getSelectedInstance();
- if (instance != null)
- {
- return instance.getId();
- }
- else
- {
- return null;
- }
- }
-
-
- public String[] getRoles()
- {
- String[] roles = super.getRoles();
- if (roles != null)
- {
- try
- {
- Set tmp = Tools.toSet(roles);
- tmp.add(SecurityConstants.UNCHECKED_ROLE_NAME);
- for (Iterator i = getRoleModule().findRoles().iterator(); i.hasNext();)
- {
- Role role = (Role)i.next();
- tmp.add(role.getName());
- }
- roles = (String[])tmp.toArray(new String[tmp.size()]);
- }
- catch (IdentityException e)
- {
- e.printStackTrace();
- }
- }
- return roles;
- }
-
- public SelectItem[] getAvailableActions()
- {
- return new SelectItem[]{
- new SelectItem("view")
- };
- }
- }
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/InstanceManagerBean.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/InstanceManagerBean.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/InstanceManagerBean.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/InstanceManagerBean.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,475 @@
+/******************************************************************************
+ * 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.portlet.management;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.value.Value;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.core.model.instance.NoSuchInstanceException;
+import org.jboss.portal.faces.matrix.Cell;
+import org.jboss.portal.faces.matrix.Row;
+import org.jboss.portal.faces.matrix.RowSetModel;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.info.MetaInfo;
+import org.jboss.portal.portlet.info.PreferencesInfo;
+import org.jboss.portal.portlet.state.PropertyMap;
+import org.jboss.portal.security.AuthorizationDomainRegistry;
+import org.jboss.portal.security.SecurityConstants;
+import org.jboss.portal.security.spi.provider.DomainConfigurator;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 5915 $
+ */
+public class InstanceManagerBean
+{
+
+ /** . */
+ private Logger log = Logger.getLogger(getClass());
+
+ /** . */
+ private InstanceContainer instanceContainer;
+
+ /** . */
+ private String selectedId;
+
+ /** . */
+ private String selectedPlugin;
+
+ /** . */
+ private AuthorizationDomainRegistry authorizationDomainRegistry;
+
+ /** . */
+ private RoleModule roleModule;
+
+ /** . */
+ private PreferencesBean selectedPreferences;
+
+ /** . */
+ private AbstractAuthorizationBean auth = new AuthorizationBean();
+
+ /** . */
+ private Integer selectedRow;
+
+ private String sortColumn;
+
+ private boolean sortAscending;
+
+ public InstanceManagerBean()
+ {
+ }
+
+ public String getSortColumn()
+ {
+ return sortColumn;
+ }
+
+ public void setSortColumn(String sortColumn)
+ {
+ this.sortColumn = sortColumn;
+ }
+
+ public boolean getSortAscending()
+ {
+ return sortAscending;
+ }
+
+ public void setSortAscending(boolean sortAscending)
+ {
+ this.sortAscending = sortAscending;
+ }
+
+ public Integer getSelectedRow()
+ {
+ return selectedRow;
+ }
+
+ public void setSelectedRow(Integer selectedRow)
+ {
+ this.selectedRow = selectedRow;
+ }
+
+ public InstanceContainer getInstanceContainer()
+ {
+ return instanceContainer;
+ }
+
+ public void setInstanceContainer(InstanceContainer instanceContainer)
+ {
+ this.instanceContainer = instanceContainer;
+ }
+
+ public String getSelectedId()
+ {
+ return selectedId;
+ }
+
+ public void setSelectedId(String selectedId)
+ {
+ this.selectedId = selectedId;
+ }
+
+ public AuthorizationDomainRegistry getAuthorizationDomainRegistry()
+ {
+ return authorizationDomainRegistry;
+ }
+
+ public void setAuthorizationDomainRegistry(AuthorizationDomainRegistry authorizationDomainRegistry)
+ {
+ this.authorizationDomainRegistry = authorizationDomainRegistry;
+ }
+
+ public RoleModule getRoleModule()
+ {
+ return roleModule;
+ }
+
+ public void setRoleModule(RoleModule roleModule)
+ {
+ this.roleModule = roleModule;
+ }
+
+ public DomainConfigurator getDomainConfigurator()
+ {
+ return authorizationDomainRegistry.getDomain("instance").getConfigurator();
+ }
+
+ public Instance getSelectedInstance()
+ {
+ if (selectedId != null)
+ {
+ return instanceContainer.getDefinition(selectedId);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public PreferencesBean getSelectedPreferences()
+ {
+ return selectedPreferences;
+ }
+
+ public String getSelectedPlugin()
+ {
+ return selectedPlugin;
+ }
+
+ public void setSelectedPlugin(String selectedPlugin)
+ {
+ this.selectedPlugin = selectedPlugin;
+ }
+
+ public void selectPlugin()
+ {
+ // Get id
+ Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
+ selectedPlugin = (String)pmap.get("plugin");
+ }
+
+ public AbstractAuthorizationBean getAuth()
+ {
+ return auth;
+ }
+
+ /** Return an array of all instances known in this container. */
+ public Collection getInstances()
+ {
+ List instances = new ArrayList();
+ for (Iterator i = instanceContainer.getDefinitions().iterator(); i.hasNext();)
+ {
+ Instance instance = (Instance)i.next();
+ try
+ {
+ Portlet portlet = instance.getPortlet();
+ Object[] line = new Object[]
+ {
+ instance,
+ portlet,
+ };
+ instances.add(line);
+ }
+ catch (PortletInvokerException e)
+ {
+ log.warn("Couldn't access portlet invoker associated to instance " + instance.getId()
+ + ". This instance won't be listed.\nReason:\n\t" + e.getLocalizedMessage());
+ }
+ }
+
+ try
+ {
+ sortInstances(instances, sortColumn, sortAscending);
+ }
+ catch (Exception e)
+ {
+ log.warn("Error during sorting instances list");
+ }
+
+ return instances;
+ }
+
+ public void selectInstance()
+ {
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ ExternalContext ectx = ctx.getExternalContext();
+ Map params = ectx.getRequestParameterMap();
+ selectedId = (String)params.get("id");
+ selectedPreferences = null;
+ selectedPlugin = "preferences";
+ }
+
+ public void deleteInstance()
+ {
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ ExternalContext ectx = ctx.getExternalContext();
+ Map params = ectx.getRequestParameterMap();
+ String id = (String)params.get("id");
+
+ if (id == null)
+ {
+ // Error
+ }
+
+ try
+ {
+ instanceContainer.destroyDefinition(id);
+
+ //
+ if (id.equals(selectedId))
+ {
+ selectedId = null;
+ selectedPreferences = null;
+ }
+ }
+ catch (NoSuchInstanceException e)
+ {
+ e.printStackTrace();
+ }
+ catch (PortletInvokerException e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+
+ /** Refresh the selected prefs. */
+ public void refresh()
+ {
+ selectedPreferences = null;
+
+ //
+ Instance selectedInstance = getSelectedInstance();
+ if (selectedInstance != null)
+ {
+ PreferencesInfo prefsInfo = null;
+ try
+ {
+ prefsInfo = selectedInstance.getPortlet().getInfo().getPreferences();
+ }
+ catch (PortletInvokerException e)
+ {
+ log.warn("Couldn't access portlet invoker associated to instance " + selectedInstance.getId()
+ + ". This instance won't be refreshed.\nReason:\n\t" + e.getLocalizedMessage());
+ }
+
+ if (prefsInfo != null)
+ {
+ RowSetModel model = new RowSetModel(null, prefsInfo.getKeys().size());
+
+ //
+ PropertyMap prefs;
+ try
+ {
+ prefs = getSelectedInstance().getProperties();
+ }
+ catch (PortletInvokerException e)
+ {
+ throw new Error("Handle me gracefully please", e);
+ }
+
+ //
+ int index = 0;
+ for (Iterator i = prefsInfo.getKeys().iterator(); i.hasNext(); index++)
+ {
+ String key = (String)i.next();
+
+ // Get info for this key
+// PreferenceInfo info = prefsInfo.getPreference(key);
+// boolean readOnly = info.isReadOnly();
+ boolean readOnly = false;
+// Value value = info.getValue();
+
+ // Get value from the state
+ Value value = prefs.getProperty(key);
+
+ //
+ Row row = model.getRow(index);
+ row.setReadOnly(readOnly);
+
+ //
+ Cell cell = row.getCell();
+ cell.setHandback("" + i);
+ cell.setValue(value.asStringArray());
+
+ //
+ row.setHandback(key);
+ row.setKey(key);
+ row.setName("Description");
+ row.setReadOnly(false);
+ row.setValue(value.asStringArray());
+ }
+
+ //
+ selectedPreferences = new PreferencesBean(model);
+
+ //
+ if (selectedRow != null)
+ {
+ selectedPreferences.selectRow(selectedRow);
+ }
+ }
+ }
+ }
+
+ public static void sortInstances(List instances, final String column, final boolean ascending)
+ {
+ Comparator comparator = new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ if (column == null)
+ {
+ return 0;
+ }
+ if (column.equals("id"))
+ {
+ Instance i1 = (Instance)((Object[])o1)[0];
+ Instance i2 = (Instance)((Object[])o2)[0];
+ return ascending ? i1.getId().compareToIgnoreCase(i2.getId()) : i2.getId()
+ .compareToIgnoreCase(i1.getId());
+ }
+ if (column.equals("portlet"))
+ {
+ Portlet p1 = (Portlet)((Object[])o1)[1];
+ Portlet p2 = (Portlet)((Object[])o2)[1];
+
+ LocalizedString displayName = p1.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ Locale locale = ctx.getExternalContext().getRequestLocale();
+ String name1 = displayName.getString(locale, true);
+ displayName = p2.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
+ String name2 = displayName.getString(locale, true);
+
+ if (name1 == null || name2 == null)
+ {
+ return 0;
+ }
+
+ return ascending ? name1.compareToIgnoreCase(name2) : name2
+ .compareToIgnoreCase(name1);
+ }
+
+ else
+ {
+ return 0;
+ }
+ }
+ };
+ Collections.sort(instances, comparator);
+ }
+
+ public class AuthorizationBean extends AbstractAuthorizationBean
+ {
+
+ public DomainConfigurator getDomainConfigurator()
+ {
+ return InstanceManagerBean.this.getDomainConfigurator();
+ }
+
+ protected String getURI()
+ {
+ Instance instance = getSelectedInstance();
+ if (instance != null)
+ {
+ return instance.getId();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+
+ public String[] getRoles()
+ {
+ String[] roles = super.getRoles();
+ if (roles != null)
+ {
+ try
+ {
+ Set tmp = Tools.toSet(roles);
+ tmp.add(SecurityConstants.UNCHECKED_ROLE_NAME);
+ for (Iterator i = getRoleModule().findRoles().iterator(); i.hasNext();)
+ {
+ Role role = (Role)i.next();
+ tmp.add(role.getName());
+ }
+ roles = (String[])tmp.toArray(new String[tmp.size()]);
+ }
+ catch (IdentityException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ return roles;
+ }
+
+ public SelectItem[] getAvailableActions()
+ {
+ return new SelectItem[]{
+ new SelectItem("view")
+ };
+ }
+ }
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,176 +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.portlet.management;
-
-import org.apache.myfaces.custom.tree2.TreeNode;
-import org.jboss.portal.core.model.portal.PortalContainer;
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.model.portal.Portal;
-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 java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5774 $
- */
-public class LazyPortalObjectTreeNode implements TreeNode
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = 7253085860667670643L;
-
- /** . */
- private PortalObject object;
-
- /** . */
- private List children;
-
- /** . */
- private String description;
-
- /** . */
- private String type;
-
- public LazyPortalObjectTreeNode(PortalObject object)
- {
- this.object = object;
- this.description = object.getName();
- switch (object.getType())
- {
- case PortalObject.TYPE_CONTEXT:
- type = "context";
- break;
- case PortalObject.TYPE_PORTAL:
- type = "portal";
- break;
- case PortalObject.TYPE_PAGE:
- type = "page";
- break;
- case PortalObject.TYPE_WINDOW:
- type = "window";
- break;
- }
- }
-
- public boolean isLeaf()
- {
- return object.getChildren().size() == 0;
- }
-
- public void setLeaf(boolean b)
- {
- throw new UnsupportedOperationException();
- }
-
- public List getChildren()
- {
- if (children == null)
- {
- children = new ArrayList(object.getChildren());
- Collections.sort(children, new Comparator()
- {
- public int compare(Object o1, Object o2)
- {
- int high1 = getOrder(o1);
- int high2 = getOrder(o2);
- if (high1 == high2)
- {
- return ((PortalObject)o1).getName().compareTo(((PortalObject)o2).getName());
- }
- else
- {
- return high1 - high2;
- }
- }
- });
- for (int i = 0; i < children.size(); i++)
- {
- PortalObject child = (PortalObject)children.get(i);
- children.set(i, new LazyPortalObjectTreeNode(child));
- }
- }
- return children;
- }
-
- public String getType()
- {
- return type;
- }
-
- public void setType(String name)
- {
- throw new UnsupportedOperationException();
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public void setDescription(String name)
- {
- throw new UnsupportedOperationException();
- }
-
- public String getIdentifier()
- {
- return object.getId().toString(PortalObjectId.CANONICAL_FORMAT);
- }
-
- public void setIdentifier(String name)
- {
- throw new UnsupportedOperationException();
- }
-
- public int getChildCount()
- {
- return object.getChildren().size();
- }
-
- private static int getOrder(Object o)
- {
- if (o instanceof PortalContainer)
- {
- return 0;
- }
- if (o instanceof Portal)
- {
- return 1;
- }
- if (o instanceof Page)
- {
- return 2;
- }
- if (o instanceof Window)
- {
- return 3;
- }
- return 4;
- }
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,176 @@
+/******************************************************************************
+ * 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.portlet.management;
+
+import org.apache.myfaces.custom.tree2.TreeNode;
+import org.jboss.portal.core.model.portal.PortalContainer;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.Portal;
+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 java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5774 $
+ */
+public class LazyPortalObjectTreeNode implements TreeNode
+{
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 7253085860667670643L;
+
+ /** . */
+ private PortalObject object;
+
+ /** . */
+ private List children;
+
+ /** . */
+ private String description;
+
+ /** . */
+ private String type;
+
+ public LazyPortalObjectTreeNode(PortalObject object)
+ {
+ this.object = object;
+ this.description = object.getName();
+ switch (object.getType())
+ {
+ case PortalObject.TYPE_CONTEXT:
+ type = "context";
+ break;
+ case PortalObject.TYPE_PORTAL:
+ type = "portal";
+ break;
+ case PortalObject.TYPE_PAGE:
+ type = "page";
+ break;
+ case PortalObject.TYPE_WINDOW:
+ type = "window";
+ break;
+ }
+ }
+
+ public boolean isLeaf()
+ {
+ return object.getChildren().size() == 0;
+ }
+
+ public void setLeaf(boolean b)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public List getChildren()
+ {
+ if (children == null)
+ {
+ children = new ArrayList(object.getChildren());
+ Collections.sort(children, new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ int high1 = getOrder(o1);
+ int high2 = getOrder(o2);
+ if (high1 == high2)
+ {
+ return ((PortalObject)o1).getName().compareTo(((PortalObject)o2).getName());
+ }
+ else
+ {
+ return high1 - high2;
+ }
+ }
+ });
+ for (int i = 0; i < children.size(); i++)
+ {
+ PortalObject child = (PortalObject)children.get(i);
+ children.set(i, new LazyPortalObjectTreeNode(child));
+ }
+ }
+ return children;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String name)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String name)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getIdentifier()
+ {
+ return object.getId().toString(PortalObjectId.CANONICAL_FORMAT);
+ }
+
+ public void setIdentifier(String name)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getChildCount()
+ {
+ return object.getChildren().size();
+ }
+
+ private static int getOrder(Object o)
+ {
+ if (o instanceof PortalContainer)
+ {
+ return 0;
+ }
+ if (o instanceof Portal)
+ {
+ return 1;
+ }
+ if (o instanceof Page)
+ {
+ return 2;
+ }
+ if (o instanceof Window)
+ {
+ return 3;
+ }
+ return 4;
+ }
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,1110 +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.portlet.management;
-
-import org.apache.myfaces.custom.tree2.HtmlTree;
-import org.apache.myfaces.custom.tree2.TreeModel;
-import org.apache.myfaces.custom.tree2.TreeModelBase;
-import org.apache.myfaces.custom.tree2.TreeNode;
-import org.jboss.logging.Logger;
-import org.jboss.portal.api.node.PortalNode;
-import org.jboss.portal.common.MediaType;
-import org.jboss.portal.common.util.LocalizedString;
-import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.core.aspects.controller.node.Navigation;
-import org.jboss.portal.core.impl.model.portal.PortalObjectImpl;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.PortalObjectContainer;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.faces.el.DelegatingPropertyResolver;
-import org.jboss.portal.faces.el.PropertyDef;
-import org.jboss.portal.faces.el.TypeDef;
-import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.identity.Role;
-import org.jboss.portal.identity.RoleModule;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.info.MetaInfo;
-import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.security.AuthorizationDomainRegistry;
-import org.jboss.portal.security.SecurityConstants;
-import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
-import org.jboss.portal.security.spi.provider.DomainConfigurator;
-import org.jboss.portal.theme.LayoutService;
-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.render.PortalRenderSet;
-import org.jboss.portal.theme.strategy.LayoutStrategy;
-import org.jboss.portlet.JBossRenderResponse;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.model.SelectItem;
-import javax.faces.validator.ValidatorException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-/** The portal object manager bean. */
-public class PortalObjectManagerBean implements Serializable
-{
-
- private Logger log = Logger.getLogger(getClass());
-
- /** The serialVersionUID */
- private static final long serialVersionUID = -8923517554726982622L;
-
- static
- {
- TypeDef roleModuleDef = new TypeDef(RoleModule.class);
- roleModuleDef.addAccessor("roles", new PropertyDef(Set.class)
- {
- public Object getValue(Object base)
- {
- try
- {
- RoleModule module = (RoleModule)base;
- return module.findRoles();
- }
- catch (IdentityException e)
- {
- e.printStackTrace();
- return null;
- }
- }
- });
-
- //
- TypeDef portletDef = new TypeDef(Portlet.class);
- portletDef.addAccessor("name", new PropertyDef(String.class)
- {
- public Object getValue(Object base)
- {
- Portlet portlet = (Portlet)base;
- LocalizedString displayName = portlet.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
- FacesContext ctx = FacesContext.getCurrentInstance();
- Locale locale = ctx.getExternalContext().getRequestLocale();
- String name = displayName.getString(locale, true);
- return name;
- }
- });
- portletDef.addAccessor("description", new PropertyDef(String.class)
- {
- public Object getValue(Object base)
- {
- Portlet portlet = (Portlet)base;
- LocalizedString displayName = portlet.getInfo().getMeta().getMetaValue(MetaInfo.DESCRIPTION);
- FacesContext ctx = FacesContext.getCurrentInstance();
- Locale locale = ctx.getExternalContext().getRequestLocale();
- String name = displayName.getString(locale, true);
- if (name == null)
- {
- name = "-";
- }
- return name;
- }
- });
- portletDef.addAccessor("remotable", new PropertyDef(String.class)
- {
- public Object getValue(Object base)
- {
- Portlet portlet = (Portlet)base;
- PortletInfo info = portlet.getInfo();
- Boolean remotable = info.isRemotable();
- return remotable;
- }
- });
- DelegatingPropertyResolver.registerTypeDef(portletDef);
- }
-
- /** The selected id. */
- private String selectedId;
-
- /** The selected node properties. */
- private List selectedProperties;
-
- /** The current tab name. */
- private String selectedPlugin;
-
- /** . */
- private RoleModule roleModule;
-
- /** . */
- private PortalObjectContainer portalObjectContainer;
-
- /** . */
- private InstanceContainer instanceContainer;
-
- /** . */
- private LayoutService layoutService;
-
- /** . */
- private ThemeService themeService;
-
- /** . */
- private AuthorizationDomainRegistry authorizationDomainRegistry;
-
- /** . */
- private PortalAuthorizationManagerFactory portalAuthorizationManagerFactory;
-
- /** . */
- private AbstractAuthorizationBean auth = new PortalObjectAuthorizationBean();
-
- /** . */
- private ThemeBean themes = new ThemeBean();
-
- /** Compares two windows according to their order. */
- private static final Comparator comparator = new Comparator()
- {
- public int compare(Object o1, Object o2)
- {
- Window w1 = (Window)o1;
- Window w2 = (Window)o2;
- int sign = getOrder(w1) - getOrder(w2);
- if (sign == 0)
- {
- sign = w1.getId().compareTo(w2.getId());
- }
- return sign;
- }
- };
-
- public RoleModule getRoleModule()
- {
- return roleModule;
- }
-
- public void setRoleModule(RoleModule roleModule)
- {
- this.roleModule = roleModule;
- }
-
- public PortalObjectContainer getPortalObjectContainer()
- {
- return portalObjectContainer;
- }
-
- public void setPortalObjectContainer(PortalObjectContainer poc)
- {
- this.portalObjectContainer = poc;
- }
-
- public InstanceContainer getInstanceContainer()
- {
- return instanceContainer;
- }
-
- public void setInstanceContainer(InstanceContainer instanceContainer)
- {
- this.instanceContainer = instanceContainer;
- }
-
- public LayoutService getLayoutService()
- {
- return layoutService;
- }
-
- public void setLayoutService(LayoutService layoutService)
- {
- this.layoutService = layoutService;
- }
-
-
- public ThemeService getThemeService()
- {
- return themeService;
- }
-
-
- /**
- * bind the theme service. (defined in the faces-config.xml; injected in WebAppEnhancer, based on jboss-portlet.xml
- * service entry)
- *
- * @param themeService
- */
- public void setThemeService(ThemeService themeService)
- {
- this.themeService = themeService;
- }
-
- public AuthorizationDomainRegistry getAuthorizationDomainRegistry()
- {
- return authorizationDomainRegistry;
- }
-
- public void setAuthorizationDomainRegistry(AuthorizationDomainRegistry authorizationDomainRegistry)
- {
- this.authorizationDomainRegistry = authorizationDomainRegistry;
- }
-
- public AbstractAuthorizationBean getAuth()
- {
- return auth;
- }
-
- public ThemeBean getThemes()
- {
- return themes;
- }
-
- // ****************************
-
- public DomainConfigurator getDomainConfigurator()
- {
- return authorizationDomainRegistry.getDomain("portalobject").getConfigurator();
- }
-
- public PortalObject getSelectedObject()
- {
- PortalObject result = null;
- if (selectedId != null)
- {
- try
- {
- PortalObjectId id = PortalObjectId.parse(selectedId, PortalObjectId.CANONICAL_FORMAT);
- result = portalObjectContainer.getObject(id);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- return result;
- }
-
- public List getSelectedProperties()
- {
- //return selectedProperties;
- PortalObject object = getSelectedObject();
- List properties = new ArrayList();
- for (Iterator i = object.getDeclaredProperties().entrySet().iterator(); i.hasNext();)
- {
- Map.Entry entry = (Map.Entry)i.next();
- properties.add(new String[]{(String)entry.getKey(), (String)entry.getValue()});
- }
- return properties;
- }
-
- public String getSelectedPlugin()
- {
- return selectedPlugin;
- }
-
- public void selectPlugin()
- {
- // Get id
- Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
- selectedPlugin = (String)pmap.get("plugin");
- }
-
- /** Proceed to an object selection. */
- public void selectObject()
- {
- try
- {
- // Select the empty plugin
- // selectedPlugin = null;
-
- // Clear state
- selectedId = null;
- selectedProperties = null;
- selectedPlugin = null;
-
- // Get id
- Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
- String id = (String)pmap.get("id");
-
- // Set the state from the id
- if (id != null)
- {
- PortalObjectId poid = PortalObjectId.parse(id, PortalObjectId.CANONICAL_FORMAT);
- PortalObject object = portalObjectContainer.getObject(poid);
-
- //
- if (object != null)
- {
- List properties = new ArrayList();
- for (Iterator i = object.getDeclaredProperties().entrySet().iterator(); i.hasNext();)
- {
- Map.Entry entry = (Map.Entry)i.next();
- properties.add(new String[]{(String)entry.getKey(), (String)entry.getValue()});
- }
-
- // Update state
- selectedId = id;
- selectedPlugin = "manager";
- selectedProperties = properties;
- }
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- /** Proceed to object destroy. */
- public void destroyObject()
- {
- try
- {
- // Clear state
- selectedId = null;
- selectedProperties = null;
- selectedPlugin = null;
-
- // Get id
- Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
- String id = (String)pmap.get("id");
-
- // Destroy the object
- if (id != null)
- {
- PortalObjectId poid = PortalObjectId.parse(id, PortalObjectId.CANONICAL_FORMAT);
- PortalObject object = portalObjectContainer.getObject(poid);
-
- //
- object.getParent().destroyChild(object.getName());
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- private HtmlTree _tree;
-
- public TreeNode getTreeData()
- {
- PortalObject root = portalObjectContainer.getRootObject();
- return new LazyPortalObjectTreeNode(root);
- }
-
- public SelectItem[] getInstanceItems()
- {
- Collection instances = instanceContainer.getDefinitions();
-
- //sort instances by id
- List sortedInstances = new LinkedList();
- for (Iterator i = instances.iterator(); i.hasNext();)
- {
- Instance instance = (Instance)i.next();
- sortedInstances.add(instance);
- }
- try
- {
- sortInstances(sortedInstances, "id", true);
- }
- catch (Exception e)
- {
- log.warn("Error while sorting instances list");
- }
-
- ArrayList list = new ArrayList(instances.size());
- for (Iterator i = sortedInstances.iterator(); i.hasNext();)
- {
- Instance instance = (Instance)i.next();
- SelectItem item = new SelectItem(instance.getId());
- list.add(item);
- }
- return (SelectItem[])list.toArray(new SelectItem[list.size()]);
- }
-
- public SelectItem[] getPortalPageItems()
- {
- Collection pages = getSelectedObject().getChildren();
-
- ArrayList list = new ArrayList(pages.size() + 1);
- for (Iterator iterator = pages.iterator(); iterator.hasNext();)
- {
- PortalObject o = (PortalObject)iterator.next();
- if (o.getType() == PortalObject.TYPE_PAGE)
- {
- SelectItem item = new SelectItem(o.getName());
- list.add(item);
- }
-
- }
- list.add(new SelectItem("", "no selection"));
-
- return (SelectItem[])list.toArray(new SelectItem[list.size()]);
- }
-
-
- public static void sortInstances(List instances, final String column, final boolean ascending)
- {
- Comparator comparator = new Comparator()
- {
- public int compare(Object o1, Object o2)
- {
- Instance i1 = (Instance)o1;
- Instance i2 = (Instance)o2;
-
- if (column == null)
- {
- return 0;
- }
- if (column.equals("id"))
- {
- return ascending ? i1.getId().compareToIgnoreCase(i2.getId()) : i2.getId()
- .compareToIgnoreCase(i1.getId());
- }
- else
- {
- return 0;
- }
- }
- };
- Collections.sort(instances, comparator);
- }
-
- private static int getOrder(Window w)
- {
- try
- {
- return Integer.parseInt(w.getDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER));
- }
- catch (NumberFormatException e)
- {
- return Integer.MAX_VALUE;
- }
- }
-
- public void moveUp()
- {
- try
- {
- Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
- String id = (String)pmap.get("id");
- PortalObjectId poid = PortalObjectId.parse(id, PortalObjectId.CANONICAL_FORMAT);
- Window target = (Window)portalObjectContainer.getObject(poid);
- move(target, MOVE_UP);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- public void moveDown()
- {
- try
- {
- Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
- String id = (String)pmap.get("id");
- PortalObjectId poid = PortalObjectId.parse(id, PortalObjectId.CANONICAL_FORMAT);
- Window target = (Window)portalObjectContainer.getObject(poid);
- move(target, MOVE_DOWN);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- public void moveRight()
- {
- try
- {
- Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
- String id = (String)pmap.get("id");
- PortalObjectId poid = PortalObjectId.parse(id, PortalObjectId.CANONICAL_FORMAT);
- Window target = (Window)portalObjectContainer.getObject(poid);
- move(target, MOVE_RIGHT);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- public void moveLeft()
- {
- try
- {
- Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
- String id = (String)pmap.get("id");
- PortalObjectId poid = PortalObjectId.parse(id, PortalObjectId.CANONICAL_FORMAT);
- Window target = (Window)portalObjectContainer.getObject(poid);
- move(target, MOVE_LEFT);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- public void move(Window target, int direction)
- {
- try
- {
- // Get region
- String region = target.getDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION);
- if (region == null)
- {
- region = "unknown";
- }
-
- // Get page
- Page page = (Page)target.getParent();
-
- // Build the set of cols
- Map columns = getWindows(page);
-
- //
- List regions = new ArrayList(columns.keySet());
- Collections.sort(regions);
-
- // Do the move
- switch (direction)
- {
- case MOVE_UP:
- {
- List column = new ArrayList((SortedSet)columns.get(region));
- int order = column.indexOf(target);
- int newOrder = order - 1;
- if (newOrder >= 0 && newOrder < column.size())
- {
- column.set(order, column.set(newOrder, target));
- }
- for (int index = 0; index < column.size(); index++)
- {
- Window window = (Window)column.get(index);
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + index);
- }
- break;
- }
- case MOVE_DOWN:
- {
- List column = new ArrayList((SortedSet)columns.get(region));
- int order = column.indexOf(target);
- int newOrder = order + 1;
- if (newOrder >= 0 && newOrder < column.size())
- {
- column.set(order, column.set(newOrder, target));
- }
- for (int index = 0; index < column.size(); index++)
- {
- Window window = (Window)column.get(index);
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + index);
- }
- break;
- }
- case MOVE_RIGHT:
- {
- int index = regions.indexOf(region);
- if (index < regions.size() - 1)
- {
- String newRegion = (String)regions.get(index + 1);
- target.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION, newRegion);
- target.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + Integer.MAX_VALUE);
- ((SortedSet)columns.get(region)).remove(target);
- ((SortedSet)columns.get(newRegion)).add(target);
- List column = new ArrayList((SortedSet)columns.get(newRegion));
- for (int i = 0; i < column.size(); i++)
- {
- Window window = (Window)column.get(i);
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + i);
- }
- }
- break;
- }
- case MOVE_LEFT:
- {
- int index = regions.indexOf(region);
- if (index > 0)
- {
- String newRegion = (String)regions.get(index - 1);
- target.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION, newRegion);
- target.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + Integer.MAX_VALUE);
- ((SortedSet)columns.get(region)).remove(target);
- ((SortedSet)columns.get(newRegion)).add(target);
- List column = new ArrayList((SortedSet)columns.get(newRegion));
- for (int i = 0; i < column.size(); i++)
- {
- Window window = (Window)column.get(i);
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + i);
- }
- }
- break;
- }
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- /** Returns a <Region,<Window>SortedSet>Map. */
- private Map getWindows(Page page) throws Exception
- {
- // Get the layout
- String layoutId = page.getProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
- PortalLayout layout = layoutService.getLayout(layoutId, false);
-
- //
- LinkedHashMap windows = new LinkedHashMap();
- for (Iterator i = layout.getLayoutInfo().getRegionNames().iterator(); i.hasNext();)
- {
- String region = (String)i.next();
- windows.put(region, new TreeSet(comparator));
- }
- windows.put("unknown", new TreeSet(comparator));
-
- //
- for (Iterator j = getSelectedObject().getChildren().iterator(); j.hasNext();)
- {
- PortalObject object = (PortalObject)j.next();
- if (object.getType() == PortalObject.TYPE_WINDOW)
- {
- String region = object.getProperty(ThemeConstants.PORTAL_PROP_REGION);
- if (!windows.containsKey(region))
- {
- region = "unknown";
- }
- SortedSet set = (SortedSet)windows.get(region);
- set.add(object);
- }
- }
- return windows;
- }
-
- /** Return the <Region>List on the selected object which must be a page. */
- public List getCols() throws Exception
- {
- Map windows = getWindows((Page)getSelectedObject());
-
- //
- List regions = new ArrayList(windows.keySet());
- Collections.sort(regions);
-
- //
- return regions;
- }
-
- /** Return an array of <Region,Window>Map on the selected object which must be a page. */
- public Map[] getRows() throws Exception
- {
- Map windows = getWindows((Page)getSelectedObject());
-
- //
- List regions = new ArrayList(windows.keySet());
- Collections.sort(regions);
-
- //
- Iterator[] iterators = new Iterator[regions.size()];
- for (int i = 0; i < regions.size(); i++)
- {
- String region = (String)regions.get(i);
- iterators[i] = ((SortedSet)windows.get(region)).iterator();
- }
-
- //
- List maps = new ArrayList();
- while (true)
- {
- Map row = new HashMap();
- for (int i = 0; i < iterators.length; i++)
- {
- Iterator iterator = iterators[i];
- if (iterator.hasNext())
- {
- row.put(regions.get(i), iterator.next());
- }
- }
- if (row.size() == 0)
- {
- break;
- }
- maps.add(row);
- }
-
- return (Map[])maps.toArray(new Map[maps.size()]);
- }
-
-
- private static final int MOVE_UP = 0;
- private static final int MOVE_DOWN = 1;
- private static final int MOVE_LEFT = 2;
- private static final int MOVE_RIGHT = 3;
-
- // ***
-
- /**
- * NOTE: This is just to show an alternative way of supplying tree data. You can supply either a TreeModel or
- * TreeNode.
- *
- * @return TreeModel
- */
- public TreeModel getExpandedTreeData()
- {
- return new TreeModelBase(getTreeData());
- }
-
- public void setTree(HtmlTree tree)
- {
- _tree = tree;
- }
-
- public HtmlTree getTree()
- {
- return _tree;
- }
-
- public String expandAll()
- {
- _tree.expandAll();
- return null;
- }
-
- private String _nodePath;
-
- public void setNodePath(String nodePath)
- {
- _nodePath = nodePath;
- }
-
- public String getNodePath()
- {
- return _nodePath;
- }
-
- public void checkPath(FacesContext context, UIComponent component, java.lang.Object value)
- {
- // make sure path is valid (leaves cannot be expanded or renderer will complain)
- FacesMessage message = null;
-
- String[] path = _tree.getPathInformation(value.toString());
-
- for (int i = 0; i < path.length; i++)
- {
- String nodeId = path[i];
- try
- {
- _tree.setNodeId(nodeId);
- }
- catch (Exception e)
- {
- throw new ValidatorException(message, e);
- }
-
- if (_tree.getNode().isLeaf())
- {
- message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
- "Invalid node path (cannot expand a leaf): " + nodeId,
- "Invalid node path (cannot expand a leaf): " + nodeId);
- throw new ValidatorException(message);
- }
- }
- }
-
- public void expandPath()
- {
- _tree.expandPath(_tree.getPathInformation(_nodePath));
- }
-
- // ****************************
-
- public class PortalObjectAuthorizationBean extends AbstractAuthorizationBean
- {
-
- public DomainConfigurator getDomainConfigurator()
- {
- return PortalObjectManagerBean.this.getDomainConfigurator();
- }
-
- protected String getURI()
- {
- PortalObject po = getSelectedObject();
- if (po != null)
- {
- return po.getId().toString(PortalObjectId.CANONICAL_FORMAT);
- }
- else
- {
- return null;
- }
- }
-
-
- public String[] getRoles()
- {
- String[] roles = super.getRoles();
- if (roles != null)
- {
- try
- {
- Set tmp = Tools.toSet(roles);
- tmp.add(SecurityConstants.UNCHECKED_ROLE_NAME);
- for (Iterator i = getRoleModule().findRoles().iterator(); i.hasNext();)
- {
- Role role = (Role)i.next();
- tmp.add(role.getName());
- }
- roles = (String[])tmp.toArray(new String[tmp.size()]);
- }
- catch (IdentityException e)
- {
- e.printStackTrace();
- }
- }
- return roles;
- }
-
- public SelectItem[] getAvailableActions()
- {
- return new SelectItem[]{
- new SelectItem("view"),
- new SelectItem("viewrecursive"),
- new SelectItem("personalize"),
- new SelectItem("personalizerecursive"),
- new SelectItem("dashboard"),
- };
- }
- }
-
- public final class ThemeBean
- {
- public boolean isWindow()
- {
- PortalObject po = getSelectedObject();
- if (po != null)
- {
- return (po.getType() == PortalObject.TYPE_WINDOW);
- }
-
- return false;
- }
-
- public String getLayoutName()
- {
- return getDeclaredProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
- }
-
- public String getThemeName()
- {
- return getDeclaredProperty(ThemeConstants.PORTAL_PROP_THEME);
- }
-
- public String getRenderSetName()
- {
- return getDeclaredProperty(ThemeConstants.PORTAL_PROP_RENDERSET);
- }
-
- public String getStrategyName()
- {
- return getDeclaredProperty(ThemeConstants.PORTAL_PROP_STRATEGY);
- }
-
- public String getWindowRenderer()
- {
- return getDeclaredProperty(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER);
- }
-
- public String getDecorationRenderer()
- {
- return getDeclaredProperty(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER);
- }
-
- public String getPortletRenderer()
- {
- return getDeclaredProperty(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER);
- }
-
- /**
- * Get the list of available layouts
- *
- * @return an array of the available layout names to pick a layout from
- */
- public SelectItem[] getLayoutNames()
- {
- Collection layouts = layoutService.getLayouts();
- SelectItem[] names = new SelectItem[layouts.size() + 1];
- int p = 0;
- for (Iterator i = layouts.iterator(); i.hasNext();)
- {
- PortalLayout layout = (PortalLayout)i.next();
- names[p++] = new SelectItem(layout.getLayoutInfo().getName(), layout.getLayoutInfo().getName());
- }
- names[p] = new SelectItem("", "no selection");
- return names;
- }
-
- /**
- * Get the list of available themes
- *
- * @return an array of the available theme names to pick a theme from
- */
- public SelectItem[] getThemeNames()
- {
- Collection themes = themeService.getThemes();
- SelectItem[] themeNames = new SelectItem[themes.size() + 1];
-
- int p = 0;
- for (Iterator i = themes.iterator(); i.hasNext();)
- {
- PortalTheme theme = (PortalTheme)i.next();
- themeNames[p++] = new SelectItem(theme.getThemeInfo().getName(), theme.getThemeInfo().getName());
- }
- themeNames[p] = new SelectItem("", "no selection");
-
- return themeNames;
- }
-
- /**
- * Get a list of available render sets
- *
- * @return and array of all available render set names to pick a render set from
- */
- public SelectItem[] getRenderSetNames()
- {
- Collection renderSets = layoutService.getRenderSets();
- Map names = new HashMap();
- for (Iterator i = renderSets.iterator(); i.hasNext();)
- {
- ServerRegistrationID renderSetId = (ServerRegistrationID)i.next();
- PortalRenderSet renderSet = layoutService.getRenderSet(renderSetId, MediaType.HTML);
- if (renderSet != null)
- {
- names.put(renderSet.getName(), renderSet.getName());
- }
- }
- SelectItem[] renderSetNames = new SelectItem[names.size() + 1];
- int i = 0;
- for (Iterator it = names.keySet().iterator(); it.hasNext();)
- {
- String key = (String)it.next();
- renderSetNames[i++] = new SelectItem(key, (String)names.get(key));
- }
- renderSetNames[i] = new SelectItem("", "no selection");
- return renderSetNames;
- }
-
- public SelectItem[] getStrategyNames()
- {
- Collection strategies = layoutService.getStrategies();
- Map names = new HashMap();
- for (Iterator i = strategies.iterator(); i.hasNext();)
- {
- ServerRegistrationID id = (ServerRegistrationID)i.next();
- LayoutStrategy strategy = layoutService.getStrategy(id, MediaType.HTML);
- if (strategy != null)
- {
- names.put(strategy.getName(), strategy.getName());
- }
- }
- SelectItem[] strategyNames = new SelectItem[names.size() + 1];
-
- int i = 0;
- for (Iterator it = names.keySet().iterator(); it.hasNext();)
- {
- String key = (String)it.next();
- strategyNames[i++] = new SelectItem(key, (String)names.get(key));
- }
- strategyNames[i] = new SelectItem("", "no selection");
- return strategyNames;
- }
-
- private String getDeclaredProperty(String key)
- {
- String value = null;
- PortalObject po = getSelectedObject();
- if (po != null)
- {
- value = po.getDeclaredProperty(key);
- }
-
- return value;
- }
- }
-
- public PortalAuthorizationManagerFactory getPortalAuthorizationManagerFactory()
- {
- return portalAuthorizationManagerFactory;
- }
-
- public void setPortalAuthorizationManagerFactory(PortalAuthorizationManagerFactory portalAuthorizationManagerFactory)
- {
- this.portalAuthorizationManagerFactory = portalAuthorizationManagerFactory;
- }
-
- public String getPreviewURL()
- {
- try
- {
- //set up the root node
- PortalNode root = Navigation.getCurrentNode();
- for (; root.getParent() != null;)
- {
- root = root.getParent();
- }
-
- //obtain the path to our node
- PortalObjectImpl object = (PortalObjectImpl)getSelectedObject();
- String path = object.getObjectNode().getPath();
-
- //iterate to our point
- String[] nodes = path.split("\\.");
- PortalNode dest = root;
-
- for (int i = 0; i < nodes.length; i++)
- {
- String s = nodes[i];
- dest = dest.getChild(s);
- }
-
- //generate url
- JBossRenderResponse response = (JBossRenderResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse();
- String url = response.createRenderURL(dest).toString();
- return url;
- }
- catch (Exception e)
- {
- log.info("Failed to generate object preview link");
- e.printStackTrace();
- }
- //in case it fails let's point to some nice page ;)
- return "http://www.jboss.org";
- }
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,1110 @@
+/******************************************************************************
+ * 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.portlet.management;
+
+import org.apache.myfaces.custom.tree2.HtmlTree;
+import org.apache.myfaces.custom.tree2.TreeModel;
+import org.apache.myfaces.custom.tree2.TreeModelBase;
+import org.apache.myfaces.custom.tree2.TreeNode;
+import org.jboss.logging.Logger;
+import org.jboss.portal.api.node.PortalNode;
+import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.core.aspects.controller.node.Navigation;
+import org.jboss.portal.core.impl.model.portal.PortalObjectImpl;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.faces.el.DelegatingPropertyResolver;
+import org.jboss.portal.faces.el.PropertyDef;
+import org.jboss.portal.faces.el.TypeDef;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.info.MetaInfo;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.security.AuthorizationDomainRegistry;
+import org.jboss.portal.security.SecurityConstants;
+import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
+import org.jboss.portal.security.spi.provider.DomainConfigurator;
+import org.jboss.portal.theme.LayoutService;
+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.render.PortalRenderSet;
+import org.jboss.portal.theme.strategy.LayoutStrategy;
+import org.jboss.portlet.JBossRenderResponse;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+import javax.faces.validator.ValidatorException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+/** The portal object manager bean. */
+public class PortalObjectManagerBean implements Serializable
+{
+
+ private Logger log = Logger.getLogger(getClass());
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -8923517554726982622L;
+
+ static
+ {
+ TypeDef roleModuleDef = new TypeDef(RoleModule.class);
+ roleModuleDef.addAccessor("roles", new PropertyDef(Set.class)
+ {
+ public Object getValue(Object base)
+ {
+ try
+ {
+ RoleModule module = (RoleModule)base;
+ return module.findRoles();
+ }
+ catch (IdentityException e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ });
+
+ //
+ TypeDef portletDef = new TypeDef(Portlet.class);
+ portletDef.addAccessor("name", new PropertyDef(String.class)
+ {
+ public Object getValue(Object base)
+ {
+ Portlet portlet = (Portlet)base;
+ LocalizedString displayName = portlet.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ Locale locale = ctx.getExternalContext().getRequestLocale();
+ String name = displayName.getString(locale, true);
+ return name;
+ }
+ });
+ portletDef.addAccessor("description", new PropertyDef(String.class)
+ {
+ public Object getValue(Object base)
+ {
+ Portlet portlet = (Portlet)base;
+ LocalizedString displayName = portlet.getInfo().getMeta().getMetaValue(MetaInfo.DESCRIPTION);
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ Locale locale = ctx.getExternalContext().getRequestLocale();
+ String name = displayName.getString(locale, true);
+ if (name == null)
+ {
+ name = "-";
+ }
+ return name;
+ }
+ });
+ portletDef.addAccessor("remotable", new PropertyDef(String.class)
+ {
+ public Object getValue(Object base)
+ {
+ Portlet portlet = (Portlet)base;
+ PortletInfo info = portlet.getInfo();
+ Boolean remotable = info.isRemotable();
+ return remotable;
+ }
+ });
+ DelegatingPropertyResolver.registerTypeDef(portletDef);
+ }
+
+ /** The selected id. */
+ private String selectedId;
+
+ /** The selected node properties. */
+ private List selectedProperties;
+
+ /** The current tab name. */
+ private String selectedPlugin;
+
+ /** . */
+ private RoleModule roleModule;
+
+ /** . */
+ private PortalObjectContainer portalObjectContainer;
+
+ /** . */
+ private InstanceContainer instanceContainer;
+
+ /** . */
+ private LayoutService layoutService;
+
+ /** . */
+ private ThemeService themeService;
+
+ /** . */
+ private AuthorizationDomainRegistry authorizationDomainRegistry;
+
+ /** . */
+ private PortalAuthorizationManagerFactory portalAuthorizationManagerFactory;
+
+ /** . */
+ private AbstractAuthorizationBean auth = new PortalObjectAuthorizationBean();
+
+ /** . */
+ private ThemeBean themes = new ThemeBean();
+
+ /** Compares two windows according to their order. */
+ private static final Comparator comparator = new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ Window w1 = (Window)o1;
+ Window w2 = (Window)o2;
+ int sign = getOrder(w1) - getOrder(w2);
+ if (sign == 0)
+ {
+ sign = w1.getId().compareTo(w2.getId());
+ }
+ return sign;
+ }
+ };
+
+ public RoleModule getRoleModule()
+ {
+ return roleModule;
+ }
+
+ public void setRoleModule(RoleModule roleModule)
+ {
+ this.roleModule = roleModule;
+ }
+
+ public PortalObjectContainer getPortalObjectContainer()
+ {
+ return portalObjectContainer;
+ }
+
+ public void setPortalObjectContainer(PortalObjectContainer poc)
+ {
+ this.portalObjectContainer = poc;
+ }
+
+ public InstanceContainer getInstanceContainer()
+ {
+ return instanceContainer;
+ }
+
+ public void setInstanceContainer(InstanceContainer instanceContainer)
+ {
+ this.instanceContainer = instanceContainer;
+ }
+
+ public LayoutService getLayoutService()
+ {
+ return layoutService;
+ }
+
+ public void setLayoutService(LayoutService layoutService)
+ {
+ this.layoutService = layoutService;
+ }
+
+
+ public ThemeService getThemeService()
+ {
+ return themeService;
+ }
+
+
+ /**
+ * bind the theme service. (defined in the faces-config.xml; injected in WebAppEnhancer, based on jboss-portlet.xml
+ * service entry)
+ *
+ * @param themeService
+ */
+ public void setThemeService(ThemeService themeService)
+ {
+ this.themeService = themeService;
+ }
+
+ public AuthorizationDomainRegistry getAuthorizationDomainRegistry()
+ {
+ return authorizationDomainRegistry;
+ }
+
+ public void setAuthorizationDomainRegistry(AuthorizationDomainRegistry authorizationDomainRegistry)
+ {
+ this.authorizationDomainRegistry = authorizationDomainRegistry;
+ }
+
+ public AbstractAuthorizationBean getAuth()
+ {
+ return auth;
+ }
+
+ public ThemeBean getThemes()
+ {
+ return themes;
+ }
+
+ // ****************************
+
+ public DomainConfigurator getDomainConfigurator()
+ {
+ return authorizationDomainRegistry.getDomain("portalobject").getConfigurator();
+ }
+
+ public PortalObject getSelectedObject()
+ {
+ PortalObject result = null;
+ if (selectedId != null)
+ {
+ try
+ {
+ PortalObjectId id = PortalObjectId.parse(selectedId, PortalObjectId.CANONICAL_FORMAT);
+ result = portalObjectContainer.getObject(id);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ return result;
+ }
+
+ public List getSelectedProperties()
+ {
+ //return selectedProperties;
+ PortalObject object = getSelectedObject();
+ List properties = new ArrayList();
+ for (Iterator i = object.getDeclaredProperties().entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ properties.add(new String[]{(String)entry.getKey(), (String)entry.getValue()});
+ }
+ return properties;
+ }
+
+ public String getSelectedPlugin()
+ {
+ return selectedPlugin;
+ }
+
+ public void selectPlugin()
+ {
+ // Get id
+ Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
+ selectedPlugin = (String)pmap.get("plugin");
+ }
+
+ /** Proceed to an object selection. */
+ public void selectObject()
+ {
+ try
+ {
+ // Select the empty plugin
+ // selectedPlugin = null;
+
+ // Clear state
+ selectedId = null;
+ selectedProperties = null;
+ selectedPlugin = null;
+
+ // Get id
+ Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
+ String id = (String)pmap.get("id");
+
+ // Set the state from the id
+ if (id != null)
+ {
+ PortalObjectId poid = PortalObjectId.parse(id, PortalObjectId.CANONICAL_FORMAT);
+ PortalObject object = portalObjectContainer.getObject(poid);
+
+ //
+ if (object != null)
+ {
+ List properties = new ArrayList();
+ for (Iterator i = object.getDeclaredProperties().entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ properties.add(new String[]{(String)entry.getKey(), (String)entry.getValue()});
+ }
+
+ // Update state
+ selectedId = id;
+ selectedPlugin = "manager";
+ selectedProperties = properties;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /** Proceed to object destroy. */
+ public void destroyObject()
+ {
+ try
+ {
+ // Clear state
+ selectedId = null;
+ selectedProperties = null;
+ selectedPlugin = null;
+
+ // Get id
+ Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
+ String id = (String)pmap.get("id");
+
+ // Destroy the object
+ if (id != null)
+ {
+ PortalObjectId poid = PortalObjectId.parse(id, PortalObjectId.CANONICAL_FORMAT);
+ PortalObject object = portalObjectContainer.getObject(poid);
+
+ //
+ object.getParent().destroyChild(object.getName());
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private HtmlTree _tree;
+
+ public TreeNode getTreeData()
+ {
+ PortalObject root = portalObjectContainer.getRootObject();
+ return new LazyPortalObjectTreeNode(root);
+ }
+
+ public SelectItem[] getInstanceItems()
+ {
+ Collection instances = instanceContainer.getDefinitions();
+
+ //sort instances by id
+ List sortedInstances = new LinkedList();
+ for (Iterator i = instances.iterator(); i.hasNext();)
+ {
+ Instance instance = (Instance)i.next();
+ sortedInstances.add(instance);
+ }
+ try
+ {
+ sortInstances(sortedInstances, "id", true);
+ }
+ catch (Exception e)
+ {
+ log.warn("Error while sorting instances list");
+ }
+
+ ArrayList list = new ArrayList(instances.size());
+ for (Iterator i = sortedInstances.iterator(); i.hasNext();)
+ {
+ Instance instance = (Instance)i.next();
+ SelectItem item = new SelectItem(instance.getId());
+ list.add(item);
+ }
+ return (SelectItem[])list.toArray(new SelectItem[list.size()]);
+ }
+
+ public SelectItem[] getPortalPageItems()
+ {
+ Collection pages = getSelectedObject().getChildren();
+
+ ArrayList list = new ArrayList(pages.size() + 1);
+ for (Iterator iterator = pages.iterator(); iterator.hasNext();)
+ {
+ PortalObject o = (PortalObject)iterator.next();
+ if (o.getType() == PortalObject.TYPE_PAGE)
+ {
+ SelectItem item = new SelectItem(o.getName());
+ list.add(item);
+ }
+
+ }
+ list.add(new SelectItem("", "no selection"));
+
+ return (SelectItem[])list.toArray(new SelectItem[list.size()]);
+ }
+
+
+ public static void sortInstances(List instances, final String column, final boolean ascending)
+ {
+ Comparator comparator = new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ Instance i1 = (Instance)o1;
+ Instance i2 = (Instance)o2;
+
+ if (column == null)
+ {
+ return 0;
+ }
+ if (column.equals("id"))
+ {
+ return ascending ? i1.getId().compareToIgnoreCase(i2.getId()) : i2.getId()
+ .compareToIgnoreCase(i1.getId());
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ };
+ Collections.sort(instances, comparator);
+ }
+
+ private static int getOrder(Window w)
+ {
+ try
+ {
+ return Integer.parseInt(w.getDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER));
+ }
+ catch (NumberFormatException e)
+ {
+ return Integer.MAX_VALUE;
+ }
+ }
+
+ public void moveUp()
+ {
+ try
+ {
+ Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
+ String id = (String)pmap.get("id");
+ PortalObjectId poid = PortalObjectId.parse(id, PortalObjectId.CANONICAL_FORMAT);
+ Window target = (Window)portalObjectContainer.getObject(poid);
+ move(target, MOVE_UP);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void moveDown()
+ {
+ try
+ {
+ Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
+ String id = (String)pmap.get("id");
+ PortalObjectId poid = PortalObjectId.parse(id, PortalObjectId.CANONICAL_FORMAT);
+ Window target = (Window)portalObjectContainer.getObject(poid);
+ move(target, MOVE_DOWN);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void moveRight()
+ {
+ try
+ {
+ Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
+ String id = (String)pmap.get("id");
+ PortalObjectId poid = PortalObjectId.parse(id, PortalObjectId.CANONICAL_FORMAT);
+ Window target = (Window)portalObjectContainer.getObject(poid);
+ move(target, MOVE_RIGHT);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void moveLeft()
+ {
+ try
+ {
+ Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
+ String id = (String)pmap.get("id");
+ PortalObjectId poid = PortalObjectId.parse(id, PortalObjectId.CANONICAL_FORMAT);
+ Window target = (Window)portalObjectContainer.getObject(poid);
+ move(target, MOVE_LEFT);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void move(Window target, int direction)
+ {
+ try
+ {
+ // Get region
+ String region = target.getDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION);
+ if (region == null)
+ {
+ region = "unknown";
+ }
+
+ // Get page
+ Page page = (Page)target.getParent();
+
+ // Build the set of cols
+ Map columns = getWindows(page);
+
+ //
+ List regions = new ArrayList(columns.keySet());
+ Collections.sort(regions);
+
+ // Do the move
+ switch (direction)
+ {
+ case MOVE_UP:
+ {
+ List column = new ArrayList((SortedSet)columns.get(region));
+ int order = column.indexOf(target);
+ int newOrder = order - 1;
+ if (newOrder >= 0 && newOrder < column.size())
+ {
+ column.set(order, column.set(newOrder, target));
+ }
+ for (int index = 0; index < column.size(); index++)
+ {
+ Window window = (Window)column.get(index);
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + index);
+ }
+ break;
+ }
+ case MOVE_DOWN:
+ {
+ List column = new ArrayList((SortedSet)columns.get(region));
+ int order = column.indexOf(target);
+ int newOrder = order + 1;
+ if (newOrder >= 0 && newOrder < column.size())
+ {
+ column.set(order, column.set(newOrder, target));
+ }
+ for (int index = 0; index < column.size(); index++)
+ {
+ Window window = (Window)column.get(index);
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + index);
+ }
+ break;
+ }
+ case MOVE_RIGHT:
+ {
+ int index = regions.indexOf(region);
+ if (index < regions.size() - 1)
+ {
+ String newRegion = (String)regions.get(index + 1);
+ target.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION, newRegion);
+ target.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + Integer.MAX_VALUE);
+ ((SortedSet)columns.get(region)).remove(target);
+ ((SortedSet)columns.get(newRegion)).add(target);
+ List column = new ArrayList((SortedSet)columns.get(newRegion));
+ for (int i = 0; i < column.size(); i++)
+ {
+ Window window = (Window)column.get(i);
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + i);
+ }
+ }
+ break;
+ }
+ case MOVE_LEFT:
+ {
+ int index = regions.indexOf(region);
+ if (index > 0)
+ {
+ String newRegion = (String)regions.get(index - 1);
+ target.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION, newRegion);
+ target.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + Integer.MAX_VALUE);
+ ((SortedSet)columns.get(region)).remove(target);
+ ((SortedSet)columns.get(newRegion)).add(target);
+ List column = new ArrayList((SortedSet)columns.get(newRegion));
+ for (int i = 0; i < column.size(); i++)
+ {
+ Window window = (Window)column.get(i);
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + i);
+ }
+ }
+ break;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /** Returns a <Region,<Window>SortedSet>Map. */
+ private Map getWindows(Page page) throws Exception
+ {
+ // Get the layout
+ String layoutId = page.getProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
+ PortalLayout layout = layoutService.getLayout(layoutId, false);
+
+ //
+ LinkedHashMap windows = new LinkedHashMap();
+ for (Iterator i = layout.getLayoutInfo().getRegionNames().iterator(); i.hasNext();)
+ {
+ String region = (String)i.next();
+ windows.put(region, new TreeSet(comparator));
+ }
+ windows.put("unknown", new TreeSet(comparator));
+
+ //
+ for (Iterator j = getSelectedObject().getChildren().iterator(); j.hasNext();)
+ {
+ PortalObject object = (PortalObject)j.next();
+ if (object.getType() == PortalObject.TYPE_WINDOW)
+ {
+ String region = object.getProperty(ThemeConstants.PORTAL_PROP_REGION);
+ if (!windows.containsKey(region))
+ {
+ region = "unknown";
+ }
+ SortedSet set = (SortedSet)windows.get(region);
+ set.add(object);
+ }
+ }
+ return windows;
+ }
+
+ /** Return the <Region>List on the selected object which must be a page. */
+ public List getCols() throws Exception
+ {
+ Map windows = getWindows((Page)getSelectedObject());
+
+ //
+ List regions = new ArrayList(windows.keySet());
+ Collections.sort(regions);
+
+ //
+ return regions;
+ }
+
+ /** Return an array of <Region,Window>Map on the selected object which must be a page. */
+ public Map[] getRows() throws Exception
+ {
+ Map windows = getWindows((Page)getSelectedObject());
+
+ //
+ List regions = new ArrayList(windows.keySet());
+ Collections.sort(regions);
+
+ //
+ Iterator[] iterators = new Iterator[regions.size()];
+ for (int i = 0; i < regions.size(); i++)
+ {
+ String region = (String)regions.get(i);
+ iterators[i] = ((SortedSet)windows.get(region)).iterator();
+ }
+
+ //
+ List maps = new ArrayList();
+ while (true)
+ {
+ Map row = new HashMap();
+ for (int i = 0; i < iterators.length; i++)
+ {
+ Iterator iterator = iterators[i];
+ if (iterator.hasNext())
+ {
+ row.put(regions.get(i), iterator.next());
+ }
+ }
+ if (row.size() == 0)
+ {
+ break;
+ }
+ maps.add(row);
+ }
+
+ return (Map[])maps.toArray(new Map[maps.size()]);
+ }
+
+
+ private static final int MOVE_UP = 0;
+ private static final int MOVE_DOWN = 1;
+ private static final int MOVE_LEFT = 2;
+ private static final int MOVE_RIGHT = 3;
+
+ // ***
+
+ /**
+ * NOTE: This is just to show an alternative way of supplying tree data. You can supply either a TreeModel or
+ * TreeNode.
+ *
+ * @return TreeModel
+ */
+ public TreeModel getExpandedTreeData()
+ {
+ return new TreeModelBase(getTreeData());
+ }
+
+ public void setTree(HtmlTree tree)
+ {
+ _tree = tree;
+ }
+
+ public HtmlTree getTree()
+ {
+ return _tree;
+ }
+
+ public String expandAll()
+ {
+ _tree.expandAll();
+ return null;
+ }
+
+ private String _nodePath;
+
+ public void setNodePath(String nodePath)
+ {
+ _nodePath = nodePath;
+ }
+
+ public String getNodePath()
+ {
+ return _nodePath;
+ }
+
+ public void checkPath(FacesContext context, UIComponent component, java.lang.Object value)
+ {
+ // make sure path is valid (leaves cannot be expanded or renderer will complain)
+ FacesMessage message = null;
+
+ String[] path = _tree.getPathInformation(value.toString());
+
+ for (int i = 0; i < path.length; i++)
+ {
+ String nodeId = path[i];
+ try
+ {
+ _tree.setNodeId(nodeId);
+ }
+ catch (Exception e)
+ {
+ throw new ValidatorException(message, e);
+ }
+
+ if (_tree.getNode().isLeaf())
+ {
+ message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
+ "Invalid node path (cannot expand a leaf): " + nodeId,
+ "Invalid node path (cannot expand a leaf): " + nodeId);
+ throw new ValidatorException(message);
+ }
+ }
+ }
+
+ public void expandPath()
+ {
+ _tree.expandPath(_tree.getPathInformation(_nodePath));
+ }
+
+ // ****************************
+
+ public class PortalObjectAuthorizationBean extends AbstractAuthorizationBean
+ {
+
+ public DomainConfigurator getDomainConfigurator()
+ {
+ return PortalObjectManagerBean.this.getDomainConfigurator();
+ }
+
+ protected String getURI()
+ {
+ PortalObject po = getSelectedObject();
+ if (po != null)
+ {
+ return po.getId().toString(PortalObjectId.CANONICAL_FORMAT);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+
+ public String[] getRoles()
+ {
+ String[] roles = super.getRoles();
+ if (roles != null)
+ {
+ try
+ {
+ Set tmp = Tools.toSet(roles);
+ tmp.add(SecurityConstants.UNCHECKED_ROLE_NAME);
+ for (Iterator i = getRoleModule().findRoles().iterator(); i.hasNext();)
+ {
+ Role role = (Role)i.next();
+ tmp.add(role.getName());
+ }
+ roles = (String[])tmp.toArray(new String[tmp.size()]);
+ }
+ catch (IdentityException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ return roles;
+ }
+
+ public SelectItem[] getAvailableActions()
+ {
+ return new SelectItem[]{
+ new SelectItem("view"),
+ new SelectItem("viewrecursive"),
+ new SelectItem("personalize"),
+ new SelectItem("personalizerecursive"),
+ new SelectItem("dashboard"),
+ };
+ }
+ }
+
+ public final class ThemeBean
+ {
+ public boolean isWindow()
+ {
+ PortalObject po = getSelectedObject();
+ if (po != null)
+ {
+ return (po.getType() == PortalObject.TYPE_WINDOW);
+ }
+
+ return false;
+ }
+
+ public String getLayoutName()
+ {
+ return getDeclaredProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
+ }
+
+ public String getThemeName()
+ {
+ return getDeclaredProperty(ThemeConstants.PORTAL_PROP_THEME);
+ }
+
+ public String getRenderSetName()
+ {
+ return getDeclaredProperty(ThemeConstants.PORTAL_PROP_RENDERSET);
+ }
+
+ public String getStrategyName()
+ {
+ return getDeclaredProperty(ThemeConstants.PORTAL_PROP_STRATEGY);
+ }
+
+ public String getWindowRenderer()
+ {
+ return getDeclaredProperty(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER);
+ }
+
+ public String getDecorationRenderer()
+ {
+ return getDeclaredProperty(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER);
+ }
+
+ public String getPortletRenderer()
+ {
+ return getDeclaredProperty(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER);
+ }
+
+ /**
+ * Get the list of available layouts
+ *
+ * @return an array of the available layout names to pick a layout from
+ */
+ public SelectItem[] getLayoutNames()
+ {
+ Collection layouts = layoutService.getLayouts();
+ SelectItem[] names = new SelectItem[layouts.size() + 1];
+ int p = 0;
+ for (Iterator i = layouts.iterator(); i.hasNext();)
+ {
+ PortalLayout layout = (PortalLayout)i.next();
+ names[p++] = new SelectItem(layout.getLayoutInfo().getName(), layout.getLayoutInfo().getName());
+ }
+ names[p] = new SelectItem("", "no selection");
+ return names;
+ }
+
+ /**
+ * Get the list of available themes
+ *
+ * @return an array of the available theme names to pick a theme from
+ */
+ public SelectItem[] getThemeNames()
+ {
+ Collection themes = themeService.getThemes();
+ SelectItem[] themeNames = new SelectItem[themes.size() + 1];
+
+ int p = 0;
+ for (Iterator i = themes.iterator(); i.hasNext();)
+ {
+ PortalTheme theme = (PortalTheme)i.next();
+ themeNames[p++] = new SelectItem(theme.getThemeInfo().getName(), theme.getThemeInfo().getName());
+ }
+ themeNames[p] = new SelectItem("", "no selection");
+
+ return themeNames;
+ }
+
+ /**
+ * Get a list of available render sets
+ *
+ * @return and array of all available render set names to pick a render set from
+ */
+ public SelectItem[] getRenderSetNames()
+ {
+ Collection renderSets = layoutService.getRenderSets();
+ Map names = new HashMap();
+ for (Iterator i = renderSets.iterator(); i.hasNext();)
+ {
+ ServerRegistrationID renderSetId = (ServerRegistrationID)i.next();
+ PortalRenderSet renderSet = layoutService.getRenderSet(renderSetId, MediaType.HTML);
+ if (renderSet != null)
+ {
+ names.put(renderSet.getName(), renderSet.getName());
+ }
+ }
+ SelectItem[] renderSetNames = new SelectItem[names.size() + 1];
+ int i = 0;
+ for (Iterator it = names.keySet().iterator(); it.hasNext();)
+ {
+ String key = (String)it.next();
+ renderSetNames[i++] = new SelectItem(key, (String)names.get(key));
+ }
+ renderSetNames[i] = new SelectItem("", "no selection");
+ return renderSetNames;
+ }
+
+ public SelectItem[] getStrategyNames()
+ {
+ Collection strategies = layoutService.getStrategies();
+ Map names = new HashMap();
+ for (Iterator i = strategies.iterator(); i.hasNext();)
+ {
+ ServerRegistrationID id = (ServerRegistrationID)i.next();
+ LayoutStrategy strategy = layoutService.getStrategy(id, MediaType.HTML);
+ if (strategy != null)
+ {
+ names.put(strategy.getName(), strategy.getName());
+ }
+ }
+ SelectItem[] strategyNames = new SelectItem[names.size() + 1];
+
+ int i = 0;
+ for (Iterator it = names.keySet().iterator(); it.hasNext();)
+ {
+ String key = (String)it.next();
+ strategyNames[i++] = new SelectItem(key, (String)names.get(key));
+ }
+ strategyNames[i] = new SelectItem("", "no selection");
+ return strategyNames;
+ }
+
+ private String getDeclaredProperty(String key)
+ {
+ String value = null;
+ PortalObject po = getSelectedObject();
+ if (po != null)
+ {
+ value = po.getDeclaredProperty(key);
+ }
+
+ return value;
+ }
+ }
+
+ public PortalAuthorizationManagerFactory getPortalAuthorizationManagerFactory()
+ {
+ return portalAuthorizationManagerFactory;
+ }
+
+ public void setPortalAuthorizationManagerFactory(PortalAuthorizationManagerFactory portalAuthorizationManagerFactory)
+ {
+ this.portalAuthorizationManagerFactory = portalAuthorizationManagerFactory;
+ }
+
+ public String getPreviewURL()
+ {
+ try
+ {
+ //set up the root node
+ PortalNode root = Navigation.getCurrentNode();
+ for (; root.getParent() != null;)
+ {
+ root = root.getParent();
+ }
+
+ //obtain the path to our node
+ PortalObjectImpl object = (PortalObjectImpl)getSelectedObject();
+ String path = object.getObjectNode().getPath();
+
+ //iterate to our point
+ String[] nodes = path.split("\\.");
+ PortalNode dest = root;
+
+ for (int i = 0; i < nodes.length; i++)
+ {
+ String s = nodes[i];
+ dest = dest.getChild(s);
+ }
+
+ //generate url
+ JBossRenderResponse response = (JBossRenderResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse();
+ String url = response.createRenderURL(dest).toString();
+ return url;
+ }
+ catch (Exception e)
+ {
+ log.info("Failed to generate object preview link");
+ e.printStackTrace();
+ }
+ //in case it fails let's point to some nice page ;)
+ return "http://www.jboss.org";
+ }
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PortletManagerBean.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PortletManagerBean.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PortletManagerBean.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,465 +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.portlet.management;
-
-import org.jboss.logging.Logger;
-import org.jboss.portal.common.util.LocalizedString;
-import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.common.value.Value;
-import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.faces.matrix.Cell;
-import org.jboss.portal.faces.matrix.Row;
-import org.jboss.portal.faces.matrix.RowSetModel;
-import org.jboss.portal.portlet.federation.FederatedPortletInvoker;
-import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
-import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.identity.Role;
-import org.jboss.portal.identity.RoleModule;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.PortletContext;
-import org.jboss.portal.portlet.PortletInvoker;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.info.MetaInfo;
-import org.jboss.portal.portlet.info.PreferenceInfo;
-import org.jboss.portal.portlet.info.PreferencesInfo;
-import org.jboss.portal.security.AuthorizationDomainRegistry;
-import org.jboss.portal.security.SecurityConstants;
-import org.jboss.portal.security.spi.provider.DomainConfigurator;
-
-import javax.faces.context.FacesContext;
-import javax.faces.model.SelectItem;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
- * @version $Revision: 6117 $
- */
-public class PortletManagerBean
-{
-
- /** . */
- private Logger log = Logger.getLogger(getClass());
-
- /** . */
- private InstanceContainer instanceContainer;
-
- /** . */
- private AuthorizationDomainRegistry authorizationDomainRegistry;
-
- /** . */
- private String selectedPortletId;
-
- /** The current tab name. */
- private String selectedPlugin;
-
- /** . */
- private RoleModule roleModule;
-
- /** . */
- private PreferencesBean selectedPreferences;
-
- /** . */
- private String selectedFederatedId;
-
- /** . */
- private AbstractAuthorizationBean auth = new AuthorizationBean();
-
- /** . */
- private FederatingPortletInvoker federatingPortletInvoker;
-
- private String sortColumn;
-
- private boolean sortAscending;
-
- public String getSortColumn()
- {
- return sortColumn;
- }
-
- public void setSortColumn(String sortColumn)
- {
- this.sortColumn = sortColumn;
- }
-
- public boolean getSortAscending()
- {
- return sortAscending;
- }
-
- public void setSortAscending(boolean sortAscending)
- {
- this.sortAscending = sortAscending;
- }
-
- public RoleModule getRoleModule()
- {
- return roleModule;
- }
-
- public void setRoleModule(RoleModule roleModule)
- {
- this.roleModule = roleModule;
- }
-
- private PortletInvoker getPortletInvoker()
- {
- FederatedPortletInvoker federated = federatingPortletInvoker.getFederatedInvoker(selectedFederatedId);
- return federated;
- }
-
- public Collection getFederatedIds()
- {
- ArrayList toto = new ArrayList();
- toto.add(new SelectItem("local"));
- for (Iterator i = federatingPortletInvoker.getFederatedInvokers().iterator(); i.hasNext();)
- {
- FederatedPortletInvoker federated = (FederatedPortletInvoker)i.next();
- if ("local".equals(federated.getId()) == false)
- {
- toto.add(new SelectItem(federated.getId()));
- }
- }
- return toto;
- }
-
- public InstanceContainer getInstanceContainer()
- {
- return instanceContainer;
- }
-
- public void setInstanceContainer(InstanceContainer instanceContainer)
- {
- this.instanceContainer = instanceContainer;
- }
-
- public AuthorizationDomainRegistry getAuthorizationDomainRegistry()
- {
- return authorizationDomainRegistry;
- }
-
- public void setAuthorizationDomainRegistry(AuthorizationDomainRegistry authorizationDomainRegistry)
- {
- this.authorizationDomainRegistry = authorizationDomainRegistry;
- }
-
- public String getSelectedPlugin()
- {
- return selectedPlugin;
- }
-
- public void setSelectedPlugin(String selectedPlugin)
- {
- this.selectedPlugin = selectedPlugin;
- }
-
- public String getSelectedFederatedId()
- {
- return selectedFederatedId;
- }
-
- public void setSelectedFederatedId(String selectedFederatedId)
- {
- this.selectedFederatedId = selectedFederatedId;
- }
-
- public FederatingPortletInvoker getFederatingPortletInvoker()
- {
- return federatingPortletInvoker;
- }
-
- public void setFederatingPortletInvoker(FederatingPortletInvoker federatingPortletInvoker)
- {
- this.federatingPortletInvoker = federatingPortletInvoker;
- }
-
- public Collection getPortlets()
- {
- List portlets = Collections.EMPTY_LIST;
- try
- {
- portlets = new ArrayList(getPortletInvoker().getPortlets());
- }
- catch (PortletInvokerException e)
- {
- log.warn("Couldn't access portlet invoker. Portlets won't be listed.\nReason:\n\t" + e.getLocalizedMessage());
- }
-
- try
- {
- sortPortlets(portlets, sortColumn, sortAscending);
- }
- catch (Exception e)
- {
- log.warn("Error during sorting portlets list");
- }
-
- return portlets;
- }
-
- // ****************
-
- public DomainConfigurator getDomainConfigurator()
- {
- return authorizationDomainRegistry.getDomain("portlet").getConfigurator();
- }
-
- public String[] getToto()
- {
- return new String[]{"1", "2", "3"};
- }
-
- public AbstractAuthorizationBean getAuth()
- {
- return auth;
- }
-
- public Portlet getSelectedPortlet()
- {
- if (selectedPortletId != null)
- {
- try
- {
- return getPortletInvoker().getPortlet(PortletContext.createPortletContext(selectedPortletId));
- }
- catch (PortletInvokerException e)
- {
- // todo: find a way to report these errors to the user
- log.warn("Portlet invoker unavailable for portlet: " + selectedPortletId
- + ". Returning null instead.\nReason:\n\t" + e.getLocalizedMessage());
- return null;
- }
- }
- else
- {
- return null;
- }
- }
-
- public String selectPortlet()
- {
- FacesContext ctx = FacesContext.getCurrentInstance();
- selectedPortletId = (String)ctx.getExternalContext().getRequestParameterMap().get("id");
- selectedPlugin = "manager";
- return "portlets";
- }
-
- public void selectPlugin()
- {
- // Get id
- Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
- selectedPlugin = (String)pmap.get("plugin");
- }
-
- public PreferencesBean getSelectedPreferences()
- {
- return selectedPreferences;
- }
-
- /** Refresh the selected prefs if they are available. */
- public void refresh()
- {
- selectedPreferences = null;
-
- // Get user locale
- FacesContext ctx = FacesContext.getCurrentInstance();
- Locale locale = ctx.getExternalContext().getRequestLocale();
-
- // Get portlet
- Portlet portlet = getSelectedPortlet();
-
- if (portlet != null)
- {
- // Get preferences info
- PreferencesInfo prefsInfo = portlet.getInfo().getPreferences();
-
- // If the portlet has preferences info then we display them
- if (prefsInfo != null)
- {
- RowSetModel model = new RowSetModel(null, prefsInfo.getKeys().size());
- model.setMutable(false);
-
- //
- int index = 0;
- for (Iterator i = prefsInfo.getKeys().iterator(); i.hasNext(); index++)
- {
- String key = (String)i.next();
-
- //
- PreferenceInfo prefs = prefsInfo.getPreference(key);
- Value value = prefs.getDefaultValue();
- Boolean readOnly = prefs.isReadOnly();
-
- //
- Row row = model.getRow(index);
-
- //
- Cell cell = row.getCell();
- cell.setHandback("" + i);
- cell.setValue(value.asStringArray());
-
- //
- row.setHandback(key);
- row.setKey(key);
- row.setName(prefs.getDisplayName().getString(locale, true));
- row.setReadOnly(Boolean.TRUE.equals(readOnly));
- row.setValue(value.asStringArray());
- }
-
- //
- selectedPreferences = new PreferencesBean(model);
- }
- }
- }
-
- public static void sortPortlets(List portlets, final String column, final boolean ascending)
- {
- Comparator comparator = new Comparator()
- {
- public int compare(Object o1, Object o2)
- {
- Portlet p1 = (Portlet)o1;
- Portlet p2 = (Portlet)o2;
-
- if (p1 == null || p2 == null)
- {
- return 0;
- }
-
- if (column == null)
- {
- return 0;
- }
- if (column.equals("id"))
- {
- return ascending ? p1.getContext().getId().compareToIgnoreCase(p2.getContext().getId()) : p2.getContext().getId()
- .compareToIgnoreCase(p1.getContext().getId());
- }
- if (column.equals("name"))
- {
-
- LocalizedString displayName = p1.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
- FacesContext ctx = FacesContext.getCurrentInstance();
- Locale locale = ctx.getExternalContext().getRequestLocale();
- String name1 = displayName.getString(locale, true);
- if (name1 == null)
- {
- name1 = "";
- }
- displayName = p2.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
- String name2 = displayName.getString(locale, true);
- if (name2 == null)
- {
- name2 = "";
- }
-
- return ascending ? name1.compareToIgnoreCase(name2) : name2
- .compareToIgnoreCase(name1);
- }
-
- if (column.equals("description"))
- {
- LocalizedString displayName = p1.getInfo().getMeta().getMetaValue(MetaInfo.DESCRIPTION);
- FacesContext ctx = FacesContext.getCurrentInstance();
- Locale locale = ctx.getExternalContext().getRequestLocale();
- String name1 = displayName.getString(locale, true);
- if (name1 == null)
- {
- name1 = "-";
- }
- displayName = p2.getInfo().getMeta().getMetaValue(MetaInfo.DESCRIPTION);
- String name2 = displayName.getString(locale, true);
- if (name2 == null)
- {
- name2 = "-";
- }
-
- return ascending ? name1.compareToIgnoreCase(name2) : name2
- .compareToIgnoreCase(name1);
- }
-
- else
- {
- return 0;
- }
- }
- };
- Collections.sort(portlets, comparator);
- }
-
- public class AuthorizationBean extends AbstractAuthorizationBean
- {
-
- protected String getURI()
- {
- Portlet portlet = getSelectedPortlet();
- if (portlet != null)
- {
- return portlet.getContext().getId();
- }
- else
- {
- return null;
- }
- }
-
- public String[] getRoles()
- {
- String[] roles = super.getRoles();
- if (roles != null)
- {
- try
- {
- Set tmp = Tools.toSet(roles);
- tmp.add(SecurityConstants.UNCHECKED_ROLE_NAME);
- for (Iterator i = getRoleModule().findRoles().iterator(); i.hasNext();)
- {
- Role role = (Role)i.next();
- tmp.add(role.getName());
- }
- roles = (String[])tmp.toArray(new String[tmp.size()]);
- }
- catch (IdentityException e)
- {
- e.printStackTrace();
- }
- }
- return roles;
- }
-
- public SelectItem[] getAvailableActions()
- {
- return new SelectItem[]{
- new SelectItem("view")
- };
- }
- }
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PortletManagerBean.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PortletManagerBean.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PortletManagerBean.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PortletManagerBean.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,465 @@
+/******************************************************************************
+ * 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.portlet.management;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.value.Value;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.faces.matrix.Cell;
+import org.jboss.portal.faces.matrix.Row;
+import org.jboss.portal.faces.matrix.RowSetModel;
+import org.jboss.portal.portlet.federation.FederatedPortletInvoker;
+import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.info.MetaInfo;
+import org.jboss.portal.portlet.info.PreferenceInfo;
+import org.jboss.portal.portlet.info.PreferencesInfo;
+import org.jboss.portal.security.AuthorizationDomainRegistry;
+import org.jboss.portal.security.SecurityConstants;
+import org.jboss.portal.security.spi.provider.DomainConfigurator;
+
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 6117 $
+ */
+public class PortletManagerBean
+{
+
+ /** . */
+ private Logger log = Logger.getLogger(getClass());
+
+ /** . */
+ private InstanceContainer instanceContainer;
+
+ /** . */
+ private AuthorizationDomainRegistry authorizationDomainRegistry;
+
+ /** . */
+ private String selectedPortletId;
+
+ /** The current tab name. */
+ private String selectedPlugin;
+
+ /** . */
+ private RoleModule roleModule;
+
+ /** . */
+ private PreferencesBean selectedPreferences;
+
+ /** . */
+ private String selectedFederatedId;
+
+ /** . */
+ private AbstractAuthorizationBean auth = new AuthorizationBean();
+
+ /** . */
+ private FederatingPortletInvoker federatingPortletInvoker;
+
+ private String sortColumn;
+
+ private boolean sortAscending;
+
+ public String getSortColumn()
+ {
+ return sortColumn;
+ }
+
+ public void setSortColumn(String sortColumn)
+ {
+ this.sortColumn = sortColumn;
+ }
+
+ public boolean getSortAscending()
+ {
+ return sortAscending;
+ }
+
+ public void setSortAscending(boolean sortAscending)
+ {
+ this.sortAscending = sortAscending;
+ }
+
+ public RoleModule getRoleModule()
+ {
+ return roleModule;
+ }
+
+ public void setRoleModule(RoleModule roleModule)
+ {
+ this.roleModule = roleModule;
+ }
+
+ private PortletInvoker getPortletInvoker()
+ {
+ FederatedPortletInvoker federated = federatingPortletInvoker.getFederatedInvoker(selectedFederatedId);
+ return federated;
+ }
+
+ public Collection getFederatedIds()
+ {
+ ArrayList toto = new ArrayList();
+ toto.add(new SelectItem("local"));
+ for (Iterator i = federatingPortletInvoker.getFederatedInvokers().iterator(); i.hasNext();)
+ {
+ FederatedPortletInvoker federated = (FederatedPortletInvoker)i.next();
+ if ("local".equals(federated.getId()) == false)
+ {
+ toto.add(new SelectItem(federated.getId()));
+ }
+ }
+ return toto;
+ }
+
+ public InstanceContainer getInstanceContainer()
+ {
+ return instanceContainer;
+ }
+
+ public void setInstanceContainer(InstanceContainer instanceContainer)
+ {
+ this.instanceContainer = instanceContainer;
+ }
+
+ public AuthorizationDomainRegistry getAuthorizationDomainRegistry()
+ {
+ return authorizationDomainRegistry;
+ }
+
+ public void setAuthorizationDomainRegistry(AuthorizationDomainRegistry authorizationDomainRegistry)
+ {
+ this.authorizationDomainRegistry = authorizationDomainRegistry;
+ }
+
+ public String getSelectedPlugin()
+ {
+ return selectedPlugin;
+ }
+
+ public void setSelectedPlugin(String selectedPlugin)
+ {
+ this.selectedPlugin = selectedPlugin;
+ }
+
+ public String getSelectedFederatedId()
+ {
+ return selectedFederatedId;
+ }
+
+ public void setSelectedFederatedId(String selectedFederatedId)
+ {
+ this.selectedFederatedId = selectedFederatedId;
+ }
+
+ public FederatingPortletInvoker getFederatingPortletInvoker()
+ {
+ return federatingPortletInvoker;
+ }
+
+ public void setFederatingPortletInvoker(FederatingPortletInvoker federatingPortletInvoker)
+ {
+ this.federatingPortletInvoker = federatingPortletInvoker;
+ }
+
+ public Collection getPortlets()
+ {
+ List portlets = Collections.EMPTY_LIST;
+ try
+ {
+ portlets = new ArrayList(getPortletInvoker().getPortlets());
+ }
+ catch (PortletInvokerException e)
+ {
+ log.warn("Couldn't access portlet invoker. Portlets won't be listed.\nReason:\n\t" + e.getLocalizedMessage());
+ }
+
+ try
+ {
+ sortPortlets(portlets, sortColumn, sortAscending);
+ }
+ catch (Exception e)
+ {
+ log.warn("Error during sorting portlets list");
+ }
+
+ return portlets;
+ }
+
+ // ****************
+
+ public DomainConfigurator getDomainConfigurator()
+ {
+ return authorizationDomainRegistry.getDomain("portlet").getConfigurator();
+ }
+
+ public String[] getToto()
+ {
+ return new String[]{"1", "2", "3"};
+ }
+
+ public AbstractAuthorizationBean getAuth()
+ {
+ return auth;
+ }
+
+ public Portlet getSelectedPortlet()
+ {
+ if (selectedPortletId != null)
+ {
+ try
+ {
+ return getPortletInvoker().getPortlet(PortletContext.createPortletContext(selectedPortletId));
+ }
+ catch (PortletInvokerException e)
+ {
+ // todo: find a way to report these errors to the user
+ log.warn("Portlet invoker unavailable for portlet: " + selectedPortletId
+ + ". Returning null instead.\nReason:\n\t" + e.getLocalizedMessage());
+ return null;
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public String selectPortlet()
+ {
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ selectedPortletId = (String)ctx.getExternalContext().getRequestParameterMap().get("id");
+ selectedPlugin = "manager";
+ return "portlets";
+ }
+
+ public void selectPlugin()
+ {
+ // Get id
+ Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
+ selectedPlugin = (String)pmap.get("plugin");
+ }
+
+ public PreferencesBean getSelectedPreferences()
+ {
+ return selectedPreferences;
+ }
+
+ /** Refresh the selected prefs if they are available. */
+ public void refresh()
+ {
+ selectedPreferences = null;
+
+ // Get user locale
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ Locale locale = ctx.getExternalContext().getRequestLocale();
+
+ // Get portlet
+ Portlet portlet = getSelectedPortlet();
+
+ if (portlet != null)
+ {
+ // Get preferences info
+ PreferencesInfo prefsInfo = portlet.getInfo().getPreferences();
+
+ // If the portlet has preferences info then we display them
+ if (prefsInfo != null)
+ {
+ RowSetModel model = new RowSetModel(null, prefsInfo.getKeys().size());
+ model.setMutable(false);
+
+ //
+ int index = 0;
+ for (Iterator i = prefsInfo.getKeys().iterator(); i.hasNext(); index++)
+ {
+ String key = (String)i.next();
+
+ //
+ PreferenceInfo prefs = prefsInfo.getPreference(key);
+ Value value = prefs.getDefaultValue();
+ Boolean readOnly = prefs.isReadOnly();
+
+ //
+ Row row = model.getRow(index);
+
+ //
+ Cell cell = row.getCell();
+ cell.setHandback("" + i);
+ cell.setValue(value.asStringArray());
+
+ //
+ row.setHandback(key);
+ row.setKey(key);
+ row.setName(prefs.getDisplayName().getString(locale, true));
+ row.setReadOnly(Boolean.TRUE.equals(readOnly));
+ row.setValue(value.asStringArray());
+ }
+
+ //
+ selectedPreferences = new PreferencesBean(model);
+ }
+ }
+ }
+
+ public static void sortPortlets(List portlets, final String column, final boolean ascending)
+ {
+ Comparator comparator = new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ Portlet p1 = (Portlet)o1;
+ Portlet p2 = (Portlet)o2;
+
+ if (p1 == null || p2 == null)
+ {
+ return 0;
+ }
+
+ if (column == null)
+ {
+ return 0;
+ }
+ if (column.equals("id"))
+ {
+ return ascending ? p1.getContext().getId().compareToIgnoreCase(p2.getContext().getId()) : p2.getContext().getId()
+ .compareToIgnoreCase(p1.getContext().getId());
+ }
+ if (column.equals("name"))
+ {
+
+ LocalizedString displayName = p1.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ Locale locale = ctx.getExternalContext().getRequestLocale();
+ String name1 = displayName.getString(locale, true);
+ if (name1 == null)
+ {
+ name1 = "";
+ }
+ displayName = p2.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
+ String name2 = displayName.getString(locale, true);
+ if (name2 == null)
+ {
+ name2 = "";
+ }
+
+ return ascending ? name1.compareToIgnoreCase(name2) : name2
+ .compareToIgnoreCase(name1);
+ }
+
+ if (column.equals("description"))
+ {
+ LocalizedString displayName = p1.getInfo().getMeta().getMetaValue(MetaInfo.DESCRIPTION);
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ Locale locale = ctx.getExternalContext().getRequestLocale();
+ String name1 = displayName.getString(locale, true);
+ if (name1 == null)
+ {
+ name1 = "-";
+ }
+ displayName = p2.getInfo().getMeta().getMetaValue(MetaInfo.DESCRIPTION);
+ String name2 = displayName.getString(locale, true);
+ if (name2 == null)
+ {
+ name2 = "-";
+ }
+
+ return ascending ? name1.compareToIgnoreCase(name2) : name2
+ .compareToIgnoreCase(name1);
+ }
+
+ else
+ {
+ return 0;
+ }
+ }
+ };
+ Collections.sort(portlets, comparator);
+ }
+
+ public class AuthorizationBean extends AbstractAuthorizationBean
+ {
+
+ protected String getURI()
+ {
+ Portlet portlet = getSelectedPortlet();
+ if (portlet != null)
+ {
+ return portlet.getContext().getId();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public String[] getRoles()
+ {
+ String[] roles = super.getRoles();
+ if (roles != null)
+ {
+ try
+ {
+ Set tmp = Tools.toSet(roles);
+ tmp.add(SecurityConstants.UNCHECKED_ROLE_NAME);
+ for (Iterator i = getRoleModule().findRoles().iterator(); i.hasNext();)
+ {
+ Role role = (Role)i.next();
+ tmp.add(role.getName());
+ }
+ roles = (String[])tmp.toArray(new String[tmp.size()]);
+ }
+ catch (IdentityException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ return roles;
+ }
+
+ public SelectItem[] getAvailableActions()
+ {
+ return new SelectItem[]{
+ new SelectItem("view")
+ };
+ }
+ }
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PreferencesBean.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PreferencesBean.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PreferencesBean.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,74 +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.portlet.management;
-
-import org.jboss.portal.faces.matrix.Cell;
-import org.jboss.portal.faces.matrix.Row;
-import org.jboss.portal.faces.matrix.RowSetModel;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class PreferencesBean
-{
-
- /** . */
- private RowSetModel model;
-
- /** . */
- private Cell selectedPreference;
-
- public PreferencesBean(RowSetModel selectedPreferences)
- {
- this.model = selectedPreferences;
- }
-
- public Cell getSelectedPreference()
- {
- return selectedPreference;
- }
-
- public void setSelectedPreference(Cell selectedPreference)
- {
- this.selectedPreference = selectedPreference;
- }
-
- public RowSetModel getModel()
- {
- return model;
- }
-
- public void selectRow(Integer index)
- {
- if (index != null)
- {
- Row row = model.getRow(index.intValue());
- selectedPreference = row.getCell();
- }
- else
- {
- selectedPreference = null;
- }
- }
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PreferencesBean.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PreferencesBean.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PreferencesBean.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/PreferencesBean.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * 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.portlet.management;
+
+import org.jboss.portal.faces.matrix.Cell;
+import org.jboss.portal.faces.matrix.Row;
+import org.jboss.portal.faces.matrix.RowSetModel;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class PreferencesBean
+{
+
+ /** . */
+ private RowSetModel model;
+
+ /** . */
+ private Cell selectedPreference;
+
+ public PreferencesBean(RowSetModel selectedPreferences)
+ {
+ this.model = selectedPreferences;
+ }
+
+ public Cell getSelectedPreference()
+ {
+ return selectedPreference;
+ }
+
+ public void setSelectedPreference(Cell selectedPreference)
+ {
+ this.selectedPreference = selectedPreference;
+ }
+
+ public RowSetModel getModel()
+ {
+ return model;
+ }
+
+ public void selectRow(Integer index)
+ {
+ if (index != null)
+ {
+ Row row = model.getRow(index.intValue());
+ selectedPreference = row.getCell();
+ }
+ else
+ {
+ selectedPreference = null;
+ }
+ }
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/Refresher.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/Refresher.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/Refresher.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,66 +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.portlet.management;
-
-import javax.faces.context.FacesContext;
-import javax.faces.event.PhaseEvent;
-import javax.faces.event.PhaseId;
-import javax.faces.event.PhaseListener;
-
-/**
- * Refresh the beans before JSR performs the render.
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class Refresher implements PhaseListener
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = -5027591744094332498L;
-
- public void afterPhase(PhaseEvent phaseEvent)
- {
- }
-
- public void beforePhase(PhaseEvent phaseEvent)
- {
- if (phaseEvent.getPhaseId() == PhaseId.RENDER_RESPONSE)
- {
- FacesContext ctx = phaseEvent.getFacesContext();
-
- //
- InstanceManagerBean instancemgr = (InstanceManagerBean)ctx.getApplication().createValueBinding("#{instancemgr}").getValue(ctx);
- instancemgr.refresh();
-
- //
- PortletManagerBean portletmgr = (PortletManagerBean)ctx.getApplication().createValueBinding("#{portletmgr}").getValue(ctx);
- portletmgr.refresh();
- }
- }
-
- public PhaseId getPhaseId()
- {
- return PhaseId.ANY_PHASE;
- }
-}
\ No newline at end of file
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/Refresher.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/Refresher.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/Refresher.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/Refresher.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,66 @@
+/******************************************************************************
+ * 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.portlet.management;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+/**
+ * Refresh the beans before JSR performs the render.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class Refresher implements PhaseListener
+{
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -5027591744094332498L;
+
+ public void afterPhase(PhaseEvent phaseEvent)
+ {
+ }
+
+ public void beforePhase(PhaseEvent phaseEvent)
+ {
+ if (phaseEvent.getPhaseId() == PhaseId.RENDER_RESPONSE)
+ {
+ FacesContext ctx = phaseEvent.getFacesContext();
+
+ //
+ InstanceManagerBean instancemgr = (InstanceManagerBean)ctx.getApplication().createValueBinding("#{instancemgr}").getValue(ctx);
+ instancemgr.refresh();
+
+ //
+ PortletManagerBean portletmgr = (PortletManagerBean)ctx.getApplication().createValueBinding("#{portletmgr}").getValue(ctx);
+ portletmgr.refresh();
+ }
+ }
+
+ public PhaseId getPhaseId()
+ {
+ return PhaseId.ANY_PHASE;
+ }
+}
\ No newline at end of file
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions)
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/AddPageAction.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/AddPageAction.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/AddPageAction.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,122 +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.portlet.management.actions;
-
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.model.portal.PageContainer;
-import org.jboss.portal.core.model.portal.PortalObjectPermission;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.portlet.management.PortalObjectManagerBean;
-import org.jboss.portal.security.RoleSecurityBinding;
-import org.jboss.portal.security.SecurityConstants;
-import org.jboss.portal.security.spi.provider.DomainConfigurator;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.validator.ValidatorException;
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5763 $
- */
-public class AddPageAction
-{
-
- /** . */
- private PortalObjectManagerBean pomgr;
-
- /** . */
- private String pageName;
-
- /** . */
- private static final String ERROR_DUPE_NAME = "Duplicate Page name found on this portal!";
-
- /** . */
- private static final String ERROR_EMPTY_NAME = "Page name cannot be blank!";
-
- public PortalObjectManagerBean getPortalObjectManager()
- {
- return pomgr;
- }
-
- public void setPortalObjectManager(PortalObjectManagerBean portalObjectManager)
- {
- this.pomgr = portalObjectManager;
- }
-
- public String getPageName()
- {
- return pageName;
- }
-
- public void setPageName(String pageName)
- {
- this.pageName = pageName;
- }
-
- /**
- * Checks for duplicate page names on the portal instance. Blank page names are not allowed and are controlled by the
- * required attribute in the presentation page.
- *
- * @param context
- * @param toValidate
- * @param value
- */
- public void validatePageName(FacesContext context, UIComponent toValidate, Object value)
- {
- String pageName = (String)value;
-
- // check for empty string
- if (pageName.startsWith(" "))
- {
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, ERROR_EMPTY_NAME, ERROR_EMPTY_NAME);
- throw new ValidatorException(message);
- }
-
- // Check for duplicate child name
- if (pomgr.getSelectedObject().getChild(pageName) != null)
- {
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, ERROR_DUPE_NAME, ERROR_DUPE_NAME);
- throw new ValidatorException(message);
- }
- }
-
- public void execute()
- {
- try
- {
- PageContainer pageContainer = (PageContainer)pomgr.getSelectedObject();
- Page page = pageContainer.createPage(pageName);
- DomainConfigurator configurator = pomgr.getDomainConfigurator();
- Set constraints = Collections.singleton(new RoleSecurityBinding(PortalObjectPermission.VIEW_RECURSIVE_ACTION, SecurityConstants.UNCHECKED_ROLE_NAME));
- configurator.setSecurityBindings(page.getId().toString(PortalObjectId.CANONICAL_FORMAT), constraints);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/AddPageAction.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/AddPageAction.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/AddPageAction.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/AddPageAction.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,122 @@
+/******************************************************************************
+ * 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.portlet.management.actions;
+
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PageContainer;
+import org.jboss.portal.core.model.portal.PortalObjectPermission;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.portlet.management.PortalObjectManagerBean;
+import org.jboss.portal.security.RoleSecurityBinding;
+import org.jboss.portal.security.SecurityConstants;
+import org.jboss.portal.security.spi.provider.DomainConfigurator;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5763 $
+ */
+public class AddPageAction
+{
+
+ /** . */
+ private PortalObjectManagerBean pomgr;
+
+ /** . */
+ private String pageName;
+
+ /** . */
+ private static final String ERROR_DUPE_NAME = "Duplicate Page name found on this portal!";
+
+ /** . */
+ private static final String ERROR_EMPTY_NAME = "Page name cannot be blank!";
+
+ public PortalObjectManagerBean getPortalObjectManager()
+ {
+ return pomgr;
+ }
+
+ public void setPortalObjectManager(PortalObjectManagerBean portalObjectManager)
+ {
+ this.pomgr = portalObjectManager;
+ }
+
+ public String getPageName()
+ {
+ return pageName;
+ }
+
+ public void setPageName(String pageName)
+ {
+ this.pageName = pageName;
+ }
+
+ /**
+ * Checks for duplicate page names on the portal instance. Blank page names are not allowed and are controlled by the
+ * required attribute in the presentation page.
+ *
+ * @param context
+ * @param toValidate
+ * @param value
+ */
+ public void validatePageName(FacesContext context, UIComponent toValidate, Object value)
+ {
+ String pageName = (String)value;
+
+ // check for empty string
+ if (pageName.startsWith(" "))
+ {
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, ERROR_EMPTY_NAME, ERROR_EMPTY_NAME);
+ throw new ValidatorException(message);
+ }
+
+ // Check for duplicate child name
+ if (pomgr.getSelectedObject().getChild(pageName) != null)
+ {
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, ERROR_DUPE_NAME, ERROR_DUPE_NAME);
+ throw new ValidatorException(message);
+ }
+ }
+
+ public void execute()
+ {
+ try
+ {
+ PageContainer pageContainer = (PageContainer)pomgr.getSelectedObject();
+ Page page = pageContainer.createPage(pageName);
+ DomainConfigurator configurator = pomgr.getDomainConfigurator();
+ Set constraints = Collections.singleton(new RoleSecurityBinding(PortalObjectPermission.VIEW_RECURSIVE_ACTION, SecurityConstants.UNCHECKED_ROLE_NAME));
+ configurator.setSecurityBindings(page.getId().toString(PortalObjectId.CANONICAL_FORMAT), constraints);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/AddWindowAction.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/AddWindowAction.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/AddWindowAction.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,132 +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.portlet.management.actions;
-
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.content.ContentType;
-import org.jboss.portal.core.portlet.management.PortalObjectManagerBean;
-import org.jboss.portal.theme.ThemeConstants;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-import javax.faces.validator.ValidatorException;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 6082 $
- */
-public class AddWindowAction
-{
-
- /** . */
- private PortalObjectManagerBean pomgr;
-
- /** . */
- private String instanceId;
-
- /** . */
- private String windowName;
-
- public PortalObjectManagerBean getPortalObjectManager()
- {
- return pomgr;
- }
-
- public void setPortalObjectManager(PortalObjectManagerBean portalObjectManager)
- {
- this.pomgr = portalObjectManager;
- }
-
- public String getWindowName()
- {
- return windowName;
- }
-
- public void setWindowName(String windowName)
- {
- this.windowName = windowName;
- }
-
- public String getInstanceId()
- {
- return instanceId;
- }
-
- public void setInstanceId(String instanceId)
- {
- this.instanceId = instanceId;
- }
-
- /**
- * Checks for duplicate window names on the page. Blank window names are not allowed and are controlled by the
- * required attribute in the presentation page.
- *
- * @param context
- * @param toValidate
- * @param value
- */
- public void validateWindowName(FacesContext context, UIComponent toValidate, Object value)
- {
- String windowName = (String)value;
-
- // check for empty string
- if (windowName.startsWith(" "))
- {
- String error = "Window name cannot be blank!";
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, error, error);
- throw new ValidatorException(message);
- }
-
- // check for duplicate window name
- Page page = (Page)pomgr.getSelectedObject();
- if (page.getWindow(windowName) != null)
- {
- String error = "Duplicate window name found on this page!";
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, error, error);
- throw new ValidatorException(message);
- }
- }
-
- public void execute()
- {
- try
- {
- FacesContext ctx = FacesContext.getCurrentInstance();
- ValueBinding vb = ctx.getApplication().createValueBinding("#{col}");
- String region = (String)vb.getValue(ctx);
- Page page = (Page)pomgr.getSelectedObject();
-
- //
- Window window = page.createWindow(windowName, ContentType.PORTLET, instanceId);
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION, region);
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + Integer.MAX_VALUE);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/AddWindowAction.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/AddWindowAction.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/AddWindowAction.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/AddWindowAction.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,132 @@
+/******************************************************************************
+ * 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.portlet.management.actions;
+
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.content.ContentType;
+import org.jboss.portal.core.portlet.management.PortalObjectManagerBean;
+import org.jboss.portal.theme.ThemeConstants;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 6082 $
+ */
+public class AddWindowAction
+{
+
+ /** . */
+ private PortalObjectManagerBean pomgr;
+
+ /** . */
+ private String instanceId;
+
+ /** . */
+ private String windowName;
+
+ public PortalObjectManagerBean getPortalObjectManager()
+ {
+ return pomgr;
+ }
+
+ public void setPortalObjectManager(PortalObjectManagerBean portalObjectManager)
+ {
+ this.pomgr = portalObjectManager;
+ }
+
+ public String getWindowName()
+ {
+ return windowName;
+ }
+
+ public void setWindowName(String windowName)
+ {
+ this.windowName = windowName;
+ }
+
+ public String getInstanceId()
+ {
+ return instanceId;
+ }
+
+ public void setInstanceId(String instanceId)
+ {
+ this.instanceId = instanceId;
+ }
+
+ /**
+ * Checks for duplicate window names on the page. Blank window names are not allowed and are controlled by the
+ * required attribute in the presentation page.
+ *
+ * @param context
+ * @param toValidate
+ * @param value
+ */
+ public void validateWindowName(FacesContext context, UIComponent toValidate, Object value)
+ {
+ String windowName = (String)value;
+
+ // check for empty string
+ if (windowName.startsWith(" "))
+ {
+ String error = "Window name cannot be blank!";
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, error, error);
+ throw new ValidatorException(message);
+ }
+
+ // check for duplicate window name
+ Page page = (Page)pomgr.getSelectedObject();
+ if (page.getWindow(windowName) != null)
+ {
+ String error = "Duplicate window name found on this page!";
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, error, error);
+ throw new ValidatorException(message);
+ }
+ }
+
+ public void execute()
+ {
+ try
+ {
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ ValueBinding vb = ctx.getApplication().createValueBinding("#{col}");
+ String region = (String)vb.getValue(ctx);
+ Page page = (Page)pomgr.getSelectedObject();
+
+ //
+ Window window = page.createWindow(windowName, ContentType.PORTLET, instanceId);
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION, region);
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + Integer.MAX_VALUE);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/CreateInstanceAction.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/CreateInstanceAction.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/CreateInstanceAction.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -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.portlet.management.actions;
-
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.core.portlet.management.InstanceManagerBean;
-import org.jboss.portal.core.portlet.management.PortletManagerBean;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.security.RoleSecurityBinding;
-import org.jboss.portal.security.SecurityConstants;
-import org.jboss.portal.security.spi.provider.DomainConfigurator;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.context.FacesContext;
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5915 $
- */
-public class CreateInstanceAction
-{
-
- /** . */
- private String instanceId;
-
- /** . */
- private PortletManagerBean portletMgr;
-
- /** . */
- private InstanceManagerBean instanceMgr;
-
- public String getInstanceId()
- {
- return instanceId;
- }
-
- public void setInstanceId(String instanceId)
- {
- this.instanceId = instanceId;
- }
-
- public PortletManagerBean getPortletManager()
- {
- return portletMgr;
- }
-
- public void setPortletManager(PortletManagerBean portletManager)
- {
- this.portletMgr = portletManager;
- }
-
- public InstanceManagerBean getInstanceManager()
- {
- return instanceMgr;
- }
-
- public void setInstanceManager(InstanceManagerBean instanceManager)
- {
- this.instanceMgr = instanceManager;
- }
-
- public String execute()
- {
- Portlet portlet = portletMgr.getSelectedPortlet();
- if (portlet == null)
- {
- // Todo validate here
- return null;
- }
- else
- {
- InstanceContainer container = instanceMgr.getInstanceContainer();
- try
- {
- Instance instance = container.createDefinition(instanceId, portlet.getContext().getId());
- instanceMgr.setSelectedId(instanceId);
-
- //
- DomainConfigurator configurator = instanceMgr.getDomainConfigurator();
- Set constraints = Collections.singleton(new RoleSecurityBinding("view", SecurityConstants.UNCHECKED_ROLE_NAME));
- configurator.setSecurityBindings(instance.getId(), constraints);
-
- //
- return "instances";
- }
- catch (Exception e)
- {
- FacesContext ctx = FacesContext.getCurrentInstance();
- FacesMessage msg = new FacesMessage("An instance with this name already exist");
- ctx.addMessage(null, msg);
- return null;
- }
- }
- }
-
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/CreateInstanceAction.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/CreateInstanceAction.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/CreateInstanceAction.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/CreateInstanceAction.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -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.portlet.management.actions;
+
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.core.portlet.management.InstanceManagerBean;
+import org.jboss.portal.core.portlet.management.PortletManagerBean;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.security.RoleSecurityBinding;
+import org.jboss.portal.security.SecurityConstants;
+import org.jboss.portal.security.spi.provider.DomainConfigurator;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5915 $
+ */
+public class CreateInstanceAction
+{
+
+ /** . */
+ private String instanceId;
+
+ /** . */
+ private PortletManagerBean portletMgr;
+
+ /** . */
+ private InstanceManagerBean instanceMgr;
+
+ public String getInstanceId()
+ {
+ return instanceId;
+ }
+
+ public void setInstanceId(String instanceId)
+ {
+ this.instanceId = instanceId;
+ }
+
+ public PortletManagerBean getPortletManager()
+ {
+ return portletMgr;
+ }
+
+ public void setPortletManager(PortletManagerBean portletManager)
+ {
+ this.portletMgr = portletManager;
+ }
+
+ public InstanceManagerBean getInstanceManager()
+ {
+ return instanceMgr;
+ }
+
+ public void setInstanceManager(InstanceManagerBean instanceManager)
+ {
+ this.instanceMgr = instanceManager;
+ }
+
+ public String execute()
+ {
+ Portlet portlet = portletMgr.getSelectedPortlet();
+ if (portlet == null)
+ {
+ // Todo validate here
+ return null;
+ }
+ else
+ {
+ InstanceContainer container = instanceMgr.getInstanceContainer();
+ try
+ {
+ Instance instance = container.createDefinition(instanceId, portlet.getContext().getId());
+ instanceMgr.setSelectedId(instanceId);
+
+ //
+ DomainConfigurator configurator = instanceMgr.getDomainConfigurator();
+ Set constraints = Collections.singleton(new RoleSecurityBinding("view", SecurityConstants.UNCHECKED_ROLE_NAME));
+ configurator.setSecurityBindings(instance.getId(), constraints);
+
+ //
+ return "instances";
+ }
+ catch (Exception e)
+ {
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ FacesMessage msg = new FacesMessage("An instance with this name already exist");
+ ctx.addMessage(null, msg);
+ return null;
+ }
+ }
+ }
+
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PortalAction.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PortalAction.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PortalAction.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,180 +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.portlet.management.actions;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.core.model.portal.PortalContainer;
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.model.portal.Portal;
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.PortalObjectPermission;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.portlet.management.PortalObjectManagerBean;
-import org.jboss.portal.security.RoleSecurityBinding;
-import org.jboss.portal.security.SecurityConstants;
-import org.jboss.portal.security.spi.provider.DomainConfigurator;
-import org.jboss.portal.theme.ThemeConstants;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.validator.ValidatorException;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5763 $
- */
-public class PortalAction
-{
-
- /** . */
- private PortalObjectManagerBean pomgr;
-
- /** . */
- private String portalName;
-
- //private String defaultPageName;
-
- /** . */
- private static final String ERROR_DUPE_NAME = "Duplicate Portal name found on this portal!";
-
- /** . */
- private static final String ERROR_EMPTY_NAME = "Portal name cannot be blank!";
-
- public PortalObjectManagerBean getPortalObjectManager()
- {
- return pomgr;
- }
-
- public void setPortalObjectManager(PortalObjectManagerBean portalObjectManager)
- {
- this.pomgr = portalObjectManager;
- }
-
- public String getPortalName()
- {
- return portalName;
- }
-
- public void setPortalName(String portalName)
- {
- this.portalName = portalName;
- }
-
- public String getDefaultPageName()
- {
- return pomgr.getSelectedObject().getDeclaredProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME);
- }
-
- public void setDefaultPageName(String defaultPageName)
- {
- if (defaultPageName != null && !defaultPageName.equals(""))
- {
- pomgr.getSelectedObject().setDeclaredProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME, defaultPageName);
- }
- else if (defaultPageName == null || defaultPageName.equals(""))
- {
- pomgr.getSelectedObject().setDeclaredProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME, null);
- }
-
- }
-
-
- /**
- * Checks for duplicate portal names on the portal instance. Blank page names are not allowed and are controlled by
- * the required attribute in the presentation page.
- *
- * @param context
- * @param toValidate
- * @param value
- */
- public void validatePortalName(FacesContext context, UIComponent toValidate, Object value)
- {
- String portalName = (String)value;
-
- // check for empty string
- if (portalName.startsWith(" "))
- {
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, PortalAction.ERROR_EMPTY_NAME, PortalAction.ERROR_EMPTY_NAME);
- throw new ValidatorException(message);
- }
-
- // Check for duplicate child name
- if (pomgr.getSelectedObject().getChild(portalName) != null)
- {
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, PortalAction.ERROR_DUPE_NAME, PortalAction.ERROR_DUPE_NAME);
- throw new ValidatorException(message);
- }
- }
-
- public void addPortal()
- {
- try
- {
- PortalContainer portalContainer = (PortalContainer)pomgr.getSelectedObject();
- Portal portal = portalContainer.createPortal(portalName);
- DomainConfigurator configurator = pomgr.getDomainConfigurator();
-
- // Initial portal permissions
- Set actions = new HashSet();
- actions.add(PortalObjectPermission.VIEW_ACTION);
- actions.add(PortalObjectPermission.PERSONALIZE_RECURSIVE_ACTION);
- RoleSecurityBinding binding = new RoleSecurityBinding(actions, SecurityConstants.UNCHECKED_ROLE_NAME);
- Set constraints = Collections.singleton(binding);
- configurator.setSecurityBindings(portal.getId().toString(PortalObjectId.CANONICAL_FORMAT), constraints);
-
- // We need to add initial layout sets to avoid problems...
- portal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_LAYOUT, "generic");
- portal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_THEME, "Nphalanx");
- portal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_RENDERSET, "divRenderer");
- portal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_STRATEGY, "maximizedRegion");
-
- //
- portal.getSupportedWindowStates().add(WindowState.MAXIMIZED);
- portal.getSupportedWindowStates().add(WindowState.MINIMIZED);
- portal.getSupportedWindowStates().add(WindowState.NORMAL);
-
- //
- portal.getSupportedModes().add(Mode.EDIT);
- portal.getSupportedModes().add(Mode.HELP);
- portal.getSupportedModes().add(Mode.VIEW);
-
- // Create the default page
- Page page = portal.createPage("default");
- constraints = Collections.singleton(new RoleSecurityBinding(PortalObjectPermission.VIEW_RECURSIVE_ACTION, SecurityConstants.UNCHECKED_ROLE_NAME));
- configurator.setSecurityBindings(page.getId().toString(PortalObjectId.CANONICAL_FORMAT), constraints);
-
- portal.setDeclaredProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME, page.getName());
-
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PortalAction.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PortalAction.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PortalAction.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PortalAction.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,180 @@
+/******************************************************************************
+ * 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.portlet.management.actions;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.core.model.portal.PortalContainer;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.PortalObjectPermission;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.portlet.management.PortalObjectManagerBean;
+import org.jboss.portal.security.RoleSecurityBinding;
+import org.jboss.portal.security.SecurityConstants;
+import org.jboss.portal.security.spi.provider.DomainConfigurator;
+import org.jboss.portal.theme.ThemeConstants;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5763 $
+ */
+public class PortalAction
+{
+
+ /** . */
+ private PortalObjectManagerBean pomgr;
+
+ /** . */
+ private String portalName;
+
+ //private String defaultPageName;
+
+ /** . */
+ private static final String ERROR_DUPE_NAME = "Duplicate Portal name found on this portal!";
+
+ /** . */
+ private static final String ERROR_EMPTY_NAME = "Portal name cannot be blank!";
+
+ public PortalObjectManagerBean getPortalObjectManager()
+ {
+ return pomgr;
+ }
+
+ public void setPortalObjectManager(PortalObjectManagerBean portalObjectManager)
+ {
+ this.pomgr = portalObjectManager;
+ }
+
+ public String getPortalName()
+ {
+ return portalName;
+ }
+
+ public void setPortalName(String portalName)
+ {
+ this.portalName = portalName;
+ }
+
+ public String getDefaultPageName()
+ {
+ return pomgr.getSelectedObject().getDeclaredProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME);
+ }
+
+ public void setDefaultPageName(String defaultPageName)
+ {
+ if (defaultPageName != null && !defaultPageName.equals(""))
+ {
+ pomgr.getSelectedObject().setDeclaredProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME, defaultPageName);
+ }
+ else if (defaultPageName == null || defaultPageName.equals(""))
+ {
+ pomgr.getSelectedObject().setDeclaredProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME, null);
+ }
+
+ }
+
+
+ /**
+ * Checks for duplicate portal names on the portal instance. Blank page names are not allowed and are controlled by
+ * the required attribute in the presentation page.
+ *
+ * @param context
+ * @param toValidate
+ * @param value
+ */
+ public void validatePortalName(FacesContext context, UIComponent toValidate, Object value)
+ {
+ String portalName = (String)value;
+
+ // check for empty string
+ if (portalName.startsWith(" "))
+ {
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, PortalAction.ERROR_EMPTY_NAME, PortalAction.ERROR_EMPTY_NAME);
+ throw new ValidatorException(message);
+ }
+
+ // Check for duplicate child name
+ if (pomgr.getSelectedObject().getChild(portalName) != null)
+ {
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, PortalAction.ERROR_DUPE_NAME, PortalAction.ERROR_DUPE_NAME);
+ throw new ValidatorException(message);
+ }
+ }
+
+ public void addPortal()
+ {
+ try
+ {
+ PortalContainer portalContainer = (PortalContainer)pomgr.getSelectedObject();
+ Portal portal = portalContainer.createPortal(portalName);
+ DomainConfigurator configurator = pomgr.getDomainConfigurator();
+
+ // Initial portal permissions
+ Set actions = new HashSet();
+ actions.add(PortalObjectPermission.VIEW_ACTION);
+ actions.add(PortalObjectPermission.PERSONALIZE_RECURSIVE_ACTION);
+ RoleSecurityBinding binding = new RoleSecurityBinding(actions, SecurityConstants.UNCHECKED_ROLE_NAME);
+ Set constraints = Collections.singleton(binding);
+ configurator.setSecurityBindings(portal.getId().toString(PortalObjectId.CANONICAL_FORMAT), constraints);
+
+ // We need to add initial layout sets to avoid problems...
+ portal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_LAYOUT, "generic");
+ portal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_THEME, "Nphalanx");
+ portal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_RENDERSET, "divRenderer");
+ portal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_STRATEGY, "maximizedRegion");
+
+ //
+ portal.getSupportedWindowStates().add(WindowState.MAXIMIZED);
+ portal.getSupportedWindowStates().add(WindowState.MINIMIZED);
+ portal.getSupportedWindowStates().add(WindowState.NORMAL);
+
+ //
+ portal.getSupportedModes().add(Mode.EDIT);
+ portal.getSupportedModes().add(Mode.HELP);
+ portal.getSupportedModes().add(Mode.VIEW);
+
+ // Create the default page
+ Page page = portal.createPage("default");
+ constraints = Collections.singleton(new RoleSecurityBinding(PortalObjectPermission.VIEW_RECURSIVE_ACTION, SecurityConstants.UNCHECKED_ROLE_NAME));
+ configurator.setSecurityBindings(page.getId().toString(PortalObjectId.CANONICAL_FORMAT), constraints);
+
+ portal.setDeclaredProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME, page.getName());
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PreferenceAction.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PreferenceAction.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PreferenceAction.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,182 +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.portlet.management.actions;
-
-import org.jboss.portal.common.value.StringValue;
-import org.jboss.portal.common.value.Value;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.portlet.management.InstanceManagerBean;
-import org.jboss.portal.faces.matrix.AbstractCellAction;
-import org.jboss.portal.faces.matrix.Cell;
-import org.jboss.portal.faces.matrix.Row;
-import org.jboss.portal.faces.matrix.RowSetModel;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.state.PropertyChange;
-import org.jboss.portal.portlet.state.PropertyMap;
-import org.jboss.portal.portlet.state.SimplePropertyMap;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class PreferenceAction extends AbstractCellAction
-{
-
- /** The instance manager bean. */
- private InstanceManagerBean manager;
-
- public InstanceManagerBean getManager()
- {
- return manager;
- }
-
- public void setManager(InstanceManagerBean manager)
- {
- this.manager = manager;
- }
-
- public void appendLine(String appendedValue)
- {
- try
- {
- //
- Row row = getSelectedRow();
- String key = row.getHandback();
-
- //
- Instance instance = manager.getSelectedInstance();
- PropertyMap prefs = instance.getProperties();
-
- Value value = prefs.getProperty(key);
- String[] strings = value.asStringArray();
- String[] strings2 = new String[strings.length + 1];
- System.arraycopy(strings, 0, strings2, 0, strings.length);
- strings2[strings.length] = appendedValue;
- Value value2 = new StringValue(strings2);
-
- //
- PropertyChange change = PropertyChange.newUpdate(key, value2);
- instance.setProperties(new PropertyChange[]{change});
- }
- catch (PortletInvokerException e)
- {
- throw new Error("Handle me gracefully please", e);
- }
- }
-
- public void deleteLine(int index)
- {
- try
- {
- Row row = getSelectedRow();
- String key = row.getHandback();
-
- //
- Instance instance = manager.getSelectedInstance();
- PropertyMap prefs = instance.getProperties();
-
- //
- Value value = prefs.getProperty(key);
- String[] strings = value.asStringArray();
- List list = new ArrayList(Arrays.asList(strings));
- list.remove(index);
- String[] strings2 = (String[])list.toArray(new String[list.size()]);
- Value value2 = new StringValue(strings2);
-
- //
- PropertyChange change = PropertyChange.newUpdate(key, value2);
- instance.setProperties(new PropertyChange[]{change});
- }
- catch (PortletInvokerException e)
- {
- throw new Error("Handle me gracefully please", e);
- }
- }
-
- public void updateCell()
- {
- try
- {
- Cell cell = manager.getSelectedPreferences().getSelectedPreference();
- StringValue value = new StringValue(cell.getValue());
-
- //
- Row row = cell.getRow();
- String key = row.getHandback();
-
- //
- Instance instance = manager.getSelectedInstance();
-
- //
- PropertyChange change = PropertyChange.newUpdate(key, value);
- instance.setProperties(new PropertyChange[]{change});
-
- // Unselect the current row has we consider that the update work is done
- manager.setSelectedRow(null);
- }
- catch (PortletInvokerException e)
- {
- throw new Error("Handle me gracefully please", e);
- }
- }
-
-
- public void selectRow(int rowIndex)
- {
- manager.setSelectedRow(new Integer(rowIndex));
- }
-
- public void deleteRow(Row row)
- {
- try
- {
- //
- Instance instance = manager.getSelectedInstance();
- PropertyMap prefs = instance.getProperties();
- PropertyMap newPrefs = new SimplePropertyMap(prefs);
-
- //
- String key = row.getHandback();
-
- //
- PropertyChange change = PropertyChange.newReset(key);
- instance.setProperties(new PropertyChange[]{change});
- }
- catch (PortletInvokerException e)
- {
- throw new Error("Handle me gracefully please", e);
- }
- }
-
- private Row getSelectedRow()
- {
- int selectedRow = manager.getSelectedRow().intValue();
- RowSetModel model = manager.getSelectedPreferences().getModel();
- Row row = model.getRow(selectedRow);
- return row;
- }
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PreferenceAction.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PreferenceAction.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PreferenceAction.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PreferenceAction.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,182 @@
+/******************************************************************************
+ * 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.portlet.management.actions;
+
+import org.jboss.portal.common.value.StringValue;
+import org.jboss.portal.common.value.Value;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.portlet.management.InstanceManagerBean;
+import org.jboss.portal.faces.matrix.AbstractCellAction;
+import org.jboss.portal.faces.matrix.Cell;
+import org.jboss.portal.faces.matrix.Row;
+import org.jboss.portal.faces.matrix.RowSetModel;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.state.PropertyChange;
+import org.jboss.portal.portlet.state.PropertyMap;
+import org.jboss.portal.portlet.state.SimplePropertyMap;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class PreferenceAction extends AbstractCellAction
+{
+
+ /** The instance manager bean. */
+ private InstanceManagerBean manager;
+
+ public InstanceManagerBean getManager()
+ {
+ return manager;
+ }
+
+ public void setManager(InstanceManagerBean manager)
+ {
+ this.manager = manager;
+ }
+
+ public void appendLine(String appendedValue)
+ {
+ try
+ {
+ //
+ Row row = getSelectedRow();
+ String key = row.getHandback();
+
+ //
+ Instance instance = manager.getSelectedInstance();
+ PropertyMap prefs = instance.getProperties();
+
+ Value value = prefs.getProperty(key);
+ String[] strings = value.asStringArray();
+ String[] strings2 = new String[strings.length + 1];
+ System.arraycopy(strings, 0, strings2, 0, strings.length);
+ strings2[strings.length] = appendedValue;
+ Value value2 = new StringValue(strings2);
+
+ //
+ PropertyChange change = PropertyChange.newUpdate(key, value2);
+ instance.setProperties(new PropertyChange[]{change});
+ }
+ catch (PortletInvokerException e)
+ {
+ throw new Error("Handle me gracefully please", e);
+ }
+ }
+
+ public void deleteLine(int index)
+ {
+ try
+ {
+ Row row = getSelectedRow();
+ String key = row.getHandback();
+
+ //
+ Instance instance = manager.getSelectedInstance();
+ PropertyMap prefs = instance.getProperties();
+
+ //
+ Value value = prefs.getProperty(key);
+ String[] strings = value.asStringArray();
+ List list = new ArrayList(Arrays.asList(strings));
+ list.remove(index);
+ String[] strings2 = (String[])list.toArray(new String[list.size()]);
+ Value value2 = new StringValue(strings2);
+
+ //
+ PropertyChange change = PropertyChange.newUpdate(key, value2);
+ instance.setProperties(new PropertyChange[]{change});
+ }
+ catch (PortletInvokerException e)
+ {
+ throw new Error("Handle me gracefully please", e);
+ }
+ }
+
+ public void updateCell()
+ {
+ try
+ {
+ Cell cell = manager.getSelectedPreferences().getSelectedPreference();
+ StringValue value = new StringValue(cell.getValue());
+
+ //
+ Row row = cell.getRow();
+ String key = row.getHandback();
+
+ //
+ Instance instance = manager.getSelectedInstance();
+
+ //
+ PropertyChange change = PropertyChange.newUpdate(key, value);
+ instance.setProperties(new PropertyChange[]{change});
+
+ // Unselect the current row has we consider that the update work is done
+ manager.setSelectedRow(null);
+ }
+ catch (PortletInvokerException e)
+ {
+ throw new Error("Handle me gracefully please", e);
+ }
+ }
+
+
+ public void selectRow(int rowIndex)
+ {
+ manager.setSelectedRow(new Integer(rowIndex));
+ }
+
+ public void deleteRow(Row row)
+ {
+ try
+ {
+ //
+ Instance instance = manager.getSelectedInstance();
+ PropertyMap prefs = instance.getProperties();
+ PropertyMap newPrefs = new SimplePropertyMap(prefs);
+
+ //
+ String key = row.getHandback();
+
+ //
+ PropertyChange change = PropertyChange.newReset(key);
+ instance.setProperties(new PropertyChange[]{change});
+ }
+ catch (PortletInvokerException e)
+ {
+ throw new Error("Handle me gracefully please", e);
+ }
+ }
+
+ private Row getSelectedRow()
+ {
+ int selectedRow = manager.getSelectedRow().intValue();
+ RowSetModel model = manager.getSelectedPreferences().getModel();
+ Row row = model.getRow(selectedRow);
+ return row;
+ }
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PropertyAction.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PropertyAction.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PropertyAction.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,137 +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.portlet.management.actions;
-
-import org.apache.myfaces.component.html.ext.HtmlDataTable;
-import org.jboss.logging.Logger;
-import org.jboss.portal.core.portlet.management.PortalObjectManagerBean;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.validator.ValidatorException;
-
-/**
- * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
- * @version $Revision: 5448 $
- */
-public class PropertyAction
-{
- private Logger log = Logger.getLogger(getClass());
-
- /** . */
- private PortalObjectManagerBean pomgr;
-
- private HtmlDataTable propertyDataTable;
-
- private String selectedProperty;
-
- private String propertyValue;
-
- private static final String ERROR_WRONG_NAME = "Wrong property name!";
-
- private static final String ERROR_EMPTY_NAME = "Property name cannot be blank!";
-
- public PortalObjectManagerBean getPortalObjectManager()
- {
- //don't know why but this isn't injected properly in faces-config.xml
- if (pomgr == null)
- {
- FacesContext ctx = FacesContext.getCurrentInstance();
- pomgr = (PortalObjectManagerBean)ctx.getApplication().createValueBinding("#{portalobjectmgr}").getValue(ctx);
- }
- return pomgr;
- }
-
- public void setPortalObjectManager(PortalObjectManagerBean portalObjectManager)
- {
- this.pomgr = portalObjectManager;
- }
-
- public String getSelectedProperty()
- {
- return selectedProperty;
- }
-
- public void setSelectedProperty(String selectedProperty)
- {
- this.selectedProperty = selectedProperty;
- }
-
- public HtmlDataTable getPropertyDataTable()
- {
- return propertyDataTable;
- }
-
- public void setPropertyDataTable(HtmlDataTable propertyDataTable)
- {
- this.propertyDataTable = propertyDataTable;
- }
-
- public String getPropertyValue()
- {
- return propertyValue;
- }
-
- public void setPropertyValue(String propertyValue)
- {
- this.propertyValue = propertyValue;
- }
-
-
- public void validatePropertyName(FacesContext context, UIComponent toValidate, Object value)
- {
- String propertyName = (String)value;
-
- // check for empty string
- if (propertyName == null || propertyName.startsWith(" ") || propertyName.equals(""))
- {
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, PropertyAction.ERROR_EMPTY_NAME, PropertyAction.ERROR_EMPTY_NAME);
- throw new ValidatorException(message);
- }
-
-
- }
-
- public void selectProperty()
- {
- String[] property = (String[])getPropertyDataTable().getRowData();
- selectedProperty = property[0];
- propertyValue = property[1];
- }
-
- public void removeProperty()
- {
- String[] property = (String[])getPropertyDataTable().getRowData();
- getPortalObjectManager().getSelectedObject().setDeclaredProperty(property[0], null);
- }
-
- public void updateProperty()
- {
- if (!(getSelectedProperty() == null || getSelectedProperty().equals("") || getSelectedProperty().startsWith(" ")))
- {
- getPortalObjectManager().getSelectedObject().setDeclaredProperty(getSelectedProperty(), getPropertyValue());
- }
- }
-
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PropertyAction.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PropertyAction.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PropertyAction.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/PropertyAction.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,137 @@
+/******************************************************************************
+ * 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.portlet.management.actions;
+
+import org.apache.myfaces.component.html.ext.HtmlDataTable;
+import org.jboss.logging.Logger;
+import org.jboss.portal.core.portlet.management.PortalObjectManagerBean;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 5448 $
+ */
+public class PropertyAction
+{
+ private Logger log = Logger.getLogger(getClass());
+
+ /** . */
+ private PortalObjectManagerBean pomgr;
+
+ private HtmlDataTable propertyDataTable;
+
+ private String selectedProperty;
+
+ private String propertyValue;
+
+ private static final String ERROR_WRONG_NAME = "Wrong property name!";
+
+ private static final String ERROR_EMPTY_NAME = "Property name cannot be blank!";
+
+ public PortalObjectManagerBean getPortalObjectManager()
+ {
+ //don't know why but this isn't injected properly in faces-config.xml
+ if (pomgr == null)
+ {
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ pomgr = (PortalObjectManagerBean)ctx.getApplication().createValueBinding("#{portalobjectmgr}").getValue(ctx);
+ }
+ return pomgr;
+ }
+
+ public void setPortalObjectManager(PortalObjectManagerBean portalObjectManager)
+ {
+ this.pomgr = portalObjectManager;
+ }
+
+ public String getSelectedProperty()
+ {
+ return selectedProperty;
+ }
+
+ public void setSelectedProperty(String selectedProperty)
+ {
+ this.selectedProperty = selectedProperty;
+ }
+
+ public HtmlDataTable getPropertyDataTable()
+ {
+ return propertyDataTable;
+ }
+
+ public void setPropertyDataTable(HtmlDataTable propertyDataTable)
+ {
+ this.propertyDataTable = propertyDataTable;
+ }
+
+ public String getPropertyValue()
+ {
+ return propertyValue;
+ }
+
+ public void setPropertyValue(String propertyValue)
+ {
+ this.propertyValue = propertyValue;
+ }
+
+
+ public void validatePropertyName(FacesContext context, UIComponent toValidate, Object value)
+ {
+ String propertyName = (String)value;
+
+ // check for empty string
+ if (propertyName == null || propertyName.startsWith(" ") || propertyName.equals(""))
+ {
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, PropertyAction.ERROR_EMPTY_NAME, PropertyAction.ERROR_EMPTY_NAME);
+ throw new ValidatorException(message);
+ }
+
+
+ }
+
+ public void selectProperty()
+ {
+ String[] property = (String[])getPropertyDataTable().getRowData();
+ selectedProperty = property[0];
+ propertyValue = property[1];
+ }
+
+ public void removeProperty()
+ {
+ String[] property = (String[])getPropertyDataTable().getRowData();
+ getPortalObjectManager().getSelectedObject().setDeclaredProperty(property[0], null);
+ }
+
+ public void updateProperty()
+ {
+ if (!(getSelectedProperty() == null || getSelectedProperty().equals("") || getSelectedProperty().startsWith(" ")))
+ {
+ getPortalObjectManager().getSelectedObject().setDeclaredProperty(getSelectedProperty(), getPropertyValue());
+ }
+ }
+
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/ThemePropertyAction.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/ThemePropertyAction.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/ThemePropertyAction.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,201 +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.portlet.management.actions;
-
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.portlet.management.PortalObjectManagerBean;
-import org.jboss.portal.theme.ThemeConstants;
-
-/**
- * @author <a href="mailto:mholzner at novell.com">Martin Holzner</a>
- * @version $Revision: 5448 $
- */
-public class ThemePropertyAction
-{
-
- /** . */
- private PortalObjectManagerBean pomgr;
-
- /** . */
- private String layoutName;
-
- /** . */
- private String themeName;
-
- /** . */
- private String renderSetName;
-
- /** . */
- private String strategyName;
-
- /** . */
- private String windowRendererName;
-
- /** . */
- private String decorationRendererName;
-
- /** . */
- private String portletRendererName;
-
- public PortalObjectManagerBean getPortalObjectManager()
- {
- return pomgr;
- }
-
- public void setPortalObjectManager(PortalObjectManagerBean portalObjectManager)
- {
- this.pomgr = portalObjectManager;
-
- layoutName = pomgr.getThemes().getLayoutName();
- themeName = pomgr.getThemes().getThemeName();
- renderSetName = pomgr.getThemes().getRenderSetName();
- strategyName = pomgr.getThemes().getStrategyName();
- windowRendererName = pomgr.getThemes().getWindowRenderer();
- decorationRendererName = pomgr.getThemes().getDecorationRenderer();
- portletRendererName = pomgr.getThemes().getPortletRenderer();
- }
-
- public String getLayoutName()
- {
- return layoutName;
- }
-
- public void setLayoutName(String layoutName)
- {
- this.layoutName = ("".equals(layoutName) ? null : layoutName);
- }
-
- public String getThemeName()
- {
- return themeName;
- }
-
- public void setThemeName(String themeName)
- {
- this.themeName = ("".equals(themeName) ? null : themeName);
- }
-
- public String getRenderSetName()
- {
- return renderSetName;
- }
-
- public void setRenderSetName(String renderSetName)
- {
- this.renderSetName = ("".equals(renderSetName) ? null : renderSetName);
- }
-
- public String getStrategyName()
- {
- return strategyName;
- }
-
- public void setStrategyName(String strategyName)
- {
- this.strategyName = ("".equals(strategyName) ? null : strategyName);
- }
-
- public String getWindowRendererName()
- {
- return windowRendererName;
- }
-
- public void setWindowRendererName(String windowRendererName)
- {
- this.windowRendererName = ("".equals(windowRendererName) ? null : windowRendererName);
- }
-
- public String getDecorationRendererName()
- {
- return decorationRendererName;
- }
-
- public void setDecorationRendererName(String decorationRendererName)
- {
- this.decorationRendererName = ("".equals(decorationRendererName) ? null : decorationRendererName);
- }
-
- public String getPortletRendererName()
- {
- return portletRendererName;
- }
-
- public void setPortletRendererName(String portletRendererName)
- {
- this.portletRendererName = ("".equals(portletRendererName) ? null : portletRendererName);
- }
-
- public void execute()
- {
- PortalObject po = pomgr.getSelectedObject();
-
- if (po.getType() == PortalObject.TYPE_PORTAL || po.getType() == PortalObject.TYPE_PAGE)
- {
- if (layoutName == null || !layoutName.equals(pomgr.getThemes().getLayoutName()))
- {
-// log.info("set layout to '" + layoutName + "' for " + po.getName());
- po.setDeclaredProperty(ThemeConstants.PORTAL_PROP_LAYOUT, layoutName);
- }
- if (themeName == null || !themeName.equals(pomgr.getThemes().getThemeName()))
- {
- if ("".equals(themeName))
- {
- }
-// log.info("set theme to '" + themeName + "' for " + po.getName());
- po.setDeclaredProperty(ThemeConstants.PORTAL_PROP_THEME, themeName);
- }
- if (renderSetName == null || !renderSetName.equals(pomgr.getThemes().getRenderSetName()))
- {
-// log.info("set renderSet to '" + renderSetName + "' for " + po.getName());
- po.setDeclaredProperty(ThemeConstants.PORTAL_PROP_RENDERSET, renderSetName);
- }
- if (strategyName == null || !strategyName.equals(pomgr.getThemes().getStrategyName()))
- {
-// log.info("set strategy to '" + strategyName + "' for " + po.getName());
- po.setDeclaredProperty(ThemeConstants.PORTAL_PROP_STRATEGY, strategyName);
- }
- }
- else if (po.getType() == PortalObject.TYPE_WINDOW)
- {
- if (windowRendererName == null || !windowRendererName.equals(pomgr.getThemes().getWindowRenderer()))
- {
-// log.info("set window renderer to '" + windowRendererName + "' for " + po.getName());
- po.setDeclaredProperty(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER, windowRendererName);
- }
- if (decorationRendererName == null || !decorationRendererName.equals(pomgr.getThemes().getDecorationRenderer()))
- {
-// log.info("set decoration renderer to '" + decorationRendererName + "' for " + po.getName());
- po.setDeclaredProperty(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER, decorationRendererName);
- }
- if (portletRendererName == null || !portletRendererName.equals(pomgr.getThemes().getPortletRenderer()))
- {
-// log.info("set portlet renderer to '" + portletRendererName + "' for " + po.getName());
- po.setDeclaredProperty(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER, portletRendererName);
- }
- }
- else
- {
-// log.error("attempt to set a theme property on an unknown node type: " + po);
- }
- }
-}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/ThemePropertyAction.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/ThemePropertyAction.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/ThemePropertyAction.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java-portal/org/jboss/portal/core/portlet/management/actions/ThemePropertyAction.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,201 @@
+/******************************************************************************
+ * 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.portlet.management.actions;
+
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.portlet.management.PortalObjectManagerBean;
+import org.jboss.portal.theme.ThemeConstants;
+
+/**
+ * @author <a href="mailto:mholzner at novell.com">Martin Holzner</a>
+ * @version $Revision: 5448 $
+ */
+public class ThemePropertyAction
+{
+
+ /** . */
+ private PortalObjectManagerBean pomgr;
+
+ /** . */
+ private String layoutName;
+
+ /** . */
+ private String themeName;
+
+ /** . */
+ private String renderSetName;
+
+ /** . */
+ private String strategyName;
+
+ /** . */
+ private String windowRendererName;
+
+ /** . */
+ private String decorationRendererName;
+
+ /** . */
+ private String portletRendererName;
+
+ public PortalObjectManagerBean getPortalObjectManager()
+ {
+ return pomgr;
+ }
+
+ public void setPortalObjectManager(PortalObjectManagerBean portalObjectManager)
+ {
+ this.pomgr = portalObjectManager;
+
+ layoutName = pomgr.getThemes().getLayoutName();
+ themeName = pomgr.getThemes().getThemeName();
+ renderSetName = pomgr.getThemes().getRenderSetName();
+ strategyName = pomgr.getThemes().getStrategyName();
+ windowRendererName = pomgr.getThemes().getWindowRenderer();
+ decorationRendererName = pomgr.getThemes().getDecorationRenderer();
+ portletRendererName = pomgr.getThemes().getPortletRenderer();
+ }
+
+ public String getLayoutName()
+ {
+ return layoutName;
+ }
+
+ public void setLayoutName(String layoutName)
+ {
+ this.layoutName = ("".equals(layoutName) ? null : layoutName);
+ }
+
+ public String getThemeName()
+ {
+ return themeName;
+ }
+
+ public void setThemeName(String themeName)
+ {
+ this.themeName = ("".equals(themeName) ? null : themeName);
+ }
+
+ public String getRenderSetName()
+ {
+ return renderSetName;
+ }
+
+ public void setRenderSetName(String renderSetName)
+ {
+ this.renderSetName = ("".equals(renderSetName) ? null : renderSetName);
+ }
+
+ public String getStrategyName()
+ {
+ return strategyName;
+ }
+
+ public void setStrategyName(String strategyName)
+ {
+ this.strategyName = ("".equals(strategyName) ? null : strategyName);
+ }
+
+ public String getWindowRendererName()
+ {
+ return windowRendererName;
+ }
+
+ public void setWindowRendererName(String windowRendererName)
+ {
+ this.windowRendererName = ("".equals(windowRendererName) ? null : windowRendererName);
+ }
+
+ public String getDecorationRendererName()
+ {
+ return decorationRendererName;
+ }
+
+ public void setDecorationRendererName(String decorationRendererName)
+ {
+ this.decorationRendererName = ("".equals(decorationRendererName) ? null : decorationRendererName);
+ }
+
+ public String getPortletRendererName()
+ {
+ return portletRendererName;
+ }
+
+ public void setPortletRendererName(String portletRendererName)
+ {
+ this.portletRendererName = ("".equals(portletRendererName) ? null : portletRendererName);
+ }
+
+ public void execute()
+ {
+ PortalObject po = pomgr.getSelectedObject();
+
+ if (po.getType() == PortalObject.TYPE_PORTAL || po.getType() == PortalObject.TYPE_PAGE)
+ {
+ if (layoutName == null || !layoutName.equals(pomgr.getThemes().getLayoutName()))
+ {
+// log.info("set layout to '" + layoutName + "' for " + po.getName());
+ po.setDeclaredProperty(ThemeConstants.PORTAL_PROP_LAYOUT, layoutName);
+ }
+ if (themeName == null || !themeName.equals(pomgr.getThemes().getThemeName()))
+ {
+ if ("".equals(themeName))
+ {
+ }
+// log.info("set theme to '" + themeName + "' for " + po.getName());
+ po.setDeclaredProperty(ThemeConstants.PORTAL_PROP_THEME, themeName);
+ }
+ if (renderSetName == null || !renderSetName.equals(pomgr.getThemes().getRenderSetName()))
+ {
+// log.info("set renderSet to '" + renderSetName + "' for " + po.getName());
+ po.setDeclaredProperty(ThemeConstants.PORTAL_PROP_RENDERSET, renderSetName);
+ }
+ if (strategyName == null || !strategyName.equals(pomgr.getThemes().getStrategyName()))
+ {
+// log.info("set strategy to '" + strategyName + "' for " + po.getName());
+ po.setDeclaredProperty(ThemeConstants.PORTAL_PROP_STRATEGY, strategyName);
+ }
+ }
+ else if (po.getType() == PortalObject.TYPE_WINDOW)
+ {
+ if (windowRendererName == null || !windowRendererName.equals(pomgr.getThemes().getWindowRenderer()))
+ {
+// log.info("set window renderer to '" + windowRendererName + "' for " + po.getName());
+ po.setDeclaredProperty(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER, windowRendererName);
+ }
+ if (decorationRendererName == null || !decorationRendererName.equals(pomgr.getThemes().getDecorationRenderer()))
+ {
+// log.info("set decoration renderer to '" + decorationRendererName + "' for " + po.getName());
+ po.setDeclaredProperty(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER, decorationRendererName);
+ }
+ if (portletRendererName == null || !portletRendererName.equals(pomgr.getThemes().getPortletRenderer()))
+ {
+// log.info("set portlet renderer to '" + portletRendererName + "' for " + po.getName());
+ po.setDeclaredProperty(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER, portletRendererName);
+ }
+ }
+ else
+ {
+// log.error("attempt to set a theme property on an unknown node type: " + po);
+ }
+ }
+}
Modified: labs/jbosslabs/trunk/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/CmsLinkParser.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/CmsLinkParser.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/CmsLinkParser.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -2,6 +2,7 @@
import org.jboss.shotoku.tools.Tools;
import org.jboss.forge.common.ForgeHelper;
+import org.jboss.forge.common.Constants;
import org.jboss.forge.common.projects.ProjectsHelper;
/**
@@ -9,7 +10,7 @@
*/
public class CmsLinkParser {
public static final String PRJ_FREEZONE_LINK_PREFIX =
- ForgeHelper.LABS_PORTAL + "/" +
+ Constants.LABS_PORTAL + "/" +
ProjectsHelper.MEMBERS_DIR + "/";
public static final int PRJ_FREEZONE_LINK_PREFIX_LEN =
PRJ_FREEZONE_LINK_PREFIX.length();
Modified: labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -72,14 +72,16 @@
* checked in the url mapper).
*/
String projectId = ProjectsHelper.getSelectedProjectId(request);
- String portalName = ForgeHelper.getPortalName(request);
+ System.out.println("PROJECT ID: " + projectId);
- if ((projectId != null)
+ String portalName = ForgeHelper.getPortalName(request);
+
+ if ((projectId != null) && (!"default".equals(projectId))
&& (!ProjectsHelper.getProjects(portalName)
.projectExists(
new RenderRequestPermissionsChecker(request),
projectId))) {
- sendResponseNotFound(response);
+ sendResponseNotFound(response);
return;
}
@@ -99,13 +101,15 @@
Object requestedPathFromPref = request.getPreferences().getValue(
"page", null);
- if (requestedPathFromPref != null) {
+ //System.out.println("REQ PATH FROM PREF: " + requestedPathFromPref);
+
+ if (!Tools.isEmpty((String) requestedPathFromPref)) {
requestedPath = (String) requestedPathFromPref;
}
if (requestedPath == null) {
- sendResponseNotFound(response);
- return;
+ requestedPath = "default/members/" + projectId + "/freezone/index.html";
+ //sendResponseNotFound(response);
}
Node requestedNode;
@@ -244,7 +248,7 @@
protected void doEdit(JBossRenderRequest request,
JBossRenderResponse response) throws PortletException,
- PortletSecurityException, IOException {
+ IOException {
String portalName = ForgeHelper.getPortalName(request);
// We'll be sending text/html for sure.
@@ -273,7 +277,7 @@
}
public void processAction(ActionRequest request, ActionResponse response)
- throws PortletException, PortletSecurityException, IOException {
+ throws PortletException, IOException {
// Passing necessary parameters.
response.setRenderParameter(Constants.ATTR_REQ_PATH, request
.getParameter(Constants.ATTR_REQ_PATH));
Copied: labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/TestServlet.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-freezone/src/java/org/jboss/forge/projects/freezone/TestServlet.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/TestServlet.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/TestServlet.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,28 @@
+package org.jboss.forge.projects.freezone;
+
+import org.jboss.forge.common.ejb3.LabsServices;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import javax.naming.NamingException;
+import java.io.IOException;
+
+/**
+ * TO REMOVE! Just for testing.
+ * @author <a href="mailto:adamw at aster.pl">Adam Warski</a>
+ */
+public class TestServlet extends HttpServlet {
+
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ response.setContentType("text/html");
+ response.getWriter().println("Calling project pages service bean.");
+
+ try {
+ LabsServices.getProjectPagesService().updatePages("jbossas");
+ } catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+}
Copied: labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/TestServlet2.java (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-freezone/src/java/org/jboss/forge/projects/freezone/TestServlet2.java)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/TestServlet2.java (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/TestServlet2.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,28 @@
+package org.jboss.forge.projects.freezone;
+
+import org.jboss.forge.common.ejb3.LabsServices;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import javax.naming.NamingException;
+import java.io.IOException;
+
+/**
+ * TO REMOVE! Just for testing.
+ * @author <a href="mailto:adamw at aster.pl">Adam Warski</a>
+ */
+public class TestServlet2 extends HttpServlet {
+
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ response.setContentType("text/html");
+ response.getWriter().println("Calling project pages service bean 2. <br />");
+
+ try {
+ response.getWriter().println(LabsServices.getProjectPagesService().getTree());
+ } catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+}
Modified: labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/jboss-app.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/jboss-app.xml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/jboss-app.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,3 +1,3 @@
<jboss-app>
- <app-name>prj-freezone</app-name>
+ <app-name>freezone</app-name>
</jboss-app>
Modified: labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/portlet-instances.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/portlet-instances.xml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/portlet-instances.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,49 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<deployments>
- <deployment>
- <if-exists>overwrite</if-exists>
- <instance>
- <instance-id>PrjFreezonePortletInstance</instance-id>
- <portlet-ref>PrjFreezonePortlet</portlet-ref>
- </instance>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <instance>
- <instance-id>FreezoneDefaultPagePortletInstance</instance-id>
- <portlet-ref>PrjFreezonePortlet</portlet-ref>
- <preferences>
- <preference>
- <name>page</name>
- <value>default/members/default/freezone/welcome.html</value>
- </preference>
- </preferences>
- </instance>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <instance>
- <instance-id>FreezoneRightPanelPortletInstance</instance-id>
- <portlet-ref>PrjFreezonePortlet</portlet-ref>
- <preferences>
- <preference>
- <name>page</name>
- <value>default/members/default/freezone/rightPanelContent.html</value>
- </preference>
- </preferences>
- </instance>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <instance>
- <instance-id>FreezoneMostDownloadedPortletInstance</instance-id>
- <portlet-ref>PrjFreezonePortlet</portlet-ref>
- <preferences>
- <preference>
- <name>page</name>
- <value>default/members/default/freezone/mostdownloaded.html</value>
- </preference>
- </preferences>
- </instance>
- </deployment>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <instance>
+ <instance-id>FreezoneDefaultPageInstance</instance-id>
+ <portlet-ref>FreezonePortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>page</name>
+ <value>default/members/default/freezone/welcome.html</value>
+ </preference>
+ </preferences>
+ </instance>
+ </deployment>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <instance>
+ <instance-id>FreezoneRightPanelInstance</instance-id>
+ <portlet-ref>FreezonePortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>page</name>
+ <value>default/members/default/freezone/rightPanelContent.html</value>
+ </preference>
+ </preferences>
+ </instance>
+ </deployment>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <instance>
+ <instance-id>FreezoneMostDownloadedInstance</instance-id>
+ <portlet-ref>FreezonePortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>page</name>
+ <value>default/members/default/freezone/mostdownloaded.html</value>
+ </preference>
+ </preferences>
+ </instance>
+ </deployment>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <instance>
+ <instance-id>FreezoneNavigationInstance</instance-id>
+ <portlet-ref>FreezonePortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>page</name>
+ <value>default/members/default/freezone/navigation.html</value>
+ </preference>
+ </preferences>
+ </instance>
+ </deployment>
</deployments>
Modified: labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/portlet.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/portlet.xml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/portlet.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
<portlet>
<description>Forge project freezone portlet</description>
- <portlet-name>PrjFreezonePortlet</portlet-name>
+ <portlet-name>FreezonePortlet</portlet-name>
<display-name>Project freezone</display-name>
<portlet-class>org.jboss.forge.projects.freezone.Freezone</portlet-class>
<supports>
@@ -15,5 +15,15 @@
<portlet-info>
<title>Project freezone</title>
</portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>projectId</name>
+ <value>default</value>
+ </preference>
+ <preference>
+ <name>page</name>
+ <value></value>
+ </preference>
+ </portlet-preferences>
</portlet>
</portlet-app>
Modified: labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/web.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/web.xml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/web.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,8 +1,9 @@
<?xml version="1.0"?>
-<!DOCTYPE web-app PUBLIC
- "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
- "http://java.sun.com/dtd/web-app_2_3.dtd">
-<web-app>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
<filter>
<filter-name>filesFromRepoFilter</filter-name>
<filter-class>org.jboss.forge.common.FilesFromRepoFilter</filter-class>
@@ -13,4 +14,24 @@
<url-pattern>/repo-access/*</url-pattern>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
+
+ <servlet>
+ <servlet-name>Test1</servlet-name>
+ <servlet-class>org.jboss.forge.projects.freezone.TestServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Test1</servlet-name>
+ <url-pattern>/test1/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <servlet-name>Test2</servlet-name>
+ <servlet-class>org.jboss.forge.projects.freezone.TestServlet2</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Test2</servlet-name>
+ <url-pattern>/test2/*</url-pattern>
+ </servlet-mapping>
</web-app>
\ No newline at end of file
Modified: labs/jbosslabs/trunk/portal-extensions/forge-mapper/src/java/org/jboss/labs/mapper/LabsCommandFactory.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-mapper/src/java/org/jboss/labs/mapper/LabsCommandFactory.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-mapper/src/java/org/jboss/labs/mapper/LabsCommandFactory.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -152,7 +152,7 @@
* - the requested resource is of another mime type - in this case,
* we send a redirect to the file-access servlet.
*/
- String cmsPath = getCmsPath(ForgeHelper.LABS_PORTAL, projectId, path);
+ String cmsPath = getCmsPath(Constants.LABS_PORTAL, projectId, path);
try {
if (!Constants.PAGES_MIME_TYPE.equalsIgnoreCase(cm.getNode(cmsPath).getMimeType())) {
@@ -215,7 +215,7 @@
redirect = freezonePage;
} else {
redirect = ProjectsHelper.createFreezonePageLink(
- ForgeHelper.LABS_PORTAL, projectId, freezonePage);
+ Constants.LABS_PORTAL, projectId, freezonePage);
}
sendRedirect(invocation, redirect);
@@ -229,13 +229,6 @@
public ControllerCommand doMapping(ServerInvocation invocation, String host, String portalContextPath,
String portalRequestPath) {
- // TODO temporary for freezone
- String projectParam = invocation.getServerContext().getClientRequest()
- .getParameter(Constants.PROJECT_PARAM);
- if (projectParam != null) {
- setAttribute(invocation, Constants.PROJECT_PARAM, projectParam);
- }
-
// Removing unnecessary /.
while (portalRequestPath.indexOf("//") != -1) {
portalRequestPath = portalRequestPath.replace("//", "/");
@@ -266,14 +259,8 @@
ControllerCommand c;
String[] tokens = portalRequestPath.split("[/]", 3);
- Projects projects = ProjectsHelper.getProjects(ForgeHelper.LABS_PORTAL);
+ Projects projects = ProjectsHelper.getProjects(Constants.LABS_PORTAL);
if ((tokens.length > 1) && (projects.projectExists(tokens[1]))) {
- /*
- * The user requested a project page (/projectId). It will be
- * unset, if necessary, in the AttributesFilter.
- */
- setAttribute(invocation, Constants.PROJECT_PARAM, tokens[1]);
-
try {
c = getProjectCommand(invocation, tokens.length > 2 ? tokens[2] : null,
tokens[1], projects);
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/AttributesFilter.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/AttributesFilter.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/AttributesFilter.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,108 +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.forge.portal;
-
-import java.io.IOException;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-
-import org.jboss.forge.common.Constants;
-
-/**
- * Filter which sets attributes that are necessary for labs portlets to be
- * fully functional.
- * @author Adam Warski (adamw at aster.pl)
- */
-public class AttributesFilter implements Filter {
- public void init(FilterConfig config) throws ServletException {
-
- }
-
- public void doFilter(ServletRequest request,
- ServletResponse response, FilterChain chain)
- throws IOException, ServletException {
- if (request instanceof HttpServletRequest) {
- HttpServletRequest httpRequest = (HttpServletRequest) request;
-
- // Getting the request parameters.
- String noproject = request.getParameter(Constants.NO_PROJECT_PARAM_NAME);
- String project = request.getParameter(Constants.PROJECT_PARAM);
- String prjList = request.getParameter(Constants.PROJECT_LIST_PARAM);
-
- // The project doesn't have to be passed as a parameter. It can be
- // passed in the requestURI, when accessing freezone pages. This
- // only applies to the default portal.
- String requestURI = httpRequest.getRequestURI();
-
- // ProjectId handling.
- if (Constants.TRUE_VALUE.equals(noproject)) {
- // Removing project from session info.
- httpRequest.getSession().removeAttribute(Constants.PROJECT_PARAM);
- httpRequest.removeAttribute(Constants.PROJECT_PARAM);
- } else if ((project != null) && (!"".equals(project))) {
- httpRequest.getSession().setAttribute(Constants.PROJECT_PARAM, project);
- httpRequest.setAttribute(Constants.PROJECT_PARAM, project);
- } else {
- Object val = httpRequest.getSession().getAttribute(Constants.PROJECT_PARAM);
- if (val != null) {
- httpRequest.setAttribute(Constants.PROJECT_PARAM, val.toString());
- }
- }
-
- // ProjectList handling.
- if (Constants.TRUE_VALUE.equals(noproject)) {
- httpRequest.getSession().removeAttribute(Constants.PROJECT_LIST_PARAM);
- httpRequest.removeAttribute(Constants.PROJECT_LIST_PARAM);
- } else if ((prjList != null) && (!"".equals(prjList))) {
- Object val = Constants.TRUE_VALUE.equals(prjList);
-
- httpRequest.getSession().setAttribute(Constants.PROJECT_LIST_PARAM, val);
- httpRequest.setAttribute(Constants.PROJECT_LIST_PARAM, val);
- } else {
- Object val = httpRequest.getSession().getAttribute(Constants.PROJECT_LIST_PARAM);
- if (val != null) {
- httpRequest.setAttribute(Constants.PROJECT_LIST_PARAM, val);
- }
- }
-
- // Putting the full requested url into session for navigation.
- String fullUrl = requestURI;
- if (httpRequest.getQueryString() != null) {
- fullUrl += "?" + httpRequest.getQueryString();
- }
-
- httpRequest.setAttribute(Constants.ATTR_URL, fullUrl);
- }
-
- chain.doFilter(request, response);
- }
-
- public void destroy() {
-
- }
-}
Modified: labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/AutologinFilter.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/AutologinFilter.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/AutologinFilter.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -3,7 +3,6 @@
import java.io.IOException;
import java.util.Random;
-import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
@@ -16,8 +15,8 @@
import javax.servlet.http.HttpServletResponse;
import org.jboss.forge.common.ForgeHelper;
-import org.jboss.forge.common.propertypersistance.PropertyService;
-import org.jboss.forge.common.soa.LabsServices;
+import org.jboss.forge.common.ejb3.PropertyService;
+import org.jboss.forge.common.ejb3.LabsServices;
import org.jboss.logging.Logger;
public class AutologinFilter implements Filter {
Copied: labs/jbosslabs/trunk/portal-extensions/forge-prj-info/forge-prj-info.iml (from rev 9290, labs/jbosslabs/trunk/portal-extensions-newprj/forge-prj-info/forge-prj-info.iml)
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-prj-info/forge-prj-info.iml (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-prj-info/forge-prj-info.iml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module version="4" relativePaths="true" type="JAVA_MODULE">
+ <component name="ModuleRootManager" />
+ <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/target" />
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="shotoku-base" />
+ <orderEntry type="module" module-name="shotoku-aop" />
+ <orderEntry type="module" module-name="forge-common" />
+ <orderEntry type="library" name="jboss" level="application" />
+ <orderEntry type="library" name="portal" level="application" />
+ <orderEntry type="library" name="portlet" level="application" />
+ <orderEntryProperties />
+ </component>
+</module>
+
Modified: labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/java/org/jboss/forge/projects/info/Info.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/java/org/jboss/forge/projects/info/Info.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/java/org/jboss/forge/projects/info/Info.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -23,13 +23,11 @@
import java.io.IOException;
-import java.io.InputStream;
-
import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher;
import org.jboss.forge.common.ForgeHelper;
-import org.jboss.forge.common.projects.ProjectDescriptor;
+import org.jboss.forge.common.portlet.JBossLabsPortlet;
import org.jboss.forge.common.projects.Projects;
import org.jboss.forge.common.projects.ProjectsHelper;
import org.jboss.forge.common.projects.permissions.PermissionsChecker;
@@ -37,7 +35,6 @@
import org.jboss.logging.Logger;
import org.jboss.portal.core.servlet.jsp.taglib.context.DelegateContext;
import org.jboss.portal.core.servlet.jsp.PortalJsp;
-import org.jboss.portlet.JBossPortlet;
import org.jboss.portlet.JBossRenderRequest;
import org.jboss.portlet.JBossRenderResponse;
import org.jboss.shotoku.ContentManager;
@@ -50,7 +47,7 @@
*
* @author adamw
*/
-public class Info extends JBossPortlet {
+public class Info extends JBossLabsPortlet {
private final static String INFO_JSP = "prj-info/info.jsp";
private final static String INFO_ERROR_JSP = "prj-info/info_error.jsp";
@@ -60,11 +57,15 @@
@Inject
private ContentManager cm;
- public void doView(JBossRenderRequest request, JBossRenderResponse response)
+ protected boolean isAllowed(JBossRenderRequest request, JBossRenderResponse response) {
+ return true;
+ }
+
+ public void labsDoView(JBossRenderRequest request, JBossRenderResponse response)
throws IOException, PortletException {
response.setContentType("text/html");
- String projectId = ProjectsHelper.getSelectedProjectId(request);
+ String projectId = ProjectsHelper.getSelectedProjectId(request);
String portalName = ForgeHelper.getPortalName(request);
Projects projects = ProjectsHelper.getProjects(portalName);
@@ -75,7 +76,7 @@
}
DelegateContext context = null;
- PortletRequestDispatcher rd = null;
+ PortletRequestDispatcher rd;
PermissionsChecker pc = new RenderRequestPermissionsChecker(request);
Modified: labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/java/org/jboss/forge/projects/info/ProjectInfoBean.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/java/org/jboss/forge/projects/info/ProjectInfoBean.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/java/org/jboss/forge/projects/info/ProjectInfoBean.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -22,17 +22,13 @@
package org.jboss.forge.projects.info;
import javax.faces.context.FacesContext;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
import org.jboss.forge.common.FacesTools;
import org.jboss.forge.common.ForgeHelper;
import org.jboss.forge.common.projects.ProjectsHelper;
import org.jboss.forge.common.projects.project.Project;
-import org.jboss.forge.common.soa.projects.ProjectsService;
+import org.jboss.forge.common.ejb3.ProjectsService;
import org.jboss.logging.Logger;
-import org.jboss.mx.util.MBeanProxyExt;
-import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.portlet.JBossRenderRequest;
import org.jboss.shotoku.ContentManager;
import org.jboss.shotoku.Node;
Modified: labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/java/org/jboss/forge/projects/info/ProjectInfoEditBean.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/java/org/jboss/forge/projects/info/ProjectInfoEditBean.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/java/org/jboss/forge/projects/info/ProjectInfoEditBean.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -31,7 +31,7 @@
import org.jboss.forge.common.projects.project.Forum;
import org.jboss.forge.common.projects.project.Project;
import org.jboss.forge.common.projects.project.Repository;
-import org.jboss.forge.common.soa.projects.ProjectsService;
+import org.jboss.forge.common.ejb3.ProjectsService;
public class ProjectInfoEditBean {
Modified: labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/web/WEB-INF/portlet.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/web/WEB-INF/portlet.xml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/web/WEB-INF/portlet.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
- version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
- <!--
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
+ <!--
<portlet>
<description>Forge project info portlet</description>
<portlet-name>PrjInfoPortlet</portlet-name>
@@ -15,27 +15,27 @@
<portlet-info>
<title>Project information</title>
</portlet-info>
- </portlet>
--->
-
-<portlet>
- <description>Forge project info portlet</description>
- <portlet-name>PrjInfoPortlet</portlet-name>
- <display-name>Project information</display-name>
- <portlet-class>org.apache.myfaces.portlet.MyFacesGenericPortlet</portlet-class>
- <init-param>
- <name>default-view</name>
- <value>/repo-access/default/prj-info/info.jsp</value>
- </init-param>
- <expiration-cache>0</expiration-cache>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>VIEW</portlet-mode>
- </supports>
- <portlet-info>
- <title>Project information</title>
- </portlet-info>
- </portlet>
-
+ </portlet>
+-->
+
+<portlet>
+ <description>Forge project info portlet</description>
+ <portlet-name>PrjInfoPortlet</portlet-name>
+ <display-name>Project information</display-name>
+ <portlet-class>org.apache.myfaces.portlet.MyFacesGenericPortlet</portlet-class>
+ <init-param>
+ <name>default-view</name>
+ <value>/repo-access/default/prj-info/info.jsp</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Project information</title>
+ </portlet-info>
+ </portlet>
+
</portlet-app>
Modified: labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/web/WEB-INF/web.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/web/WEB-INF/web.xml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-prj-info/src/web/WEB-INF/web.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,8 +1,9 @@
<?xml version="1.0"?>
-<!DOCTYPE web-app PUBLIC
- "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
- "http://java.sun.com/dtd/web-app_2_3.dtd">
-<web-app>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
Modified: labs/jbosslabs/trunk/portal-extensions/forge-sar/src/forge-service.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-sar/src/forge-service.xml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-sar/src/forge-service.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -10,7 +10,7 @@
<!-- Invoke invoke(Invocation mi) operation or the target method -->
<attribute name="InvokeTargetMethod">true</attribute>
<!-- MyService interface -->
- <attribute name="ExportedInterfaces">org.jboss.forge.common.soa.projects.ProjectsService</attribute>
+ <attribute name="ExportedInterfaces">org.jboss.forge.common.ejb3.ProjectsService</attribute>
<attribute name="ClientInterceptors">
<interceptors>
<interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
Modified: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/TagMeServlet.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/TagMeServlet.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/TagMeServlet.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -28,8 +28,8 @@
import javax.naming.NamingException;
import org.jboss.forge.common.PermissionTools;
-import org.jboss.forge.common.soa.LabsServices;
-import org.jboss.forge.common.soa.primates.PrimatesService;
+import org.jboss.forge.common.ejb3.LabsServices;
+import org.jboss.forge.common.ejb3.PrimatesService;
import org.jboss.labs.tagme.gwt.client.AddTagsClickListener;
import org.jboss.labs.tagme.gwt.client.TaggingService;
import org.jboss.labs.tagme.services.TagMeTagger;
Modified: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/services/TagMeTools.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/services/TagMeTools.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/services/TagMeTools.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,7 +1,7 @@
package org.jboss.labs.tagme.services;
import org.jboss.forge.common.PermissionTools;
-import org.jboss.forge.common.soa.LabsServices;
+import org.jboss.forge.common.ejb3.LabsServices;
import org.jboss.portal.identity.User;
public class TagMeTools {
Modified: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/ProjectTools.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/ProjectTools.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/ProjectTools.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -15,7 +15,7 @@
import org.jboss.forge.common.projects.project.Project;
import org.jboss.forge.common.projects.project.RepoType;
import org.jboss.forge.common.projects.project.Repository;
-import org.jboss.forge.common.soa.projects.ProjectsService;
+import org.jboss.forge.common.ejb3.ProjectsService;
import org.jboss.logging.Logger;
/**
@@ -113,7 +113,7 @@
public static long getOverallDownloadsForProject(String projectId, String portalName) {
- return service.getOverallDownloadsForProject(projectId, portalName);
+ return service.getOverallDownloadsForProject(projectId);
}
public static boolean getPackagedForDownload(String projectId) {
Modified: labs/jbosslabs/trunk/portal-extensions/maven.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/maven.xml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/maven.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -52,9 +52,14 @@
</ant:copy>
<ant:copy todir="target/${maven.final.name}.sar" flatten="true" overwrite="true">
<ant:fileset dir=".">
- <ant:filename name="target/*ar" />
+ <ant:filename name="target/*war" />
</ant:fileset>
</ant:copy>
+ <ant:copy todir="target/${maven.final.name}.sar" flatten="true" overwrite="true">
+ <ant:fileset dir=".">
+ <ant:filename name="target/*jar" />
+ </ant:fileset>
+ </ant:copy>
<j:set var="jar.to.dir" value="target/${maven.final.name}.sar" />
<attainGoal name="dir-to-jar" />
<ant:copy file="target/${maven.final.name}.sar" todir="${local.deploy.dir}" />
@@ -78,11 +83,6 @@
<attainGoal name="clean" />
<attainGoal name="build" />
<attainGoal name="deploy" />
- <ant:copy todir="${local.deploy.dir}" flatten="true" overwrite="true">
- <ant:fileset dir=".">
- <ant:filename name="target/*.war" />
- </ant:fileset>
- </ant:copy>
</goal>
<!--
@@ -260,8 +260,12 @@
<!-- Convenience goal that does clean, build, deploy -->
<goal name="all">
- <ant:delete dir="${forge.jar.dest}" />
+ <!-- Removing legacy packages -->
+ <ant:delete file="${local.deploy.dir}/forge-navigation-portlet.sar" />
+ <ant:delete file="${local.deploy.dir}/forge-common-1.0.ejb3" />
+ <ant:delete dir="${forge.jar.dest}" />
+
<attainGoal name="prepare-repo" />
<j:set var="goal" value="clean,build,deploy" />
Modified: labs/jbosslabs/trunk/portal-extensions/polls/src/java/org/jboss/forge/polls/PollsCacheItem.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/polls/src/java/org/jboss/forge/polls/PollsCacheItem.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/polls/src/java/org/jboss/forge/polls/PollsCacheItem.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -3,7 +3,6 @@
import org.jboss.shotoku.tools.Pair;
import org.jboss.shotoku.cache.ShotokuResourceWatcher;
import org.jboss.shotoku.cache.ChangeType;
-import org.jboss.forge.common.service.ResourceWatcher;
import org.jboss.forge.common.projects.ProjectsHelper;
import java.util.Map;
Modified: labs/jbosslabs/trunk/portal-extensions/portal-default/src/web/WEB-INF/default-object.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/portal-default/src/web/WEB-INF/default-object.xml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/portal-default/src/web/WEB-INF/default-object.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -1,638 +1,294 @@
<?xml version="1.0" encoding="UTF-8"?>
<deployments>
- <deployment>
- <parent-ref />
- <if-exists>overwrite</if-exists>
- <portal>
- <portal-name>default</portal-name>
- <properties>
- <!-- Set the layout for the default portal, see also portal-layouts.xml. -->
- <property>
- <name>layout.id</name>
- <value>JBossForge</value>
+ <deployment>
+ <parent-ref />
+ <if-exists>keep</if-exists>
+ <portal>
+ <portal-name>default</portal-name>
+ <properties>
+ <!-- Set the layout for the default portal, see also portal-layouts.xml. -->
+ <property>
+ <name>layout.id</name>
+ <value>JBossForge</value>
</property>
- <!-- Set the theme for the default portal, see also portal-themes.xml. -->
- <property>
- <name>theme.id</name>
- <value>jboss-forge</value>
+ <!-- Set the theme for the default portal, see also portal-themes.xml. -->
+ <property>
+ <name>theme.id</name>
+ <value>jboss-forge</value>
</property>
- <!-- Set the default render set name (used by the render tag in layouts), see also portal-renderSet.xml -->
- <property>
- <name>theme.renderSetId</name>
- <value>emptyRenderer</value>
+ <!-- Set the default render set name (used by the render tag in layouts), see also portal-renderSet.xml -->
+ <property>
+ <name>theme.renderSetId</name>
+ <value>emptyRenderer</value>
</property>
- <!-- Set the default strategy name (used by the strategy interceptor), see also portal-strategies.xml -->
- <property>
- <name>layout.strategyId</name>
- <!--<value>jbfStrategy</value>-->
+ <!-- Set the default strategy name (used by the strategy interceptor), see also portal-strategies.xml -->
+ <property>
+ <name>layout.strategyId</name>
+ <!--<value>jbfStrategy</value>-->
<value>maximizedRegion</value>
</property>
- <!-- The default page name, if the property is not explicited then the default page name is "default" -->
- <property>
- <name>portal.defaultObjectName</name>
- <value>default</value>
- </property>
+ <!-- The default page name, if the property is not explicited then the default page name is "default" -->
+ <property>
+ <name>portal.defaultObjectName</name>
+ <value>default</value>
+ </property>
- <!-- Labs properties -->
- <property>
- <name>org.jboss.portlet.blog.mainportlet</name>
- <value>yes</value>
- </property>
- <property>
- <name>org.jboss.portlet.blog.specialpage</name>
- <value>no</value>
- </property>
- <property>
- <name>shotoku.main.directory</name>
- <value>default</value>
- </property>
- <property>
- <name>wikiPage</name>
- <value>default</value>
- </property>
- </properties>
- <supported-modes>
- <mode>view</mode>
- <mode>edit</mode>
- <mode>help</mode>
- </supported-modes>
- <supported-window-states>
- <window-state>normal</window-state>
- <window-state>minimized</window-state>
- <window-state>maximized</window-state>
- </supported-window-states>
+ <!-- Labs properties -->
+ <property>
+ <name>shotoku.main.directory</name>
+ <value>default</value>
+ </property>
+ <property>
+ <name>wikiPage</name>
+ <value>default</value>
+ </property>
+ </properties>
+ <supported-modes>
+ <mode>view</mode>
+ <mode>edit</mode>
+ <mode>help</mode>
+ </supported-modes>
+ <supported-window-states>
+ <window-state>normal</window-state>
+ <window-state>minimized</window-state>
+ <window-state>maximized</window-state>
+ </supported-window-states>
- <page>
- <page-name>default</page-name>
- <window>
- <window-name>FreezonePortletWindowDefaultDefault</window-name>
- <instance-ref>FreezoneDefaultPagePortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- <window>
- <window-name>PodcastPortletWindowDefaultDefault</window-name>
- <instance-ref>PodcastPortletInstanceSmall</instance-ref>
- <region>right</region>
- <height>1</height>
- </window>
- <window>
- <window-name>PrimatesPortletWindowDefaultDefault</window-name>
- <instance-ref>PrimatesPortletMugshotInstance</instance-ref>
- <region>innerright</region>
- <height>0</height>
- </window>
- <window>
- <window-name>BlogPortletWindowDefaultDefault</window-name>
- <instance-ref>BlogPortletInstance</instance-ref>
- <region>innerleft</region>
- <height>0</height>
- </window>
- <window>
- <window-name>NavigationPortletWindowDefaultDefault</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>AdsPortletWindowDefaultDefault</window-name>
- <instance-ref>AdsPortletInstance</instance-ref>
- <region>left</region>
- <height>2</height>
- </window>
- <!-- <window>
- <window-name>PollsPortletWindowDefaultRandom</window-name>
- <instance-ref>PollsPortletInstanceRandom</instance-ref>
- <region>right</region>
- <height>1</height>
- </window> -->
- <window>
- <window-name>FreezonePortletWindowDefaultRight</window-name>
- <instance-ref>FreezoneRightPanelPortletInstance</instance-ref>
- <region>right</region>
- <height>0</height>
- </window>
- <!--<window>
- <window-name>FreezonePortletWindowDefaultDownloads</window-name>
- <instance-ref>FreezoneMostDownloadedPortletInstance</instance-ref>
- <region>innerright</region>
- <height>0</height>
- </window>-->
- <window>
- <window-name>UserPortletWindow</window-name>
- <instance-ref>UserPortletInstance</instance-ref>
- <region>nav</region>
- <height>10</height>
- </window>
- </page>
+ <page>
+ <page-name>default</page-name>
+ <window>
+ <window-name>FreezoneNavigationWindow</window-name>
+ <instance-ref>FreezoneNavigationInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>FreezoneDefaultPageWindow</window-name>
+ <instance-ref>FreezoneDefaultPageInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>PodcastPortletWindow</window-name>
+ <instance-ref>PodcastPortletInstanceSmall</instance-ref>
+ <region>right</region>
+ <height>1</height>
+ </window>
+ <window>
+ <window-name>PrimatesPortletWindow</window-name>
+ <instance-ref>PrimatesPortletMugshotInstance</instance-ref>
+ <region>innerright</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>AdsPortletWindow</window-name>
+ <instance-ref>AdsPortletInstance</instance-ref>
+ <region>left</region>
+ <height>2</height>
+ </window>
+ <window>
+ <window-name>FreezoneRightPanelWindow</window-name>
+ <instance-ref>FreezoneRightPanelInstance</instance-ref>
+ <region>right</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>UserPortletWindow</window-name>
+ <instance-ref>UserPortletInstance</instance-ref>
+ <region>nav</region>
+ <height>10</height>
+ </window>
+ </page>
- </portal>
- </deployment>
+ </portal>
+ </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
- <page>
- <!-- login page -->
- <page-name>login</page-name>
- <window>
- <window-name>LoginWindow</window-name>
- <instance-ref>LoginInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- <window>
- <window-name>NavigationPortletWindowDefaultLogin</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>AdsPortletWindowDefaultLogin</window-name>
- <instance-ref>AdsPortletInstance</instance-ref>
- <region>left</region>
- <height>2</height>
- </window>
- </page>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
- <!-- timetracker page -->
- <page>
- <page-name>TTS</page-name>
- <window>
- <window-name>TimeTrackerWindow</window-name>
- <instance-ref>TimetrackerPortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- <window>
- <window-name>NavigationPortletWindowDefaultTTS</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>AdsPortletWindowDefaultTTS</window-name>
- <instance-ref>AdsPortletInstance</instance-ref>
- <region>left</region>
- <height>2</height>
- </window>
- </page>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
- <!-- community page -->
- <page>
- <page-name>community</page-name>
- <window>
- <window-name>PrimatesPortletWindowDefaultCommunity</window-name>
- <instance-ref>PrimatesPortletAllInstance</instance-ref>
- <region>center</region>
- <height>1</height>
- </window>
- <window>
- <window-name>AdsPortletWindowDefaultTTS</window-name>
- <instance-ref>AdsPortletInstance</instance-ref>
- <region>left</region>
- <height>1</height>
- </window>
- <window>
- <window-name>NavigationPortletWindowDefaultTTS</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>PollsPortletWindowDefaultRandom</window-name>
- <instance-ref>PollsPortletInstanceRandom</instance-ref>
- <region>left</region>
- <height>2</height>
- </window>
- </page>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
- <page>
- <page-name>softwaremap</page-name>
- <window>
- <window-name>NavigationPortletWindowDefaultMap</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>AdsPortletWindowDefaultMap</window-name>
- <instance-ref>AdsPortletInstance</instance-ref>
- <region>left</region>
- <height>2</height>
- </window>
- <window>
- <window-name>MapWindowDefaultMap</window-name>
- <instance-ref>MapPortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- </page>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
- <page>
- <page-name>wiki</page-name>
- <window>
- <window-name>NavigationPortletWindowDefaultWiki</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>AdsPortletWindowDefaultWiki</window-name>
- <instance-ref>AdsPortletInstance</instance-ref>
- <region>left</region>
- <height>2</height>
- </window>
- <window>
- <window-name>WikiPortletWindow</window-name>
- <instance-ref>WikiPortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- </page>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
- <page>
- <page-name>info</page-name>
-
- <window>
- <window-name>NavigationPortletWindowDefaultInfo</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>AdsPortletWindowDefaultInfo</window-name>
- <instance-ref>AdsPortletInstance</instance-ref>
- <region>left</region>
- <height>2</height>
- </window>
- <window>
- <window-name>PrjInfoPortletWindowDefaultInfo</window-name>
- <instance-ref>PrjInfoPortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- <window>
- <window-name>PollsPortletWindowInfo</window-name>
- <instance-ref>PollsPortletInstance</instance-ref>
- <region>right</region>
- <height>1</height>
- </window>
- </page>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
- <page>
- <page-name>blog</page-name>
- <window>
- <window-name>NavigationPortletWindowDefaultBlog</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>AdsPortletWindowDefaultBlog</window-name>
- <instance-ref>AdsPortletInstance</instance-ref>
- <region>left</region>
- <height>2</height>
- </window>
-
- <window>
- <window-name>PrjBlogPortletWindowDefaultBlog</window-name>
- <instance-ref>PrjBlogPortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- </page>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
- <page>
- <page-name>downloads</page-name>
-
- <window>
- <window-name>NavigationPortletWindowDefaultDownloads</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>AdsPortletWindowDefaultDownloads</window-name>
- <instance-ref>AdsPortletInstance</instance-ref>
- <region>left</region>
- <height>2</height>
- </window>
- <window>
- <window-name>PrjDownloadsPortletWindowDefaultDownloads</window-name>
- <instance-ref>PrjDownloadsPortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- <window>
- <window-name>DownloadCounterPortletWindowDefaultDownloads</window-name>
- <instance-ref>DownloadCounterPortletInstance</instance-ref>
- <region>center</region>
- <height>1</height>
- </window>
- </page>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
- <page>
- <page-name>con</page-name>
- <window>
- <window-name>NavigationPortletWindowDefaultCon</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>AdsPortletWindowDefaultCon</window-name>
- <instance-ref>AdsPortletInstance</instance-ref>
- <region>left</region>
- <height>2</height>
- </window>
- <window>
- <window-name>ConPortletWindowDefault</window-name>
- <instance-ref>ConPortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- </page>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
- <page>
- <page-name>feeds</page-name>
- <window>
- <window-name>NavigationPortletWindowDefaultFeeds</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>AdsPortletWindowDefaultFeeds</window-name>
- <instance-ref>AdsPortletInstance</instance-ref>
- <region>left</region>
- <height>2</height>
- </window>
- <window>
- <window-name>FeedsPortletWindowDefault</window-name>
- <instance-ref>FeedsPortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- </page>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
- <page>
- <page-name>freezone</page-name>
- <window>
- <window-name>NavigationPortletWindowDefaultFreezone</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>AdsPortletWindowDefaultFreezone</window-name>
- <instance-ref>AdsPortletInstance</instance-ref>
- <region>left</region>
- <height>2</height>
- </window>
- <window>
- <window-name>FreezonePortletWindow</window-name>
- <instance-ref>PrjFreezonePortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- </page>
- </deployment>
- <!--<deployment>
- <if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
- <page>
- <page-name>forgeforums</page-name>
-
- <window>
- <window-name>NavigationPortletWindowDefaultForums</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>AdsPortletWindowDefaultForums</window-name>
- <instance-ref>AdsPortletInstance</instance-ref>
- <region>left</region>
- <height>2</height>
- </window>
- <window>
- <window-name>ForumsPortletWindowDefaultForums</window-name>
- <instance-ref>ForumsPortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
-
- </page>
- </deployment>-->
- <deployment>
- <if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
- <page>
- <page-name>jmm</page-name>
- <window>
- <window-name>NavigationPortletWindowDefaultJMM</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>AdsPortletWindowDefaultJMM</window-name>
- <instance-ref>AdsPortletInstance</instance-ref>
- <region>left</region>
- <height>2</height>
- </window>
- <window>
- <window-name>JMMPortletWindowDefaultJMM</window-name>
- <instance-ref>JMMPortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- </page>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
- <page>
- <page-name>podcast</page-name>
- <window>
- <window-name>NavigationPortletWindowDefaultPodcast</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>AdsPortletWindowDefaultPodcast</window-name>
- <instance-ref>AdsPortletInstance</instance-ref>
- <region>left</region>
- <height>2</height>
- </window>
- <window>
- <window-name>PodcastPortletWindowDefaultPodcast</window-name>
- <instance-ref>PodcastPortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- </page>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
- <page>
- <page-name>kosmos-jira</page-name>
- <window>
- <window-name>NavigationPortletWindowDefaultKosmosJira</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>AdsPortletWindowDefaulKosmosJira</window-name>
- <instance-ref>AdsPortletInstance</instance-ref>
- <region>left</region>
- <height>2</height>
- </window>
- <window>
- <window-name>KosmosJiraPortletWindowDefaultKosmosJira</window-name>
- <instance-ref>KosmosJiraPortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- </page>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
- <page>
- <page-name>kosmos-svn</page-name>
- <window>
- <window-name>NavigationPortletWindowDefaultKosmosSvn</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>AdsPortletWindowDefaultKosmosSvn</window-name>
- <instance-ref>AdsPortletInstance</instance-ref>
- <region>left</region>
- <height>2</height>
- </window>
- <window>
- <window-name>KosmosSvnPortletWindowDefaultKosmosSvn</window-name>
- <instance-ref>KosmosSvnPortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- </page>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
- <page>
- <page-name>admin</page-name>
- <window>
- <window-name>NavigationPortletWindowDefaultAdmin</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>RolePortletWindowDefaultAdmin</window-name>
- <instance-ref>RolePortletInstance</instance-ref>
- <region>center</region>
- <height>2</height>
- <properties>
- <property>
- <name>decorationVisible</name>
- <value>true</value>
- </property>
- </properties>
- </window>
- <window>
- <window-name>UserPortletWindowDefaultAdmin</window-name>
- <instance-ref>UserPortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- <properties>
- <property>
- <name>decorationVisible</name>
- <value>true</value>
- </property>
- </properties>
- </window>
- <window>
- <window-name>ManagementPortletWindowDefaultAdmin</window-name>
- <instance-ref>ManagementPortletInstance</instance-ref>
- <region>center</region>
- <height>1</height>
- <properties>
- <property>
- <name>decorationVisible</name>
- <value>true</value>
- </property>
- </properties>
- </window>
- <security-constraint>
- <policy-permission>
- <role-name>Admin</role-name>
- <action-name>view</action-name>
- </policy-permission>
- </security-constraint>
- </page>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
- <page>
- <page-name>cmsadmin</page-name>
- <window>
- <window-name>NavigationPortletWindowCMSDefaultAdmin</window-name>
- <instance-ref>LabsNavigationPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>CMSAdminPortletWindow</window-name>
- <instance-ref>CMSAdminPortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- <security-constraint>
- <policy-permission>
- <role-name>Admin</role-name>
- <action-name>view</action-name>
- </policy-permission>
- </security-constraint>
- </page>
- </deployment>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <parent-ref>default</parent-ref>
+ <page>
+ <!-- login page -->
+ <page-name>login</page-name>
+ <window>
+ <window-name>LoginWindow</window-name>
+ <instance-ref>LoginInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>FreezoneNavigationWindow</window-name>
+ <instance-ref>FreezoneNavigationInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>AdsPortletWindowDefaultLogin</window-name>
+ <instance-ref>AdsPortletInstance</instance-ref>
+ <region>left</region>
+ <height>2</height>
+ </window>
+ </page>
+ </deployment>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <parent-ref>default</parent-ref>
+ <!-- community page -->
+ <page>
+ <page-name>community</page-name>
+ <window>
+ <window-name>PrimatesPortletWindowDefaultCommunity</window-name>
+ <instance-ref>PrimatesPortletAllInstance</instance-ref>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ <window>
+ <window-name>AdsPortletWindowDefaultTTS</window-name>
+ <instance-ref>AdsPortletInstance</instance-ref>
+ <region>left</region>
+ <height>1</height>
+ </window>
+ <window>
+ <window-name>FreezoneNavigationWindow</window-name>
+ <instance-ref>FreezoneNavigationInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>PollsPortletWindowDefaultRandom</window-name>
+ <instance-ref>PollsPortletInstanceRandom</instance-ref>
+ <region>left</region>
+ <height>2</height>
+ </window>
+ </page>
+ </deployment>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <parent-ref>default</parent-ref>
+ <page>
+ <page-name>wiki</page-name>
+ <window>
+ <window-name>FreezoneNavigationWindow</window-name>
+ <instance-ref>FreezoneNavigationInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>AdsPortletWindowDefaultWiki</window-name>
+ <instance-ref>AdsPortletInstance</instance-ref>
+ <region>left</region>
+ <height>2</height>
+ </window>
+ <window>
+ <window-name>WikiPortletWindow</window-name>
+ <instance-ref>WikiPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
+ </deployment>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <parent-ref>default</parent-ref>
+ <page>
+ <page-name>con</page-name>
+ <window>
+ <window-name>FreezoneNavigationWindow</window-name>
+ <instance-ref>FreezoneNavigationInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>AdsPortletWindowDefaultCon</window-name>
+ <instance-ref>AdsPortletInstance</instance-ref>
+ <region>left</region>
+ <height>2</height>
+ </window>
+ <window>
+ <window-name>ConPortletWindowDefault</window-name>
+ <instance-ref>ConPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
+ </deployment>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <parent-ref>default</parent-ref>
+ <page>
+ <page-name>podcast</page-name>
+ <window>
+ <window-name>FreezoneNavigationWindow</window-name>
+ <instance-ref>FreezoneNavigationInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>AdsPortletWindowDefaultPodcast</window-name>
+ <instance-ref>AdsPortletInstance</instance-ref>
+ <region>left</region>
+ <height>2</height>
+ </window>
+ <window>
+ <window-name>PodcastPortletWindowDefaultPodcast</window-name>
+ <instance-ref>PodcastPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
+ </deployment>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <parent-ref>default</parent-ref>
+ <page>
+ <page-name>admin</page-name>
+ <window>
+ <window-name>FreezoneNavigationWindow</window-name>
+ <instance-ref>FreezoneNavigationInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>RolePortletWindowDefaultAdmin</window-name>
+ <instance-ref>RolePortletInstance</instance-ref>
+ <region>center</region>
+ <height>2</height>
+ <properties>
+ <property>
+ <name>decorationVisible</name>
+ <value>true</value>
+ </property>
+ </properties>
+ </window>
+ <window>
+ <window-name>UserPortletWindowDefaultAdmin</window-name>
+ <instance-ref>UserPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ <properties>
+ <property>
+ <name>decorationVisible</name>
+ <value>true</value>
+ </property>
+ </properties>
+ </window>
+ <window>
+ <window-name>ManagementPortletWindowDefaultAdmin</window-name>
+ <instance-ref>ManagementPortletInstance</instance-ref>
+ <region>center</region>
+ <height>1</height>
+ <properties>
+ <property>
+ <name>decorationVisible</name>
+ <value>true</value>
+ </property>
+ </properties>
+ </window>
+ <security-constraint>
+ <policy-permission>
+ <role-name>Admin</role-name>
+ <action-name>view</action-name>
+ </policy-permission>
+ </security-constraint>
+ </page>
+ </deployment>
</deployments>
Modified: labs/jbosslabs/trunk/portal-extensions/portal-default/src/web/WEB-INF/portlet-instances.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/portal-default/src/web/WEB-INF/portlet-instances.xml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/portal-default/src/web/WEB-INF/portlet-instances.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -16,19 +16,6 @@
<deployment>
<if-exists>overwrite</if-exists>
<instance>
- <instance-name>CMSAdminPortletInstance</instance-name>
- <component-ref>portal.CMSAdminPortlet</component-ref>
- <security-constraint>
- <policy-permission>
- <role-name>Admin</role-name>
- <action-name>view</action-name>
- </policy-permission>
- </security-constraint>
- </instance>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <instance>
<instance-name>UserPortletInstance</instance-name>
<component-ref>portal.UserPortlet</component-ref>
</instance>
Modified: labs/jbosslabs/trunk/portal-extensions/primates/project.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/primates/project.xml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/primates/project.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -29,6 +29,11 @@
<jar>ejb3-persistence.jar</jar>
</dependency>
<dependency>
+ <groupId>jboss-forge</groupId>
+ <artifactId>forge-common</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
<groupId>jboss</groupId>
<artifactId>jboss-ejb3x</artifactId>
<version>3.0RC6</version>
Modified: labs/jbosslabs/trunk/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/service/PrimatesServiceImpl.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/service/PrimatesServiceImpl.java 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/service/PrimatesServiceImpl.java 2007-02-02 15:37:57 UTC (rev 9291)
@@ -30,15 +30,13 @@
import org.jboss.annotation.ejb.Management;
import org.jboss.annotation.ejb.Service;
-import org.jboss.forge.common.soa.primates.PrimateDTO;
-import org.jboss.forge.common.soa.primates.PrimatesService;
+import org.jboss.forge.common.ejb3.PrimatesService;
+import org.jboss.forge.common.primates.PrimateDTO;
import org.jboss.logging.Logger;
import org.jboss.portal.core.servlet.jsp.taglib.context.DelegateContext;
-import org.jboss.portal.core.modules.ModuleException;
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.UserModule;
import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.identity.NoSuchUserException;
import org.jbosslabs.portlets.primates.Primate;
import org.jbosslabs.portlets.primates.PrimatesDescriptor;
import org.jbosslabs.portlets.primates.PrimatesTools;
Modified: labs/jbosslabs/trunk/portal-extensions/project.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/project.xml 2007-02-02 15:07:19 UTC (rev 9290)
+++ labs/jbosslabs/trunk/portal-extensions/project.xml 2007-02-02 15:37:57 UTC (rev 9291)
@@ -5,24 +5,4 @@
See terms of license at gnu.org.
-->
<project>
- <dependency>
- <id>portlet-api</id>
- <version>1.0</version>
- </dependency>
-
- <dependency>
- <id>rome</id>
- <version>0.5</version>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
-
- <dependency>
- <id>jdom</id>
- <version>1.0</version>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
</project>
More information about the jboss-svn-commits
mailing list