JBoss Portal SVN: r10277 - modules/web/trunk/web/src/test.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-03-12 20:45:45 -0400 (Wed, 12 Mar 2008)
New Revision: 10277
Modified:
modules/web/trunk/web/src/test/build.xml
Log:
Added support for running tests only on tomcat or jboss using -Dtests=tomcat or -Dtests=jboss, respectively.
Modified: modules/web/trunk/web/src/test/build.xml
===================================================================
--- modules/web/trunk/web/src/test/build.xml 2008-03-12 17:05:25 UTC (rev 10276)
+++ modules/web/trunk/web/src/test/build.xml 2008-03-13 00:45:45 UTC (rev 10277)
@@ -12,14 +12,31 @@
<antcall target="tests.local"/>
- <antcall target="tests.jboss-4.2"/>
- <antcall target="tests.tomcat-6"/>
+ <antcall target="tests.call.single"/>
+ <antcall target="tests.call.all"/>
<!--Cleanup-->
<delete dir="${test.temp.dir}"/>
</target>
+ <target name="tests.call.all" unless="tests">
+ <antcall target="tests.jboss"/>
+ <antcall target="tests.tomcat"/>
+ </target>
+
+ <target name="tests.call.single" if="tests">
+ <antcall target="tests.${tests}"/>
+ </target>
+
+ <!-- Aliases for easier test execution -->
+ <target name="tests.jboss">
+ <antcall target="tests.jboss-4.2"/>
+ </target>
+ <target name="tests.tomcat">
+ <antcall target="tests.tomcat-6"/>
+ </target>
+
<target name="prepare_env">
<!--Relative path to target dir-->
16 years, 3 months
JBoss Portal SVN: r10276 - branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-03-12 13:05:25 -0400 (Wed, 12 Mar 2008)
New Revision: 10276
Added:
branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf/jsf-facelets-1.1.14.jar
branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf/portletbridge-api-1.0.0-SNAPSHOT.jar
branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf/portletbridge-impl-1.0.0-SNAPSHOT.jar
branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf/richfaces-api-3.1.4.SR1.jar
branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf/richfaces-impl-3.1.4.SR1.jar
branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf/richfaces-ui-3.1.4.SR1.jar
Log:
temporary jars for migration debugging
Added: branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf/jsf-facelets-1.1.14.jar
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf/jsf-facelets-1.1.14.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf/portletbridge-api-1.0.0-SNAPSHOT.jar
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf/portletbridge-api-1.0.0-SNAPSHOT.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf/portletbridge-impl-1.0.0-SNAPSHOT.jar
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf/portletbridge-impl-1.0.0-SNAPSHOT.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf/richfaces-api-3.1.4.SR1.jar
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf/richfaces-api-3.1.4.SR1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf/richfaces-impl-3.1.4.SR1.jar
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf/richfaces-impl-3.1.4.SR1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf/richfaces-ui-3.1.4.SR1.jar
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/etc/sun-jsf/richfaces-ui-3.1.4.SR1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 3 months
JBoss Portal SVN: r10275 - in branches/JBoss_Portal_2_6_4_JBPB/core-admin: src/resources/portal-admin-war/WEB-INF and 1 other directory.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-03-12 13:04:09 -0400 (Wed, 12 Mar 2008)
New Revision: 10275
Modified:
branches/JBoss_Portal_2_6_4_JBPB/core-admin/build.xml
branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/jboss-portlet.xml
branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/portlet-instances.xml
branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml
branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml
Log:
core-admin migration to portlet bridge
Modified: branches/JBoss_Portal_2_6_4_JBPB/core-admin/build.xml
===================================================================
--- branches/JBoss_Portal_2_6_4_JBPB/core-admin/build.xml 2008-03-12 15:51:48 UTC (rev 10274)
+++ branches/JBoss_Portal_2_6_4_JBPB/core-admin/build.xml 2008-03-12 17:04:09 UTC (rev 10275)
@@ -95,12 +95,17 @@
<path refid="jboss.cache.classpath"/>
<path refid="jbossas/core.libs.classpath"/>
<path refid="hibernate.hibernate.classpath"/>
- <path refid="apache.myfaces.classpath"/>
+ <path refid="sun.jsf.classpath"/>
<path refid="apache.log4j.classpath"/>
<path refid="sun.servlet.classpath"/>
- <path refid="facelets.facelets.classpath"/>
<path refid="el.el.classpath"/>
- <pathelement location="${source.etc}/sun-jsf/jsf-example.jar"/>
+ <pathelement location="${source.etc}/sun-jsf/jsf-facelets-1.1.14.jar"/>
+ <pathelement location="${source.etc}/sun-jsf/portletbridge-api-1.0.0-SNAPSHOT.jar"/>
+ <pathelement location="${source.etc}/sun-jsf/portletbridge-impl-1.0.0-SNAPSHOT.jar"/>
+ <pathelement location="${source.etc}/sun-jsf/richfaces-api-3.1.4.SR1.jar"/>
+ <pathelement location="${source.etc}/sun-jsf/richfaces-impl-3.1.4.SR1.jar"/>
+ <pathelement location="${source.etc}/sun-jsf/richfaces-ui-3.1.4.SR1.jar"/>
+
</path>
<!-- Configure modules -->
@@ -185,14 +190,16 @@
</jar>
<!-- portal-admin.war -->
- <copy todir="${build.resources}/portal-admin-war/WEB-INF/lib2">
- <fileset dir="${apache.myfaces.lib}" includes="myfaces-api.jar,myfaces-impl.jar,jstl.jar"/>
- <fileset dir="${build.lib}" includes="portal-core-admin-lib.jar"/>
- <fileset dir="${jboss.portal-faces.root}/lib" includes="portal-faces-lib.jar"/>
- <fileset dir="../core-admin/src/etc/sun-jsf" includes="jsf-example.jar"/>
- <fileset dir="${facelets.facelets.lib}" includes="jsf-facelets.jar"/>
- <fileset dir="${el.el.lib}" includes="el-api.jar,el-ri.jar"/>
- <fileset dir="${commons.el.lib}" includes="commons-el.jar"/>
+ <copy todir="${build.resources}/portal-admin-war/WEB-INF/lib">
+ <fileset dir="${apache.myfaces.lib}" includes="jstl.jar"/>
+ <fileset dir="../core-admin/src/etc/sun-jsf" includes="jsf-facelets-1.1.14.jar"/>
+ <fileset dir="../core-admin/src/etc/sun-jsf" includes="portletbridge-api-1.0.0-SNAPSHOT.jar"/>
+ <fileset dir="../core-admin/src/etc/sun-jsf" includes="portletbridge-impl-1.0.0-SNAPSHOT.jar"/>
+ <fileset dir="../core-admin/src/etc/sun-jsf" includes="richfaces-api-3.1.4.SR1.jar"/>
+ <fileset dir="../core-admin/src/etc/sun-jsf" includes="richfaces-impl-3.1.4.SR1.jar"/>
+ <fileset dir="../core-admin/src/etc/sun-jsf" includes="richfaces-ui-3.1.4.SR1.jar"/>
+ <fileset dir="${build.lib}" includes="portal-core-admin-lib.jar"/>
+ <fileset dir="${jboss.portal-faces.root}/lib" includes="portal-faces-lib.jar"/>
<fileset dir="${apache.beanutils.lib}" includes="commons-beanutils.jar"/>
<fileset dir="${apache.digester.lib}" includes="commons-digester.jar"/>
<fileset dir="${apache.lang.lib}" includes="commons-lang.jar"/>
Modified: branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
===================================================================
--- branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2008-03-12 15:51:48 UTC (rev 10274)
+++ branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2008-03-12 17:04:09 UTC (rev 10275)
@@ -28,9 +28,16 @@
<faces-config>
<application>
+ <view-handler>
+ org.jboss.portletbridge.application.PortletViewHandler
+ </view-handler>
<property-resolver>org.jboss.portal.core.admin.ui.AdminPropertyResolver</property-resolver>
- <view-handler>com.sun.facelets.FaceletPortletViewHandler</view-handler>
- </application>
+ </application>
+ <factory>
+ <faces-context-factory>
+ org.jboss.portletbridge.context.FacesContextFactoryImpl
+ </faces-context-factory>
+ </factory>
<converter>
<converter-for-class>org.jboss.portal.core.model.content.ContentType</converter-for-class>
Modified: branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/jboss-portlet.xml
===================================================================
--- branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/jboss-portlet.xml 2008-03-12 15:51:48 UTC (rev 10274)
+++ branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/jboss-portlet.xml 2008-03-12 17:04:09 UTC (rev 10275)
@@ -35,6 +35,9 @@
<trans-attribute>Required</trans-attribute>
</transaction>
<header-content>
+ <script src="/faces/rfRes/org/ajax4jsf/framework.pack.js" type="text/javascript" ></script>
+ <script src="/faces/rfRes/org/richfaces/ui.pack.js" type="text/javascript" ></script>
+ <link rel="stylesheet" type="text/css" href="/faces/rfRes/org/richfaces/skin.xcss" />
<link rel="stylesheet" type="text/css" href="/css/style.css" media="screen"/>
</header-content>
<portlet-info>
@@ -53,6 +56,9 @@
<trans-attribute>Required</trans-attribute>
</transaction>
<header-content>
+ <script src="/faces/rfRes/org/ajax4jsf/framework.pack.js" type="text/javascript" ></script>
+ <script src="/faces/rfRes/org/richfaces/ui.pack.js" type="text/javascript" ></script>
+ <link rel="stylesheet" type="text/css" href="/faces/rfRes/org/richfaces/skin.xcss" />
<link rel="stylesheet" type="text/css" href="/css/style.css" media="screen"/>
</header-content>
<portlet-info>
Modified: branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/portlet-instances.xml
===================================================================
--- branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/portlet-instances.xml 2008-03-12 15:51:48 UTC (rev 10274)
+++ branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/portlet-instances.xml 2008-03-12 17:04:09 UTC (rev 10275)
@@ -47,4 +47,10 @@
<portlet-ref>DashboardConfigPortlet</portlet-ref>
</instance>
</deployment>
+ <deployment>
+ <instance>
+ <instance-id>DashboardConfigPortletSecondInstance</instance-id>
+ <portlet-ref>DashboardConfigPortlet</portlet-ref>
+ </instance>
+ </deployment>
</deployments>
\ No newline at end of file
Modified: branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml 2008-03-12 15:51:48 UTC (rev 10274)
+++ branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml 2008-03-12 17:04:09 UTC (rev 10275)
@@ -31,11 +31,15 @@
<description>Administration Portlet</description>
<portlet-name>AdminPortlet</portlet-name>
<display-name>Administration Portlet</display-name>
- <portlet-class>org.jboss.portal.faces.loader.FacesPortlet</portlet-class>
+ <portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
<init-param>
- <name>default-view</name>
+ <name>javax.portlet.faces.defaultViewId.view</name>
<value>/WEB-INF/jsf/objects.xhtml</value>
</init-param>
+ <init-param>
+ <name>javax.portlet.faces.preserveActionParams</name>
+ <value>true</value>
+ </init-param>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -49,11 +53,15 @@
<description>Dashboard Configurator Portlet</description>
<portlet-name>DashboardConfigPortlet</portlet-name>
<display-name>Dashboard Configurator Portlet</display-name>
- <portlet-class>org.jboss.portal.faces.loader.FacesPortlet</portlet-class>
+ <portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
<init-param>
- <name>default-view</name>
+ <name>javax.portlet.faces.defaultViewId.view</name>
<value>/WEB-INF/jsf/dashboard/dashboard.xhtml</value>
</init-param>
+ <init-param>
+ <name>javax.portlet.faces.preserveActionParams</name>
+ <value>true</value>
+ </init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
Modified: branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml
===================================================================
--- branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml 2008-03-12 15:51:48 UTC (rev 10274)
+++ branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml 2008-03-12 17:04:09 UTC (rev 10275)
@@ -28,32 +28,42 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
- <!-- MyFaces specific configuration -->
+ <!-- Bridge specific configuration -->
<context-param>
- <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
- <param-value>true</param-value>
+ <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
+ <param-value>
+ org.jboss.portletbridge.application.FaceletPortletViewHandler
+ </param-value>
</context-param>
<context-param>
- <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
- <param-value>false</param-value>
+ <param-name>javax.portlet.faces.renderPolicy</param-name>
+ <param-value>ALWAYS_DELEGATE</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.portlet.faces.preserveActionParams</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.ajax4jsf.RESOURCE_URI_PREFIX</param-name>
+ <param-value>rfRes</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.LoadStyleStrategy</param-name>
+ <param-value>NONE</param-value>
</context-param>
<context-param>
- <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
- <param-value>false</param-value>
+ <param-name>org.richfaces.LoadScriptStrategy</param-name>
+ <param-value>NONE</param-value>
</context-param>
<context-param>
- <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
+ <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
<param-value>false</param-value>
</context-param>
- <context-param>
- <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
- <param-value>true</param-value>
- </context-param>
<!-- Facelet configuration -->
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
- <param-value>false</param-value>
+ <param-value>true</param-value>
</context-param>
<context-param>
<param-name>facelets.SKIP_COMMENTS</param-name>
@@ -76,9 +86,14 @@
<!-- The JSF servlet -->
<servlet>
- <servlet-name>Faces Servlet</servlet-name>
- <servlet-class>org.jboss.portal.faces.loader.FacesLoaderServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
+ <servlet-name>FacesServlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>FacesServlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+
</web-app>
16 years, 3 months
JBoss Portal SVN: r10274 - in branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity: services/impl and 3 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-03-12 11:51:48 -0400 (Wed, 12 Mar 2008)
New Revision: 10274
Modified:
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailService.java
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/WorkflowSoftDependency.java
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityMailServiceImpl.java
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfigurationServiceImpl.java
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/UIComponentConfiguration.java
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/SendValidationMailAction.java
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java
Log:
JBPORTAL-1953: Validation email is sent to an old email address
JBPORTAL-1952: IdentityUIConfigurationServiceImpl : better logs of exception, for better config debugging
Modified: branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailService.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailService.java 2008-03-12 15:38:16 UTC (rev 10273)
+++ branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailService.java 2008-03-12 15:51:48 UTC (rev 10274)
@@ -34,6 +34,25 @@
*/
public interface IdentityMailService
{
- void sendMail(String templateLocation, Map mailData, Locale locale) throws IOException, TemplateException;
+ /**
+ * Generates and sends an email based on a template.
+ *
+ * @param the template location (directory)
+ * @param a map required for the template
+ * @param the requested locale
+ * @throws IOException
+ * @throws TemplateException
+ */
+ void sendMail(String templateLocation, Map<String, String> mailData, Locale locale) throws IOException, TemplateException;
+
+ /**
+ * Sends an email
+ *
+ * @param email from
+ * @param email to
+ * @param subject
+ * @param email body
+ */
+ public void send(String emailFrom, String emailTo, String subject, String emailText);
}
Modified: branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/WorkflowSoftDependency.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/WorkflowSoftDependency.java 2008-03-12 15:38:16 UTC (rev 10273)
+++ branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/WorkflowSoftDependency.java 2008-03-12 15:51:48 UTC (rev 10274)
@@ -42,9 +42,6 @@
*/
public class WorkflowSoftDependency extends AbstractJBossService
{
-
- private Logger log = Logger.getLogger(WorkflowSoftDependency.class);
-
private MBeanServer server;
private IdentityUIConfigurationService identityUIConfigurationService;
@@ -55,6 +52,9 @@
private ObjectName workflowServiceObjectName;
+ /** The logger. */
+ private Logger log = Logger.getLogger(WorkflowSoftDependency.class);
+
public WorkflowSoftDependency()
{
server = (MBeanServer)MBeanServerFactory.findMBeanServer(null).get(0);
@@ -84,7 +84,7 @@
}
catch (Exception e)
{
- e.printStackTrace();
+ log.error("Error starting workflow", e);
}
}
@@ -95,7 +95,7 @@
}
catch (Exception e)
{
- e.printStackTrace();
+ log.error(e);
}
}
@@ -107,7 +107,7 @@
}
catch (Exception e)
{
- e.printStackTrace();
+ log.error(e);
}
}
@@ -148,7 +148,7 @@
}
catch (MBeanProxyCreationException e)
{
- e.printStackTrace();
+ log.error("Error starting workflow", e);
}
}
else
@@ -162,7 +162,7 @@
}
catch (Exception e)
{
- e.printStackTrace();
+ log.error(e);
}
}
}
Modified: branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityMailServiceImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityMailServiceImpl.java 2008-03-12 15:38:16 UTC (rev 10273)
+++ branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityMailServiceImpl.java 2008-03-12 15:51:48 UTC (rev 10274)
@@ -28,12 +28,12 @@
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.net.URL;
-import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
import org.jboss.logging.Logger;
+import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.core.identity.services.IdentityConstants;
import org.jboss.portal.core.identity.services.IdentityMailService;
import org.jboss.portal.core.identity.services.metadata.IdentityUIConfiguration;
@@ -52,47 +52,42 @@
*/
public class IdentityMailServiceImpl extends AbstractJBossService implements IdentityMailService
{
-
- /** Template mail data */
- private Map mailData = new HashMap();
-
- /** Requested locale */
- private Locale locale;
-
- /** The e-mail text */
- private String emailText = null;
- /** The e-mail domain */
+ /** The e-mail domain. */
private String emailDomain = null;
- /** E-Mail from */
+ /** E-Mail from. */
private String emailFrom = null;
-
- /** Template location */
- private String templateLocation;
-
- /** The mail module */
+
+ /** The mail module. */
private MailModule mailModule;
- /** The core-identity configuration service */
+ /** The template path. */
+ private static final String TEMPLATE_PATH = "conf/templates/";
+
+ /** The template prefix. */
+ private static final String TEMPLATE_PREFIX = "/emailTemplate_";
+
+ /** The core-identity configuration service. */
private IdentityUIConfigurationService identityUIConfigurationService;
- /** . */
+ /** The logger */
private static final Logger log = Logger.getLogger(IdentityMailServiceImpl.class);
- /** . */
+ /** The JNDI binding */
private JNDI.Binding jndiBinding;
- /** . */
+ /** The JNDI name */
private String jndiName = null;
public void startService() throws Exception
{
super.startService();
- IdentityUIConfiguration cf =this.identityUIConfigurationService.getConfiguration();
- this.emailDomain = cf.getEmailDomain();
- this.emailFrom = cf.getEmailFrom();
+ IdentityUIConfiguration cf =this.identityUIConfigurationService.getConfiguration();
+ // Set mail attributes
+ this.setEmailDomain(cf.getEmailDomain());
+ this.setEmailFrom(cf.getEmailFrom());
if (this.jndiName != null)
{
@@ -119,6 +114,9 @@
public void setEmailDomain(String emailDomain)
{
+ if(emailDomain == null)
+ throw new IllegalArgumentException("email domain may not be null.");
+
this.emailDomain = emailDomain;
}
@@ -129,6 +127,9 @@
public void setEmailFrom(String emailFrom)
{
+ if(emailFrom == null)
+ throw new IllegalArgumentException("email from may not be null.");
+
this.emailFrom = emailFrom;
}
@@ -162,12 +163,16 @@
this.jndiName = jndiName;
}
- public void sendMail(String templateLocation, Map mailData, Locale locale) throws IOException, TemplateException
+ public void sendMail(String templateLocation, Map<String, String> mailData, Locale locale) throws IOException, TemplateException
{
- this.templateLocation = templateLocation;
- this.mailData = mailData;
- this.locale = locale;
- this.mailData.put(IdentityConstants.EMAIL_DOMAIN, emailDomain);
+ if(templateLocation == null)
+ throw new IllegalArgumentException("template location may not be null.");
+ if(mailData == null)
+ throw new IllegalArgumentException("mail data may not be null.");
+ if(locale == null)
+ throw new IllegalArgumentException("locale may not be null.");
+
+ mailData.put(IdentityConstants.EMAIL_DOMAIN, emailDomain);
ResourceBundle bundle = ResourceBundle.getBundle("conf.bundles.Identity", locale);
@@ -188,41 +193,49 @@
}
else
{
- throw new IllegalArgumentException("unknown template.");
+ subject = bundle.getString(templateLocation);
+ if(subject == null)
+ throw new IllegalArgumentException("unknown template.");
}
// Generating message
- this.generateEmailText();
+ String emailText = generateEmailText(templateLocation, mailData, locale);
// log.debug(this.emailText);
// Sending mail
- this.getMailModule().send(emailFrom, to , subject, emailText);
+ send(emailFrom, to , subject, emailText);
}
- private void generateEmailText() throws IOException, TemplateException
+ public void send(String emailFrom, String emailTo, String subject, String emailText)
{
+ this.getMailModule().send(emailFrom, emailTo, subject, emailText);
+ }
+
+ private String generateEmailText(String templateLocation, Map<String, String> mailData, Locale locale) throws IOException, TemplateException
+ {
ClassLoader tcl = Thread.currentThread().getContextClassLoader();
- URL config = tcl.getResource("conf/templates/" + this.templateLocation + "/emailTemplate_" + locale.getLanguage() + "_" + locale.getCountry() + ".tpl");
+ URL config = tcl.getResource(TEMPLATE_PATH + templateLocation + TEMPLATE_PREFIX + locale.getLanguage() + "_" + locale.getCountry() + ".tpl");
if (config == null)
{
- config = tcl.getResource("conf/templates/" + this.templateLocation + "/emailTemplate_" + locale.getLanguage() + ".tpl");
+ config = tcl.getResource(TEMPLATE_PATH + templateLocation + TEMPLATE_PREFIX + locale.getLanguage() + ".tpl");
}
if (config == null)
{
- config = tcl.getResource("conf/templates/" + this.templateLocation + "/emailTemplate.tpl");
+ config = tcl.getResource(TEMPLATE_PATH + templateLocation + TEMPLATE_PREFIX + ".tpl");
}
if (config == null)
{
- throw new FileNotFoundException("Cannot load a suitable emailTemplate.tpl in conf/templates/"
- + this.templateLocation);
+ throw new FileNotFoundException("Cannot load a suitable email templte in: " + TEMPLATE_PATH);
}
+
InputStream in = config.openStream();
Template tpl = new Template("emailTemplate", new InputStreamReader(in), new Configuration());
StringWriter out = new StringWriter();
- tpl.process(this.mailData, out);
- out.close();
+ tpl.process(mailData, out);
- this.emailText = out.toString();
+ IOTools.safeClose(out);
+
+ return out.toString();
}
}
Modified: branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfigurationServiceImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfigurationServiceImpl.java 2008-03-12 15:38:16 UTC (rev 10273)
+++ branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfigurationServiceImpl.java 2008-03-12 15:51:48 UTC (rev 10274)
@@ -87,7 +87,7 @@
// Loading workflow if subscriptionmodes != automatic
if (this.configuration.enableWorkflow())
{
-
+ // Throws an CoreIdentityConfigurationException if the workflow service is null
this.isValidConfiguration();
String subscriptionMode = this.configuration.getSubscriptionMode();
@@ -221,7 +221,7 @@
JbpmContext jbpmContext = null;
try
- {
+ {
jbpmContext = this.getWorkflowService().getJbpmConfiguration().createJbpmContext();
ProcessDefinition processDefinition = jbpmContext.getGraphSession().findLatestProcessDefinition(processName);
@@ -243,7 +243,7 @@
}
catch(Exception e)
{
- throw new CoreIdentityConfigurationException("I don't like your subscription mode! Please make sure that the file and the process name match - also check the syntax.");
+ throw new CoreIdentityConfigurationException("I don't like your subscription mode! Please make sure that the file and the process name match - also check the syntax.", e);
}
finally
{
@@ -279,8 +279,7 @@
}
catch (IdentityException e)
{
- uiComponent = null;
- throw new IllegalArgumentException("cannot resolve property: " + uiComponent.getPropertyRef());
+ throw new IllegalArgumentException("cannot resolve property: " + uiComponent.getPropertyRef(), e);
}
}
return uiComponent;
@@ -332,11 +331,11 @@
}
catch (IOException e)
{
- throw new CoreIdentityConfigurationException("Could not find configuration file or schema.");
+ throw new CoreIdentityConfigurationException("Could not find configuration file or schema.", e);
}
catch (JBossXBException e)
{
- throw new CoreIdentityConfigurationException("Could not parse configuration file.");
+ throw new CoreIdentityConfigurationException("Could not parse configuration file.", e);
}
catch (Throwable e)
{
Modified: branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/UIComponentConfiguration.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/UIComponentConfiguration.java 2008-03-12 15:38:16 UTC (rev 10273)
+++ branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/UIComponentConfiguration.java 2008-03-12 15:51:48 UTC (rev 10274)
@@ -166,6 +166,6 @@
public Class getPropertyClass() throws ClassNotFoundException
{
// Returns the Class of the Property
- return ClassLoader.getSystemClassLoader().loadClass(this.propertyInfo.getType());
+ return Thread.currentThread().getContextClassLoader().loadClass(this.propertyInfo.getType());
}
}
Modified: branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/SendValidationMailAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/SendValidationMailAction.java 2008-03-12 15:38:16 UTC (rev 10273)
+++ branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/SendValidationMailAction.java 2008-03-12 15:51:48 UTC (rev 10274)
@@ -78,11 +78,10 @@
emailMap.put("username", uc.getUsername());
emailMap.put("password", uc.getPassword());
}
- // Change email
+ // Change email request (send an email to the NEW email address)
else if (IdentityConstants.ACTION_CHANGE_EMAIL.equals(action))
{
- String emailTo = this.getIdentityManagementService().getCurrentEmail(uc.getUsername());
- emailMap.put(IdentityConstants.EMAIL_TO, emailTo);
+ emailMap.put(IdentityConstants.EMAIL_TO, email);
}
else
{
@@ -90,7 +89,8 @@
}
ectx.getContextInstance().setVariable(IdentityConstants.VALIDATION_HASH, hash);
- // Building the validation URL
+
+ // Generating the validation URL
String portalURL = (String) ectx.getContextInstance().getVariable(IdentityConstants.PORTAL_URL);
String activationLink = portalURL + "/" + IdentityConstants.VALIDATE_EMAIL + "/"
+ ectx.getProcessInstance().getId() + "/" + hash;
@@ -149,21 +149,4 @@
return identityMailService;
}
- private IdentityUserManagementService getIdentityManagementService()
- {
- if (identityManagementService == null)
- {
- try
- {
- this.identityManagementService = (IdentityUserManagementService) new InitialContext()
- .lookup("java:/portal/IdentityUserManagementService");
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
- return identityManagementService;
- }
-
}
Modified: branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java 2008-03-12 15:38:16 UTC (rev 10273)
+++ branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java 2008-03-12 15:51:48 UTC (rev 10274)
@@ -52,6 +52,9 @@
/** The registration service */
private RegistrationService registrationService;
+ /** The logger */
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(UsernameValidator.class);
+
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
{
String username = (String) value;
@@ -66,12 +69,14 @@
// checking jBPM context
if (registrationService.checkUsername(username))
{
- throw new ValidatorException(new FacesMessage(bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN") + username));
+ throw new ValidatorException(new FacesMessage(bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN")
+ + username));
}
User u = userModule.findUserByUserName(username);
// User found so this nickname is already taken
- throw new ValidatorException(new FacesMessage(bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN") + u.getUserName()));
+ throw new ValidatorException(new FacesMessage(bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN")
+ + u.getUserName()));
}
catch (NoSuchUserException e)
{
@@ -83,11 +88,13 @@
}
catch (IdentityException e)
{
+ log.error("Error validation username", e);
throw new ValidatorException(new FacesMessage(bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR")));
}
catch (CoreIdentityConfigurationException e)
{
- throw new ValidatorException(new FacesMessage(bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR")));
+ log.error("Error validation username", e);
+ throw new ValidatorException(new FacesMessage(bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR")));
}
}
}
16 years, 3 months
JBoss Portal SVN: r10273 - in branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity: services/impl and 3 other directories.
by portal-commits@lists.jboss.org
Author: emuckenhuber
Date: 2008-03-12 11:38:16 -0400 (Wed, 12 Mar 2008)
New Revision: 10273
Modified:
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailService.java
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/WorkflowSoftDependency.java
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityMailServiceImpl.java
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfigurationServiceImpl.java
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/UIComponentConfiguration.java
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/SendValidationMailAction.java
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java
Log:
better logging and minor cleanup
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailService.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailService.java 2008-03-12 12:21:16 UTC (rev 10272)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailService.java 2008-03-12 15:38:16 UTC (rev 10273)
@@ -34,6 +34,25 @@
*/
public interface IdentityMailService
{
- void sendMail(String templateLocation, Map mailData, Locale locale) throws IOException, TemplateException;
+ /**
+ * Generates and sends an email based on a template.
+ *
+ * @param the template location (directory)
+ * @param a map required for the template
+ * @param the requested locale
+ * @throws IOException
+ * @throws TemplateException
+ */
+ void sendMail(String templateLocation, Map<String, String> mailData, Locale locale) throws IOException, TemplateException;
+
+ /**
+ * Sends an email
+ *
+ * @param email from
+ * @param email to
+ * @param subject
+ * @param email body
+ */
+ public void send(String emailFrom, String emailTo, String subject, String emailText);
}
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/WorkflowSoftDependency.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/WorkflowSoftDependency.java 2008-03-12 12:21:16 UTC (rev 10272)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/WorkflowSoftDependency.java 2008-03-12 15:38:16 UTC (rev 10273)
@@ -42,9 +42,6 @@
*/
public class WorkflowSoftDependency extends AbstractJBossService
{
-
- private Logger log = Logger.getLogger(WorkflowSoftDependency.class);
-
private MBeanServer server;
private IdentityUIConfigurationService identityUIConfigurationService;
@@ -55,6 +52,9 @@
private ObjectName workflowServiceObjectName;
+ /** The logger. */
+ private Logger log = Logger.getLogger(WorkflowSoftDependency.class);
+
public WorkflowSoftDependency()
{
server = (MBeanServer)MBeanServerFactory.findMBeanServer(null).get(0);
@@ -84,7 +84,7 @@
}
catch (Exception e)
{
- e.printStackTrace();
+ log.error("Error starting workflow", e);
}
}
@@ -95,7 +95,7 @@
}
catch (Exception e)
{
- e.printStackTrace();
+ log.error(e);
}
}
@@ -107,7 +107,7 @@
}
catch (Exception e)
{
- e.printStackTrace();
+ log.error(e);
}
}
@@ -148,7 +148,7 @@
}
catch (MBeanProxyCreationException e)
{
- e.printStackTrace();
+ log.error("Error starting workflow", e);
}
}
else
@@ -162,7 +162,7 @@
}
catch (Exception e)
{
- e.printStackTrace();
+ log.error(e);
}
}
}
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityMailServiceImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityMailServiceImpl.java 2008-03-12 12:21:16 UTC (rev 10272)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityMailServiceImpl.java 2008-03-12 15:38:16 UTC (rev 10273)
@@ -28,12 +28,12 @@
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.net.URL;
-import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
import org.jboss.logging.Logger;
+import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.core.identity.services.IdentityConstants;
import org.jboss.portal.core.identity.services.IdentityMailService;
import org.jboss.portal.core.identity.services.metadata.IdentityUIConfiguration;
@@ -52,47 +52,42 @@
*/
public class IdentityMailServiceImpl extends AbstractJBossService implements IdentityMailService
{
-
- /** Template mail data */
- private Map mailData = new HashMap();
-
- /** Requested locale */
- private Locale locale;
-
- /** The e-mail text */
- private String emailText = null;
- /** The e-mail domain */
+ /** The e-mail domain. */
private String emailDomain = null;
- /** E-Mail from */
+ /** E-Mail from. */
private String emailFrom = null;
-
- /** Template location */
- private String templateLocation;
-
- /** The mail module */
+
+ /** The mail module. */
private MailModule mailModule;
- /** The core-identity configuration service */
+ /** The template path. */
+ private static final String TEMPLATE_PATH = "conf/templates/";
+
+ /** The template prefix. */
+ private static final String TEMPLATE_PREFIX = "/emailTemplate_";
+
+ /** The core-identity configuration service. */
private IdentityUIConfigurationService identityUIConfigurationService;
- /** . */
+ /** The logger */
private static final Logger log = Logger.getLogger(IdentityMailServiceImpl.class);
- /** . */
+ /** The JNDI binding */
private JNDI.Binding jndiBinding;
- /** . */
+ /** The JNDI name */
private String jndiName = null;
public void startService() throws Exception
{
super.startService();
- IdentityUIConfiguration cf =this.identityUIConfigurationService.getConfiguration();
- this.emailDomain = cf.getEmailDomain();
- this.emailFrom = cf.getEmailFrom();
+ IdentityUIConfiguration cf =this.identityUIConfigurationService.getConfiguration();
+ // Set mail attributes
+ this.setEmailDomain(cf.getEmailDomain());
+ this.setEmailFrom(cf.getEmailFrom());
if (this.jndiName != null)
{
@@ -119,6 +114,9 @@
public void setEmailDomain(String emailDomain)
{
+ if(emailDomain == null)
+ throw new IllegalArgumentException("email domain may not be null.");
+
this.emailDomain = emailDomain;
}
@@ -129,6 +127,9 @@
public void setEmailFrom(String emailFrom)
{
+ if(emailFrom == null)
+ throw new IllegalArgumentException("email from may not be null.");
+
this.emailFrom = emailFrom;
}
@@ -162,12 +163,16 @@
this.jndiName = jndiName;
}
- public void sendMail(String templateLocation, Map mailData, Locale locale) throws IOException, TemplateException
+ public void sendMail(String templateLocation, Map<String, String> mailData, Locale locale) throws IOException, TemplateException
{
- this.templateLocation = templateLocation;
- this.mailData = mailData;
- this.locale = locale;
- this.mailData.put(IdentityConstants.EMAIL_DOMAIN, emailDomain);
+ if(templateLocation == null)
+ throw new IllegalArgumentException("template location may not be null.");
+ if(mailData == null)
+ throw new IllegalArgumentException("mail data may not be null.");
+ if(locale == null)
+ throw new IllegalArgumentException("locale may not be null.");
+
+ mailData.put(IdentityConstants.EMAIL_DOMAIN, emailDomain);
ResourceBundle bundle = ResourceBundle.getBundle("conf.bundles.Identity", locale);
@@ -188,41 +193,49 @@
}
else
{
- throw new IllegalArgumentException("unknown template.");
+ subject = bundle.getString(templateLocation);
+ if(subject == null)
+ throw new IllegalArgumentException("unknown template.");
}
// Generating message
- this.generateEmailText();
+ String emailText = generateEmailText(templateLocation, mailData, locale);
// log.debug(this.emailText);
// Sending mail
- this.getMailModule().send(emailFrom, to , subject, emailText);
+ send(emailFrom, to , subject, emailText);
}
- private void generateEmailText() throws IOException, TemplateException
+ public void send(String emailFrom, String emailTo, String subject, String emailText)
{
+ this.getMailModule().send(emailFrom, emailTo, subject, emailText);
+ }
+
+ private String generateEmailText(String templateLocation, Map<String, String> mailData, Locale locale) throws IOException, TemplateException
+ {
ClassLoader tcl = Thread.currentThread().getContextClassLoader();
- URL config = tcl.getResource("conf/templates/" + this.templateLocation + "/emailTemplate_" + locale.getLanguage() + "_" + locale.getCountry() + ".tpl");
+ URL config = tcl.getResource(TEMPLATE_PATH + templateLocation + TEMPLATE_PREFIX + locale.getLanguage() + "_" + locale.getCountry() + ".tpl");
if (config == null)
{
- config = tcl.getResource("conf/templates/" + this.templateLocation + "/emailTemplate_" + locale.getLanguage() + ".tpl");
+ config = tcl.getResource(TEMPLATE_PATH + templateLocation + TEMPLATE_PREFIX + locale.getLanguage() + ".tpl");
}
if (config == null)
{
- config = tcl.getResource("conf/templates/" + this.templateLocation + "/emailTemplate.tpl");
+ config = tcl.getResource(TEMPLATE_PATH + templateLocation + TEMPLATE_PREFIX + ".tpl");
}
if (config == null)
{
- throw new FileNotFoundException("Cannot load a suitable emailTemplate.tpl in conf/templates/"
- + this.templateLocation);
+ throw new FileNotFoundException("Cannot load a suitable email templte in: " + TEMPLATE_PATH);
}
+
InputStream in = config.openStream();
Template tpl = new Template("emailTemplate", new InputStreamReader(in), new Configuration());
StringWriter out = new StringWriter();
- tpl.process(this.mailData, out);
- out.close();
+ tpl.process(mailData, out);
- this.emailText = out.toString();
+ IOTools.safeClose(out);
+
+ return out.toString();
}
}
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfigurationServiceImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfigurationServiceImpl.java 2008-03-12 12:21:16 UTC (rev 10272)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfigurationServiceImpl.java 2008-03-12 15:38:16 UTC (rev 10273)
@@ -87,7 +87,7 @@
// Loading workflow if subscriptionmodes != automatic
if (this.configuration.enableWorkflow())
{
-
+ // Throws an CoreIdentityConfigurationException if the workflow service is null
this.isValidConfiguration();
String subscriptionMode = this.configuration.getSubscriptionMode();
@@ -221,7 +221,7 @@
JbpmContext jbpmContext = null;
try
- {
+ {
jbpmContext = this.getWorkflowService().getJbpmConfiguration().createJbpmContext();
ProcessDefinition processDefinition = jbpmContext.getGraphSession().findLatestProcessDefinition(processName);
@@ -243,7 +243,7 @@
}
catch(Exception e)
{
- throw new CoreIdentityConfigurationException("I don't like your subscription mode! Please make sure that the file and the process name match - also check the syntax.");
+ throw new CoreIdentityConfigurationException("I don't like your subscription mode! Please make sure that the file and the process name match - also check the syntax.", e);
}
finally
{
@@ -279,8 +279,7 @@
}
catch (IdentityException e)
{
- uiComponent = null;
- throw new IllegalArgumentException("cannot resolve property: " + uiComponent.getPropertyRef());
+ throw new IllegalArgumentException("cannot resolve property: " + uiComponent.getPropertyRef(), e);
}
}
return uiComponent;
@@ -332,11 +331,11 @@
}
catch (IOException e)
{
- throw new CoreIdentityConfigurationException("Could not find configuration file or schema.");
+ throw new CoreIdentityConfigurationException("Could not find configuration file or schema.", e);
}
catch (JBossXBException e)
{
- throw new CoreIdentityConfigurationException("Could not parse configuration file.");
+ throw new CoreIdentityConfigurationException("Could not parse configuration file.", e);
}
catch (Throwable e)
{
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/UIComponentConfiguration.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/UIComponentConfiguration.java 2008-03-12 12:21:16 UTC (rev 10272)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/UIComponentConfiguration.java 2008-03-12 15:38:16 UTC (rev 10273)
@@ -166,6 +166,6 @@
public Class getPropertyClass() throws ClassNotFoundException
{
// Returns the Class of the Property
- return ClassLoader.getSystemClassLoader().loadClass(this.propertyInfo.getType());
+ return Thread.currentThread().getContextClassLoader().loadClass(this.propertyInfo.getType());
}
}
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/SendValidationMailAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/SendValidationMailAction.java 2008-03-12 12:21:16 UTC (rev 10272)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/SendValidationMailAction.java 2008-03-12 15:38:16 UTC (rev 10273)
@@ -78,11 +78,10 @@
emailMap.put("username", uc.getUsername());
emailMap.put("password", uc.getPassword());
}
- // Change email
+ // Change email request (send an email to the NEW email address)
else if (IdentityConstants.ACTION_CHANGE_EMAIL.equals(action))
{
- String emailTo = this.getIdentityManagementService().getCurrentEmail(uc.getUsername());
- emailMap.put(IdentityConstants.EMAIL_TO, emailTo);
+ emailMap.put(IdentityConstants.EMAIL_TO, email);
}
else
{
@@ -90,7 +89,8 @@
}
ectx.getContextInstance().setVariable(IdentityConstants.VALIDATION_HASH, hash);
- // Building the validation URL
+
+ // Generating the validation URL
String portalURL = (String) ectx.getContextInstance().getVariable(IdentityConstants.PORTAL_URL);
String activationLink = portalURL + "/" + IdentityConstants.VALIDATE_EMAIL + "/"
+ ectx.getProcessInstance().getId() + "/" + hash;
@@ -149,21 +149,4 @@
return identityMailService;
}
- private IdentityUserManagementService getIdentityManagementService()
- {
- if (identityManagementService == null)
- {
- try
- {
- this.identityManagementService = (IdentityUserManagementService) new InitialContext()
- .lookup("java:/portal/IdentityUserManagementService");
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
- return identityManagementService;
- }
-
}
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java 2008-03-12 12:21:16 UTC (rev 10272)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java 2008-03-12 15:38:16 UTC (rev 10273)
@@ -52,6 +52,9 @@
/** The registration service */
private RegistrationService registrationService;
+ /** The logger */
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(UsernameValidator.class);
+
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
{
String username = (String) value;
@@ -66,12 +69,14 @@
// checking jBPM context
if (registrationService.checkUsername(username))
{
- throw new ValidatorException(new FacesMessage(bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN") + username));
+ throw new ValidatorException(new FacesMessage(bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN")
+ + username));
}
User u = userModule.findUserByUserName(username);
// User found so this nickname is already taken
- throw new ValidatorException(new FacesMessage(bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN") + u.getUserName()));
+ throw new ValidatorException(new FacesMessage(bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN")
+ + u.getUserName()));
}
catch (NoSuchUserException e)
{
@@ -83,11 +88,13 @@
}
catch (IdentityException e)
{
+ log.error("Error validation username", e);
throw new ValidatorException(new FacesMessage(bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR")));
}
catch (CoreIdentityConfigurationException e)
{
- throw new ValidatorException(new FacesMessage(bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR")));
+ log.error("Error validation username", e);
+ throw new ValidatorException(new FacesMessage(bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR")));
}
}
}
16 years, 3 months
JBoss Portal SVN: r10272 - modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/info.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-03-12 08:21:16 -0400 (Wed, 12 Mar 2008)
New Revision: 10272
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java
Log:
added notion of generic attachment on PortletInfo interface with an implementation in ContainerPortletInfo
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java 2008-03-12 11:18:57 UTC (rev 10271)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java 2008-03-12 12:21:16 UTC (rev 10272)
@@ -112,4 +112,13 @@
{
return navigationSupport;
}
+
+ public <T> T getAttachment(Class<T> type) throws IllegalArgumentException
+ {
+ if (type == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return null;
+ }
}
16 years, 3 months
JBoss Portal SVN: r10271 - modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-03-12 07:18:57 -0400 (Wed, 12 Mar 2008)
New Revision: 10271
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
Log:
added notion of generic attachment on PortletInfo interface with an implementation in ContainerPortletInfo
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-03-12 11:15:20 UTC (rev 10270)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-03-12 11:18:57 UTC (rev 10271)
@@ -164,12 +164,27 @@
public <T> T getAttachment(Class<T> type)
{
+ if (type == null)
+ {
+ throw new IllegalArgumentException("No null type accepted");
+ }
return type.cast(attachments.get(type));
}
public <T> void setAttachment(Class<T> type, T object)
{
- attachments.put(type, object);
+ if (type == null)
+ {
+ throw new IllegalArgumentException("No null type accepted");
+ }
+ if (object == null)
+ {
+ attachments.remove(type);
+ }
+ else
+ {
+ attachments.put(type, object);
+ }
}
public String getName()
16 years, 3 months
JBoss Portal SVN: r10270 - in modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet: info and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-03-12 07:15:20 -0400 (Wed, 12 Mar 2008)
New Revision: 10270
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java
Log:
added notion of generic attachment on PortletInfo interface with an implementation in ContainerPortletInfo
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-03-12 06:59:37 UTC (rev 10269)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-03-12 11:15:20 UTC (rev 10270)
@@ -29,6 +29,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.HashMap;
/**
* For now implementation that use the portlet container directly.
@@ -41,6 +42,9 @@
{
/** . */
+ private final Map<Class, Object> attachments;
+
+ /** . */
private final ContainerCapabilitiesInfo capabilities;
/** . */
@@ -102,6 +106,7 @@
Boolean remotable,
ResourceBundleManager bundleManager)
{
+ this.attachments = new HashMap<Class, Object>();
this.capabilities = capabilities;
this.preferences = preferences;
this.meta = meta;
@@ -138,6 +143,7 @@
ResourceBundleManager bundleManager,
Map<String, ContainerOptionInfo> options)
{
+ this.attachments = new HashMap<Class, Object>();
this.capabilities = capabilities;
this.preferences = preferences;
this.meta = meta;
@@ -156,6 +162,16 @@
this.options = options;
}
+ public <T> T getAttachment(Class<T> type)
+ {
+ return type.cast(attachments.get(type));
+ }
+
+ public <T> void setAttachment(Class<T> type, T object)
+ {
+ attachments.put(type, object);
+ }
+
public String getName()
{
return name;
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java 2008-03-12 06:59:37 UTC (rev 10269)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java 2008-03-12 11:15:20 UTC (rev 10270)
@@ -101,7 +101,26 @@
*/
Boolean isRemotable();
+ /**
+ * Return the eventing information.
+ *
+ * @return the eventing information
+ */
EventingInfo getEventing();
+ /**
+ * Returns the navigation information.
+ *
+ * @return the navigation information
+ */
NavigationInfo getNavigation();
+
+ /**
+ * Returns a generic attachment on the portlet info.
+ *
+ * @param type the parameter type
+ * @return the attachment or null
+ * @throws IllegalArgumentException if the parameter type is null
+ */
+ <T> T getAttachment(Class<T> type) throws IllegalArgumentException;
}
16 years, 3 months
JBoss Portal SVN: r10269 - in branches/JBoss_Portal_Branch_2_7: core/src/main/org/jboss/portal/core/impl/model/content and 7 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-03-12 02:59:37 -0400 (Wed, 12 Mar 2008)
New Revision: 10269
Added:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/MarkupAttribute.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/MarkupElement.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/MarkupTestCase.java
Removed:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoImpl.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/ContainerPortletInfoWrapper.java
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilder.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/MarkupHeaderInfoImpl.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/ElementMetaData.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/HeaderContentMetaData.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/LinkElementMetaData.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/NamedMetaElementMetaData.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/ScriptElementMetaData.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/CorePortletInfo.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/MarkupHeaderInfo.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/filter/JBossPortletFilter.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/InfoBuilder.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
Log:
- Started support for header injection:
+ Rewrote HeaderInterceptor
+ Adapted InternalContentProvider to get header string
+ Turned CorePortletInfo into a class instead of interface so that it can extend ContainerPortletInfo
so that the correct portlet infor can be set on portlet containers in PortletAppDeployment.start().
+ Removed CorePortletInfoImpl and ContainerPortletInfoWrapper.
+ DOES NOT WORK AT RUNTIME because of:
java.lang.IncompatibleClassChangeError
org.jboss.portal.portlet.impl.spi.AbstractServerContext.dispatch(AbstractServerContext.java:69)
org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor.invoke(ContextDispatcherInterceptor.java:76)
org.jboss.portal.portlet.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38)
Need to figure out what's going on but this is a synchro commit...
- More generification
- Added and improved MarkupAttribute, MarkupElement and MarkupTestCase from common module
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java 2008-03-12 06:47:39 UTC (rev 10268)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -22,20 +22,21 @@
******************************************************************************/
package org.jboss.portal.core.aspects.portlet;
-import org.jboss.portal.common.NotYetImplemented;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.common.markup.MarkupElement;
+import org.jboss.portal.common.util.MultiValuedPropertyMap;
+import org.jboss.portal.core.metadata.portlet.MarkupElement;
import org.jboss.portal.core.portlet.info.CorePortletInfo;
import org.jboss.portal.core.portlet.info.MarkupHeaderInfo;
import org.jboss.portal.portlet.container.PortletContainer;
import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.ResponseProperties;
+import org.w3c.dom.Element;
-import java.io.StringWriter;
-import java.util.Iterator;
+import javax.portlet.MimeResponse;
/**
* @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
@@ -46,96 +47,46 @@
public class HeaderInterceptor extends PortletInterceptor
{
- protected Object invoke(PortletInvocation invocation) throws Exception, InvocationException
+ protected Object invoke(PortletInvocation invocation) throws Exception
{
PortletInvocationResponse response = (PortletInvocationResponse)invocation.invokeNext();
// Only affect fragments
if (response instanceof FragmentResponse)
{
- System.out.println("TODO: org.jboss.portal.core.aspects.portlet.HeaderInterceptor");
- /*
FragmentResponse fragment = (FragmentResponse)response;
- // The buffer that may become non null if we have content to write in it
- StringWriter buffer = null;
-
- // Get existing header which may be null
-
- String headerChars = fragment.getHeader();
-
- // Add declaratively injected header content here (get it via the component)
+ // Add declaratively injected header content here if needed (get it via the component)
PortletContainer container = (PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PortletContainerInvoker.PORTLET_CONTAINER);
- CorePortletInfo info = (CorePortletInfo)container.getInfo();
- MarkupHeaderInfo headerContentInfo = info.getMarkupHeader();
- if (headerContentInfo != null)
+ PortletInfo info = container.getInfo();
+ // only proceed if we have JBoss Portal specific metadata
+ if (info instanceof CorePortletInfo)
{
- // Init the buffer
- buffer = initBuffer(headerChars);
+ CorePortletInfo corePortletInfo = (CorePortletInfo)info;
+ MarkupHeaderInfo headerContentInfo = corePortletInfo.getMarkupHeader();
+ if (headerContentInfo != null)
+ {
+ ResponseProperties props = fragment.getProperties();
- // Get the context path
- String contextPath = (String)invocation.getDispatchedRequest().getAttribute("javax.servlet.include.context_path");
+ // if we don't already have properties in the response, create some
+ if (props == null)
+ {
+ props = new ResponseProperties();
+ }
- // Render header
- render(headerContentInfo, buffer, contextPath);
- }
+ // Get the context path
+ String contextPath = (String)invocation.getDispatchedRequest().getAttribute("javax.servlet.include.context_path");
- // Add header content coming from the response written by the portlet at runtime
- String headerContent = (String)invocation.getAttribute(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, "HEADER_CONTENT");
- if (headerContent != null)
- {
- // Init buffer if needed
- if (buffer == null)
- {
- buffer = initBuffer(headerChars);
+ MultiValuedPropertyMap<Element> headers = props.getMarkupHeaders();
+ for (MarkupElement markupElement : headerContentInfo.getMarkupElements())
+ {
+ headers.addValue(MimeResponse.MARKUP_HEAD_ELEMENT, markupElement.toElement(contextPath));
+ }
}
-
- // Append the content as it is
- buffer.write(headerContent);
}
-
- // If the buffer is not empty, use it
- if (buffer != null)
- {
- headerChars = buffer.toString();
- }
-
- //
- fragment.setHeader(headerChars);
- */
}
//
return response;
}
-
- private StringWriter initBuffer(String existingBuffer)
- {
- if (existingBuffer != null)
- {
- StringWriter buffer = new StringWriter(existingBuffer.length() + 100);
- buffer.write(existingBuffer);
- return buffer;
- }
- else
- {
- return new StringWriter(100);
- }
- }
-
- /**
- * Render the header content provided by the portlet.
- *
- * @param headerContent
- * @param writer
- * @param contextPath
- */
- protected void render(MarkupHeaderInfo headerContent, StringWriter writer, String contextPath)
- {
- for (Iterator i = headerContent.getMarkupElements().iterator(); i.hasNext();)
- {
- MarkupElement element = (MarkupElement)i.next();
- writer.write(element.toString(contextPath));
- }
- }
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2008-03-12 06:47:39 UTC (rev 10268)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -25,7 +25,7 @@
import org.jboss.logging.Logger;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.core.aspects.portlet.AjaxInterceptor;
+import org.jboss.portal.common.util.MultiValuedPropertyMap;
import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.controller.command.response.SecurityErrorResponse;
import org.jboss.portal.core.controller.command.response.UnavailableResourceResponse;
@@ -35,30 +35,31 @@
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstancePermission;
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.PortalObject;
import org.jboss.portal.core.model.portal.command.response.MarkupResponse;
import org.jboss.portal.core.model.portal.content.ContentRenderer;
+import org.jboss.portal.core.model.portal.content.ContentRendererContext;
import org.jboss.portal.core.model.portal.content.WindowRendition;
-import org.jboss.portal.core.model.portal.content.ContentRendererContext;
import org.jboss.portal.core.model.portal.navstate.WindowNavigationalState;
import org.jboss.portal.portlet.NoSuchPortletException;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.CapabilitiesInfo;
import org.jboss.portal.portlet.info.ModeInfo;
import org.jboss.portal.portlet.info.WindowStateInfo;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.InsufficientPrivilegesResponse;
import org.jboss.portal.portlet.invocation.response.InsufficientTransportGuaranteeResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.ResponseProperties;
import org.jboss.portal.portlet.invocation.response.UnavailableResponse;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
-import org.jboss.portal.theme.impl.render.dynamic.DynaRenderOptions;
+import org.w3c.dom.Element;
+import javax.portlet.MimeResponse;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -162,7 +163,7 @@
// Get the parent portal
Portal portal = null;
- for (PortalObject current = window;current != null;current = current.getParent())
+ for (PortalObject current = window; current != null; current = current.getParent())
{
if (current.getType() == PortalObject.TYPE_PORTAL)
{
@@ -288,7 +289,7 @@
if (response instanceof FragmentResponse)
{
System.out.println("TODO: org.jboss.portal.core.impl.model.content.InternalContentProvider.renderWindow()");
-
+
FragmentResponse fragment = (FragmentResponse)response;
//
@@ -298,9 +299,22 @@
windowTitle = window.getName();
}
- //
-// String headerChars = fragment.getHeader();
+ // header handling
+ String header = "";
+ ResponseProperties properties = fragment.getProperties();
+ if (properties != null)
+ {
+ MultiValuedPropertyMap<Element> headers = properties.getMarkupHeaders();
+ List<Element> headElements = headers.getValues(MimeResponse.MARKUP_HEAD_ELEMENT);
+ StringBuffer buffer = new StringBuffer(124 * headElements.size());
+ for (Element element : headElements)
+ {
+ buffer.append(element);
+ }
+ header = buffer.toString();
+ }
+
// Handle minimized here
String contentChars;
if (WindowState.MINIMIZED == windowNS.getWindowState())
@@ -309,7 +323,7 @@
}
else
{
- contentChars = fragment.getChars().toString();
+ contentChars = fragment.getChars();
}
// Update window props after render if needed
@@ -324,8 +338,8 @@
*/
//
- cr = new MarkupResponse(windowTitle, contentChars, "");
-
+ cr = new MarkupResponse(windowTitle, contentChars, header);
+
}
else if (response instanceof ErrorResponse)
{
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilder.java 2008-03-12 06:47:39 UTC (rev 10268)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilder.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -22,10 +22,8 @@
******************************************************************************/
package org.jboss.portal.core.impl.portlet.info;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-
import org.jboss.portal.core.metadata.portlet.JBossPortletMetaData;
+import org.jboss.portal.core.portlet.info.CorePortletInfo;
import org.jboss.portal.portlet.deployment.jboss.InfoBuilder;
import org.jboss.portal.portlet.deployment.jboss.PortletApplicationContextImpl;
import org.jboss.portal.portlet.deployment.jboss.metadata.JBossApplicationMetaData;
@@ -37,6 +35,9 @@
import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
import org.jboss.portal.portlet.info.PortletInfo;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+
/**
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
* @version $Revision$
@@ -55,13 +56,14 @@
public CoreInfoBuilder(JBossApplicationMetaData jbossApplicationMetaData, PortletApplication10MetaData portletApplicationMD,
- CoreInfoBuilderContext builderContext)
+ CoreInfoBuilderContext builderContext)
{
this.portletApplicationMD = portletApplicationMD;
this.jbossApplicationMetaData = jbossApplicationMetaData;
this.builderContext = builderContext;
this.portlets = new LinkedHashMap<String, PortletInfo>();
}
+
public Collection<PortletInfo> getPortlets()
{
return portlets.values();
@@ -71,23 +73,23 @@
{
return application;
}
-
+
public void build()
{
//
ContainerInfoBuilderContext containerBuilderContext = new ContainerInfoBuilderContextImpl(portletApplicationMD, builderContext.getWebApp());
ContainerInfoBuilder builder = new ContainerInfoBuilder(builderContext.getWebApp().getContextPath(), portletApplicationMD, containerBuilderContext);
builder.build();
-
+
this.application = builder.getApplication();
-
+
//
for (ContainerPortletInfo containerInfo : builder.getPortlets())
{
org.jboss.portal.portlet.deployment.jboss.metadata.JBossPortletMetaData jbPortletMD = (org.jboss.portal.portlet.deployment.jboss.metadata.JBossPortletMetaData)jbossApplicationMetaData.getPortlets().get(containerInfo.getName());
if (jbPortletMD instanceof JBossPortletMetaData)
{
- CorePortletInfoImpl cpi = new CorePortletInfoImpl(containerInfo, new PortletApplicationContextImpl(builderContext.getWebApp()), (JBossPortletMetaData)jbPortletMD, containerInfo.getBundleManager());
+ CorePortletInfo cpi = new CorePortletInfo(containerInfo, new PortletApplicationContextImpl(builderContext.getWebApp()), (JBossPortletMetaData)jbPortletMD, containerInfo.getBundleManager());
portlets.put(jbPortletMD.getName(), cpi);
}
else
Deleted: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoImpl.java 2008-03-12 06:47:39 UTC (rev 10268)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoImpl.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -1,162 +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.impl.portlet.info;
-
-import org.jboss.portal.common.i18n.ResourceBundleManager;
-import org.jboss.portal.common.transaction.Transactions;
-import org.jboss.portal.core.metadata.portlet.AjaxMetaData;
-import org.jboss.portal.core.metadata.portlet.HeaderContentMetaData;
-import org.jboss.portal.core.metadata.portlet.JBossPortletMetaData;
-import org.jboss.portal.core.metadata.portlet.PortletInfoMetaData;
-import org.jboss.portal.core.portlet.info.AjaxInfo;
-import org.jboss.portal.core.portlet.info.CorePortletInfo;
-import org.jboss.portal.core.portlet.info.MarkupHeaderInfo;
-import org.jboss.portal.core.portlet.info.PortletInfoInfo;
-import org.jboss.portal.portlet.container.PortletApplicationContext;
-import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
-import org.jboss.portal.portlet.info.CacheInfo;
-import org.jboss.portal.portlet.info.CapabilitiesInfo;
-import org.jboss.portal.portlet.info.EventingInfo;
-import org.jboss.portal.portlet.info.MetaInfo;
-import org.jboss.portal.portlet.info.NavigationInfo;
-import org.jboss.portal.portlet.info.PreferencesInfo;
-import org.jboss.portal.portlet.info.SecurityInfo;
-import org.jboss.portal.portlet.info.SessionInfo;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class CorePortletInfoImpl implements CorePortletInfo
-{
-
- /** . */
- private final Transactions.Type txType;
-
- /** . */
- private final AjaxInfoImpl ajax;
-
- /** . */
- private final MarkupHeaderInfoImpl markupHeader;
-
- /** . */
- private final PortletInfoInfoImpl portletInfo;
-
- private ContainerPortletInfo delegate;
-
- public CorePortletInfoImpl(ContainerPortletInfo delegate, PortletApplicationContext portletApplicationContext, JBossPortletMetaData jbossPortletMD, ResourceBundleManager bundleMgr)
- {
- this.delegate = delegate;
-
- //
- AjaxMetaData ajaxMD = ((JBossPortletMetaData)jbossPortletMD).getAjax();
- HeaderContentMetaData headerContentMD = ((JBossPortletMetaData)jbossPortletMD).getHeaderContent();
- PortletInfoMetaData portletInfoMD = ((JBossPortletMetaData)jbossPortletMD).getPortletInfo();
-
- //
- this.txType = jbossPortletMD.getTxType();
- this.ajax = ajaxMD != null ? new AjaxInfoImpl(ajaxMD) : null;
- this.markupHeader = headerContentMD != null ? new MarkupHeaderInfoImpl(headerContentMD) : null;
- this.portletInfo = portletInfoMD != null ? new PortletInfoInfoImpl(portletApplicationContext, portletInfoMD) : null;
- }
-
- public Transactions.Type getTxType()
- {
- return txType;
- }
-
- public AjaxInfo getAjax()
- {
- return ajax;
- }
-
- public MarkupHeaderInfo getMarkupHeader()
- {
- return markupHeader;
- }
-
- public PortletInfoInfo getPortletInfo()
- {
- return portletInfo;
- }
-
- public ContainerPortletInfo getContainerPortletInfo()
- {
- return delegate;
- }
-
- public String getApplicationName()
- {
- return delegate.getApplicationName();
- }
-
- public CacheInfo getCache()
- {
- return delegate.getCache();
- }
-
- public CapabilitiesInfo getCapabilities()
- {
- return delegate.getCapabilities();
- }
-
- public EventingInfo getEventing()
- {
- return delegate.getEventing();
- }
-
- public MetaInfo getMeta()
- {
- return delegate.getMeta();
- }
-
- public String getName()
- {
- return delegate.getName();
- }
-
- public NavigationInfo getNavigation()
- {
- return delegate.getNavigation();
- }
-
- public PreferencesInfo getPreferences()
- {
- return delegate.getPreferences();
- }
-
- public SecurityInfo getSecurity()
- {
- return delegate.getSecurity();
- }
-
- public SessionInfo getSession()
- {
- return delegate.getSession();
- }
-
- public Boolean isRemotable()
- {
- return delegate.isRemotable();
- }
-}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/MarkupHeaderInfoImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/MarkupHeaderInfoImpl.java 2008-03-12 06:47:39 UTC (rev 10268)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/MarkupHeaderInfoImpl.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -24,12 +24,12 @@
import org.jboss.portal.core.metadata.portlet.ElementMetaData;
import org.jboss.portal.core.metadata.portlet.HeaderContentMetaData;
+import org.jboss.portal.core.metadata.portlet.MarkupElement;
import org.jboss.portal.core.portlet.info.MarkupHeaderInfo;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.Iterator;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -39,22 +39,21 @@
{
/** . */
- private final Collection markupElements;
+ private final Collection<MarkupElement> markupElements;
public MarkupHeaderInfoImpl(HeaderContentMetaData headerContentMD)
{
- ArrayList markupElements = new ArrayList(headerContentMD.getElements().size());
- for (Iterator i = headerContentMD.getElements().iterator(); i.hasNext();)
+ ArrayList<MarkupElement> markupElements = new ArrayList<MarkupElement>(headerContentMD.getElements().size());
+ for (ElementMetaData elementMetaData : headerContentMD.getElements())
{
- ElementMetaData elementMD = (ElementMetaData)i.next();
- markupElements.add(elementMD.getElement());
+ markupElements.add(elementMetaData.getElement());
}
//
this.markupElements = Collections.unmodifiableCollection(markupElements);
}
- public Collection getMarkupElements()
+ public Collection<MarkupElement> getMarkupElements()
{
return markupElements;
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/ElementMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/ElementMetaData.java 2008-03-12 06:47:39 UTC (rev 10268)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/ElementMetaData.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.metadata.portlet;
-import org.jboss.portal.common.markup.MarkupElement;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/HeaderContentMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/HeaderContentMetaData.java 2008-03-12 06:47:39 UTC (rev 10268)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/HeaderContentMetaData.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -37,11 +37,11 @@
{
/** . */
- private List elements;
+ private List<ElementMetaData> elements;
public HeaderContentMetaData()
{
- elements = new ArrayList();
+ elements = new ArrayList<ElementMetaData>();
}
/**
@@ -49,7 +49,7 @@
*
* @return a list of header elements (HeaderContentMetaData.Element)
*/
- public List getElements()
+ public List<ElementMetaData> getElements()
{
return elements;
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/LinkElementMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/LinkElementMetaData.java 2008-03-12 06:47:39 UTC (rev 10268)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/LinkElementMetaData.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -22,9 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.metadata.portlet;
-import org.jboss.portal.common.markup.MarkupAttribute;
-import org.jboss.portal.common.markup.MarkupElement;
-
import java.util.ArrayList;
/**
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/MarkupAttribute.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/MarkupAttribute.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/MarkupAttribute.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -0,0 +1,245 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.core.metadata.portlet;
+
+import org.jboss.portal.common.io.UndeclaredIOException;
+import org.jboss.portal.common.io.WriterCharWriter;
+import org.jboss.portal.common.text.AbstractCharEncoder;
+import org.jboss.portal.common.text.CharEncoder;
+import org.jboss.portal.common.text.CharWriter;
+import org.jboss.portal.common.text.EncodingException;
+import org.jboss.portal.common.text.FastURLEncoder;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+
+/**
+ * A markup attribute.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 7228 $
+ */
+public class MarkupAttribute
+{
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final String value;
+
+ /** . */
+ final Type type;
+
+ /**
+ * @param name the attribute name
+ * @param value the attribute value
+ * @param type the attribute type
+ */
+ public MarkupAttribute(String name, String value, Type type)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("No null name accepted");
+ }
+ if (value == null)
+ {
+ throw new IllegalArgumentException("No null value accepted");
+ }
+ if (type == null)
+ {
+ throw new IllegalArgumentException("No null type accepted");
+ }
+ this.name = name;
+ this.value = value;
+ this.type = type;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public String getEncodedValue()
+ {
+ StringWriter tmp = new StringWriter(32);
+ type.encode(getValue(), tmp);
+ return tmp.toString();
+ }
+
+ public String getEncodedValue(String contextPath)
+ {
+ StringWriter writer = new StringWriter(64);
+ return getEncodedValue(contextPath, writer);
+ }
+
+ String getEncodedValue(String contextPath, Writer writer)
+ {
+ if (type == Type.URI && value.startsWith("/"))
+ {
+ Type.URI.encode(contextPath, writer);
+ }
+
+ try
+ {
+ writer.write(getEncodedValue());
+ }
+ catch (IOException e)
+ {
+ throw new UndeclaredIOException(e);
+ }
+
+ return writer.toString();
+ }
+
+ public Type getType()
+ {
+ return type;
+ }
+
+ public void write(String urlPrefix, Writer writer) throws UndeclaredIOException
+ {
+ if (urlPrefix == null)
+ {
+ throw new IllegalArgumentException("No context path provided");
+ }
+ if (writer == null)
+ {
+ throw new IllegalArgumentException("No writer provided");
+ }
+ try
+ {
+ writer.write(name);
+ writer.write("=\"");
+
+ writer.write(getEncodedValue(urlPrefix, writer));
+ writer.write('"');
+ }
+ catch (IOException e)
+ {
+ throw new UndeclaredIOException(e);
+ }
+ }
+
+ public String toString(String contextPath)
+ {
+ StringWriter buffer = new StringWriter(128);
+ write(contextPath, buffer);
+ return buffer.toString();
+ }
+
+ /** The type of the attribute value. */
+ public abstract static class Type
+ {
+
+ /**
+ * Encode the string in the proper format according to the type.
+ *
+ * @param string the string to encode
+ * @return the encoded string
+ */
+ public abstract void encode(String string, Writer writer) throws UndeclaredIOException;
+
+ private static class CDATAType extends Type
+ {
+ public void encode(String string, Writer writer)
+ {
+ try
+ {
+ writer.write(string);
+ }
+ catch (IOException e)
+ {
+ throw new UndeclaredIOException(e);
+ }
+ }
+ }
+
+ /**
+ * CDATA is a sequence of characters from the document character set and may include character entities. User
+ * agents should interpret attribute values as follows: <ul> <li>Replace character entities with characters,</li>
+ * <li>Ignore line feeds,</li> <li>Replace each carriage return or tab with a single space.</li> </ul>
+ */
+ public static final Type CDATA = new CDATAType();
+
+ /**
+ * NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]),
+ * hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
+ */
+ public static final Type NAME = new CDATAType();
+
+ /** %ContentType required : CDATA -- media type, as per [RFC2045]. */
+ public static final Type CONTENT_TYPE = new CDATAType();
+
+ private static final char[] SLASH_ARRAY = "/".toCharArray();
+
+ /** %URI : CDATA -- a Uniform Resource Identifier, see [URI]. */
+ public static final Type URI = new CDATAType()
+ {
+ {
+ // Patches the encoder to let '/' not being encoded
+ encoder = new AbstractCharEncoder()
+ {
+ protected void safeEncode(char c, CharWriter writer) throws EncodingException
+ {
+ if (c == '/')
+ {
+ writer.append(SLASH_ARRAY);
+ }
+ else
+ {
+ FastURLEncoder.getUTF8Instance().encode(c, writer);
+ }
+ }
+ };
+ }
+
+ /** Our encoder for URI. */
+ final CharEncoder encoder;
+
+ public void encode(String string, Writer writer)
+ {
+ encoder.encode(string, new WriterCharWriter(writer));
+ }
+ };
+
+ /** %LinkTypes : CDATA -- space-separated list of link types. */
+ public static final Type LINK_TYPES = new CDATAType();
+
+ /** %Text : CDATA : CDATA. */
+ public static final Type TEXT = new CDATAType();
+
+ /** %MediaDesc : CDATA -- single or comma-separated list of media descriptors. */
+ public static final Type MEDIA_DESC = new CDATAType();
+
+ /** %URI : CDATA -- a Uniform Resource Identifier, see [URI]. */
+ public static final Type HREF = new CDATAType();
+ }
+}
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/MarkupElement.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/MarkupElement.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/MarkupElement.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -0,0 +1,504 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.core.metadata.portlet;
+
+import org.jboss.portal.common.io.UndeclaredIOException;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.TypeInfo;
+import org.w3c.dom.UserDataHandler;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * A markup element.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 7228 $
+ */
+public class MarkupElement
+{
+
+ /** . */
+ final String name;
+
+ /** . */
+ final String bodyContent;
+
+ /**
+ * If true and the body content is null then output the start tag and the end tag instead of an empty tag. The use
+ * case is for the script element which when it is empty raise issues on IE, so it start element and end element have
+ * to be used.
+ */
+ final boolean neverEmpty;
+
+ /** . */
+ final MarkupAttribute[] attributes;
+
+ /**
+ * @param name the element name
+ * @param bodyContent the optional body content
+ * @param neverEmpty
+ * @param attributes
+ */
+ public MarkupElement(String name, String bodyContent, boolean neverEmpty, MarkupAttribute[] attributes)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("No null name accepted");
+ }
+ if (attributes == null)
+ {
+ throw new IllegalArgumentException("No null attributes accepted");
+ }
+
+ //
+ Set<String> tmp = new HashSet<String>(attributes.length);
+ for (MarkupAttribute attribute : attributes)
+ {
+ if (attribute == null)
+ {
+ throw new IllegalArgumentException("Cannot have a null attribute");
+ }
+ if (!tmp.add(attribute.getName()))
+ {
+ throw new IllegalArgumentException("Cannot have two identical attributes " + attribute.getName());
+ }
+ }
+
+ this.name = name;
+ this.bodyContent = bodyContent;
+ this.neverEmpty = neverEmpty;
+ this.attributes = attributes.clone();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getBodyContent()
+ {
+ return bodyContent;
+ }
+
+ public boolean isNeverEmpty()
+ {
+ return neverEmpty;
+ }
+
+ public int getAttributeSize()
+ {
+ return attributes.length;
+ }
+
+ public MarkupAttribute getAttribute(int index)
+ {
+ return attributes[index];
+ }
+
+ public MarkupAttribute getAttribute(String name)
+ {
+ for (MarkupAttribute attribute : attributes)
+ {
+ if (attribute.getName().equals(name))
+ {
+ return attribute;
+ }
+ }
+ return null;
+ }
+
+ public void write(String urlPrefix, Writer writer) throws UndeclaredIOException
+ {
+ if (urlPrefix == null)
+ {
+ throw new IllegalArgumentException("No context path provided");
+ }
+ if (writer == null)
+ {
+ throw new IllegalArgumentException("No writer provided");
+ }
+ try
+ {
+ writer.write("<");
+ writer.write(name);
+
+ // attributes
+ for (MarkupAttribute attribute : attributes)
+ {
+ writer.write(" ");
+ attribute.write(urlPrefix, writer);
+ }
+
+ // content
+ if (bodyContent != null && bodyContent.length() > 0)
+ {
+ writer.write(">");
+ writer.write(bodyContent);
+ writer.write("</");
+ writer.write(name);
+ writer.write(">\n");
+ }
+ else if (neverEmpty)
+ {
+ writer.write(">");
+ writer.write("</");
+ writer.write(name);
+ writer.write(">\n");
+ }
+ else
+ {
+ writer.write("/>\n");
+ }
+ }
+ catch (IOException e)
+ {
+ throw new UndeclaredIOException(e);
+ }
+ }
+
+ public String toString(String contextPath)
+ {
+ StringWriter buffer = new StringWriter(128);
+ write(contextPath, buffer);
+ return buffer.toString();
+ }
+
+ public Element toElement(String contextPath)
+ {
+ return new SimpleElement(contextPath);
+ }
+
+ private class SimpleElement implements Element
+ {
+ private String contextPath;
+
+ private SimpleElement(String contextPath)
+ {
+ this.contextPath = contextPath;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MarkupElement.this.toString(contextPath);
+ }
+
+ public String getTagName()
+ {
+ return name;
+ }
+
+ public String getAttribute(String name)
+ {
+ return MarkupElement.this.getAttribute(name).getEncodedValue(contextPath);
+ }
+
+ public void setAttribute(String name, String value) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAttribute(String name) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Attr getAttributeNode(String name)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Attr setAttributeNode(Attr newAttr) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Attr removeAttributeNode(Attr oldAttr) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public NodeList getElementsByTagName(String name)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getAttributeNS(String namespaceURI, String localName) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAttributeNS(String namespaceURI, String localName) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Attr getAttributeNodeNS(String namespaceURI, String localName) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Attr setAttributeNodeNS(Attr newAttr) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public NodeList getElementsByTagNameNS(String namespaceURI, String localName) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean hasAttribute(String name)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean hasAttributeNS(String namespaceURI, String localName) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public TypeInfo getSchemaTypeInfo()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setIdAttribute(String name, boolean isId) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getNodeName()
+ {
+ return getTagName();
+ }
+
+ public String getNodeValue() throws DOMException
+ {
+ return null;
+ }
+
+ public void setNodeValue(String nodeValue) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public short getNodeType()
+ {
+ return ELEMENT_NODE;
+ }
+
+ public Node getParentNode()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public NodeList getChildNodes()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Node getFirstChild()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Node getLastChild()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Node getPreviousSibling()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Node getNextSibling()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public NamedNodeMap getAttributes()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Document getOwnerDocument()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Node insertBefore(Node newChild, Node refChild) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Node replaceChild(Node newChild, Node oldChild) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Node removeChild(Node oldChild) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Node appendChild(Node newChild) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean hasChildNodes()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Node cloneNode(boolean deep)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void normalize()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isSupported(String feature, String version)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getNamespaceURI()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getPrefix()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setPrefix(String prefix) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getLocalName()
+ {
+ return getTagName();
+ }
+
+ public boolean hasAttributes()
+ {
+ return MarkupElement.this.getAttributeSize() != 0;
+ }
+
+ public String getBaseURI()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public short compareDocumentPosition(Node other) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getTextContent() throws DOMException
+ {
+ return MarkupElement.this.getBodyContent();
+ }
+
+ public void setTextContent(String textContent) throws DOMException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isSameNode(Node other)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String lookupPrefix(String namespaceURI)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isDefaultNamespace(String namespaceURI)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String lookupNamespaceURI(String prefix)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isEqualNode(Node arg)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getFeature(String feature, String version)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object setUserData(String key, Object data, UserDataHandler handler)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getUserData(String key)
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/NamedMetaElementMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/NamedMetaElementMetaData.java 2008-03-12 06:47:39 UTC (rev 10268)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/NamedMetaElementMetaData.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -22,9 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.metadata.portlet;
-import org.jboss.portal.common.markup.MarkupAttribute;
-import org.jboss.portal.common.markup.MarkupElement;
-
import java.util.ArrayList;
/**
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/ScriptElementMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/ScriptElementMetaData.java 2008-03-12 06:47:39 UTC (rev 10268)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/ScriptElementMetaData.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -22,9 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.metadata.portlet;
-import org.jboss.portal.common.markup.MarkupAttribute;
-import org.jboss.portal.common.markup.MarkupElement;
-
import java.util.ArrayList;
/**
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/CorePortletInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/CorePortletInfo.java 2008-03-12 06:47:39 UTC (rev 10268)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/CorePortletInfo.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -22,23 +22,72 @@
******************************************************************************/
package org.jboss.portal.core.portlet.info;
+import org.jboss.portal.common.i18n.ResourceBundleManager;
import org.jboss.portal.common.transaction.Transactions;
-import org.jboss.portal.portlet.deployment.jboss.info.ContainerPortletInfoWrapper;
+import org.jboss.portal.core.impl.portlet.info.AjaxInfoImpl;
+import org.jboss.portal.core.impl.portlet.info.MarkupHeaderInfoImpl;
+import org.jboss.portal.core.impl.portlet.info.PortletInfoInfoImpl;
+import org.jboss.portal.core.metadata.portlet.AjaxMetaData;
+import org.jboss.portal.core.metadata.portlet.HeaderContentMetaData;
+import org.jboss.portal.core.metadata.portlet.JBossPortletMetaData;
+import org.jboss.portal.core.metadata.portlet.PortletInfoMetaData;
+import org.jboss.portal.portlet.container.PortletApplicationContext;
+import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 8786 $
*/
-public interface CorePortletInfo extends ContainerPortletInfoWrapper
+public class CorePortletInfo extends ContainerPortletInfo
{
- /** @return */
- Transactions.Type getTxType();
+ /** . */
+ private final Transactions.Type txType;
- /** @return */
- AjaxInfo getAjax();
+ /** . */
+ private final AjaxInfoImpl ajax;
- /** @return */
- MarkupHeaderInfo getMarkupHeader();
+ /** . */
+ private final MarkupHeaderInfoImpl markupHeader;
- PortletInfoInfo getPortletInfo();
+ /** . */
+ private final PortletInfoInfoImpl portletInfo;
+
+ public CorePortletInfo(ContainerPortletInfo delegate, PortletApplicationContext portletApplicationContext, JBossPortletMetaData jbossPortletMD, ResourceBundleManager bundleMgr)
+ {
+ super(delegate.getCapabilities(), delegate.getPreferences(), delegate.getMeta(), delegate.getSecurity(),
+ delegate.getCache(), delegate.getSession(), delegate.getEventing(), delegate.getNavigation(),
+ delegate.getFilterRefs(), delegate.getName(), delegate.getApplicationName(), delegate.getClassName(),
+ delegate.getInitParameters(), delegate.isRemotable(), delegate.getBundleManager(), delegate.getOptions());
+
+ //
+ AjaxMetaData ajaxMD = jbossPortletMD.getAjax();
+ HeaderContentMetaData headerContentMD = jbossPortletMD.getHeaderContent();
+ PortletInfoMetaData portletInfoMD = jbossPortletMD.getPortletInfo();
+
+ //
+ this.txType = jbossPortletMD.getTxType();
+ this.ajax = ajaxMD != null ? new AjaxInfoImpl(ajaxMD) : null;
+ this.markupHeader = headerContentMD != null ? new MarkupHeaderInfoImpl(headerContentMD) : null;
+ this.portletInfo = portletInfoMD != null ? new PortletInfoInfoImpl(portletApplicationContext, portletInfoMD) : null;
+ }
+
+ public Transactions.Type getTxType()
+ {
+ return txType;
+ }
+
+ public AjaxInfo getAjax()
+ {
+ return ajax;
+ }
+
+ public MarkupHeaderInfo getMarkupHeader()
+ {
+ return markupHeader;
+ }
+
+ public PortletInfoInfo getPortletInfo()
+ {
+ return portletInfo;
+ }
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/MarkupHeaderInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/MarkupHeaderInfo.java 2008-03-12 06:47:39 UTC (rev 10268)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/MarkupHeaderInfo.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.core.portlet.info;
+import org.jboss.portal.core.metadata.portlet.MarkupElement;
+
import java.util.Collection;
/**
@@ -30,5 +32,5 @@
*/
public interface MarkupHeaderInfo
{
- Collection getMarkupElements();
+ Collection<MarkupElement> getMarkupElements();
}
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/MarkupTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/MarkupTestCase.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/MarkupTestCase.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2008, Your Corporation. All Rights Reserved.
+ */
+package org.jboss.portal.test.core;
+
+import junit.framework.TestCase;
+import org.jboss.portal.core.metadata.portlet.MarkupAttribute;
+import org.jboss.portal.core.metadata.portlet.MarkupElement;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class MarkupTestCase extends TestCase
+{
+
+ public void testAttributeConstructor()
+ {
+ try
+ {
+ new MarkupAttribute(null, "value", MarkupAttribute.Type.CDATA);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ new MarkupAttribute("name", null, MarkupAttribute.Type.CDATA);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ new MarkupAttribute("name", "value", null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ MarkupAttribute attribute = new MarkupAttribute("name", "value", MarkupAttribute.Type.CDATA);
+ assertEquals("name", attribute.getName());
+ assertEquals("value", attribute.getValue());
+ assertEquals(MarkupAttribute.Type.CDATA, attribute.getType());
+ }
+
+ public void testElementContructor()
+ {
+ try
+ {
+ new MarkupElement(null, "body", false, new MarkupAttribute[0]);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ new MarkupElement("name", "body", false, null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ new MarkupElement("name", "body", false, new MarkupAttribute[]{null});
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ MarkupElement element = new MarkupElement("elementname", "body", false, new MarkupAttribute[]{new MarkupAttribute("attributename", "attributevalue", MarkupAttribute.Type.CDATA)});
+ assertEquals("elementname", element.getName());
+ assertEquals("body", element.getBodyContent());
+ assertEquals(false, element.isNeverEmpty());
+ assertEquals(1, element.getAttributeSize());
+ MarkupAttribute attribute = element.getAttribute(0);
+ assertEquals("attributename", attribute.getName());
+ assertEquals("attributevalue", attribute.getValue());
+ assertEquals(MarkupAttribute.Type.CDATA, attribute.getType());
+ attribute = element.getAttribute("attributename");
+ assertEquals("attributename", attribute.getName());
+ assertEquals("attributevalue", attribute.getValue());
+ assertEquals(MarkupAttribute.Type.CDATA, attribute.getType());
+ assertEquals(null, element.getAttribute("someotherattributename"));
+ }
+
+ public void testAttributeURIEncoding()
+ {
+ MarkupAttribute attribute = new MarkupAttribute("name", "/-_.*ABCabc012# ", MarkupAttribute.Type.URI);
+ assertEquals("/-_.*ABCabc012%23+", attribute.getEncodedValue());
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/filter/JBossPortletFilter.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/filter/JBossPortletFilter.java 2008-03-12 06:47:39 UTC (rev 10268)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/filter/JBossPortletFilter.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -22,36 +22,38 @@
******************************************************************************/
package org.jboss.portlet.filter;
-import java.io.IOException;
+import org.jboss.portlet.JBossActionRequest;
+import org.jboss.portlet.JBossActionResponse;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
import javax.portlet.filter.ActionFilter;
+import javax.portlet.filter.EventFilter;
import javax.portlet.filter.FilterChain;
import javax.portlet.filter.FilterConfig;
-import javax.portlet.filter.PortletFilter;
import javax.portlet.filter.RenderFilter;
+import javax.portlet.filter.ResourceFilter;
+import java.io.IOException;
-import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.ActionResponseImpl;
-import org.jboss.portlet.JBossActionRequest;
-import org.jboss.portlet.JBossActionResponse;
-
/**
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
* @version $Revision$
*/
-public class JBossPortletFilter implements ActionFilter, RenderFilter, PortletFilter
+public class JBossPortletFilter implements ActionFilter, RenderFilter, ResourceFilter, EventFilter
{
public void doFilter(ActionRequest request, ActionResponse response, FilterChain filterChain) throws IOException, PortletException
{
JBossActionRequest actionRequest = new JBossActionRequest(request);
JBossActionResponse actionResponse = new JBossActionResponse(response);
-
+
filterChain.doFilter(actionRequest, actionResponse);
}
@@ -72,5 +74,14 @@
filterChain.doFilter(request, response);
}
+ public void doFilter(ResourceRequest resourceRequest, ResourceResponse resourceResponse, FilterChain filterChain) throws IOException, PortletException
+ {
+ filterChain.doFilter(resourceRequest, resourceResponse);
+ }
+
+ public void doFilter(EventRequest eventRequest, EventResponse eventResponse, FilterChain filterChain) throws IOException, PortletException
+ {
+ filterChain.doFilter(eventRequest, eventResponse);
+ }
}
Modified: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/InfoBuilder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/InfoBuilder.java 2008-03-12 06:47:39 UTC (rev 10268)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/InfoBuilder.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -22,11 +22,10 @@
******************************************************************************/
package org.jboss.portal.portlet.deployment.jboss;
-import java.util.Collection;
-
-import org.jboss.portal.portlet.deployment.jboss.info.ContainerPortletInfoWrapper;
import org.jboss.portal.portlet.impl.info.ContainerPortletApplicationInfo;
+import java.util.Collection;
+
/**
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
* @version $Revision$
Modified: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2008-03-12 06:47:39 UTC (rev 10268)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -22,15 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.deployment.jboss;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.management.MBeanServer;
-import javax.servlet.ServletContext;
-
import org.jboss.deployment.DeploymentException;
import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.common.xml.NullEntityResolver;
@@ -43,7 +34,6 @@
import org.jboss.portal.portlet.container.object.PortletFilterObject;
import org.jboss.portal.portlet.deployment.CorePortletInvoker;
import org.jboss.portal.portlet.deployment.PortletApplicationModelFactory;
-import org.jboss.portal.portlet.deployment.jboss.info.ContainerPortletInfoWrapper;
import org.jboss.portal.portlet.deployment.jboss.metadata.JBossApplicationMetaData;
import org.jboss.portal.portlet.deployment.jboss.metadata.JBossPortletMetaData;
import org.jboss.portal.portlet.impl.container.PortletApplicationLifeCycle;
@@ -64,6 +54,14 @@
import org.jboss.xb.binding.UnmarshallerFactory;
import org.xml.sax.EntityResolver;
+import javax.management.MBeanServer;
+import javax.servlet.ServletContext;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Map;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -85,10 +83,10 @@
/** . */
protected PortletApplicationContextImpl portletApplicationContext;
-
+
/** . */
private PortletApplicationLifeCycle portletApplicationLifeCycle;
-
+
private ManagedObjectRegistryEventListener listener;
public PortletAppDeployment(URL url, PortalWebApp pwa, ManagedObjectRegistryEventListener listener, MBeanServer mbeanServer, PortletAppDeploymentFactory factory)
@@ -97,7 +95,7 @@
this.factory = factory;
this.listener = listener;
}
-
+
public void create() throws DeploymentException
{
importTLD();
@@ -150,12 +148,12 @@
public void start() throws DeploymentException
{
-
+
log.debug("Starting installation");
//
InfoBuilder infoBuilder = factory.getCoreInfoBuilderFactory().createInfoBuilder(pwa, jbossAppMD, portletAppMD);
-
+
infoBuilder.build();
/*
ContainerInfoBuilderContext builderContext = new ContainerInfoBuilderContextImpl(portletAppMD, pwa);
@@ -166,7 +164,6 @@
PortletApplicationObject portletApplicationObject = new PortletApplicationImpl(infoBuilder.getApplication());
PortletApplicationContext portletApplicationContext = new PortletApplicationContextImpl(pwa);
-
//
portletApplicationLifeCycle = new PortletApplicationLifeCycle(
listener,
@@ -186,26 +183,15 @@
//
for (PortletInfo portletInfo : infoBuilder.getPortlets())
{
- ContainerPortletInfo cpi = null;
- if (portletInfo instanceof ContainerPortletInfoWrapper)
- {
- cpi = ((ContainerPortletInfoWrapper)portletInfo).getContainerPortletInfo();
- }
- else
- {
- cpi = (ContainerPortletInfo)portletInfo;
- }
-
+ ContainerPortletInfo cpi = (ContainerPortletInfo)portletInfo;
PortletContainerObject portletContainerObject = new PortletContainerImpl(cpi);
PortletContainerContext portletContainerContext = new PortletContainerContextImpl();
-
+
//
PortletContainerLifeCycle portletContainerLifeCycle = portletApplicationLifeCycle.addPortletContainer(portletContainerContext, portletContainerObject);
((CorePortletInvoker)factory.getCorePortletInvoker()).addPortletInfo(portletInfo.getApplicationName(), portletInfo.getName(), portletInfo);
-
-
-
+
// Now create deps
for (String filterRef : cpi.getFilterRefs())
{
@@ -231,107 +217,104 @@
//
-
-
-
/*
- try
- {
- portletApplicationContext = new PortletApplicationContextImpl(
- factory.getWebAppRegistry(),
- factory.getPortletAPIFactory(),
- factory.getPortletInfoFactory(),
- portletAppMD,
- jbossAppMD,
- pwa.getServletContext(),
- pwa.getClassLoader(),
- pwa.getContextPath()
- );
-
- // Install portlet containers
- portletApplicationContext.startPortletApplication();
- }
- catch (Throwable e)
- {
- throw new DeploymentException("Cannot deploy portlet application", e);
- }
-
- // Configure security
- PortletSecurityService portletSecurityService = factory.getPortletSecurityService();
- if (portletSecurityService != null)
- {
- AuthorizationDomain authDomain = portletSecurityService.getAuthorizationDomain();
- DomainConfigurator domainConfigurator = authDomain.getConfigurator();
-
- //
- for (Iterator i = jbossAppMD.getPortlets().values().iterator(); i.hasNext();)
- {
- JBossPortletMetaData portletMD = (JBossPortletMetaData)i.next();
- SecurityConstraintMetaData securityConstraintMD = portletMD.getSecurityConstraint();
-
- //
- if (securityConstraintMD == null)
+ try
{
- securityConstraintMD = new SecurityConstraintMetaData();
- PolicyPermissionMetaData policyPermission = new PolicyPermissionMetaData();
- policyPermission.setRoleName(SecurityConstants.UNCHECKED_ROLE_NAME);
- policyPermission.getActions().add("view");
- securityConstraintMD.getPolicyPermissions().put(SecurityConstants.UNCHECKED_ROLE_NAME, policyPermission);
- }
+ portletApplicationContext = new PortletApplicationContextImpl(
+ factory.getWebAppRegistry(),
+ factory.getPortletAPIFactory(),
+ factory.getPortletInfoFactory(),
+ portletAppMD,
+ jbossAppMD,
+ pwa.getServletContext(),
+ pwa.getClassLoader(),
+ pwa.getContextPath()
+ );
- //
- Set bindings = new HashSet();
- for (Iterator j = securityConstraintMD.getPolicyPermissions().values().iterator(); j.hasNext();)
+ // Install portlet containers
+ portletApplicationContext.startPortletApplication();
+ }
+ catch (Throwable e)
{
- PolicyPermissionMetaData policyPermissionMD = (PolicyPermissionMetaData)j.next();
- RoleSecurityBinding binding = new RoleSecurityBinding(policyPermissionMD.getActions(), policyPermissionMD.getRoleName());
- bindings.add(binding);
+ throw new DeploymentException("Cannot deploy portlet application", e);
}
- //
- try
+ // Configure security
+ PortletSecurityService portletSecurityService = factory.getPortletSecurityService();
+ if (portletSecurityService != null)
{
- String portletId = pwa.getId() + "." + portletMD.getName();
- domainConfigurator.setSecurityBindings(portletId, bindings);
+ AuthorizationDomain authDomain = portletSecurityService.getAuthorizationDomain();
+ DomainConfigurator domainConfigurator = authDomain.getConfigurator();
+
+ //
+ for (Iterator i = jbossAppMD.getPortlets().values().iterator(); i.hasNext();)
+ {
+ JBossPortletMetaData portletMD = (JBossPortletMetaData)i.next();
+ SecurityConstraintMetaData securityConstraintMD = portletMD.getSecurityConstraint();
+
+ //
+ if (securityConstraintMD == null)
+ {
+ securityConstraintMD = new SecurityConstraintMetaData();
+ PolicyPermissionMetaData policyPermission = new PolicyPermissionMetaData();
+ policyPermission.setRoleName(SecurityConstants.UNCHECKED_ROLE_NAME);
+ policyPermission.getActions().add("view");
+ securityConstraintMD.getPolicyPermissions().put(SecurityConstants.UNCHECKED_ROLE_NAME, policyPermission);
+ }
+
+ //
+ Set bindings = new HashSet();
+ for (Iterator j = securityConstraintMD.getPolicyPermissions().values().iterator(); j.hasNext();)
+ {
+ PolicyPermissionMetaData policyPermissionMD = (PolicyPermissionMetaData)j.next();
+ RoleSecurityBinding binding = new RoleSecurityBinding(policyPermissionMD.getActions(), policyPermissionMD.getRoleName());
+ bindings.add(binding);
+ }
+
+ //
+ try
+ {
+ String portletId = pwa.getId() + "." + portletMD.getName();
+ domainConfigurator.setSecurityBindings(portletId, bindings);
+ }
+ catch (SecurityConfigurationException e)
+ {
+ log.error("Error in configuration", e);
+ }
+ }
}
- catch (SecurityConfigurationException e)
- {
- log.error("Error in configuration", e);
- }
- }
- }
-*/
+ */
//
super.start();
}
public void stop() throws DeploymentException
{
-
- /*
- PortletSecurityService portletSecurityService = factory.getPortletSecurityService();
- if (portletSecurityService != null)
- {
- AuthorizationDomain authDomain = portletSecurityService.getAuthorizationDomain();
- DomainConfigurator domainConfigurator = authDomain.getConfigurator();
- for (Iterator i = portletAppMD.getPortlets().values().iterator(); i.hasNext();)
- {
- PortletMetaData portletMD = (PortletMetaData)i.next();
- //
- try
+ /*
+ PortletSecurityService portletSecurityService = factory.getPortletSecurityService();
+ if (portletSecurityService != null)
{
- String portletId = pwa.getId() + "." + portletMD.getId();
- domainConfigurator.removeSecurityBindings(portletId);
+ AuthorizationDomain authDomain = portletSecurityService.getAuthorizationDomain();
+ DomainConfigurator domainConfigurator = authDomain.getConfigurator();
+ for (Iterator i = portletAppMD.getPortlets().values().iterator(); i.hasNext();)
+ {
+ PortletMetaData portletMD = (PortletMetaData)i.next();
+
+ //
+ try
+ {
+ String portletId = pwa.getId() + "." + portletMD.getId();
+ domainConfigurator.removeSecurityBindings(portletId);
+ }
+ catch (SecurityConfigurationException e)
+ {
+ log.error("Error in configuration", e);
+ }
+ }
}
- catch (SecurityConfigurationException e)
- {
- log.error("Error in configuration", e);
- }
- }
- }
-*/
+ */
//
super.stop();
}
Deleted: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/ContainerPortletInfoWrapper.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/ContainerPortletInfoWrapper.java 2008-03-12 06:47:39 UTC (rev 10268)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/ContainerPortletInfoWrapper.java 2008-03-12 06:59:37 UTC (rev 10269)
@@ -1,36 +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.portlet.deployment.jboss.info;
-
-import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
-import org.jboss.portal.portlet.info.PortletInfo;
-
-/**
- * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public interface ContainerPortletInfoWrapper extends PortletInfo
-{
- public ContainerPortletInfo getContainerPortletInfo();
-}
-
16 years, 3 months
JBoss Portal SVN: r10268 - in modules/common/trunk/common/src: test/java/org/jboss/portal/test/common and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-03-12 02:47:39 -0400 (Wed, 12 Mar 2008)
New Revision: 10268
Removed:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/markup/
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/MarkupTestCase.java
Log:
- Moved MarkupAttribute, MarkupElement and MarkupTestCase to core of JBoss Portal.
Deleted: modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/MarkupTestCase.java
===================================================================
--- modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/MarkupTestCase.java 2008-03-12 05:39:42 UTC (rev 10267)
+++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/MarkupTestCase.java 2008-03-12 06:47:39 UTC (rev 10268)
@@ -1,115 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.common;
-
-import junit.framework.TestCase;
-import org.jboss.portal.common.markup.MarkupAttribute;
-import org.jboss.portal.common.markup.MarkupElement;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class MarkupTestCase extends TestCase
-{
-
- public void testAttributeConstructor()
- {
- try
- {
- new MarkupAttribute(null, "value", MarkupAttribute.Type.CDATA);
- fail("Was expecting an IAE");
- }
- catch (IllegalArgumentException expected)
- {
- }
- try
- {
- new MarkupAttribute("name", null, MarkupAttribute.Type.CDATA);
- fail("Was expecting an IAE");
- }
- catch (IllegalArgumentException expected)
- {
- }
- try
- {
- new MarkupAttribute("name", "value", null);
- fail("Was expecting an IAE");
- }
- catch (IllegalArgumentException expected)
- {
- }
- MarkupAttribute attribute = new MarkupAttribute("name", "value", MarkupAttribute.Type.CDATA);
- assertEquals("name", attribute.getName());
- assertEquals("value", attribute.getValue());
- assertEquals(MarkupAttribute.Type.CDATA, attribute.getType());
- }
-
- public void testElementContructor()
- {
- try
- {
- new MarkupElement(null, "body", false, new MarkupAttribute[0]);
- fail("Was expecting an IAE");
- }
- catch (IllegalArgumentException expected)
- {
- }
- try
- {
- new MarkupElement("name", "body", false, null);
- fail("Was expecting an IAE");
- }
- catch (IllegalArgumentException expected)
- {
- }
- try
- {
- new MarkupElement("name", "body", false, new MarkupAttribute[]{null});
- fail("Was expecting an IAE");
- }
- catch (IllegalArgumentException expected)
- {
- }
- MarkupElement element = new MarkupElement("elementname", "body", false, new MarkupAttribute[]{new MarkupAttribute("attributename", "attributevalue", MarkupAttribute.Type.CDATA)});
- assertEquals("elementname", element.getName());
- assertEquals("body", element.getBodyContent());
- assertEquals(false, element.isNeverEmpty());
- assertEquals(1, element.getAttributeSize());
- MarkupAttribute attribute = element.getAttribute(0);
- assertEquals("attributename", attribute.getName());
- assertEquals("attributevalue", attribute.getValue());
- assertEquals(MarkupAttribute.Type.CDATA, attribute.getType());
- attribute = element.getAttribute("attributename");
- assertEquals("attributename", attribute.getName());
- assertEquals("attributevalue", attribute.getValue());
- assertEquals(MarkupAttribute.Type.CDATA, attribute.getType());
- assertEquals(null, element.getAttribute("someotherattributename"));
- }
-
- public void testAttributeURIEncoding()
- {
- MarkupAttribute attribute = new MarkupAttribute("name", "/-_.*ABCabc012# ", MarkupAttribute.Type.URI);
- assertEquals("/-_.*ABCabc012%23+", attribute.getEncodedValue());
- }
-}
16 years, 3 months