gatein SVN: r6962 - in epp/docs/branches/5.1/Site_Publisher/Installation_Guide: en-US and 1 other directory.
by do-not-reply@jboss.org
Author: smumford
Date: 2011-07-31 19:58:58 -0400 (Sun, 31 Jul 2011)
New Revision: 6962
Modified:
epp/docs/branches/5.1/Site_Publisher/Installation_Guide/en-US/Book_Info.xml
epp/docs/branches/5.1/Site_Publisher/Installation_Guide/en-US/Revision_History.xml
epp/docs/branches/5.1/Site_Publisher/Installation_Guide/en-US/Site_Publisher_Installation_Guide.ent
epp/docs/branches/5.1/Site_Publisher/Installation_Guide/publican.cfg
Log:
Update entities. Rewrite subtitle in Book_Info
Modified: epp/docs/branches/5.1/Site_Publisher/Installation_Guide/en-US/Book_Info.xml
===================================================================
--- epp/docs/branches/5.1/Site_Publisher/Installation_Guide/en-US/Book_Info.xml 2011-07-31 23:56:50 UTC (rev 6961)
+++ epp/docs/branches/5.1/Site_Publisher/Installation_Guide/en-US/Book_Info.xml 2011-07-31 23:58:58 UTC (rev 6962)
@@ -4,28 +4,28 @@
%BOOK_ENTITIES;
]>
<bookinfo id="book-Installation_Guide-Installation_Guide">
- <title>Site Publisher Installation Guide</title>
- <subtitle>An Installation Guide for Site Publisher &VZ;</subtitle>
- <productname>JBoss Enterprise Portal Platform</productname>
- <productnumber>5.1</productnumber>
- <edition>2</edition>
- <pubsnumber>5.1.1</pubsnumber>
- <abstract>
- <para>
+ <title>Site Publisher Installation Guide</title>
+ <subtitle>A guide to installing JBoss Enterprise Portal Platform Site Publisher &VZ;</subtitle>
+ <productname>JBoss Enterprise Portal Platform</productname>
+ <productnumber>5.1</productnumber>
+ <edition>2</edition>
+ <pubsnumber>5.1.2</pubsnumber>
+ <abstract>
+ <para>
This book provides information about obtaining, installing and running the JBoss Enterprise Portal Platform Site Publisher extension. It forms the documentation suite along with the Site Publisher User Guide available at <ulink type="http" url="http://docs.redhat.com/docs/en-US/JBoss_Site_Publisher/index.html" />
- </para>
+ </para>
- </abstract>
- <corpauthor>
- <inlinemediaobject>
- <imageobject>
- <imagedata fileref="Common_Content/images/title_logo.svg" format="SVG" />
- </imageobject>
+ </abstract>
+ <corpauthor>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="Common_Content/images/title_logo.svg" format="SVG" />
+ </imageobject>
- </inlinemediaobject>
+ </inlinemediaobject>
- </corpauthor>
- <xi:include href="Common_Content/Legal_Notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ </corpauthor>
+ <xi:include href="Common_Content/Legal_Notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</bookinfo>
Modified: epp/docs/branches/5.1/Site_Publisher/Installation_Guide/en-US/Revision_History.xml
===================================================================
--- epp/docs/branches/5.1/Site_Publisher/Installation_Guide/en-US/Revision_History.xml 2011-07-31 23:56:50 UTC (rev 6961)
+++ epp/docs/branches/5.1/Site_Publisher/Installation_Guide/en-US/Revision_History.xml 2011-07-31 23:58:58 UTC (rev 6962)
@@ -4,38 +4,52 @@
%BOOK_ENTITIES;
]>
<appendix id="appe-Installation_Guide-Revision_History">
- <title>Revision History</title>
- <simpara>
- <revhistory>
- <revision>
- <revnumber>2-5.1.1</revnumber>
- <date>Monday June 27 2011</date>
- <author>
- <firstname>Scott</firstname>
- <surname>Mumford</surname>
- <email>smumford(a)redhat.com</email>
- </author>
- <revdescription>
- <simplelist>
- <member>Updated for 5.1.1 Release.</member>
- </simplelist>
- </revdescription>
- </revision>
- <revision>
- <revnumber>1-5.3</revnumber>
- <date>Wed June 22 2011</date>
- <author>
- <firstname>Scott</firstname>
- <surname>Mumford</surname>
- <email>smumford(a)redhat.com</email>
- </author>
- <revdescription>
- <simplelist>
- <member>Incorporated new Bugzilla feedback link.</member>
- <member>Corrected minor typographical errors.</member>
- </simplelist>
- </revdescription>
- </revision>
+ <title>Revision History</title>
+ <simpara>
+ <revhistory>
+ <revision>
+ <revnumber>2-5.1.2</revnumber>
+ <date>Fri Jul 15 2011</date>
+ <author>
+ <firstname>Scott</firstname>
+ <surname>Mumford</surname>
+ <email></email>
+ </author>
+ <revdescription>
+ <simplelist>
+ <member>Updated for 5.1.1 Release.</member>
+ </simplelist>
+ </revdescription>
+ </revision>
+ <!--<revision>
+ <revnumber>2-5.1.1</revnumber>
+ <date>Monday June 27 2011</date>
+ <author>
+ <firstname>Scott</firstname>
+ <surname>Mumford</surname>
+ <email>smumford(a)redhat.com</email>
+ </author>
+ <revdescription>
+ <simplelist>
+ <member>Updated for 5.1.1 Release.</member>
+ </simplelist>
+ </revdescription>
+ </revision>-->
+ <revision>
+ <revnumber>1-5.3</revnumber>
+ <date>Wed June 22 2011</date>
+ <author>
+ <firstname>Scott</firstname>
+ <surname>Mumford</surname>
+ <email>smumford(a)redhat.com</email>
+ </author>
+ <revdescription>
+ <simplelist>
+ <member>Incorporated new Bugzilla feedback link.</member>
+ <member>Corrected minor typographical errors.</member>
+ </simplelist>
+ </revdescription>
+ </revision>
<!-- <revision>
<revnumber>1-5.2</revnumber>
<date>Thu Jun 02 2011</date>
@@ -134,37 +148,37 @@
</simplelist>
</revdescription>
</revision>
- <revision>
- <revnumber>1-1.1</revnumber>
- <date>Wed Nov 17 2010</date>
- <author>
- <firstname>Scott</firstname>
- <surname>Mumford</surname>
- <email>smumford(a)redhat.com</email>
- </author>
- <revdescription>
- <simplelist>
- <member>Added first draft content.</member>
- </simplelist>
- </revdescription>
- </revision> -->
+ <revision>
+ <revnumber>1-1.1</revnumber>
+ <date>Wed Nov 17 2010</date>
+ <author>
+ <firstname>Scott</firstname>
+ <surname>Mumford</surname>
+ <email>smumford(a)redhat.com</email>
+ </author>
+ <revdescription>
+ <simplelist>
+ <member>Added first draft content.</member>
+ </simplelist>
+ </revdescription>
+ </revision> -->
- <revision>
- <revnumber>1-1.0</revnumber>
- <date>Wed Nov 17 2010</date>
- <author>
- <firstname>Scott</firstname>
- <surname>Mumford</surname>
- <email>smumford(a)redhat.com</email>
- </author>
- <revdescription>
- <simplelist>
- <member>Initial creation of book by publican</member>
- </simplelist>
- </revdescription>
- </revision>
+ <revision>
+ <revnumber>1-1.0</revnumber>
+ <date>Wed Nov 17 2010</date>
+ <author>
+ <firstname>Scott</firstname>
+ <surname>Mumford</surname>
+ <email>smumford(a)redhat.com</email>
+ </author>
+ <revdescription>
+ <simplelist>
+ <member>Initial creation of book by publican</member>
+ </simplelist>
+ </revdescription>
+ </revision>
- </revhistory>
- </simpara>
+ </revhistory>
+ </simpara>
</appendix>
Modified: epp/docs/branches/5.1/Site_Publisher/Installation_Guide/en-US/Site_Publisher_Installation_Guide.ent
===================================================================
--- epp/docs/branches/5.1/Site_Publisher/Installation_Guide/en-US/Site_Publisher_Installation_Guide.ent 2011-07-31 23:56:50 UTC (rev 6961)
+++ epp/docs/branches/5.1/Site_Publisher/Installation_Guide/en-US/Site_Publisher_Installation_Guide.ent 2011-07-31 23:58:58 UTC (rev 6962)
@@ -10,7 +10,7 @@
<!ENTITY BZURL "<ulink url='https://bugzilla.redhat.com/enter_bug.cgi?product=JBoss%20Enterpri...'>http://bugzilla.redhat.com/</ulink>">
<!-- Corporate Specifics: -->
-<!ENTITY YEAR "2010">
+<!ENTITY YEAR "2011">
<!ENTITY HOLDER "Red Hat, Inc">
<!-- Version Specifcs: -->
Modified: epp/docs/branches/5.1/Site_Publisher/Installation_Guide/publican.cfg
===================================================================
--- epp/docs/branches/5.1/Site_Publisher/Installation_Guide/publican.cfg 2011-07-31 23:56:50 UTC (rev 6961)
+++ epp/docs/branches/5.1/Site_Publisher/Installation_Guide/publican.cfg 2011-07-31 23:58:58 UTC (rev 6962)
@@ -4,6 +4,7 @@
xml_lang: en-US
type: Book
brand: JBoss
+show_remarks: 1
cvs_branch: DOCS-RHEL-6
cvs_root: :ext:cvs.devel.redhat.com:/cvs/dist
cvs_pkg: JBoss_Enterprise_Portal_Platform-Site_Publisher_Installation_Guide-5.1-web-__LANG__
13 years, 4 months
gatein SVN: r6961 - in epp/docs/branches/5.1/Site_Publisher/User_Guide: en-US and 1 other directories.
by do-not-reply@jboss.org
Author: smumford
Date: 2011-07-31 19:56:50 -0400 (Sun, 31 Jul 2011)
New Revision: 6961
Modified:
epp/docs/branches/5.1/Site_Publisher/User_Guide/en-US/Book_Info.xml
epp/docs/branches/5.1/Site_Publisher/User_Guide/en-US/Revision_History.xml
epp/docs/branches/5.1/Site_Publisher/User_Guide/en-US/modules/Get_Started/Account.xml
epp/docs/branches/5.1/Site_Publisher/User_Guide/publican.cfg
Log:
JBEPP-886: Commit new 'Toolbar Visibility' section
Modified: epp/docs/branches/5.1/Site_Publisher/User_Guide/en-US/Book_Info.xml
===================================================================
--- epp/docs/branches/5.1/Site_Publisher/User_Guide/en-US/Book_Info.xml 2011-07-30 02:53:38 UTC (rev 6960)
+++ epp/docs/branches/5.1/Site_Publisher/User_Guide/en-US/Book_Info.xml 2011-07-31 23:56:50 UTC (rev 6961)
@@ -5,14 +5,14 @@
]>
<bookinfo id="book-User_Guide-User_Guide">
<title>Site Publisher User Guide</title>
- <subtitle>A guide to using the JBoss Enterprise Portal Platform Site Publisher &VZ; (powered by eXo) extension</subtitle>
+ <subtitle>A guide to using JBoss Enterprise Portal Platform Site Publisher &VZ;</subtitle>
<productname>JBoss Enterprise Portal Platform</productname>
<productnumber>5.1</productnumber>
<edition>2</edition>
- <pubsnumber>5.2</pubsnumber>
+ <pubsnumber>5.6</pubsnumber>
<abstract>
<para>
- This document provides an easy to follow guide to the functions and options available in the Enterprise Portal Platform Site Publisher extension. It is intended to be accessible and useful to both experienced and novice portal users.
+ This document provides an easy to follow guide to the functions and options available in the Enterprise Portal Platform Site Publisher extension (powered by eXo). It is intended to be accessible and useful to both experienced and novice portal users.
</para>
</abstract>
<corpauthor>
Modified: epp/docs/branches/5.1/Site_Publisher/User_Guide/en-US/Revision_History.xml
===================================================================
--- epp/docs/branches/5.1/Site_Publisher/User_Guide/en-US/Revision_History.xml 2011-07-30 02:53:38 UTC (rev 6960)
+++ epp/docs/branches/5.1/Site_Publisher/User_Guide/en-US/Revision_History.xml 2011-07-31 23:56:50 UTC (rev 6961)
@@ -8,6 +8,20 @@
<simpara>
<revhistory>
<revision>
+ <revnumber>2-5.6</revnumber>
+ <date>Fri Jul 15 2011</date>
+ <author>
+ <firstname>Scott</firstname>
+ <surname>Mumford</surname>
+ <email></email>
+ </author>
+ <revdescription>
+ <simplelist>
+ <member>Draft content for <ulink type="http" url="https://issues.jboss.org/browse/JBEPP-886">JBEPP-886</ulink></member>
+ </simplelist>
+ </revdescription>
+ </revision>
+ <!--<revision>
<revnumber>2-5.2</revnumber>
<date>Tue Jul 05 2011</date>
<author>
@@ -20,7 +34,7 @@
<member>Draft content for <ulink type="http" url="https://issues.jboss.org/browse/JBEPP-886"></ulink>JBEPP-886</member>
</simplelist>
</revdescription>
- </revision>
+ </revision>-->
<revision>
<revnumber>2-5.1.1</revnumber>
<date>Monday June 27 2011</date>
Modified: epp/docs/branches/5.1/Site_Publisher/User_Guide/en-US/modules/Get_Started/Account.xml
===================================================================
--- epp/docs/branches/5.1/Site_Publisher/User_Guide/en-US/modules/Get_Started/Account.xml 2011-07-30 02:53:38 UTC (rev 6960)
+++ epp/docs/branches/5.1/Site_Publisher/User_Guide/en-US/modules/Get_Started/Account.xml 2011-07-31 23:56:50 UTC (rev 6961)
@@ -470,7 +470,7 @@
</procedure>
</section>
<section id="sect-User_Guide-Account-Toolbar_Visibility">
- <title>Toolbar Visibility</title>
+ <title><remark>Toolbar Visibility</remark></title>
<!-- Source Metadata
URL: https://access.redhat.com/kb/docs/DOC-54051
Author: Red Hat GSS
Modified: epp/docs/branches/5.1/Site_Publisher/User_Guide/publican.cfg
===================================================================
--- epp/docs/branches/5.1/Site_Publisher/User_Guide/publican.cfg 2011-07-30 02:53:38 UTC (rev 6960)
+++ epp/docs/branches/5.1/Site_Publisher/User_Guide/publican.cfg 2011-07-31 23:56:50 UTC (rev 6961)
@@ -5,6 +5,7 @@
type: Book
brand: JBoss
debug:1
+show_remarks: 1
toc_section_depth:10
max_image_width:660
condition: redhat
13 years, 4 months
gatein SVN: r6960 - in portal/trunk: component/common and 46 other directories.
by do-not-reply@jboss.org
Author: nscavell
Date: 2011-07-29 22:53:38 -0400 (Fri, 29 Jul 2011)
New Revision: 6960
Added:
portal/trunk/component/common/src/main/java/org/gatein/
portal/trunk/component/common/src/main/java/org/gatein/common/
portal/trunk/component/common/src/main/java/org/gatein/common/xml/
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/Exceptions.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/StaxNavUtils.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilder.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilderImpl.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriter.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterImpl.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueType.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueTypes.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilder.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilderImpl.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilder.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/NoOpFormatter.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/SimpleFormatter.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/XmlStreamingFormatter.java
portal/trunk/component/common/src/test/java/org/gatein/
portal/trunk/component/common/src/test/java/org/gatein/common/
portal/trunk/component/common/src/test/java/org/gatein/common/xml/
portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/
portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/AbstractStaxWriterTest.java
portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/LocalStaxWriterTest.java
portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/QualifiedStaxWriterTest.java
portal/trunk/component/management/src/main/java/org/gatein/
portal/trunk/component/management/src/main/java/org/gatein/management/
portal/trunk/component/management/src/main/java/org/gatein/management/runtime/
portal/trunk/component/management/src/main/java/org/gatein/management/runtime/ManagementBootstrap.java
portal/trunk/component/management/src/main/java/org/gatein/management/runtime/RuntimeContextImpl.java
portal/trunk/component/management/src/main/resources/conf/
portal/trunk/component/management/src/main/resources/conf/portal/
portal/trunk/component/management/src/main/resources/conf/portal/configuration.xml
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/MopManagementExtension.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/MopBindingProvider.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshaller.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/DelimitedValueType.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Element.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Namespace.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshaller.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshaller.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshaller.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Utils.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/AbstractExportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/AbstractImportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/ImportStrategy.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/ImportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/NavigationExportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/NavigationImportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/POMSessionExportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/PageExportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/PageImportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/SiteLayoutExportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/SiteLayoutImportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/AbstractMopOperationHandler.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopReadResource.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/Utils.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/AbstractNavigationOperationHandler.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationExportResource.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationKey.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationReadConfigAsXml.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationReadResource.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationUtils.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/AbstractPageOperationHandler.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageExportResource.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageKey.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageReadConfigAsXml.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageReadResource.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageUtils.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/AbstractSiteOperationHandler.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutExportResource.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutReadConfigAsXml.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteReadResource.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteTypeReadResource.java
portal/trunk/component/portal/src/main/resources/META-INF/services/org.gatein.management.spi.ManagementExtension
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshallerTest.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshallerTest.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshallerTest.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshallerTest.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/exportimport/
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/exportimport/PageImportTaskTest.java
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-empty.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-extended.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-fragment.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-empty.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-homepage.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-loaded.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/portal.xml
Removed:
portal/trunk/component/common/src/main/java/org/gatein/common/
portal/trunk/component/common/src/main/java/org/gatein/common/xml/
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/Exceptions.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/StaxNavUtils.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilder.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilderImpl.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriter.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterImpl.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueType.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueTypes.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilder.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilderImpl.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilder.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/NoOpFormatter.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/SimpleFormatter.java
portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/XmlStreamingFormatter.java
portal/trunk/component/common/src/test/java/org/gatein/common/
portal/trunk/component/common/src/test/java/org/gatein/common/xml/
portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/
portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/AbstractStaxWriterTest.java
portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/LocalStaxWriterTest.java
portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/QualifiedStaxWriterTest.java
portal/trunk/component/management/src/main/java/org/gatein/management/
portal/trunk/component/management/src/main/java/org/gatein/management/runtime/
portal/trunk/component/management/src/main/java/org/gatein/management/runtime/ManagementBootstrap.java
portal/trunk/component/management/src/main/java/org/gatein/management/runtime/RuntimeContextImpl.java
portal/trunk/component/management/src/main/resources/conf/portal/
portal/trunk/component/management/src/main/resources/conf/portal/configuration.xml
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/MopManagementExtension.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/MopBindingProvider.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshaller.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/DelimitedValueType.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Element.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Namespace.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshaller.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshaller.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshaller.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Utils.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/AbstractExportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/AbstractImportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/ImportStrategy.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/ImportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/NavigationExportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/NavigationImportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/POMSessionExportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/PageExportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/PageImportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/SiteLayoutExportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/SiteLayoutImportTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/AbstractMopOperationHandler.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopReadResource.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/Utils.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/AbstractNavigationOperationHandler.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationExportResource.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationKey.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationReadConfigAsXml.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationReadResource.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationUtils.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/AbstractPageOperationHandler.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageExportResource.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageKey.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageReadConfigAsXml.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageReadResource.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageUtils.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/AbstractSiteOperationHandler.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutExportResource.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutReadConfigAsXml.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteReadResource.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteTypeReadResource.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshallerTest.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshallerTest.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshallerTest.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshallerTest.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/exportimport/
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/exportimport/PageImportTaskTest.java
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-empty.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-extended.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-fragment.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-empty.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-homepage.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-loaded.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/portal.xml
Modified:
portal/trunk/
portal/trunk/component/common/pom.xml
portal/trunk/component/management/pom.xml
portal/trunk/component/portal/pom.xml
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
portal/trunk/packaging/jboss-as5/pkg/pom.xml
portal/trunk/packaging/jboss-as6/pkg/pom.xml
portal/trunk/packaging/jetty/pkg/pom.xml
portal/trunk/packaging/tomcat/pkg/pom.xml
portal/trunk/pom.xml
Log:
Merging gatein-management branch
Property changes on: portal/trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /epp/portal/branches/EPP_5_1_Branch:6841
/portal/branches/branch-GTNPORTAL-1790:5864-5919
/portal/branches/branch-GTNPORTAL-1822:5938-5991
/portal/branches/branch-GTNPORTAL-1832:5993-6105
/portal/branches/branch-GTNPORTAL-1872:6327-6594
/portal/branches/branch-GTNPORTAL-1921:6597-6803
/portal/branches/decoupled-webos:6214-6243
/portal/branches/global-portlet-metadata:6298-6384
/portal/branches/site-describability:6171-6235
/portal/branches/wsrp-extraction:5828-6031
+ /epp/portal/branches/EPP_5_1_Branch:6841
/portal/branches/branch-GTNPORTAL-1790:5864-5919
/portal/branches/branch-GTNPORTAL-1822:5938-5991
/portal/branches/branch-GTNPORTAL-1832:5993-6105
/portal/branches/branch-GTNPORTAL-1872:6327-6594
/portal/branches/branch-GTNPORTAL-1921:6597-6803
/portal/branches/decoupled-webos:6214-6243
/portal/branches/gatein-management:6920-6958
/portal/branches/global-portlet-metadata:6298-6384
/portal/branches/site-describability:6171-6235
/portal/branches/wsrp-extraction:5828-6031
Modified: portal/trunk/component/common/pom.xml
===================================================================
--- portal/trunk/component/common/pom.xml 2011-07-30 02:15:53 UTC (rev 6959)
+++ portal/trunk/component/common/pom.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -67,6 +67,11 @@
<groupId>org.chromattic</groupId>
<artifactId>chromattic.spi</artifactId>
</dependency>
+ <!-- Staxnav -->
+ <dependency>
+ <groupId>org.staxnav</groupId>
+ <artifactId>staxnav.core</artifactId>
+ </dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
@@ -86,6 +91,12 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>1.8.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.chromattic</groupId>
<artifactId>chromattic.core</artifactId>
<scope>test</scope>
Deleted: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/Exceptions.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/Exceptions.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/Exceptions.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax.navigator;
-
-import org.staxnav.StaxNavException;
-import org.staxnav.StaxNavigator;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class Exceptions
-{
- public static <N> StaxNavException expectedElement(StaxNavigator<N> navigator, N expected)
- {
- return expectedElement(navigator, navigator.getNaming().getLocalPart(expected));
- }
-
- public static StaxNavException expectedElement(StaxNavigator navigator, String expected)
- {
- StringBuilder message = new StringBuilder().append("Expected '").append(expected)
- .append("' but found '").append(navigator.getLocalName()).append("' instead.");
-
- return new StaxNavException(navigator.getLocation(), message.toString());
- }
-
- public static StaxNavException unexpectedElement(StaxNavigator navigator)
- {
- return new StaxNavException(navigator.getLocation(), "Unexpected element '" + navigator.getLocalName() + "'");
- }
-
- public static StaxNavException unknownElement(StaxNavigator navigator)
- {
- return new StaxNavException(navigator.getLocation(), "Unknown element '" + navigator.getLocalName() + "'");
- }
-
- public static StaxNavException invalidSequence(StaxNavigator navigator)
- {
- return new StaxNavException(navigator.getLocation(), "Element '" + navigator.getLocalName() + "' is out of sequence.");
- }
-
- public static StaxNavException contentRequired(StaxNavigator navigator)
- {
- return new StaxNavException(navigator.getLocation(), "Content for element '" + navigator.getLocalName() + "' is required.");
- }
-
- public static StaxNavException invalidParent(StaxNavigator navigator)
- {
- return new StaxNavException(navigator.getLocation(), "Invalid parent for element '" + navigator.getLocalName() + "'");
- }
-
- public static StaxNavException unexpectedEndOfFile(StaxNavigator navigator)
- {
- return new StaxNavException(navigator.getLocation(), "Unexpected end of file.");
- }
-}
Copied: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/Exceptions.java (from rev 6958, portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/Exceptions.java)
===================================================================
--- portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/Exceptions.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/Exceptions.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.navigator;
+
+import org.staxnav.StaxNavException;
+import org.staxnav.StaxNavigator;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class Exceptions
+{
+ public static <N> StaxNavException expectedElement(StaxNavigator<N> navigator, N expected)
+ {
+ return expectedElement(navigator, navigator.getNaming().getLocalPart(expected));
+ }
+
+ public static StaxNavException expectedElement(StaxNavigator navigator, String expected)
+ {
+ StringBuilder message = new StringBuilder().append("Expected '").append(expected)
+ .append("' but found '").append(navigator.getLocalName()).append("' instead.");
+
+ return new StaxNavException(navigator.getLocation(), message.toString());
+ }
+
+ public static StaxNavException unexpectedElement(StaxNavigator navigator)
+ {
+ return new StaxNavException(navigator.getLocation(), "Unexpected element '" + navigator.getLocalName() + "'");
+ }
+
+ public static StaxNavException unknownElement(StaxNavigator navigator)
+ {
+ return new StaxNavException(navigator.getLocation(), "Unknown element '" + navigator.getLocalName() + "'");
+ }
+
+ public static StaxNavException invalidSequence(StaxNavigator navigator)
+ {
+ return new StaxNavException(navigator.getLocation(), "Element '" + navigator.getLocalName() + "' is out of sequence.");
+ }
+
+ public static StaxNavException contentRequired(StaxNavigator navigator)
+ {
+ return new StaxNavException(navigator.getLocation(), "Content for element '" + navigator.getLocalName() + "' is required.");
+ }
+
+ public static StaxNavException invalidParent(StaxNavigator navigator)
+ {
+ return new StaxNavException(navigator.getLocation(), "Invalid parent for element '" + navigator.getLocalName() + "'");
+ }
+
+ public static StaxNavException unexpectedEndOfFile(StaxNavigator navigator)
+ {
+ return new StaxNavException(navigator.getLocation(), "Unexpected end of file.");
+ }
+}
Deleted: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/StaxNavUtils.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/StaxNavUtils.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/StaxNavUtils.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,197 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax.navigator;
-
-import org.gatein.common.xml.stax.navigator.builder.StaxNavBuilder;
-import org.gatein.common.xml.stax.navigator.builder.StaxNavBuilderImpl;
-import org.staxnav.EnumElement;
-import org.staxnav.Naming;
-import org.staxnav.StaxNavException;
-import org.staxnav.StaxNavigator;
-import org.staxnav.ValueType;
-
-import javax.xml.namespace.QName;
-import java.io.InputStream;
-import java.io.Reader;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import static org.gatein.common.xml.stax.navigator.Exceptions.*;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class StaxNavUtils
-{
- public static <N> StaxNavigator<N> createNavigator(Naming<N> naming, InputStream in) throws StaxNavException
- {
- return buildDefaultNavigator().withInputStream(in).build(naming);
- }
-
- public static StaxNavigator<String> createNavigator(InputStream in) throws StaxNavException
- {
- return createNavigator(new Naming.Local(), in);
- }
-
- public static StaxNavigator<QName> createQualifiedNavigator(InputStream in) throws StaxNavException
- {
- return createNavigator(new Naming.Qualified(), in);
- }
-
- public static <E extends Enum<E> & EnumElement<E>> StaxNavigator<E> createNavigator(Class<E> enumeratedClass,
- E noSuchElement, InputStream in) throws StaxNavException
- {
- Naming<E> naming;
- if (EnumElement.class.isAssignableFrom(enumeratedClass))
- {
- naming = new Naming.Enumerated.Mapped<E>(enumeratedClass, noSuchElement);
- }
- else
- {
- naming = new Naming.Enumerated.Simple<E>(enumeratedClass, noSuchElement);
- }
-
- return createNavigator(naming, in);
- }
-
- public static <N> StaxNavigator<N> createNavigator(Naming<N> naming, Reader reader) throws StaxNavException
- {
- return buildDefaultNavigator().withReader(reader).build(naming);
- }
-
- public static StaxNavigator<String> createNavigator(Reader reader) throws StaxNavException
- {
- return createNavigator(new Naming.Local(), reader);
- }
-
- public static StaxNavigator<QName> createQualifiedNavigator(Reader reader) throws StaxNavException
- {
- return createNavigator(new Naming.Qualified(), reader);
- }
-
- public static <E extends Enum<E> & EnumElement<E>> StaxNavigator<E> createNavigator(Class<E> enumeratedClass,
- E noSuchElement, Reader reader) throws StaxNavException
- {
- Naming<E> naming;
- if (EnumElement.class.isAssignableFrom(enumeratedClass))
- {
- naming = new Naming.Enumerated.Mapped<E>(enumeratedClass, noSuchElement);
- }
- else
- {
- naming = new Naming.Enumerated.Simple<E>(enumeratedClass, noSuchElement);
- }
-
- return createNavigator(naming, reader);
- }
-
- public static <N> void requiresChild(StaxNavigator<N> navigator, N element)
- {
- if (navigator.child() != element)
- {
- throw expectedElement(navigator, element);
- }
- }
-
- public static <N> void requiresSibling(StaxNavigator<N> navigator, N element)
- {
- if (!navigator.sibling(element))
- {
- throw expectedElement(navigator, element);
- }
- }
-
- public static String getRequiredAttribute(StaxNavigator navigator, String attributeName) throws StaxNavException
- {
- String value = navigator.getAttribute(attributeName);
- if (value == null)
- {
- throw new StaxNavException(navigator.getLocation(), "Attribute '" + attributeName + "' is required for element '" + navigator.getLocalName() + "'");
- }
-
- return value;
- }
-
- public static <N> String getContent(StaxNavigator<N> navigator, boolean trim)
- {
- boolean before = navigator.getTrimContent();
- try
- {
- navigator.setTrimContent(trim);
- return navigator.getContent();
- }
- finally
- {
- navigator.setTrimContent(before);
- }
- }
-
- public static <N> String getRequiredContent(StaxNavigator<N> navigator, boolean trim)
- {
- String content = getContent(navigator, trim);
- if (content == null || content.length() == 0)
- {
- throw contentRequired(navigator);
- }
-
- return content;
- }
-
- public static <N, V> V parseContent(StaxNavigator<N> navigator, ValueType<V> valueType, V defaultValue)
- {
- String content = getContent(navigator, true);
- if (content != null && content.length() != 0)
- {
- return navigator.parseContent(valueType);
- }
- else
- {
- return defaultValue;
- }
- }
-
- public static <N, V> V parseRequiredContent(StaxNavigator<N> navigator, ValueType<V> valueType)
- {
- V value = parseContent(navigator, valueType, null);
- if (value == null)
- {
- throw contentRequired(navigator);
- }
-
- return value;
- }
-
- public static <N> Set<N> forNames(N...names)
- {
- return new HashSet<N>(Arrays.asList(names));
- }
-
- private static StaxNavBuilder buildDefaultNavigator()
- {
- return new StaxNavBuilderImpl();
- }
-
- private StaxNavUtils() {}
-}
Copied: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/StaxNavUtils.java (from rev 6958, portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/StaxNavUtils.java)
===================================================================
--- portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/StaxNavUtils.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/StaxNavUtils.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,197 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.navigator;
+
+import org.gatein.common.xml.stax.navigator.builder.StaxNavBuilder;
+import org.gatein.common.xml.stax.navigator.builder.StaxNavBuilderImpl;
+import org.staxnav.EnumElement;
+import org.staxnav.Naming;
+import org.staxnav.StaxNavException;
+import org.staxnav.StaxNavigator;
+import org.staxnav.ValueType;
+
+import javax.xml.namespace.QName;
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.gatein.common.xml.stax.navigator.Exceptions.*;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class StaxNavUtils
+{
+ public static <N> StaxNavigator<N> createNavigator(Naming<N> naming, InputStream in) throws StaxNavException
+ {
+ return buildDefaultNavigator().withInputStream(in).build(naming);
+ }
+
+ public static StaxNavigator<String> createNavigator(InputStream in) throws StaxNavException
+ {
+ return createNavigator(new Naming.Local(), in);
+ }
+
+ public static StaxNavigator<QName> createQualifiedNavigator(InputStream in) throws StaxNavException
+ {
+ return createNavigator(new Naming.Qualified(), in);
+ }
+
+ public static <E extends Enum<E> & EnumElement<E>> StaxNavigator<E> createNavigator(Class<E> enumeratedClass,
+ E noSuchElement, InputStream in) throws StaxNavException
+ {
+ Naming<E> naming;
+ if (EnumElement.class.isAssignableFrom(enumeratedClass))
+ {
+ naming = new Naming.Enumerated.Mapped<E>(enumeratedClass, noSuchElement);
+ }
+ else
+ {
+ naming = new Naming.Enumerated.Simple<E>(enumeratedClass, noSuchElement);
+ }
+
+ return createNavigator(naming, in);
+ }
+
+ public static <N> StaxNavigator<N> createNavigator(Naming<N> naming, Reader reader) throws StaxNavException
+ {
+ return buildDefaultNavigator().withReader(reader).build(naming);
+ }
+
+ public static StaxNavigator<String> createNavigator(Reader reader) throws StaxNavException
+ {
+ return createNavigator(new Naming.Local(), reader);
+ }
+
+ public static StaxNavigator<QName> createQualifiedNavigator(Reader reader) throws StaxNavException
+ {
+ return createNavigator(new Naming.Qualified(), reader);
+ }
+
+ public static <E extends Enum<E> & EnumElement<E>> StaxNavigator<E> createNavigator(Class<E> enumeratedClass,
+ E noSuchElement, Reader reader) throws StaxNavException
+ {
+ Naming<E> naming;
+ if (EnumElement.class.isAssignableFrom(enumeratedClass))
+ {
+ naming = new Naming.Enumerated.Mapped<E>(enumeratedClass, noSuchElement);
+ }
+ else
+ {
+ naming = new Naming.Enumerated.Simple<E>(enumeratedClass, noSuchElement);
+ }
+
+ return createNavigator(naming, reader);
+ }
+
+ public static <N> void requiresChild(StaxNavigator<N> navigator, N element)
+ {
+ if (navigator.child() != element)
+ {
+ throw expectedElement(navigator, element);
+ }
+ }
+
+ public static <N> void requiresSibling(StaxNavigator<N> navigator, N element)
+ {
+ if (!navigator.sibling(element))
+ {
+ throw expectedElement(navigator, element);
+ }
+ }
+
+ public static String getRequiredAttribute(StaxNavigator navigator, String attributeName) throws StaxNavException
+ {
+ String value = navigator.getAttribute(attributeName);
+ if (value == null)
+ {
+ throw new StaxNavException(navigator.getLocation(), "Attribute '" + attributeName + "' is required for element '" + navigator.getLocalName() + "'");
+ }
+
+ return value;
+ }
+
+ public static <N> String getContent(StaxNavigator<N> navigator, boolean trim)
+ {
+ boolean before = navigator.getTrimContent();
+ try
+ {
+ navigator.setTrimContent(trim);
+ return navigator.getContent();
+ }
+ finally
+ {
+ navigator.setTrimContent(before);
+ }
+ }
+
+ public static <N> String getRequiredContent(StaxNavigator<N> navigator, boolean trim)
+ {
+ String content = getContent(navigator, trim);
+ if (content == null || content.length() == 0)
+ {
+ throw contentRequired(navigator);
+ }
+
+ return content;
+ }
+
+ public static <N, V> V parseContent(StaxNavigator<N> navigator, ValueType<V> valueType, V defaultValue)
+ {
+ String content = getContent(navigator, true);
+ if (content != null && content.length() != 0)
+ {
+ return navigator.parseContent(valueType);
+ }
+ else
+ {
+ return defaultValue;
+ }
+ }
+
+ public static <N, V> V parseRequiredContent(StaxNavigator<N> navigator, ValueType<V> valueType)
+ {
+ V value = parseContent(navigator, valueType, null);
+ if (value == null)
+ {
+ throw contentRequired(navigator);
+ }
+
+ return value;
+ }
+
+ public static <N> Set<N> forNames(N...names)
+ {
+ return new HashSet<N>(Arrays.asList(names));
+ }
+
+ private static StaxNavBuilder buildDefaultNavigator()
+ {
+ return new StaxNavBuilderImpl();
+ }
+
+ private StaxNavUtils() {}
+}
Deleted: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilder.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilder.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilder.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax.navigator.builder;
-
-import org.staxnav.Naming;
-import org.staxnav.StaxNavException;
-import org.staxnav.StaxNavigator;
-
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.transform.Source;
-import java.io.InputStream;
-import java.io.Reader;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public interface StaxNavBuilder
-{
- StaxNavBuilder withProperty(String name, Object value);
-
- StaxNavBuilder withPropertyIfSupported(String name, Object value);
-
- StaxNavBuilder withInputStream(InputStream inputStream);
-
- StaxNavBuilder withInputStream(InputStream inputStream, String encoding);
-
- StaxNavBuilder withReader(Reader reader);
-
- StaxNavBuilder withSource(Source source);
-
- StaxNavBuilder withXmlStreamReader(XMLStreamReader reader);
-
- <N> StaxNavigator<N> build(Naming<N> naming) throws StaxNavException, IllegalStateException;
-}
Copied: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilder.java (from rev 6958, portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilder.java)
===================================================================
--- portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilder.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilder.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.navigator.builder;
+
+import org.staxnav.Naming;
+import org.staxnav.StaxNavException;
+import org.staxnav.StaxNavigator;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import java.io.InputStream;
+import java.io.Reader;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public interface StaxNavBuilder
+{
+ StaxNavBuilder withProperty(String name, Object value);
+
+ StaxNavBuilder withPropertyIfSupported(String name, Object value);
+
+ StaxNavBuilder withInputStream(InputStream inputStream);
+
+ StaxNavBuilder withInputStream(InputStream inputStream, String encoding);
+
+ StaxNavBuilder withReader(Reader reader);
+
+ StaxNavBuilder withSource(Source source);
+
+ StaxNavBuilder withXmlStreamReader(XMLStreamReader reader);
+
+ <N> StaxNavigator<N> build(Naming<N> naming) throws StaxNavException, IllegalStateException;
+}
Deleted: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilderImpl.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilderImpl.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilderImpl.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,203 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax.navigator.builder;
-
-import org.staxnav.Naming;
-import org.staxnav.StaxNavException;
-import org.staxnav.StaxNavigator;
-import org.staxnav.StaxNavigatorFactory;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.transform.Source;
-import java.io.InputStream;
-import java.io.Reader;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class StaxNavBuilderImpl implements StaxNavBuilder
-{
- private Object input;
- private String inputEncoding;
- private XMLStreamReader reader;
-
- private Map<String, Object> properties = new HashMap<String, Object>();
- private Map<String, Object> supportedProperties = new HashMap<String, Object>();
-
- @Override
- public StaxNavBuilder withProperty(String name, Object value)
- {
- if (name == null) throw new IllegalArgumentException("name is null");
- if (value == null) throw new IllegalArgumentException("value is null");
-
- properties.put(name, value);
- return this;
- }
-
- @Override
- public StaxNavBuilder withPropertyIfSupported(String name, Object value)
- {
- if (name == null) throw new IllegalArgumentException("name is null");
- if (value == null) throw new IllegalArgumentException("value is null");
-
- supportedProperties.put(name, value);
- return this;
- }
-
- @Override
- public StaxNavBuilder withInputStream(InputStream inputStream)
- {
- if (inputStream == null) throw new IllegalArgumentException("inputStream is null");
-
- input = inputStream;
- return this;
- }
-
- @Override
- public StaxNavBuilder withInputStream(InputStream inputStream, String encoding)
- {
- if (inputStream == null) throw new IllegalArgumentException("inputStream is null");
- if (encoding == null) throw new IllegalArgumentException("encoding is null");
-
- input = inputStream;
- inputEncoding = encoding;
- return this;
- }
-
- @Override
- public StaxNavBuilder withReader(Reader reader)
- {
- if (reader == null) throw new IllegalArgumentException("reader is null");
-
- this.input = reader;
- return this;
- }
-
- @Override
- public StaxNavBuilder withSource(Source source)
- {
- if (source == null) throw new IllegalArgumentException("source is null");
-
- input = source;
- return this;
- }
-
- @Override
- public StaxNavBuilder withXmlStreamReader(XMLStreamReader reader)
- {
- if (reader == null) throw new IllegalArgumentException("reader is null");
-
- this.reader = reader;
- return this;
- }
-
- @Override
- public <N> StaxNavigator<N> build(Naming<N> naming) throws StaxNavException, IllegalStateException
- {
- if (naming == null) throw new IllegalArgumentException("naming is null");
-
- if (reader == null && input == null)
- throw new IllegalStateException("Cannot build stax reader. Try calling withInputStream/withReader or pass in own XMLStreamReader.");
-
- if (reader == null)
- {
- //TODO: Create solution to properly cache XMLInputFactory
- XMLInputFactory factory = XMLInputFactory.newInstance();
-
- // Set properties
- for (Map.Entry<String, Object> entry : properties.entrySet())
- {
- factory.setProperty(entry.getKey(), entry.getValue());
- }
-
- // Set properties if supported
- for (Map.Entry<String, Object> entry : supportedProperties.entrySet())
- {
- String name = entry.getKey();
- if (factory.isPropertySupported(name))
- {
- factory.setProperty(name, entry.getValue());
- }
- }
-
- if (input instanceof InputStream)
- {
- if (inputEncoding == null)
- {
- try
- {
- reader = factory.createXMLStreamReader((InputStream) input, inputEncoding);
- }
- catch (XMLStreamException e)
- {
- throw new StaxNavException(e);
- }
- }
- else
- {
- try
- {
- reader = factory.createXMLStreamReader((InputStream) input);
- }
- catch (XMLStreamException e)
- {
- throw new StaxNavException(null, "Exception creating XMLStreamReader with inputStream: " + input, e);
- }
- }
- }
- else if (input instanceof Reader)
- {
- try
- {
- reader = factory.createXMLStreamReader((Reader) input);
- }
- catch (XMLStreamException e)
- {
- throw new StaxNavException(null, "Exception creating XMLStreamReader with reader: " + input, e);
- }
- }
- else if (input instanceof Source)
- {
- try
- {
- reader = factory.createXMLStreamReader((Source) input);
- }
- catch (XMLStreamException e)
- {
- throw new StaxNavException(null, "Exception creating XMLStreamReader with Source: " + input, e);
- }
- }
- else
- {
- throw new IllegalStateException("Unknown input: " + input); // should never happen...
- }
- }
-
- return StaxNavigatorFactory.create(naming, reader);
- }
-}
Copied: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilderImpl.java (from rev 6958, portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilderImpl.java)
===================================================================
--- portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilderImpl.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilderImpl.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,203 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.navigator.builder;
+
+import org.staxnav.Naming;
+import org.staxnav.StaxNavException;
+import org.staxnav.StaxNavigator;
+import org.staxnav.StaxNavigatorFactory;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class StaxNavBuilderImpl implements StaxNavBuilder
+{
+ private Object input;
+ private String inputEncoding;
+ private XMLStreamReader reader;
+
+ private Map<String, Object> properties = new HashMap<String, Object>();
+ private Map<String, Object> supportedProperties = new HashMap<String, Object>();
+
+ @Override
+ public StaxNavBuilder withProperty(String name, Object value)
+ {
+ if (name == null) throw new IllegalArgumentException("name is null");
+ if (value == null) throw new IllegalArgumentException("value is null");
+
+ properties.put(name, value);
+ return this;
+ }
+
+ @Override
+ public StaxNavBuilder withPropertyIfSupported(String name, Object value)
+ {
+ if (name == null) throw new IllegalArgumentException("name is null");
+ if (value == null) throw new IllegalArgumentException("value is null");
+
+ supportedProperties.put(name, value);
+ return this;
+ }
+
+ @Override
+ public StaxNavBuilder withInputStream(InputStream inputStream)
+ {
+ if (inputStream == null) throw new IllegalArgumentException("inputStream is null");
+
+ input = inputStream;
+ return this;
+ }
+
+ @Override
+ public StaxNavBuilder withInputStream(InputStream inputStream, String encoding)
+ {
+ if (inputStream == null) throw new IllegalArgumentException("inputStream is null");
+ if (encoding == null) throw new IllegalArgumentException("encoding is null");
+
+ input = inputStream;
+ inputEncoding = encoding;
+ return this;
+ }
+
+ @Override
+ public StaxNavBuilder withReader(Reader reader)
+ {
+ if (reader == null) throw new IllegalArgumentException("reader is null");
+
+ this.input = reader;
+ return this;
+ }
+
+ @Override
+ public StaxNavBuilder withSource(Source source)
+ {
+ if (source == null) throw new IllegalArgumentException("source is null");
+
+ input = source;
+ return this;
+ }
+
+ @Override
+ public StaxNavBuilder withXmlStreamReader(XMLStreamReader reader)
+ {
+ if (reader == null) throw new IllegalArgumentException("reader is null");
+
+ this.reader = reader;
+ return this;
+ }
+
+ @Override
+ public <N> StaxNavigator<N> build(Naming<N> naming) throws StaxNavException, IllegalStateException
+ {
+ if (naming == null) throw new IllegalArgumentException("naming is null");
+
+ if (reader == null && input == null)
+ throw new IllegalStateException("Cannot build stax reader. Try calling withInputStream/withReader or pass in own XMLStreamReader.");
+
+ if (reader == null)
+ {
+ //TODO: Create solution to properly cache XMLInputFactory
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+
+ // Set properties
+ for (Map.Entry<String, Object> entry : properties.entrySet())
+ {
+ factory.setProperty(entry.getKey(), entry.getValue());
+ }
+
+ // Set properties if supported
+ for (Map.Entry<String, Object> entry : supportedProperties.entrySet())
+ {
+ String name = entry.getKey();
+ if (factory.isPropertySupported(name))
+ {
+ factory.setProperty(name, entry.getValue());
+ }
+ }
+
+ if (input instanceof InputStream)
+ {
+ if (inputEncoding == null)
+ {
+ try
+ {
+ reader = factory.createXMLStreamReader((InputStream) input, inputEncoding);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(e);
+ }
+ }
+ else
+ {
+ try
+ {
+ reader = factory.createXMLStreamReader((InputStream) input);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(null, "Exception creating XMLStreamReader with inputStream: " + input, e);
+ }
+ }
+ }
+ else if (input instanceof Reader)
+ {
+ try
+ {
+ reader = factory.createXMLStreamReader((Reader) input);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(null, "Exception creating XMLStreamReader with reader: " + input, e);
+ }
+ }
+ else if (input instanceof Source)
+ {
+ try
+ {
+ reader = factory.createXMLStreamReader((Source) input);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(null, "Exception creating XMLStreamReader with Source: " + input, e);
+ }
+ }
+ else
+ {
+ throw new IllegalStateException("Unknown input: " + input); // should never happen...
+ }
+ }
+
+ return StaxNavigatorFactory.create(naming, reader);
+ }
+}
Deleted: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriter.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriter.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriter.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,152 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax.writer;
-
-import org.staxnav.StaxNavException;
-
-import javax.xml.namespace.QName;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public interface StaxWriter<N>
-{
- /**
- * Writes the start tag of an xml element. Requires that an element has been started first.
- *
- * @param element element to start
- * @return StaxWriter
- * @throws org.staxnav.StaxNavException if an exception occurs
- */
- StaxWriter<N> writeStartElement(N element) throws StaxNavException;
-
- /**
- * Writes an attribute for an xml element. Requires that an element has been started first.
- *
- * @param name the name of the attribute
- * @param value the value of the attribute
- * @return StaxWriter
- * @throws org.staxnav.StaxNavException if an exception occurs
- */
- StaxWriter<N> writeAttribute(String name, String value) throws StaxNavException;
-
- /**
- * Writes an attribute for an xml element. Requires that an element has been started first.
- *
- * @param name QName object representing the name of the attribute
- * @param value the value of the attribute
- * @return StaxWriter
- * @throws org.staxnav.StaxNavException if an exception occurs
- */
- StaxWriter<N> writeAttribute(QName name, String value) throws StaxNavException;
-
- /**
- * Writes xml content. Requires an xml element has been started first.
- *
- * @param content content to be written
- * @return StaxWriter
- * @throws org.staxnav.StaxNavException if an exception occurs
- */
- StaxWriter<N> writeContent(String content) throws StaxNavException;
-
- /**
- * Writes xml content based on the ValueType responsible for converting the content to string. Requires an xml element has been started first.
- *
- * @param valueType object responsible for writing content to string
- * @param content content to be written
- * @return StaxWriter
- * @throws org.staxnav.StaxNavException if an exception occurs
- */
- <V> StaxWriter<N> writeContent(WritableValueType<V> valueType, V content) throws StaxNavException;
-
- /**
- * Writes an end tag for the previously started element. Requires that an element has been started first.
- *
- * @return StaxWriter
- * @throws org.staxnav.StaxNavException if an exception occurs
- */
- StaxWriter<N> writeEndElement() throws StaxNavException;
-
- /**
- * Convenience method for calling <code>writeStartElement</code>, <code>writeContent</code>, <code>writeEndElement</code>
- *
- * @param element element to write
- * @param content content to be written
- * @return StaxWriter
- * @throws org.staxnav.StaxNavException if an exception occurs
- */
- <V> StaxWriter<N> writeElement(N element, String content) throws StaxNavException;
-
- /**
- * Convenience method for calling <code>writeStartElement</code>, <code>writeContent</code>, <code>writeEndElement</code>
- *
- * @param element element to write
- * @param valueType object responsible for writing content to string
- * @param content content to be written
- * @return StaxWriter
- * @throws org.staxnav.StaxNavException if an exception occurs
- */
- <V> StaxWriter<N> writeElement(N element, WritableValueType<V> valueType, V content) throws StaxNavException;
-
- /**
- * Writes the namespace. If prefix is an empty string, "xmlns", or null this will delegate to writeDefaultNamespace
- * @param prefix the prefix to bind the namespace to
- * @param uri the uri to bind the prefix to
- * @return StaxWriter
- * @throws org.staxnav.StaxNavException if an exception occurs
- */
- StaxWriter<N> writeNamespace(String prefix, String uri) throws StaxNavException;
-
- /**
- * Writes the default namespace
- * @param uri the uri to bind the default namespace to
- * @return StaxWriter
- * @throws org.staxnav.StaxNavException if an exception occurs
- */
- StaxWriter<N> writeDefaultNamespace(String uri) throws StaxNavException;
-
- /**
- * Writes an xml comment
- * @param comment the comment to write
- * @return StaxWriter
- * @throws org.staxnav.StaxNavException if an exception occurs
- */
- StaxWriter<N> writeComment(String comment) throws StaxNavException;
-
- /**
- * Writes a cdata section
- * @param cdata content of the cdata
- * @return StaxWriter
- * @throws org.staxnav.StaxNavException if an exception occurs
- */
- StaxWriter<N> writeCData(String cdata) throws StaxNavException;
-
- /**
- * Calling finish will flush and close the underlying stream. It will also call any endElements for you
- * if they were never explicitly called.
- *
- * @throws org.staxnav.StaxNavException if an exception occurs
- */
- void finish() throws StaxNavException;
-}
\ No newline at end of file
Copied: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriter.java (from rev 6958, portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriter.java)
===================================================================
--- portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriter.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriter.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,152 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer;
+
+import org.staxnav.StaxNavException;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public interface StaxWriter<N>
+{
+ /**
+ * Writes the start tag of an xml element. Requires that an element has been started first.
+ *
+ * @param element element to start
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ StaxWriter<N> writeStartElement(N element) throws StaxNavException;
+
+ /**
+ * Writes an attribute for an xml element. Requires that an element has been started first.
+ *
+ * @param name the name of the attribute
+ * @param value the value of the attribute
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ StaxWriter<N> writeAttribute(String name, String value) throws StaxNavException;
+
+ /**
+ * Writes an attribute for an xml element. Requires that an element has been started first.
+ *
+ * @param name QName object representing the name of the attribute
+ * @param value the value of the attribute
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ StaxWriter<N> writeAttribute(QName name, String value) throws StaxNavException;
+
+ /**
+ * Writes xml content. Requires an xml element has been started first.
+ *
+ * @param content content to be written
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ StaxWriter<N> writeContent(String content) throws StaxNavException;
+
+ /**
+ * Writes xml content based on the ValueType responsible for converting the content to string. Requires an xml element has been started first.
+ *
+ * @param valueType object responsible for writing content to string
+ * @param content content to be written
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ <V> StaxWriter<N> writeContent(WritableValueType<V> valueType, V content) throws StaxNavException;
+
+ /**
+ * Writes an end tag for the previously started element. Requires that an element has been started first.
+ *
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ StaxWriter<N> writeEndElement() throws StaxNavException;
+
+ /**
+ * Convenience method for calling <code>writeStartElement</code>, <code>writeContent</code>, <code>writeEndElement</code>
+ *
+ * @param element element to write
+ * @param content content to be written
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ <V> StaxWriter<N> writeElement(N element, String content) throws StaxNavException;
+
+ /**
+ * Convenience method for calling <code>writeStartElement</code>, <code>writeContent</code>, <code>writeEndElement</code>
+ *
+ * @param element element to write
+ * @param valueType object responsible for writing content to string
+ * @param content content to be written
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ <V> StaxWriter<N> writeElement(N element, WritableValueType<V> valueType, V content) throws StaxNavException;
+
+ /**
+ * Writes the namespace. If prefix is an empty string, "xmlns", or null this will delegate to writeDefaultNamespace
+ * @param prefix the prefix to bind the namespace to
+ * @param uri the uri to bind the prefix to
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ StaxWriter<N> writeNamespace(String prefix, String uri) throws StaxNavException;
+
+ /**
+ * Writes the default namespace
+ * @param uri the uri to bind the default namespace to
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ StaxWriter<N> writeDefaultNamespace(String uri) throws StaxNavException;
+
+ /**
+ * Writes an xml comment
+ * @param comment the comment to write
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ StaxWriter<N> writeComment(String comment) throws StaxNavException;
+
+ /**
+ * Writes a cdata section
+ * @param cdata content of the cdata
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ StaxWriter<N> writeCData(String cdata) throws StaxNavException;
+
+ /**
+ * Calling finish will flush and close the underlying stream. It will also call any endElements for you
+ * if they were never explicitly called.
+ *
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ void finish() throws StaxNavException;
+}
\ No newline at end of file
Deleted: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterImpl.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterImpl.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterImpl.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,503 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax.writer;
-
-
-import org.gatein.common.xml.stax.writer.formatting.NoOpFormatter;
-import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
-import org.staxnav.Naming;
-import org.staxnav.StaxNavException;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import java.util.ArrayDeque;
-import java.util.Deque;
-import java.util.List;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class StaxWriterImpl<N> implements StaxWriter<N>, XMLStreamConstants
-{
- private Naming<N> naming;
- private XMLStreamWriter writer;
- private XmlStreamingFormatter formatter;
-
- private Deque<Element> elementStack = new ArrayDeque<Element>();
-
- public StaxWriterImpl(Naming<N> naming, XMLStreamWriter writer)
- {
- this(naming, writer, null);
- }
-
- public StaxWriterImpl(Naming<N> naming, XMLStreamWriter writer, XmlStreamingFormatter formatter)
- {
- this(naming, writer, formatter, null, null);
- }
-
- public StaxWriterImpl(Naming<N> naming, XMLStreamWriter writer, XmlStreamingFormatter formatter, String encoding, String version)
- {
- this.naming = naming;
- this.writer = writer;
- if (formatter == null) formatter = new NoOpFormatter();
-
- this.formatter = formatter;
- elementStack.push(new RootElement(writer, formatter, encoding, version));
- }
-
- public StaxWriter<N> writeAttribute(String name, String value)
- {
- if (name == null) throw new IllegalArgumentException("name cannot be null");
- if (value == null) throw new IllegalArgumentException("value cannot be null");
-
- Element current = elementStack.peek();
- current.writeAttribute(name, value);
- return this;
- }
-
- public StaxWriter<N> writeAttribute(QName name, String value)
- {
- if (name == null) throw new IllegalArgumentException("name cannot be null");
-
- Element current = elementStack.peek();
- current.writeAttribute(name, value);
- return this;
- }
-
- public StaxWriter<N> writeStartElement(N element) throws StaxNavException
- {
- Element current = elementStack.peek();
- if (current instanceof RootElement)
- {
- if (((RootElement) current).started)
- {
- current = new StreamElement(writer, formatter);
- elementStack.push(current);
- }
- }
- else
- {
- current = new StreamElement(writer, formatter);
- elementStack.push(current);
- }
-
- current.writeStartElement(naming, element);
- return this;
- }
-
- public StaxWriter<N> writeEndElement() throws StaxNavException
- {
- if (elementStack.isEmpty()) throw new StaxNavException(null, "No matching startElement was found for this endElement");
-
- elementStack.pop().end();
-
- return this;
- }
-
- public StaxWriter<N> writeContent(String content) throws StaxNavException
- {
- return writeContent(WritableValueTypes.STRING, content);
- }
-
- public <V> StaxWriter<N> writeContent(WritableValueType<V> valueType, V content) throws StaxNavException
- {
- if (valueType == null) throw new IllegalArgumentException("valueType cannot be null.");
- if (content == null) throw new IllegalArgumentException("content cannot be null.");
-
- Element current = elementStack.peek();
- current.writeContent(valueType.format(content));
-
- return this;
- }
-
- public <V> StaxWriter<N> writeElement(N element, String content) throws StaxNavException
- {
- return writeElement(element, WritableValueTypes.STRING, content);
- }
-
- public <V> StaxWriter<N> writeElement(N element, WritableValueType<V> valueType, V content) throws StaxNavException
- {
- writeStartElement(element).writeContent(valueType, content).writeEndElement();
- return this;
- }
-
- public StaxWriter<N> writeNamespace(String prefix, String uri) throws StaxNavException
- {
- Element current = elementStack.peek();
- current.writeNamespace(prefix, uri);
- return this;
- }
-
- public StaxWriter<N> writeDefaultNamespace(String uri) throws StaxNavException
- {
- Element current = elementStack.peek();
- current.writeDefaultNamespace(uri);
- return this;
- }
-
- public StaxWriter<N> writeComment(final String comment) throws StaxNavException
- {
- Element current = elementStack.peek();
- current.writeComment(comment);
- return this;
- }
-
- public StaxWriter<N> writeCData(String cdata) throws StaxNavException
- {
- Element current = elementStack.peek();
- current.writeCData(cdata);
- return this;
- }
-
- public void finish() throws StaxNavException
- {
- while (!elementStack.isEmpty())
- {
- elementStack.pop().end();
- }
- }
-
- private static abstract class Element
- {
- abstract void writeAttribute(String name, String value) throws StaxNavException;
-
- abstract <N> void writeAttribute(QName name, String value) throws StaxNavException;
-
- abstract <N> void writeStartElement(Naming<N> naming, N name) throws StaxNavException;
-
- abstract void writeContent(String content) throws StaxNavException;
-
- abstract void writeNamespace(String prefix, String uri) throws StaxNavException;
-
- abstract void writeDefaultNamespace(String uri) throws StaxNavException;
-
- abstract void writeComment(String comment) throws StaxNavException;
-
- abstract void writeCData(String cdata) throws StaxNavException;
-
- abstract void end();
-
- XMLStreamWriter writer;
- XmlStreamingFormatter formatter;
- private List<StreamClosure> closures;
-
- Element(XMLStreamWriter writer, XmlStreamingFormatter formatter)
- {
- this(writer, formatter, null);
- }
-
- Element(XMLStreamWriter writer, XmlStreamingFormatter formatter, List<StreamClosure> closures)
- {
- this.writer = writer;
- this.formatter = formatter;
- this.closures = closures;
- }
-
- void apply(int event, StreamClosure closure) throws StaxNavException
- {
- try
- {
- formatter.before(writer, event);
- closure.execute(writer);
- formatter.after(writer, event);
- }
- catch (XMLStreamException e)
- {
- throw new StaxNavException(e);
- }
- }
- }
-
- private static class RootElement extends Element
- {
- private String encoding;
- private String version;
- private Element element;
- private boolean started;
-
- RootElement(XMLStreamWriter writer, XmlStreamingFormatter formatter, String encoding, String version)
- {
- super(writer, formatter);
- this.encoding = encoding;
- this.version = version;
- }
-
- public void writeAttribute(String name, String value) throws StaxNavException
- {
- get().writeAttribute(name, value);
- }
-
- public <N> void writeAttribute(QName name, String value) throws StaxNavException
- {
- get().writeAttribute(name, value);
- }
-
- public <N> void writeStartElement(Naming<N> naming, N name) throws StaxNavException
- {
- get().writeStartElement(naming, name);
- started = true;
- }
-
- public void writeContent(String content) throws StaxNavException
- {
- get().writeContent(content);
- }
-
- public void writeNamespace(String prefix, String uri) throws StaxNavException
- {
- get().writeNamespace(prefix, uri);
- }
-
- public void writeDefaultNamespace(String uri) throws StaxNavException
- {
- get().writeDefaultNamespace(uri);
- }
-
- public void writeComment(String comment) throws StaxNavException
- {
- get().writeComment(comment);
- }
-
- public void writeCData(String cdata) throws StaxNavException
- {
- get().writeCData(cdata);
- }
-
- public void end()
- {
- if (started)
- {
- get().end();
- }
- endDocument();
- }
-
- private Element get()
- {
- if (element == null)
- {
- startDocument();
- element = new StreamElement(writer, formatter);
- }
- return element;
- }
-
- private void startDocument() throws StaxNavException
- {
- apply(START_DOCUMENT, new StreamClosure()
- {
- public void execute(XMLStreamWriter writer) throws XMLStreamException
- {
- if (encoding == null && version == null)
- {
- writer.writeStartDocument();
- }
- else if (encoding == null)
- {
- writer.writeStartDocument(version);
- }
- else
- {
- writer.writeStartDocument(encoding, version);
- }
- }
- });
- }
-
- private void endDocument() throws StaxNavException
- {
- try
- {
- apply(END_DOCUMENT, new StreamClosure()
- {
- public void execute(XMLStreamWriter writer) throws XMLStreamException
- {
- writer.writeEndDocument();
- }
- });
-
- writer.flush();
- }
- catch (XMLStreamException e)
- {
- throw new StaxNavException(e);
- }
- finally
- {
- try
- {
- writer.close();
- }
- catch (XMLStreamException e)
- {
- }
- }
- }
- }
-
- private static class StreamElement extends Element
- {
- StreamElement(XMLStreamWriter writer, XmlStreamingFormatter formatter)
- {
- super(writer, formatter);
- }
-
- public void writeAttribute(final String name, final String value) throws StaxNavException
- {
- apply(ATTRIBUTE, new StreamClosure()
- {
- public void execute(XMLStreamWriter writer) throws XMLStreamException
- {
- writer.writeAttribute(name, value);
- }
- });
- }
-
- public <N> void writeAttribute(QName name, final String value) throws StaxNavException
- {
- final String prefix = name.getPrefix();
- final String uri = name.getNamespaceURI();
- final String localPart = name.getLocalPart();
-
- apply(ATTRIBUTE, new StreamClosure()
- {
- public void execute(XMLStreamWriter writer) throws XMLStreamException
- {
- if (uri == null || XMLConstants.NULL_NS_URI.equals(uri))
- {
- writer.writeAttribute(localPart, value);
- }
- else if (prefix == null || XMLConstants.DEFAULT_NS_PREFIX.equals(prefix))
- {
- writer.writeAttribute(uri, localPart, value);
- }
- else
- {
- writer.writeAttribute(prefix, uri, localPart, value);
- }
- }
- });
- }
-
- public <N> void writeStartElement(Naming<N> naming, N name) throws StaxNavException
- {
- final String prefix = naming.getPrefix(name);
- final String uri = naming.getURI(name);
- final String localPart = naming.getLocalPart(name);
-
- apply(START_ELEMENT, new StreamClosure()
- {
- public void execute(XMLStreamWriter writer) throws XMLStreamException
- {
- if (uri == null || XMLConstants.NULL_NS_URI.equals(uri))
- {
- writer.writeStartElement(localPart);
- }
- else if (prefix == null || XMLConstants.DEFAULT_NS_PREFIX.equals(prefix))
- {
- writer.writeStartElement(uri, localPart);
- }
- else
- {
- writer.writeStartElement(prefix, localPart, uri);
- }
- }
- });
- }
-
- public void writeContent(final String content) throws StaxNavException
- {
- apply(CHARACTERS, new StreamClosure()
- {
- public void execute(XMLStreamWriter writer) throws XMLStreamException
- {
- writer.writeCharacters(content);
- }
- });
- }
-
- public void writeNamespace(final String prefix, final String uri) throws StaxNavException
- {
- apply(NAMESPACE, new StreamClosure()
- {
- public void execute(XMLStreamWriter writer) throws XMLStreamException
- {
- writer.writeNamespace(prefix, uri);
- }
- });
- }
-
- public void writeDefaultNamespace(final String uri) throws StaxNavException
- {
- apply(NAMESPACE, new StreamClosure()
- {
- public void execute(XMLStreamWriter writer) throws XMLStreamException
- {
- writer.writeDefaultNamespace(uri);
- }
- });
- }
-
- public void writeComment(final String comment) throws StaxNavException
- {
- apply(COMMENT, new StreamClosure()
- {
- public void execute(XMLStreamWriter writer) throws XMLStreamException
- {
- writer.writeComment(comment);
- }
- });
- }
-
- public void writeCData(final String cdata) throws StaxNavException
- {
- apply(CDATA, new StreamClosure()
- {
- public void execute(XMLStreamWriter writer) throws XMLStreamException
- {
- writer.writeCData(cdata);
- }
- });
- }
-
- public void end()
- {
- apply(END_ELEMENT, new StreamClosure()
- {
- public void execute(XMLStreamWriter writer) throws XMLStreamException
- {
- writer.writeEndElement();
- }
- });
- }
- }
-
- private static interface StreamClosure
- {
- void execute(XMLStreamWriter writer) throws XMLStreamException;
- }
-}
Copied: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterImpl.java (from rev 6958, portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterImpl.java)
===================================================================
--- portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterImpl.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterImpl.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,503 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer;
+
+
+import org.gatein.common.xml.stax.writer.formatting.NoOpFormatter;
+import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
+import org.staxnav.Naming;
+import org.staxnav.StaxNavException;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.util.ArrayDeque;
+import java.util.Deque;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class StaxWriterImpl<N> implements StaxWriter<N>, XMLStreamConstants
+{
+ private Naming<N> naming;
+ private XMLStreamWriter writer;
+ private XmlStreamingFormatter formatter;
+
+ private Deque<Element> elementStack = new ArrayDeque<Element>();
+
+ public StaxWriterImpl(Naming<N> naming, XMLStreamWriter writer)
+ {
+ this(naming, writer, null);
+ }
+
+ public StaxWriterImpl(Naming<N> naming, XMLStreamWriter writer, XmlStreamingFormatter formatter)
+ {
+ this(naming, writer, formatter, null, null);
+ }
+
+ public StaxWriterImpl(Naming<N> naming, XMLStreamWriter writer, XmlStreamingFormatter formatter, String encoding, String version)
+ {
+ this.naming = naming;
+ this.writer = writer;
+ if (formatter == null) formatter = new NoOpFormatter();
+
+ this.formatter = formatter;
+ elementStack.push(new RootElement(writer, formatter, encoding, version));
+ }
+
+ public StaxWriter<N> writeAttribute(String name, String value)
+ {
+ if (name == null) throw new IllegalArgumentException("name cannot be null");
+ if (value == null) throw new IllegalArgumentException("value cannot be null");
+
+ Element current = elementStack.peek();
+ current.writeAttribute(name, value);
+ return this;
+ }
+
+ public StaxWriter<N> writeAttribute(QName name, String value)
+ {
+ if (name == null) throw new IllegalArgumentException("name cannot be null");
+
+ Element current = elementStack.peek();
+ current.writeAttribute(name, value);
+ return this;
+ }
+
+ public StaxWriter<N> writeStartElement(N element) throws StaxNavException
+ {
+ Element current = elementStack.peek();
+ if (current instanceof RootElement)
+ {
+ if (((RootElement) current).started)
+ {
+ current = new StreamElement(writer, formatter);
+ elementStack.push(current);
+ }
+ }
+ else
+ {
+ current = new StreamElement(writer, formatter);
+ elementStack.push(current);
+ }
+
+ current.writeStartElement(naming, element);
+ return this;
+ }
+
+ public StaxWriter<N> writeEndElement() throws StaxNavException
+ {
+ if (elementStack.isEmpty()) throw new StaxNavException(null, "No matching startElement was found for this endElement");
+
+ elementStack.pop().end();
+
+ return this;
+ }
+
+ public StaxWriter<N> writeContent(String content) throws StaxNavException
+ {
+ return writeContent(WritableValueTypes.STRING, content);
+ }
+
+ public <V> StaxWriter<N> writeContent(WritableValueType<V> valueType, V content) throws StaxNavException
+ {
+ if (valueType == null) throw new IllegalArgumentException("valueType cannot be null.");
+ if (content == null) throw new IllegalArgumentException("content cannot be null.");
+
+ Element current = elementStack.peek();
+ current.writeContent(valueType.format(content));
+
+ return this;
+ }
+
+ public <V> StaxWriter<N> writeElement(N element, String content) throws StaxNavException
+ {
+ return writeElement(element, WritableValueTypes.STRING, content);
+ }
+
+ public <V> StaxWriter<N> writeElement(N element, WritableValueType<V> valueType, V content) throws StaxNavException
+ {
+ writeStartElement(element).writeContent(valueType, content).writeEndElement();
+ return this;
+ }
+
+ public StaxWriter<N> writeNamespace(String prefix, String uri) throws StaxNavException
+ {
+ Element current = elementStack.peek();
+ current.writeNamespace(prefix, uri);
+ return this;
+ }
+
+ public StaxWriter<N> writeDefaultNamespace(String uri) throws StaxNavException
+ {
+ Element current = elementStack.peek();
+ current.writeDefaultNamespace(uri);
+ return this;
+ }
+
+ public StaxWriter<N> writeComment(final String comment) throws StaxNavException
+ {
+ Element current = elementStack.peek();
+ current.writeComment(comment);
+ return this;
+ }
+
+ public StaxWriter<N> writeCData(String cdata) throws StaxNavException
+ {
+ Element current = elementStack.peek();
+ current.writeCData(cdata);
+ return this;
+ }
+
+ public void finish() throws StaxNavException
+ {
+ while (!elementStack.isEmpty())
+ {
+ elementStack.pop().end();
+ }
+ }
+
+ private static abstract class Element
+ {
+ abstract void writeAttribute(String name, String value) throws StaxNavException;
+
+ abstract <N> void writeAttribute(QName name, String value) throws StaxNavException;
+
+ abstract <N> void writeStartElement(Naming<N> naming, N name) throws StaxNavException;
+
+ abstract void writeContent(String content) throws StaxNavException;
+
+ abstract void writeNamespace(String prefix, String uri) throws StaxNavException;
+
+ abstract void writeDefaultNamespace(String uri) throws StaxNavException;
+
+ abstract void writeComment(String comment) throws StaxNavException;
+
+ abstract void writeCData(String cdata) throws StaxNavException;
+
+ abstract void end();
+
+ XMLStreamWriter writer;
+ XmlStreamingFormatter formatter;
+ private List<StreamClosure> closures;
+
+ Element(XMLStreamWriter writer, XmlStreamingFormatter formatter)
+ {
+ this(writer, formatter, null);
+ }
+
+ Element(XMLStreamWriter writer, XmlStreamingFormatter formatter, List<StreamClosure> closures)
+ {
+ this.writer = writer;
+ this.formatter = formatter;
+ this.closures = closures;
+ }
+
+ void apply(int event, StreamClosure closure) throws StaxNavException
+ {
+ try
+ {
+ formatter.before(writer, event);
+ closure.execute(writer);
+ formatter.after(writer, event);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(e);
+ }
+ }
+ }
+
+ private static class RootElement extends Element
+ {
+ private String encoding;
+ private String version;
+ private Element element;
+ private boolean started;
+
+ RootElement(XMLStreamWriter writer, XmlStreamingFormatter formatter, String encoding, String version)
+ {
+ super(writer, formatter);
+ this.encoding = encoding;
+ this.version = version;
+ }
+
+ public void writeAttribute(String name, String value) throws StaxNavException
+ {
+ get().writeAttribute(name, value);
+ }
+
+ public <N> void writeAttribute(QName name, String value) throws StaxNavException
+ {
+ get().writeAttribute(name, value);
+ }
+
+ public <N> void writeStartElement(Naming<N> naming, N name) throws StaxNavException
+ {
+ get().writeStartElement(naming, name);
+ started = true;
+ }
+
+ public void writeContent(String content) throws StaxNavException
+ {
+ get().writeContent(content);
+ }
+
+ public void writeNamespace(String prefix, String uri) throws StaxNavException
+ {
+ get().writeNamespace(prefix, uri);
+ }
+
+ public void writeDefaultNamespace(String uri) throws StaxNavException
+ {
+ get().writeDefaultNamespace(uri);
+ }
+
+ public void writeComment(String comment) throws StaxNavException
+ {
+ get().writeComment(comment);
+ }
+
+ public void writeCData(String cdata) throws StaxNavException
+ {
+ get().writeCData(cdata);
+ }
+
+ public void end()
+ {
+ if (started)
+ {
+ get().end();
+ }
+ endDocument();
+ }
+
+ private Element get()
+ {
+ if (element == null)
+ {
+ startDocument();
+ element = new StreamElement(writer, formatter);
+ }
+ return element;
+ }
+
+ private void startDocument() throws StaxNavException
+ {
+ apply(START_DOCUMENT, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ if (encoding == null && version == null)
+ {
+ writer.writeStartDocument();
+ }
+ else if (encoding == null)
+ {
+ writer.writeStartDocument(version);
+ }
+ else
+ {
+ writer.writeStartDocument(encoding, version);
+ }
+ }
+ });
+ }
+
+ private void endDocument() throws StaxNavException
+ {
+ try
+ {
+ apply(END_DOCUMENT, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ writer.writeEndDocument();
+ }
+ });
+
+ writer.flush();
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(e);
+ }
+ finally
+ {
+ try
+ {
+ writer.close();
+ }
+ catch (XMLStreamException e)
+ {
+ }
+ }
+ }
+ }
+
+ private static class StreamElement extends Element
+ {
+ StreamElement(XMLStreamWriter writer, XmlStreamingFormatter formatter)
+ {
+ super(writer, formatter);
+ }
+
+ public void writeAttribute(final String name, final String value) throws StaxNavException
+ {
+ apply(ATTRIBUTE, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ writer.writeAttribute(name, value);
+ }
+ });
+ }
+
+ public <N> void writeAttribute(QName name, final String value) throws StaxNavException
+ {
+ final String prefix = name.getPrefix();
+ final String uri = name.getNamespaceURI();
+ final String localPart = name.getLocalPart();
+
+ apply(ATTRIBUTE, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ if (uri == null || XMLConstants.NULL_NS_URI.equals(uri))
+ {
+ writer.writeAttribute(localPart, value);
+ }
+ else if (prefix == null || XMLConstants.DEFAULT_NS_PREFIX.equals(prefix))
+ {
+ writer.writeAttribute(uri, localPart, value);
+ }
+ else
+ {
+ writer.writeAttribute(prefix, uri, localPart, value);
+ }
+ }
+ });
+ }
+
+ public <N> void writeStartElement(Naming<N> naming, N name) throws StaxNavException
+ {
+ final String prefix = naming.getPrefix(name);
+ final String uri = naming.getURI(name);
+ final String localPart = naming.getLocalPart(name);
+
+ apply(START_ELEMENT, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ if (uri == null || XMLConstants.NULL_NS_URI.equals(uri))
+ {
+ writer.writeStartElement(localPart);
+ }
+ else if (prefix == null || XMLConstants.DEFAULT_NS_PREFIX.equals(prefix))
+ {
+ writer.writeStartElement(uri, localPart);
+ }
+ else
+ {
+ writer.writeStartElement(prefix, localPart, uri);
+ }
+ }
+ });
+ }
+
+ public void writeContent(final String content) throws StaxNavException
+ {
+ apply(CHARACTERS, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ writer.writeCharacters(content);
+ }
+ });
+ }
+
+ public void writeNamespace(final String prefix, final String uri) throws StaxNavException
+ {
+ apply(NAMESPACE, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ writer.writeNamespace(prefix, uri);
+ }
+ });
+ }
+
+ public void writeDefaultNamespace(final String uri) throws StaxNavException
+ {
+ apply(NAMESPACE, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ writer.writeDefaultNamespace(uri);
+ }
+ });
+ }
+
+ public void writeComment(final String comment) throws StaxNavException
+ {
+ apply(COMMENT, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ writer.writeComment(comment);
+ }
+ });
+ }
+
+ public void writeCData(final String cdata) throws StaxNavException
+ {
+ apply(CDATA, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ writer.writeCData(cdata);
+ }
+ });
+ }
+
+ public void end()
+ {
+ apply(END_ELEMENT, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ writer.writeEndElement();
+ }
+ });
+ }
+ }
+
+ private static interface StreamClosure
+ {
+ void execute(XMLStreamWriter writer) throws XMLStreamException;
+ }
+}
Deleted: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,199 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax.writer;
-
-import org.gatein.common.xml.stax.writer.builder.StaxFormatterBuilder;
-import org.gatein.common.xml.stax.writer.builder.StaxFormatterBuilderImpl;
-import org.gatein.common.xml.stax.writer.builder.StaxWriterBuilder;
-import org.gatein.common.xml.stax.writer.builder.StaxWriterBuilderImpl;
-import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
-import org.staxnav.EnumElement;
-import org.staxnav.Naming;
-import org.staxnav.StaxNavException;
-
-import javax.xml.namespace.QName;
-import java.io.OutputStream;
-import java.io.Writer;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class StaxWriterUtils
-{
- public static <N> StaxWriter<N> createWriter(Naming<N> naming, OutputStream outputStream) throws StaxNavException
- {
- return buildDefaultWriter(outputStream).build(naming);
- }
-
- public static StaxWriter<String> createWriter(OutputStream outputStream) throws StaxNavException
- {
- return createWriter(new Naming.Local(), outputStream);
- }
-
- public static StaxWriter<QName> createQualifiedWriter(OutputStream outputStream) throws StaxNavException
- {
- return createWriter(new Naming.Qualified(), outputStream);
- }
-
- public static <E extends Enum<E> & EnumElement<E>> StaxWriter<E> createWriter(Class<E> enumeratedClass,
- OutputStream outputStream) throws StaxNavException
- {
- Naming<E> naming;
- if (EnumElement.class.isAssignableFrom(enumeratedClass))
- {
- naming = new Naming.Enumerated.Mapped<E>(enumeratedClass, null);
- }
- else
- {
- naming = new Naming.Enumerated.Simple<E>(enumeratedClass, null);
- }
-
- return createWriter(naming, outputStream);
- }
-
- public static <N> StaxWriter<N> createWriter(Naming<N> naming, Writer writer) throws StaxNavException
- {
- return buildDefaultWriter().withWriter(writer).build(naming);
- }
-
- public static StaxWriter<String> createWriter(Writer writer) throws StaxNavException
- {
- return createWriter(new Naming.Local(), writer);
- }
-
- public static StaxWriter<QName> createQualifiedWriter(Writer writer) throws StaxNavException
- {
- return createWriter(new Naming.Qualified(), writer);
- }
-
- public static <E extends Enum<E> & EnumElement<E>> StaxWriter<E> createWriter(Class<E> enumeratedClass,
- Writer writer) throws StaxNavException
- {
- Naming<E> naming;
- if (EnumElement.class.isAssignableFrom(enumeratedClass))
- {
- naming = new Naming.Enumerated.Mapped<E>(enumeratedClass, null);
- }
- else
- {
- naming = new Naming.Enumerated.Simple<E>(enumeratedClass, null);
- }
-
- return createWriter(naming, writer);
- }
-
- public static StaxWriterBuilder buildWriter()
- {
- return new StaxWriterBuilderImpl();
- }
-
- public static XmlStreamingFormatter createFormatter()
- {
- return buildFormatter().withNewline(DEFAULT_NEWLINE)
- .ofIndentSize(DEFAULT_INDENT_SIZE).withIndentCharacter(DEFAULT_INDENT_CHAR)
- .build();
- }
-
- public static XmlStreamingFormatter createFormatter(int indentSize)
- {
- return buildFormatter().withNewline(DEFAULT_NEWLINE)
- .ofIndentSize(indentSize).withIndentCharacter(DEFAULT_INDENT_CHAR)
- .build();
- }
-
- public static StaxFormatterBuilder buildFormatter()
- {
- return new StaxFormatterBuilderImpl();
- }
-
- public static <N> void writeOptionalElement(StaxWriter<N> writer, N element, String content)
- {
- if (content == null) return;
-
- writer.writeElement(element, content);
- }
-
- public static <N, V> void writeOptionalElement(StaxWriter<N> writer, N element, WritableValueType<V> valueType, V value)
- {
- if (value == null) return;
-
- writer.writeElement(element, valueType, value);
- }
-
- public static <N> void writeOptionalContent(StaxWriter<N> writer, N element, String content)
- {
- writer.writeStartElement(element);
- if (content != null)
- {
- writer.writeContent(content);
- }
- writer.writeEndElement();
- }
-
- public static <N, V> void writeOptionalContent(StaxWriter<N> writer, N element, WritableValueType<V> valueType, V value)
- {
- writer.writeStartElement(element);
- if (value != null)
- {
- writer.writeContent(valueType, value);
- }
- writer.writeEndElement();
- }
-
- private static StaxWriterBuilder buildDefaultWriter()
- {
- return buildWriter().withEncoding("UTF-8").withVersion("1.0")
- .withPropertyIfSupported("com.ctc.wstx.outputEscapeCr", Boolean.FALSE)
- .withFormatting(createFormatter());
- }
-
- private static StaxWriterBuilder buildDefaultWriter(OutputStream outputStream)
- {
- return buildWriter().withEncoding("UTF-8").withVersion("1.0")
- .withPropertyIfSupported("com.ctc.wstx.outputEscapeCr", Boolean.FALSE)
- .withFormatting(createFormatter())
- .withOutputStream(outputStream, "UTF-8");
- }
-
- private static final int DEFAULT_INDENT_SIZE = 3;
- private static final char DEFAULT_INDENT_CHAR = ' ';
- private static final String DEFAULT_NEWLINE;
-
- static
- {
- String newline = null;
- try
- {
- newline = System.getProperty("line.separator");
- }
- catch (Throwable ignored)
- {
- }
- if (newline == null) newline = "\n";
-
- DEFAULT_NEWLINE = newline;
- }
-
- private StaxWriterUtils(){}
-}
Copied: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java (from rev 6958, portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java)
===================================================================
--- portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,199 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer;
+
+import org.gatein.common.xml.stax.writer.builder.StaxFormatterBuilder;
+import org.gatein.common.xml.stax.writer.builder.StaxFormatterBuilderImpl;
+import org.gatein.common.xml.stax.writer.builder.StaxWriterBuilder;
+import org.gatein.common.xml.stax.writer.builder.StaxWriterBuilderImpl;
+import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
+import org.staxnav.EnumElement;
+import org.staxnav.Naming;
+import org.staxnav.StaxNavException;
+
+import javax.xml.namespace.QName;
+import java.io.OutputStream;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class StaxWriterUtils
+{
+ public static <N> StaxWriter<N> createWriter(Naming<N> naming, OutputStream outputStream) throws StaxNavException
+ {
+ return buildDefaultWriter(outputStream).build(naming);
+ }
+
+ public static StaxWriter<String> createWriter(OutputStream outputStream) throws StaxNavException
+ {
+ return createWriter(new Naming.Local(), outputStream);
+ }
+
+ public static StaxWriter<QName> createQualifiedWriter(OutputStream outputStream) throws StaxNavException
+ {
+ return createWriter(new Naming.Qualified(), outputStream);
+ }
+
+ public static <E extends Enum<E> & EnumElement<E>> StaxWriter<E> createWriter(Class<E> enumeratedClass,
+ OutputStream outputStream) throws StaxNavException
+ {
+ Naming<E> naming;
+ if (EnumElement.class.isAssignableFrom(enumeratedClass))
+ {
+ naming = new Naming.Enumerated.Mapped<E>(enumeratedClass, null);
+ }
+ else
+ {
+ naming = new Naming.Enumerated.Simple<E>(enumeratedClass, null);
+ }
+
+ return createWriter(naming, outputStream);
+ }
+
+ public static <N> StaxWriter<N> createWriter(Naming<N> naming, Writer writer) throws StaxNavException
+ {
+ return buildDefaultWriter().withWriter(writer).build(naming);
+ }
+
+ public static StaxWriter<String> createWriter(Writer writer) throws StaxNavException
+ {
+ return createWriter(new Naming.Local(), writer);
+ }
+
+ public static StaxWriter<QName> createQualifiedWriter(Writer writer) throws StaxNavException
+ {
+ return createWriter(new Naming.Qualified(), writer);
+ }
+
+ public static <E extends Enum<E> & EnumElement<E>> StaxWriter<E> createWriter(Class<E> enumeratedClass,
+ Writer writer) throws StaxNavException
+ {
+ Naming<E> naming;
+ if (EnumElement.class.isAssignableFrom(enumeratedClass))
+ {
+ naming = new Naming.Enumerated.Mapped<E>(enumeratedClass, null);
+ }
+ else
+ {
+ naming = new Naming.Enumerated.Simple<E>(enumeratedClass, null);
+ }
+
+ return createWriter(naming, writer);
+ }
+
+ public static StaxWriterBuilder buildWriter()
+ {
+ return new StaxWriterBuilderImpl();
+ }
+
+ public static XmlStreamingFormatter createFormatter()
+ {
+ return buildFormatter().withNewline(DEFAULT_NEWLINE)
+ .ofIndentSize(DEFAULT_INDENT_SIZE).withIndentCharacter(DEFAULT_INDENT_CHAR)
+ .build();
+ }
+
+ public static XmlStreamingFormatter createFormatter(int indentSize)
+ {
+ return buildFormatter().withNewline(DEFAULT_NEWLINE)
+ .ofIndentSize(indentSize).withIndentCharacter(DEFAULT_INDENT_CHAR)
+ .build();
+ }
+
+ public static StaxFormatterBuilder buildFormatter()
+ {
+ return new StaxFormatterBuilderImpl();
+ }
+
+ public static <N> void writeOptionalElement(StaxWriter<N> writer, N element, String content)
+ {
+ if (content == null) return;
+
+ writer.writeElement(element, content);
+ }
+
+ public static <N, V> void writeOptionalElement(StaxWriter<N> writer, N element, WritableValueType<V> valueType, V value)
+ {
+ if (value == null) return;
+
+ writer.writeElement(element, valueType, value);
+ }
+
+ public static <N> void writeOptionalContent(StaxWriter<N> writer, N element, String content)
+ {
+ writer.writeStartElement(element);
+ if (content != null)
+ {
+ writer.writeContent(content);
+ }
+ writer.writeEndElement();
+ }
+
+ public static <N, V> void writeOptionalContent(StaxWriter<N> writer, N element, WritableValueType<V> valueType, V value)
+ {
+ writer.writeStartElement(element);
+ if (value != null)
+ {
+ writer.writeContent(valueType, value);
+ }
+ writer.writeEndElement();
+ }
+
+ private static StaxWriterBuilder buildDefaultWriter()
+ {
+ return buildWriter().withEncoding("UTF-8").withVersion("1.0")
+ .withPropertyIfSupported("com.ctc.wstx.outputEscapeCr", Boolean.FALSE)
+ .withFormatting(createFormatter());
+ }
+
+ private static StaxWriterBuilder buildDefaultWriter(OutputStream outputStream)
+ {
+ return buildWriter().withEncoding("UTF-8").withVersion("1.0")
+ .withPropertyIfSupported("com.ctc.wstx.outputEscapeCr", Boolean.FALSE)
+ .withFormatting(createFormatter())
+ .withOutputStream(outputStream, "UTF-8");
+ }
+
+ private static final int DEFAULT_INDENT_SIZE = 3;
+ private static final char DEFAULT_INDENT_CHAR = ' ';
+ private static final String DEFAULT_NEWLINE;
+
+ static
+ {
+ String newline = null;
+ try
+ {
+ newline = System.getProperty("line.separator");
+ }
+ catch (Throwable ignored)
+ {
+ }
+ if (newline == null) newline = "\n";
+
+ DEFAULT_NEWLINE = newline;
+ }
+
+ private StaxWriterUtils(){}
+}
Deleted: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueType.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueType.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueType.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax.writer;
-
-import org.staxnav.StaxNavException;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public interface WritableValueType<V>
-{
- String format(V value) throws StaxNavException;
-}
Copied: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueType.java (from rev 6958, portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueType.java)
===================================================================
--- portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueType.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueType.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer;
+
+import org.staxnav.StaxNavException;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public interface WritableValueType<V>
+{
+ String format(V value) throws StaxNavException;
+}
Deleted: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueTypes.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueTypes.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueTypes.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,115 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax.writer;
-
-import org.staxnav.StaxNavException;
-
-import javax.xml.bind.DatatypeConverter;
-import java.util.Calendar;
-import java.util.Date;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public abstract class WritableValueTypes
-{
- /**
- * Returns a value type for an enum class.
- *
- * @param <E> the enum parameter type
- * @return the corresponding value type
- */
- public static <E extends Enum<E>> WritableValueType<E> getEnumType()
- {
- return new EnumType<E>();
- }
-
- public static final WritableValueType<String> STRING = new WritableValueType<String>()
- {
- @Override
- public String format(String value) throws StaxNavException
- {
- return value;
- }
- };
-
- public static final WritableValueType<String> TRIMMED_STRING = new WritableValueType<String>()
- {
- @Override
- public String format(String value) throws StaxNavException
- {
- return value.trim();
- }
- };
-
- public static final WritableValueType<Boolean> BOOLEAN = new WritableValueType<Boolean>()
- {
- @Override
- public String format(Boolean value) throws StaxNavException
- {
- return value.toString();
- }
- };
-
- public static final WritableValueType<Integer> INTEGER = new WritableValueType<Integer>()
- {
- @Override
- public String format(Integer value) throws StaxNavException
- {
- return value.toString();
- }
- };
-
- public static final WritableValueType<Date> DATE = new WritableValueType<Date>()
- {
- @Override
- public String format(Date value) throws StaxNavException
- {
- Calendar cal = Calendar.getInstance();
- cal.setTime(value);
- return DatatypeConverter.printDate(cal);
- }
- };
-
- public static final WritableValueType<Date> DATE_TIME = new WritableValueType<Date>()
- {
-
- @Override
- public String format(Date value) throws StaxNavException
- {
- Calendar cal = Calendar.getInstance();
- cal.setTime(value);
- return DatatypeConverter.printDateTime(cal);
- }
- };
-
- protected static class EnumType<E extends Enum<E>> implements WritableValueType<E>
- {
- @Override
- public String format(E value) throws StaxNavException
- {
- return value.name();
- }
- }
-}
Copied: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueTypes.java (from rev 6958, portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueTypes.java)
===================================================================
--- portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueTypes.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueTypes.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer;
+
+import org.staxnav.StaxNavException;
+
+import javax.xml.bind.DatatypeConverter;
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public abstract class WritableValueTypes
+{
+ /**
+ * Returns a value type for an enum class.
+ *
+ * @param <E> the enum parameter type
+ * @return the corresponding value type
+ */
+ public static <E extends Enum<E>> WritableValueType<E> getEnumType()
+ {
+ return new EnumType<E>();
+ }
+
+ public static final WritableValueType<String> STRING = new WritableValueType<String>()
+ {
+ @Override
+ public String format(String value) throws StaxNavException
+ {
+ return value;
+ }
+ };
+
+ public static final WritableValueType<String> TRIMMED_STRING = new WritableValueType<String>()
+ {
+ @Override
+ public String format(String value) throws StaxNavException
+ {
+ return value.trim();
+ }
+ };
+
+ public static final WritableValueType<Boolean> BOOLEAN = new WritableValueType<Boolean>()
+ {
+ @Override
+ public String format(Boolean value) throws StaxNavException
+ {
+ return value.toString();
+ }
+ };
+
+ public static final WritableValueType<Integer> INTEGER = new WritableValueType<Integer>()
+ {
+ @Override
+ public String format(Integer value) throws StaxNavException
+ {
+ return value.toString();
+ }
+ };
+
+ public static final WritableValueType<Date> DATE = new WritableValueType<Date>()
+ {
+ @Override
+ public String format(Date value) throws StaxNavException
+ {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(value);
+ return DatatypeConverter.printDate(cal);
+ }
+ };
+
+ public static final WritableValueType<Date> DATE_TIME = new WritableValueType<Date>()
+ {
+
+ @Override
+ public String format(Date value) throws StaxNavException
+ {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(value);
+ return DatatypeConverter.printDateTime(cal);
+ }
+ };
+
+ protected static class EnumType<E extends Enum<E>> implements WritableValueType<E>
+ {
+ @Override
+ public String format(E value) throws StaxNavException
+ {
+ return value.name();
+ }
+ }
+}
Deleted: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilder.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilder.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilder.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax.writer.builder;
-
-
-import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public interface StaxFormatterBuilder
-{
- StaxFormatterBuilder withIndentCharacter(char indentCharacter);
-
- StaxFormatterBuilder ofIndentSize(int indentSize);
-
- StaxFormatterBuilder withNewline(String newline);
-
- XmlStreamingFormatter build() throws IllegalStateException;
-}
Copied: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilder.java (from rev 6958, portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilder.java)
===================================================================
--- portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilder.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilder.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer.builder;
+
+
+import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public interface StaxFormatterBuilder
+{
+ StaxFormatterBuilder withIndentCharacter(char indentCharacter);
+
+ StaxFormatterBuilder ofIndentSize(int indentSize);
+
+ StaxFormatterBuilder withNewline(String newline);
+
+ XmlStreamingFormatter build() throws IllegalStateException;
+}
Deleted: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilderImpl.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilderImpl.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilderImpl.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax.writer.builder;
-
-
-import org.gatein.common.xml.stax.writer.formatting.SimpleFormatter;
-import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class StaxFormatterBuilderImpl implements StaxFormatterBuilder
-{
- private Character indentCharacter;
- private Integer indentSize;
- private String newline;
-
- public StaxFormatterBuilder withIndentCharacter(char indentCharacter)
- {
- this.indentCharacter = indentCharacter;
- return this;
- }
-
- public StaxFormatterBuilder ofIndentSize(int indentSize)
- {
- this.indentSize = indentSize;
- return this;
- }
-
- public StaxFormatterBuilder withNewline(String newline)
- {
- this.newline = newline;
- return this;
- }
-
- public XmlStreamingFormatter build()
- {
- if (indentCharacter == null) throw new IllegalStateException("indent character is required value for this builder.");
- if (indentSize == null) throw new IllegalArgumentException("indent size is a required value for this builder.");
- if (newline == null) throw new IllegalArgumentException("newline is a required value for this builder.");
-
- return new SimpleFormatter(indentCharacter, indentSize, newline);
- }
-}
Copied: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilderImpl.java (from rev 6958, portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilderImpl.java)
===================================================================
--- portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilderImpl.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilderImpl.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer.builder;
+
+
+import org.gatein.common.xml.stax.writer.formatting.SimpleFormatter;
+import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class StaxFormatterBuilderImpl implements StaxFormatterBuilder
+{
+ private Character indentCharacter;
+ private Integer indentSize;
+ private String newline;
+
+ public StaxFormatterBuilder withIndentCharacter(char indentCharacter)
+ {
+ this.indentCharacter = indentCharacter;
+ return this;
+ }
+
+ public StaxFormatterBuilder ofIndentSize(int indentSize)
+ {
+ this.indentSize = indentSize;
+ return this;
+ }
+
+ public StaxFormatterBuilder withNewline(String newline)
+ {
+ this.newline = newline;
+ return this;
+ }
+
+ public XmlStreamingFormatter build()
+ {
+ if (indentCharacter == null) throw new IllegalStateException("indent character is required value for this builder.");
+ if (indentSize == null) throw new IllegalArgumentException("indent size is a required value for this builder.");
+ if (newline == null) throw new IllegalArgumentException("newline is a required value for this builder.");
+
+ return new SimpleFormatter(indentCharacter, indentSize, newline);
+ }
+}
Deleted: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilder.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilder.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilder.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax.writer.builder;
-
-
-import org.gatein.common.xml.stax.writer.StaxWriter;
-import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
-import org.staxnav.Naming;
-import org.staxnav.StaxNavException;
-
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.transform.Result;
-import java.io.OutputStream;
-import java.io.Writer;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public interface StaxWriterBuilder
-{
- StaxWriterBuilder withProperty(String name, Object value);
-
- StaxWriterBuilder withPropertyIfSupported(String name, Object value);
-
- StaxWriterBuilder withEncoding(String encoding);
-
- StaxWriterBuilder withVersion(String version);
-
- StaxWriterBuilder withFormatting(XmlStreamingFormatter formatter);
-
- StaxWriterBuilder withOutputStream(OutputStream outputStream);
-
- StaxWriterBuilder withOutputStream(OutputStream outputStream, String encoding);
-
- StaxWriterBuilder withWriter(Writer writer);
-
- StaxWriterBuilder withResult(Result result);
-
- StaxWriterBuilder withXmlStreamWriter(XMLStreamWriter writer);
-
- <N> StaxWriter<N> build(Naming<N> naming) throws StaxNavException, IllegalStateException;
-}
Copied: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilder.java (from rev 6958, portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilder.java)
===================================================================
--- portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilder.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilder.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer.builder;
+
+
+import org.gatein.common.xml.stax.writer.StaxWriter;
+import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
+import org.staxnav.Naming;
+import org.staxnav.StaxNavException;
+
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Result;
+import java.io.OutputStream;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public interface StaxWriterBuilder
+{
+ StaxWriterBuilder withProperty(String name, Object value);
+
+ StaxWriterBuilder withPropertyIfSupported(String name, Object value);
+
+ StaxWriterBuilder withEncoding(String encoding);
+
+ StaxWriterBuilder withVersion(String version);
+
+ StaxWriterBuilder withFormatting(XmlStreamingFormatter formatter);
+
+ StaxWriterBuilder withOutputStream(OutputStream outputStream);
+
+ StaxWriterBuilder withOutputStream(OutputStream outputStream, String encoding);
+
+ StaxWriterBuilder withWriter(Writer writer);
+
+ StaxWriterBuilder withResult(Result result);
+
+ StaxWriterBuilder withXmlStreamWriter(XMLStreamWriter writer);
+
+ <N> StaxWriter<N> build(Naming<N> naming) throws StaxNavException, IllegalStateException;
+}
Deleted: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,224 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax.writer.builder;
-
-import org.gatein.common.xml.stax.writer.StaxWriter;
-import org.gatein.common.xml.stax.writer.StaxWriterImpl;
-import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
-import org.staxnav.Naming;
-import org.staxnav.StaxNavException;
-
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.transform.Result;
-import java.io.OutputStream;
-import java.io.Writer;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class StaxWriterBuilderImpl implements StaxWriterBuilder
-{
- private XMLStreamWriter writer;
- private Object output;
- private String outputEncoding;
- private String version;
- private String encoding;
-
- private XmlStreamingFormatter formatter;
-
- private Map<String, Object> properties = new HashMap<String, Object>();
- private Map<String, Object> supportedProperties = new HashMap<String, Object>();
-
- public StaxWriterBuilder withProperty(String name, Object value)
- {
- if (name == null) throw new IllegalArgumentException("name is null");
- if (value == null) throw new IllegalArgumentException("value is null");
-
- properties.put(name, value);
- return this;
- }
-
- public StaxWriterBuilder withPropertyIfSupported(String name, Object value)
- {
- if (name == null) throw new IllegalArgumentException("name is null");
- if (value == null) throw new IllegalArgumentException("value is null");
-
- supportedProperties.put(name, value);
- return this;
- }
-
- public StaxWriterBuilder withOutputStream(OutputStream outputStream)
- {
- if (outputStream == null) throw new IllegalArgumentException("outputStream is null");
-
- output = outputStream;
- return this;
- }
-
- public StaxWriterBuilder withOutputStream(OutputStream outputStream, String encoding)
- {
- if (outputStream == null) throw new IllegalArgumentException("outputStream is null");
- if (encoding == null) throw new IllegalArgumentException("encoding is null");
-
- output = outputStream;
- outputEncoding = encoding;
- return this;
- }
-
- public StaxWriterBuilder withWriter(Writer writer)
- {
- if (writer == null) throw new IllegalArgumentException("writer is null");
-
- this.output = writer;
- return this;
- }
-
- public StaxWriterBuilder withResult(Result result)
- {
- if (result == null) throw new IllegalArgumentException("result is null");
-
- output = result;
- return this;
- }
-
- public StaxWriterBuilder withXmlStreamWriter(XMLStreamWriter writer)
- {
- if (writer == null) throw new IllegalArgumentException("writer is null");
-
- this.writer = writer;
- return this;
- }
-
- public StaxWriterBuilder withEncoding(String encoding)
- {
- if (encoding == null) throw new IllegalArgumentException("encoding is null");
-
- this.encoding = encoding;
- return this;
- }
-
- public StaxWriterBuilder withVersion(String version)
- {
- if (version == null) throw new IllegalArgumentException("version is null");
-
- this.version = version;
- return this;
- }
-
- public StaxWriterBuilder withFormatting(XmlStreamingFormatter formatter)
- {
- if (formatter == null) throw new IllegalArgumentException("formatter is null");
-
- this.formatter = formatter;
- return this;
- }
-
- public <N> StaxWriter<N> build(Naming<N> naming) throws StaxNavException, IllegalStateException
- {
- if (naming == null) throw new IllegalArgumentException("naming is null");
-
- if (writer == null && output == null)
- throw new IllegalStateException("Cannot build stax writer. Try calling withOutputStream/withWriter or pass in own XMLStreamWriter.");
-
- if (writer == null)
- {
- //TODO: Create solution to properly cache XMLOutputFactory
- XMLOutputFactory factory = XMLOutputFactory.newInstance();
-
- // Set properties
- for (Map.Entry<String, Object> entry : properties.entrySet())
- {
- factory.setProperty(entry.getKey(), entry.getValue());
- }
-
- // Set properties if supported
- for (Map.Entry<String, Object> entry : supportedProperties.entrySet())
- {
- String name = entry.getKey();
- if (factory.isPropertySupported(name))
- {
- factory.setProperty(name, entry.getValue());
- }
- }
-
- if (output instanceof OutputStream)
- {
- if (outputEncoding != null)
- {
- try
- {
- writer = factory.createXMLStreamWriter((OutputStream) output, outputEncoding);
- }
- catch (XMLStreamException e)
- {
- throw new StaxNavException(e);
- }
- }
- else
- {
- try
- {
- writer = factory.createXMLStreamWriter((OutputStream) output);
- }
- catch (XMLStreamException e)
- {
- throw new StaxNavException(null, "Exception creating XMLStreamWriter with OutputStream: " + output, e);
- }
- }
- }
- else if (output instanceof Writer)
- {
- try
- {
- writer = factory.createXMLStreamWriter((Writer) output);
- }
- catch (XMLStreamException e)
- {
- throw new StaxNavException(null, "Exception creating XMLStreamWriter with Writer: " + output, e);
- }
- }
- else if (output instanceof Result)
- {
- try
- {
- writer = factory.createXMLStreamWriter((Result) output);
- }
- catch (XMLStreamException e)
- {
- throw new StaxNavException(null, "Exception creating XMLStreamWriter with Result: " + output, e);
- }
- }
- else
- {
- throw new IllegalStateException("Unknown output: " + output); // should never happen...
- }
- }
-
- return new StaxWriterImpl<N>(naming, writer, formatter, encoding, version);
- }
-}
Copied: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java (from rev 6958, portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java)
===================================================================
--- portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,224 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer.builder;
+
+import org.gatein.common.xml.stax.writer.StaxWriter;
+import org.gatein.common.xml.stax.writer.StaxWriterImpl;
+import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
+import org.staxnav.Naming;
+import org.staxnav.StaxNavException;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Result;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class StaxWriterBuilderImpl implements StaxWriterBuilder
+{
+ private XMLStreamWriter writer;
+ private Object output;
+ private String outputEncoding;
+ private String version;
+ private String encoding;
+
+ private XmlStreamingFormatter formatter;
+
+ private Map<String, Object> properties = new HashMap<String, Object>();
+ private Map<String, Object> supportedProperties = new HashMap<String, Object>();
+
+ public StaxWriterBuilder withProperty(String name, Object value)
+ {
+ if (name == null) throw new IllegalArgumentException("name is null");
+ if (value == null) throw new IllegalArgumentException("value is null");
+
+ properties.put(name, value);
+ return this;
+ }
+
+ public StaxWriterBuilder withPropertyIfSupported(String name, Object value)
+ {
+ if (name == null) throw new IllegalArgumentException("name is null");
+ if (value == null) throw new IllegalArgumentException("value is null");
+
+ supportedProperties.put(name, value);
+ return this;
+ }
+
+ public StaxWriterBuilder withOutputStream(OutputStream outputStream)
+ {
+ if (outputStream == null) throw new IllegalArgumentException("outputStream is null");
+
+ output = outputStream;
+ return this;
+ }
+
+ public StaxWriterBuilder withOutputStream(OutputStream outputStream, String encoding)
+ {
+ if (outputStream == null) throw new IllegalArgumentException("outputStream is null");
+ if (encoding == null) throw new IllegalArgumentException("encoding is null");
+
+ output = outputStream;
+ outputEncoding = encoding;
+ return this;
+ }
+
+ public StaxWriterBuilder withWriter(Writer writer)
+ {
+ if (writer == null) throw new IllegalArgumentException("writer is null");
+
+ this.output = writer;
+ return this;
+ }
+
+ public StaxWriterBuilder withResult(Result result)
+ {
+ if (result == null) throw new IllegalArgumentException("result is null");
+
+ output = result;
+ return this;
+ }
+
+ public StaxWriterBuilder withXmlStreamWriter(XMLStreamWriter writer)
+ {
+ if (writer == null) throw new IllegalArgumentException("writer is null");
+
+ this.writer = writer;
+ return this;
+ }
+
+ public StaxWriterBuilder withEncoding(String encoding)
+ {
+ if (encoding == null) throw new IllegalArgumentException("encoding is null");
+
+ this.encoding = encoding;
+ return this;
+ }
+
+ public StaxWriterBuilder withVersion(String version)
+ {
+ if (version == null) throw new IllegalArgumentException("version is null");
+
+ this.version = version;
+ return this;
+ }
+
+ public StaxWriterBuilder withFormatting(XmlStreamingFormatter formatter)
+ {
+ if (formatter == null) throw new IllegalArgumentException("formatter is null");
+
+ this.formatter = formatter;
+ return this;
+ }
+
+ public <N> StaxWriter<N> build(Naming<N> naming) throws StaxNavException, IllegalStateException
+ {
+ if (naming == null) throw new IllegalArgumentException("naming is null");
+
+ if (writer == null && output == null)
+ throw new IllegalStateException("Cannot build stax writer. Try calling withOutputStream/withWriter or pass in own XMLStreamWriter.");
+
+ if (writer == null)
+ {
+ //TODO: Create solution to properly cache XMLOutputFactory
+ XMLOutputFactory factory = XMLOutputFactory.newInstance();
+
+ // Set properties
+ for (Map.Entry<String, Object> entry : properties.entrySet())
+ {
+ factory.setProperty(entry.getKey(), entry.getValue());
+ }
+
+ // Set properties if supported
+ for (Map.Entry<String, Object> entry : supportedProperties.entrySet())
+ {
+ String name = entry.getKey();
+ if (factory.isPropertySupported(name))
+ {
+ factory.setProperty(name, entry.getValue());
+ }
+ }
+
+ if (output instanceof OutputStream)
+ {
+ if (outputEncoding != null)
+ {
+ try
+ {
+ writer = factory.createXMLStreamWriter((OutputStream) output, outputEncoding);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(e);
+ }
+ }
+ else
+ {
+ try
+ {
+ writer = factory.createXMLStreamWriter((OutputStream) output);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(null, "Exception creating XMLStreamWriter with OutputStream: " + output, e);
+ }
+ }
+ }
+ else if (output instanceof Writer)
+ {
+ try
+ {
+ writer = factory.createXMLStreamWriter((Writer) output);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(null, "Exception creating XMLStreamWriter with Writer: " + output, e);
+ }
+ }
+ else if (output instanceof Result)
+ {
+ try
+ {
+ writer = factory.createXMLStreamWriter((Result) output);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(null, "Exception creating XMLStreamWriter with Result: " + output, e);
+ }
+ }
+ else
+ {
+ throw new IllegalStateException("Unknown output: " + output); // should never happen...
+ }
+ }
+
+ return new StaxWriterImpl<N>(naming, writer, formatter, encoding, version);
+ }
+}
Deleted: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/NoOpFormatter.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/NoOpFormatter.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/NoOpFormatter.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax.writer.formatting;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class NoOpFormatter implements XmlStreamingFormatter
-{
- @Override
- public void before(XMLStreamWriter writer, int event) throws XMLStreamException
- {
- // No-op
- }
-
- @Override
- public void after(XMLStreamWriter writer, int event) throws XMLStreamException
- {
- // No-op
- }
-}
Copied: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/NoOpFormatter.java (from rev 6958, portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/NoOpFormatter.java)
===================================================================
--- portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/NoOpFormatter.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/NoOpFormatter.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer.formatting;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class NoOpFormatter implements XmlStreamingFormatter
+{
+ @Override
+ public void before(XMLStreamWriter writer, int event) throws XMLStreamException
+ {
+ // No-op
+ }
+
+ @Override
+ public void after(XMLStreamWriter writer, int event) throws XMLStreamException
+ {
+ // No-op
+ }
+}
Deleted: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/SimpleFormatter.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/SimpleFormatter.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/SimpleFormatter.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,114 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax.writer.formatting;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class SimpleFormatter implements XmlStreamingFormatter
-{
-
- public static final int DEFAULT_INDENT_SIZE = 3;
- public static final char DEFAULT_INDENT_CHAR = ' ';
- public static final String DEFAULT_NEWLINE;
-
- static
- {
- String newline = null;
- try
- {
- newline = System.getProperty("line.separator");
- }
- catch (Throwable ignored)
- {
- }
- if (newline == null) newline = "\n";
-
- DEFAULT_NEWLINE = newline;
- }
-
- private String indentSequence;
- private String newline;
- private int depth = 0;
-
- private int previousEvent;
-
- public SimpleFormatter()
- {
- this(DEFAULT_INDENT_CHAR, DEFAULT_INDENT_SIZE, DEFAULT_NEWLINE);
- }
-
- public SimpleFormatter(char indentCharacter, int indentSize, String newline)
- {
- if (newline == null) throw new IllegalArgumentException("newline cannot be null");
- this.newline = newline;
-
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < indentSize; i++)
- {
- sb.append(indentCharacter);
- }
- indentSequence = sb.toString();
- }
-
- public void before(XMLStreamWriter writer, int event) throws XMLStreamException
- {
- switch (event)
- {
- case START_ELEMENT:
- depth++;
- nl(writer);
- indent(writer);
- break;
- case END_ELEMENT:
- if (previousEvent == END_ELEMENT)
- {
- nl(writer);
- indent(writer);
- }
- depth--;
- }
- }
-
- public void after(XMLStreamWriter writer, int event) throws XMLStreamException
- {
- previousEvent = event;
- }
-
- private void nl(XMLStreamWriter writer) throws XMLStreamException
- {
- writer.writeCharacters(newline);
- }
-
- private void indent(XMLStreamWriter writer) throws XMLStreamException
- {
- for (int i = 0; i < depth - 1; i++)
- {
- writer.writeCharacters(indentSequence);
- }
- }
-}
Copied: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/SimpleFormatter.java (from rev 6958, portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/SimpleFormatter.java)
===================================================================
--- portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/SimpleFormatter.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/SimpleFormatter.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer.formatting;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class SimpleFormatter implements XmlStreamingFormatter
+{
+
+ public static final int DEFAULT_INDENT_SIZE = 3;
+ public static final char DEFAULT_INDENT_CHAR = ' ';
+ public static final String DEFAULT_NEWLINE;
+
+ static
+ {
+ String newline = null;
+ try
+ {
+ newline = System.getProperty("line.separator");
+ }
+ catch (Throwable ignored)
+ {
+ }
+ if (newline == null) newline = "\n";
+
+ DEFAULT_NEWLINE = newline;
+ }
+
+ private String indentSequence;
+ private String newline;
+ private int depth = 0;
+
+ private int previousEvent;
+
+ public SimpleFormatter()
+ {
+ this(DEFAULT_INDENT_CHAR, DEFAULT_INDENT_SIZE, DEFAULT_NEWLINE);
+ }
+
+ public SimpleFormatter(char indentCharacter, int indentSize, String newline)
+ {
+ if (newline == null) throw new IllegalArgumentException("newline cannot be null");
+ this.newline = newline;
+
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < indentSize; i++)
+ {
+ sb.append(indentCharacter);
+ }
+ indentSequence = sb.toString();
+ }
+
+ public void before(XMLStreamWriter writer, int event) throws XMLStreamException
+ {
+ switch (event)
+ {
+ case START_ELEMENT:
+ depth++;
+ nl(writer);
+ indent(writer);
+ break;
+ case END_ELEMENT:
+ if (previousEvent == END_ELEMENT)
+ {
+ nl(writer);
+ indent(writer);
+ }
+ depth--;
+ }
+ }
+
+ public void after(XMLStreamWriter writer, int event) throws XMLStreamException
+ {
+ previousEvent = event;
+ }
+
+ private void nl(XMLStreamWriter writer) throws XMLStreamException
+ {
+ writer.writeCharacters(newline);
+ }
+
+ private void indent(XMLStreamWriter writer) throws XMLStreamException
+ {
+ for (int i = 0; i < depth - 1; i++)
+ {
+ writer.writeCharacters(indentSequence);
+ }
+ }
+}
Deleted: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/XmlStreamingFormatter.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/XmlStreamingFormatter.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/XmlStreamingFormatter.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax.writer.formatting;
-
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public interface XmlStreamingFormatter extends XMLStreamConstants
-{
- void before(XMLStreamWriter writer, int event) throws XMLStreamException;
-
- void after(XMLStreamWriter writer, int event) throws XMLStreamException;
-}
Copied: portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/XmlStreamingFormatter.java (from rev 6958, portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/XmlStreamingFormatter.java)
===================================================================
--- portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/XmlStreamingFormatter.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/XmlStreamingFormatter.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer.formatting;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public interface XmlStreamingFormatter extends XMLStreamConstants
+{
+ void before(XMLStreamWriter writer, int event) throws XMLStreamException;
+
+ void after(XMLStreamWriter writer, int event) throws XMLStreamException;
+}
Deleted: portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/AbstractStaxWriterTest.java
===================================================================
--- portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/AbstractStaxWriterTest.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/AbstractStaxWriterTest.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,357 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax;
-
-import junit.framework.TestCase;
-import org.gatein.common.xml.stax.writer.StaxWriter;
-import org.gatein.common.xml.stax.writer.StaxWriterImpl;
-import org.gatein.common.xml.stax.writer.WritableValueType;
-import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
-import org.mockito.InOrder;
-import org.staxnav.Naming;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamWriter;
-
-import static org.mockito.Mockito.*;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public abstract class AbstractStaxWriterTest<N> extends TestCase
-{
- static final String ENCODING = "UTF-8";
- static final String VERSION = "1.0";
-
- private Naming<N> naming;
- protected XMLStreamWriter stream;
- protected XmlStreamingFormatter formatter;
- protected StaxWriter<N> writer;
-
- public abstract Naming<N> getNaming();
-
- @Override
- public void setUp() throws Exception
- {
- naming = getNaming();
- formatter = mock(XmlStreamingFormatter.class);
- stream = mock(XMLStreamWriter.class);
- writer = new StaxWriterImpl<N>(naming, stream, formatter, ENCODING, VERSION);
- }
-
- protected N createName(String localPart)
- {
- return naming.getName(null, null, localPart);
- }
-
- public void testEncodingAndVersion() throws Exception
- {
- String encoding = "UTF-8";
- String version = "1.0";
- StaxWriter<N> writer = new StaxWriterImpl<N>(naming, stream, formatter, encoding, version);
- writer.writeElement(createName("foo"), "blah");
-
- verify(stream).writeStartDocument(encoding, version);
-
- reset(stream);
- encoding = "encoding";
- version = "version";
- writer = new StaxWriterImpl<N>(naming, stream, formatter, encoding, version);
- writer.writeElement(createName("foo"), "blah");
-
- verify(stream).writeStartDocument(encoding, version);
- }
-
- public void testEncoding() throws Exception
- {
- String encoding = "ISO-8859-1";
- StaxWriter<N> writer = new StaxWriterImpl<N>(naming, stream, formatter, encoding, null);
- writer.writeElement(createName("foo"), "blah");
-
- verify(stream).writeStartDocument(encoding, null);
- }
-
- public void testNoEncoding() throws Exception
- {
- StaxWriter<N> writer = new StaxWriterImpl<N>(naming, stream, formatter);
- writer.writeElement(createName("foo"), "blah");
-
- verify(stream).writeStartDocument();
- }
-
- public void testStartDocument() throws Exception
- {
- writer.writeStartElement(createName("foo"));
- writer.writeComment("some comment");
- writer.writeCData("some cdata < & ...");
-
- verify(stream, times(1)).writeStartDocument(ENCODING, VERSION);
-
- }
-
- public void testWriteStartElement() throws Exception
- {
- writer.writeStartElement(createName("foo"));
- verify(stream).writeStartElement("foo");
- }
-
- public void testWriteAttribute() throws Exception
- {
- writer.writeStartElement(createName("foo")).writeAttribute("name", "value");
-
- verify(stream).writeAttribute("name", "value");
- }
-
- public void testWriteQNameAttribute() throws Exception
- {
- writer.writeStartElement(createName("foo"))
- .writeAttribute(new QName("uri", "local", "pre"), "value")
- .writeAttribute(new QName("uri", "local"), "value");
-
- verify(stream).writeAttribute("pre", "uri", "local", "value");
- verify(stream).writeAttribute("uri", "local", "value");
- }
-
- public void testWriteElement() throws Exception
- {
- writer.writeElement(createName("foo"), "content");
-
- verify(stream).writeStartElement("foo");
- verify(stream).writeCharacters("content");
- verify(stream).writeEndElement();
- }
-
- public void testWriteContent() throws Exception
- {
-
- writer.writeStartElement(createName("foo")).writeContent("blah");
- verify(stream).writeCharacters("blah");
-
- WritableValueType<String> vt = new WritableValueType<String>()
- {
- @Override
- public String format(String value)
- {
- return "some value";
- }
- };
-
- writer.writeStartElement(createName("bar")).writeContent(vt, "content");
- verify(stream).writeCharacters("some value");
- }
-
- public void testWriteNullContent() throws Exception
- {
- try
- {
- writer.writeContent(null);
- fail("IllegalArgumentException expected to be thrown");
- }
- catch (IllegalArgumentException e){}
- }
-
- public void testNamespace() throws Exception
- {
- writer.writeStartElement(createName("foo")).writeNamespace("xsi", XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
-
- verify(stream).writeNamespace("xsi", XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
- }
-
- public void testDefaultNamespace() throws Exception
- {
- String namespace = "http://www.example.com/ns/mynamespace";
-
- writer.writeStartElement(createName("foo")).writeDefaultNamespace(namespace);
-
- verify(stream).writeDefaultNamespace(namespace);
- }
-
- public void testComment() throws Exception
- {
- writer.writeComment("Some comment");
- writer.writeStartElement(createName("foo"));
-
- verify(stream, times(1)).writeStartDocument(ENCODING, VERSION);
- verify(stream).writeComment("Some comment");
- }
-
- public void testCData() throws Exception
- {
- String cdata = "Some cdata stuff here < & \" ";
- writer.writeCData(cdata);
- writer.writeStartElement(createName("foo"));
-
- verify(stream).writeStartDocument(ENCODING, VERSION);
- verify(stream).writeCData(cdata);
- }
-
- public void testFinish() throws Exception
- {
- writer.writeStartElement(createName("foo")).finish();
-
- verify(stream).flush();
- verify(stream).close();
- }
-
- public void testFinishNoElements() throws Exception
- {
- writer.writeComment("comment");
- writer.finish();
- verify(stream).flush();
- verify(stream).close();
- }
-
- public void testEndElementOnFinish() throws Exception
- {
- writer.writeStartElement(createName("foo")).
- writeStartElement(createName("bar")).
- writeElement(createName("foobar"), "stuff");
-
- // Even though we never explicitly call endElement for the first two start elements, finish will do that for us.
- writer.finish();
-
- verify(stream).writeStartElement("foo");
- verify(stream).writeStartElement("bar");
- verify(stream).writeStartElement("foobar");
- verify(stream).writeCharacters("stuff");
- verify(stream, times(3)).writeEndElement();
- }
-
- public void testFormatter() throws Exception
- {
- InOrder order = inOrder(formatter, stream);
-
- // Start element
- writer.writeStartElement(createName("foo"));
- verifyFormatter(order, XMLStreamConstants.START_DOCUMENT, new VerifyClosure()
- {
- public void verify(InOrder order) throws Exception
- {
- // first start element also writes the document
- order.verify(stream).writeStartDocument(ENCODING, VERSION);
- }
- });
- verifyFormatter(order, XMLStreamConstants.START_ELEMENT, new VerifyClosure()
- {
- public void verify(InOrder order) throws Exception
- {
- order.verify(stream).writeStartElement("foo");
- }
- });
-
- // Namespace
- writer.writeNamespace("prefix", "uri");
- verifyFormatter(order, XMLStreamConstants.NAMESPACE, new VerifyClosure()
- {
- public void verify(InOrder order) throws Exception
- {
- order.verify(stream).writeNamespace("prefix", "uri");
- }
- });
-
- // Default namespace
- writer.writeDefaultNamespace("uri");
- verifyFormatter(order, XMLStreamConstants.NAMESPACE, new VerifyClosure()
- {
- public void verify(InOrder order) throws Exception
- {
- order.verify(stream).writeDefaultNamespace("uri");
- }
- });
-
- // Attribute
- writer.writeAttribute("name", "value");
- verifyFormatter(order, XMLStreamConstants.ATTRIBUTE, new VerifyClosure()
- {
- public void verify(InOrder order) throws Exception
- {
- order.verify(stream).writeAttribute("name", "value");
- }
- });
-
- // Comment
- writer.writeComment("comment");
- verifyFormatter(order, XMLStreamConstants.COMMENT, new VerifyClosure()
- {
- public void verify(InOrder order) throws Exception
- {
- order.verify(stream).writeComment("comment");
- }
- });
-
- // CData
- writer.writeCData("cdata");
- verifyFormatter(order, XMLStreamConstants.CDATA, new VerifyClosure()
- {
- public void verify(InOrder order) throws Exception
- {
- order.verify(stream).writeCData("cdata");
- }
- });
-
- // Content
- writer.writeContent("content");
- verifyFormatter(order, XMLStreamConstants.CHARACTERS, new VerifyClosure()
- {
- public void verify(InOrder order) throws Exception
- {
- order.verify(stream).writeCharacters("content");
- }
- });
-
- // End element
- writer.writeEndElement();
- verifyFormatter(order, XMLStreamConstants.END_ELEMENT, new VerifyClosure()
- {
- public void verify(InOrder order) throws Exception
- {
- order.verify(stream).writeEndElement();
- }
- });
-
- // End document
- writer.finish();
- verifyFormatter(order, XMLStreamConstants.END_DOCUMENT, new VerifyClosure()
- {
- public void verify(InOrder order) throws Exception
- {
- order.verify(stream).writeEndDocument();
- }
- });
- }
-
- protected void verifyFormatter(InOrder order, int event, VerifyClosure closure) throws Exception
- {
- order.verify(formatter).before(stream, event);
- closure.verify(order);
- order.verify(formatter).after(stream, event);
- }
-
- private static interface VerifyClosure
- {
- void verify(InOrder order) throws Exception;
- }
-}
Copied: portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/AbstractStaxWriterTest.java (from rev 6958, portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/AbstractStaxWriterTest.java)
===================================================================
--- portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/AbstractStaxWriterTest.java (rev 0)
+++ portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/AbstractStaxWriterTest.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,357 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax;
+
+import junit.framework.TestCase;
+import org.gatein.common.xml.stax.writer.StaxWriter;
+import org.gatein.common.xml.stax.writer.StaxWriterImpl;
+import org.gatein.common.xml.stax.writer.WritableValueType;
+import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
+import org.mockito.InOrder;
+import org.staxnav.Naming;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamWriter;
+
+import static org.mockito.Mockito.*;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public abstract class AbstractStaxWriterTest<N> extends TestCase
+{
+ static final String ENCODING = "UTF-8";
+ static final String VERSION = "1.0";
+
+ private Naming<N> naming;
+ protected XMLStreamWriter stream;
+ protected XmlStreamingFormatter formatter;
+ protected StaxWriter<N> writer;
+
+ public abstract Naming<N> getNaming();
+
+ @Override
+ public void setUp() throws Exception
+ {
+ naming = getNaming();
+ formatter = mock(XmlStreamingFormatter.class);
+ stream = mock(XMLStreamWriter.class);
+ writer = new StaxWriterImpl<N>(naming, stream, formatter, ENCODING, VERSION);
+ }
+
+ protected N createName(String localPart)
+ {
+ return naming.getName(null, null, localPart);
+ }
+
+ public void testEncodingAndVersion() throws Exception
+ {
+ String encoding = "UTF-8";
+ String version = "1.0";
+ StaxWriter<N> writer = new StaxWriterImpl<N>(naming, stream, formatter, encoding, version);
+ writer.writeElement(createName("foo"), "blah");
+
+ verify(stream).writeStartDocument(encoding, version);
+
+ reset(stream);
+ encoding = "encoding";
+ version = "version";
+ writer = new StaxWriterImpl<N>(naming, stream, formatter, encoding, version);
+ writer.writeElement(createName("foo"), "blah");
+
+ verify(stream).writeStartDocument(encoding, version);
+ }
+
+ public void testEncoding() throws Exception
+ {
+ String encoding = "ISO-8859-1";
+ StaxWriter<N> writer = new StaxWriterImpl<N>(naming, stream, formatter, encoding, null);
+ writer.writeElement(createName("foo"), "blah");
+
+ verify(stream).writeStartDocument(encoding, null);
+ }
+
+ public void testNoEncoding() throws Exception
+ {
+ StaxWriter<N> writer = new StaxWriterImpl<N>(naming, stream, formatter);
+ writer.writeElement(createName("foo"), "blah");
+
+ verify(stream).writeStartDocument();
+ }
+
+ public void testStartDocument() throws Exception
+ {
+ writer.writeStartElement(createName("foo"));
+ writer.writeComment("some comment");
+ writer.writeCData("some cdata < & ...");
+
+ verify(stream, times(1)).writeStartDocument(ENCODING, VERSION);
+
+ }
+
+ public void testWriteStartElement() throws Exception
+ {
+ writer.writeStartElement(createName("foo"));
+ verify(stream).writeStartElement("foo");
+ }
+
+ public void testWriteAttribute() throws Exception
+ {
+ writer.writeStartElement(createName("foo")).writeAttribute("name", "value");
+
+ verify(stream).writeAttribute("name", "value");
+ }
+
+ public void testWriteQNameAttribute() throws Exception
+ {
+ writer.writeStartElement(createName("foo"))
+ .writeAttribute(new QName("uri", "local", "pre"), "value")
+ .writeAttribute(new QName("uri", "local"), "value");
+
+ verify(stream).writeAttribute("pre", "uri", "local", "value");
+ verify(stream).writeAttribute("uri", "local", "value");
+ }
+
+ public void testWriteElement() throws Exception
+ {
+ writer.writeElement(createName("foo"), "content");
+
+ verify(stream).writeStartElement("foo");
+ verify(stream).writeCharacters("content");
+ verify(stream).writeEndElement();
+ }
+
+ public void testWriteContent() throws Exception
+ {
+
+ writer.writeStartElement(createName("foo")).writeContent("blah");
+ verify(stream).writeCharacters("blah");
+
+ WritableValueType<String> vt = new WritableValueType<String>()
+ {
+ @Override
+ public String format(String value)
+ {
+ return "some value";
+ }
+ };
+
+ writer.writeStartElement(createName("bar")).writeContent(vt, "content");
+ verify(stream).writeCharacters("some value");
+ }
+
+ public void testWriteNullContent() throws Exception
+ {
+ try
+ {
+ writer.writeContent(null);
+ fail("IllegalArgumentException expected to be thrown");
+ }
+ catch (IllegalArgumentException e){}
+ }
+
+ public void testNamespace() throws Exception
+ {
+ writer.writeStartElement(createName("foo")).writeNamespace("xsi", XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
+
+ verify(stream).writeNamespace("xsi", XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
+ }
+
+ public void testDefaultNamespace() throws Exception
+ {
+ String namespace = "http://www.example.com/ns/mynamespace";
+
+ writer.writeStartElement(createName("foo")).writeDefaultNamespace(namespace);
+
+ verify(stream).writeDefaultNamespace(namespace);
+ }
+
+ public void testComment() throws Exception
+ {
+ writer.writeComment("Some comment");
+ writer.writeStartElement(createName("foo"));
+
+ verify(stream, times(1)).writeStartDocument(ENCODING, VERSION);
+ verify(stream).writeComment("Some comment");
+ }
+
+ public void testCData() throws Exception
+ {
+ String cdata = "Some cdata stuff here < & \" ";
+ writer.writeCData(cdata);
+ writer.writeStartElement(createName("foo"));
+
+ verify(stream).writeStartDocument(ENCODING, VERSION);
+ verify(stream).writeCData(cdata);
+ }
+
+ public void testFinish() throws Exception
+ {
+ writer.writeStartElement(createName("foo")).finish();
+
+ verify(stream).flush();
+ verify(stream).close();
+ }
+
+ public void testFinishNoElements() throws Exception
+ {
+ writer.writeComment("comment");
+ writer.finish();
+ verify(stream).flush();
+ verify(stream).close();
+ }
+
+ public void testEndElementOnFinish() throws Exception
+ {
+ writer.writeStartElement(createName("foo")).
+ writeStartElement(createName("bar")).
+ writeElement(createName("foobar"), "stuff");
+
+ // Even though we never explicitly call endElement for the first two start elements, finish will do that for us.
+ writer.finish();
+
+ verify(stream).writeStartElement("foo");
+ verify(stream).writeStartElement("bar");
+ verify(stream).writeStartElement("foobar");
+ verify(stream).writeCharacters("stuff");
+ verify(stream, times(3)).writeEndElement();
+ }
+
+ public void testFormatter() throws Exception
+ {
+ InOrder order = inOrder(formatter, stream);
+
+ // Start element
+ writer.writeStartElement(createName("foo"));
+ verifyFormatter(order, XMLStreamConstants.START_DOCUMENT, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ // first start element also writes the document
+ order.verify(stream).writeStartDocument(ENCODING, VERSION);
+ }
+ });
+ verifyFormatter(order, XMLStreamConstants.START_ELEMENT, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ order.verify(stream).writeStartElement("foo");
+ }
+ });
+
+ // Namespace
+ writer.writeNamespace("prefix", "uri");
+ verifyFormatter(order, XMLStreamConstants.NAMESPACE, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ order.verify(stream).writeNamespace("prefix", "uri");
+ }
+ });
+
+ // Default namespace
+ writer.writeDefaultNamespace("uri");
+ verifyFormatter(order, XMLStreamConstants.NAMESPACE, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ order.verify(stream).writeDefaultNamespace("uri");
+ }
+ });
+
+ // Attribute
+ writer.writeAttribute("name", "value");
+ verifyFormatter(order, XMLStreamConstants.ATTRIBUTE, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ order.verify(stream).writeAttribute("name", "value");
+ }
+ });
+
+ // Comment
+ writer.writeComment("comment");
+ verifyFormatter(order, XMLStreamConstants.COMMENT, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ order.verify(stream).writeComment("comment");
+ }
+ });
+
+ // CData
+ writer.writeCData("cdata");
+ verifyFormatter(order, XMLStreamConstants.CDATA, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ order.verify(stream).writeCData("cdata");
+ }
+ });
+
+ // Content
+ writer.writeContent("content");
+ verifyFormatter(order, XMLStreamConstants.CHARACTERS, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ order.verify(stream).writeCharacters("content");
+ }
+ });
+
+ // End element
+ writer.writeEndElement();
+ verifyFormatter(order, XMLStreamConstants.END_ELEMENT, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ order.verify(stream).writeEndElement();
+ }
+ });
+
+ // End document
+ writer.finish();
+ verifyFormatter(order, XMLStreamConstants.END_DOCUMENT, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ order.verify(stream).writeEndDocument();
+ }
+ });
+ }
+
+ protected void verifyFormatter(InOrder order, int event, VerifyClosure closure) throws Exception
+ {
+ order.verify(formatter).before(stream, event);
+ closure.verify(order);
+ order.verify(formatter).after(stream, event);
+ }
+
+ private static interface VerifyClosure
+ {
+ void verify(InOrder order) throws Exception;
+ }
+}
Deleted: portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/LocalStaxWriterTest.java
===================================================================
--- portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/LocalStaxWriterTest.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/LocalStaxWriterTest.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax;
-
-import org.staxnav.Naming;
-
-public class LocalStaxWriterTest extends AbstractStaxWriterTest<String>
-{
- @Override
- public Naming<String> getNaming()
- {
- return new Naming.Local();
- }
-}
\ No newline at end of file
Copied: portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/LocalStaxWriterTest.java (from rev 6958, portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/LocalStaxWriterTest.java)
===================================================================
--- portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/LocalStaxWriterTest.java (rev 0)
+++ portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/LocalStaxWriterTest.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax;
+
+import org.staxnav.Naming;
+
+public class LocalStaxWriterTest extends AbstractStaxWriterTest<String>
+{
+ @Override
+ public Naming<String> getNaming()
+ {
+ return new Naming.Local();
+ }
+}
\ No newline at end of file
Deleted: portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/QualifiedStaxWriterTest.java
===================================================================
--- portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/QualifiedStaxWriterTest.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/QualifiedStaxWriterTest.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.common.xml.stax;
-
-import org.mockito.Mockito;
-import org.staxnav.Naming;
-
-import javax.xml.namespace.QName;
-
-public class QualifiedStaxWriterTest extends AbstractStaxWriterTest<QName>
-{
- @Override
- public Naming<QName> getNaming()
- {
- return new Naming.Qualified();
- }
-
- public void testWriteQualifiedStartElement() throws Exception
- {
- QName bar = new QName("uri", "pre", "bar");
-
- writer.writeStartElement(bar);
- Mockito.verify(stream).writeStartElement(bar.getPrefix(), bar.getLocalPart(), bar.getNamespaceURI());
-
- QName foobar = new QName("http://www.gatein.org/xml/ns/gatein_objects_1_0", "foobar");
- writer.writeStartElement(foobar);
- Mockito.verify(stream).writeStartElement(foobar.getNamespaceURI(), foobar.getLocalPart());
- }
-}
\ No newline at end of file
Copied: portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/QualifiedStaxWriterTest.java (from rev 6958, portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/QualifiedStaxWriterTest.java)
===================================================================
--- portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/QualifiedStaxWriterTest.java (rev 0)
+++ portal/trunk/component/common/src/test/java/org/gatein/common/xml/stax/QualifiedStaxWriterTest.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax;
+
+import org.mockito.Mockito;
+import org.staxnav.Naming;
+
+import javax.xml.namespace.QName;
+
+public class QualifiedStaxWriterTest extends AbstractStaxWriterTest<QName>
+{
+ @Override
+ public Naming<QName> getNaming()
+ {
+ return new Naming.Qualified();
+ }
+
+ public void testWriteQualifiedStartElement() throws Exception
+ {
+ QName bar = new QName("uri", "pre", "bar");
+
+ writer.writeStartElement(bar);
+ Mockito.verify(stream).writeStartElement(bar.getPrefix(), bar.getLocalPart(), bar.getNamespaceURI());
+
+ QName foobar = new QName("http://www.gatein.org/xml/ns/gatein_objects_1_0", "foobar");
+ writer.writeStartElement(foobar);
+ Mockito.verify(stream).writeStartElement(foobar.getNamespaceURI(), foobar.getLocalPart());
+ }
+}
\ No newline at end of file
Modified: portal/trunk/component/management/pom.xml
===================================================================
--- portal/trunk/component/management/pom.xml 2011-07-30 02:15:53 UTC (rev 6959)
+++ portal/trunk/component/management/pom.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -43,6 +43,13 @@
<groupId>org.exoplatform.ws</groupId>
<artifactId>exo.ws.rest.core</artifactId>
</dependency>
-
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-rest</artifactId>
+ </dependency>
</dependencies>
</project>
Deleted: portal/trunk/component/management/src/main/java/org/gatein/management/runtime/ManagementBootstrap.java
===================================================================
--- portal/branches/gatein-management/component/management/src/main/java/org/gatein/management/runtime/ManagementBootstrap.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/management/src/main/java/org/gatein/management/runtime/ManagementBootstrap.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,30 +0,0 @@
-package org.gatein.management.runtime;
-
-import org.gatein.management.api.ManagementService;
-import org.picocontainer.Startable;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class ManagementBootstrap implements Startable
-{
- private ManagementService service;
-
- public ManagementBootstrap(ManagementService service)
- {
- this.service = service;
- }
-
- @Override
- public void start()
- {
- service.load();
- }
-
- @Override
- public void stop()
- {
- service.unload();
- }
-}
Copied: portal/trunk/component/management/src/main/java/org/gatein/management/runtime/ManagementBootstrap.java (from rev 6958, portal/branches/gatein-management/component/management/src/main/java/org/gatein/management/runtime/ManagementBootstrap.java)
===================================================================
--- portal/trunk/component/management/src/main/java/org/gatein/management/runtime/ManagementBootstrap.java (rev 0)
+++ portal/trunk/component/management/src/main/java/org/gatein/management/runtime/ManagementBootstrap.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,30 @@
+package org.gatein.management.runtime;
+
+import org.gatein.management.api.ManagementService;
+import org.picocontainer.Startable;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class ManagementBootstrap implements Startable
+{
+ private ManagementService service;
+
+ public ManagementBootstrap(ManagementService service)
+ {
+ this.service = service;
+ }
+
+ @Override
+ public void start()
+ {
+ service.load();
+ }
+
+ @Override
+ public void stop()
+ {
+ service.unload();
+ }
+}
Deleted: portal/trunk/component/management/src/main/java/org/gatein/management/runtime/RuntimeContextImpl.java
===================================================================
--- portal/branches/gatein-management/component/management/src/main/java/org/gatein/management/runtime/RuntimeContextImpl.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/management/src/main/java/org/gatein/management/runtime/RuntimeContextImpl.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,17 +0,0 @@
-package org.gatein.management.runtime;
-
-import org.exoplatform.container.PortalContainer;
-import org.gatein.management.api.RuntimeContext;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class RuntimeContextImpl implements RuntimeContext
-{
- @Override
- public <T> T getRuntimeComponent(Class<T> componentClass)
- {
- return componentClass.cast(PortalContainer.getInstance().getComponentInstanceOfType(componentClass));
- }
-}
Copied: portal/trunk/component/management/src/main/java/org/gatein/management/runtime/RuntimeContextImpl.java (from rev 6958, portal/branches/gatein-management/component/management/src/main/java/org/gatein/management/runtime/RuntimeContextImpl.java)
===================================================================
--- portal/trunk/component/management/src/main/java/org/gatein/management/runtime/RuntimeContextImpl.java (rev 0)
+++ portal/trunk/component/management/src/main/java/org/gatein/management/runtime/RuntimeContextImpl.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,17 @@
+package org.gatein.management.runtime;
+
+import org.exoplatform.container.PortalContainer;
+import org.gatein.management.api.RuntimeContext;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class RuntimeContextImpl implements RuntimeContext
+{
+ @Override
+ public <T> T getRuntimeComponent(Class<T> componentClass)
+ {
+ return componentClass.cast(PortalContainer.getInstance().getComponentInstanceOfType(componentClass));
+ }
+}
Deleted: portal/trunk/component/management/src/main/resources/conf/portal/configuration.xml
===================================================================
--- portal/branches/gatein-management/component/management/src/main/resources/conf/portal/configuration.xml 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/management/src/main/resources/conf/portal/configuration.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,50 +0,0 @@
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2011, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file 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.
- -->
-
-<configuration
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
-
- <component>
- <key>org.gatein.management.api.ManagementService</key>
- <type>org.gatein.management.core.api.ManagementServiceImpl</type>
- </component>
-
- <component>
- <key>org.gatein.management.api.controller.ManagementController</key>
- <type>org.gatein.management.core.api.controller.SimpleManagementController</type>
- </component>
-
- <component>
- <type>org.gatein.management.rest.RestApplication</type>
- </component>
-
- <component>
- <type>org.gatein.management.runtime.RuntimeContextImpl</type>
- </component>
-
- <component>
- <type>org.gatein.management.runtime.ManagementBootstrap</type>
- </component>
-
-</configuration>
\ No newline at end of file
Copied: portal/trunk/component/management/src/main/resources/conf/portal/configuration.xml (from rev 6958, portal/branches/gatein-management/component/management/src/main/resources/conf/portal/configuration.xml)
===================================================================
--- portal/trunk/component/management/src/main/resources/conf/portal/configuration.xml (rev 0)
+++ portal/trunk/component/management/src/main/resources/conf/portal/configuration.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,50 @@
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file 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.
+ -->
+
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <key>org.gatein.management.api.ManagementService</key>
+ <type>org.gatein.management.core.api.ManagementServiceImpl</type>
+ </component>
+
+ <component>
+ <key>org.gatein.management.api.controller.ManagementController</key>
+ <type>org.gatein.management.core.api.controller.SimpleManagementController</type>
+ </component>
+
+ <component>
+ <type>org.gatein.management.rest.RestApplication</type>
+ </component>
+
+ <component>
+ <type>org.gatein.management.runtime.RuntimeContextImpl</type>
+ </component>
+
+ <component>
+ <type>org.gatein.management.runtime.ManagementBootstrap</type>
+ </component>
+
+</configuration>
\ No newline at end of file
Modified: portal/trunk/component/portal/pom.xml
===================================================================
--- portal/trunk/component/portal/pom.xml 2011-07-30 02:15:53 UTC (rev 6959)
+++ portal/trunk/component/portal/pom.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -74,6 +74,11 @@
</dependency>
<dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-spi</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-core</artifactId>
</dependency>
@@ -114,6 +119,13 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>1.8.5</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<build>
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2011-07-30 02:15:53 UTC (rev 6959)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -217,6 +217,8 @@
*/
public void saveDashboard(Dashboard dashboard) throws Exception;
+ public void save() throws Exception;
+
/**
* Returns the list of all portal names.
*
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2011-07-30 02:15:53 UTC (rev 6959)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -285,6 +285,11 @@
delegate.save(portletPreferences);
}
+ public void save() throws Exception
+ {
+ delegate.save();
+ }
+
public PortalConfig getPortalConfig(String ownerType, String portalName) throws Exception
{
PortalKey key = new PortalKey(ownerType, portalName);
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/MopManagementExtension.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/MopManagementExtension.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/MopManagementExtension.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,129 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management;
-
-import org.exoplatform.portal.mop.management.binding.MopBindingProvider;
-import org.exoplatform.portal.mop.management.operations.MopImportResource;
-import org.exoplatform.portal.mop.management.operations.MopReadResource;
-import org.exoplatform.portal.mop.management.operations.navigation.NavigationExportResource;
-import org.exoplatform.portal.mop.management.operations.navigation.NavigationReadConfigAsXml;
-import org.exoplatform.portal.mop.management.operations.navigation.NavigationReadResource;
-import org.exoplatform.portal.mop.management.operations.page.PageExportResource;
-import org.exoplatform.portal.mop.management.operations.page.PageReadConfigAsXml;
-import org.exoplatform.portal.mop.management.operations.page.PageReadResource;
-import org.exoplatform.portal.mop.management.operations.site.SiteLayoutExportResource;
-import org.exoplatform.portal.mop.management.operations.site.SiteLayoutReadConfigAsXml;
-import org.exoplatform.portal.mop.management.operations.site.SiteReadResource;
-import org.exoplatform.portal.mop.management.operations.site.SiteTypeReadResource;
-import org.gatein.management.api.ComponentRegistration;
-import org.gatein.management.api.ManagedDescription;
-import org.gatein.management.api.ManagedResource;
-import org.gatein.management.api.operation.OperationNames;
-import org.gatein.management.spi.ExtensionContext;
-import org.gatein.management.spi.ManagementExtension;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class MopManagementExtension implements ManagementExtension
-{
- @Override
- public void initialize(ExtensionContext context)
- {
- ComponentRegistration registration = context.registerManagedComponent("mop");
- registration.registerBindingProvider(MopBindingProvider.INSTANCE);
-
- ManagedResource.Registration mop = registration.registerManagedResource(description("MOP (Model Object for Portal) Managed Resource"));
- mop.registerOperationHandler(OperationNames.IMPORT_RESOURCE, new MopImportResource(), description("Imports mop data from an exported zip file."));
-
- mop.registerOperationHandler(OperationNames.READ_RESOURCE, new MopReadResource(), description("Available site types for a portal"));
-
- ManagedResource.Registration sitetypes = mop.registerSubResource("{site-type}sites", description("Management resource responsible for handling management operations on a specific site type for a portal."));
- sitetypes.registerOperationHandler(OperationNames.READ_RESOURCE, new SiteTypeReadResource(), description("Available sites for a given site type."));
-
- ManagedResource.Registration sites = sitetypes.registerSubResource("{site-name: .*}", description("Management resource responsible for handling management operations on a specific site."));
- sites.registerOperationHandler(OperationNames.READ_RESOURCE, new SiteReadResource(), description("Available artifacts for a given site (ie pages, navigation, site layout)"));
-
- // Site Layout management
- siteLayoutManagementRegistration(sites);
-
- // Page management
- pageManagementRegistration(sites);
-
- // Navigation management
- navigationManagementRegistration(sites);
- }
-
- private void siteLayoutManagementRegistration(ManagedResource.Registration sites)
- {
- ManagedResource.Registration siteLayout = sites.registerSubResource("portal", description("Management resource responsible for handling management operations for a site layout."));
- siteLayout.registerOperationHandler(OperationNames.READ_CONFIG_AS_XML, new SiteLayoutReadConfigAsXml(), description("Reads site layout data for a specific site as configuration xml."));
- siteLayout.registerOperationHandler(OperationNames.EXPORT_RESOURCE, new SiteLayoutExportResource(), description("Exports site layout configuration xml as a zip file."));
- }
-
- private void pageManagementRegistration(ManagedResource.Registration sites)
- {
- // Pages management resource registration
- ManagedResource.Registration pages = sites.registerSubResource("pages", description("Management resource responsible for handling management operations on all pages of a site."));
-
- // Pages management operations
- pages.registerOperationHandler(OperationNames.READ_RESOURCE, new PageReadResource(), description("Available pages at the specified address."), true);
- pages.registerOperationHandler(OperationNames.READ_CONFIG_AS_XML, new PageReadConfigAsXml(), description("Reads pages as configuration xml at the specified address."), true);
- pages.registerOperationHandler(OperationNames.EXPORT_RESOURCE, new PageExportResource(), description("Exports pages configuration xml as a zip file."), true);
-
- // Page name management resource registration
- pages.registerSubResource("{page-name}", description("Page management resource representing an individual page."));
- }
-
- private void navigationManagementRegistration(ManagedResource.Registration sites)
- {
- // Navigation management resource registration
- ManagedResource.Registration navigation = sites.registerSubResource("navigation", description("Management resource responsible for handling management operations on a sites navigation."));
-
- // Navigation management operations
- navigation.registerOperationHandler(OperationNames.READ_RESOURCE, new NavigationReadResource(), description("Available navigation nodes at the specified address."), true);
- navigation.registerOperationHandler(OperationNames.READ_CONFIG_AS_XML, new NavigationReadConfigAsXml(), description("Reads navigation as configuration xml at the specified address."), true);
- navigation.registerOperationHandler(OperationNames.EXPORT_RESOURCE, new NavigationExportResource(), description("Exports navigation configuration xml as a zip file."), true);
-
- // Navigation node management resource registration
- navigation.registerSubResource("{nav-uri: .*}", description("Management resource responsible for handling management operations on specific navigation nodes."));
- }
-
- @Override
- public void destroy()
- {
- }
-
- private static ManagedDescription description(final String description)
- {
- return new ManagedDescription()
- {
- @Override
- public String getDescription()
- {
- return description;
- }
- };
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/MopManagementExtension.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/MopManagementExtension.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/MopManagementExtension.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/MopManagementExtension.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,129 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management;
+
+import org.exoplatform.portal.mop.management.binding.MopBindingProvider;
+import org.exoplatform.portal.mop.management.operations.MopImportResource;
+import org.exoplatform.portal.mop.management.operations.MopReadResource;
+import org.exoplatform.portal.mop.management.operations.navigation.NavigationExportResource;
+import org.exoplatform.portal.mop.management.operations.navigation.NavigationReadConfigAsXml;
+import org.exoplatform.portal.mop.management.operations.navigation.NavigationReadResource;
+import org.exoplatform.portal.mop.management.operations.page.PageExportResource;
+import org.exoplatform.portal.mop.management.operations.page.PageReadConfigAsXml;
+import org.exoplatform.portal.mop.management.operations.page.PageReadResource;
+import org.exoplatform.portal.mop.management.operations.site.SiteLayoutExportResource;
+import org.exoplatform.portal.mop.management.operations.site.SiteLayoutReadConfigAsXml;
+import org.exoplatform.portal.mop.management.operations.site.SiteReadResource;
+import org.exoplatform.portal.mop.management.operations.site.SiteTypeReadResource;
+import org.gatein.management.api.ComponentRegistration;
+import org.gatein.management.api.ManagedDescription;
+import org.gatein.management.api.ManagedResource;
+import org.gatein.management.api.operation.OperationNames;
+import org.gatein.management.spi.ExtensionContext;
+import org.gatein.management.spi.ManagementExtension;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class MopManagementExtension implements ManagementExtension
+{
+ @Override
+ public void initialize(ExtensionContext context)
+ {
+ ComponentRegistration registration = context.registerManagedComponent("mop");
+ registration.registerBindingProvider(MopBindingProvider.INSTANCE);
+
+ ManagedResource.Registration mop = registration.registerManagedResource(description("MOP (Model Object for Portal) Managed Resource"));
+ mop.registerOperationHandler(OperationNames.IMPORT_RESOURCE, new MopImportResource(), description("Imports mop data from an exported zip file."));
+
+ mop.registerOperationHandler(OperationNames.READ_RESOURCE, new MopReadResource(), description("Available site types for a portal"));
+
+ ManagedResource.Registration sitetypes = mop.registerSubResource("{site-type}sites", description("Management resource responsible for handling management operations on a specific site type for a portal."));
+ sitetypes.registerOperationHandler(OperationNames.READ_RESOURCE, new SiteTypeReadResource(), description("Available sites for a given site type."));
+
+ ManagedResource.Registration sites = sitetypes.registerSubResource("{site-name: .*}", description("Management resource responsible for handling management operations on a specific site."));
+ sites.registerOperationHandler(OperationNames.READ_RESOURCE, new SiteReadResource(), description("Available artifacts for a given site (ie pages, navigation, site layout)"));
+
+ // Site Layout management
+ siteLayoutManagementRegistration(sites);
+
+ // Page management
+ pageManagementRegistration(sites);
+
+ // Navigation management
+ navigationManagementRegistration(sites);
+ }
+
+ private void siteLayoutManagementRegistration(ManagedResource.Registration sites)
+ {
+ ManagedResource.Registration siteLayout = sites.registerSubResource("portal", description("Management resource responsible for handling management operations for a site layout."));
+ siteLayout.registerOperationHandler(OperationNames.READ_CONFIG_AS_XML, new SiteLayoutReadConfigAsXml(), description("Reads site layout data for a specific site as configuration xml."));
+ siteLayout.registerOperationHandler(OperationNames.EXPORT_RESOURCE, new SiteLayoutExportResource(), description("Exports site layout configuration xml as a zip file."));
+ }
+
+ private void pageManagementRegistration(ManagedResource.Registration sites)
+ {
+ // Pages management resource registration
+ ManagedResource.Registration pages = sites.registerSubResource("pages", description("Management resource responsible for handling management operations on all pages of a site."));
+
+ // Pages management operations
+ pages.registerOperationHandler(OperationNames.READ_RESOURCE, new PageReadResource(), description("Available pages at the specified address."), true);
+ pages.registerOperationHandler(OperationNames.READ_CONFIG_AS_XML, new PageReadConfigAsXml(), description("Reads pages as configuration xml at the specified address."), true);
+ pages.registerOperationHandler(OperationNames.EXPORT_RESOURCE, new PageExportResource(), description("Exports pages configuration xml as a zip file."), true);
+
+ // Page name management resource registration
+ pages.registerSubResource("{page-name}", description("Page management resource representing an individual page."));
+ }
+
+ private void navigationManagementRegistration(ManagedResource.Registration sites)
+ {
+ // Navigation management resource registration
+ ManagedResource.Registration navigation = sites.registerSubResource("navigation", description("Management resource responsible for handling management operations on a sites navigation."));
+
+ // Navigation management operations
+ navigation.registerOperationHandler(OperationNames.READ_RESOURCE, new NavigationReadResource(), description("Available navigation nodes at the specified address."), true);
+ navigation.registerOperationHandler(OperationNames.READ_CONFIG_AS_XML, new NavigationReadConfigAsXml(), description("Reads navigation as configuration xml at the specified address."), true);
+ navigation.registerOperationHandler(OperationNames.EXPORT_RESOURCE, new NavigationExportResource(), description("Exports navigation configuration xml as a zip file."), true);
+
+ // Navigation node management resource registration
+ navigation.registerSubResource("{nav-uri: .*}", description("Management resource responsible for handling management operations on specific navigation nodes."));
+ }
+
+ @Override
+ public void destroy()
+ {
+ }
+
+ private static ManagedDescription description(final String description)
+ {
+ return new ManagedDescription()
+ {
+ @Override
+ public String getDescription()
+ {
+ return description;
+ }
+ };
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/MopBindingProvider.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/MopBindingProvider.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/MopBindingProvider.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,123 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding;
-
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.mop.management.binding.xml.NavigationMarshaller;
-import org.exoplatform.portal.mop.management.binding.xml.PageMarshaller;
-import org.exoplatform.portal.mop.management.binding.xml.SiteLayoutMarshaller;
-import org.exoplatform.portal.pom.data.PortalData;
-import org.gatein.management.api.ContentType;
-import org.gatein.management.api.binding.BindingException;
-import org.gatein.management.api.binding.BindingProvider;
-import org.gatein.management.api.binding.Marshaller;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class MopBindingProvider implements BindingProvider
-{
- public static final MopBindingProvider INSTANCE = new MopBindingProvider();
-
- private MopBindingProvider(){}
-
- @Override
- public <T> Marshaller<T> getMarshaller(Class<T> type, ContentType contentType) throws BindingException
- {
- switch (contentType)
- {
- case XML:
- return getXmlMarshaller(type);
- case JSON:
- case ZIP:
- default:
- return null;
- }
- }
-
- @SuppressWarnings("unchecked")
- private <T> Marshaller<T> getXmlMarshaller(Class<T> type)
- {
- if (Page.class.isAssignableFrom(type))
- {
- return (Marshaller<T>) XmlMarshallers.page_marshaller;
- }
- else if (Page.PageSet.class.isAssignableFrom(type))
- {
- return (Marshaller<T>) XmlMarshallers.pages_marshaller;
- }
- else if (PageNavigation.class.isAssignableFrom(type))
- {
- return (Marshaller<T>) XmlMarshallers.navigation_marshaller;
- }
- else if (PortalConfig.class.isAssignableFrom(type))
- {
- return (Marshaller<T>) XmlMarshallers.site_marshaller;
- }
-
- return null;
- }
-
- private static class XmlMarshallers
- {
-
- //------------------------------------ Page Marshallers ------------------------------------//
- private static Marshaller<Page.PageSet> pages_marshaller = new PageMarshaller();
-
- private static Marshaller<Page> page_marshaller = new Marshaller<Page>()
- {
- @Override
- public void marshal(Page page, OutputStream outputStream) throws BindingException
- {
- Page.PageSet pages = new Page.PageSet();
- pages.setPages(new ArrayList<Page>(1));
- pages.getPages().add(page);
-
- XmlMarshallers.pages_marshaller.marshal(pages, outputStream);
- }
-
- @Override
- public Page unmarshal(InputStream inputStream) throws BindingException
- {
- Page.PageSet pages = pages_marshaller.unmarshal(inputStream);
-
- if (pages.getPages().isEmpty()) throw new BindingException("No page was unmarshalled.");
-
- if (pages.getPages().size() != 1) throw new BindingException("Multiple pages found.");
-
- return pages.getPages().get(0);
- }
- };
-
- private static Marshaller<PageNavigation> navigation_marshaller = new NavigationMarshaller();
-
- private static Marshaller<PortalConfig> site_marshaller = new SiteLayoutMarshaller();
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/MopBindingProvider.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/MopBindingProvider.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/MopBindingProvider.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/MopBindingProvider.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,123 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding;
+
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.management.binding.xml.NavigationMarshaller;
+import org.exoplatform.portal.mop.management.binding.xml.PageMarshaller;
+import org.exoplatform.portal.mop.management.binding.xml.SiteLayoutMarshaller;
+import org.exoplatform.portal.pom.data.PortalData;
+import org.gatein.management.api.ContentType;
+import org.gatein.management.api.binding.BindingException;
+import org.gatein.management.api.binding.BindingProvider;
+import org.gatein.management.api.binding.Marshaller;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class MopBindingProvider implements BindingProvider
+{
+ public static final MopBindingProvider INSTANCE = new MopBindingProvider();
+
+ private MopBindingProvider(){}
+
+ @Override
+ public <T> Marshaller<T> getMarshaller(Class<T> type, ContentType contentType) throws BindingException
+ {
+ switch (contentType)
+ {
+ case XML:
+ return getXmlMarshaller(type);
+ case JSON:
+ case ZIP:
+ default:
+ return null;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T> Marshaller<T> getXmlMarshaller(Class<T> type)
+ {
+ if (Page.class.isAssignableFrom(type))
+ {
+ return (Marshaller<T>) XmlMarshallers.page_marshaller;
+ }
+ else if (Page.PageSet.class.isAssignableFrom(type))
+ {
+ return (Marshaller<T>) XmlMarshallers.pages_marshaller;
+ }
+ else if (PageNavigation.class.isAssignableFrom(type))
+ {
+ return (Marshaller<T>) XmlMarshallers.navigation_marshaller;
+ }
+ else if (PortalConfig.class.isAssignableFrom(type))
+ {
+ return (Marshaller<T>) XmlMarshallers.site_marshaller;
+ }
+
+ return null;
+ }
+
+ private static class XmlMarshallers
+ {
+
+ //------------------------------------ Page Marshallers ------------------------------------//
+ private static Marshaller<Page.PageSet> pages_marshaller = new PageMarshaller();
+
+ private static Marshaller<Page> page_marshaller = new Marshaller<Page>()
+ {
+ @Override
+ public void marshal(Page page, OutputStream outputStream) throws BindingException
+ {
+ Page.PageSet pages = new Page.PageSet();
+ pages.setPages(new ArrayList<Page>(1));
+ pages.getPages().add(page);
+
+ XmlMarshallers.pages_marshaller.marshal(pages, outputStream);
+ }
+
+ @Override
+ public Page unmarshal(InputStream inputStream) throws BindingException
+ {
+ Page.PageSet pages = pages_marshaller.unmarshal(inputStream);
+
+ if (pages.getPages().isEmpty()) throw new BindingException("No page was unmarshalled.");
+
+ if (pages.getPages().size() != 1) throw new BindingException("Multiple pages found.");
+
+ return pages.getPages().get(0);
+ }
+ };
+
+ private static Marshaller<PageNavigation> navigation_marshaller = new NavigationMarshaller();
+
+ private static Marshaller<PortalConfig> site_marshaller = new SiteLayoutMarshaller();
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshaller.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshaller.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshaller.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,666 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
-
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.container.ExoContainerContext;
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.model.Application;
-import org.exoplatform.portal.config.model.ApplicationState;
-import org.exoplatform.portal.config.model.ApplicationType;
-import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageBody;
-import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.gatein.common.xml.stax.writer.StaxWriter;
-import org.gatein.common.xml.stax.writer.WritableValueTypes;
-import org.exoplatform.portal.pom.data.ModelDataStorage;
-import org.exoplatform.portal.pom.spi.gadget.Gadget;
-import org.exoplatform.portal.pom.spi.portlet.Portlet;
-import org.exoplatform.portal.pom.spi.portlet.PortletBuilder;
-import org.exoplatform.portal.pom.spi.portlet.Preference;
-import org.gatein.management.api.binding.Marshaller;
-import org.staxnav.StaxNavigator;
-import org.staxnav.ValueType;
-
-import javax.xml.stream.XMLStreamException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import static org.gatein.common.xml.stax.navigator.Exceptions.*;
-import static org.gatein.common.xml.stax.navigator.StaxNavUtils.*;
-import static org.gatein.common.xml.stax.writer.StaxWriterUtils.*;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public abstract class AbstractMarshaller<T> implements Marshaller<T>
-{
- protected void marshalModelObject(StaxWriter<Element> writer, ModelObject modelObject) throws XMLStreamException
- {
- if (modelObject instanceof Application)
- {
- Application application = (Application) modelObject;
- ApplicationType type = application.getType();
- if (ApplicationType.PORTLET == type)
- {
- marshalPortletApplication(writer, safeCast(application, Portlet.class));
- }
- else if (ApplicationType.GADGET == type)
- {
- marshalGadgetApplication(writer, safeCast(application, Gadget.class));
- }
- else if (ApplicationType.WSRP_PORTLET == type)
- {
- throw new XMLStreamException("WSRP portlet marshalling not supported.");
- }
- }
- else if (modelObject instanceof Page)
- {
- //marshalPageData(writer, (PageData) componentData);
- throw new XMLStreamException("Unexpected PageData object. Storage id: " + modelObject.getStorageId());
- }
- else if (modelObject instanceof Container)
- {
- marshalContainer(writer, (Container) modelObject);
- }
- else if (modelObject instanceof PageBody)
- {
- writer.writeStartElement(Element.PAGE_BODY).writeEndElement();
- }
- else
- {
- throw new XMLStreamException("Unknown ComponentData type " + modelObject);
- }
- }
-
- protected void marshalContainer(StaxWriter<Element> writer, Container container) throws XMLStreamException
- {
- writer.writeStartElement(Element.CONTAINER);
-
- writeOptionalAttribute(writer, Attribute.ID, container.getId());
- writeOptionalAttribute(writer, Attribute.TEMPLATE, container.getTemplate());
- writeOptionalAttribute(writer, Attribute.WIDTH, container.getWidth());
- writeOptionalAttribute(writer, Attribute.HEIGHT, container.getHeight());
-
- writeOptionalElement(writer, Element.NAME, container.getName());
- writeOptionalElement(writer, Element.TITLE, container.getTitle());
- writeOptionalElement(writer, Element.ICON, container.getIcon());
- writeOptionalElement(writer, Element.DESCRIPTION, container.getDescription());
-
- marshalAccessPermissions(writer, container.getAccessPermissions());
-
- writeOptionalElement(writer, Element.FACTORY_ID, container.getFactoryId());
-
- List<ModelObject> children = container.getChildren();
- for (ModelObject child : children)
- {
- marshalModelObject(writer, child);
- }
-
- writer.writeEndElement(); // End of container element
- }
-
- protected Container unmarshalContainer(StaxNavigator<Element> navigator) throws XMLStreamException
- {
- Container container = new Container();
- container.setId(navigator.getAttribute(Attribute.ID.getLocalName()));
- container.setTemplate(navigator.getAttribute(Attribute.TEMPLATE.getLocalName()));
- container.setWidth(navigator.getAttribute(Attribute.WIDTH.getLocalName()));
- container.setHeight(navigator.getAttribute(Attribute.HEIGHT.getLocalName()));
-
- Element current = navigator.child();
- while (current != null)
- {
- switch (current)
- {
- case NAME:
- container.setName(navigator.getContent());
- current = navigator.sibling();
- break;
- case TITLE:
- container.setTitle(navigator.getContent());
- current = navigator.sibling();
- break;
- case ICON:
- container.setIcon(navigator.getContent());
- current = navigator.sibling();
- break;
- case DESCRIPTION:
- container.setDescription(navigator.getContent());
- current = navigator.sibling();
- break;
- case ACCESS_PERMISSIONS:
- container.setAccessPermissions(unmarshalAccessPermissions(navigator, false));
- current = navigator.sibling();
- break;
- case FACTORY_ID:
- container.setFactoryId(navigator.getContent());
- current = navigator.sibling();
- break;
- case CONTAINER:
- if (container.getChildren() == null)
- {
- container.setChildren(new ArrayList<ModelObject>());
- }
- container.getChildren().add(unmarshalContainer(navigator.fork()));
- current = navigator.sibling();
- break;
- case PORTLET_APPLICATION:
- if (container.getChildren() == null)
- {
- container.setChildren(new ArrayList<ModelObject>());
- }
- container.getChildren().add(unmarshalPortletApplication(navigator.fork()));
- current = navigator.sibling();
- break;
- case GADGET_APPLICATION:
- if (container.getChildren() == null)
- {
- container.setChildren(new ArrayList<ModelObject>());
- }
- container.getChildren().add(unmarshalGadgetApplication(navigator.fork()));
- current = navigator.sibling();
- break;
- case UNKNOWN:
- throw unknownElement(navigator);
- default:
- throw unexpectedElement(navigator);
- }
- }
-
- return container;
- }
-
- protected void marshalPortletApplication(StaxWriter<Element> writer, Application<Portlet> portletApplication) throws XMLStreamException
- {
- writer.writeStartElement(Element.PORTLET_APPLICATION).writeStartElement(Element.PORTLET);
-
- // Marshal ApplicationState
- ApplicationState<Portlet> state = portletApplication.getState();
-
- // Marshal application state
- String contentId;
- Portlet portlet;
- // If transient we have all the information we need
- if (state instanceof TransientApplicationState)
- {
- TransientApplicationState<Portlet> transientApplicationState = (TransientApplicationState<Portlet>) state;
- contentId = transientApplicationState.getContentId();
- portlet = transientApplicationState.getContentState();
- }
- else
- {
- // The only way to retrieve the information if the state is not transient is if we're within the portal context
- ExoContainer container = ExoContainerContext.getCurrentContainer();
- if (container instanceof PortalContainer)
- {
- DataStorage dataStorage = (DataStorage) container.getComponentInstanceOfType(DataStorage.class);
- try
- {
- portlet = dataStorage.load(state, ApplicationType.PORTLET);
- }
- catch (Exception e)
- {
- throw new XMLStreamException("Could not obtain portlet state.");
- }
-
- try
- {
- contentId = dataStorage.getId(state);
- }
- catch (Exception e)
- {
- throw new XMLStreamException("Could not obtain contentId.", e);
- }
- }
- else
- {
- throw new XMLStreamException("Cannot marshal application state " + state + " outside the context of the portal.");
- }
- }
-
- // Marshal portlet application id
- if (contentId == null) throw new XMLStreamException("Portlet application ID was null.");
- writer.writeElement(Element.APPLICATION_REF, contentId.substring(0, contentId.indexOf("/")));
- writer.writeElement(Element.PORTLET_REF, contentId.substring(contentId.indexOf("/") + 1, contentId.length()));
-
- // Marshal preferences
- if (portlet != null)
- {
- boolean prefsWritten = false;
- for (Preference preference : portlet)
- {
- if (!prefsWritten)
- {
- writer.writeStartElement(Element.PREFERENCES);
- prefsWritten = true;
- }
-
- writer.writeStartElement(Element.PREFERENCE);
- writer.writeElement(Element.NAME, preference.getName());
- for (String value : preference.getValues())
- {
- writeOptionalContent(writer, Element.PREFERENCE_VALUE, value);
- }
- writer.writeElement(Element.PREFERENCE_READONLY, WritableValueTypes.BOOLEAN, preference.isReadOnly());
- writer.writeEndElement(); // End of preference
- }
- if (prefsWritten)
- {
- writer.writeEndElement(); // End of preferences
- }
- }
- writer.writeEndElement(); // End of portlet
-
- marshalApplication(writer, portletApplication);
-
- writer.writeEndElement(); // End of portlet-application
- }
-
- protected Application<Portlet> unmarshalPortletApplication(StaxNavigator<Element> navigator) throws XMLStreamException
- {
- requiresChild(navigator, Element.PORTLET);
- ApplicationState<Portlet> state = unmarshalPortletApplicationState(navigator.fork());
-
- Application<Portlet> portlet = new Application<Portlet>(ApplicationType.PORTLET);
- portlet.setState(state);
-
- boolean showInfoBarParsed = false;
-
- Element current = navigator.sibling();
- while (current != null)
- {
- switch (current)
- {
- case THEME:
- portlet.setTheme(navigator.getContent());
- current = navigator.sibling();
- break;
- case TITLE:
- portlet.setTitle(navigator.getContent());
- current = navigator.sibling();
- break;
- case ACCESS_PERMISSIONS:
- portlet.setAccessPermissions(unmarshalAccessPermissions(navigator, true));
- current = navigator.sibling();
- break;
- case SHOW_INFO_BAR:
- portlet.setShowInfoBar(parseRequiredContent(navigator, ValueType.BOOLEAN));
- showInfoBarParsed = true;
- current = navigator.sibling();
- break;
- case SHOW_APPLICATION_STATE:
- portlet.setShowApplicationState(navigator.parseContent(ValueType.BOOLEAN));
- current = navigator.sibling();
- break;
- case SHOW_APPLICATION_MODE:
- portlet.setShowApplicationMode(navigator.parseContent(ValueType.BOOLEAN));
- current = navigator.sibling();
- break;
- case DESCRIPTION:
- portlet.setDescription(navigator.getContent());
- current = navigator.sibling();
- break;
- case ICON:
- portlet.setIcon(navigator.getContent());
- current = navigator.sibling();
- break;
- case WIDTH:
- portlet.setWidth(navigator.getContent());
- current = navigator.sibling();
- break;
- case HEIGHT:
- portlet.setHeight(navigator.getContent());
- current = navigator.sibling();
- break;
- case UNKNOWN:
- throw unknownElement(navigator);
- default:
- throw unexpectedElement(navigator);
- }
- }
-
- //TODO: We should raise this exception as soon as we know so location is accurate
- if (portlet.getAccessPermissions() == null) throw expectedElement(navigator, Element.ACCESS_PERMISSIONS);
- if (!showInfoBarParsed) throw expectedElement(navigator, Element.SHOW_INFO_BAR);
-
- return portlet;
- }
-
- private ApplicationState<Portlet> unmarshalPortletApplicationState(StaxNavigator<Element> navigator) throws XMLStreamException
- {
- // Application name
- requiresChild(navigator, Element.APPLICATION_REF);
- String applicationRef = getRequiredContent(navigator, true);
-
- // Portlet name
- requiresSibling(navigator, Element.PORTLET_REF);
- String portletRef = getRequiredContent(navigator, true);
-
- // Preferences
- PortletBuilder portletBuilder = null;
- if (navigator.sibling() == Element.PREFERENCES)
- {
- requiresChild(navigator, Element.PREFERENCE);
- portletBuilder = new PortletBuilder();
- for (StaxNavigator<Element> fork : navigator.fork(Element.PREFERENCE))
- {
- // Preference name
- requiresChild(fork, Element.NAME);
- String prefName = getRequiredContent(fork, false);
-
- // Preference values
- List<String> values = null;
- while (fork.sibling() == Element.PREFERENCE_VALUE)
- {
- if (values == null) values = new ArrayList<String>();
- values.add(getContent(fork, false));
- }
- if (values == null)
- {
- values = Collections.singletonList(null);
- }
-
- // Preference readonly
- Boolean readOnly = null;
- if (fork.getName() == Element.PREFERENCE_READONLY)
- {
- readOnly = parseRequiredContent(fork, ValueType.BOOLEAN);
- }
-
- // Ensure nothing is left.
- if (fork.next() != null)
- {
- throw unexpectedElement(fork);
- }
-
- if (readOnly == null)
- {
- portletBuilder.add(prefName, values);
- }
- else
- {
- portletBuilder.add(prefName, values, readOnly);
- }
- }
- }
-
- TransientApplicationState<Portlet> state = new TransientApplicationState<Portlet>(applicationRef + "/" + portletRef);
- if (portletBuilder != null)
- {
- state.setContentState(portletBuilder.build());
- }
-
- return state;
- }
-
- protected void marshalGadgetApplication(StaxWriter<Element> writer, Application<Gadget> gadgetApplication) throws XMLStreamException
- {
- writer.writeStartElement(Element.GADGET_APPLICATION).writeStartElement(Element.GADGET);
-
- // Marshal ApplicationState
- ApplicationState<Gadget> state = gadgetApplication.getState();
-
- // Marshal application state
- String contentId;
- Gadget gadget;
- // If transient we have all the information we need
- if (state instanceof TransientApplicationState)
- {
- TransientApplicationState<Gadget> transientApplicationState = (TransientApplicationState<Gadget>) state;
- contentId = transientApplicationState.getContentId();
- gadget = transientApplicationState.getContentState();
- }
- else
- {
- // The only way to retrieve the information if the state is not transient is if we're within a portal context
- ExoContainer container = ExoContainerContext.getCurrentContainer();
- if (container instanceof PortalContainer)
- {
- ModelDataStorage dataStorage = (ModelDataStorage) container.getComponentInstanceOfType(ModelDataStorage.class);
- try
- {
- gadget = dataStorage.load(state, ApplicationType.GADGET);
- }
- catch (Exception e)
- {
- throw new XMLStreamException("Could not obtain gadget state from custom context.");
- }
-
- try
- {
- contentId = dataStorage.getId(state);
- }
- catch (Exception e)
- {
- throw new XMLStreamException("Could not obtain contentId from custom context.", e);
- }
- }
- else
- {
- throw new XMLStreamException("Cannot marshal application state " + state + " outside the context of the portal.");
- }
- }
-
- // Marshal portlet application id
- if (contentId == null) throw new XMLStreamException("Gadget content ID was null.");
- writer.writeElement(Element.GADGET_REF, contentId);
-
- // Marshal preferences
- if (gadget != null)
- {
- //TODO: When user-prefs are supported, uncomment
- //writer.writeOptionalElement(Element.PREFERENCES, gadget.getUserPref());
- }
- writer.writeEndElement(); // End of portlet
-
- marshalApplication(writer, gadgetApplication);
-
-
- writer.writeEndElement(); // End of gadget-application
- }
-
- protected Application<Gadget> unmarshalGadgetApplication(StaxNavigator<Element> navigator) throws XMLStreamException
- {
- requiresChild(navigator, Element.GADGET);
- ApplicationState<Gadget> state = unmarshalGadgetApplicationState(navigator.fork());
-
- Application<Gadget> gadget = new Application<Gadget>(ApplicationType.GADGET);
- gadget.setState(state);
-
- boolean showInfoBarParsed = false;
-
- Element current = navigator.sibling();
- while (current != null)
- {
- switch (current)
- {
- case THEME:
- gadget.setTheme(navigator.getContent());
- current = navigator.sibling();
- break;
- case TITLE:
- gadget.setTitle(navigator.getContent());
- current = navigator.sibling();
- break;
- case ACCESS_PERMISSIONS:
- gadget.setAccessPermissions(unmarshalAccessPermissions(navigator, true));
- current = navigator.sibling();
- break;
- case SHOW_INFO_BAR:
- gadget.setShowInfoBar(parseRequiredContent(navigator, ValueType.BOOLEAN));
- showInfoBarParsed = true;
- current = navigator.sibling();
- break;
- case SHOW_APPLICATION_STATE:
- gadget.setShowApplicationState(navigator.parseContent(ValueType.BOOLEAN));
- current = navigator.sibling();
- break;
- case SHOW_APPLICATION_MODE:
- gadget.setShowApplicationMode(navigator.parseContent(ValueType.BOOLEAN));
- current = navigator.sibling();
- break;
- case DESCRIPTION:
- gadget.setDescription(navigator.getContent());
- current = navigator.sibling();
- break;
- case ICON:
- gadget.setIcon(navigator.getContent());
- current = navigator.sibling();
- break;
- case WIDTH:
- gadget.setWidth(navigator.getContent());
- current = navigator.sibling();
- break;
- case HEIGHT:
- gadget.setHeight(navigator.getContent());
- current = navigator.sibling();
- break;
- case UNKNOWN:
- throw unknownElement(navigator);
- default:
- throw unexpectedElement(navigator);
- }
- }
-
- //TODO: We should raise this exception as soon as we know so location is accurate
- if (gadget.getAccessPermissions() == null) throw expectedElement(navigator, Element.ACCESS_PERMISSIONS);
- if (!showInfoBarParsed) throw expectedElement(navigator, Element.SHOW_INFO_BAR);
-
- return gadget;
- }
-
- private ApplicationState<Gadget> unmarshalGadgetApplicationState(StaxNavigator<Element> navigator) throws XMLStreamException
- {
- requiresChild(navigator, Element.GADGET_REF);
- String gadgetRef = getRequiredContent(navigator, true);
-
- //TODO: Implement userPref unmarshalling when gatein_objects support it
- Gadget gadget = null;
-
- if (navigator.next() != null)
- {
- throw unexpectedElement(navigator);
- }
-
- return new TransientApplicationState<Gadget>(gadgetRef, gadget);
- }
-
- protected void marshalApplication(StaxWriter<Element> writer, Application<?> application) throws XMLStreamException
- {
- // Theme, Title
- writeOptionalElement(writer, Element.THEME, application.getTheme());
- writeOptionalElement(writer, Element.TITLE, application.getTitle());
-
- // Access Permissions
- marshalAccessPermissions(writer, application.getAccessPermissions());
-
- // common application elements
- writeOptionalElement(writer, Element.SHOW_INFO_BAR, String.valueOf(application.getShowInfoBar()));
- writeOptionalElement(writer, Element.SHOW_APPLICATION_STATE, String.valueOf(application.getShowApplicationState()));
- writeOptionalElement(writer, Element.SHOW_APPLICATION_MODE, String.valueOf(application.getShowApplicationMode()));
-
- // Description, Icon
- writeOptionalElement(writer, Element.DESCRIPTION, application.getDescription());
- writeOptionalElement(writer, Element.ICON, application.getIcon());
-
- // Width & Height
- writeOptionalElement(writer, Element.WIDTH, application.getWidth());
- writeOptionalElement(writer, Element.HEIGHT, application.getHeight());
- }
-
- protected void marshalAccessPermissions(StaxWriter<Element> writer, String[] accessPermissions) throws XMLStreamException
- {
- writeOptionalElement(writer, Element.ACCESS_PERMISSIONS, DelimitedValueType.SEMI_COLON, accessPermissions);
- }
-
- protected String[] unmarshalAccessPermissions(StaxNavigator<Element> navigator, boolean required) throws XMLStreamException
- {
- if (required)
- {
- return parseRequiredContent(navigator, DelimitedValueType.SEMI_COLON);
- }
- else
- {
- return parseContent(navigator, DelimitedValueType.SEMI_COLON, null);
- }
- }
-
- protected void marshalEditPermission(StaxWriter<Element> writer, String editPermission) throws XMLStreamException
- {
- writeOptionalElement(writer, Element.EDIT_PERMISSION, editPermission);
- }
-
- protected String unmarshalEditPermission(StaxNavigator<Element> navigator) throws XMLStreamException
- {
- return getContent(navigator, true);
- }
-
- protected void writeGateinObjectsNamespace(StaxWriter<Element> writer) throws XMLStreamException
- {
- Utils.writeGateinObjectsNamespace(writer);
- }
-
- @SuppressWarnings("unchecked")
- private <S> Application<S> safeCast(Application application, Class<S> stateClass)
- {
- return (Application<S>) application;
- }
-
- private static void writeOptionalAttribute(StaxWriter writer, Attribute attribute, String value) throws XMLStreamException
- {
- if (value == null) return;
-
- writer.writeAttribute(attribute.getLocalName(), value);
- }
-
- private static enum Attribute
- {
- ID("id"),
- TEMPLATE("template"),
- WIDTH("width"),
- HEIGHT("height");
-
- private final String name;
-
- Attribute(final String name)
- {
- this.name = name;
- }
-
- /**
- * Get the local name of this element.
- *
- * @return the local name
- */
- public String getLocalName()
- {
- return name;
- }
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshaller.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshaller.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshaller.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshaller.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,666 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
+
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageBody;
+import org.exoplatform.portal.config.model.TransientApplicationState;
+import org.gatein.common.xml.stax.writer.StaxWriter;
+import org.gatein.common.xml.stax.writer.WritableValueTypes;
+import org.exoplatform.portal.pom.data.ModelDataStorage;
+import org.exoplatform.portal.pom.spi.gadget.Gadget;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+import org.exoplatform.portal.pom.spi.portlet.PortletBuilder;
+import org.exoplatform.portal.pom.spi.portlet.Preference;
+import org.gatein.management.api.binding.Marshaller;
+import org.staxnav.StaxNavigator;
+import org.staxnav.ValueType;
+
+import javax.xml.stream.XMLStreamException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import static org.gatein.common.xml.stax.navigator.Exceptions.*;
+import static org.gatein.common.xml.stax.navigator.StaxNavUtils.*;
+import static org.gatein.common.xml.stax.writer.StaxWriterUtils.*;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public abstract class AbstractMarshaller<T> implements Marshaller<T>
+{
+ protected void marshalModelObject(StaxWriter<Element> writer, ModelObject modelObject) throws XMLStreamException
+ {
+ if (modelObject instanceof Application)
+ {
+ Application application = (Application) modelObject;
+ ApplicationType type = application.getType();
+ if (ApplicationType.PORTLET == type)
+ {
+ marshalPortletApplication(writer, safeCast(application, Portlet.class));
+ }
+ else if (ApplicationType.GADGET == type)
+ {
+ marshalGadgetApplication(writer, safeCast(application, Gadget.class));
+ }
+ else if (ApplicationType.WSRP_PORTLET == type)
+ {
+ throw new XMLStreamException("WSRP portlet marshalling not supported.");
+ }
+ }
+ else if (modelObject instanceof Page)
+ {
+ //marshalPageData(writer, (PageData) componentData);
+ throw new XMLStreamException("Unexpected PageData object. Storage id: " + modelObject.getStorageId());
+ }
+ else if (modelObject instanceof Container)
+ {
+ marshalContainer(writer, (Container) modelObject);
+ }
+ else if (modelObject instanceof PageBody)
+ {
+ writer.writeStartElement(Element.PAGE_BODY).writeEndElement();
+ }
+ else
+ {
+ throw new XMLStreamException("Unknown ComponentData type " + modelObject);
+ }
+ }
+
+ protected void marshalContainer(StaxWriter<Element> writer, Container container) throws XMLStreamException
+ {
+ writer.writeStartElement(Element.CONTAINER);
+
+ writeOptionalAttribute(writer, Attribute.ID, container.getId());
+ writeOptionalAttribute(writer, Attribute.TEMPLATE, container.getTemplate());
+ writeOptionalAttribute(writer, Attribute.WIDTH, container.getWidth());
+ writeOptionalAttribute(writer, Attribute.HEIGHT, container.getHeight());
+
+ writeOptionalElement(writer, Element.NAME, container.getName());
+ writeOptionalElement(writer, Element.TITLE, container.getTitle());
+ writeOptionalElement(writer, Element.ICON, container.getIcon());
+ writeOptionalElement(writer, Element.DESCRIPTION, container.getDescription());
+
+ marshalAccessPermissions(writer, container.getAccessPermissions());
+
+ writeOptionalElement(writer, Element.FACTORY_ID, container.getFactoryId());
+
+ List<ModelObject> children = container.getChildren();
+ for (ModelObject child : children)
+ {
+ marshalModelObject(writer, child);
+ }
+
+ writer.writeEndElement(); // End of container element
+ }
+
+ protected Container unmarshalContainer(StaxNavigator<Element> navigator) throws XMLStreamException
+ {
+ Container container = new Container();
+ container.setId(navigator.getAttribute(Attribute.ID.getLocalName()));
+ container.setTemplate(navigator.getAttribute(Attribute.TEMPLATE.getLocalName()));
+ container.setWidth(navigator.getAttribute(Attribute.WIDTH.getLocalName()));
+ container.setHeight(navigator.getAttribute(Attribute.HEIGHT.getLocalName()));
+
+ Element current = navigator.child();
+ while (current != null)
+ {
+ switch (current)
+ {
+ case NAME:
+ container.setName(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case TITLE:
+ container.setTitle(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case ICON:
+ container.setIcon(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case DESCRIPTION:
+ container.setDescription(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case ACCESS_PERMISSIONS:
+ container.setAccessPermissions(unmarshalAccessPermissions(navigator, false));
+ current = navigator.sibling();
+ break;
+ case FACTORY_ID:
+ container.setFactoryId(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case CONTAINER:
+ if (container.getChildren() == null)
+ {
+ container.setChildren(new ArrayList<ModelObject>());
+ }
+ container.getChildren().add(unmarshalContainer(navigator.fork()));
+ current = navigator.sibling();
+ break;
+ case PORTLET_APPLICATION:
+ if (container.getChildren() == null)
+ {
+ container.setChildren(new ArrayList<ModelObject>());
+ }
+ container.getChildren().add(unmarshalPortletApplication(navigator.fork()));
+ current = navigator.sibling();
+ break;
+ case GADGET_APPLICATION:
+ if (container.getChildren() == null)
+ {
+ container.setChildren(new ArrayList<ModelObject>());
+ }
+ container.getChildren().add(unmarshalGadgetApplication(navigator.fork()));
+ current = navigator.sibling();
+ break;
+ case UNKNOWN:
+ throw unknownElement(navigator);
+ default:
+ throw unexpectedElement(navigator);
+ }
+ }
+
+ return container;
+ }
+
+ protected void marshalPortletApplication(StaxWriter<Element> writer, Application<Portlet> portletApplication) throws XMLStreamException
+ {
+ writer.writeStartElement(Element.PORTLET_APPLICATION).writeStartElement(Element.PORTLET);
+
+ // Marshal ApplicationState
+ ApplicationState<Portlet> state = portletApplication.getState();
+
+ // Marshal application state
+ String contentId;
+ Portlet portlet;
+ // If transient we have all the information we need
+ if (state instanceof TransientApplicationState)
+ {
+ TransientApplicationState<Portlet> transientApplicationState = (TransientApplicationState<Portlet>) state;
+ contentId = transientApplicationState.getContentId();
+ portlet = transientApplicationState.getContentState();
+ }
+ else
+ {
+ // The only way to retrieve the information if the state is not transient is if we're within the portal context
+ ExoContainer container = ExoContainerContext.getCurrentContainer();
+ if (container instanceof PortalContainer)
+ {
+ DataStorage dataStorage = (DataStorage) container.getComponentInstanceOfType(DataStorage.class);
+ try
+ {
+ portlet = dataStorage.load(state, ApplicationType.PORTLET);
+ }
+ catch (Exception e)
+ {
+ throw new XMLStreamException("Could not obtain portlet state.");
+ }
+
+ try
+ {
+ contentId = dataStorage.getId(state);
+ }
+ catch (Exception e)
+ {
+ throw new XMLStreamException("Could not obtain contentId.", e);
+ }
+ }
+ else
+ {
+ throw new XMLStreamException("Cannot marshal application state " + state + " outside the context of the portal.");
+ }
+ }
+
+ // Marshal portlet application id
+ if (contentId == null) throw new XMLStreamException("Portlet application ID was null.");
+ writer.writeElement(Element.APPLICATION_REF, contentId.substring(0, contentId.indexOf("/")));
+ writer.writeElement(Element.PORTLET_REF, contentId.substring(contentId.indexOf("/") + 1, contentId.length()));
+
+ // Marshal preferences
+ if (portlet != null)
+ {
+ boolean prefsWritten = false;
+ for (Preference preference : portlet)
+ {
+ if (!prefsWritten)
+ {
+ writer.writeStartElement(Element.PREFERENCES);
+ prefsWritten = true;
+ }
+
+ writer.writeStartElement(Element.PREFERENCE);
+ writer.writeElement(Element.NAME, preference.getName());
+ for (String value : preference.getValues())
+ {
+ writeOptionalContent(writer, Element.PREFERENCE_VALUE, value);
+ }
+ writer.writeElement(Element.PREFERENCE_READONLY, WritableValueTypes.BOOLEAN, preference.isReadOnly());
+ writer.writeEndElement(); // End of preference
+ }
+ if (prefsWritten)
+ {
+ writer.writeEndElement(); // End of preferences
+ }
+ }
+ writer.writeEndElement(); // End of portlet
+
+ marshalApplication(writer, portletApplication);
+
+ writer.writeEndElement(); // End of portlet-application
+ }
+
+ protected Application<Portlet> unmarshalPortletApplication(StaxNavigator<Element> navigator) throws XMLStreamException
+ {
+ requiresChild(navigator, Element.PORTLET);
+ ApplicationState<Portlet> state = unmarshalPortletApplicationState(navigator.fork());
+
+ Application<Portlet> portlet = new Application<Portlet>(ApplicationType.PORTLET);
+ portlet.setState(state);
+
+ boolean showInfoBarParsed = false;
+
+ Element current = navigator.sibling();
+ while (current != null)
+ {
+ switch (current)
+ {
+ case THEME:
+ portlet.setTheme(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case TITLE:
+ portlet.setTitle(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case ACCESS_PERMISSIONS:
+ portlet.setAccessPermissions(unmarshalAccessPermissions(navigator, true));
+ current = navigator.sibling();
+ break;
+ case SHOW_INFO_BAR:
+ portlet.setShowInfoBar(parseRequiredContent(navigator, ValueType.BOOLEAN));
+ showInfoBarParsed = true;
+ current = navigator.sibling();
+ break;
+ case SHOW_APPLICATION_STATE:
+ portlet.setShowApplicationState(navigator.parseContent(ValueType.BOOLEAN));
+ current = navigator.sibling();
+ break;
+ case SHOW_APPLICATION_MODE:
+ portlet.setShowApplicationMode(navigator.parseContent(ValueType.BOOLEAN));
+ current = navigator.sibling();
+ break;
+ case DESCRIPTION:
+ portlet.setDescription(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case ICON:
+ portlet.setIcon(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case WIDTH:
+ portlet.setWidth(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case HEIGHT:
+ portlet.setHeight(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case UNKNOWN:
+ throw unknownElement(navigator);
+ default:
+ throw unexpectedElement(navigator);
+ }
+ }
+
+ //TODO: We should raise this exception as soon as we know so location is accurate
+ if (portlet.getAccessPermissions() == null) throw expectedElement(navigator, Element.ACCESS_PERMISSIONS);
+ if (!showInfoBarParsed) throw expectedElement(navigator, Element.SHOW_INFO_BAR);
+
+ return portlet;
+ }
+
+ private ApplicationState<Portlet> unmarshalPortletApplicationState(StaxNavigator<Element> navigator) throws XMLStreamException
+ {
+ // Application name
+ requiresChild(navigator, Element.APPLICATION_REF);
+ String applicationRef = getRequiredContent(navigator, true);
+
+ // Portlet name
+ requiresSibling(navigator, Element.PORTLET_REF);
+ String portletRef = getRequiredContent(navigator, true);
+
+ // Preferences
+ PortletBuilder portletBuilder = null;
+ if (navigator.sibling() == Element.PREFERENCES)
+ {
+ requiresChild(navigator, Element.PREFERENCE);
+ portletBuilder = new PortletBuilder();
+ for (StaxNavigator<Element> fork : navigator.fork(Element.PREFERENCE))
+ {
+ // Preference name
+ requiresChild(fork, Element.NAME);
+ String prefName = getRequiredContent(fork, false);
+
+ // Preference values
+ List<String> values = null;
+ while (fork.sibling() == Element.PREFERENCE_VALUE)
+ {
+ if (values == null) values = new ArrayList<String>();
+ values.add(getContent(fork, false));
+ }
+ if (values == null)
+ {
+ values = Collections.singletonList(null);
+ }
+
+ // Preference readonly
+ Boolean readOnly = null;
+ if (fork.getName() == Element.PREFERENCE_READONLY)
+ {
+ readOnly = parseRequiredContent(fork, ValueType.BOOLEAN);
+ }
+
+ // Ensure nothing is left.
+ if (fork.next() != null)
+ {
+ throw unexpectedElement(fork);
+ }
+
+ if (readOnly == null)
+ {
+ portletBuilder.add(prefName, values);
+ }
+ else
+ {
+ portletBuilder.add(prefName, values, readOnly);
+ }
+ }
+ }
+
+ TransientApplicationState<Portlet> state = new TransientApplicationState<Portlet>(applicationRef + "/" + portletRef);
+ if (portletBuilder != null)
+ {
+ state.setContentState(portletBuilder.build());
+ }
+
+ return state;
+ }
+
+ protected void marshalGadgetApplication(StaxWriter<Element> writer, Application<Gadget> gadgetApplication) throws XMLStreamException
+ {
+ writer.writeStartElement(Element.GADGET_APPLICATION).writeStartElement(Element.GADGET);
+
+ // Marshal ApplicationState
+ ApplicationState<Gadget> state = gadgetApplication.getState();
+
+ // Marshal application state
+ String contentId;
+ Gadget gadget;
+ // If transient we have all the information we need
+ if (state instanceof TransientApplicationState)
+ {
+ TransientApplicationState<Gadget> transientApplicationState = (TransientApplicationState<Gadget>) state;
+ contentId = transientApplicationState.getContentId();
+ gadget = transientApplicationState.getContentState();
+ }
+ else
+ {
+ // The only way to retrieve the information if the state is not transient is if we're within a portal context
+ ExoContainer container = ExoContainerContext.getCurrentContainer();
+ if (container instanceof PortalContainer)
+ {
+ ModelDataStorage dataStorage = (ModelDataStorage) container.getComponentInstanceOfType(ModelDataStorage.class);
+ try
+ {
+ gadget = dataStorage.load(state, ApplicationType.GADGET);
+ }
+ catch (Exception e)
+ {
+ throw new XMLStreamException("Could not obtain gadget state from custom context.");
+ }
+
+ try
+ {
+ contentId = dataStorage.getId(state);
+ }
+ catch (Exception e)
+ {
+ throw new XMLStreamException("Could not obtain contentId from custom context.", e);
+ }
+ }
+ else
+ {
+ throw new XMLStreamException("Cannot marshal application state " + state + " outside the context of the portal.");
+ }
+ }
+
+ // Marshal portlet application id
+ if (contentId == null) throw new XMLStreamException("Gadget content ID was null.");
+ writer.writeElement(Element.GADGET_REF, contentId);
+
+ // Marshal preferences
+ if (gadget != null)
+ {
+ //TODO: When user-prefs are supported, uncomment
+ //writer.writeOptionalElement(Element.PREFERENCES, gadget.getUserPref());
+ }
+ writer.writeEndElement(); // End of portlet
+
+ marshalApplication(writer, gadgetApplication);
+
+
+ writer.writeEndElement(); // End of gadget-application
+ }
+
+ protected Application<Gadget> unmarshalGadgetApplication(StaxNavigator<Element> navigator) throws XMLStreamException
+ {
+ requiresChild(navigator, Element.GADGET);
+ ApplicationState<Gadget> state = unmarshalGadgetApplicationState(navigator.fork());
+
+ Application<Gadget> gadget = new Application<Gadget>(ApplicationType.GADGET);
+ gadget.setState(state);
+
+ boolean showInfoBarParsed = false;
+
+ Element current = navigator.sibling();
+ while (current != null)
+ {
+ switch (current)
+ {
+ case THEME:
+ gadget.setTheme(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case TITLE:
+ gadget.setTitle(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case ACCESS_PERMISSIONS:
+ gadget.setAccessPermissions(unmarshalAccessPermissions(navigator, true));
+ current = navigator.sibling();
+ break;
+ case SHOW_INFO_BAR:
+ gadget.setShowInfoBar(parseRequiredContent(navigator, ValueType.BOOLEAN));
+ showInfoBarParsed = true;
+ current = navigator.sibling();
+ break;
+ case SHOW_APPLICATION_STATE:
+ gadget.setShowApplicationState(navigator.parseContent(ValueType.BOOLEAN));
+ current = navigator.sibling();
+ break;
+ case SHOW_APPLICATION_MODE:
+ gadget.setShowApplicationMode(navigator.parseContent(ValueType.BOOLEAN));
+ current = navigator.sibling();
+ break;
+ case DESCRIPTION:
+ gadget.setDescription(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case ICON:
+ gadget.setIcon(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case WIDTH:
+ gadget.setWidth(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case HEIGHT:
+ gadget.setHeight(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case UNKNOWN:
+ throw unknownElement(navigator);
+ default:
+ throw unexpectedElement(navigator);
+ }
+ }
+
+ //TODO: We should raise this exception as soon as we know so location is accurate
+ if (gadget.getAccessPermissions() == null) throw expectedElement(navigator, Element.ACCESS_PERMISSIONS);
+ if (!showInfoBarParsed) throw expectedElement(navigator, Element.SHOW_INFO_BAR);
+
+ return gadget;
+ }
+
+ private ApplicationState<Gadget> unmarshalGadgetApplicationState(StaxNavigator<Element> navigator) throws XMLStreamException
+ {
+ requiresChild(navigator, Element.GADGET_REF);
+ String gadgetRef = getRequiredContent(navigator, true);
+
+ //TODO: Implement userPref unmarshalling when gatein_objects support it
+ Gadget gadget = null;
+
+ if (navigator.next() != null)
+ {
+ throw unexpectedElement(navigator);
+ }
+
+ return new TransientApplicationState<Gadget>(gadgetRef, gadget);
+ }
+
+ protected void marshalApplication(StaxWriter<Element> writer, Application<?> application) throws XMLStreamException
+ {
+ // Theme, Title
+ writeOptionalElement(writer, Element.THEME, application.getTheme());
+ writeOptionalElement(writer, Element.TITLE, application.getTitle());
+
+ // Access Permissions
+ marshalAccessPermissions(writer, application.getAccessPermissions());
+
+ // common application elements
+ writeOptionalElement(writer, Element.SHOW_INFO_BAR, String.valueOf(application.getShowInfoBar()));
+ writeOptionalElement(writer, Element.SHOW_APPLICATION_STATE, String.valueOf(application.getShowApplicationState()));
+ writeOptionalElement(writer, Element.SHOW_APPLICATION_MODE, String.valueOf(application.getShowApplicationMode()));
+
+ // Description, Icon
+ writeOptionalElement(writer, Element.DESCRIPTION, application.getDescription());
+ writeOptionalElement(writer, Element.ICON, application.getIcon());
+
+ // Width & Height
+ writeOptionalElement(writer, Element.WIDTH, application.getWidth());
+ writeOptionalElement(writer, Element.HEIGHT, application.getHeight());
+ }
+
+ protected void marshalAccessPermissions(StaxWriter<Element> writer, String[] accessPermissions) throws XMLStreamException
+ {
+ writeOptionalElement(writer, Element.ACCESS_PERMISSIONS, DelimitedValueType.SEMI_COLON, accessPermissions);
+ }
+
+ protected String[] unmarshalAccessPermissions(StaxNavigator<Element> navigator, boolean required) throws XMLStreamException
+ {
+ if (required)
+ {
+ return parseRequiredContent(navigator, DelimitedValueType.SEMI_COLON);
+ }
+ else
+ {
+ return parseContent(navigator, DelimitedValueType.SEMI_COLON, null);
+ }
+ }
+
+ protected void marshalEditPermission(StaxWriter<Element> writer, String editPermission) throws XMLStreamException
+ {
+ writeOptionalElement(writer, Element.EDIT_PERMISSION, editPermission);
+ }
+
+ protected String unmarshalEditPermission(StaxNavigator<Element> navigator) throws XMLStreamException
+ {
+ return getContent(navigator, true);
+ }
+
+ protected void writeGateinObjectsNamespace(StaxWriter<Element> writer) throws XMLStreamException
+ {
+ Utils.writeGateinObjectsNamespace(writer);
+ }
+
+ @SuppressWarnings("unchecked")
+ private <S> Application<S> safeCast(Application application, Class<S> stateClass)
+ {
+ return (Application<S>) application;
+ }
+
+ private static void writeOptionalAttribute(StaxWriter writer, Attribute attribute, String value) throws XMLStreamException
+ {
+ if (value == null) return;
+
+ writer.writeAttribute(attribute.getLocalName(), value);
+ }
+
+ private static enum Attribute
+ {
+ ID("id"),
+ TEMPLATE("template"),
+ WIDTH("width"),
+ HEIGHT("height");
+
+ private final String name;
+
+ Attribute(final String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Get the local name of this element.
+ *
+ * @return the local name
+ */
+ public String getLocalName()
+ {
+ return name;
+ }
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/DelimitedValueType.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/DelimitedValueType.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/DelimitedValueType.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
-
-import org.gatein.common.xml.stax.writer.WritableValueType;
-import org.exoplatform.portal.pom.config.Utils;
-import org.staxnav.StaxNavException;
-import org.staxnav.ValueType;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class DelimitedValueType extends ValueType<String[]> implements WritableValueType<String[]>
-{
- public static DelimitedValueType SEMI_COLON = new DelimitedValueType(";");
-
- private final String delimiter;
-
- public DelimitedValueType(String delimiter)
- {
- this.delimiter = delimiter;
- }
-
- @Override
- protected String[] parse(String s) throws Exception
- {
- return Utils.split(delimiter, s);
- }
-
- @Override
- public String format(String[] value) throws StaxNavException
- {
- String s = Utils.join(delimiter, value);
-
- if (s != null && s.trim().length() == 0)
- {
- return null;
- }
- else
- {
- return s;
- }
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/DelimitedValueType.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/DelimitedValueType.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/DelimitedValueType.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/DelimitedValueType.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
+
+import org.gatein.common.xml.stax.writer.WritableValueType;
+import org.exoplatform.portal.pom.config.Utils;
+import org.staxnav.StaxNavException;
+import org.staxnav.ValueType;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class DelimitedValueType extends ValueType<String[]> implements WritableValueType<String[]>
+{
+ public static DelimitedValueType SEMI_COLON = new DelimitedValueType(";");
+
+ private final String delimiter;
+
+ public DelimitedValueType(String delimiter)
+ {
+ this.delimiter = delimiter;
+ }
+
+ @Override
+ protected String[] parse(String s) throws Exception
+ {
+ return Utils.split(delimiter, s);
+ }
+
+ @Override
+ public String format(String[] value) throws StaxNavException
+ {
+ String s = Utils.join(delimiter, value);
+
+ if (s != null && s.trim().length() == 0)
+ {
+ return null;
+ }
+ else
+ {
+ return s;
+ }
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Element.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Element.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Element.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,104 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
-
-
-import org.staxnav.EnumElement;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public enum Element implements EnumElement<Element>
-{
- // Navigation Elements
- UNKNOWN(null),
- NODE_NAVIGATION("node-navigation"),
- PRIORITY("priority"),
- PAGE_NODES("page-nodes"),
- NODE("node"),
- @Deprecated
- URI("uri"),
- PARENT_URI("parent-uri"),
- LABEL("label"),
- START_PUBLICATION_DATE("start-publication-date"),
- END_PUBLICATION_DATE("end-publication-date"),
- VISIBILITY("visibility"),
- PAGE_REFERENCE("page-reference"),
-
- // Page elements
- PAGE_SET("page-set"),
- PAGE("page"),
- NAME("name"),
- SHOW_MAX_WINDOW("show-max-window"),
-
- // Portal config elements
- PORTAL_CONFIG("portal-config"),
- PORTAL_NAME("portal-name"),
- LOCALE("locale"),
- SKIN("skin"),
- PROPERTIES("properties"),
- PROPERTIES_ENTRY("entry"),
- PORTAL_LAYOUT("portal-layout"),
-
- // Common elements
- TITLE("title"),
- DESCRIPTION("description"),
- FACTORY_ID("factory-id"),
- ACCESS_PERMISSIONS("access-permissions"),
- EDIT_PERMISSION("edit-permission"),
- PORTLET_APPLICATION("portlet-application"),
- GADGET_APPLICATION("gadget-application"),
- CONTAINER("container"),
- PAGE_BODY("page-body"),
- APPLICATION_REF("application-ref"),
- PORTLET_REF("portlet-ref"),
- PORTLET("portlet"),
- GADGET_REF("gadget-ref"),
- GADGET("gadget"),
- THEME("theme"),
- SHOW_INFO_BAR("show-info-bar"),
- SHOW_APPLICATION_STATE("show-application-state"),
- SHOW_APPLICATION_MODE("show-application-mode"),
- ICON("icon"),
- WIDTH("width"),
- HEIGHT("height"),
- PREFERENCES("preferences"),
- PREFERENCE("preference"),
- PREFERENCE_VALUE("value"),
- PREFERENCE_READONLY("read-only")
- ;
-
- private final String name;
-
- Element(String name)
- {
- this.name = name;
- }
-
- @Override
- public String getLocalName()
- {
- return name;
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Element.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Element.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Element.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Element.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,104 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
+
+
+import org.staxnav.EnumElement;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public enum Element implements EnumElement<Element>
+{
+ // Navigation Elements
+ UNKNOWN(null),
+ NODE_NAVIGATION("node-navigation"),
+ PRIORITY("priority"),
+ PAGE_NODES("page-nodes"),
+ NODE("node"),
+ @Deprecated
+ URI("uri"),
+ PARENT_URI("parent-uri"),
+ LABEL("label"),
+ START_PUBLICATION_DATE("start-publication-date"),
+ END_PUBLICATION_DATE("end-publication-date"),
+ VISIBILITY("visibility"),
+ PAGE_REFERENCE("page-reference"),
+
+ // Page elements
+ PAGE_SET("page-set"),
+ PAGE("page"),
+ NAME("name"),
+ SHOW_MAX_WINDOW("show-max-window"),
+
+ // Portal config elements
+ PORTAL_CONFIG("portal-config"),
+ PORTAL_NAME("portal-name"),
+ LOCALE("locale"),
+ SKIN("skin"),
+ PROPERTIES("properties"),
+ PROPERTIES_ENTRY("entry"),
+ PORTAL_LAYOUT("portal-layout"),
+
+ // Common elements
+ TITLE("title"),
+ DESCRIPTION("description"),
+ FACTORY_ID("factory-id"),
+ ACCESS_PERMISSIONS("access-permissions"),
+ EDIT_PERMISSION("edit-permission"),
+ PORTLET_APPLICATION("portlet-application"),
+ GADGET_APPLICATION("gadget-application"),
+ CONTAINER("container"),
+ PAGE_BODY("page-body"),
+ APPLICATION_REF("application-ref"),
+ PORTLET_REF("portlet-ref"),
+ PORTLET("portlet"),
+ GADGET_REF("gadget-ref"),
+ GADGET("gadget"),
+ THEME("theme"),
+ SHOW_INFO_BAR("show-info-bar"),
+ SHOW_APPLICATION_STATE("show-application-state"),
+ SHOW_APPLICATION_MODE("show-application-mode"),
+ ICON("icon"),
+ WIDTH("width"),
+ HEIGHT("height"),
+ PREFERENCES("preferences"),
+ PREFERENCE("preference"),
+ PREFERENCE_VALUE("value"),
+ PREFERENCE_READONLY("read-only")
+ ;
+
+ private final String name;
+
+ Element(String name)
+ {
+ this.name = name;
+ }
+
+ @Override
+ public String getLocalName()
+ {
+ return name;
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Namespace.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Namespace.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Namespace.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public enum Namespace
-{
- GATEIN_OBJECTS_1_1("http://www.gatein.org/xml/ns/gatein_objects_1_1"),
- GATEIN_OBJECTS_1_2("http://www.gatein.org/xml/ns/gatein_objects_1_2");
-
- /**
- * The current namespace version.
- */
- public static final Namespace CURRENT = GATEIN_OBJECTS_1_2;
-
- private final String name;
-
- Namespace(final String name)
- {
- this.name = name;
- }
-
- /**
- * Get the URI of this namespace.
- *
- * @return the URI
- */
- public String getUri()
- {
- return name;
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Namespace.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Namespace.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Namespace.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Namespace.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public enum Namespace
+{
+ GATEIN_OBJECTS_1_1("http://www.gatein.org/xml/ns/gatein_objects_1_1"),
+ GATEIN_OBJECTS_1_2("http://www.gatein.org/xml/ns/gatein_objects_1_2");
+
+ /**
+ * The current namespace version.
+ */
+ public static final Namespace CURRENT = GATEIN_OBJECTS_1_2;
+
+ private final String name;
+
+ Namespace(final String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Get the URI of this namespace.
+ *
+ * @return the URI
+ */
+ public String getUri()
+ {
+ return name;
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshaller.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshaller.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshaller.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,302 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
-
-import org.exoplatform.portal.config.model.I18NString;
-import org.exoplatform.portal.config.model.LocalizedString;
-import org.exoplatform.portal.config.model.NavigationFragment;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.mop.Visibility;
-import org.gatein.common.xml.stax.writer.StaxWriter;
-import org.gatein.common.xml.stax.writer.WritableValueTypes;
-import org.gatein.management.api.binding.BindingException;
-import org.gatein.management.api.binding.Marshaller;
-import org.staxnav.StaxNavException;
-import org.staxnav.StaxNavigator;
-import org.staxnav.ValueType;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import static org.gatein.common.xml.stax.navigator.Exceptions.*;
-import static org.gatein.common.xml.stax.navigator.StaxNavUtils.*;
-import static org.gatein.common.xml.stax.writer.StaxWriterUtils.*;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class NavigationMarshaller implements Marshaller<PageNavigation>
-{
-
- @Override
- public void marshal(PageNavigation navigation, OutputStream outputStream) throws BindingException
- {
- try
- {
- StaxWriter<Element> writer = createWriter(Element.class, outputStream);
- marshalNavigation(writer, navigation);
- }
- catch (StaxNavException e)
- {
- throw new BindingException(e);
- }
- catch (XMLStreamException e)
- {
- throw new BindingException(e);
- }
- }
-
- @Override
- public PageNavigation unmarshal(InputStream is) throws BindingException
- {
- try
- {
- StaxNavigator<Element> navigator = createNavigator(Element.class, Element.UNKNOWN, is);
- return unmarshalNavigation(navigator);
- }
- catch (StaxNavException e)
- {
- throw new BindingException(e);
- }
- }
-
- private void marshalNavigation(StaxWriter<Element> writer, PageNavigation navigation) throws XMLStreamException
- {
- writer.writeStartElement(Element.NODE_NAVIGATION);
-
- // Write gatein_objects xml namespace
- Utils.writeGateinObjectsNamespace(writer);
-
- // Priority
- writer.writeElement(Element.PRIORITY, WritableValueTypes.INTEGER, navigation.getPriority());
-
- // Page nodes
- writer.writeStartElement(Element.PAGE_NODES);
- ArrayList<NavigationFragment> fragments = navigation.getFragments();
- for (NavigationFragment fragment : fragments)
- {
- if (fragment.getParentURI() != null)
- {
- String parentUri = fragment.getParentURI();
- writeOptionalElement(writer, Element.PARENT_URI, parentUri);
- }
-
- Collection<PageNode> nodes = fragment.getNodes();
- if (nodes != null && !nodes.isEmpty())
- {
- for (PageNode node : nodes)
- {
- marshallNode(writer, node);
- }
- }
- }
-
- writer.writeEndElement().writeEndElement(); // End page-nodes and node-navigation
- }
-
- public void marshallNode(StaxWriter<Element> writer, PageNode node) throws XMLStreamException
- {
- writer.writeStartElement(Element.NODE);
- writer.writeElement(Element.NAME, node.getName());
-
- if (node.getLabels() != null)
- {
- for (LocalizedString label : node.getLabels())
- {
- writer.writeStartElement(Element.LABEL);
- if (label.getLang() != null)
- {
- String localeString = label.getLang().getLanguage();
- if (localeString == null)
- {
- throw new XMLStreamException("Language was null for locale " + label.getLang());
- }
- String country = label.getLang().getCountry();
- if (country != null && country.length() > 0)
- {
- localeString += "-" + country.toLowerCase();
- }
-
- writer.writeAttribute(new QName(XMLConstants.XML_NS_URI, "lang", XMLConstants.XML_NS_PREFIX), localeString);
- }
- writer.writeContent(label.getValue()).writeEndElement();
- }
- }
-
- writeOptionalElement(writer, Element.ICON, node.getIcon());
-
- writeOptionalElement(writer, Element.START_PUBLICATION_DATE, WritableValueTypes.DATE_TIME, node.getStartPublicationDate());
- writeOptionalElement(writer, Element.END_PUBLICATION_DATE, WritableValueTypes.DATE_TIME, node.getEndPublicationDate());
-
- String visibility = (node.getVisibility() == null) ? null : node.getVisibility().name();
- writeOptionalElement(writer, Element.VISIBILITY, visibility);
- writeOptionalElement(writer, Element.PAGE_REFERENCE, node.getPageReference());
-
- // Marshall children
- List<PageNode> children = node.getNodes();
- if (children != null && !children.isEmpty())
- {
- for (PageNode child : children)
- {
- marshallNode(writer, child);
- }
- }
-
- writer.writeEndElement(); // End of node
- }
-
- private PageNavigation unmarshalNavigation(StaxNavigator<Element> navigator) throws StaxNavException
- {
- PageNavigation navigation = new PageNavigation();
-
- if (navigator.getName() == Element.NODE_NAVIGATION)
- {
- Element next = navigator.child();
- if (next != Element.PRIORITY)
- {
- throw expectedElement(navigator, Element.PRIORITY);
- }
- Integer priority = parseRequiredContent(navigator, ValueType.INTEGER);
- navigation.setPriority(priority);
-
- next = navigator.sibling();
- if (next == Element.PAGE_NODES)
- {
- for (StaxNavigator<Element> fork: navigator.fork(Element.PAGE_NODES))
- {
- NavigationFragment fragment = new NavigationFragment();
- navigation.addFragment(fragment);
-
- next = fork.child();
- if (next == Element.PARENT_URI)
- {
- String parentUri = fork.getContent();
- if (parentUri == null)
- {
- parentUri = "";
- }
- else if (parentUri.charAt(0) == '/')
- {
- parentUri = parentUri.substring(1, parentUri.length());
- }
- fragment.setParentURI(parentUri);
-
- next = fork.sibling();
- }
-
- if (next == Element.NODE)
- {
- ArrayList<PageNode> nodes = new ArrayList<PageNode>();
- for (StaxNavigator<Element> nodeFork : fork.fork(Element.NODE))
- {
- nodes.add(unmarshalNode(nodeFork));
- }
- fragment.setNodes(nodes);
- }
- else if (next != null)
- {
- throw unknownElement(fork);
- }
- }
- }
- else if (next != null)
- {
- throw expectedElement(navigator, Element.PAGE_NODES);
- }
-
- return navigation;
- }
- else
- {
- throw unknownElement(navigator);
- }
- }
-
- private PageNode unmarshalNode(StaxNavigator<Element> navigator) throws StaxNavException
- {
- PageNode node = new PageNode();
- I18NString labels = new I18NString();
- ArrayList<PageNode> children = new ArrayList<PageNode>();
-
- Element current = navigator.child();
- while (current != null)
- {
- switch (navigator.getName())
- {
- case URI: // For backwards compatibility
- current = navigator.sibling();
- break;
- case NAME:
- node.setName(navigator.getContent());
- current = navigator.sibling();
- break;
- case LABEL:
- labels.add(Utils.parseLocalizedString(navigator));
- current = navigator.sibling();
- break;
- case ICON:
- node.setIcon(navigator.getContent());
- current = navigator.sibling();
- break;
- case START_PUBLICATION_DATE:
- node.setStartPublicationDate(navigator.parseContent(ValueType.DATE_TIME));
- current = navigator.sibling();
- break;
- case END_PUBLICATION_DATE:
- node.setEndPublicationDate(navigator.parseContent(ValueType.DATE_TIME));
- current = navigator.sibling();
- break;
- case VISIBILITY:
- node.setVisibility(navigator.parseContent(ValueType.get(Visibility.class)));
- current = navigator.sibling();
- break;
- case PAGE_REFERENCE:
- node.setPageReference(navigator.getContent());
- current = navigator.sibling();
- break;
- case NODE:
- PageNode child = unmarshalNode(navigator.fork());
- children.add(child);
- current = navigator.sibling();
- break;
- case UNKNOWN:
- throw unknownElement(navigator);
- default:
- throw unexpectedElement(navigator);
- }
- }
-
- node.setLabels(labels);
- node.setChildren(children);
-
- return node;
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshaller.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshaller.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshaller.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshaller.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,302 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
+
+import org.exoplatform.portal.config.model.I18NString;
+import org.exoplatform.portal.config.model.LocalizedString;
+import org.exoplatform.portal.config.model.NavigationFragment;
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.Visibility;
+import org.gatein.common.xml.stax.writer.StaxWriter;
+import org.gatein.common.xml.stax.writer.WritableValueTypes;
+import org.gatein.management.api.binding.BindingException;
+import org.gatein.management.api.binding.Marshaller;
+import org.staxnav.StaxNavException;
+import org.staxnav.StaxNavigator;
+import org.staxnav.ValueType;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import static org.gatein.common.xml.stax.navigator.Exceptions.*;
+import static org.gatein.common.xml.stax.navigator.StaxNavUtils.*;
+import static org.gatein.common.xml.stax.writer.StaxWriterUtils.*;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class NavigationMarshaller implements Marshaller<PageNavigation>
+{
+
+ @Override
+ public void marshal(PageNavigation navigation, OutputStream outputStream) throws BindingException
+ {
+ try
+ {
+ StaxWriter<Element> writer = createWriter(Element.class, outputStream);
+ marshalNavigation(writer, navigation);
+ }
+ catch (StaxNavException e)
+ {
+ throw new BindingException(e);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new BindingException(e);
+ }
+ }
+
+ @Override
+ public PageNavigation unmarshal(InputStream is) throws BindingException
+ {
+ try
+ {
+ StaxNavigator<Element> navigator = createNavigator(Element.class, Element.UNKNOWN, is);
+ return unmarshalNavigation(navigator);
+ }
+ catch (StaxNavException e)
+ {
+ throw new BindingException(e);
+ }
+ }
+
+ private void marshalNavigation(StaxWriter<Element> writer, PageNavigation navigation) throws XMLStreamException
+ {
+ writer.writeStartElement(Element.NODE_NAVIGATION);
+
+ // Write gatein_objects xml namespace
+ Utils.writeGateinObjectsNamespace(writer);
+
+ // Priority
+ writer.writeElement(Element.PRIORITY, WritableValueTypes.INTEGER, navigation.getPriority());
+
+ // Page nodes
+ writer.writeStartElement(Element.PAGE_NODES);
+ ArrayList<NavigationFragment> fragments = navigation.getFragments();
+ for (NavigationFragment fragment : fragments)
+ {
+ if (fragment.getParentURI() != null)
+ {
+ String parentUri = fragment.getParentURI();
+ writeOptionalElement(writer, Element.PARENT_URI, parentUri);
+ }
+
+ Collection<PageNode> nodes = fragment.getNodes();
+ if (nodes != null && !nodes.isEmpty())
+ {
+ for (PageNode node : nodes)
+ {
+ marshallNode(writer, node);
+ }
+ }
+ }
+
+ writer.writeEndElement().writeEndElement(); // End page-nodes and node-navigation
+ }
+
+ public void marshallNode(StaxWriter<Element> writer, PageNode node) throws XMLStreamException
+ {
+ writer.writeStartElement(Element.NODE);
+ writer.writeElement(Element.NAME, node.getName());
+
+ if (node.getLabels() != null)
+ {
+ for (LocalizedString label : node.getLabels())
+ {
+ writer.writeStartElement(Element.LABEL);
+ if (label.getLang() != null)
+ {
+ String localeString = label.getLang().getLanguage();
+ if (localeString == null)
+ {
+ throw new XMLStreamException("Language was null for locale " + label.getLang());
+ }
+ String country = label.getLang().getCountry();
+ if (country != null && country.length() > 0)
+ {
+ localeString += "-" + country.toLowerCase();
+ }
+
+ writer.writeAttribute(new QName(XMLConstants.XML_NS_URI, "lang", XMLConstants.XML_NS_PREFIX), localeString);
+ }
+ writer.writeContent(label.getValue()).writeEndElement();
+ }
+ }
+
+ writeOptionalElement(writer, Element.ICON, node.getIcon());
+
+ writeOptionalElement(writer, Element.START_PUBLICATION_DATE, WritableValueTypes.DATE_TIME, node.getStartPublicationDate());
+ writeOptionalElement(writer, Element.END_PUBLICATION_DATE, WritableValueTypes.DATE_TIME, node.getEndPublicationDate());
+
+ String visibility = (node.getVisibility() == null) ? null : node.getVisibility().name();
+ writeOptionalElement(writer, Element.VISIBILITY, visibility);
+ writeOptionalElement(writer, Element.PAGE_REFERENCE, node.getPageReference());
+
+ // Marshall children
+ List<PageNode> children = node.getNodes();
+ if (children != null && !children.isEmpty())
+ {
+ for (PageNode child : children)
+ {
+ marshallNode(writer, child);
+ }
+ }
+
+ writer.writeEndElement(); // End of node
+ }
+
+ private PageNavigation unmarshalNavigation(StaxNavigator<Element> navigator) throws StaxNavException
+ {
+ PageNavigation navigation = new PageNavigation();
+
+ if (navigator.getName() == Element.NODE_NAVIGATION)
+ {
+ Element next = navigator.child();
+ if (next != Element.PRIORITY)
+ {
+ throw expectedElement(navigator, Element.PRIORITY);
+ }
+ Integer priority = parseRequiredContent(navigator, ValueType.INTEGER);
+ navigation.setPriority(priority);
+
+ next = navigator.sibling();
+ if (next == Element.PAGE_NODES)
+ {
+ for (StaxNavigator<Element> fork: navigator.fork(Element.PAGE_NODES))
+ {
+ NavigationFragment fragment = new NavigationFragment();
+ navigation.addFragment(fragment);
+
+ next = fork.child();
+ if (next == Element.PARENT_URI)
+ {
+ String parentUri = fork.getContent();
+ if (parentUri == null)
+ {
+ parentUri = "";
+ }
+ else if (parentUri.charAt(0) == '/')
+ {
+ parentUri = parentUri.substring(1, parentUri.length());
+ }
+ fragment.setParentURI(parentUri);
+
+ next = fork.sibling();
+ }
+
+ if (next == Element.NODE)
+ {
+ ArrayList<PageNode> nodes = new ArrayList<PageNode>();
+ for (StaxNavigator<Element> nodeFork : fork.fork(Element.NODE))
+ {
+ nodes.add(unmarshalNode(nodeFork));
+ }
+ fragment.setNodes(nodes);
+ }
+ else if (next != null)
+ {
+ throw unknownElement(fork);
+ }
+ }
+ }
+ else if (next != null)
+ {
+ throw expectedElement(navigator, Element.PAGE_NODES);
+ }
+
+ return navigation;
+ }
+ else
+ {
+ throw unknownElement(navigator);
+ }
+ }
+
+ private PageNode unmarshalNode(StaxNavigator<Element> navigator) throws StaxNavException
+ {
+ PageNode node = new PageNode();
+ I18NString labels = new I18NString();
+ ArrayList<PageNode> children = new ArrayList<PageNode>();
+
+ Element current = navigator.child();
+ while (current != null)
+ {
+ switch (navigator.getName())
+ {
+ case URI: // For backwards compatibility
+ current = navigator.sibling();
+ break;
+ case NAME:
+ node.setName(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case LABEL:
+ labels.add(Utils.parseLocalizedString(navigator));
+ current = navigator.sibling();
+ break;
+ case ICON:
+ node.setIcon(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case START_PUBLICATION_DATE:
+ node.setStartPublicationDate(navigator.parseContent(ValueType.DATE_TIME));
+ current = navigator.sibling();
+ break;
+ case END_PUBLICATION_DATE:
+ node.setEndPublicationDate(navigator.parseContent(ValueType.DATE_TIME));
+ current = navigator.sibling();
+ break;
+ case VISIBILITY:
+ node.setVisibility(navigator.parseContent(ValueType.get(Visibility.class)));
+ current = navigator.sibling();
+ break;
+ case PAGE_REFERENCE:
+ node.setPageReference(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case NODE:
+ PageNode child = unmarshalNode(navigator.fork());
+ children.add(child);
+ current = navigator.sibling();
+ break;
+ case UNKNOWN:
+ throw unknownElement(navigator);
+ default:
+ throw unexpectedElement(navigator);
+ }
+ }
+
+ node.setLabels(labels);
+ node.setChildren(children);
+
+ return node;
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshaller.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshaller.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshaller.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,220 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
-
-import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.config.model.Page;
-import org.gatein.common.xml.stax.writer.StaxWriter;
-import org.gatein.common.xml.stax.writer.WritableValueTypes;
-import org.gatein.management.api.binding.BindingException;
-import org.staxnav.StaxNavException;
-import org.staxnav.StaxNavigator;
-import org.staxnav.ValueType;
-
-import javax.xml.stream.XMLStreamException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.gatein.common.xml.stax.navigator.Exceptions.*;
-import static org.gatein.common.xml.stax.navigator.StaxNavUtils.*;
-import static org.gatein.common.xml.stax.writer.StaxWriterUtils.*;
-
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class PageMarshaller extends AbstractMarshaller<Page.PageSet>
-{
- @Override
- public void marshal(Page.PageSet pageSet, OutputStream outputStream) throws BindingException
- {
- try
- {
- StaxWriter<Element> writer = createWriter(Element.class, outputStream);
-
- writer.writeStartElement(Element.PAGE_SET);
- writeGateinObjectsNamespace(writer);
-
- // Marshal pages
- for (Page page : pageSet.getPages())
- {
- marshalPage(writer, page);
- }
-
- writer.finish();
- }
- catch (StaxNavException e)
- {
- throw new BindingException(e);
- }
- catch (XMLStreamException e)
- {
- throw new BindingException(e);
- }
- }
-
- @Override
- public Page.PageSet unmarshal(InputStream inputStream) throws BindingException
- {
- try
- {
- StaxNavigator<Element> navigator = createNavigator(Element.class, Element.UNKNOWN, inputStream);
- if (navigator.getName() == Element.PAGE_SET)
- {
- ArrayList<Page> pages = new ArrayList<Page>();
- Element next = navigator.child();
- if (next == Element.PAGE)
- {
- for (StaxNavigator<Element> fork : navigator.fork(Element.PAGE))
- {
- pages.add(unmarshalPage(fork));
- }
- }
- else if (next != null)
- {
- throw unexpectedElement(navigator);
- }
-
- //Seems like next should be null here...
- if (navigator.sibling() != null)
- {
- throw unexpectedElement(navigator);
- }
-
- Page.PageSet pageSet = new Page.PageSet();
- pageSet.setPages(pages);
-
- return pageSet;
- }
- else
- {
- throw unknownElement(navigator);
- }
- }
- catch (StaxNavException e)
- {
- throw new BindingException(e);
- }
- catch (XMLStreamException e)
- {
- throw new BindingException(e);
- }
- }
-
- private void marshalPage(StaxWriter<Element> writer, Page page) throws XMLStreamException
- {
- writer.writeStartElement(Element.PAGE);
-
- // name, title description
- writer.writeElement(Element.NAME, page.getName());
- writeOptionalElement(writer, Element.TITLE, page.getTitle());
- writeOptionalElement(writer, Element.DESCRIPTION, page.getDescription());
-
- // Access/Edit permissions
- marshalAccessPermissions(writer, page.getAccessPermissions());
- marshalEditPermission(writer, page.getEditPermission());
-
- writeOptionalElement(writer, Element.SHOW_MAX_WINDOW, WritableValueTypes.BOOLEAN, page.isShowMaxWindow());
-
- List<ModelObject> children = page.getChildren();
- for (ModelObject child : children)
- {
- marshalModelObject(writer, child);
- }
-
- writer.writeEndElement(); // End of page element
- }
-
- private Page unmarshalPage(StaxNavigator<Element> navigator) throws XMLStreamException
- {
- requiresChild(navigator, Element.NAME);
- String name = getRequiredContent(navigator, true);
-
- Page page = new Page();
- page.setName(name);
-
- //TODO: Need valid way to ensure a sequence of xml elements, with a mix of required and optional elements.
- Element current = navigator.sibling();
- while (current != null)
- {
- switch (current)
- {
- case TITLE:
- page.setTitle(getContent(navigator, false));
- current = navigator.sibling();
- break;
- case DESCRIPTION:
- page.setDescription(getContent(navigator, false));
- current = navigator.sibling();
- break;
- case ACCESS_PERMISSIONS:
- page.setAccessPermissions(unmarshalAccessPermissions(navigator, true));
- current = navigator.sibling();
- break;
- case EDIT_PERMISSION:
- page.setEditPermission(unmarshalEditPermission(navigator));
- current = navigator.sibling();
- break;
- case SHOW_MAX_WINDOW:
- page.setShowMaxWindow(parseRequiredContent(navigator, ValueType.BOOLEAN));
- current = navigator.sibling();
- break;
- case CONTAINER:
- if (page.getChildren() == null)
- {
- page.setChildren(new ArrayList<ModelObject>());
- }
- page.getChildren().add(unmarshalContainer(navigator.fork()));
- current = navigator.sibling();
- break;
- case PORTLET_APPLICATION:
- if (page.getChildren() == null)
- {
- page.setChildren(new ArrayList<ModelObject>());
- }
- page.getChildren().add(unmarshalPortletApplication(navigator.fork()));
- current = navigator.sibling();
- break;
- case GADGET_APPLICATION:
- if (page.getChildren() == null)
- {
- page.setChildren(new ArrayList<ModelObject>());
- }
- page.getChildren().add(unmarshalGadgetApplication(navigator.fork()));
- current = navigator.sibling();
- break;
- case UNKNOWN:
- throw unknownElement(navigator);
- default:
- throw unexpectedElement(navigator);
- }
- }
- //TODO: We should raise this exception as soon as we know so location is accurate
- if (page.getAccessPermissions() == null) throw expectedElement(navigator, Element.ACCESS_PERMISSIONS);
-
- return page;
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshaller.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshaller.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshaller.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshaller.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,220 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
+
+import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.model.Page;
+import org.gatein.common.xml.stax.writer.StaxWriter;
+import org.gatein.common.xml.stax.writer.WritableValueTypes;
+import org.gatein.management.api.binding.BindingException;
+import org.staxnav.StaxNavException;
+import org.staxnav.StaxNavigator;
+import org.staxnav.ValueType;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.gatein.common.xml.stax.navigator.Exceptions.*;
+import static org.gatein.common.xml.stax.navigator.StaxNavUtils.*;
+import static org.gatein.common.xml.stax.writer.StaxWriterUtils.*;
+
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class PageMarshaller extends AbstractMarshaller<Page.PageSet>
+{
+ @Override
+ public void marshal(Page.PageSet pageSet, OutputStream outputStream) throws BindingException
+ {
+ try
+ {
+ StaxWriter<Element> writer = createWriter(Element.class, outputStream);
+
+ writer.writeStartElement(Element.PAGE_SET);
+ writeGateinObjectsNamespace(writer);
+
+ // Marshal pages
+ for (Page page : pageSet.getPages())
+ {
+ marshalPage(writer, page);
+ }
+
+ writer.finish();
+ }
+ catch (StaxNavException e)
+ {
+ throw new BindingException(e);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new BindingException(e);
+ }
+ }
+
+ @Override
+ public Page.PageSet unmarshal(InputStream inputStream) throws BindingException
+ {
+ try
+ {
+ StaxNavigator<Element> navigator = createNavigator(Element.class, Element.UNKNOWN, inputStream);
+ if (navigator.getName() == Element.PAGE_SET)
+ {
+ ArrayList<Page> pages = new ArrayList<Page>();
+ Element next = navigator.child();
+ if (next == Element.PAGE)
+ {
+ for (StaxNavigator<Element> fork : navigator.fork(Element.PAGE))
+ {
+ pages.add(unmarshalPage(fork));
+ }
+ }
+ else if (next != null)
+ {
+ throw unexpectedElement(navigator);
+ }
+
+ //Seems like next should be null here...
+ if (navigator.sibling() != null)
+ {
+ throw unexpectedElement(navigator);
+ }
+
+ Page.PageSet pageSet = new Page.PageSet();
+ pageSet.setPages(pages);
+
+ return pageSet;
+ }
+ else
+ {
+ throw unknownElement(navigator);
+ }
+ }
+ catch (StaxNavException e)
+ {
+ throw new BindingException(e);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new BindingException(e);
+ }
+ }
+
+ private void marshalPage(StaxWriter<Element> writer, Page page) throws XMLStreamException
+ {
+ writer.writeStartElement(Element.PAGE);
+
+ // name, title description
+ writer.writeElement(Element.NAME, page.getName());
+ writeOptionalElement(writer, Element.TITLE, page.getTitle());
+ writeOptionalElement(writer, Element.DESCRIPTION, page.getDescription());
+
+ // Access/Edit permissions
+ marshalAccessPermissions(writer, page.getAccessPermissions());
+ marshalEditPermission(writer, page.getEditPermission());
+
+ writeOptionalElement(writer, Element.SHOW_MAX_WINDOW, WritableValueTypes.BOOLEAN, page.isShowMaxWindow());
+
+ List<ModelObject> children = page.getChildren();
+ for (ModelObject child : children)
+ {
+ marshalModelObject(writer, child);
+ }
+
+ writer.writeEndElement(); // End of page element
+ }
+
+ private Page unmarshalPage(StaxNavigator<Element> navigator) throws XMLStreamException
+ {
+ requiresChild(navigator, Element.NAME);
+ String name = getRequiredContent(navigator, true);
+
+ Page page = new Page();
+ page.setName(name);
+
+ //TODO: Need valid way to ensure a sequence of xml elements, with a mix of required and optional elements.
+ Element current = navigator.sibling();
+ while (current != null)
+ {
+ switch (current)
+ {
+ case TITLE:
+ page.setTitle(getContent(navigator, false));
+ current = navigator.sibling();
+ break;
+ case DESCRIPTION:
+ page.setDescription(getContent(navigator, false));
+ current = navigator.sibling();
+ break;
+ case ACCESS_PERMISSIONS:
+ page.setAccessPermissions(unmarshalAccessPermissions(navigator, true));
+ current = navigator.sibling();
+ break;
+ case EDIT_PERMISSION:
+ page.setEditPermission(unmarshalEditPermission(navigator));
+ current = navigator.sibling();
+ break;
+ case SHOW_MAX_WINDOW:
+ page.setShowMaxWindow(parseRequiredContent(navigator, ValueType.BOOLEAN));
+ current = navigator.sibling();
+ break;
+ case CONTAINER:
+ if (page.getChildren() == null)
+ {
+ page.setChildren(new ArrayList<ModelObject>());
+ }
+ page.getChildren().add(unmarshalContainer(navigator.fork()));
+ current = navigator.sibling();
+ break;
+ case PORTLET_APPLICATION:
+ if (page.getChildren() == null)
+ {
+ page.setChildren(new ArrayList<ModelObject>());
+ }
+ page.getChildren().add(unmarshalPortletApplication(navigator.fork()));
+ current = navigator.sibling();
+ break;
+ case GADGET_APPLICATION:
+ if (page.getChildren() == null)
+ {
+ page.setChildren(new ArrayList<ModelObject>());
+ }
+ page.getChildren().add(unmarshalGadgetApplication(navigator.fork()));
+ current = navigator.sibling();
+ break;
+ case UNKNOWN:
+ throw unknownElement(navigator);
+ default:
+ throw unexpectedElement(navigator);
+ }
+ }
+ //TODO: We should raise this exception as soon as we know so location is accurate
+ if (page.getAccessPermissions() == null) throw expectedElement(navigator, Element.ACCESS_PERMISSIONS);
+
+ return page;
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshaller.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshaller.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshaller.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,292 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
-
-import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.config.model.PageBody;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.config.model.Properties;
-import org.gatein.common.xml.stax.navigator.StaxNavUtils;
-import org.gatein.common.xml.stax.writer.StaxWriter;
-import org.gatein.management.api.binding.BindingException;
-import org.staxnav.Axis;
-import org.staxnav.StaxNavException;
-import org.staxnav.StaxNavigator;
-
-import javax.xml.stream.XMLStreamException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.List;
-import java.util.Map;
-
-import static org.gatein.common.xml.stax.navigator.Exceptions.*;
-import static org.gatein.common.xml.stax.navigator.StaxNavUtils.*;
-import static org.gatein.common.xml.stax.writer.StaxWriterUtils.*;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class SiteLayoutMarshaller extends AbstractMarshaller<PortalConfig>
-{
- @Override
- public void marshal(PortalConfig object, OutputStream outputStream) throws BindingException
- {
- try
- {
- StaxWriter<Element> writer = createWriter(Element.class, outputStream);
-
- // root element
- writer.writeStartElement(Element.PORTAL_CONFIG);
- writeGateinObjectsNamespace(writer);
-
- marshalPortalConfig(writer, object);
-
- writer.finish();
- }
- catch (StaxNavException e)
- {
- throw new BindingException(e);
- }
- catch (XMLStreamException e)
- {
- throw new BindingException(e);
- }
- }
-
- @Override
- public PortalConfig unmarshal(InputStream is) throws BindingException
- {
- try
- {
- StaxNavigator<Element> navigator = StaxNavUtils.createNavigator(Element.class, Element.UNKNOWN, is);
-
- if (navigator.getName() == Element.PORTAL_CONFIG)
- {
- return unmarshalPortalConfig(navigator);
- }
- else
- {
- throw unknownElement(navigator);
- }
- }
- catch (StaxNavException e)
- {
- throw new BindingException(e);
- }
- catch (XMLStreamException e)
- {
- throw new BindingException(e);
- }
- }
-
- private void marshalPortalConfig(StaxWriter<Element> writer, PortalConfig portalConfig) throws XMLStreamException
- {
- writer.writeElement(Element.PORTAL_NAME, portalConfig.getName());
- writeOptionalElement(writer, Element.LABEL, portalConfig.getLabel());
- writeOptionalElement(writer, Element.DESCRIPTION, portalConfig.getDescription());
- writeOptionalElement(writer, Element.LOCALE, portalConfig.getLocale());
-
- // Access permissions
- marshalAccessPermissions(writer, portalConfig.getAccessPermissions());
-
- // Edit permission
- marshalEditPermission(writer, portalConfig.getEditPermission());
-
- writeOptionalElement(writer, Element.SKIN, portalConfig.getSkin());
-
- boolean propertiesWritten = false;
- Map<String, String> properties = portalConfig.getProperties();
- if (properties != null)
- {
- for (String key : properties.keySet())
- {
- if (!propertiesWritten)
- {
- writer.writeStartElement(Element.PROPERTIES);
- propertiesWritten = true;
- }
- String value = properties.get(key);
- if (value != null)
- {
- writer.writeStartElement(Element.PROPERTIES_ENTRY);
- writer.writeAttribute(Attribute.PROPERTIES_KEY.getLocalName(), key);
- writer.writeContent(value).writeEndElement();
- }
- }
- if (propertiesWritten)
- {
- writer.writeEndElement();
- }
- }
-
- Container container = portalConfig.getPortalLayout();
- if (container != null)
- {
- writer.writeStartElement(Element.PORTAL_LAYOUT);
- List<ModelObject> children = container.getChildren();
- if (children != null && !children.isEmpty())
- {
- for (ModelObject child : children)
- {
- marshalModelObject(writer, child);
- }
- }
- writer.writeEndElement();
- }
- }
-
- private PortalConfig unmarshalPortalConfig(StaxNavigator<Element> navigator) throws XMLStreamException
- {
- PortalConfig portalConfig = new PortalConfig();
-
- Container portalLayout = null;
- Element current = navigator.child();
- while (current != null)
- {
- switch (current)
- {
- case PORTAL_NAME:
- portalConfig.setName(navigator.getContent());
- current = navigator.sibling();
- break;
- case LOCALE:
- portalConfig.setLocale(navigator.getContent());
- current = navigator.sibling();
- break;
- case LABEL:
- portalConfig.setLabel(navigator.getContent());
- current = navigator.sibling();
- break;
- case DESCRIPTION:
- portalConfig.setDescription(navigator.getContent());
- current = navigator.sibling();
- break;
- case SKIN:
- portalConfig.setSkin(navigator.getContent());
- current = navigator.sibling();
- break;
- case PROPERTIES:
- Properties properties = new Properties();
- if (navigator.navigate(Axis.CHILD, Element.PROPERTIES_ENTRY))
- {
- for (StaxNavigator<Element> fork : navigator.fork(Element.PROPERTIES_ENTRY))
- {
- String key = getRequiredAttribute(fork, Attribute.PROPERTIES_KEY.getLocalName());
- String value = getRequiredContent(fork, false);
- properties.put(key, value);
- }
- }
- else
- {
- throw expectedElement(navigator, Element.PROPERTIES_ENTRY);
- }
- portalConfig.setProperties(properties);
- current = navigator.next();
- break;
- case ACCESS_PERMISSIONS:
- portalConfig.setAccessPermissions(unmarshalAccessPermissions(navigator, false));
- current = navigator.sibling();
- break;
- case EDIT_PERMISSION:
- portalConfig.setEditPermission(unmarshalEditPermission(navigator));
- current = navigator.sibling();
- break;
- case PORTAL_LAYOUT:
- portalLayout = new Container();
- current = navigator.child();
- break;
- case PAGE_BODY:
- if (portalLayout == null)
- {
- throw expectedElement(navigator, Element.PORTAL_LAYOUT);
- }
- portalLayout.getChildren().add(new PageBody());
- current = navigator.sibling();
- break;
- case PORTLET_APPLICATION:
- if (portalLayout == null)
- {
- throw expectedElement(navigator, Element.PORTAL_LAYOUT);
- }
- portalLayout.getChildren().add(unmarshalPortletApplication(navigator.fork()));
- current = navigator.sibling();
- break;
- case GADGET_APPLICATION:
- if (portalLayout == null)
- {
- throw expectedElement(navigator, Element.PORTAL_LAYOUT);
- }
- portalLayout.getChildren().add(unmarshalGadgetApplication(navigator.fork()));
- current = navigator.sibling();
- break;
- case CONTAINER:
- if (portalLayout == null)
- {
- throw expectedElement(navigator, Element.PORTAL_LAYOUT);
- }
- portalLayout.getChildren().add(unmarshalContainer(navigator.fork()));
- current = navigator.sibling();
- break;
- case UNKNOWN:
- throw unknownElement(navigator);
- default:
- throw unexpectedElement(navigator);
- }
- }
-
- //TODO: We should raise this exception as soon as we know so location is accurate
- if (portalConfig.getAccessPermissions() == null) throw expectedElement(navigator, Element.ACCESS_PERMISSIONS);
- if (portalLayout == null)
- {
- portalLayout = PortalConfig.DEFAULT_LAYOUT;
- }
-
- portalConfig.setPortalLayout(portalLayout);
-
- return portalConfig;
- }
-
- private static enum Attribute
- {
- PROPERTIES_KEY("key");
-
- private final String name;
-
- Attribute(final String name)
- {
- this.name = name;
- }
-
- /**
- * Get the local name of this element.
- *
- * @return the local name
- */
- public String getLocalName()
- {
- return name;
- }
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshaller.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshaller.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshaller.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshaller.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,292 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
+
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.model.PageBody;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.Properties;
+import org.gatein.common.xml.stax.navigator.StaxNavUtils;
+import org.gatein.common.xml.stax.writer.StaxWriter;
+import org.gatein.management.api.binding.BindingException;
+import org.staxnav.Axis;
+import org.staxnav.StaxNavException;
+import org.staxnav.StaxNavigator;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+import java.util.Map;
+
+import static org.gatein.common.xml.stax.navigator.Exceptions.*;
+import static org.gatein.common.xml.stax.navigator.StaxNavUtils.*;
+import static org.gatein.common.xml.stax.writer.StaxWriterUtils.*;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class SiteLayoutMarshaller extends AbstractMarshaller<PortalConfig>
+{
+ @Override
+ public void marshal(PortalConfig object, OutputStream outputStream) throws BindingException
+ {
+ try
+ {
+ StaxWriter<Element> writer = createWriter(Element.class, outputStream);
+
+ // root element
+ writer.writeStartElement(Element.PORTAL_CONFIG);
+ writeGateinObjectsNamespace(writer);
+
+ marshalPortalConfig(writer, object);
+
+ writer.finish();
+ }
+ catch (StaxNavException e)
+ {
+ throw new BindingException(e);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new BindingException(e);
+ }
+ }
+
+ @Override
+ public PortalConfig unmarshal(InputStream is) throws BindingException
+ {
+ try
+ {
+ StaxNavigator<Element> navigator = StaxNavUtils.createNavigator(Element.class, Element.UNKNOWN, is);
+
+ if (navigator.getName() == Element.PORTAL_CONFIG)
+ {
+ return unmarshalPortalConfig(navigator);
+ }
+ else
+ {
+ throw unknownElement(navigator);
+ }
+ }
+ catch (StaxNavException e)
+ {
+ throw new BindingException(e);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new BindingException(e);
+ }
+ }
+
+ private void marshalPortalConfig(StaxWriter<Element> writer, PortalConfig portalConfig) throws XMLStreamException
+ {
+ writer.writeElement(Element.PORTAL_NAME, portalConfig.getName());
+ writeOptionalElement(writer, Element.LABEL, portalConfig.getLabel());
+ writeOptionalElement(writer, Element.DESCRIPTION, portalConfig.getDescription());
+ writeOptionalElement(writer, Element.LOCALE, portalConfig.getLocale());
+
+ // Access permissions
+ marshalAccessPermissions(writer, portalConfig.getAccessPermissions());
+
+ // Edit permission
+ marshalEditPermission(writer, portalConfig.getEditPermission());
+
+ writeOptionalElement(writer, Element.SKIN, portalConfig.getSkin());
+
+ boolean propertiesWritten = false;
+ Map<String, String> properties = portalConfig.getProperties();
+ if (properties != null)
+ {
+ for (String key : properties.keySet())
+ {
+ if (!propertiesWritten)
+ {
+ writer.writeStartElement(Element.PROPERTIES);
+ propertiesWritten = true;
+ }
+ String value = properties.get(key);
+ if (value != null)
+ {
+ writer.writeStartElement(Element.PROPERTIES_ENTRY);
+ writer.writeAttribute(Attribute.PROPERTIES_KEY.getLocalName(), key);
+ writer.writeContent(value).writeEndElement();
+ }
+ }
+ if (propertiesWritten)
+ {
+ writer.writeEndElement();
+ }
+ }
+
+ Container container = portalConfig.getPortalLayout();
+ if (container != null)
+ {
+ writer.writeStartElement(Element.PORTAL_LAYOUT);
+ List<ModelObject> children = container.getChildren();
+ if (children != null && !children.isEmpty())
+ {
+ for (ModelObject child : children)
+ {
+ marshalModelObject(writer, child);
+ }
+ }
+ writer.writeEndElement();
+ }
+ }
+
+ private PortalConfig unmarshalPortalConfig(StaxNavigator<Element> navigator) throws XMLStreamException
+ {
+ PortalConfig portalConfig = new PortalConfig();
+
+ Container portalLayout = null;
+ Element current = navigator.child();
+ while (current != null)
+ {
+ switch (current)
+ {
+ case PORTAL_NAME:
+ portalConfig.setName(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case LOCALE:
+ portalConfig.setLocale(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case LABEL:
+ portalConfig.setLabel(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case DESCRIPTION:
+ portalConfig.setDescription(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case SKIN:
+ portalConfig.setSkin(navigator.getContent());
+ current = navigator.sibling();
+ break;
+ case PROPERTIES:
+ Properties properties = new Properties();
+ if (navigator.navigate(Axis.CHILD, Element.PROPERTIES_ENTRY))
+ {
+ for (StaxNavigator<Element> fork : navigator.fork(Element.PROPERTIES_ENTRY))
+ {
+ String key = getRequiredAttribute(fork, Attribute.PROPERTIES_KEY.getLocalName());
+ String value = getRequiredContent(fork, false);
+ properties.put(key, value);
+ }
+ }
+ else
+ {
+ throw expectedElement(navigator, Element.PROPERTIES_ENTRY);
+ }
+ portalConfig.setProperties(properties);
+ current = navigator.next();
+ break;
+ case ACCESS_PERMISSIONS:
+ portalConfig.setAccessPermissions(unmarshalAccessPermissions(navigator, false));
+ current = navigator.sibling();
+ break;
+ case EDIT_PERMISSION:
+ portalConfig.setEditPermission(unmarshalEditPermission(navigator));
+ current = navigator.sibling();
+ break;
+ case PORTAL_LAYOUT:
+ portalLayout = new Container();
+ current = navigator.child();
+ break;
+ case PAGE_BODY:
+ if (portalLayout == null)
+ {
+ throw expectedElement(navigator, Element.PORTAL_LAYOUT);
+ }
+ portalLayout.getChildren().add(new PageBody());
+ current = navigator.sibling();
+ break;
+ case PORTLET_APPLICATION:
+ if (portalLayout == null)
+ {
+ throw expectedElement(navigator, Element.PORTAL_LAYOUT);
+ }
+ portalLayout.getChildren().add(unmarshalPortletApplication(navigator.fork()));
+ current = navigator.sibling();
+ break;
+ case GADGET_APPLICATION:
+ if (portalLayout == null)
+ {
+ throw expectedElement(navigator, Element.PORTAL_LAYOUT);
+ }
+ portalLayout.getChildren().add(unmarshalGadgetApplication(navigator.fork()));
+ current = navigator.sibling();
+ break;
+ case CONTAINER:
+ if (portalLayout == null)
+ {
+ throw expectedElement(navigator, Element.PORTAL_LAYOUT);
+ }
+ portalLayout.getChildren().add(unmarshalContainer(navigator.fork()));
+ current = navigator.sibling();
+ break;
+ case UNKNOWN:
+ throw unknownElement(navigator);
+ default:
+ throw unexpectedElement(navigator);
+ }
+ }
+
+ //TODO: We should raise this exception as soon as we know so location is accurate
+ if (portalConfig.getAccessPermissions() == null) throw expectedElement(navigator, Element.ACCESS_PERMISSIONS);
+ if (portalLayout == null)
+ {
+ portalLayout = PortalConfig.DEFAULT_LAYOUT;
+ }
+
+ portalConfig.setPortalLayout(portalLayout);
+
+ return portalConfig;
+ }
+
+ private static enum Attribute
+ {
+ PROPERTIES_KEY("key");
+
+ private final String name;
+
+ Attribute(final String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Get the local name of this element.
+ *
+ * @return the local name
+ */
+ public String getLocalName()
+ {
+ return name;
+ }
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Utils.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Utils.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Utils.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,91 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
-
-import org.exoplatform.portal.config.model.LocalizedString;
-import org.gatein.common.xml.stax.navigator.StaxNavUtils;
-import org.gatein.common.xml.stax.writer.StaxWriter;
-import org.staxnav.StaxNavException;
-import org.staxnav.StaxNavigator;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import java.util.Locale;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-class Utils
-{
- private static final Pattern XMLLANG_PATTERN = Pattern.compile("^([a-zA-Z]{2})(?:-([a-zA-Z]{2}))?$");
-
- public static <N> void writeGateinObjectsNamespace(StaxWriter<N> writer) throws XMLStreamException
- {
- String gatein_object_ns = Namespace.CURRENT.getUri();
- String location = new StringBuilder().append(gatein_object_ns).append(" ").append(gatein_object_ns).toString();
-
- writer.writeDefaultNamespace(gatein_object_ns);
- writer.writeNamespace("xsi", XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
- writer.writeAttribute(new QName(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "schemaLocation"), location);
- }
-
- public static <N> LocalizedString parseLocalizedString(StaxNavigator<N> navigator) throws StaxNavException
- {
- String attribute = navigator.getAttribute(new QName(XMLConstants.XML_NS_URI, "lang", XMLConstants.XML_NS_PREFIX));
- if (attribute == null)
- {
- attribute = navigator.getAttribute("lang");
- }
-
- Locale lang = null;
- if (attribute != null)
- {
- Matcher matcher = XMLLANG_PATTERN.matcher(attribute);
- if (matcher.matches())
- {
- String langISO = matcher.group(1);
- String countryISO = matcher.group(2);
- if (countryISO == null)
- {
- lang = new Locale(langISO.toLowerCase());
- }
- else
- {
- lang = new Locale(langISO.toLowerCase(), countryISO.toLowerCase());
- }
- }
- else
- {
- throw new StaxNavException(navigator.getLocation(), "The attribute xml:lang='" + attribute + "' does not represent a valid language pattern (ie: en, en-us).");
- }
- }
-
- String value = StaxNavUtils.getRequiredContent(navigator, false);
-
- return new LocalizedString(value, lang);
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Utils.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Utils.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Utils.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/Utils.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
+
+import org.exoplatform.portal.config.model.LocalizedString;
+import org.gatein.common.xml.stax.navigator.StaxNavUtils;
+import org.gatein.common.xml.stax.writer.StaxWriter;
+import org.staxnav.StaxNavException;
+import org.staxnav.StaxNavigator;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+class Utils
+{
+ private static final Pattern XMLLANG_PATTERN = Pattern.compile("^([a-zA-Z]{2})(?:-([a-zA-Z]{2}))?$");
+
+ public static <N> void writeGateinObjectsNamespace(StaxWriter<N> writer) throws XMLStreamException
+ {
+ String gatein_object_ns = Namespace.CURRENT.getUri();
+ String location = new StringBuilder().append(gatein_object_ns).append(" ").append(gatein_object_ns).toString();
+
+ writer.writeDefaultNamespace(gatein_object_ns);
+ writer.writeNamespace("xsi", XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
+ writer.writeAttribute(new QName(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "schemaLocation"), location);
+ }
+
+ public static <N> LocalizedString parseLocalizedString(StaxNavigator<N> navigator) throws StaxNavException
+ {
+ String attribute = navigator.getAttribute(new QName(XMLConstants.XML_NS_URI, "lang", XMLConstants.XML_NS_PREFIX));
+ if (attribute == null)
+ {
+ attribute = navigator.getAttribute("lang");
+ }
+
+ Locale lang = null;
+ if (attribute != null)
+ {
+ Matcher matcher = XMLLANG_PATTERN.matcher(attribute);
+ if (matcher.matches())
+ {
+ String langISO = matcher.group(1);
+ String countryISO = matcher.group(2);
+ if (countryISO == null)
+ {
+ lang = new Locale(langISO.toLowerCase());
+ }
+ else
+ {
+ lang = new Locale(langISO.toLowerCase(), countryISO.toLowerCase());
+ }
+ }
+ else
+ {
+ throw new StaxNavException(navigator.getLocation(), "The attribute xml:lang='" + attribute + "' does not represent a valid language pattern (ie: en, en-us).");
+ }
+ }
+
+ String value = StaxNavUtils.getRequiredContent(navigator, false);
+
+ return new LocalizedString(value, lang);
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/AbstractExportTask.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/AbstractExportTask.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/AbstractExportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
-
-import org.exoplatform.portal.mop.SiteKey;
-import org.gatein.management.api.operation.model.ExportTask;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public abstract class AbstractExportTask implements ExportTask
-{
- protected SiteKey siteKey;
-
- protected AbstractExportTask(SiteKey siteKey)
- {
- this.siteKey = siteKey;
- }
-
- @Override
- public String getEntry()
- {
- String siteType = siteKey.getTypeName();
-
- String siteName = siteKey.getName();
- if (siteName.charAt(0) == '/') siteName = siteName.substring(1, siteName.length());
-
- return new StringBuilder().
- append(siteType).append("/").append(siteName).append("/").append(getXmlFileName()).toString();
- }
-
- protected abstract String getXmlFileName();
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/AbstractExportTask.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/AbstractExportTask.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/AbstractExportTask.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/AbstractExportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.gatein.management.api.operation.model.ExportTask;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public abstract class AbstractExportTask implements ExportTask
+{
+ protected SiteKey siteKey;
+
+ protected AbstractExportTask(SiteKey siteKey)
+ {
+ this.siteKey = siteKey;
+ }
+
+ @Override
+ public String getEntry()
+ {
+ String siteType = siteKey.getTypeName();
+
+ String siteName = siteKey.getName();
+ if (siteName.charAt(0) == '/') siteName = siteName.substring(1, siteName.length());
+
+ return new StringBuilder().
+ append(siteType).append("/").append(siteName).append("/").append(getXmlFileName()).toString();
+ }
+
+ protected abstract String getXmlFileName();
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/AbstractImportTask.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/AbstractImportTask.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/AbstractImportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
-
-import org.exoplatform.portal.mop.SiteKey;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public abstract class AbstractImportTask<T> extends ImportTask<T>
-{
- protected final SiteKey siteKey;
-
- public AbstractImportTask(T data, SiteKey siteKey)
- {
- super(data);
- this.siteKey = siteKey;
- }
-
- public SiteKey getSiteKey()
- {
- return siteKey;
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/AbstractImportTask.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/AbstractImportTask.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/AbstractImportTask.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/AbstractImportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
+
+import org.exoplatform.portal.mop.SiteKey;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public abstract class AbstractImportTask<T> extends ImportTask<T>
+{
+ protected final SiteKey siteKey;
+
+ public AbstractImportTask(T data, SiteKey siteKey)
+ {
+ super(data);
+ this.siteKey = siteKey;
+ }
+
+ public SiteKey getSiteKey()
+ {
+ return siteKey;
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/ImportStrategy.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/ImportStrategy.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/ImportStrategy.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public enum ImportStrategy
-{
- /**
- * Import when data does not exist. Otherwise do nothing.
- */
- CONSERVE("conserve"),
-
- /**
- * Import when data does not exist. Otherwise perform a merge
- */
- MERGE("merge"),
-
- /**
- * Delete existing data, import new data.
- */
- OVERWRITE("overwrite");
-
- private String name;
-
- ImportStrategy(String name)
- {
- this.name = name;
- }
-
- private static final Map<String, ImportStrategy> MAP;
-
- static
- {
- Map<String, ImportStrategy> tmp = new HashMap<String, ImportStrategy>(3);
- for (ImportStrategy strategy : ImportStrategy.values())
- {
- tmp.put(strategy.name, strategy);
- }
-
- MAP = tmp;
- }
-
- public String getName()
- {
- return name;
- }
-
- public static ImportStrategy forName(String name)
- {
- return MAP.get(name);
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/ImportStrategy.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/ImportStrategy.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/ImportStrategy.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/ImportStrategy.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public enum ImportStrategy
+{
+ /**
+ * Import when data does not exist. Otherwise do nothing.
+ */
+ CONSERVE("conserve"),
+
+ /**
+ * Import when data does not exist. Otherwise perform a merge
+ */
+ MERGE("merge"),
+
+ /**
+ * Delete existing data, import new data.
+ */
+ OVERWRITE("overwrite");
+
+ private String name;
+
+ ImportStrategy(String name)
+ {
+ this.name = name;
+ }
+
+ private static final Map<String, ImportStrategy> MAP;
+
+ static
+ {
+ Map<String, ImportStrategy> tmp = new HashMap<String, ImportStrategy>(3);
+ for (ImportStrategy strategy : ImportStrategy.values())
+ {
+ tmp.put(strategy.name, strategy);
+ }
+
+ MAP = tmp;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public static ImportStrategy forName(String name)
+ {
+ return MAP.get(name);
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/ImportTask.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/ImportTask.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/ImportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public abstract class ImportTask<T>
-{
- protected final T data;
- protected ImportTask(T data)
- {
- this.data = data;
- }
-
- public abstract void importData(ImportStrategy importStrategy) throws Exception;
-
- public abstract void rollback() throws Exception;
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/ImportTask.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/ImportTask.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/ImportTask.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/ImportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public abstract class ImportTask<T>
+{
+ protected final T data;
+ protected ImportTask(T data)
+ {
+ this.data = data;
+ }
+
+ public abstract void importData(ImportStrategy importStrategy) throws Exception;
+
+ public abstract void rollback() throws Exception;
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/NavigationExportTask.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/NavigationExportTask.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/NavigationExportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
-
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.mop.description.DescriptionService;
-import org.exoplatform.portal.mop.management.operations.navigation.NavigationKey;
-import org.exoplatform.portal.mop.management.operations.navigation.NavigationUtils;
-import org.exoplatform.portal.mop.navigation.NavigationService;
-import org.gatein.management.api.binding.Marshaller;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class NavigationExportTask extends AbstractExportTask
-{
- public static final String FILE = "navigation.xml";
-
- private NavigationKey navigationKey;
- private Marshaller<PageNavigation> marshaller;
- private NavigationService navigationService;
- private DescriptionService descriptionService;
-
- public NavigationExportTask(NavigationKey navigationKey, NavigationService navigationService,
- DescriptionService descriptionService, Marshaller<PageNavigation> marshaller)
- {
- super(navigationKey.getSiteKey());
- this.navigationKey = navigationKey;
- this.navigationService = navigationService;
- this.descriptionService = descriptionService;
- this.marshaller = marshaller;
- }
-
- @Override
- protected String getXmlFileName()
- {
- return FILE;
- }
-
- @Override
- public void export(OutputStream outputStream) throws IOException
- {
- PageNavigation navigation = NavigationUtils.loadPageNavigation(navigationKey, navigationService, descriptionService);
- marshaller.marshal(navigation, outputStream);
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/NavigationExportTask.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/NavigationExportTask.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/NavigationExportTask.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/NavigationExportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
+
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.mop.description.DescriptionService;
+import org.exoplatform.portal.mop.management.operations.navigation.NavigationKey;
+import org.exoplatform.portal.mop.management.operations.navigation.NavigationUtils;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.gatein.management.api.binding.Marshaller;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class NavigationExportTask extends AbstractExportTask
+{
+ public static final String FILE = "navigation.xml";
+
+ private NavigationKey navigationKey;
+ private Marshaller<PageNavigation> marshaller;
+ private NavigationService navigationService;
+ private DescriptionService descriptionService;
+
+ public NavigationExportTask(NavigationKey navigationKey, NavigationService navigationService,
+ DescriptionService descriptionService, Marshaller<PageNavigation> marshaller)
+ {
+ super(navigationKey.getSiteKey());
+ this.navigationKey = navigationKey;
+ this.navigationService = navigationService;
+ this.descriptionService = descriptionService;
+ this.marshaller = marshaller;
+ }
+
+ @Override
+ protected String getXmlFileName()
+ {
+ return FILE;
+ }
+
+ @Override
+ public void export(OutputStream outputStream) throws IOException
+ {
+ PageNavigation navigation = NavigationUtils.loadPageNavigation(navigationKey, navigationService, descriptionService);
+ marshaller.marshal(navigation, outputStream);
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/NavigationImportTask.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/NavigationImportTask.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/NavigationImportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,130 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
-
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.description.DescriptionService;
-import org.exoplatform.portal.mop.importer.ImportMode;
-import org.exoplatform.portal.mop.importer.NavigationImporter;
-import org.exoplatform.portal.mop.navigation.NavigationContext;
-import org.exoplatform.portal.mop.navigation.NavigationService;
-import org.exoplatform.portal.pom.data.ModelDataStorage;
-import org.exoplatform.portal.pom.data.PortalData;
-import org.exoplatform.portal.pom.data.PortalKey;
-import org.gatein.common.logging.Logger;
-import org.gatein.common.logging.LoggerFactory;
-
-import java.util.Locale;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class NavigationImportTask extends AbstractImportTask<PageNavigation>
-{
- private static final Logger log = LoggerFactory.getLogger(NavigationImportTask.class);
-
- private NavigationService navigationService;
- private DescriptionService descriptionService;
- private DataStorage dataStorage;
- private RollbackTask rollbackTask;
-
- public NavigationImportTask(PageNavigation data, SiteKey siteKey,
- NavigationService navigationService, DescriptionService descriptionService, DataStorage dataStorage)
- {
- super(data, siteKey);
- this.navigationService = navigationService;
- this.descriptionService = descriptionService;
- this.dataStorage = dataStorage;
- }
-
- @Override
- public void importData(ImportStrategy importStrategy) throws Exception
- {
- ImportMode mode;
- switch (importStrategy)
- {
- case CONSERVE:
- mode = ImportMode.INSERT;
- break;
- case MERGE:
- mode = ImportMode.MERGE;
- break;
- case OVERWRITE:
- mode = ImportMode.OVERWRITE;
- break;
- default:
- throw new Exception("Could not map import strategy " + importStrategy.getName() + " to import mode.");
- }
-
- PortalConfig portalConfig = dataStorage.getPortalConfig(siteKey.getTypeName(), siteKey.getName());
- if (portalConfig == null) throw new Exception("Cannot import navigation because site does not exist for " + siteKey);
-
- Locale locale = (portalConfig.getLocale() == null) ? Locale.ENGLISH : new Locale(portalConfig.getLocale());
-
- final NavigationContext navContext = navigationService.loadNavigation(siteKey);
- if (navContext == null)
- {
- rollbackTask = new RollbackTask()
- {
- @Override
- public void rollback() throws Exception
- {
- navigationService.destroyNavigation(navContext);
- }
- };
- }
- else
- {
- //TODO: Rollback updates.
- rollbackTask = new RollbackTask()
- {
- @Override
- public void rollback() throws Exception
- {
- log.warn("Rollback for existing navigation not supported at the moment.");
- }
- };
- }
-
- NavigationImporter importer = new NavigationImporter(locale, mode, data, navigationService, descriptionService);
- importer.perform();
- }
-
- @Override
- public void rollback() throws Exception
- {
- if (rollbackTask != null)
- {
- rollbackTask.rollback();
- }
- }
-
- private static interface RollbackTask
- {
- void rollback() throws Exception;
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/NavigationImportTask.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/NavigationImportTask.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/NavigationImportTask.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/NavigationImportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,130 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
+
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.description.DescriptionService;
+import org.exoplatform.portal.mop.importer.ImportMode;
+import org.exoplatform.portal.mop.importer.NavigationImporter;
+import org.exoplatform.portal.mop.navigation.NavigationContext;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.pom.data.ModelDataStorage;
+import org.exoplatform.portal.pom.data.PortalData;
+import org.exoplatform.portal.pom.data.PortalKey;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
+
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class NavigationImportTask extends AbstractImportTask<PageNavigation>
+{
+ private static final Logger log = LoggerFactory.getLogger(NavigationImportTask.class);
+
+ private NavigationService navigationService;
+ private DescriptionService descriptionService;
+ private DataStorage dataStorage;
+ private RollbackTask rollbackTask;
+
+ public NavigationImportTask(PageNavigation data, SiteKey siteKey,
+ NavigationService navigationService, DescriptionService descriptionService, DataStorage dataStorage)
+ {
+ super(data, siteKey);
+ this.navigationService = navigationService;
+ this.descriptionService = descriptionService;
+ this.dataStorage = dataStorage;
+ }
+
+ @Override
+ public void importData(ImportStrategy importStrategy) throws Exception
+ {
+ ImportMode mode;
+ switch (importStrategy)
+ {
+ case CONSERVE:
+ mode = ImportMode.INSERT;
+ break;
+ case MERGE:
+ mode = ImportMode.MERGE;
+ break;
+ case OVERWRITE:
+ mode = ImportMode.OVERWRITE;
+ break;
+ default:
+ throw new Exception("Could not map import strategy " + importStrategy.getName() + " to import mode.");
+ }
+
+ PortalConfig portalConfig = dataStorage.getPortalConfig(siteKey.getTypeName(), siteKey.getName());
+ if (portalConfig == null) throw new Exception("Cannot import navigation because site does not exist for " + siteKey);
+
+ Locale locale = (portalConfig.getLocale() == null) ? Locale.ENGLISH : new Locale(portalConfig.getLocale());
+
+ final NavigationContext navContext = navigationService.loadNavigation(siteKey);
+ if (navContext == null)
+ {
+ rollbackTask = new RollbackTask()
+ {
+ @Override
+ public void rollback() throws Exception
+ {
+ navigationService.destroyNavigation(navContext);
+ }
+ };
+ }
+ else
+ {
+ //TODO: Rollback updates.
+ rollbackTask = new RollbackTask()
+ {
+ @Override
+ public void rollback() throws Exception
+ {
+ log.warn("Rollback for existing navigation not supported at the moment.");
+ }
+ };
+ }
+
+ NavigationImporter importer = new NavigationImporter(locale, mode, data, navigationService, descriptionService);
+ importer.perform();
+ }
+
+ @Override
+ public void rollback() throws Exception
+ {
+ if (rollbackTask != null)
+ {
+ rollbackTask.rollback();
+ }
+ }
+
+ private static interface RollbackTask
+ {
+ void rollback() throws Exception;
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/POMSessionExportTask.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/POMSessionExportTask.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/POMSessionExportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
-
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.pom.config.POMSession;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public abstract class POMSessionExportTask extends AbstractExportTask
-{
- protected POMSession session;
-
- public POMSessionExportTask(SiteKey siteKey, POMSession session)
- {
- super(siteKey);
- this.session = session;
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/POMSessionExportTask.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/POMSessionExportTask.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/POMSessionExportTask.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/POMSessionExportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.pom.config.POMSession;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public abstract class POMSessionExportTask extends AbstractExportTask
+{
+ protected POMSession session;
+
+ public POMSessionExportTask(SiteKey siteKey, POMSession session)
+ {
+ super(siteKey);
+ this.session = session;
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/PageExportTask.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/PageExportTask.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/PageExportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,95 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
-
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.Utils;
-import org.gatein.management.api.binding.Marshaller;
-import org.gatein.management.api.operation.model.ExportTask;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class PageExportTask extends AbstractExportTask implements ExportTask
-{
- public static final String FILE = "pages.xml";
-
- private final DataStorage dataStorage;
- private final Marshaller<Page.PageSet> marshaller;
- private final List<String> pageNames;
-
- public PageExportTask(SiteKey siteKey, DataStorage dataStorage, Marshaller<Page.PageSet> marshaller)
- {
- super(siteKey);
- this.dataStorage = dataStorage;
- this.marshaller = marshaller;
- pageNames = new ArrayList<String>();
- }
-
- @Override
- public void export(OutputStream outputStream) throws IOException
- {
- Page.PageSet pages = new Page.PageSet();
- pages.setPages(new ArrayList<Page>(pageNames.size()));
- for (String pageName : pageNames)
- {
- try
- {
- Page page = dataStorage.getPage(Utils.join("::", siteKey.getTypeName(), siteKey.getName(), pageName));
- pages.getPages().add(page);
- }
- catch (Exception e)
- {
- throw new IOException("Could not retrieve page name " + pageName + " for site " + siteKey, e);
- }
- }
-
- marshaller.marshal(pages, outputStream);
- }
-
- @Override
- protected String getXmlFileName()
- {
- return FILE;
- }
-
- public void addPageName(String pageName)
- {
- pageNames.add(pageName);
- }
-
- public List<String> getPageNames()
- {
- return Collections.unmodifiableList(pageNames);
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/PageExportTask.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/PageExportTask.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/PageExportTask.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/PageExportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
+
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.Utils;
+import org.gatein.management.api.binding.Marshaller;
+import org.gatein.management.api.operation.model.ExportTask;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class PageExportTask extends AbstractExportTask implements ExportTask
+{
+ public static final String FILE = "pages.xml";
+
+ private final DataStorage dataStorage;
+ private final Marshaller<Page.PageSet> marshaller;
+ private final List<String> pageNames;
+
+ public PageExportTask(SiteKey siteKey, DataStorage dataStorage, Marshaller<Page.PageSet> marshaller)
+ {
+ super(siteKey);
+ this.dataStorage = dataStorage;
+ this.marshaller = marshaller;
+ pageNames = new ArrayList<String>();
+ }
+
+ @Override
+ public void export(OutputStream outputStream) throws IOException
+ {
+ Page.PageSet pages = new Page.PageSet();
+ pages.setPages(new ArrayList<Page>(pageNames.size()));
+ for (String pageName : pageNames)
+ {
+ try
+ {
+ Page page = dataStorage.getPage(Utils.join("::", siteKey.getTypeName(), siteKey.getName(), pageName));
+ pages.getPages().add(page);
+ }
+ catch (Exception e)
+ {
+ throw new IOException("Could not retrieve page name " + pageName + " for site " + siteKey, e);
+ }
+ }
+
+ marshaller.marshal(pages, outputStream);
+ }
+
+ @Override
+ protected String getXmlFileName()
+ {
+ return FILE;
+ }
+
+ public void addPageName(String pageName)
+ {
+ pageNames.add(pageName);
+ }
+
+ public List<String> getPageNames()
+ {
+ return Collections.unmodifiableList(pageNames);
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/PageImportTask.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/PageImportTask.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/PageImportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,203 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
-
-import org.exoplatform.commons.utils.LazyPageList;
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.Query;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.mop.SiteKey;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class PageImportTask extends AbstractImportTask<Page.PageSet>
-{
- private final DataStorage dataStorage;
- private Page.PageSet rollbackSaves;
- private Page.PageSet rollbackDeletes;
-
- public PageImportTask(Page.PageSet data, SiteKey siteKey, DataStorage dataStorage)
- {
- super(data, siteKey);
- this.dataStorage = dataStorage;
- }
-
- @Override
- public void importData(ImportStrategy strategy) throws Exception
- {
- if (data == null || data.getPages() == null || data.getPages().isEmpty()) return;
-
- Query<Page> query = new Query<Page>(siteKey.getTypeName(), siteKey.getName(), Page.class);
- LazyPageList<Page> list = dataStorage.find(query);
- int size = list.getAvailable();
-
- Page.PageSet dst = null;
- switch (strategy)
- {
- case CONSERVE:
- if (size == 0)
- {
- dst = data; // No pages exist yet.
- rollbackDeletes = data;
- }
- else
- {
- dst = new Page.PageSet();
- dst.setPages(new ArrayList<Page>());
- List<Page> existingPages = list.getAll();
- rollbackDeletes = new Page.PageSet();
- rollbackDeletes.setPages(new ArrayList<Page>());
- for (Page src : data.getPages())
- {
- Page found = findPage(existingPages, src);
- if (found == null)
- {
- dst.getPages().add(src);
- rollbackDeletes.getPages().add(src);
- }
- }
- }
- break;
- case MERGE:
- if (size == 0) // No pages exist yet.
- {
- dst = data;
- rollbackDeletes = data;
- }
- else
- {
- dst = new Page.PageSet();
- dst.setPages(new ArrayList<Page>(data.getPages().size()));
- List<Page> existingPages = list.getAll();
- rollbackSaves = new Page.PageSet();
- rollbackSaves.setPages(new ArrayList<Page>(size));
- rollbackDeletes = new Page.PageSet();
- rollbackDeletes.setPages(new ArrayList<Page>());
- for (Page src : data.getPages())
- {
- dst.getPages().add(src);
-
- Page found = findPage(existingPages, src);
- if (found == null)
- {
- rollbackDeletes.getPages().add(src);
- }
- else
- {
- rollbackSaves.getPages().add(found);
- }
- }
- }
- break;
- case OVERWRITE:
- if (size == 0)
- {
- dst = data;
- rollbackDeletes = data;
- }
- else
- {
- List<Page> existingPages = list.getAll();
- rollbackSaves = new Page.PageSet();
- rollbackSaves.setPages(new ArrayList<Page>(size));
- rollbackDeletes = new Page.PageSet();
- rollbackDeletes.setPages(new ArrayList<Page>());
- for (Page page : existingPages)
- {
- dataStorage.remove(page);
- dataStorage.save();
- rollbackSaves.getPages().add(page);
- }
- for (Page src : data.getPages())
- {
- Page found = findPage(rollbackSaves.getPages(), src);
- if (found == null)
- {
- rollbackDeletes.getPages().add(src);
- }
- }
-
- dst = data;
- }
- break;
- }
-
- if (dst != null)
- {
- for (Page page : dst.getPages())
- {
- dataStorage.save(page);
- dataStorage.save();
- }
- }
- }
-
- @Override
- public void rollback() throws Exception
- {
- if (rollbackDeletes != null && !rollbackDeletes.getPages().isEmpty())
- {
- for (Page page : rollbackDeletes.getPages())
- {
- dataStorage.remove(page);
- dataStorage.save();
- }
- }
- if (rollbackSaves != null && !rollbackSaves.getPages().isEmpty())
- {
- for (Page page : rollbackSaves.getPages())
- {
- dataStorage.save(page);
- dataStorage.save();
- }
- }
- }
-
- Page.PageSet getRollbackSaves()
- {
- return rollbackSaves;
- }
-
- Page.PageSet getRollbackDeletes()
- {
- return rollbackDeletes;
- }
-
- private Page findPage(List<Page> pages, Page src)
- {
- Page found = null;
- for (Page page : pages)
- {
- if (src.getName().equals(page.getName()))
- {
- found = page;
- }
- }
- return found;
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/PageImportTask.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/PageImportTask.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/PageImportTask.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/PageImportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,203 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
+
+import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.Query;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.mop.SiteKey;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class PageImportTask extends AbstractImportTask<Page.PageSet>
+{
+ private final DataStorage dataStorage;
+ private Page.PageSet rollbackSaves;
+ private Page.PageSet rollbackDeletes;
+
+ public PageImportTask(Page.PageSet data, SiteKey siteKey, DataStorage dataStorage)
+ {
+ super(data, siteKey);
+ this.dataStorage = dataStorage;
+ }
+
+ @Override
+ public void importData(ImportStrategy strategy) throws Exception
+ {
+ if (data == null || data.getPages() == null || data.getPages().isEmpty()) return;
+
+ Query<Page> query = new Query<Page>(siteKey.getTypeName(), siteKey.getName(), Page.class);
+ LazyPageList<Page> list = dataStorage.find(query);
+ int size = list.getAvailable();
+
+ Page.PageSet dst = null;
+ switch (strategy)
+ {
+ case CONSERVE:
+ if (size == 0)
+ {
+ dst = data; // No pages exist yet.
+ rollbackDeletes = data;
+ }
+ else
+ {
+ dst = new Page.PageSet();
+ dst.setPages(new ArrayList<Page>());
+ List<Page> existingPages = list.getAll();
+ rollbackDeletes = new Page.PageSet();
+ rollbackDeletes.setPages(new ArrayList<Page>());
+ for (Page src : data.getPages())
+ {
+ Page found = findPage(existingPages, src);
+ if (found == null)
+ {
+ dst.getPages().add(src);
+ rollbackDeletes.getPages().add(src);
+ }
+ }
+ }
+ break;
+ case MERGE:
+ if (size == 0) // No pages exist yet.
+ {
+ dst = data;
+ rollbackDeletes = data;
+ }
+ else
+ {
+ dst = new Page.PageSet();
+ dst.setPages(new ArrayList<Page>(data.getPages().size()));
+ List<Page> existingPages = list.getAll();
+ rollbackSaves = new Page.PageSet();
+ rollbackSaves.setPages(new ArrayList<Page>(size));
+ rollbackDeletes = new Page.PageSet();
+ rollbackDeletes.setPages(new ArrayList<Page>());
+ for (Page src : data.getPages())
+ {
+ dst.getPages().add(src);
+
+ Page found = findPage(existingPages, src);
+ if (found == null)
+ {
+ rollbackDeletes.getPages().add(src);
+ }
+ else
+ {
+ rollbackSaves.getPages().add(found);
+ }
+ }
+ }
+ break;
+ case OVERWRITE:
+ if (size == 0)
+ {
+ dst = data;
+ rollbackDeletes = data;
+ }
+ else
+ {
+ List<Page> existingPages = list.getAll();
+ rollbackSaves = new Page.PageSet();
+ rollbackSaves.setPages(new ArrayList<Page>(size));
+ rollbackDeletes = new Page.PageSet();
+ rollbackDeletes.setPages(new ArrayList<Page>());
+ for (Page page : existingPages)
+ {
+ dataStorage.remove(page);
+ dataStorage.save();
+ rollbackSaves.getPages().add(page);
+ }
+ for (Page src : data.getPages())
+ {
+ Page found = findPage(rollbackSaves.getPages(), src);
+ if (found == null)
+ {
+ rollbackDeletes.getPages().add(src);
+ }
+ }
+
+ dst = data;
+ }
+ break;
+ }
+
+ if (dst != null)
+ {
+ for (Page page : dst.getPages())
+ {
+ dataStorage.save(page);
+ dataStorage.save();
+ }
+ }
+ }
+
+ @Override
+ public void rollback() throws Exception
+ {
+ if (rollbackDeletes != null && !rollbackDeletes.getPages().isEmpty())
+ {
+ for (Page page : rollbackDeletes.getPages())
+ {
+ dataStorage.remove(page);
+ dataStorage.save();
+ }
+ }
+ if (rollbackSaves != null && !rollbackSaves.getPages().isEmpty())
+ {
+ for (Page page : rollbackSaves.getPages())
+ {
+ dataStorage.save(page);
+ dataStorage.save();
+ }
+ }
+ }
+
+ Page.PageSet getRollbackSaves()
+ {
+ return rollbackSaves;
+ }
+
+ Page.PageSet getRollbackDeletes()
+ {
+ return rollbackDeletes;
+ }
+
+ private Page findPage(List<Page> pages, Page src)
+ {
+ Page found = null;
+ for (Page page : pages)
+ {
+ if (src.getName().equals(page.getName()))
+ {
+ found = page;
+ }
+ }
+ return found;
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/SiteLayoutExportTask.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/SiteLayoutExportTask.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/SiteLayoutExportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,77 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
-
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.tasks.PortalConfigTask;
-import org.exoplatform.portal.pom.data.PortalData;
-import org.exoplatform.portal.pom.data.PortalKey;
-import org.gatein.management.api.binding.Marshaller;
-import org.gatein.management.api.operation.model.ExportTask;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class SiteLayoutExportTask extends AbstractExportTask implements ExportTask
-{
- public static final String FILE = "portal.xml";
-
- private final DataStorage dataStorage;
- private final Marshaller<PortalConfig> marshaller;
-
- public SiteLayoutExportTask(SiteKey siteKey, DataStorage dataStorage, Marshaller<PortalConfig> marshaller)
- {
- super(siteKey);
- this.dataStorage = dataStorage;
- this.marshaller = marshaller;
- }
-
- @Override
- protected String getXmlFileName()
- {
- return FILE;
- }
-
- @Override
- public void export(OutputStream outputStream) throws IOException
- {
- PortalConfig portalConfig;
- try
- {
- portalConfig = dataStorage.getPortalConfig(siteKey.getTypeName(), siteKey.getName());
- }
- catch (Exception e)
- {
- throw new IOException("Could not retrieve site " + siteKey, e);
- }
-
- marshaller.marshal(portalConfig, outputStream);
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/SiteLayoutExportTask.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/SiteLayoutExportTask.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/SiteLayoutExportTask.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/SiteLayoutExportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
+
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.tasks.PortalConfigTask;
+import org.exoplatform.portal.pom.data.PortalData;
+import org.exoplatform.portal.pom.data.PortalKey;
+import org.gatein.management.api.binding.Marshaller;
+import org.gatein.management.api.operation.model.ExportTask;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class SiteLayoutExportTask extends AbstractExportTask implements ExportTask
+{
+ public static final String FILE = "portal.xml";
+
+ private final DataStorage dataStorage;
+ private final Marshaller<PortalConfig> marshaller;
+
+ public SiteLayoutExportTask(SiteKey siteKey, DataStorage dataStorage, Marshaller<PortalConfig> marshaller)
+ {
+ super(siteKey);
+ this.dataStorage = dataStorage;
+ this.marshaller = marshaller;
+ }
+
+ @Override
+ protected String getXmlFileName()
+ {
+ return FILE;
+ }
+
+ @Override
+ public void export(OutputStream outputStream) throws IOException
+ {
+ PortalConfig portalConfig;
+ try
+ {
+ portalConfig = dataStorage.getPortalConfig(siteKey.getTypeName(), siteKey.getName());
+ }
+ catch (Exception e)
+ {
+ throw new IOException("Could not retrieve site " + siteKey, e);
+ }
+
+ marshaller.marshal(portalConfig, outputStream);
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/SiteLayoutImportTask.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/SiteLayoutImportTask.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/SiteLayoutImportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,106 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
-
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.pom.data.ModelDataStorage;
-import org.exoplatform.portal.pom.data.PortalData;
-import org.exoplatform.portal.pom.data.PortalKey;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class SiteLayoutImportTask extends AbstractImportTask<PortalConfig>
-{
- private final DataStorage dataStorage;
- private PortalConfig rollbackDelete;
- private PortalConfig rollbackSave;
-
- public SiteLayoutImportTask(PortalConfig data, SiteKey siteKey, DataStorage dataStorage)
- {
- super(data, siteKey);
- this.dataStorage = dataStorage;
- }
-
- @Override
- public void importData(ImportStrategy importStrategy) throws Exception
- {
- PortalConfig dst = dataStorage.getPortalConfig(siteKey.getTypeName(), siteKey.getName());
-
- switch (importStrategy)
- {
- // Really doesn't make sense to "merge" site layout data. Really two modes, conserve (keep) and overwrite.
- case CONSERVE:
- if (dst == null)
- {
- dst = data;
- rollbackDelete = data;
- }
- else
- {
- dst = null;
- }
- break;
- case MERGE:
- case OVERWRITE:
- if (dst == null)
- {
- rollbackDelete = data;
- }
- else
- {
- rollbackSave = dst;
- }
- dst = data;
- break;
- }
-
- if (dst != null)
- {
- if (rollbackDelete == null)
- {
- dataStorage.save(dst);
- }
- else
- {
- dataStorage.create(dst);
- }
- }
- }
-
- @Override
- public void rollback() throws Exception
- {
- if (rollbackDelete != null)
- {
- dataStorage.remove(rollbackDelete);
- }
- else if (rollbackSave != null)
- {
- dataStorage.save(rollbackSave);
- }
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/SiteLayoutImportTask.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/SiteLayoutImportTask.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/SiteLayoutImportTask.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/exportimport/SiteLayoutImportTask.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
+
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.pom.data.ModelDataStorage;
+import org.exoplatform.portal.pom.data.PortalData;
+import org.exoplatform.portal.pom.data.PortalKey;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class SiteLayoutImportTask extends AbstractImportTask<PortalConfig>
+{
+ private final DataStorage dataStorage;
+ private PortalConfig rollbackDelete;
+ private PortalConfig rollbackSave;
+
+ public SiteLayoutImportTask(PortalConfig data, SiteKey siteKey, DataStorage dataStorage)
+ {
+ super(data, siteKey);
+ this.dataStorage = dataStorage;
+ }
+
+ @Override
+ public void importData(ImportStrategy importStrategy) throws Exception
+ {
+ PortalConfig dst = dataStorage.getPortalConfig(siteKey.getTypeName(), siteKey.getName());
+
+ switch (importStrategy)
+ {
+ // Really doesn't make sense to "merge" site layout data. Really two modes, conserve (keep) and overwrite.
+ case CONSERVE:
+ if (dst == null)
+ {
+ dst = data;
+ rollbackDelete = data;
+ }
+ else
+ {
+ dst = null;
+ }
+ break;
+ case MERGE:
+ case OVERWRITE:
+ if (dst == null)
+ {
+ rollbackDelete = data;
+ }
+ else
+ {
+ rollbackSave = dst;
+ }
+ dst = data;
+ break;
+ }
+
+ if (dst != null)
+ {
+ if (rollbackDelete == null)
+ {
+ dataStorage.save(dst);
+ }
+ else
+ {
+ dataStorage.create(dst);
+ }
+ }
+ }
+
+ @Override
+ public void rollback() throws Exception
+ {
+ if (rollbackDelete != null)
+ {
+ dataStorage.remove(rollbackDelete);
+ }
+ else if (rollbackSave != null)
+ {
+ dataStorage.save(rollbackSave);
+ }
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/AbstractMopOperationHandler.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/AbstractMopOperationHandler.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/AbstractMopOperationHandler.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations;
-
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.SiteType;
-import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.gatein.management.api.PathAddress;
-import org.gatein.management.api.exceptions.OperationException;
-import org.gatein.management.api.exceptions.ResourceNotFoundException;
-import org.gatein.management.api.operation.OperationContext;
-import org.gatein.management.api.operation.OperationHandler;
-import org.gatein.management.api.operation.ResultHandler;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Site;
-import org.gatein.mop.api.workspace.Workspace;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public abstract class AbstractMopOperationHandler implements OperationHandler
-{
- @Override
- public final void execute(OperationContext operationContext, ResultHandler resultHandler) throws ResourceNotFoundException, OperationException
- {
- String operationName = operationContext.getOperationName();
- PathAddress address = operationContext.getAddress();
-
- String siteType = address.resolvePathTemplate("site-type");
- if (siteType == null) throw new OperationException(operationName, "Site type was not specified.");
-
- ObjectType<Site> objectType = Utils.getObjectType(Utils.getSiteType(siteType));
- if (objectType == null)
- {
- throw new ResourceNotFoundException("No site type found for " + siteType);
- }
-
- POMSessionManager mgr = operationContext.getRuntimeContext().getRuntimeComponent(POMSessionManager.class);
- POMSession session = mgr.getSession();
- if (session == null) throw new OperationException(operationName, "MOP session was null");
-
- Workspace workspace = session.getWorkspace();
- if (workspace == null) throw new OperationException(operationName, "MOP workspace was null");
-
- execute(operationContext, resultHandler, workspace, objectType);
- }
-
- protected abstract void execute(OperationContext operationContext, ResultHandler resultHandler,
- Workspace workspace, ObjectType<Site> siteType) throws ResourceNotFoundException, OperationException;
-
-
- protected SiteType getSiteType(ObjectType<? extends Site> objectType)
- {
- return Utils.getSiteType(objectType);
- }
-
- protected SiteKey getSiteKey(ObjectType<? extends Site> objectType, String name)
- {
- return Utils.siteKey(Utils.getSiteType(objectType), name);
- }
-
- protected SiteKey getSiteKey(Site site)
- {
- return getSiteKey(site.getObjectType(), site.getName());
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/AbstractMopOperationHandler.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/AbstractMopOperationHandler.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/AbstractMopOperationHandler.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/AbstractMopOperationHandler.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.SiteType;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.gatein.management.api.PathAddress;
+import org.gatein.management.api.exceptions.OperationException;
+import org.gatein.management.api.exceptions.ResourceNotFoundException;
+import org.gatein.management.api.operation.OperationContext;
+import org.gatein.management.api.operation.OperationHandler;
+import org.gatein.management.api.operation.ResultHandler;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.api.workspace.Workspace;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public abstract class AbstractMopOperationHandler implements OperationHandler
+{
+ @Override
+ public final void execute(OperationContext operationContext, ResultHandler resultHandler) throws ResourceNotFoundException, OperationException
+ {
+ String operationName = operationContext.getOperationName();
+ PathAddress address = operationContext.getAddress();
+
+ String siteType = address.resolvePathTemplate("site-type");
+ if (siteType == null) throw new OperationException(operationName, "Site type was not specified.");
+
+ ObjectType<Site> objectType = Utils.getObjectType(Utils.getSiteType(siteType));
+ if (objectType == null)
+ {
+ throw new ResourceNotFoundException("No site type found for " + siteType);
+ }
+
+ POMSessionManager mgr = operationContext.getRuntimeContext().getRuntimeComponent(POMSessionManager.class);
+ POMSession session = mgr.getSession();
+ if (session == null) throw new OperationException(operationName, "MOP session was null");
+
+ Workspace workspace = session.getWorkspace();
+ if (workspace == null) throw new OperationException(operationName, "MOP workspace was null");
+
+ execute(operationContext, resultHandler, workspace, objectType);
+ }
+
+ protected abstract void execute(OperationContext operationContext, ResultHandler resultHandler,
+ Workspace workspace, ObjectType<Site> siteType) throws ResourceNotFoundException, OperationException;
+
+
+ protected SiteType getSiteType(ObjectType<? extends Site> objectType)
+ {
+ return Utils.getSiteType(objectType);
+ }
+
+ protected SiteKey getSiteKey(ObjectType<? extends Site> objectType, String name)
+ {
+ return Utils.siteKey(Utils.getSiteType(objectType), name);
+ }
+
+ protected SiteKey getSiteKey(Site site)
+ {
+ return getSiteKey(site.getObjectType(), site.getName());
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,343 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations;
-
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.description.DescriptionService;
-import org.exoplatform.portal.mop.management.exportimport.ImportStrategy;
-import org.exoplatform.portal.mop.management.exportimport.NavigationExportTask;
-import org.exoplatform.portal.mop.management.exportimport.NavigationImportTask;
-import org.exoplatform.portal.mop.management.exportimport.PageExportTask;
-import org.exoplatform.portal.mop.management.exportimport.PageImportTask;
-import org.exoplatform.portal.mop.management.exportimport.SiteLayoutExportTask;
-import org.exoplatform.portal.mop.management.exportimport.SiteLayoutImportTask;
-import org.exoplatform.portal.mop.navigation.NavigationService;
-import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.gatein.common.logging.Logger;
-import org.gatein.common.logging.LoggerFactory;
-import org.gatein.management.api.ContentType;
-import org.gatein.management.api.binding.Marshaller;
-import org.gatein.management.api.exceptions.OperationException;
-import org.gatein.management.api.exceptions.ResourceNotFoundException;
-import org.gatein.management.api.operation.OperationAttachment;
-import org.gatein.management.api.operation.OperationContext;
-import org.gatein.management.api.operation.OperationHandler;
-import org.gatein.management.api.operation.ResultHandler;
-import org.gatein.management.api.operation.model.NoResultModel;
-import org.gatein.mop.api.workspace.Workspace;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class MopImportResource implements OperationHandler
-{
- private static final Logger log = LoggerFactory.getLogger(MopImportResource.class);
-
- //TODO: Would like to see the step operations be handled by mgmt core.
-
- //TODO: Clean this up when we have time
- @Override
- public void execute(final OperationContext operationContext, ResultHandler resultHandler) throws ResourceNotFoundException, OperationException
- {
- final String operationName = operationContext.getOperationName();
-
- OperationAttachment attachment = operationContext.getAttachment(true);
- if (attachment == null) throw new OperationException(operationContext.getOperationName(), "No attachment available for MOP import.");
-
- InputStream inputStream = attachment.getStream();
- if (inputStream == null) throw new OperationException(operationContext.getOperationName(), "No data stream available for import.");
-
- POMSessionManager mgr = operationContext.getRuntimeContext().getRuntimeComponent(POMSessionManager.class);
- POMSession session = mgr.getSession();
- if (session == null) throw new OperationException(operationName, "MOP session was null");
-
- Workspace workspace = session.getWorkspace();
- if (workspace == null) throw new OperationException(operationName, "MOP workspace was null");
-
- DataStorage dataStorage = operationContext.getRuntimeContext().getRuntimeComponent(DataStorage.class);
- if (dataStorage == null) throw new OperationException(operationName, "DataStorage was null");
-
- NavigationService navigationService = operationContext.getRuntimeContext().getRuntimeComponent(NavigationService.class);
- if (navigationService == null) throw new OperationException(operationName, "Navigation service was null");
-
- DescriptionService descriptionService = operationContext.getRuntimeContext().getRuntimeComponent(DescriptionService.class);
- if (descriptionService == null) throw new OperationException(operationName, "Description service was null");
-
- String strategyAttribute = operationContext.getAttributes().getValue("import-strategy");
- ImportStrategy strategy = ImportStrategy.MERGE;
- if (strategyAttribute != null)
- {
- strategy = ImportStrategy.forName(strategyAttribute);
- if (strategy == null) throw new OperationException(operationName, "Unknown import strategy " + strategyAttribute);
- }
-
- Map<SiteKey, MopImport> importMap = new HashMap<SiteKey, MopImport>();
- final NonCloseableZipInputStream zis = new NonCloseableZipInputStream(inputStream);
- ZipEntry entry;
- try
- {
- log.info("Preparing data for import.");
- while ( (entry = zis.getNextEntry()) != null)
- {
- // Skip directories
- if (entry.isDirectory()) continue;
-
- // Parse zip entry
- String[] parts = parseEntry(entry);
- SiteKey siteKey = Utils.siteKey(parts[0], parts[1]);
- String file = parts[2];
-
- MopImport mopImport = importMap.get(siteKey);
- if (mopImport == null)
- {
- mopImport = new MopImport();
- importMap.put(siteKey, mopImport);
- }
-
- if (file.equals(SiteLayoutExportTask.FILE))
- {
- // Unmarshal site layout data
- Marshaller<PortalConfig> marshaller = operationContext.getBindingProvider().getMarshaller(PortalConfig.class, ContentType.XML);
- PortalConfig portalConfig = marshaller.unmarshal(zis);
- portalConfig.setType(siteKey.getTypeName());
- if (!portalConfig.getName().equals(siteKey.getName()))
- {
- throw new OperationException(operationName, "Name of site does not match that of the zip entry site name.");
- }
-
- // Add import task to run later
- mopImport.siteTask = new SiteLayoutImportTask(portalConfig, siteKey, dataStorage);
- }
- else if (file.equals(PageExportTask.FILE))
- {
- // Unmarshal page data
- Marshaller<Page.PageSet> marshaller = operationContext.getBindingProvider().getMarshaller(Page.PageSet.class, ContentType.XML);
- Page.PageSet pages = marshaller.unmarshal(zis);
- for (Page page : pages.getPages())
- {
- page.setOwnerType(siteKey.getTypeName());
- page.setOwnerId(siteKey.getName());
- }
-
- // Add import task to run later.
- mopImport.pageTask = new PageImportTask(pages, siteKey, dataStorage);
- }
- else if (file.equals(NavigationExportTask.FILE))
- {
- // Unmarshal navigation data
- Marshaller<PageNavigation> marshaller = operationContext.getBindingProvider().getMarshaller(PageNavigation.class, ContentType.XML);
- PageNavigation navigation = marshaller.unmarshal(zis);
- navigation.setOwnerType(siteKey.getTypeName());
- navigation.setOwnerId(siteKey.getName());
-
- // Add import task to run later
- mopImport.navigationTask = new NavigationImportTask(navigation, siteKey, navigationService, descriptionService, dataStorage);
- }
- }
-
- resultHandler.completed(NoResultModel.INSTANCE);
- }
- catch (Throwable t)
- {
- throw new OperationException(operationContext.getOperationName(), "Exception reading data for import.", t);
- }
- finally
- {
- try
- {
- zis.reallyClose();
- }
- catch (IOException e)
- {
- log.warn("Exception closing underlying data stream from import.");
- }
- }
-
- // Perform import
- Map<SiteKey, MopImport> completedImportMap = new HashMap<SiteKey, MopImport>();
- try
- {
- log.info("Performing import using strategy '" + strategy.getName() + "'");
- for (Map.Entry<SiteKey, MopImport> mopImportEntry : importMap.entrySet())
- {
- SiteKey siteKey = mopImportEntry.getKey();
- MopImport mopImport = mopImportEntry.getValue();
- MopImport completed = new MopImport();
-
- if (completedImportMap.containsKey(siteKey))
- {
- throw new IllegalStateException("Multiple site imports for same operation.");
- }
- completedImportMap.put(siteKey, completed);
-
- log.debug("Importing data for site " + siteKey);
-
- // Site layout import
- if (mopImport.siteTask != null)
- {
- log.debug("Importing site layout data.");
- mopImport.siteTask.importData(strategy);
- completed.siteTask = mopImport.siteTask;
- }
-
- // Page import
- if (mopImport.pageTask != null)
- {
- log.debug("Importing page data.");
- mopImport.pageTask.importData(strategy);
- completed.pageTask = mopImport.pageTask;
- }
-
- // Navigation import
- if (mopImport.navigationTask != null)
- {
- log.debug("Importing navigation data.");
- mopImport.navigationTask.importData(strategy);
- completed.navigationTask = mopImport.navigationTask;
- }
- }
- log.info("Import successful !");
- }
- catch (Throwable t)
- {
- boolean rollbackSuccess = true;
- log.error("Exception importing data.", t);
- log.info("Attempting to rollback data modified by import.");
- for (Map.Entry<SiteKey, MopImport> mopImportEntry : completedImportMap.entrySet())
- {
- SiteKey siteKey = mopImportEntry.getKey();
- MopImport mopImport = mopImportEntry.getValue();
-
- log.debug("Rolling back imported data for site " + siteKey);
- if (mopImport.navigationTask != null)
- {
- log.debug("Rolling back navigation modified during import...");
- try
- {
- mopImport.navigationTask.rollback();
- }
- catch (Throwable t1) // Continue rolling back even though there are exceptions.
- {
- rollbackSuccess = false;
- log.error("Error rolling back navigation data for site " + siteKey, t1);
- }
- }
- if (mopImport.pageTask != null)
- {
- log.debug("Rolling back pages modified during import...");
- try
- {
- mopImport.pageTask.rollback();
- }
- catch (Throwable t1) // Continue rolling back even though there are exceptions.
- {
- rollbackSuccess = false;
- log.error("Error rolling back page data for site " + siteKey, t1);
- }
- }
- if (mopImport.siteTask != null)
- {
- log.debug("Rolling back site layout modified during import...");
- try
- {
- mopImport.siteTask.rollback();
- }
- catch (Throwable t1) // Continue rolling back even though there are exceptions.
- {
- rollbackSuccess = false;
- log.error("Error rolling back site layout for site " + siteKey, t1);
- }
- }
- }
-
- String message = (rollbackSuccess) ?
- "Error during import. Tasks successfully rolled back. Portal should be back to consistent state." :
- "Error during import. Errors in rollback as well. Portal may be in an inconsistent state.";
-
- throw new OperationException(operationName, message, t);
- }
- finally
- {
- importMap.clear();
- completedImportMap.clear();
- }
- }
-
- private static String[] parseEntry(ZipEntry entry) throws IOException
- {
- String name = entry.getName();
- if (name.endsWith(SiteLayoutExportTask.FILE) || name.endsWith(PageExportTask.FILE) || name.endsWith(NavigationExportTask.FILE))
- {
- String[] parts = new String[3];
- parts[0] = name.substring(0, name.indexOf("/"));
- parts[1] = name.substring(parts[0].length() + 1, name.lastIndexOf("/"));
- parts[2] = name.substring(name.lastIndexOf("/") + 1);
- return parts;
- }
- else
- {
- throw new IOException("Unknown entry " + name + " in zip file.");
- }
- }
-
- // Bug in SUN's JDK XMLStreamReader implementation closes the underlying stream when
- // it finishes reading an XML document. This is no good when we are using a ZipInputStream.
- // See http://bugs.sun.com/view_bug.do?bug_id=6539065 for more information.
- private static class NonCloseableZipInputStream extends ZipInputStream
- {
- private NonCloseableZipInputStream(InputStream inputStream)
- {
- super(inputStream);
- }
-
- @Override
- public void close() throws IOException
- {
- }
-
- private void reallyClose() throws IOException
- {
- super.close();
- }
- }
-
- private static class MopImport
- {
- private SiteLayoutImportTask siteTask;
- private PageImportTask pageTask;
- private NavigationImportTask navigationTask;
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,343 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations;
+
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.description.DescriptionService;
+import org.exoplatform.portal.mop.management.exportimport.ImportStrategy;
+import org.exoplatform.portal.mop.management.exportimport.NavigationExportTask;
+import org.exoplatform.portal.mop.management.exportimport.NavigationImportTask;
+import org.exoplatform.portal.mop.management.exportimport.PageExportTask;
+import org.exoplatform.portal.mop.management.exportimport.PageImportTask;
+import org.exoplatform.portal.mop.management.exportimport.SiteLayoutExportTask;
+import org.exoplatform.portal.mop.management.exportimport.SiteLayoutImportTask;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
+import org.gatein.management.api.ContentType;
+import org.gatein.management.api.binding.Marshaller;
+import org.gatein.management.api.exceptions.OperationException;
+import org.gatein.management.api.exceptions.ResourceNotFoundException;
+import org.gatein.management.api.operation.OperationAttachment;
+import org.gatein.management.api.operation.OperationContext;
+import org.gatein.management.api.operation.OperationHandler;
+import org.gatein.management.api.operation.ResultHandler;
+import org.gatein.management.api.operation.model.NoResultModel;
+import org.gatein.mop.api.workspace.Workspace;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class MopImportResource implements OperationHandler
+{
+ private static final Logger log = LoggerFactory.getLogger(MopImportResource.class);
+
+ //TODO: Would like to see the step operations be handled by mgmt core.
+
+ //TODO: Clean this up when we have time
+ @Override
+ public void execute(final OperationContext operationContext, ResultHandler resultHandler) throws ResourceNotFoundException, OperationException
+ {
+ final String operationName = operationContext.getOperationName();
+
+ OperationAttachment attachment = operationContext.getAttachment(true);
+ if (attachment == null) throw new OperationException(operationContext.getOperationName(), "No attachment available for MOP import.");
+
+ InputStream inputStream = attachment.getStream();
+ if (inputStream == null) throw new OperationException(operationContext.getOperationName(), "No data stream available for import.");
+
+ POMSessionManager mgr = operationContext.getRuntimeContext().getRuntimeComponent(POMSessionManager.class);
+ POMSession session = mgr.getSession();
+ if (session == null) throw new OperationException(operationName, "MOP session was null");
+
+ Workspace workspace = session.getWorkspace();
+ if (workspace == null) throw new OperationException(operationName, "MOP workspace was null");
+
+ DataStorage dataStorage = operationContext.getRuntimeContext().getRuntimeComponent(DataStorage.class);
+ if (dataStorage == null) throw new OperationException(operationName, "DataStorage was null");
+
+ NavigationService navigationService = operationContext.getRuntimeContext().getRuntimeComponent(NavigationService.class);
+ if (navigationService == null) throw new OperationException(operationName, "Navigation service was null");
+
+ DescriptionService descriptionService = operationContext.getRuntimeContext().getRuntimeComponent(DescriptionService.class);
+ if (descriptionService == null) throw new OperationException(operationName, "Description service was null");
+
+ String strategyAttribute = operationContext.getAttributes().getValue("import-strategy");
+ ImportStrategy strategy = ImportStrategy.MERGE;
+ if (strategyAttribute != null)
+ {
+ strategy = ImportStrategy.forName(strategyAttribute);
+ if (strategy == null) throw new OperationException(operationName, "Unknown import strategy " + strategyAttribute);
+ }
+
+ Map<SiteKey, MopImport> importMap = new HashMap<SiteKey, MopImport>();
+ final NonCloseableZipInputStream zis = new NonCloseableZipInputStream(inputStream);
+ ZipEntry entry;
+ try
+ {
+ log.info("Preparing data for import.");
+ while ( (entry = zis.getNextEntry()) != null)
+ {
+ // Skip directories
+ if (entry.isDirectory()) continue;
+
+ // Parse zip entry
+ String[] parts = parseEntry(entry);
+ SiteKey siteKey = Utils.siteKey(parts[0], parts[1]);
+ String file = parts[2];
+
+ MopImport mopImport = importMap.get(siteKey);
+ if (mopImport == null)
+ {
+ mopImport = new MopImport();
+ importMap.put(siteKey, mopImport);
+ }
+
+ if (file.equals(SiteLayoutExportTask.FILE))
+ {
+ // Unmarshal site layout data
+ Marshaller<PortalConfig> marshaller = operationContext.getBindingProvider().getMarshaller(PortalConfig.class, ContentType.XML);
+ PortalConfig portalConfig = marshaller.unmarshal(zis);
+ portalConfig.setType(siteKey.getTypeName());
+ if (!portalConfig.getName().equals(siteKey.getName()))
+ {
+ throw new OperationException(operationName, "Name of site does not match that of the zip entry site name.");
+ }
+
+ // Add import task to run later
+ mopImport.siteTask = new SiteLayoutImportTask(portalConfig, siteKey, dataStorage);
+ }
+ else if (file.equals(PageExportTask.FILE))
+ {
+ // Unmarshal page data
+ Marshaller<Page.PageSet> marshaller = operationContext.getBindingProvider().getMarshaller(Page.PageSet.class, ContentType.XML);
+ Page.PageSet pages = marshaller.unmarshal(zis);
+ for (Page page : pages.getPages())
+ {
+ page.setOwnerType(siteKey.getTypeName());
+ page.setOwnerId(siteKey.getName());
+ }
+
+ // Add import task to run later.
+ mopImport.pageTask = new PageImportTask(pages, siteKey, dataStorage);
+ }
+ else if (file.equals(NavigationExportTask.FILE))
+ {
+ // Unmarshal navigation data
+ Marshaller<PageNavigation> marshaller = operationContext.getBindingProvider().getMarshaller(PageNavigation.class, ContentType.XML);
+ PageNavigation navigation = marshaller.unmarshal(zis);
+ navigation.setOwnerType(siteKey.getTypeName());
+ navigation.setOwnerId(siteKey.getName());
+
+ // Add import task to run later
+ mopImport.navigationTask = new NavigationImportTask(navigation, siteKey, navigationService, descriptionService, dataStorage);
+ }
+ }
+
+ resultHandler.completed(NoResultModel.INSTANCE);
+ }
+ catch (Throwable t)
+ {
+ throw new OperationException(operationContext.getOperationName(), "Exception reading data for import.", t);
+ }
+ finally
+ {
+ try
+ {
+ zis.reallyClose();
+ }
+ catch (IOException e)
+ {
+ log.warn("Exception closing underlying data stream from import.");
+ }
+ }
+
+ // Perform import
+ Map<SiteKey, MopImport> completedImportMap = new HashMap<SiteKey, MopImport>();
+ try
+ {
+ log.info("Performing import using strategy '" + strategy.getName() + "'");
+ for (Map.Entry<SiteKey, MopImport> mopImportEntry : importMap.entrySet())
+ {
+ SiteKey siteKey = mopImportEntry.getKey();
+ MopImport mopImport = mopImportEntry.getValue();
+ MopImport completed = new MopImport();
+
+ if (completedImportMap.containsKey(siteKey))
+ {
+ throw new IllegalStateException("Multiple site imports for same operation.");
+ }
+ completedImportMap.put(siteKey, completed);
+
+ log.debug("Importing data for site " + siteKey);
+
+ // Site layout import
+ if (mopImport.siteTask != null)
+ {
+ log.debug("Importing site layout data.");
+ mopImport.siteTask.importData(strategy);
+ completed.siteTask = mopImport.siteTask;
+ }
+
+ // Page import
+ if (mopImport.pageTask != null)
+ {
+ log.debug("Importing page data.");
+ mopImport.pageTask.importData(strategy);
+ completed.pageTask = mopImport.pageTask;
+ }
+
+ // Navigation import
+ if (mopImport.navigationTask != null)
+ {
+ log.debug("Importing navigation data.");
+ mopImport.navigationTask.importData(strategy);
+ completed.navigationTask = mopImport.navigationTask;
+ }
+ }
+ log.info("Import successful !");
+ }
+ catch (Throwable t)
+ {
+ boolean rollbackSuccess = true;
+ log.error("Exception importing data.", t);
+ log.info("Attempting to rollback data modified by import.");
+ for (Map.Entry<SiteKey, MopImport> mopImportEntry : completedImportMap.entrySet())
+ {
+ SiteKey siteKey = mopImportEntry.getKey();
+ MopImport mopImport = mopImportEntry.getValue();
+
+ log.debug("Rolling back imported data for site " + siteKey);
+ if (mopImport.navigationTask != null)
+ {
+ log.debug("Rolling back navigation modified during import...");
+ try
+ {
+ mopImport.navigationTask.rollback();
+ }
+ catch (Throwable t1) // Continue rolling back even though there are exceptions.
+ {
+ rollbackSuccess = false;
+ log.error("Error rolling back navigation data for site " + siteKey, t1);
+ }
+ }
+ if (mopImport.pageTask != null)
+ {
+ log.debug("Rolling back pages modified during import...");
+ try
+ {
+ mopImport.pageTask.rollback();
+ }
+ catch (Throwable t1) // Continue rolling back even though there are exceptions.
+ {
+ rollbackSuccess = false;
+ log.error("Error rolling back page data for site " + siteKey, t1);
+ }
+ }
+ if (mopImport.siteTask != null)
+ {
+ log.debug("Rolling back site layout modified during import...");
+ try
+ {
+ mopImport.siteTask.rollback();
+ }
+ catch (Throwable t1) // Continue rolling back even though there are exceptions.
+ {
+ rollbackSuccess = false;
+ log.error("Error rolling back site layout for site " + siteKey, t1);
+ }
+ }
+ }
+
+ String message = (rollbackSuccess) ?
+ "Error during import. Tasks successfully rolled back. Portal should be back to consistent state." :
+ "Error during import. Errors in rollback as well. Portal may be in an inconsistent state.";
+
+ throw new OperationException(operationName, message, t);
+ }
+ finally
+ {
+ importMap.clear();
+ completedImportMap.clear();
+ }
+ }
+
+ private static String[] parseEntry(ZipEntry entry) throws IOException
+ {
+ String name = entry.getName();
+ if (name.endsWith(SiteLayoutExportTask.FILE) || name.endsWith(PageExportTask.FILE) || name.endsWith(NavigationExportTask.FILE))
+ {
+ String[] parts = new String[3];
+ parts[0] = name.substring(0, name.indexOf("/"));
+ parts[1] = name.substring(parts[0].length() + 1, name.lastIndexOf("/"));
+ parts[2] = name.substring(name.lastIndexOf("/") + 1);
+ return parts;
+ }
+ else
+ {
+ throw new IOException("Unknown entry " + name + " in zip file.");
+ }
+ }
+
+ // Bug in SUN's JDK XMLStreamReader implementation closes the underlying stream when
+ // it finishes reading an XML document. This is no good when we are using a ZipInputStream.
+ // See http://bugs.sun.com/view_bug.do?bug_id=6539065 for more information.
+ private static class NonCloseableZipInputStream extends ZipInputStream
+ {
+ private NonCloseableZipInputStream(InputStream inputStream)
+ {
+ super(inputStream);
+ }
+
+ @Override
+ public void close() throws IOException
+ {
+ }
+
+ private void reallyClose() throws IOException
+ {
+ super.close();
+ }
+ }
+
+ private static class MopImport
+ {
+ private SiteLayoutImportTask siteTask;
+ private PageImportTask pageTask;
+ private NavigationImportTask navigationTask;
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopReadResource.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopReadResource.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopReadResource.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations;
-
-import org.gatein.management.api.exceptions.OperationException;
-import org.gatein.management.api.operation.model.ReadResourceModel;
-import org.gatein.management.api.operation.OperationContext;
-import org.gatein.management.api.operation.OperationHandler;
-import org.gatein.management.api.operation.ResultHandler;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class MopReadResource implements OperationHandler
-{
- @Override
- public void execute(OperationContext operationContext, ResultHandler resultHandler) throws OperationException
- {
- Set<String> children = new LinkedHashSet<String>(3);
- children.add("portalsites");
- children.add("groupsites");
- children.add("usersites");
-
- resultHandler.completed(new ReadResourceModel("Available site types.", children));
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopReadResource.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopReadResource.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopReadResource.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopReadResource.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations;
+
+import org.gatein.management.api.exceptions.OperationException;
+import org.gatein.management.api.operation.model.ReadResourceModel;
+import org.gatein.management.api.operation.OperationContext;
+import org.gatein.management.api.operation.OperationHandler;
+import org.gatein.management.api.operation.ResultHandler;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class MopReadResource implements OperationHandler
+{
+ @Override
+ public void execute(OperationContext operationContext, ResultHandler resultHandler) throws OperationException
+ {
+ Set<String> children = new LinkedHashSet<String>(3);
+ children.add("portalsites");
+ children.add("groupsites");
+ children.add("usersites");
+
+ resultHandler.completed(new ReadResourceModel("Available site types.", children));
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/Utils.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/Utils.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/Utils.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,111 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations;
-
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.SiteType;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Site;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class Utils
-{
-
- private Utils()
- {
- }
-
- public static ObjectType<Site> getObjectType(SiteType siteType)
- {
- switch (siteType)
- {
- case PORTAL:
- return ObjectType.PORTAL_SITE;
- case GROUP:
- return ObjectType.GROUP_SITE;
- case USER:
- return ObjectType.USER_SITE;
- default:
- return null;
- }
- }
-
- public static SiteType getSiteType(ObjectType<? extends Site> objectType)
- {
- if (ObjectType.PORTAL_SITE == objectType)
- {
- return SiteType.PORTAL;
- }
- else if (ObjectType.GROUP_SITE == objectType)
- {
- return SiteType.GROUP;
- }
- else if (ObjectType.USER_SITE == objectType)
- {
- return SiteType.USER;
- }
- else
- {
- return null;
- }
- }
-
- public static SiteType getSiteType(String siteType)
- {
- if (siteType == null) return null;
-
- return SiteType.valueOf(siteType.toUpperCase());
- }
-
-
- public static SiteKey siteKey(String siteType, String siteName)
- {
- SiteType st = getSiteType(siteType);
- return siteKey(st, siteName);
- }
-
- public static SiteKey siteKey(SiteType siteType, String siteName)
- {
- switch (siteType)
- {
- case PORTAL:
- return SiteKey.portal(siteName);
- case GROUP:
- if (siteName.charAt(0) != '/') siteName = "/" + siteName;
- return SiteKey.group(siteName);
- case USER:
- return SiteKey.user(siteName);
- default:
- return null;
-
- }
- }
-
- public static SiteKey siteKey(Site site)
- {
- return siteKey(getSiteType(site.getObjectType()), site.getName());
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/Utils.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/Utils.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/Utils.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/Utils.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.SiteType;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class Utils
+{
+
+ private Utils()
+ {
+ }
+
+ public static ObjectType<Site> getObjectType(SiteType siteType)
+ {
+ switch (siteType)
+ {
+ case PORTAL:
+ return ObjectType.PORTAL_SITE;
+ case GROUP:
+ return ObjectType.GROUP_SITE;
+ case USER:
+ return ObjectType.USER_SITE;
+ default:
+ return null;
+ }
+ }
+
+ public static SiteType getSiteType(ObjectType<? extends Site> objectType)
+ {
+ if (ObjectType.PORTAL_SITE == objectType)
+ {
+ return SiteType.PORTAL;
+ }
+ else if (ObjectType.GROUP_SITE == objectType)
+ {
+ return SiteType.GROUP;
+ }
+ else if (ObjectType.USER_SITE == objectType)
+ {
+ return SiteType.USER;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static SiteType getSiteType(String siteType)
+ {
+ if (siteType == null) return null;
+
+ return SiteType.valueOf(siteType.toUpperCase());
+ }
+
+
+ public static SiteKey siteKey(String siteType, String siteName)
+ {
+ SiteType st = getSiteType(siteType);
+ return siteKey(st, siteName);
+ }
+
+ public static SiteKey siteKey(SiteType siteType, String siteName)
+ {
+ switch (siteType)
+ {
+ case PORTAL:
+ return SiteKey.portal(siteName);
+ case GROUP:
+ if (siteName.charAt(0) != '/') siteName = "/" + siteName;
+ return SiteKey.group(siteName);
+ case USER:
+ return SiteKey.user(siteName);
+ default:
+ return null;
+
+ }
+ }
+
+ public static SiteKey siteKey(Site site)
+ {
+ return siteKey(getSiteType(site.getObjectType()), site.getName());
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/AbstractNavigationOperationHandler.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/AbstractNavigationOperationHandler.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/AbstractNavigationOperationHandler.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.navigation;
-
-import org.exoplatform.portal.mop.management.operations.site.AbstractSiteOperationHandler;
-import org.gatein.management.api.exceptions.OperationException;
-import org.gatein.management.api.exceptions.ResourceNotFoundException;
-import org.gatein.management.api.operation.OperationContext;
-import org.gatein.management.api.operation.ResultHandler;
-import org.gatein.mop.api.workspace.Navigation;
-import org.gatein.mop.api.workspace.Site;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public abstract class AbstractNavigationOperationHandler extends AbstractSiteOperationHandler
-{
- @Override
- protected void execute(OperationContext operationContext, ResultHandler resultHandler, Site site) throws ResourceNotFoundException, OperationException
- {
- Navigation navigation = site.getRootNavigation().getChild("default");
- if (navigation == null) throw new ResourceNotFoundException("Navigation does not exist for site " + getSiteKey(site));
-
- execute(operationContext, resultHandler, navigation);
- }
-
- protected abstract void execute(OperationContext operationContext, ResultHandler resultHandler, Navigation defaultNavigation);
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/AbstractNavigationOperationHandler.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/AbstractNavigationOperationHandler.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/AbstractNavigationOperationHandler.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/AbstractNavigationOperationHandler.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.navigation;
+
+import org.exoplatform.portal.mop.management.operations.site.AbstractSiteOperationHandler;
+import org.gatein.management.api.exceptions.OperationException;
+import org.gatein.management.api.exceptions.ResourceNotFoundException;
+import org.gatein.management.api.operation.OperationContext;
+import org.gatein.management.api.operation.ResultHandler;
+import org.gatein.mop.api.workspace.Navigation;
+import org.gatein.mop.api.workspace.Site;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public abstract class AbstractNavigationOperationHandler extends AbstractSiteOperationHandler
+{
+ @Override
+ protected void execute(OperationContext operationContext, ResultHandler resultHandler, Site site) throws ResourceNotFoundException, OperationException
+ {
+ Navigation navigation = site.getRootNavigation().getChild("default");
+ if (navigation == null) throw new ResourceNotFoundException("Navigation does not exist for site " + getSiteKey(site));
+
+ execute(operationContext, resultHandler, navigation);
+ }
+
+ protected abstract void execute(OperationContext operationContext, ResultHandler resultHandler, Navigation defaultNavigation);
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationExportResource.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationExportResource.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationExportResource.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.navigation;
-
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.description.DescriptionService;
-import org.exoplatform.portal.mop.management.exportimport.NavigationExportTask;
-import org.exoplatform.portal.mop.navigation.NavigationService;
-import org.gatein.management.api.ContentType;
-import org.gatein.management.api.binding.BindingProvider;
-import org.gatein.management.api.binding.Marshaller;
-import org.gatein.management.api.exceptions.OperationException;
-import org.gatein.management.api.exceptions.ResourceNotFoundException;
-import org.gatein.management.api.operation.OperationContext;
-import org.gatein.management.api.operation.ResultHandler;
-import org.gatein.management.api.operation.model.ExportResourceModel;
-import org.gatein.mop.api.workspace.Navigation;
-import org.gatein.mop.api.workspace.Site;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class NavigationExportResource extends AbstractNavigationOperationHandler
-{
- @Override
- protected void execute(OperationContext operationContext, ResultHandler resultHandler, Navigation navigation) throws ResourceNotFoundException, OperationException
- {
- Site site = navigation.getSite();
- String navUri = operationContext.getAddress().resolvePathTemplate("nav-uri");
- SiteKey siteKey = getSiteKey(site);
-
- DescriptionService descriptionService = operationContext.getRuntimeContext().getRuntimeComponent(DescriptionService.class);
- NavigationService navigationService = operationContext.getRuntimeContext().getRuntimeComponent(NavigationService.class);
- BindingProvider bindingProvider = operationContext.getBindingProvider();
- Marshaller<PageNavigation> marshaller = bindingProvider.getMarshaller(PageNavigation.class, ContentType.XML);
-
- NavigationExportTask exportTask = new NavigationExportTask(new NavigationKey(siteKey, navUri), navigationService, descriptionService, marshaller);
-
- resultHandler.completed(new ExportResourceModel(exportTask));
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationExportResource.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationExportResource.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationExportResource.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationExportResource.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.navigation;
+
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.description.DescriptionService;
+import org.exoplatform.portal.mop.management.exportimport.NavigationExportTask;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.gatein.management.api.ContentType;
+import org.gatein.management.api.binding.BindingProvider;
+import org.gatein.management.api.binding.Marshaller;
+import org.gatein.management.api.exceptions.OperationException;
+import org.gatein.management.api.exceptions.ResourceNotFoundException;
+import org.gatein.management.api.operation.OperationContext;
+import org.gatein.management.api.operation.ResultHandler;
+import org.gatein.management.api.operation.model.ExportResourceModel;
+import org.gatein.mop.api.workspace.Navigation;
+import org.gatein.mop.api.workspace.Site;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class NavigationExportResource extends AbstractNavigationOperationHandler
+{
+ @Override
+ protected void execute(OperationContext operationContext, ResultHandler resultHandler, Navigation navigation) throws ResourceNotFoundException, OperationException
+ {
+ Site site = navigation.getSite();
+ String navUri = operationContext.getAddress().resolvePathTemplate("nav-uri");
+ SiteKey siteKey = getSiteKey(site);
+
+ DescriptionService descriptionService = operationContext.getRuntimeContext().getRuntimeComponent(DescriptionService.class);
+ NavigationService navigationService = operationContext.getRuntimeContext().getRuntimeComponent(NavigationService.class);
+ BindingProvider bindingProvider = operationContext.getBindingProvider();
+ Marshaller<PageNavigation> marshaller = bindingProvider.getMarshaller(PageNavigation.class, ContentType.XML);
+
+ NavigationExportTask exportTask = new NavigationExportTask(new NavigationKey(siteKey, navUri), navigationService, descriptionService, marshaller);
+
+ resultHandler.completed(new ExportResourceModel(exportTask));
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationKey.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationKey.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationKey.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.navigation;
-
-import org.exoplatform.portal.mop.SiteKey;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class NavigationKey
-{
- private SiteKey siteKey;
- private String navUri;
-
- public NavigationKey(SiteKey siteKey)
- {
- this.siteKey = siteKey;
- }
-
- public NavigationKey(SiteKey siteKey, String navUri)
- {
- this.siteKey = siteKey;
- this.navUri = navUri;
- }
-
- public SiteKey getSiteKey()
- {
- return siteKey;
- }
-
- public String getNavUri()
- {
- return navUri;
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationKey.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationKey.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationKey.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationKey.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.navigation;
+
+import org.exoplatform.portal.mop.SiteKey;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class NavigationKey
+{
+ private SiteKey siteKey;
+ private String navUri;
+
+ public NavigationKey(SiteKey siteKey)
+ {
+ this.siteKey = siteKey;
+ }
+
+ public NavigationKey(SiteKey siteKey, String navUri)
+ {
+ this.siteKey = siteKey;
+ this.navUri = navUri;
+ }
+
+ public SiteKey getSiteKey()
+ {
+ return siteKey;
+ }
+
+ public String getNavUri()
+ {
+ return navUri;
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationReadConfigAsXml.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationReadConfigAsXml.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationReadConfigAsXml.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,59 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.navigation;
-
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.description.DescriptionService;
-import org.exoplatform.portal.mop.navigation.NavigationService;
-import org.gatein.management.api.exceptions.ResourceNotFoundException;
-import org.gatein.management.api.operation.OperationContext;
-import org.gatein.management.api.operation.ResultHandler;
-import org.gatein.mop.api.workspace.Navigation;
-import org.gatein.mop.api.workspace.Site;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class NavigationReadConfigAsXml extends AbstractNavigationOperationHandler
-{
- @Override
- protected void execute(OperationContext operationContext, ResultHandler resultHandler, Navigation defaultNavigation)
- {
- String navUri = operationContext.getAddress().resolvePathTemplate("nav-uri");
-
- Site site = defaultNavigation.getSite();
- SiteKey siteKey = getSiteKey(site);
-
- //TODO: If there's any benefit in creating our own node model to use with navigation service, lets do it
-
- DescriptionService descriptionService = operationContext.getRuntimeContext().getRuntimeComponent(DescriptionService.class);
- NavigationService navigationService = operationContext.getRuntimeContext().getRuntimeComponent(NavigationService.class);
-
- PageNavigation pageNavigation = NavigationUtils.loadPageNavigation(new NavigationKey(siteKey, navUri), navigationService, descriptionService);
- if (pageNavigation == null) throw new ResourceNotFoundException("Navigation node not found for navigation uri '" + navUri +"'");
-
- resultHandler.completed(pageNavigation);
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationReadConfigAsXml.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationReadConfigAsXml.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationReadConfigAsXml.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationReadConfigAsXml.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.navigation;
+
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.description.DescriptionService;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.gatein.management.api.exceptions.ResourceNotFoundException;
+import org.gatein.management.api.operation.OperationContext;
+import org.gatein.management.api.operation.ResultHandler;
+import org.gatein.mop.api.workspace.Navigation;
+import org.gatein.mop.api.workspace.Site;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class NavigationReadConfigAsXml extends AbstractNavigationOperationHandler
+{
+ @Override
+ protected void execute(OperationContext operationContext, ResultHandler resultHandler, Navigation defaultNavigation)
+ {
+ String navUri = operationContext.getAddress().resolvePathTemplate("nav-uri");
+
+ Site site = defaultNavigation.getSite();
+ SiteKey siteKey = getSiteKey(site);
+
+ //TODO: If there's any benefit in creating our own node model to use with navigation service, lets do it
+
+ DescriptionService descriptionService = operationContext.getRuntimeContext().getRuntimeComponent(DescriptionService.class);
+ NavigationService navigationService = operationContext.getRuntimeContext().getRuntimeComponent(NavigationService.class);
+
+ PageNavigation pageNavigation = NavigationUtils.loadPageNavigation(new NavigationKey(siteKey, navUri), navigationService, descriptionService);
+ if (pageNavigation == null) throw new ResourceNotFoundException("Navigation node not found for navigation uri '" + navUri +"'");
+
+ resultHandler.completed(pageNavigation);
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationReadResource.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationReadResource.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationReadResource.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,47 +0,0 @@
-package org.exoplatform.portal.mop.management.operations.navigation;
-
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.navigation.NavigationContext;
-import org.exoplatform.portal.mop.navigation.NavigationService;
-import org.exoplatform.portal.mop.navigation.NodeContext;
-import org.gatein.management.api.exceptions.ResourceNotFoundException;
-import org.gatein.management.api.operation.OperationContext;
-import org.gatein.management.api.operation.ResultHandler;
-import org.gatein.management.api.operation.model.ReadResourceModel;
-import org.gatein.mop.api.workspace.Navigation;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class NavigationReadResource extends AbstractNavigationOperationHandler
-{
- @Override
- protected void execute(OperationContext operationContext, ResultHandler resultHandler, Navigation defaultNavigation)
- {
- SiteKey siteKey = getSiteKey(defaultNavigation.getSite());
- String navUri = operationContext.getAddress().resolvePathTemplate("nav-uri");
-
- NavigationService navigationService = operationContext.getRuntimeContext().getRuntimeComponent(NavigationService.class);
- NavigationContext navigation = navigationService.loadNavigation(siteKey);
-
- Set<String> children = new LinkedHashSet<String>();
-
- NodeContext<NodeContext<?>> node = NavigationUtils.loadNode(navigationService, navigation, navUri);
- if (node == null)
- {
- throw new ResourceNotFoundException("Navigation node not found for navigation uri '" + navUri +"'");
- }
-
- for (NodeContext child : node.getNodes())
- {
- children.add(child.getName());
- }
-
- ReadResourceModel model = new ReadResourceModel("Navigation nodes available at this resource.", children);
- resultHandler.completed(model);
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationReadResource.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationReadResource.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationReadResource.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationReadResource.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,47 @@
+package org.exoplatform.portal.mop.management.operations.navigation;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.navigation.NavigationContext;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.mop.navigation.NodeContext;
+import org.gatein.management.api.exceptions.ResourceNotFoundException;
+import org.gatein.management.api.operation.OperationContext;
+import org.gatein.management.api.operation.ResultHandler;
+import org.gatein.management.api.operation.model.ReadResourceModel;
+import org.gatein.mop.api.workspace.Navigation;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class NavigationReadResource extends AbstractNavigationOperationHandler
+{
+ @Override
+ protected void execute(OperationContext operationContext, ResultHandler resultHandler, Navigation defaultNavigation)
+ {
+ SiteKey siteKey = getSiteKey(defaultNavigation.getSite());
+ String navUri = operationContext.getAddress().resolvePathTemplate("nav-uri");
+
+ NavigationService navigationService = operationContext.getRuntimeContext().getRuntimeComponent(NavigationService.class);
+ NavigationContext navigation = navigationService.loadNavigation(siteKey);
+
+ Set<String> children = new LinkedHashSet<String>();
+
+ NodeContext<NodeContext<?>> node = NavigationUtils.loadNode(navigationService, navigation, navUri);
+ if (node == null)
+ {
+ throw new ResourceNotFoundException("Navigation node not found for navigation uri '" + navUri +"'");
+ }
+
+ for (NodeContext child : node.getNodes())
+ {
+ children.add(child.getName());
+ }
+
+ ReadResourceModel model = new ReadResourceModel("Navigation nodes available at this resource.", children);
+ resultHandler.completed(model);
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationUtils.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationUtils.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationUtils.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,218 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.navigation;
-
-import org.exoplatform.portal.config.model.I18NString;
-import org.exoplatform.portal.config.model.LocalizedString;
-import org.exoplatform.portal.config.model.NavigationFragment;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.mop.Described;
-import org.exoplatform.portal.mop.description.DescriptionService;
-import org.exoplatform.portal.mop.navigation.GenericScope;
-import org.exoplatform.portal.mop.navigation.NavigationContext;
-import org.exoplatform.portal.mop.navigation.NavigationService;
-import org.exoplatform.portal.mop.navigation.NodeContext;
-import org.exoplatform.portal.mop.navigation.NodeModel;
-import org.exoplatform.portal.mop.navigation.Scope;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class NavigationUtils
-{
- private NavigationUtils(){}
-
- public static PageNavigation loadPageNavigation(NavigationKey key, NavigationService navigationService, DescriptionService descriptionService)
- {
- NavigationContext navigation = navigationService.loadNavigation(key.getSiteKey());
- if (navigation == null) return null;
-
- NodeContext<NodeContext<?>> node = loadNode(navigationService, navigation, key.getNavUri());
- if (node == null) return null;
-
- if (key.getNavUri() != null)
- {
- return createFragmentedPageNavigation(descriptionService, navigation, node);
- }
- else
- {
- return createPageNavigation(descriptionService, navigation, node);
- }
- }
-
- public static NodeContext<NodeContext<?>> loadNode(NavigationService navigationService, NavigationContext navigation, String navUri)
- {
- if (navigation == null) return null;
-
- if (navUri != null)
- {
- String[] path = trim(navUri.split("/"));
- NodeContext<NodeContext<?>> node = navigationService.loadNode(NodeModel.SELF_MODEL, navigation, GenericScope.branchShape(path, Scope.ALL), null);
- for (String name : path)
- {
- node = node.get(name);
- if (node == null) break;
- }
-
- return node;
- }
- else
- {
- return navigationService.loadNode(NodeModel.SELF_MODEL, navigation, Scope.ALL, null);
- }
- }
-
- public static PageNavigation createPageNavigation(DescriptionService service, NavigationContext navigation, NodeContext<NodeContext<?>> node)
- {
- PageNavigation pageNavigation = new PageNavigation();
- pageNavigation.setPriority(navigation.getState().getPriority());
- pageNavigation.setOwnerType(navigation.getKey().getTypeName());
- pageNavigation.setOwnerId(navigation.getKey().getName());
-
- ArrayList<PageNode> children = new ArrayList<PageNode>(node.getNodeCount());
- for (NodeContext<?> child : node.getNodes())
- {
- @SuppressWarnings("unchecked")
- NodeContext<NodeContext<?>> childNode = (NodeContext<NodeContext<?>>) child;
- children.add(createPageNode(service, childNode));
- }
-
- NavigationFragment fragment = new NavigationFragment();
- fragment.setNodes(children);
- pageNavigation.addFragment(fragment);
-
- return pageNavigation;
- }
-
- private static PageNavigation createFragmentedPageNavigation(DescriptionService service, NavigationContext navigation, NodeContext<NodeContext<?>> node)
- {
- PageNavigation pageNavigation = new PageNavigation();
- pageNavigation.setPriority(navigation.getState().getPriority());
- pageNavigation.setOwnerType(navigation.getKey().getTypeName());
- pageNavigation.setOwnerId(navigation.getKey().getName());
-
- ArrayList<PageNode> children = new ArrayList<PageNode>(1);
- children.add(createPageNode(service, node));
-
- NavigationFragment fragment = new NavigationFragment();
- StringBuilder parentUri = new StringBuilder("/");
- getPath(node.getParent(), parentUri);
- fragment.setParentURI(parentUri.toString());
- fragment.setNodes(children);
-
- pageNavigation.addFragment(fragment);
-
- return pageNavigation;
- }
-
- private static void getPath(NodeContext<NodeContext<?>> node, StringBuilder parentUri)
- {
- if (node == null) return;
- if (node.getParent() == null) return; // since "default" is the root node, we ignore it
-
- parentUri.insert(0, node.getName()).append("/");
- getPath(node.getParent(), parentUri);
- }
-
- private static PageNode createPageNode(DescriptionService service, NodeContext<NodeContext<?>> node)
- {
- PageNode pageNode = new PageNode();
- pageNode.setName(node.getName());
-
- if (node.getState().getLabel() == null)
- {
- Map<Locale, Described.State> descriptions = service.getDescriptions(node.getId());
- if (descriptions != null && !descriptions.isEmpty())
- {
- I18NString labels = new I18NString();
- for (Map.Entry<Locale, Described.State> entry : descriptions.entrySet())
- {
- labels.add(new LocalizedString(entry.getValue().getName(), entry.getKey()));
- }
-
- pageNode.setLabels(labels);
- }
- }
- else
- {
- pageNode.setLabel(node.getState().getLabel());
- }
-
- pageNode.setIcon(node.getState().getIcon());
- long startPublicationTime = node.getState().getStartPublicationTime();
- if (startPublicationTime != -1)
- {
- pageNode.setStartPublicationDate(new Date(startPublicationTime));
- }
-
- long endPublicationTime = node.getState().getEndPublicationTime();
- if (endPublicationTime != -1)
- {
- pageNode.setEndPublicationDate(new Date(endPublicationTime));
- }
-
- pageNode.setVisibility(node.getState().getVisibility());
- pageNode.setPageReference(node.getState().getPageRef());
-
- if (node.getNodes() != null)
- {
- ArrayList<PageNode> children = new ArrayList<PageNode>(node.getNodeCount());
- for (NodeContext<?> child : node.getNodes())
- {
- @SuppressWarnings("unchecked")
- NodeContext<NodeContext<?>> childNode = (NodeContext<NodeContext<?>>) child;
- children.add(createPageNode(service, childNode));
- }
-
- pageNode.setChildren(children);
- }
- else
- {
- pageNode.setChildren(new ArrayList<PageNode>(0));
- }
-
- return pageNode;
- }
-
- private static String[] trim(String[] array)
- {
- List<String> trimmed = new ArrayList<String>(array.length);
- for (String s : array)
- {
- if (s != null && !"".equals(s))
- {
- trimmed.add(s);
- }
- }
-
- return trimmed.toArray(new String[trimmed.size()]);
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationUtils.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationUtils.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationUtils.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/navigation/NavigationUtils.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,218 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.navigation;
+
+import org.exoplatform.portal.config.model.I18NString;
+import org.exoplatform.portal.config.model.LocalizedString;
+import org.exoplatform.portal.config.model.NavigationFragment;
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.Described;
+import org.exoplatform.portal.mop.description.DescriptionService;
+import org.exoplatform.portal.mop.navigation.GenericScope;
+import org.exoplatform.portal.mop.navigation.NavigationContext;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.mop.navigation.NodeContext;
+import org.exoplatform.portal.mop.navigation.NodeModel;
+import org.exoplatform.portal.mop.navigation.Scope;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class NavigationUtils
+{
+ private NavigationUtils(){}
+
+ public static PageNavigation loadPageNavigation(NavigationKey key, NavigationService navigationService, DescriptionService descriptionService)
+ {
+ NavigationContext navigation = navigationService.loadNavigation(key.getSiteKey());
+ if (navigation == null) return null;
+
+ NodeContext<NodeContext<?>> node = loadNode(navigationService, navigation, key.getNavUri());
+ if (node == null) return null;
+
+ if (key.getNavUri() != null)
+ {
+ return createFragmentedPageNavigation(descriptionService, navigation, node);
+ }
+ else
+ {
+ return createPageNavigation(descriptionService, navigation, node);
+ }
+ }
+
+ public static NodeContext<NodeContext<?>> loadNode(NavigationService navigationService, NavigationContext navigation, String navUri)
+ {
+ if (navigation == null) return null;
+
+ if (navUri != null)
+ {
+ String[] path = trim(navUri.split("/"));
+ NodeContext<NodeContext<?>> node = navigationService.loadNode(NodeModel.SELF_MODEL, navigation, GenericScope.branchShape(path, Scope.ALL), null);
+ for (String name : path)
+ {
+ node = node.get(name);
+ if (node == null) break;
+ }
+
+ return node;
+ }
+ else
+ {
+ return navigationService.loadNode(NodeModel.SELF_MODEL, navigation, Scope.ALL, null);
+ }
+ }
+
+ public static PageNavigation createPageNavigation(DescriptionService service, NavigationContext navigation, NodeContext<NodeContext<?>> node)
+ {
+ PageNavigation pageNavigation = new PageNavigation();
+ pageNavigation.setPriority(navigation.getState().getPriority());
+ pageNavigation.setOwnerType(navigation.getKey().getTypeName());
+ pageNavigation.setOwnerId(navigation.getKey().getName());
+
+ ArrayList<PageNode> children = new ArrayList<PageNode>(node.getNodeCount());
+ for (NodeContext<?> child : node.getNodes())
+ {
+ @SuppressWarnings("unchecked")
+ NodeContext<NodeContext<?>> childNode = (NodeContext<NodeContext<?>>) child;
+ children.add(createPageNode(service, childNode));
+ }
+
+ NavigationFragment fragment = new NavigationFragment();
+ fragment.setNodes(children);
+ pageNavigation.addFragment(fragment);
+
+ return pageNavigation;
+ }
+
+ private static PageNavigation createFragmentedPageNavigation(DescriptionService service, NavigationContext navigation, NodeContext<NodeContext<?>> node)
+ {
+ PageNavigation pageNavigation = new PageNavigation();
+ pageNavigation.setPriority(navigation.getState().getPriority());
+ pageNavigation.setOwnerType(navigation.getKey().getTypeName());
+ pageNavigation.setOwnerId(navigation.getKey().getName());
+
+ ArrayList<PageNode> children = new ArrayList<PageNode>(1);
+ children.add(createPageNode(service, node));
+
+ NavigationFragment fragment = new NavigationFragment();
+ StringBuilder parentUri = new StringBuilder("/");
+ getPath(node.getParent(), parentUri);
+ fragment.setParentURI(parentUri.toString());
+ fragment.setNodes(children);
+
+ pageNavigation.addFragment(fragment);
+
+ return pageNavigation;
+ }
+
+ private static void getPath(NodeContext<NodeContext<?>> node, StringBuilder parentUri)
+ {
+ if (node == null) return;
+ if (node.getParent() == null) return; // since "default" is the root node, we ignore it
+
+ parentUri.insert(0, node.getName()).append("/");
+ getPath(node.getParent(), parentUri);
+ }
+
+ private static PageNode createPageNode(DescriptionService service, NodeContext<NodeContext<?>> node)
+ {
+ PageNode pageNode = new PageNode();
+ pageNode.setName(node.getName());
+
+ if (node.getState().getLabel() == null)
+ {
+ Map<Locale, Described.State> descriptions = service.getDescriptions(node.getId());
+ if (descriptions != null && !descriptions.isEmpty())
+ {
+ I18NString labels = new I18NString();
+ for (Map.Entry<Locale, Described.State> entry : descriptions.entrySet())
+ {
+ labels.add(new LocalizedString(entry.getValue().getName(), entry.getKey()));
+ }
+
+ pageNode.setLabels(labels);
+ }
+ }
+ else
+ {
+ pageNode.setLabel(node.getState().getLabel());
+ }
+
+ pageNode.setIcon(node.getState().getIcon());
+ long startPublicationTime = node.getState().getStartPublicationTime();
+ if (startPublicationTime != -1)
+ {
+ pageNode.setStartPublicationDate(new Date(startPublicationTime));
+ }
+
+ long endPublicationTime = node.getState().getEndPublicationTime();
+ if (endPublicationTime != -1)
+ {
+ pageNode.setEndPublicationDate(new Date(endPublicationTime));
+ }
+
+ pageNode.setVisibility(node.getState().getVisibility());
+ pageNode.setPageReference(node.getState().getPageRef());
+
+ if (node.getNodes() != null)
+ {
+ ArrayList<PageNode> children = new ArrayList<PageNode>(node.getNodeCount());
+ for (NodeContext<?> child : node.getNodes())
+ {
+ @SuppressWarnings("unchecked")
+ NodeContext<NodeContext<?>> childNode = (NodeContext<NodeContext<?>>) child;
+ children.add(createPageNode(service, childNode));
+ }
+
+ pageNode.setChildren(children);
+ }
+ else
+ {
+ pageNode.setChildren(new ArrayList<PageNode>(0));
+ }
+
+ return pageNode;
+ }
+
+ private static String[] trim(String[] array)
+ {
+ List<String> trimmed = new ArrayList<String>(array.length);
+ for (String s : array)
+ {
+ if (s != null && !"".equals(s))
+ {
+ trimmed.add(s);
+ }
+ }
+
+ return trimmed.toArray(new String[trimmed.size()]);
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/AbstractPageOperationHandler.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/AbstractPageOperationHandler.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/AbstractPageOperationHandler.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.page;
-
-import org.exoplatform.portal.mop.management.operations.site.AbstractSiteOperationHandler;
-import org.gatein.management.api.exceptions.OperationException;
-import org.gatein.management.api.exceptions.ResourceNotFoundException;
-import org.gatein.management.api.operation.OperationContext;
-import org.gatein.management.api.operation.ResultHandler;
-import org.gatein.mop.api.workspace.Page;
-import org.gatein.mop.api.workspace.Site;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public abstract class AbstractPageOperationHandler extends AbstractSiteOperationHandler
-{
- @Override
- protected void execute(OperationContext operationContext, ResultHandler resultHandler, Site site) throws ResourceNotFoundException, OperationException
- {
- Page pages = site.getRootPage().getChild("pages");
- if (pages == null || pages.getChildren().isEmpty()) throw new ResourceNotFoundException("No pages found for site " + getSiteKey(site));
-
- execute(operationContext, resultHandler, pages);
- }
-
- protected abstract void execute(OperationContext operationContext, ResultHandler resultHandler, Page page) throws ResourceNotFoundException, OperationException;
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/AbstractPageOperationHandler.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/AbstractPageOperationHandler.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/AbstractPageOperationHandler.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/AbstractPageOperationHandler.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.page;
+
+import org.exoplatform.portal.mop.management.operations.site.AbstractSiteOperationHandler;
+import org.gatein.management.api.exceptions.OperationException;
+import org.gatein.management.api.exceptions.ResourceNotFoundException;
+import org.gatein.management.api.operation.OperationContext;
+import org.gatein.management.api.operation.ResultHandler;
+import org.gatein.mop.api.workspace.Page;
+import org.gatein.mop.api.workspace.Site;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public abstract class AbstractPageOperationHandler extends AbstractSiteOperationHandler
+{
+ @Override
+ protected void execute(OperationContext operationContext, ResultHandler resultHandler, Site site) throws ResourceNotFoundException, OperationException
+ {
+ Page pages = site.getRootPage().getChild("pages");
+ if (pages == null || pages.getChildren().isEmpty()) throw new ResourceNotFoundException("No pages found for site " + getSiteKey(site));
+
+ execute(operationContext, resultHandler, pages);
+ }
+
+ protected abstract void execute(OperationContext operationContext, ResultHandler resultHandler, Page page) throws ResourceNotFoundException, OperationException;
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageExportResource.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageExportResource.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageExportResource.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,84 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.page;
-
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.management.exportimport.PageExportTask;
-import org.gatein.management.api.ContentType;
-import org.gatein.management.api.binding.BindingProvider;
-import org.gatein.management.api.exceptions.OperationException;
-import org.gatein.management.api.exceptions.ResourceNotFoundException;
-import org.gatein.management.api.operation.OperationContext;
-import org.gatein.management.api.operation.ResultHandler;
-import org.gatein.management.api.operation.model.ExportResourceModel;
-import org.gatein.management.api.operation.model.ExportTask;
-import org.gatein.mop.api.workspace.Page;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class PageExportResource extends AbstractPageOperationHandler
-{
- @Override
- protected void execute(OperationContext operationContext, ResultHandler resultHandler, Page pages) throws ResourceNotFoundException, OperationException
- {
- SiteKey siteKey = getSiteKey(pages.getSite());
-
- DataStorage dataStorage = operationContext.getRuntimeContext().getRuntimeComponent(DataStorage.class);
- BindingProvider bindingProvider = operationContext.getBindingProvider();
-
- Collection<Page> pagesList = pages.getChildren();
- List<ExportTask> tasks = new ArrayList<ExportTask>(pagesList.size());
- PageExportTask pageExportTask =
- new PageExportTask(siteKey, dataStorage, bindingProvider.getMarshaller(
- org.exoplatform.portal.config.model.Page.PageSet.class, ContentType.XML));
-
- String pageName = operationContext.getAddress().resolvePathTemplate("page-name");
- for (Page page : pagesList)
- {
- if (pageName == null)
- {
- pageExportTask.addPageName(page.getName());
- }
- else if (pageName.equals(page.getName()))
- {
- pageExportTask.addPageName(page.getName());
- }
- }
-
- if (pageExportTask.getPageNames().isEmpty() && pageName != null)
- {
- throw new ResourceNotFoundException("No page found for " + new PageKey(siteKey, pageName));
- }
-
- tasks.add(pageExportTask);
-
- resultHandler.completed(new ExportResourceModel(tasks));
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageExportResource.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageExportResource.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageExportResource.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageExportResource.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.page;
+
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.management.exportimport.PageExportTask;
+import org.gatein.management.api.ContentType;
+import org.gatein.management.api.binding.BindingProvider;
+import org.gatein.management.api.exceptions.OperationException;
+import org.gatein.management.api.exceptions.ResourceNotFoundException;
+import org.gatein.management.api.operation.OperationContext;
+import org.gatein.management.api.operation.ResultHandler;
+import org.gatein.management.api.operation.model.ExportResourceModel;
+import org.gatein.management.api.operation.model.ExportTask;
+import org.gatein.mop.api.workspace.Page;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class PageExportResource extends AbstractPageOperationHandler
+{
+ @Override
+ protected void execute(OperationContext operationContext, ResultHandler resultHandler, Page pages) throws ResourceNotFoundException, OperationException
+ {
+ SiteKey siteKey = getSiteKey(pages.getSite());
+
+ DataStorage dataStorage = operationContext.getRuntimeContext().getRuntimeComponent(DataStorage.class);
+ BindingProvider bindingProvider = operationContext.getBindingProvider();
+
+ Collection<Page> pagesList = pages.getChildren();
+ List<ExportTask> tasks = new ArrayList<ExportTask>(pagesList.size());
+ PageExportTask pageExportTask =
+ new PageExportTask(siteKey, dataStorage, bindingProvider.getMarshaller(
+ org.exoplatform.portal.config.model.Page.PageSet.class, ContentType.XML));
+
+ String pageName = operationContext.getAddress().resolvePathTemplate("page-name");
+ for (Page page : pagesList)
+ {
+ if (pageName == null)
+ {
+ pageExportTask.addPageName(page.getName());
+ }
+ else if (pageName.equals(page.getName()))
+ {
+ pageExportTask.addPageName(page.getName());
+ }
+ }
+
+ if (pageExportTask.getPageNames().isEmpty() && pageName != null)
+ {
+ throw new ResourceNotFoundException("No page found for " + new PageKey(siteKey, pageName));
+ }
+
+ tasks.add(pageExportTask);
+
+ resultHandler.completed(new ExportResourceModel(tasks));
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageKey.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageKey.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageKey.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,43 +0,0 @@
-package org.exoplatform.portal.mop.management.operations.page;
-
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.pom.config.Utils;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class PageKey
-{
- private final SiteKey siteKey;
- private final String pageName;
- private final String pageId;
-
- public PageKey(SiteKey siteKey, String pageName)
- {
- this.siteKey = siteKey;
- this.pageName = pageName;
- this.pageId = Utils.join("::", siteKey.getTypeName(), siteKey.getName(), pageName);
- }
-
- public SiteKey getSiteKey()
- {
- return siteKey;
- }
-
- public String getPageName()
- {
- return pageName;
- }
-
- public String getPageId()
- {
- return pageId;
- }
-
- @Override
- public String toString()
- {
- return "PageKey{siteKey=" + siteKey + ", pageName='" + pageName + "'}";
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageKey.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageKey.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageKey.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageKey.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,43 @@
+package org.exoplatform.portal.mop.management.operations.page;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.pom.config.Utils;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class PageKey
+{
+ private final SiteKey siteKey;
+ private final String pageName;
+ private final String pageId;
+
+ public PageKey(SiteKey siteKey, String pageName)
+ {
+ this.siteKey = siteKey;
+ this.pageName = pageName;
+ this.pageId = Utils.join("::", siteKey.getTypeName(), siteKey.getName(), pageName);
+ }
+
+ public SiteKey getSiteKey()
+ {
+ return siteKey;
+ }
+
+ public String getPageName()
+ {
+ return pageName;
+ }
+
+ public String getPageId()
+ {
+ return pageId;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "PageKey{siteKey=" + siteKey + ", pageName='" + pageName + "'}";
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageReadConfigAsXml.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageReadConfigAsXml.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageReadConfigAsXml.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.page;
-
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.Query;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.mop.SiteKey;
-import org.gatein.management.api.exceptions.OperationException;
-import org.gatein.management.api.exceptions.ResourceNotFoundException;
-import org.gatein.management.api.operation.OperationContext;
-import org.gatein.management.api.operation.ResultHandler;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class PageReadConfigAsXml extends AbstractPageOperationHandler
-{
- @Override
- protected void execute(OperationContext operationContext, ResultHandler resultHandler, org.gatein.mop.api.workspace.Page rootPage) throws ResourceNotFoundException, OperationException
- {
- SiteKey siteKey = getSiteKey(rootPage.getSite());
- DataStorage dataStorage = operationContext.getRuntimeContext().getRuntimeComponent(DataStorage.class);
-
- String pageName = operationContext.getAddress().resolvePathTemplate("page-name");
- if (pageName == null)
- {
- resultHandler.completed(PageUtils.getAllPages(dataStorage, siteKey, operationContext.getOperationName()));
- }
- else
- {
- PageKey key = new PageKey(siteKey, pageName);
- Page page = PageUtils.getPage(dataStorage, key, operationContext.getOperationName());
- if (page == null)
- {
- throw new ResourceNotFoundException("No page found for " + key);
- }
- else
- {
- resultHandler.completed(page);
- }
- }
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageReadConfigAsXml.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageReadConfigAsXml.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageReadConfigAsXml.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageReadConfigAsXml.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.page;
+
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.Query;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.mop.SiteKey;
+import org.gatein.management.api.exceptions.OperationException;
+import org.gatein.management.api.exceptions.ResourceNotFoundException;
+import org.gatein.management.api.operation.OperationContext;
+import org.gatein.management.api.operation.ResultHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class PageReadConfigAsXml extends AbstractPageOperationHandler
+{
+ @Override
+ protected void execute(OperationContext operationContext, ResultHandler resultHandler, org.gatein.mop.api.workspace.Page rootPage) throws ResourceNotFoundException, OperationException
+ {
+ SiteKey siteKey = getSiteKey(rootPage.getSite());
+ DataStorage dataStorage = operationContext.getRuntimeContext().getRuntimeComponent(DataStorage.class);
+
+ String pageName = operationContext.getAddress().resolvePathTemplate("page-name");
+ if (pageName == null)
+ {
+ resultHandler.completed(PageUtils.getAllPages(dataStorage, siteKey, operationContext.getOperationName()));
+ }
+ else
+ {
+ PageKey key = new PageKey(siteKey, pageName);
+ Page page = PageUtils.getPage(dataStorage, key, operationContext.getOperationName());
+ if (page == null)
+ {
+ throw new ResourceNotFoundException("No page found for " + key);
+ }
+ else
+ {
+ resultHandler.completed(page);
+ }
+ }
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageReadResource.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageReadResource.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageReadResource.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,50 +0,0 @@
-package org.exoplatform.portal.mop.management.operations.page;
-
-import org.exoplatform.portal.config.DataStorage;
-import org.gatein.management.api.exceptions.OperationException;
-import org.gatein.management.api.exceptions.ResourceNotFoundException;
-import org.gatein.management.api.operation.OperationContext;
-import org.gatein.management.api.operation.ResultHandler;
-import org.gatein.management.api.operation.model.ReadResourceModel;
-import org.gatein.mop.api.workspace.Page;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class PageReadResource extends AbstractPageOperationHandler
-{
- @Override
- protected void execute(OperationContext operationContext, ResultHandler resultHandler, Page rootPage) throws ResourceNotFoundException, OperationException
- {
- String pageName = operationContext.getAddress().resolvePathTemplate("page-name");
- if (pageName == null)
- {
- Collection<Page> pageList = rootPage.getChildren();
- Set<String> children = new LinkedHashSet<String>(pageList.size());
- for (Page page : pageList)
- {
- children.add(page.getName());
- }
-
- resultHandler.completed(new ReadResourceModel("List of all available pages for site '" + rootPage.getSite().getName() +"'", children));
- }
- else
- {
- DataStorage dataStorage = operationContext.getRuntimeContext().getRuntimeComponent(DataStorage.class);
- PageKey pageKey = new PageKey(getSiteKey(rootPage.getSite()), pageName);
-
- if (PageUtils.getPage(dataStorage, pageKey, operationContext.getOperationName()) == null)
- {
- throw new ResourceNotFoundException("No page found for " + pageKey);
- }
-
- resultHandler.completed(new ReadResourceModel("List of child pages for page '" + pageName +"'", Collections.<String>emptySet()));
- }
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageReadResource.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageReadResource.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageReadResource.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageReadResource.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,50 @@
+package org.exoplatform.portal.mop.management.operations.page;
+
+import org.exoplatform.portal.config.DataStorage;
+import org.gatein.management.api.exceptions.OperationException;
+import org.gatein.management.api.exceptions.ResourceNotFoundException;
+import org.gatein.management.api.operation.OperationContext;
+import org.gatein.management.api.operation.ResultHandler;
+import org.gatein.management.api.operation.model.ReadResourceModel;
+import org.gatein.mop.api.workspace.Page;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class PageReadResource extends AbstractPageOperationHandler
+{
+ @Override
+ protected void execute(OperationContext operationContext, ResultHandler resultHandler, Page rootPage) throws ResourceNotFoundException, OperationException
+ {
+ String pageName = operationContext.getAddress().resolvePathTemplate("page-name");
+ if (pageName == null)
+ {
+ Collection<Page> pageList = rootPage.getChildren();
+ Set<String> children = new LinkedHashSet<String>(pageList.size());
+ for (Page page : pageList)
+ {
+ children.add(page.getName());
+ }
+
+ resultHandler.completed(new ReadResourceModel("List of all available pages for site '" + rootPage.getSite().getName() +"'", children));
+ }
+ else
+ {
+ DataStorage dataStorage = operationContext.getRuntimeContext().getRuntimeComponent(DataStorage.class);
+ PageKey pageKey = new PageKey(getSiteKey(rootPage.getSite()), pageName);
+
+ if (PageUtils.getPage(dataStorage, pageKey, operationContext.getOperationName()) == null)
+ {
+ throw new ResourceNotFoundException("No page found for " + pageKey);
+ }
+
+ resultHandler.completed(new ReadResourceModel("List of child pages for page '" + pageName +"'", Collections.<String>emptySet()));
+ }
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageUtils.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageUtils.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageUtils.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,48 +0,0 @@
-package org.exoplatform.portal.mop.management.operations.page;
-
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.Query;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.mop.SiteKey;
-import org.gatein.management.api.exceptions.OperationException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class PageUtils
-{
- private PageUtils(){}
-
- public static Page getPage(DataStorage dataStorage, PageKey pageKey, String operationName)
- {
- try
- {
- return dataStorage.getPage(pageKey.getPageId());
- }
- catch (Exception e)
- {
- throw new OperationException(operationName, "Operation failed getting page for " + pageKey, e);
- }
- }
-
- public static Page.PageSet getAllPages(DataStorage dataStorage, SiteKey siteKey, String operationName)
- {
- Query<Page> query = new Query<Page>(siteKey.getTypeName(), siteKey.getName(), Page.class);
- try
- {
- List<Page> pageList = dataStorage.find(query).getAll();
- Page.PageSet pages = new Page.PageSet();
- pages.setPages(new ArrayList<Page>(pageList));
-
- return pages;
- }
- catch (Exception e)
- {
- throw new OperationException(operationName, "Could not retrieve pages for site " + siteKey);
- }
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageUtils.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageUtils.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageUtils.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/page/PageUtils.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,48 @@
+package org.exoplatform.portal.mop.management.operations.page;
+
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.Query;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.mop.SiteKey;
+import org.gatein.management.api.exceptions.OperationException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class PageUtils
+{
+ private PageUtils(){}
+
+ public static Page getPage(DataStorage dataStorage, PageKey pageKey, String operationName)
+ {
+ try
+ {
+ return dataStorage.getPage(pageKey.getPageId());
+ }
+ catch (Exception e)
+ {
+ throw new OperationException(operationName, "Operation failed getting page for " + pageKey, e);
+ }
+ }
+
+ public static Page.PageSet getAllPages(DataStorage dataStorage, SiteKey siteKey, String operationName)
+ {
+ Query<Page> query = new Query<Page>(siteKey.getTypeName(), siteKey.getName(), Page.class);
+ try
+ {
+ List<Page> pageList = dataStorage.find(query).getAll();
+ Page.PageSet pages = new Page.PageSet();
+ pages.setPages(new ArrayList<Page>(pageList));
+
+ return pages;
+ }
+ catch (Exception e)
+ {
+ throw new OperationException(operationName, "Could not retrieve pages for site " + siteKey);
+ }
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/AbstractSiteOperationHandler.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/AbstractSiteOperationHandler.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/AbstractSiteOperationHandler.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.site;
-
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.management.operations.AbstractMopOperationHandler;
-import org.gatein.management.api.PathAddress;
-import org.gatein.management.api.exceptions.OperationException;
-import org.gatein.management.api.exceptions.ResourceNotFoundException;
-import org.gatein.management.api.operation.OperationContext;
-import org.gatein.management.api.operation.ResultHandler;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Site;
-import org.gatein.mop.api.workspace.Workspace;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public abstract class AbstractSiteOperationHandler extends AbstractMopOperationHandler
-{
- @Override
- protected final void execute(OperationContext operationContext, ResultHandler resultHandler, Workspace workspace, ObjectType<Site> siteType) throws ResourceNotFoundException, OperationException
- {
- String operationName = operationContext.getOperationName();
- PathAddress address = operationContext.getAddress();
-
- String siteName = address.resolvePathTemplate("site-name");
- if (siteName == null) throw new OperationException(operationName, "No site name specified.");
-
- SiteKey siteKey = getSiteKey(siteType, siteName);
-
- Site site = workspace.getSite(siteType, siteKey.getName());
- if (site == null) throw new ResourceNotFoundException("No site found for site " + siteKey);
-
- execute(operationContext, resultHandler, site);
- }
-
- protected abstract void execute(OperationContext operationContext, ResultHandler resultHandler, Site site) throws ResourceNotFoundException, OperationException;
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/AbstractSiteOperationHandler.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/AbstractSiteOperationHandler.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/AbstractSiteOperationHandler.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/AbstractSiteOperationHandler.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.site;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.management.operations.AbstractMopOperationHandler;
+import org.gatein.management.api.PathAddress;
+import org.gatein.management.api.exceptions.OperationException;
+import org.gatein.management.api.exceptions.ResourceNotFoundException;
+import org.gatein.management.api.operation.OperationContext;
+import org.gatein.management.api.operation.ResultHandler;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.api.workspace.Workspace;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public abstract class AbstractSiteOperationHandler extends AbstractMopOperationHandler
+{
+ @Override
+ protected final void execute(OperationContext operationContext, ResultHandler resultHandler, Workspace workspace, ObjectType<Site> siteType) throws ResourceNotFoundException, OperationException
+ {
+ String operationName = operationContext.getOperationName();
+ PathAddress address = operationContext.getAddress();
+
+ String siteName = address.resolvePathTemplate("site-name");
+ if (siteName == null) throw new OperationException(operationName, "No site name specified.");
+
+ SiteKey siteKey = getSiteKey(siteType, siteName);
+
+ Site site = workspace.getSite(siteType, siteKey.getName());
+ if (site == null) throw new ResourceNotFoundException("No site found for site " + siteKey);
+
+ execute(operationContext, resultHandler, site);
+ }
+
+ protected abstract void execute(OperationContext operationContext, ResultHandler resultHandler, Site site) throws ResourceNotFoundException, OperationException;
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutExportResource.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutExportResource.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutExportResource.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.site;
-
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.management.exportimport.SiteLayoutExportTask;
-import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.exoplatform.portal.pom.data.PortalData;
-import org.gatein.management.api.ContentType;
-import org.gatein.management.api.binding.BindingProvider;
-import org.gatein.management.api.exceptions.OperationException;
-import org.gatein.management.api.exceptions.ResourceNotFoundException;
-import org.gatein.management.api.operation.OperationContext;
-import org.gatein.management.api.operation.ResultHandler;
-import org.gatein.management.api.operation.model.ExportResourceModel;
-import org.gatein.mop.api.workspace.Site;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class SiteLayoutExportResource extends AbstractSiteOperationHandler
-{
- @Override
- protected void execute(OperationContext operationContext, ResultHandler resultHandler, Site site) throws ResourceNotFoundException, OperationException
- {
- BindingProvider bindingProvider = operationContext.getBindingProvider();
- DataStorage dataStorage = operationContext.getRuntimeContext().getRuntimeComponent(DataStorage.class);
-
- SiteKey siteKey = getSiteKey(site);
-
- resultHandler.completed(new ExportResourceModel(new SiteLayoutExportTask(siteKey, dataStorage, bindingProvider.getMarshaller(PortalConfig.class, ContentType.XML))));
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutExportResource.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutExportResource.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutExportResource.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutExportResource.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.site;
+
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.management.exportimport.SiteLayoutExportTask;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.data.PortalData;
+import org.gatein.management.api.ContentType;
+import org.gatein.management.api.binding.BindingProvider;
+import org.gatein.management.api.exceptions.OperationException;
+import org.gatein.management.api.exceptions.ResourceNotFoundException;
+import org.gatein.management.api.operation.OperationContext;
+import org.gatein.management.api.operation.ResultHandler;
+import org.gatein.management.api.operation.model.ExportResourceModel;
+import org.gatein.mop.api.workspace.Site;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class SiteLayoutExportResource extends AbstractSiteOperationHandler
+{
+ @Override
+ protected void execute(OperationContext operationContext, ResultHandler resultHandler, Site site) throws ResourceNotFoundException, OperationException
+ {
+ BindingProvider bindingProvider = operationContext.getBindingProvider();
+ DataStorage dataStorage = operationContext.getRuntimeContext().getRuntimeComponent(DataStorage.class);
+
+ SiteKey siteKey = getSiteKey(site);
+
+ resultHandler.completed(new ExportResourceModel(new SiteLayoutExportTask(siteKey, dataStorage, bindingProvider.getMarshaller(PortalConfig.class, ContentType.XML))));
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutReadConfigAsXml.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutReadConfigAsXml.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutReadConfigAsXml.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.site;
-
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.exoplatform.portal.pom.config.tasks.PortalConfigTask;
-import org.exoplatform.portal.pom.data.PortalData;
-import org.exoplatform.portal.pom.data.PortalKey;
-import org.gatein.management.api.exceptions.OperationException;
-import org.gatein.management.api.exceptions.ResourceNotFoundException;
-import org.gatein.management.api.operation.OperationContext;
-import org.gatein.management.api.operation.ResultHandler;
-import org.gatein.mop.api.workspace.Site;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class SiteLayoutReadConfigAsXml extends AbstractSiteOperationHandler
-{
- @Override
- protected void execute(OperationContext operationContext, ResultHandler resultHandler, Site site) throws ResourceNotFoundException, OperationException
- {
- DataStorage dataStorage = operationContext.getRuntimeContext().getRuntimeComponent(DataStorage.class);
- SiteKey siteKey = getSiteKey(site);
-
- try
- {
- PortalConfig portalConfig = dataStorage.getPortalConfig(siteKey.getTypeName(), siteKey.getName());
- resultHandler.completed(portalConfig);
- }
- catch (Exception e)
- {
- throw new OperationException(operationContext.getOperationName(), "Could not retrieve site layout for site " + site, e);
- }
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutReadConfigAsXml.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutReadConfigAsXml.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutReadConfigAsXml.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutReadConfigAsXml.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.site;
+
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.tasks.PortalConfigTask;
+import org.exoplatform.portal.pom.data.PortalData;
+import org.exoplatform.portal.pom.data.PortalKey;
+import org.gatein.management.api.exceptions.OperationException;
+import org.gatein.management.api.exceptions.ResourceNotFoundException;
+import org.gatein.management.api.operation.OperationContext;
+import org.gatein.management.api.operation.ResultHandler;
+import org.gatein.mop.api.workspace.Site;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class SiteLayoutReadConfigAsXml extends AbstractSiteOperationHandler
+{
+ @Override
+ protected void execute(OperationContext operationContext, ResultHandler resultHandler, Site site) throws ResourceNotFoundException, OperationException
+ {
+ DataStorage dataStorage = operationContext.getRuntimeContext().getRuntimeComponent(DataStorage.class);
+ SiteKey siteKey = getSiteKey(site);
+
+ try
+ {
+ PortalConfig portalConfig = dataStorage.getPortalConfig(siteKey.getTypeName(), siteKey.getName());
+ resultHandler.completed(portalConfig);
+ }
+ catch (Exception e)
+ {
+ throw new OperationException(operationContext.getOperationName(), "Could not retrieve site layout for site " + site, e);
+ }
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteReadResource.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteReadResource.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteReadResource.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,91 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.site;
-
-import org.gatein.management.api.exceptions.OperationException;
-import org.gatein.management.api.exceptions.ResourceNotFoundException;
-import org.gatein.management.api.operation.OperationContext;
-import org.gatein.management.api.operation.ResultHandler;
-import org.gatein.management.api.operation.model.ReadResourceModel;
-import org.gatein.mop.api.workspace.Navigation;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Page;
-import org.gatein.mop.api.workspace.Site;
-
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class SiteReadResource extends AbstractSiteOperationHandler
-{
- @Override
- protected void execute(OperationContext operationContext, ResultHandler resultHandler, Site site) throws ResourceNotFoundException, OperationException
- {
- boolean pageOrNav = false;
- Set<String> children = new LinkedHashSet<String>(3);
-
- Page pages = site.getRootPage().getChild("pages");
- if (pages != null && !pages.getChildren().isEmpty())
- {
- children.add("pages");
- pageOrNav = true;
- }
-
- Navigation defaultNav = site.getRootNavigation().getChild("default");
- if (defaultNav != null && !defaultNav.getChildren().isEmpty())
- {
- children.add("navigation");
- pageOrNav = true;
- }
-
- if (pageOrNav)
- {
- children.add("portal");
- }
- else
- {
- if (site.getObjectType() == ObjectType.GROUP_SITE)
- {
- Collection<? extends Site> groupsites = site.getWorkspace().getSites(site.getObjectType());
- for (Site groupsite : groupsites)
- {
- String siteName = site.getName();
- String groupName = groupsite.getName();
- if (siteName.equals(groupName)) continue;
-
- int index = groupName.indexOf(siteName);
- if (index == 0)
- {
- children.add(groupName.substring(siteName.length(), groupName.length()));
- }
- }
- }
- }
-
- resultHandler.completed(new ReadResourceModel("Available artifacts for site " + getSiteKey(site), children));
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteReadResource.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteReadResource.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteReadResource.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteReadResource.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.site;
+
+import org.gatein.management.api.exceptions.OperationException;
+import org.gatein.management.api.exceptions.ResourceNotFoundException;
+import org.gatein.management.api.operation.OperationContext;
+import org.gatein.management.api.operation.ResultHandler;
+import org.gatein.management.api.operation.model.ReadResourceModel;
+import org.gatein.mop.api.workspace.Navigation;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Page;
+import org.gatein.mop.api.workspace.Site;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class SiteReadResource extends AbstractSiteOperationHandler
+{
+ @Override
+ protected void execute(OperationContext operationContext, ResultHandler resultHandler, Site site) throws ResourceNotFoundException, OperationException
+ {
+ boolean pageOrNav = false;
+ Set<String> children = new LinkedHashSet<String>(3);
+
+ Page pages = site.getRootPage().getChild("pages");
+ if (pages != null && !pages.getChildren().isEmpty())
+ {
+ children.add("pages");
+ pageOrNav = true;
+ }
+
+ Navigation defaultNav = site.getRootNavigation().getChild("default");
+ if (defaultNav != null && !defaultNav.getChildren().isEmpty())
+ {
+ children.add("navigation");
+ pageOrNav = true;
+ }
+
+ if (pageOrNav)
+ {
+ children.add("portal");
+ }
+ else
+ {
+ if (site.getObjectType() == ObjectType.GROUP_SITE)
+ {
+ Collection<? extends Site> groupsites = site.getWorkspace().getSites(site.getObjectType());
+ for (Site groupsite : groupsites)
+ {
+ String siteName = site.getName();
+ String groupName = groupsite.getName();
+ if (siteName.equals(groupName)) continue;
+
+ int index = groupName.indexOf(siteName);
+ if (index == 0)
+ {
+ children.add(groupName.substring(siteName.length(), groupName.length()));
+ }
+ }
+ }
+ }
+
+ resultHandler.completed(new ReadResourceModel("Available artifacts for site " + getSiteKey(site), children));
+ }
+}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteTypeReadResource.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteTypeReadResource.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteTypeReadResource.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,82 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.site;
-
-import org.exoplatform.portal.mop.management.operations.AbstractMopOperationHandler;
-import org.gatein.management.api.exceptions.OperationException;
-import org.gatein.management.api.exceptions.ResourceNotFoundException;
-import org.gatein.management.api.operation.OperationContext;
-import org.gatein.management.api.operation.ResultHandler;
-import org.gatein.management.api.operation.model.ReadResourceModel;
-import org.gatein.mop.api.workspace.Navigation;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Page;
-import org.gatein.mop.api.workspace.Site;
-import org.gatein.mop.api.workspace.Workspace;
-
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class SiteTypeReadResource extends AbstractMopOperationHandler
-{
- @Override
- protected void execute(OperationContext operationContext, ResultHandler resultHandler, Workspace workspace, ObjectType<Site> siteType) throws ResourceNotFoundException, OperationException
- {
- Collection<Site> sites = workspace.getSites(siteType);
- Set<String> children = new LinkedHashSet<String>(sites.size());
- for (Site site : sites)
- {
- boolean pageOrNav = false;
- Page pages = site.getRootPage().getChild("pages");
- if (pages != null && !pages.getChildren().isEmpty())
- {
- pageOrNav = true;
- }
- Navigation defaultNav = site.getRootNavigation().getChild("default");
- if (defaultNav != null && !defaultNav.getChildren().isEmpty())
- {
- pageOrNav = true;
- }
-
- //TODO: Until invalid site entries without a leading slash is corrected, this is needed to ignore them.
- if (siteType == ObjectType.GROUP_SITE)
- {
- String name = site.getName();
- if (name.charAt(0) == '/' && pageOrNav)
- {
- children.add(site.getName());
- }
- }
- else if (pageOrNav)
- {
- children.add(site.getName());
- }
- }
- resultHandler.completed(new ReadResourceModel("Available sites for site type '" + getSiteType(siteType).getName() + "'", children));
- }
-}
Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteTypeReadResource.java (from rev 6958, portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteTypeReadResource.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteTypeReadResource.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteTypeReadResource.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.operations.site;
+
+import org.exoplatform.portal.mop.management.operations.AbstractMopOperationHandler;
+import org.gatein.management.api.exceptions.OperationException;
+import org.gatein.management.api.exceptions.ResourceNotFoundException;
+import org.gatein.management.api.operation.OperationContext;
+import org.gatein.management.api.operation.ResultHandler;
+import org.gatein.management.api.operation.model.ReadResourceModel;
+import org.gatein.mop.api.workspace.Navigation;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Page;
+import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.api.workspace.Workspace;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class SiteTypeReadResource extends AbstractMopOperationHandler
+{
+ @Override
+ protected void execute(OperationContext operationContext, ResultHandler resultHandler, Workspace workspace, ObjectType<Site> siteType) throws ResourceNotFoundException, OperationException
+ {
+ Collection<Site> sites = workspace.getSites(siteType);
+ Set<String> children = new LinkedHashSet<String>(sites.size());
+ for (Site site : sites)
+ {
+ boolean pageOrNav = false;
+ Page pages = site.getRootPage().getChild("pages");
+ if (pages != null && !pages.getChildren().isEmpty())
+ {
+ pageOrNav = true;
+ }
+ Navigation defaultNav = site.getRootNavigation().getChild("default");
+ if (defaultNav != null && !defaultNav.getChildren().isEmpty())
+ {
+ pageOrNav = true;
+ }
+
+ //TODO: Until invalid site entries without a leading slash is corrected, this is needed to ignore them.
+ if (siteType == ObjectType.GROUP_SITE)
+ {
+ String name = site.getName();
+ if (name.charAt(0) == '/' && pageOrNav)
+ {
+ children.add(site.getName());
+ }
+ }
+ else if (pageOrNav)
+ {
+ children.add(site.getName());
+ }
+ }
+ resultHandler.completed(new ReadResourceModel("Available sites for site type '" + getSiteType(siteType).getName() + "'", children));
+ }
+}
Copied: portal/trunk/component/portal/src/main/resources/META-INF/services/org.gatein.management.spi.ManagementExtension (from rev 6958, portal/branches/gatein-management/component/portal/src/main/resources/META-INF/services/org.gatein.management.spi.ManagementExtension)
===================================================================
--- portal/trunk/component/portal/src/main/resources/META-INF/services/org.gatein.management.spi.ManagementExtension (rev 0)
+++ portal/trunk/component/portal/src/main/resources/META-INF/services/org.gatein.management.spi.ManagementExtension 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1 @@
+org.exoplatform.portal.mop.management.MopManagementExtension
\ No newline at end of file
Deleted: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshallerTest.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshallerTest.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshallerTest.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,169 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
-
-import junit.framework.TestCase;
-import org.exoplatform.portal.config.model.Application;
-import org.exoplatform.portal.config.model.ApplicationState;
-import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.config.model.PageBody;
-import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.pom.data.ApplicationData;
-import org.exoplatform.portal.pom.data.ContainerData;
-import org.exoplatform.portal.pom.spi.gadget.Gadget;
-import org.exoplatform.portal.pom.spi.portlet.Portlet;
-import org.exoplatform.portal.pom.spi.portlet.Preference;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public abstract class AbstractMarshallerTest extends TestCase
-{
- protected void compareComponents(List<ModelObject> expectedComponents, List<ModelObject> actualComponents)
- {
- assertEquals(expectedComponents.size(), actualComponents.size());
- for (int i=0; i<expectedComponents.size(); i++)
- {
- ModelObject expected = expectedComponents.get(i);
- ModelObject actual = actualComponents.get(i);
- assertEquals(expected.getClass(), actual.getClass());
-
- if (expected instanceof Application)
- {
- compareApplication((Application) expected, (Application) actual);
- }
- else if (expected instanceof PageBody)
- {
- assertTrue(actual instanceof PageBody);
- }
- else if (expected instanceof Container)
- {
- compareContainer((Container) expected, (Container) actual);
- }
- }
- }
-
- protected void compareContainer(Container expected, Container actual)
- {
- assertNull(actual.getStorageId());
- assertNull(actual.getStorageName());
- assertEquals(expected.getId(), actual.getId());
- assertEquals(expected.getName(), actual.getName());
- assertEquals(expected.getIcon(), actual.getIcon());
- assertEquals(expected.getTemplate(), actual.getTemplate());
- assertEquals(expected.getFactoryId(), actual.getFactoryId());
- assertEquals(expected.getTitle(), actual.getTitle());
- assertEquals(expected.getDescription(), actual.getDescription());
- assertEquals(expected.getWidth(), actual.getWidth());
- assertEquals(expected.getHeight(), actual.getHeight());
- assertEquals(Arrays.asList(expected.getAccessPermissions()), Arrays.asList(actual.getAccessPermissions()));
-
- compareComponents(expected.getChildren(), actual.getChildren());
- }
-
- protected void compareApplication(Application expected, Application actual)
- {
- assertNull(actual.getStorageId());
- assertNull(actual.getStorageName());
- assertEquals(expected.getType(), actual.getType());
- if (expected.getState() == null)
- {
- assertNull(actual.getState());
- }
- else
- {
- assertNotNull(actual.getState());
- compareApplicationState(expected.getState(), actual.getState());
- }
-
- assertNull(actual.getStorageId());
- assertNull(actual.getStorageName());
- assertNull(actual.getId());
- assertEquals(expected.getTitle(), actual.getTitle());
- assertEquals(expected.getIcon(), actual.getIcon());
- assertEquals(expected.getDescription(), actual.getDescription());
- assertEquals(expected.getShowInfoBar(), actual.getShowInfoBar());
- assertEquals(expected.getShowApplicationState(), actual.getShowApplicationState());
- assertEquals(expected.getShowApplicationMode(), actual.getShowApplicationMode());
- assertEquals(expected.getTheme(), actual.getTheme());
- assertEquals(expected.getWidth(), actual.getWidth());
- assertEquals(expected.getHeight(), actual.getHeight());
- assertEquals(expected.getProperties(), actual.getProperties());
- assertEquals(Arrays.asList(expected.getAccessPermissions()), Arrays.asList(actual.getAccessPermissions()));
- }
-
- protected void compareApplicationState(ApplicationState expected, ApplicationState actual)
- {
- assertEquals(expected.getClass(), actual.getClass());
- if (expected instanceof TransientApplicationState)
- {
- TransientApplicationState expectedTas = (TransientApplicationState) expected;
- TransientApplicationState actualTas = (TransientApplicationState) actual;
- assertEquals(expectedTas.getContentId(), actualTas.getContentId());
- assertNull(actualTas.getOwnerType());
- assertNull(actualTas.getOwnerId());
- assertNull(actualTas.getUniqueId());
- if (expectedTas.getContentState() == null)
- {
- assertNull(actualTas.getContentState());
- }
- else
- {
- assertEquals(expectedTas.getContentState().getClass(), actualTas.getContentState().getClass());
- if (expectedTas.getContentState() instanceof Portlet)
- {
- comparePortlet((Portlet) expectedTas.getContentState(), (Portlet) actualTas.getContentState());
- }
- else if (expectedTas.getContentState() instanceof Gadget)
- {
- compareGadget((Gadget) expectedTas.getContentState(), (Gadget) actualTas.getContentState());
- }
- }
- }
- }
-
- protected void comparePortlet(Portlet expected, Portlet actual)
- {
- for (Preference expectedPref : expected)
- {
- Preference actualPref = actual.getPreference(expectedPref.getName());
- assertNotNull(actualPref);
- assertEquals(expectedPref.getName(), actualPref.getName());
- assertEquals(expectedPref.getValues(), actualPref.getValues());
- assertEquals(expectedPref.isReadOnly(), actualPref.isReadOnly());
- }
- }
-
- private void compareGadget(Gadget expected, Gadget actual)
- {
- assertNotNull(expected);
- assertNotNull(actual);
- // When gadget user prefs are supported in gatein_objects, uncomment.
- //assertEquals(expected.getUserPref(), actual.getUserPref());
- }
-}
Copied: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshallerTest.java (from rev 6958, portal/branches/gatein-management/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshallerTest.java)
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshallerTest.java (rev 0)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshallerTest.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,169 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
+
+import junit.framework.TestCase;
+import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.model.PageBody;
+import org.exoplatform.portal.config.model.TransientApplicationState;
+import org.exoplatform.portal.pom.data.ApplicationData;
+import org.exoplatform.portal.pom.data.ContainerData;
+import org.exoplatform.portal.pom.spi.gadget.Gadget;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+import org.exoplatform.portal.pom.spi.portlet.Preference;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public abstract class AbstractMarshallerTest extends TestCase
+{
+ protected void compareComponents(List<ModelObject> expectedComponents, List<ModelObject> actualComponents)
+ {
+ assertEquals(expectedComponents.size(), actualComponents.size());
+ for (int i=0; i<expectedComponents.size(); i++)
+ {
+ ModelObject expected = expectedComponents.get(i);
+ ModelObject actual = actualComponents.get(i);
+ assertEquals(expected.getClass(), actual.getClass());
+
+ if (expected instanceof Application)
+ {
+ compareApplication((Application) expected, (Application) actual);
+ }
+ else if (expected instanceof PageBody)
+ {
+ assertTrue(actual instanceof PageBody);
+ }
+ else if (expected instanceof Container)
+ {
+ compareContainer((Container) expected, (Container) actual);
+ }
+ }
+ }
+
+ protected void compareContainer(Container expected, Container actual)
+ {
+ assertNull(actual.getStorageId());
+ assertNull(actual.getStorageName());
+ assertEquals(expected.getId(), actual.getId());
+ assertEquals(expected.getName(), actual.getName());
+ assertEquals(expected.getIcon(), actual.getIcon());
+ assertEquals(expected.getTemplate(), actual.getTemplate());
+ assertEquals(expected.getFactoryId(), actual.getFactoryId());
+ assertEquals(expected.getTitle(), actual.getTitle());
+ assertEquals(expected.getDescription(), actual.getDescription());
+ assertEquals(expected.getWidth(), actual.getWidth());
+ assertEquals(expected.getHeight(), actual.getHeight());
+ assertEquals(Arrays.asList(expected.getAccessPermissions()), Arrays.asList(actual.getAccessPermissions()));
+
+ compareComponents(expected.getChildren(), actual.getChildren());
+ }
+
+ protected void compareApplication(Application expected, Application actual)
+ {
+ assertNull(actual.getStorageId());
+ assertNull(actual.getStorageName());
+ assertEquals(expected.getType(), actual.getType());
+ if (expected.getState() == null)
+ {
+ assertNull(actual.getState());
+ }
+ else
+ {
+ assertNotNull(actual.getState());
+ compareApplicationState(expected.getState(), actual.getState());
+ }
+
+ assertNull(actual.getStorageId());
+ assertNull(actual.getStorageName());
+ assertNull(actual.getId());
+ assertEquals(expected.getTitle(), actual.getTitle());
+ assertEquals(expected.getIcon(), actual.getIcon());
+ assertEquals(expected.getDescription(), actual.getDescription());
+ assertEquals(expected.getShowInfoBar(), actual.getShowInfoBar());
+ assertEquals(expected.getShowApplicationState(), actual.getShowApplicationState());
+ assertEquals(expected.getShowApplicationMode(), actual.getShowApplicationMode());
+ assertEquals(expected.getTheme(), actual.getTheme());
+ assertEquals(expected.getWidth(), actual.getWidth());
+ assertEquals(expected.getHeight(), actual.getHeight());
+ assertEquals(expected.getProperties(), actual.getProperties());
+ assertEquals(Arrays.asList(expected.getAccessPermissions()), Arrays.asList(actual.getAccessPermissions()));
+ }
+
+ protected void compareApplicationState(ApplicationState expected, ApplicationState actual)
+ {
+ assertEquals(expected.getClass(), actual.getClass());
+ if (expected instanceof TransientApplicationState)
+ {
+ TransientApplicationState expectedTas = (TransientApplicationState) expected;
+ TransientApplicationState actualTas = (TransientApplicationState) actual;
+ assertEquals(expectedTas.getContentId(), actualTas.getContentId());
+ assertNull(actualTas.getOwnerType());
+ assertNull(actualTas.getOwnerId());
+ assertNull(actualTas.getUniqueId());
+ if (expectedTas.getContentState() == null)
+ {
+ assertNull(actualTas.getContentState());
+ }
+ else
+ {
+ assertEquals(expectedTas.getContentState().getClass(), actualTas.getContentState().getClass());
+ if (expectedTas.getContentState() instanceof Portlet)
+ {
+ comparePortlet((Portlet) expectedTas.getContentState(), (Portlet) actualTas.getContentState());
+ }
+ else if (expectedTas.getContentState() instanceof Gadget)
+ {
+ compareGadget((Gadget) expectedTas.getContentState(), (Gadget) actualTas.getContentState());
+ }
+ }
+ }
+ }
+
+ protected void comparePortlet(Portlet expected, Portlet actual)
+ {
+ for (Preference expectedPref : expected)
+ {
+ Preference actualPref = actual.getPreference(expectedPref.getName());
+ assertNotNull(actualPref);
+ assertEquals(expectedPref.getName(), actualPref.getName());
+ assertEquals(expectedPref.getValues(), actualPref.getValues());
+ assertEquals(expectedPref.isReadOnly(), actualPref.isReadOnly());
+ }
+ }
+
+ private void compareGadget(Gadget expected, Gadget actual)
+ {
+ assertNotNull(expected);
+ assertNotNull(actual);
+ // When gadget user prefs are supported in gatein_objects, uncomment.
+ //assertEquals(expected.getUserPref(), actual.getUserPref());
+ }
+}
Deleted: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshallerTest.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshallerTest.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshallerTest.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,323 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
-
-import junit.framework.TestCase;
-import org.exoplatform.portal.config.model.I18NString;
-import org.exoplatform.portal.config.model.LocalizedString;
-import org.exoplatform.portal.config.model.NavigationFragment;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.mop.Visibility;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Locale;
-import java.util.TimeZone;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class NavigationMarshallerTest extends TestCase
-{
- public void testNavigationUnmarshalling()
- {
- NavigationMarshaller marshaller = new NavigationMarshaller();
- PageNavigation data = marshaller.unmarshal(getClass().getResourceAsStream("/org/exoplatform/portal/mop/management/navigation.xml"));
- assertNotNull(data);
- assertEquals(111, data.getPriority());
- assertNotNull(data.getFragment());
- assertEquals(7, data.getFragment().getNodes().size());
- PageNode node = data.getFragment().getNodes().get(0);
- verifyNode(node, "home", "#{portal.classic.home}", "home", Visibility.DISPLAYED, "portal::classic::homepage", null, null, null, 1);
- node = node.getNodes().get(0);
- Date start = createDate(2011, 1, 10, 12, 13, 55);
- Date end = createDate(2011, 1, 17, 17, 14, 0);
- verifyNode(node, "home-1", "Home 1", "home/home-1", Visibility.TEMPORAL, null, start, end, "StarAward", 1);
- node = node.getNodes().get(0);
- verifyNode(node, "empty", "Empty", "home/home-1/empty", Visibility.HIDDEN, "portal::classic::empty-page", null, null, null, 0);
-
- node = data.getFragment().getNodes().get(5);
- verifyNode(node, "notfound", "NotFound", "notfound", Visibility.SYSTEM, null, null, null, null, 0);
-
- node = data.getFragment().getNodes().get(6);
- verifyNode(node, "n0", "n0", "n0", Visibility.DISPLAYED, "portal::classic::n0", null, null, null, 1);
- node = node.getNodes().get(0);
- verifyNode(node, "n0", "n0", "n0/n0", Visibility.DISPLAYED, "portal::classic::n0_n0", null, null, null, 10);
- for (int i=0; i<10; i++)
- {
- String name = "n" + i;
- String uri = "n0/n0/n" + i;
- String pageref = uri.replace("/", "_");
-
- PageNode child = node.getNodes().get(i);
- verifyNode(child, name, name, uri, Visibility.DISPLAYED, "portal::classic::" + pageref, null, null, null, 0);
- }
- }
-
- public void testEmptyNavigationUnmarshalling()
- {
- NavigationMarshaller marshaller = new NavigationMarshaller();
- PageNavigation data = marshaller.unmarshal(getClass().getResourceAsStream("/org/exoplatform/portal/mop/management/navigation-empty.xml"));
- assertNotNull(data);
- assertEquals(3, data.getPriority());
- assertNotNull(data.getFragment().getNodes());
- assertTrue(data.getFragment().getNodes().isEmpty());
- }
-
- public void testFragmentedNavigationUnmarshalling()
- {
- NavigationMarshaller marshaller = new NavigationMarshaller();
- PageNavigation data = marshaller.unmarshal(getClass().getResourceAsStream("/org/exoplatform/portal/mop/management/navigation-fragment.xml"));
- assertNotNull(data);
- assertNotNull(data.getFragments());
- assertEquals(2, data.getFragments().size());
-
- NavigationFragment fragment = data.getFragments().get(0);
- assertNotNull(fragment);
- assertEquals("home", fragment.getParentURI());
- assertNotNull(fragment.getNodes());
- assertEquals(1, fragment.getNodes().size());
- PageNode node = fragment.getNode("home-1");
- assertNotNull(node);
- assertNotNull(node.getNodes());
- assertEquals(2, node.getNodes().size());
- assertNotNull(node.getNode("home-1-1"));
- assertNotNull(node.getNode("home-1-2"));
-
- fragment = data.getFragments().get(1);
- assertNotNull(fragment);
- assertEquals("foo-bar", fragment.getParentURI());
- assertNotNull(fragment.getNodes());
- assertEquals(2, fragment.getNodes().size());
- assertNotNull(fragment.getNode("foo"));
- assertNotNull(fragment.getNode("bar"));
- }
-
- public void testLocaleNavigationUnmarshalling()
- {
- NavigationMarshaller marshaller = new NavigationMarshaller();
- PageNavigation data = marshaller.unmarshal(getClass().getResourceAsStream("/org/exoplatform/portal/mop/management/navigation-extended.xml"));
- assertNotNull(data);
- assertNotNull(data.getFragment().getNodes());
-
- PageNode node = data.getFragment().getNode("hello-node");
- assertNotNull(node);
- assertNotNull(node.getLabels());
- assertEquals(8, node.getLabels().size());
-
- Locale locale = Locale.getDefault();
-
- String cn = "Dobrý den";
- String fr = "Bonjour";
- String en = "Hello";
- String es = "Hola";
- String ja = "こんにちは";
- String it = "Ciào";
- String zh = "你好";
- String zh_tw = "Li-ho";
-
- assertEquals(cn, node.getLabels().getExtended(locale).get(new Locale("cn")));
- assertEquals(fr, node.getLabels().getExtended(locale).get(new Locale("fr")));
- assertEquals(en, node.getLabels().getExtended(locale).get(new Locale("en")));
- assertEquals(es, node.getLabels().getExtended(locale).get(new Locale("es")));
- assertEquals(ja, node.getLabels().getExtended(locale).get(new Locale("ja")));
- assertEquals(it, node.getLabels().getExtended(locale).get(new Locale("it")));
- assertEquals(zh, node.getLabels().getExtended(locale).get(new Locale("zh")));
- assertEquals(zh_tw, node.getLabels().getExtended(locale).get(Locale.TAIWAN));
-
- node = data.getFragment().getNode("hello-node2");
- assertNotNull(node);
- assertNotNull(node.getLabels());
- assertEquals(8, node.getLabels().size());
-
- assertEquals(cn, node.getLabels().getExtended(locale).get(new Locale("cn")));
- assertEquals(fr, node.getLabels().getExtended(locale).get(new Locale("fr")));
- assertEquals(en, node.getLabels().getExtended(locale).get(new Locale("en")));
- assertEquals(es, node.getLabels().getExtended(locale).get(new Locale("es")));
- assertEquals(ja, node.getLabels().getExtended(locale).get(new Locale("ja")));
- assertEquals(it, node.getLabels().getExtended(locale).get(new Locale("it")));
- assertEquals(zh, node.getLabels().getExtended(locale).get(new Locale("zh")));
- assertEquals(zh_tw, node.getLabels().getExtended(locale).get(Locale.TAIWAN));
- }
-
- public void testNavigationMarshalling()
- {
- Calendar startCal = Calendar.getInstance();
- startCal.set(Calendar.MILLISECOND, 0);
- Date start = startCal.getTime();
- Calendar endCal = Calendar.getInstance();
- endCal.set(Calendar.MILLISECOND, 0);
- Date end = endCal.getTime();
-
- PageNode expectedChild1 = newPageNode("node-1", "Icon-1", "Node 1",
- null, null, Visibility.DISPLAYED, null, new ArrayList<PageNode>());
-
- I18NString labels = new I18NString(
- new LocalizedString("Node 2", Locale.ENGLISH),
- new LocalizedString("Node 2", Locale.FRENCH),
- new LocalizedString("Node 2", Locale.TAIWAN));
-
- PageNode expectedChild2 = newPageNode("node-2", "Icon-2", labels,
- createDate(2011, 7, 22, 10, 10, 10), createDate(2011, 7, 30, 12, 0, 0), Visibility.SYSTEM, "some:page:ref", new ArrayList<PageNode>());
-
- ArrayList<PageNode> children = new ArrayList<PageNode>(2);
- children.add(expectedChild1);
- children.add(expectedChild2);
-
- PageNode expectedNode = newPageNode("node", "Icon", "Node", start, end, Visibility.HIDDEN, "page-ref", children);
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- NavigationMarshaller marshaller = new NavigationMarshaller();
- PageNavigation expected = newPageNavigation("", "", 123, new ArrayList<PageNode>(Collections.singletonList(expectedNode)));
- marshaller.marshal(expected, baos);
-
- PageNavigation actual = marshaller.unmarshal(new ByteArrayInputStream(baos.toByteArray()));
-
- assertNotNull(actual);
- assertNull(actual.getOwnerType());
- assertNull(actual.getOwnerId());
- assertEquals(expected.getPriority(), actual.getPriority());
- assertNotNull(expected.getFragment().getNodes());
- assertEquals(expected.getFragment().getNodes().size(), actual.getFragment().getNodes().size());
-
- PageNode actualNode = actual.getFragment().getNodes().get(0);
- compareNode(expectedNode, actualNode);
-
- assertNotNull(actualNode.getNodes());
- assertEquals(expectedNode.getNodes().size(), actualNode.getNodes().size());
- compareNode(expectedChild1, actualNode.getNodes().get(0));
- compareNode(expectedChild2, actualNode.getNodes().get(1));
- }
-
- private PageNavigation newPageNavigation(String ownerType, String ownerId, int priority, ArrayList<PageNode> children)
- {
- PageNavigation pageNavigation = new PageNavigation();
- pageNavigation.setOwnerType(ownerType);
- pageNavigation.setOwnerId(ownerId);
- pageNavigation.setPriority(priority);
- NavigationFragment fragment = new NavigationFragment();
- fragment.setNodes(children);
- pageNavigation.addFragment(fragment);
-
- return pageNavigation;
- }
-
- private void verifyNode(PageNode node, String name, String label, String uri, Visibility visibility,
- String pageRef, Date start, Date end, String icon, int children)
- {
- assertNotNull(node);
- assertEquals(name, node.getName());
- assertEquals(label, node.getLabel());
- assertEquals(visibility, node.getVisibility());
- assertEquals(pageRef, node.getPageReference());
- assertEquals(start, node.getStartPublicationDate());
- assertEquals(end, node.getEndPublicationDate());
- assertEquals(icon, node.getIcon());
- assertNotNull(node.getNodes());
- assertEquals(children, node.getNodes().size());
- }
-
- private void compareNode(PageNode expected, PageNode actual)
- {
- if (expected.getLabel() != null)
- {
- assertEquals(expected.getLabel(), actual.getLabel());
- }
- else if (expected.getLabels() != null)
- {
- assertNotNull(actual.getLabels());
- assertEquals(actual.getLabels().size(), expected.getLabels().size());
-
- for (int i=0; i<actual.getLabels().size(); i++)
- {
- LocalizedString actualLocalizedString = expected.getLabels().get(i);
- LocalizedString expectedLocalizedString = expected.getLabels().get(i);
- assertEquals(actualLocalizedString.getValue(), expectedLocalizedString.getValue());
- assertEquals(actualLocalizedString.getLang(), expectedLocalizedString.getLang());
- }
- }
- else
- {
- assertNull(actual.getLabel());
- assertNull(actual.getLabels());
- }
-
- assertEquals(expected.getIcon(), actual.getIcon());
- assertEquals(expected.getName(), actual.getName());
- assertEquals(expected.getStartPublicationDate(), actual.getStartPublicationDate());
- assertEquals(expected.getEndPublicationDate(), actual.getEndPublicationDate());
- assertEquals(expected.getVisibility(), actual.getVisibility());
- assertEquals(expected.getPageReference(), actual.getPageReference());
- assertEquals(expected.getNodes().size(), actual.getNodes().size());
- }
-
- private Date createDate(int year, int month, int day, int hour, int minute, int seconds)
- {
- Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("US/Eastern"));
- cal.set(Calendar.YEAR, year);
- cal.set(Calendar.MONTH, month-1);
- cal.set(Calendar.DAY_OF_MONTH, day);
- cal.set(Calendar.HOUR_OF_DAY, hour);
- cal.set(Calendar.MINUTE, minute);
- cal.set(Calendar.SECOND, seconds);
- cal.set(Calendar.MILLISECOND, 0);
-
- return cal.getTime();
- }
-
- private PageNode newPageNode(String name, String icon, String label, Date start, Date end, Visibility visibility, String pageref, ArrayList<PageNode> pageNodes)
- {
- PageNode pageNode = new PageNode();
- pageNode.setName(name);
- pageNode.setIcon(icon);
- pageNode.setLabel(label);
- pageNode.setStartPublicationDate(start);
- pageNode.setEndPublicationDate(end);
- pageNode.setVisibility(visibility);
- pageNode.setPageReference(pageref);
- pageNode.setChildren(pageNodes);
-
- return pageNode;
- }
-
- private PageNode newPageNode(String name, String icon, I18NString labels, Date start, Date end, Visibility visibility, String pageref, ArrayList<PageNode> pageNodes)
- {
- PageNode pageNode = new PageNode();
- pageNode.setName(name);
- pageNode.setIcon(icon);
- pageNode.setLabels(labels);
- pageNode.setStartPublicationDate(start);
- pageNode.setEndPublicationDate(end);
- pageNode.setVisibility(visibility);
- pageNode.setPageReference(pageref);
- pageNode.setChildren(pageNodes);
-
- return pageNode;
- }
-}
Copied: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshallerTest.java (from rev 6958, portal/branches/gatein-management/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshallerTest.java)
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshallerTest.java (rev 0)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshallerTest.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,323 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
+
+import junit.framework.TestCase;
+import org.exoplatform.portal.config.model.I18NString;
+import org.exoplatform.portal.config.model.LocalizedString;
+import org.exoplatform.portal.config.model.NavigationFragment;
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.Visibility;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class NavigationMarshallerTest extends TestCase
+{
+ public void testNavigationUnmarshalling()
+ {
+ NavigationMarshaller marshaller = new NavigationMarshaller();
+ PageNavigation data = marshaller.unmarshal(getClass().getResourceAsStream("/org/exoplatform/portal/mop/management/navigation.xml"));
+ assertNotNull(data);
+ assertEquals(111, data.getPriority());
+ assertNotNull(data.getFragment());
+ assertEquals(7, data.getFragment().getNodes().size());
+ PageNode node = data.getFragment().getNodes().get(0);
+ verifyNode(node, "home", "#{portal.classic.home}", "home", Visibility.DISPLAYED, "portal::classic::homepage", null, null, null, 1);
+ node = node.getNodes().get(0);
+ Date start = createDate(2011, 1, 10, 12, 13, 55);
+ Date end = createDate(2011, 1, 17, 17, 14, 0);
+ verifyNode(node, "home-1", "Home 1", "home/home-1", Visibility.TEMPORAL, null, start, end, "StarAward", 1);
+ node = node.getNodes().get(0);
+ verifyNode(node, "empty", "Empty", "home/home-1/empty", Visibility.HIDDEN, "portal::classic::empty-page", null, null, null, 0);
+
+ node = data.getFragment().getNodes().get(5);
+ verifyNode(node, "notfound", "NotFound", "notfound", Visibility.SYSTEM, null, null, null, null, 0);
+
+ node = data.getFragment().getNodes().get(6);
+ verifyNode(node, "n0", "n0", "n0", Visibility.DISPLAYED, "portal::classic::n0", null, null, null, 1);
+ node = node.getNodes().get(0);
+ verifyNode(node, "n0", "n0", "n0/n0", Visibility.DISPLAYED, "portal::classic::n0_n0", null, null, null, 10);
+ for (int i=0; i<10; i++)
+ {
+ String name = "n" + i;
+ String uri = "n0/n0/n" + i;
+ String pageref = uri.replace("/", "_");
+
+ PageNode child = node.getNodes().get(i);
+ verifyNode(child, name, name, uri, Visibility.DISPLAYED, "portal::classic::" + pageref, null, null, null, 0);
+ }
+ }
+
+ public void testEmptyNavigationUnmarshalling()
+ {
+ NavigationMarshaller marshaller = new NavigationMarshaller();
+ PageNavigation data = marshaller.unmarshal(getClass().getResourceAsStream("/org/exoplatform/portal/mop/management/navigation-empty.xml"));
+ assertNotNull(data);
+ assertEquals(3, data.getPriority());
+ assertNotNull(data.getFragment().getNodes());
+ assertTrue(data.getFragment().getNodes().isEmpty());
+ }
+
+ public void testFragmentedNavigationUnmarshalling()
+ {
+ NavigationMarshaller marshaller = new NavigationMarshaller();
+ PageNavigation data = marshaller.unmarshal(getClass().getResourceAsStream("/org/exoplatform/portal/mop/management/navigation-fragment.xml"));
+ assertNotNull(data);
+ assertNotNull(data.getFragments());
+ assertEquals(2, data.getFragments().size());
+
+ NavigationFragment fragment = data.getFragments().get(0);
+ assertNotNull(fragment);
+ assertEquals("home", fragment.getParentURI());
+ assertNotNull(fragment.getNodes());
+ assertEquals(1, fragment.getNodes().size());
+ PageNode node = fragment.getNode("home-1");
+ assertNotNull(node);
+ assertNotNull(node.getNodes());
+ assertEquals(2, node.getNodes().size());
+ assertNotNull(node.getNode("home-1-1"));
+ assertNotNull(node.getNode("home-1-2"));
+
+ fragment = data.getFragments().get(1);
+ assertNotNull(fragment);
+ assertEquals("foo-bar", fragment.getParentURI());
+ assertNotNull(fragment.getNodes());
+ assertEquals(2, fragment.getNodes().size());
+ assertNotNull(fragment.getNode("foo"));
+ assertNotNull(fragment.getNode("bar"));
+ }
+
+ public void testLocaleNavigationUnmarshalling()
+ {
+ NavigationMarshaller marshaller = new NavigationMarshaller();
+ PageNavigation data = marshaller.unmarshal(getClass().getResourceAsStream("/org/exoplatform/portal/mop/management/navigation-extended.xml"));
+ assertNotNull(data);
+ assertNotNull(data.getFragment().getNodes());
+
+ PageNode node = data.getFragment().getNode("hello-node");
+ assertNotNull(node);
+ assertNotNull(node.getLabels());
+ assertEquals(8, node.getLabels().size());
+
+ Locale locale = Locale.getDefault();
+
+ String cn = "Dobrý den";
+ String fr = "Bonjour";
+ String en = "Hello";
+ String es = "Hola";
+ String ja = "こんにちは";
+ String it = "Ciào";
+ String zh = "你好";
+ String zh_tw = "Li-ho";
+
+ assertEquals(cn, node.getLabels().getExtended(locale).get(new Locale("cn")));
+ assertEquals(fr, node.getLabels().getExtended(locale).get(new Locale("fr")));
+ assertEquals(en, node.getLabels().getExtended(locale).get(new Locale("en")));
+ assertEquals(es, node.getLabels().getExtended(locale).get(new Locale("es")));
+ assertEquals(ja, node.getLabels().getExtended(locale).get(new Locale("ja")));
+ assertEquals(it, node.getLabels().getExtended(locale).get(new Locale("it")));
+ assertEquals(zh, node.getLabels().getExtended(locale).get(new Locale("zh")));
+ assertEquals(zh_tw, node.getLabels().getExtended(locale).get(Locale.TAIWAN));
+
+ node = data.getFragment().getNode("hello-node2");
+ assertNotNull(node);
+ assertNotNull(node.getLabels());
+ assertEquals(8, node.getLabels().size());
+
+ assertEquals(cn, node.getLabels().getExtended(locale).get(new Locale("cn")));
+ assertEquals(fr, node.getLabels().getExtended(locale).get(new Locale("fr")));
+ assertEquals(en, node.getLabels().getExtended(locale).get(new Locale("en")));
+ assertEquals(es, node.getLabels().getExtended(locale).get(new Locale("es")));
+ assertEquals(ja, node.getLabels().getExtended(locale).get(new Locale("ja")));
+ assertEquals(it, node.getLabels().getExtended(locale).get(new Locale("it")));
+ assertEquals(zh, node.getLabels().getExtended(locale).get(new Locale("zh")));
+ assertEquals(zh_tw, node.getLabels().getExtended(locale).get(Locale.TAIWAN));
+ }
+
+ public void testNavigationMarshalling()
+ {
+ Calendar startCal = Calendar.getInstance();
+ startCal.set(Calendar.MILLISECOND, 0);
+ Date start = startCal.getTime();
+ Calendar endCal = Calendar.getInstance();
+ endCal.set(Calendar.MILLISECOND, 0);
+ Date end = endCal.getTime();
+
+ PageNode expectedChild1 = newPageNode("node-1", "Icon-1", "Node 1",
+ null, null, Visibility.DISPLAYED, null, new ArrayList<PageNode>());
+
+ I18NString labels = new I18NString(
+ new LocalizedString("Node 2", Locale.ENGLISH),
+ new LocalizedString("Node 2", Locale.FRENCH),
+ new LocalizedString("Node 2", Locale.TAIWAN));
+
+ PageNode expectedChild2 = newPageNode("node-2", "Icon-2", labels,
+ createDate(2011, 7, 22, 10, 10, 10), createDate(2011, 7, 30, 12, 0, 0), Visibility.SYSTEM, "some:page:ref", new ArrayList<PageNode>());
+
+ ArrayList<PageNode> children = new ArrayList<PageNode>(2);
+ children.add(expectedChild1);
+ children.add(expectedChild2);
+
+ PageNode expectedNode = newPageNode("node", "Icon", "Node", start, end, Visibility.HIDDEN, "page-ref", children);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ NavigationMarshaller marshaller = new NavigationMarshaller();
+ PageNavigation expected = newPageNavigation("", "", 123, new ArrayList<PageNode>(Collections.singletonList(expectedNode)));
+ marshaller.marshal(expected, baos);
+
+ PageNavigation actual = marshaller.unmarshal(new ByteArrayInputStream(baos.toByteArray()));
+
+ assertNotNull(actual);
+ assertNull(actual.getOwnerType());
+ assertNull(actual.getOwnerId());
+ assertEquals(expected.getPriority(), actual.getPriority());
+ assertNotNull(expected.getFragment().getNodes());
+ assertEquals(expected.getFragment().getNodes().size(), actual.getFragment().getNodes().size());
+
+ PageNode actualNode = actual.getFragment().getNodes().get(0);
+ compareNode(expectedNode, actualNode);
+
+ assertNotNull(actualNode.getNodes());
+ assertEquals(expectedNode.getNodes().size(), actualNode.getNodes().size());
+ compareNode(expectedChild1, actualNode.getNodes().get(0));
+ compareNode(expectedChild2, actualNode.getNodes().get(1));
+ }
+
+ private PageNavigation newPageNavigation(String ownerType, String ownerId, int priority, ArrayList<PageNode> children)
+ {
+ PageNavigation pageNavigation = new PageNavigation();
+ pageNavigation.setOwnerType(ownerType);
+ pageNavigation.setOwnerId(ownerId);
+ pageNavigation.setPriority(priority);
+ NavigationFragment fragment = new NavigationFragment();
+ fragment.setNodes(children);
+ pageNavigation.addFragment(fragment);
+
+ return pageNavigation;
+ }
+
+ private void verifyNode(PageNode node, String name, String label, String uri, Visibility visibility,
+ String pageRef, Date start, Date end, String icon, int children)
+ {
+ assertNotNull(node);
+ assertEquals(name, node.getName());
+ assertEquals(label, node.getLabel());
+ assertEquals(visibility, node.getVisibility());
+ assertEquals(pageRef, node.getPageReference());
+ assertEquals(start, node.getStartPublicationDate());
+ assertEquals(end, node.getEndPublicationDate());
+ assertEquals(icon, node.getIcon());
+ assertNotNull(node.getNodes());
+ assertEquals(children, node.getNodes().size());
+ }
+
+ private void compareNode(PageNode expected, PageNode actual)
+ {
+ if (expected.getLabel() != null)
+ {
+ assertEquals(expected.getLabel(), actual.getLabel());
+ }
+ else if (expected.getLabels() != null)
+ {
+ assertNotNull(actual.getLabels());
+ assertEquals(actual.getLabels().size(), expected.getLabels().size());
+
+ for (int i=0; i<actual.getLabels().size(); i++)
+ {
+ LocalizedString actualLocalizedString = expected.getLabels().get(i);
+ LocalizedString expectedLocalizedString = expected.getLabels().get(i);
+ assertEquals(actualLocalizedString.getValue(), expectedLocalizedString.getValue());
+ assertEquals(actualLocalizedString.getLang(), expectedLocalizedString.getLang());
+ }
+ }
+ else
+ {
+ assertNull(actual.getLabel());
+ assertNull(actual.getLabels());
+ }
+
+ assertEquals(expected.getIcon(), actual.getIcon());
+ assertEquals(expected.getName(), actual.getName());
+ assertEquals(expected.getStartPublicationDate(), actual.getStartPublicationDate());
+ assertEquals(expected.getEndPublicationDate(), actual.getEndPublicationDate());
+ assertEquals(expected.getVisibility(), actual.getVisibility());
+ assertEquals(expected.getPageReference(), actual.getPageReference());
+ assertEquals(expected.getNodes().size(), actual.getNodes().size());
+ }
+
+ private Date createDate(int year, int month, int day, int hour, int minute, int seconds)
+ {
+ Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("US/Eastern"));
+ cal.set(Calendar.YEAR, year);
+ cal.set(Calendar.MONTH, month-1);
+ cal.set(Calendar.DAY_OF_MONTH, day);
+ cal.set(Calendar.HOUR_OF_DAY, hour);
+ cal.set(Calendar.MINUTE, minute);
+ cal.set(Calendar.SECOND, seconds);
+ cal.set(Calendar.MILLISECOND, 0);
+
+ return cal.getTime();
+ }
+
+ private PageNode newPageNode(String name, String icon, String label, Date start, Date end, Visibility visibility, String pageref, ArrayList<PageNode> pageNodes)
+ {
+ PageNode pageNode = new PageNode();
+ pageNode.setName(name);
+ pageNode.setIcon(icon);
+ pageNode.setLabel(label);
+ pageNode.setStartPublicationDate(start);
+ pageNode.setEndPublicationDate(end);
+ pageNode.setVisibility(visibility);
+ pageNode.setPageReference(pageref);
+ pageNode.setChildren(pageNodes);
+
+ return pageNode;
+ }
+
+ private PageNode newPageNode(String name, String icon, I18NString labels, Date start, Date end, Visibility visibility, String pageref, ArrayList<PageNode> pageNodes)
+ {
+ PageNode pageNode = new PageNode();
+ pageNode.setName(name);
+ pageNode.setIcon(icon);
+ pageNode.setLabels(labels);
+ pageNode.setStartPublicationDate(start);
+ pageNode.setEndPublicationDate(end);
+ pageNode.setVisibility(visibility);
+ pageNode.setPageReference(pageref);
+ pageNode.setChildren(pageNodes);
+
+ return pageNode;
+ }
+}
Deleted: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshallerTest.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshallerTest.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshallerTest.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,441 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
-
-import org.exoplatform.portal.config.model.Application;
-import org.exoplatform.portal.config.model.ApplicationState;
-import org.exoplatform.portal.config.model.ApplicationType;
-import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.pom.config.Utils;
-import org.exoplatform.portal.pom.data.ApplicationData;
-import org.exoplatform.portal.pom.data.ComponentData;
-import org.exoplatform.portal.pom.data.ContainerData;
-import org.exoplatform.portal.pom.data.PageData;
-import org.exoplatform.portal.pom.spi.gadget.Gadget;
-import org.exoplatform.portal.pom.spi.portlet.Portlet;
-import org.exoplatform.portal.pom.spi.portlet.Preference;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class PageMarshallerTest extends AbstractMarshallerTest
-{
- public void testHomePageUnMarshalling()
- {
- PageMarshaller marshaller = new PageMarshaller();
- Page.PageSet pages = marshaller.unmarshal(getClass().getResourceAsStream("/org/exoplatform/portal/mop/management/pages-homepage.xml"));
- assertNotNull(pages);
- assertNotNull(pages.getPages());
- assertEquals(1, pages.getPages().size());
- Page page = pages.getPages().get(0);
-
- assertEquals("homepage", page.getName());
- assertEquals("Home Page", page.getTitle());
- assertEquals("Everyone", Utils.join(";", page.getAccessPermissions()));
- assertEquals("*:/platform/administrators", page.getEditPermission());
- assertNotNull(page.getChildren());
- assertEquals(1, page.getChildren().size());
- ModelObject child = page.getChildren().get(0);
- assertTrue(child instanceof Application);
- @SuppressWarnings("unchecked")
- Application<Portlet> application = (Application<Portlet>) child;
- assertTrue(application.getType() == ApplicationType.PORTLET);
- ApplicationState<Portlet> state = application.getState();
- assertNotNull(state);
- assertTrue(state instanceof TransientApplicationState);
- TransientApplicationState<Portlet> tas = (TransientApplicationState<Portlet>) state;
- assertEquals("web/HomePagePortlet", tas.getContentId());
- Portlet portlet = tas.getContentState();
- int count = 0;
- for (Preference pref : portlet)
- {
- count++;
- }
- assertEquals(1, count);
- Preference pref = portlet.getPreference("template");
- assertNotNull(pref);
- assertEquals("template", pref.getName());
- assertEquals("system:/templates/groovy/webui/component/UIHomePagePortlet.gtmpl", pref.getValue());
- assertFalse(pref.isReadOnly());
-
- assertNull(application.getTheme());
- assertEquals("Home Page portlet", application.getTitle());
- assertEquals("Everyone", Utils.join(";", application.getAccessPermissions()));
- assertFalse(application.getShowInfoBar());
- assertFalse(application.getShowApplicationState());
- assertFalse(application.getShowApplicationMode());
- assertNull(application.getDescription());
- assertNull(application.getIcon());
- assertNull(application.getWidth());
- assertNull(application.getHeight());
- }
-
- public void testLoadedPageUnmarshalling()
- {
- PageMarshaller marshaller = new PageMarshaller();
- Page.PageSet pages = marshaller.unmarshal(getClass().getResourceAsStream("/org/exoplatform/portal/mop/management/pages-loaded.xml"));
- assertNotNull(pages);
- assertNotNull(pages.getPages());
- assertEquals(1, pages.getPages().size());
- Page page = pages.getPages().get(0);
-
- // Verify page properties
- assertEquals("loaded-page", page.getName());
- assertEquals("Loaded Page", page.getTitle());
- assertEquals("manager:/platform/administrators;manager:/platform/users", Utils.join(";", page.getAccessPermissions()));
- assertEquals("*:/platform/administrators", page.getEditPermission());
-
- // Verify page children
- assertNotNull(page.getChildren());
- assertEquals(1, page.getChildren().size());
- ModelObject child = page.getChildren().get(0);
- assertTrue(child instanceof Container);
-
- // Verify root container
- Container rootContainer = (Container) child;
- assertEquals("rootContainer", rootContainer.getId());
- assertEquals("system:/groovy/portal/webui/container/UIContainer.gtmpl", rootContainer.getTemplate());
- assertEquals("Everyone", Utils.join(";", rootContainer.getAccessPermissions()));
-
- // Verify root container children
- List<ModelObject> rootChildren = rootContainer.getChildren();
- assertNotNull(rootChildren);
- assertEquals(3, rootChildren.size());
-
- // Verify container 1
- ModelObject c1 = rootChildren.get(0);
- assertNotNull(c1);
- assertTrue(c1 instanceof ModelObject);
- Container container1 = (Container) c1;
- assertEquals("c1", container1.getId());
- assertEquals("system:/groovy/portal/webui/container/UIContainer.gtmpl", container1.getTemplate());
- assertEquals("*:/platform/users", Utils.join(";", container1.getAccessPermissions()));
- {
- // Verify homepage application
- assertNotNull(container1.getChildren());
- assertEquals(1, container1.getChildren().size());
- ModelObject homeComponent = container1.getChildren().get(0);
- assertTrue(homeComponent instanceof Application);
- @SuppressWarnings("unchecked")
- Application<Portlet> application = (Application<Portlet>) homeComponent;
- assertTrue(application.getType() == ApplicationType.PORTLET);
- ApplicationState<Portlet> state = application.getState();
- assertNotNull(state);
- assertTrue(state instanceof TransientApplicationState);
- TransientApplicationState<Portlet> tas = (TransientApplicationState<Portlet>) state;
- assertEquals("web/HomePagePortlet", tas.getContentId());
- Portlet portlet = tas.getContentState();
- int count = 0;
- for (Preference pref : portlet)
- {
- count++;
- }
- assertEquals(3, count);
- Preference pref = portlet.getPreference("template");
- assertNotNull(pref);
- assertEquals("template", pref.getName());
- assertEquals("system:/templates/groovy/webui/component/UIHomePagePortlet.gtmpl", pref.getValue());
- assertTrue(pref.isReadOnly());
-
- pref = portlet.getPreference("empty-preference-value");
- assertNotNull(pref);
- assertEquals("empty-preference-value", pref.getName());
- assertNull(pref.getValue());
- assertFalse(pref.isReadOnly());
-
- pref = portlet.getPreference("no-preference-value");
- assertNotNull(pref);
- assertEquals("no-preference-value", pref.getName());
- assertNull(pref.getValue());
- assertFalse(pref.isReadOnly());
-
- assertEquals("Mac:MacTheme::Default:DefaultTheme::Vista:VistaTheme", application.getTheme());
- assertEquals("Home Page portlet", application.getTitle());
- assertEquals("Everyone", Utils.join(";", application.getAccessPermissions()));
- assertTrue(application.getShowInfoBar());
- assertTrue(application.getShowApplicationState());
- assertTrue(application.getShowApplicationMode());
- assertNull(application.getDescription());
- assertNull(application.getIcon());
- assertNull(application.getWidth());
- assertNull(application.getHeight());
- }
-
- // Verify container 2
- ModelObject c2 = rootChildren.get(1);
- assertNotNull(c2);
- assertTrue(c2 instanceof Container);
- Container container2 = (Container) c2;
- assertEquals("c2", container2.getId());
- assertEquals("system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl", container2.getTemplate());
- assertEquals("*:/platform/guests", Utils.join(";", container2.getAccessPermissions()));
- assertEquals("TableColumnContainer", container2.getFactoryId());
- assertNotNull(container2.getChildren());
- assertEquals(2, container2.getChildren().size());
-
- {
- // Verify column 1 of container 2
- ModelObject appregComp = container2.getChildren().get(0);
- assertTrue(appregComp instanceof Container);
- Container appregContainer = (Container) appregComp;
- assertEquals("c2-1", appregContainer.getId());
- assertEquals("system:/groovy/portal/webui/container/UIContainer.gtmpl", appregContainer.getTemplate());
- assertEquals("300px", appregContainer.getWidth());
- assertEquals("400px", appregContainer.getHeight());
- assertEquals("Everyone", Utils.join(";", appregContainer.getAccessPermissions()));
- {
- // Verify app registry application
- assertNotNull(appregContainer.getChildren());
- assertEquals(1, appregContainer.getChildren().size());
- ModelObject appregComponent = appregContainer.getChildren().get(0);
- assertTrue(appregComponent instanceof Application);
- @SuppressWarnings("unchecked")
- Application<Portlet> application = (Application<Portlet>) appregComponent;
- assertTrue(application.getType() == ApplicationType.PORTLET);
- ApplicationState<Portlet> state = application.getState();
- assertNotNull(state);
- assertTrue(state instanceof TransientApplicationState);
- TransientApplicationState<Portlet> tas = (TransientApplicationState<Portlet>) state;
- assertEquals("exoadmin/ApplicationRegistryPortlet", tas.getContentId());
- assertNull(tas.getContentState());
-
- assertEquals("Default:DefaultTheme::Mac:MacTheme::Vista:VistaTheme", application.getTheme());
- assertEquals("Application Registry", application.getTitle());
- assertEquals("*:/platform/administrators;*:/organization/management/executive-board", Utils.join(";", application.getAccessPermissions()));
- assertFalse(application.getShowInfoBar());
- assertTrue(application.getShowApplicationState());
- assertFalse(application.getShowApplicationMode());
- assertEquals("Application Registry", application.getDescription());
- assertEquals("PortletIcon", application.getIcon());
- assertEquals("250px", application.getWidth());
- assertEquals("350px", application.getHeight());
- }
-
- // Verify column 2 of container 2
- ModelObject orgComp = container2.getChildren().get(1);
- assertTrue(orgComp instanceof Container);
- Container orgContainer = (Container) orgComp;
- assertEquals("c2-2", orgContainer.getId());
- assertEquals("system:/groovy/portal/webui/container/UIContainer.gtmpl", orgContainer.getTemplate());
- assertEquals("200px", orgContainer.getWidth());
- assertEquals("300px", orgContainer.getHeight());
- assertEquals("/platform/users", Utils.join(";", orgContainer.getAccessPermissions()));
- {
- // Verify calendar gadget application
- assertNotNull(orgContainer.getChildren());
- assertEquals(1, orgContainer.getChildren().size());
- ModelObject gadgetComponent = orgContainer.getChildren().get(0);
- assertTrue(gadgetComponent instanceof Application);
- @SuppressWarnings("unchecked")
- Application<Gadget> application = (Application<Gadget>) gadgetComponent;
- assertTrue(application.getType() == ApplicationType.GADGET);
- ApplicationState<Gadget> state = application.getState();
- assertNotNull(state);
- assertTrue(state instanceof TransientApplicationState);
- TransientApplicationState<Gadget> tas = (TransientApplicationState<Gadget>) state;
- assertEquals("Calendar", tas.getContentId());
- assertNull(tas.getContentState());
-
- assertEquals("Vista:VistaTheme::Mac:MacTheme::Default:DefaultTheme", application.getTheme());
- assertEquals("Calendar Title", application.getTitle());
- assertEquals("*:/platform/administrators;*:/organization/management/executive-board", Utils.join(";", application.getAccessPermissions()));
- assertTrue(application.getShowInfoBar());
- assertFalse(application.getShowApplicationState());
- assertFalse(application.getShowApplicationMode());
- assertEquals("Calendar Description", application.getDescription());
- assertEquals("StarAwardIcon", application.getIcon());
- assertEquals("100px", application.getWidth());
- assertEquals("200px", application.getHeight());
- }
- }
-
- // Verify container 3
- ModelObject c3 = rootChildren.get(2);
- assertNotNull(c3);
- assertTrue(c3 instanceof Container);
- Container container3 = (Container) c3;
- assertEquals("c3", container3.getId());
- assertEquals("system:/groovy/portal/webui/container/UIContainer.gtmpl", container3.getTemplate());
- assertEquals(container3.getTemplate(), "system:/groovy/portal/webui/container/UIContainer.gtmpl");
- assertEquals("Everyone", Utils.join(";", container3.getAccessPermissions()));
- assertNull(container3.getFactoryId());
- {
- // Verify site map application
- assertNotNull(container3.getChildren());
- assertEquals(1, container3.getChildren().size());
- ModelObject sitemapcomponent = container3.getChildren().get(0);
- assertTrue(sitemapcomponent instanceof Application);
- @SuppressWarnings("unchecked")
- Application<Portlet> application = (Application<Portlet>) sitemapcomponent;
- assertTrue(application.getType() == ApplicationType.PORTLET);
- ApplicationState<Portlet> state = application.getState();
- assertNotNull(state);
- assertTrue(state instanceof TransientApplicationState);
- TransientApplicationState<Portlet> tas = (TransientApplicationState<Portlet>) state;
- assertEquals("web/SiteMapPortlet", tas.getContentId());
- assertNull(tas.getContentState());
-
- assertEquals("Default:DefaultTheme::Vista:VistaTheme::Mac:MacTheme", application.getTheme());
- assertEquals("SiteMap", application.getTitle());
- assertEquals("*:/platform/users", Utils.join(";", application.getAccessPermissions()));
- assertTrue(application.getShowInfoBar());
- assertTrue(application.getShowApplicationState());
- assertFalse(application.getShowApplicationMode());
- assertEquals("SiteMap", application.getDescription());
- assertNull(application.getIcon());
- assertNull(application.getWidth());
- assertNull(application.getHeight());
- }
- }
-
- public void testEmptyPageUnmarshalling()
- {
- PageMarshaller marshaller = new PageMarshaller();
- Page.PageSet pages = marshaller.unmarshal(getClass().getResourceAsStream("/org/exoplatform/portal/mop/management/pages-empty.xml"));
- assertNotNull(pages);
- assertNotNull(pages.getPages());
- assertEquals(1, pages.getPages().size());
- Page page = pages.getPages().get(0);
- assertNotNull(page);
- assertEquals("empty-page", page.getName());
- assertEquals("Empty", page.getTitle());
- assertNotNull(page.getChildren());
- assertTrue(page.getChildren().isEmpty());
- }
-
- public void testPageMarshalling()
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- Portlet portlet = new Portlet();
- portlet.putPreference(new Preference("pref-1", "value-1", true));
- portlet.putPreference(new Preference("pref-2", "value-2", false));
- portlet.putPreference(new Preference("multi-value-pref", Arrays.asList("one", "two", "three"), false));
- portlet.putPreference(new Preference("empty-value-pref", (String) null, true));
-
- ApplicationState<Portlet> state = new TransientApplicationState<Portlet>("app-ref/portlet-ref", portlet);
- ApplicationData<Portlet> applicationData = new ApplicationData<Portlet>(null, null,
- ApplicationType.PORTLET, state, null, "app-title", "app-icon", "app-description", false, true, false,
- "app-theme", "app-wdith", "app-height", new HashMap<String,String>(),
- Collections.singletonList("app-edit-permissions"));
-
- ContainerData containerData = new ContainerData(null, "cd-id", "cd-name", "cd-icon", "cd-template", "cd-factoryId", "cd-title", "cd-description", "cd-width", "cd-height", Collections.singletonList("cd-access-permissions"), Collections.singletonList((ComponentData) applicationData));
- List<ComponentData> children = Collections.singletonList((ComponentData) containerData);
-
- PageData expectedData = new PageData(null, null, "page-name", null, null, null, "Page Title", null, null, null,
- Collections.singletonList("access-permissions"), children, "", "", "edit-permission", true);
-
- Page expected = new Page(expectedData);
-
- Page.PageSet expectedPages = new Page.PageSet();
- expectedPages.setPages(new ArrayList<Page>(1));
- expectedPages.getPages().add(expected);
-
- PageMarshaller marshaller = new PageMarshaller();
- marshaller.marshal(expectedPages, baos);
-
- //System.out.println(baos.toString());
-
- Page.PageSet actualPages = marshaller.unmarshal(new ByteArrayInputStream(baos.toByteArray()));
-
- assertNotNull(actualPages);
- assertNotNull(actualPages.getPages());
- assertEquals(1, actualPages.getPages().size());
-
- comparePages(expected, actualPages.getPages().get(0));
- }
-
- public void testPageMarshallingWithGadget()
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- Gadget gadget = null;
- //TODO: Uncomment when gadget user-prefs are supported in gatein_objects
- //Gadget gadget = new Gadget();
- //gadget.setUserPref("user-pref");
-
- ApplicationState<Gadget> state = new TransientApplicationState<Gadget>("gadget-ref", gadget);
- ApplicationData<Gadget> applicationData = new ApplicationData<Gadget>(null, null,
- ApplicationType.GADGET, state, null, "app-title", "app-icon", "app-description", false, true, false,
- "app-theme", "app-wdith", "app-height", new HashMap<String,String>(),
- Collections.singletonList("app-edit-permissions"));
-
- List<ComponentData> children = Collections.singletonList((ComponentData) applicationData);
- PageData expectedData = new PageData(null, null, "page-name", null, null, null, "Page Title", null, null, null,
- Collections.singletonList("access-permissions"), children, "", "", "edit-permission", true);
-
- Page expected = new Page(expectedData);
-
- Page.PageSet expectedPages = new Page.PageSet();
- expectedPages.setPages(new ArrayList<Page>(1));
- expectedPages.getPages().add(expected);
-
- PageMarshaller marshaller = new PageMarshaller();
- marshaller.marshal(expectedPages, baos);
-
- //System.out.println(baos.toString());
-
- Page.PageSet actualPages = marshaller.unmarshal(new ByteArrayInputStream(baos.toByteArray()));
-
- assertNotNull(actualPages);
- assertNotNull(actualPages.getPages());
- assertEquals(1, actualPages.getPages().size());
-
- comparePages(expected, actualPages.getPages().get(0));
- }
-
- private void comparePages(Page expected, Page actual)
- {
- assertNull(actual.getStorageId());
- assertNull(actual.getStorageName());
- assertNull(actual.getId());
- assertNull(actual.getOwnerType());
- assertNull(actual.getOwnerId());
- assertEquals(expected.getName(), actual.getName());
- assertNull(actual.getIcon());
- assertNull(actual.getTemplate());
- assertNull(actual.getFactoryId());
- assertEquals(expected.getTitle(), actual.getTitle());
- assertNull(actual.getDescription());
- assertNull(actual.getWidth());
- assertNull(actual.getHeight());
- assertEquals(Arrays.asList(expected.getAccessPermissions()), Arrays.asList(actual.getAccessPermissions()));
-
- compareComponents(expected.getChildren(), actual.getChildren());
-
- assertEquals(expected.getEditPermission(), actual.getEditPermission());
- assertEquals(expected.isShowMaxWindow(), actual.isShowMaxWindow());
- }
-}
Copied: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshallerTest.java (from rev 6958, portal/branches/gatein-management/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshallerTest.java)
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshallerTest.java (rev 0)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshallerTest.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,441 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
+
+import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.TransientApplicationState;
+import org.exoplatform.portal.pom.config.Utils;
+import org.exoplatform.portal.pom.data.ApplicationData;
+import org.exoplatform.portal.pom.data.ComponentData;
+import org.exoplatform.portal.pom.data.ContainerData;
+import org.exoplatform.portal.pom.data.PageData;
+import org.exoplatform.portal.pom.spi.gadget.Gadget;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+import org.exoplatform.portal.pom.spi.portlet.Preference;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class PageMarshallerTest extends AbstractMarshallerTest
+{
+ public void testHomePageUnMarshalling()
+ {
+ PageMarshaller marshaller = new PageMarshaller();
+ Page.PageSet pages = marshaller.unmarshal(getClass().getResourceAsStream("/org/exoplatform/portal/mop/management/pages-homepage.xml"));
+ assertNotNull(pages);
+ assertNotNull(pages.getPages());
+ assertEquals(1, pages.getPages().size());
+ Page page = pages.getPages().get(0);
+
+ assertEquals("homepage", page.getName());
+ assertEquals("Home Page", page.getTitle());
+ assertEquals("Everyone", Utils.join(";", page.getAccessPermissions()));
+ assertEquals("*:/platform/administrators", page.getEditPermission());
+ assertNotNull(page.getChildren());
+ assertEquals(1, page.getChildren().size());
+ ModelObject child = page.getChildren().get(0);
+ assertTrue(child instanceof Application);
+ @SuppressWarnings("unchecked")
+ Application<Portlet> application = (Application<Portlet>) child;
+ assertTrue(application.getType() == ApplicationType.PORTLET);
+ ApplicationState<Portlet> state = application.getState();
+ assertNotNull(state);
+ assertTrue(state instanceof TransientApplicationState);
+ TransientApplicationState<Portlet> tas = (TransientApplicationState<Portlet>) state;
+ assertEquals("web/HomePagePortlet", tas.getContentId());
+ Portlet portlet = tas.getContentState();
+ int count = 0;
+ for (Preference pref : portlet)
+ {
+ count++;
+ }
+ assertEquals(1, count);
+ Preference pref = portlet.getPreference("template");
+ assertNotNull(pref);
+ assertEquals("template", pref.getName());
+ assertEquals("system:/templates/groovy/webui/component/UIHomePagePortlet.gtmpl", pref.getValue());
+ assertFalse(pref.isReadOnly());
+
+ assertNull(application.getTheme());
+ assertEquals("Home Page portlet", application.getTitle());
+ assertEquals("Everyone", Utils.join(";", application.getAccessPermissions()));
+ assertFalse(application.getShowInfoBar());
+ assertFalse(application.getShowApplicationState());
+ assertFalse(application.getShowApplicationMode());
+ assertNull(application.getDescription());
+ assertNull(application.getIcon());
+ assertNull(application.getWidth());
+ assertNull(application.getHeight());
+ }
+
+ public void testLoadedPageUnmarshalling()
+ {
+ PageMarshaller marshaller = new PageMarshaller();
+ Page.PageSet pages = marshaller.unmarshal(getClass().getResourceAsStream("/org/exoplatform/portal/mop/management/pages-loaded.xml"));
+ assertNotNull(pages);
+ assertNotNull(pages.getPages());
+ assertEquals(1, pages.getPages().size());
+ Page page = pages.getPages().get(0);
+
+ // Verify page properties
+ assertEquals("loaded-page", page.getName());
+ assertEquals("Loaded Page", page.getTitle());
+ assertEquals("manager:/platform/administrators;manager:/platform/users", Utils.join(";", page.getAccessPermissions()));
+ assertEquals("*:/platform/administrators", page.getEditPermission());
+
+ // Verify page children
+ assertNotNull(page.getChildren());
+ assertEquals(1, page.getChildren().size());
+ ModelObject child = page.getChildren().get(0);
+ assertTrue(child instanceof Container);
+
+ // Verify root container
+ Container rootContainer = (Container) child;
+ assertEquals("rootContainer", rootContainer.getId());
+ assertEquals("system:/groovy/portal/webui/container/UIContainer.gtmpl", rootContainer.getTemplate());
+ assertEquals("Everyone", Utils.join(";", rootContainer.getAccessPermissions()));
+
+ // Verify root container children
+ List<ModelObject> rootChildren = rootContainer.getChildren();
+ assertNotNull(rootChildren);
+ assertEquals(3, rootChildren.size());
+
+ // Verify container 1
+ ModelObject c1 = rootChildren.get(0);
+ assertNotNull(c1);
+ assertTrue(c1 instanceof ModelObject);
+ Container container1 = (Container) c1;
+ assertEquals("c1", container1.getId());
+ assertEquals("system:/groovy/portal/webui/container/UIContainer.gtmpl", container1.getTemplate());
+ assertEquals("*:/platform/users", Utils.join(";", container1.getAccessPermissions()));
+ {
+ // Verify homepage application
+ assertNotNull(container1.getChildren());
+ assertEquals(1, container1.getChildren().size());
+ ModelObject homeComponent = container1.getChildren().get(0);
+ assertTrue(homeComponent instanceof Application);
+ @SuppressWarnings("unchecked")
+ Application<Portlet> application = (Application<Portlet>) homeComponent;
+ assertTrue(application.getType() == ApplicationType.PORTLET);
+ ApplicationState<Portlet> state = application.getState();
+ assertNotNull(state);
+ assertTrue(state instanceof TransientApplicationState);
+ TransientApplicationState<Portlet> tas = (TransientApplicationState<Portlet>) state;
+ assertEquals("web/HomePagePortlet", tas.getContentId());
+ Portlet portlet = tas.getContentState();
+ int count = 0;
+ for (Preference pref : portlet)
+ {
+ count++;
+ }
+ assertEquals(3, count);
+ Preference pref = portlet.getPreference("template");
+ assertNotNull(pref);
+ assertEquals("template", pref.getName());
+ assertEquals("system:/templates/groovy/webui/component/UIHomePagePortlet.gtmpl", pref.getValue());
+ assertTrue(pref.isReadOnly());
+
+ pref = portlet.getPreference("empty-preference-value");
+ assertNotNull(pref);
+ assertEquals("empty-preference-value", pref.getName());
+ assertNull(pref.getValue());
+ assertFalse(pref.isReadOnly());
+
+ pref = portlet.getPreference("no-preference-value");
+ assertNotNull(pref);
+ assertEquals("no-preference-value", pref.getName());
+ assertNull(pref.getValue());
+ assertFalse(pref.isReadOnly());
+
+ assertEquals("Mac:MacTheme::Default:DefaultTheme::Vista:VistaTheme", application.getTheme());
+ assertEquals("Home Page portlet", application.getTitle());
+ assertEquals("Everyone", Utils.join(";", application.getAccessPermissions()));
+ assertTrue(application.getShowInfoBar());
+ assertTrue(application.getShowApplicationState());
+ assertTrue(application.getShowApplicationMode());
+ assertNull(application.getDescription());
+ assertNull(application.getIcon());
+ assertNull(application.getWidth());
+ assertNull(application.getHeight());
+ }
+
+ // Verify container 2
+ ModelObject c2 = rootChildren.get(1);
+ assertNotNull(c2);
+ assertTrue(c2 instanceof Container);
+ Container container2 = (Container) c2;
+ assertEquals("c2", container2.getId());
+ assertEquals("system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl", container2.getTemplate());
+ assertEquals("*:/platform/guests", Utils.join(";", container2.getAccessPermissions()));
+ assertEquals("TableColumnContainer", container2.getFactoryId());
+ assertNotNull(container2.getChildren());
+ assertEquals(2, container2.getChildren().size());
+
+ {
+ // Verify column 1 of container 2
+ ModelObject appregComp = container2.getChildren().get(0);
+ assertTrue(appregComp instanceof Container);
+ Container appregContainer = (Container) appregComp;
+ assertEquals("c2-1", appregContainer.getId());
+ assertEquals("system:/groovy/portal/webui/container/UIContainer.gtmpl", appregContainer.getTemplate());
+ assertEquals("300px", appregContainer.getWidth());
+ assertEquals("400px", appregContainer.getHeight());
+ assertEquals("Everyone", Utils.join(";", appregContainer.getAccessPermissions()));
+ {
+ // Verify app registry application
+ assertNotNull(appregContainer.getChildren());
+ assertEquals(1, appregContainer.getChildren().size());
+ ModelObject appregComponent = appregContainer.getChildren().get(0);
+ assertTrue(appregComponent instanceof Application);
+ @SuppressWarnings("unchecked")
+ Application<Portlet> application = (Application<Portlet>) appregComponent;
+ assertTrue(application.getType() == ApplicationType.PORTLET);
+ ApplicationState<Portlet> state = application.getState();
+ assertNotNull(state);
+ assertTrue(state instanceof TransientApplicationState);
+ TransientApplicationState<Portlet> tas = (TransientApplicationState<Portlet>) state;
+ assertEquals("exoadmin/ApplicationRegistryPortlet", tas.getContentId());
+ assertNull(tas.getContentState());
+
+ assertEquals("Default:DefaultTheme::Mac:MacTheme::Vista:VistaTheme", application.getTheme());
+ assertEquals("Application Registry", application.getTitle());
+ assertEquals("*:/platform/administrators;*:/organization/management/executive-board", Utils.join(";", application.getAccessPermissions()));
+ assertFalse(application.getShowInfoBar());
+ assertTrue(application.getShowApplicationState());
+ assertFalse(application.getShowApplicationMode());
+ assertEquals("Application Registry", application.getDescription());
+ assertEquals("PortletIcon", application.getIcon());
+ assertEquals("250px", application.getWidth());
+ assertEquals("350px", application.getHeight());
+ }
+
+ // Verify column 2 of container 2
+ ModelObject orgComp = container2.getChildren().get(1);
+ assertTrue(orgComp instanceof Container);
+ Container orgContainer = (Container) orgComp;
+ assertEquals("c2-2", orgContainer.getId());
+ assertEquals("system:/groovy/portal/webui/container/UIContainer.gtmpl", orgContainer.getTemplate());
+ assertEquals("200px", orgContainer.getWidth());
+ assertEquals("300px", orgContainer.getHeight());
+ assertEquals("/platform/users", Utils.join(";", orgContainer.getAccessPermissions()));
+ {
+ // Verify calendar gadget application
+ assertNotNull(orgContainer.getChildren());
+ assertEquals(1, orgContainer.getChildren().size());
+ ModelObject gadgetComponent = orgContainer.getChildren().get(0);
+ assertTrue(gadgetComponent instanceof Application);
+ @SuppressWarnings("unchecked")
+ Application<Gadget> application = (Application<Gadget>) gadgetComponent;
+ assertTrue(application.getType() == ApplicationType.GADGET);
+ ApplicationState<Gadget> state = application.getState();
+ assertNotNull(state);
+ assertTrue(state instanceof TransientApplicationState);
+ TransientApplicationState<Gadget> tas = (TransientApplicationState<Gadget>) state;
+ assertEquals("Calendar", tas.getContentId());
+ assertNull(tas.getContentState());
+
+ assertEquals("Vista:VistaTheme::Mac:MacTheme::Default:DefaultTheme", application.getTheme());
+ assertEquals("Calendar Title", application.getTitle());
+ assertEquals("*:/platform/administrators;*:/organization/management/executive-board", Utils.join(";", application.getAccessPermissions()));
+ assertTrue(application.getShowInfoBar());
+ assertFalse(application.getShowApplicationState());
+ assertFalse(application.getShowApplicationMode());
+ assertEquals("Calendar Description", application.getDescription());
+ assertEquals("StarAwardIcon", application.getIcon());
+ assertEquals("100px", application.getWidth());
+ assertEquals("200px", application.getHeight());
+ }
+ }
+
+ // Verify container 3
+ ModelObject c3 = rootChildren.get(2);
+ assertNotNull(c3);
+ assertTrue(c3 instanceof Container);
+ Container container3 = (Container) c3;
+ assertEquals("c3", container3.getId());
+ assertEquals("system:/groovy/portal/webui/container/UIContainer.gtmpl", container3.getTemplate());
+ assertEquals(container3.getTemplate(), "system:/groovy/portal/webui/container/UIContainer.gtmpl");
+ assertEquals("Everyone", Utils.join(";", container3.getAccessPermissions()));
+ assertNull(container3.getFactoryId());
+ {
+ // Verify site map application
+ assertNotNull(container3.getChildren());
+ assertEquals(1, container3.getChildren().size());
+ ModelObject sitemapcomponent = container3.getChildren().get(0);
+ assertTrue(sitemapcomponent instanceof Application);
+ @SuppressWarnings("unchecked")
+ Application<Portlet> application = (Application<Portlet>) sitemapcomponent;
+ assertTrue(application.getType() == ApplicationType.PORTLET);
+ ApplicationState<Portlet> state = application.getState();
+ assertNotNull(state);
+ assertTrue(state instanceof TransientApplicationState);
+ TransientApplicationState<Portlet> tas = (TransientApplicationState<Portlet>) state;
+ assertEquals("web/SiteMapPortlet", tas.getContentId());
+ assertNull(tas.getContentState());
+
+ assertEquals("Default:DefaultTheme::Vista:VistaTheme::Mac:MacTheme", application.getTheme());
+ assertEquals("SiteMap", application.getTitle());
+ assertEquals("*:/platform/users", Utils.join(";", application.getAccessPermissions()));
+ assertTrue(application.getShowInfoBar());
+ assertTrue(application.getShowApplicationState());
+ assertFalse(application.getShowApplicationMode());
+ assertEquals("SiteMap", application.getDescription());
+ assertNull(application.getIcon());
+ assertNull(application.getWidth());
+ assertNull(application.getHeight());
+ }
+ }
+
+ public void testEmptyPageUnmarshalling()
+ {
+ PageMarshaller marshaller = new PageMarshaller();
+ Page.PageSet pages = marshaller.unmarshal(getClass().getResourceAsStream("/org/exoplatform/portal/mop/management/pages-empty.xml"));
+ assertNotNull(pages);
+ assertNotNull(pages.getPages());
+ assertEquals(1, pages.getPages().size());
+ Page page = pages.getPages().get(0);
+ assertNotNull(page);
+ assertEquals("empty-page", page.getName());
+ assertEquals("Empty", page.getTitle());
+ assertNotNull(page.getChildren());
+ assertTrue(page.getChildren().isEmpty());
+ }
+
+ public void testPageMarshalling()
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ Portlet portlet = new Portlet();
+ portlet.putPreference(new Preference("pref-1", "value-1", true));
+ portlet.putPreference(new Preference("pref-2", "value-2", false));
+ portlet.putPreference(new Preference("multi-value-pref", Arrays.asList("one", "two", "three"), false));
+ portlet.putPreference(new Preference("empty-value-pref", (String) null, true));
+
+ ApplicationState<Portlet> state = new TransientApplicationState<Portlet>("app-ref/portlet-ref", portlet);
+ ApplicationData<Portlet> applicationData = new ApplicationData<Portlet>(null, null,
+ ApplicationType.PORTLET, state, null, "app-title", "app-icon", "app-description", false, true, false,
+ "app-theme", "app-wdith", "app-height", new HashMap<String,String>(),
+ Collections.singletonList("app-edit-permissions"));
+
+ ContainerData containerData = new ContainerData(null, "cd-id", "cd-name", "cd-icon", "cd-template", "cd-factoryId", "cd-title", "cd-description", "cd-width", "cd-height", Collections.singletonList("cd-access-permissions"), Collections.singletonList((ComponentData) applicationData));
+ List<ComponentData> children = Collections.singletonList((ComponentData) containerData);
+
+ PageData expectedData = new PageData(null, null, "page-name", null, null, null, "Page Title", null, null, null,
+ Collections.singletonList("access-permissions"), children, "", "", "edit-permission", true);
+
+ Page expected = new Page(expectedData);
+
+ Page.PageSet expectedPages = new Page.PageSet();
+ expectedPages.setPages(new ArrayList<Page>(1));
+ expectedPages.getPages().add(expected);
+
+ PageMarshaller marshaller = new PageMarshaller();
+ marshaller.marshal(expectedPages, baos);
+
+ //System.out.println(baos.toString());
+
+ Page.PageSet actualPages = marshaller.unmarshal(new ByteArrayInputStream(baos.toByteArray()));
+
+ assertNotNull(actualPages);
+ assertNotNull(actualPages.getPages());
+ assertEquals(1, actualPages.getPages().size());
+
+ comparePages(expected, actualPages.getPages().get(0));
+ }
+
+ public void testPageMarshallingWithGadget()
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ Gadget gadget = null;
+ //TODO: Uncomment when gadget user-prefs are supported in gatein_objects
+ //Gadget gadget = new Gadget();
+ //gadget.setUserPref("user-pref");
+
+ ApplicationState<Gadget> state = new TransientApplicationState<Gadget>("gadget-ref", gadget);
+ ApplicationData<Gadget> applicationData = new ApplicationData<Gadget>(null, null,
+ ApplicationType.GADGET, state, null, "app-title", "app-icon", "app-description", false, true, false,
+ "app-theme", "app-wdith", "app-height", new HashMap<String,String>(),
+ Collections.singletonList("app-edit-permissions"));
+
+ List<ComponentData> children = Collections.singletonList((ComponentData) applicationData);
+ PageData expectedData = new PageData(null, null, "page-name", null, null, null, "Page Title", null, null, null,
+ Collections.singletonList("access-permissions"), children, "", "", "edit-permission", true);
+
+ Page expected = new Page(expectedData);
+
+ Page.PageSet expectedPages = new Page.PageSet();
+ expectedPages.setPages(new ArrayList<Page>(1));
+ expectedPages.getPages().add(expected);
+
+ PageMarshaller marshaller = new PageMarshaller();
+ marshaller.marshal(expectedPages, baos);
+
+ //System.out.println(baos.toString());
+
+ Page.PageSet actualPages = marshaller.unmarshal(new ByteArrayInputStream(baos.toByteArray()));
+
+ assertNotNull(actualPages);
+ assertNotNull(actualPages.getPages());
+ assertEquals(1, actualPages.getPages().size());
+
+ comparePages(expected, actualPages.getPages().get(0));
+ }
+
+ private void comparePages(Page expected, Page actual)
+ {
+ assertNull(actual.getStorageId());
+ assertNull(actual.getStorageName());
+ assertNull(actual.getId());
+ assertNull(actual.getOwnerType());
+ assertNull(actual.getOwnerId());
+ assertEquals(expected.getName(), actual.getName());
+ assertNull(actual.getIcon());
+ assertNull(actual.getTemplate());
+ assertNull(actual.getFactoryId());
+ assertEquals(expected.getTitle(), actual.getTitle());
+ assertNull(actual.getDescription());
+ assertNull(actual.getWidth());
+ assertNull(actual.getHeight());
+ assertEquals(Arrays.asList(expected.getAccessPermissions()), Arrays.asList(actual.getAccessPermissions()));
+
+ compareComponents(expected.getChildren(), actual.getChildren());
+
+ assertEquals(expected.getEditPermission(), actual.getEditPermission());
+ assertEquals(expected.isShowMaxWindow(), actual.isShowMaxWindow());
+ }
+}
Deleted: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshallerTest.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshallerTest.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshallerTest.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,225 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
-
-import org.exoplatform.portal.config.model.Application;
-import org.exoplatform.portal.config.model.ApplicationState;
-import org.exoplatform.portal.config.model.ApplicationType;
-import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.config.model.PageBody;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.pom.config.Utils;
-import org.exoplatform.portal.pom.data.ApplicationData;
-import org.exoplatform.portal.pom.data.BodyData;
-import org.exoplatform.portal.pom.data.BodyType;
-import org.exoplatform.portal.pom.data.ComponentData;
-import org.exoplatform.portal.pom.data.ContainerData;
-import org.exoplatform.portal.pom.data.PortalData;
-import org.exoplatform.portal.pom.spi.portlet.Portlet;
-import org.exoplatform.portal.pom.spi.portlet.Preference;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static junit.framework.Assert.*;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class SiteLayoutMarshallerTest extends AbstractMarshallerTest
-{
- public void testPortalDataUnmarshalling()
- {
- SiteLayoutMarshaller marshaller = new SiteLayoutMarshaller();
- PortalConfig data = marshaller.unmarshal(getClass().getResourceAsStream("/org/exoplatform/portal/mop/management/portal.xml"));
- assertNotNull(data);
- assertEquals("classic", data.getName());
- assertEquals("site-label", data.getLabel());
- assertEquals("site-description", data.getDescription());
- assertEquals("en", data.getLocale());
- assertEquals("Everyone", Utils.join(";", data.getAccessPermissions()));
- assertEquals("*:/platform/administrators", data.getEditPermission());
- assertNotNull(data.getProperties());
- assertEquals(1, data.getProperties().size());
- assertTrue(data.getProperties().containsKey("sessionAlive"));
- assertEquals("onDemand", data.getProperties().get("sessionAlive"));
-
- // Verify portal layout container only has children
- assertNotNull(data.getPortalLayout());
- Container layout = data.getPortalLayout();
- assertNull(layout.getStorageId());
- assertNull(layout.getId());
- assertNull(layout.getName());
- assertNull(layout.getIcon());
- assertNull(layout.getTemplate());
- assertNull(layout.getFactoryId());
- assertNull(layout.getTitle());
- assertNull(layout.getDescription());
- assertNull(layout.getWidth());
- assertNull(layout.getHeight());
- assertNull(layout.getAccessPermissions());
- List<ModelObject> children = data.getPortalLayout().getChildren();
- assertEquals(5, children.size());
- int bodyCount = 0;
- for (ModelObject component : children)
- {
- if (component instanceof Application)
- {
- }
- else if (component instanceof PageBody)
- {
- bodyCount++;
- }
- else
- {
- fail("Only application data and one body data should be created for a portal layout.");
- }
- }
- assertEquals(1, bodyCount);
-
- // Verify banner portlet app
- {
- @SuppressWarnings("unchecked")
- Application<Portlet> application = (Application<Portlet>) children.get(0);
- assertTrue(application.getType() == ApplicationType.PORTLET);
- ApplicationState<Portlet> state = application.getState();
- assertNotNull(state);
- assertTrue(state instanceof TransientApplicationState);
- TransientApplicationState<Portlet> tas = (TransientApplicationState<Portlet>) state;
- assertEquals("web/BannerPortlet", tas.getContentId());
- Portlet portlet = tas.getContentState();
- int count = 0;
- for (Preference pref : portlet)
- {
- count++;
- }
- assertEquals(1, count);
- Preference pref = portlet.getPreference("template");
- assertNotNull(pref);
- assertEquals("template", pref.getName());
- assertEquals("par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl", pref.getValue());
- assertFalse(pref.isReadOnly());
-
- assertEquals("Default:DefaultTheme::Mac:MacTheme::Vista:VistaTheme", application.getTheme());
- assertEquals("Banner", application.getTitle());
- assertEquals("*:/platform/administrators;*:/organization/management/executive-board", Utils.join(";", application.getAccessPermissions()));
- assertFalse(application.getShowInfoBar());
- assertTrue(application.getShowApplicationState());
- assertFalse(application.getShowApplicationMode());
- assertEquals("Banner Portlet", application.getDescription());
- assertEquals("PortletIcon", application.getIcon());
- assertEquals("250px", application.getWidth());
- assertEquals("350px", application.getHeight());
- }
-
- // Verify navigation portlet app
- {
- @SuppressWarnings("unchecked")
- Application<Portlet> application = (Application<Portlet>) children.get(1);
- assertTrue(application.getType() == ApplicationType.PORTLET);
- ApplicationState<Portlet> state = application.getState();
- assertNotNull(state);
- assertTrue(state instanceof TransientApplicationState);
- TransientApplicationState<Portlet> tas = (TransientApplicationState<Portlet>) state;
- assertEquals("web/NavigationPortlet", tas.getContentId());
- assertNull(tas.getContentState());
-
- assertNull(application.getTheme());
- assertNull(application.getTitle());
- assertEquals("Everyone", Utils.join(";", application.getAccessPermissions()));
- assertFalse(application.getShowInfoBar());
- assertTrue(application.getShowApplicationState());
- assertTrue(application.getShowApplicationMode());
- assertNull(application.getDescription());
- assertNull(application.getIcon());
- assertNull(application.getWidth());
- assertNull(application.getHeight());
- }
- }
-
- public void testPortalDataMarshalling()
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- Portlet portlet = new Portlet();
- portlet.putPreference(new Preference("pref-1", "value-1", true));
- portlet.putPreference(new Preference("pref-2", "value-2", false));
- portlet.putPreference(new Preference("multi-value-pref", Arrays.asList("one", "two", "three"), false));
- portlet.putPreference(new Preference("no-value-pref", (String) null, true));
-
- ApplicationState<Portlet> state = new TransientApplicationState<Portlet>("app-ref/portlet-ref", portlet);
- ApplicationData<Portlet> application = new ApplicationData<Portlet>(null, null,
- ApplicationType.PORTLET, state, null, "app-title", "app-icon", "app-description", false, true, false,
- "app-theme", "app-wdith", "app-height", new HashMap<String,String>(),
- Collections.singletonList("app-edit-permissions"));
-
- List<ComponentData> children = new ArrayList<ComponentData>();
- children.add(application);
- children.add(new BodyData(null, BodyType.PAGE));
-
- ContainerData layout = new ContainerData(null, null, "container-name", "container-icon", "container-template",
- "factoryId", "title", "description", "width", "height", Collections.singletonList("blah"), children);
-
- Map<String,String> properties = new HashMap<String,String>();
- properties.put("key1", "value1");
- properties.put("key2", "value2");
-
- PortalData expectedData = new PortalData(null, "name", "type", "locale", "label", "description",
- Collections.singletonList("access-permissions"), "edit-permissions", properties, "skin", layout);
-
- PortalConfig expected = new PortalConfig(expectedData);
-
- SiteLayoutMarshaller marshaller = new SiteLayoutMarshaller();
- marshaller.marshal(expected, baos);
-
-// System.out.println(baos.toString());
-
- PortalConfig actual = marshaller.unmarshal(new ByteArrayInputStream(baos.toByteArray()));
- assertNotNull(actual);
- assertNull(actual.getStorageId());
- assertNull(actual.getStorageName());
- assertEquals("name", actual.getName());
- assertEquals("label", actual.getLabel());
- assertEquals("description", actual.getDescription());
- assertEquals("portal", actual.getType());
- assertEquals("locale", actual.getLocale());
- assertEquals("access-permissions", Utils.join(";", actual.getAccessPermissions()));
- assertEquals("edit-permissions", actual.getEditPermission());
- assertEquals(properties, actual.getProperties());
- assertEquals("skin", actual.getSkin());
- assertNotNull(actual.getPortalLayout());
- assertNotNull(actual.getPortalLayout().getChildren());
- assertEquals(2, actual.getPortalLayout().getChildren().size());
-
- compareComponents(expected.getPortalLayout().getChildren(), actual.getPortalLayout().getChildren());
- }
-}
Copied: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshallerTest.java (from rev 6958, portal/branches/gatein-management/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshallerTest.java)
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshallerTest.java (rev 0)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshallerTest.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,225 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.binding.xml;
+
+import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.model.PageBody;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.TransientApplicationState;
+import org.exoplatform.portal.pom.config.Utils;
+import org.exoplatform.portal.pom.data.ApplicationData;
+import org.exoplatform.portal.pom.data.BodyData;
+import org.exoplatform.portal.pom.data.BodyType;
+import org.exoplatform.portal.pom.data.ComponentData;
+import org.exoplatform.portal.pom.data.ContainerData;
+import org.exoplatform.portal.pom.data.PortalData;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+import org.exoplatform.portal.pom.spi.portlet.Preference;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static junit.framework.Assert.*;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class SiteLayoutMarshallerTest extends AbstractMarshallerTest
+{
+ public void testPortalDataUnmarshalling()
+ {
+ SiteLayoutMarshaller marshaller = new SiteLayoutMarshaller();
+ PortalConfig data = marshaller.unmarshal(getClass().getResourceAsStream("/org/exoplatform/portal/mop/management/portal.xml"));
+ assertNotNull(data);
+ assertEquals("classic", data.getName());
+ assertEquals("site-label", data.getLabel());
+ assertEquals("site-description", data.getDescription());
+ assertEquals("en", data.getLocale());
+ assertEquals("Everyone", Utils.join(";", data.getAccessPermissions()));
+ assertEquals("*:/platform/administrators", data.getEditPermission());
+ assertNotNull(data.getProperties());
+ assertEquals(1, data.getProperties().size());
+ assertTrue(data.getProperties().containsKey("sessionAlive"));
+ assertEquals("onDemand", data.getProperties().get("sessionAlive"));
+
+ // Verify portal layout container only has children
+ assertNotNull(data.getPortalLayout());
+ Container layout = data.getPortalLayout();
+ assertNull(layout.getStorageId());
+ assertNull(layout.getId());
+ assertNull(layout.getName());
+ assertNull(layout.getIcon());
+ assertNull(layout.getTemplate());
+ assertNull(layout.getFactoryId());
+ assertNull(layout.getTitle());
+ assertNull(layout.getDescription());
+ assertNull(layout.getWidth());
+ assertNull(layout.getHeight());
+ assertNull(layout.getAccessPermissions());
+ List<ModelObject> children = data.getPortalLayout().getChildren();
+ assertEquals(5, children.size());
+ int bodyCount = 0;
+ for (ModelObject component : children)
+ {
+ if (component instanceof Application)
+ {
+ }
+ else if (component instanceof PageBody)
+ {
+ bodyCount++;
+ }
+ else
+ {
+ fail("Only application data and one body data should be created for a portal layout.");
+ }
+ }
+ assertEquals(1, bodyCount);
+
+ // Verify banner portlet app
+ {
+ @SuppressWarnings("unchecked")
+ Application<Portlet> application = (Application<Portlet>) children.get(0);
+ assertTrue(application.getType() == ApplicationType.PORTLET);
+ ApplicationState<Portlet> state = application.getState();
+ assertNotNull(state);
+ assertTrue(state instanceof TransientApplicationState);
+ TransientApplicationState<Portlet> tas = (TransientApplicationState<Portlet>) state;
+ assertEquals("web/BannerPortlet", tas.getContentId());
+ Portlet portlet = tas.getContentState();
+ int count = 0;
+ for (Preference pref : portlet)
+ {
+ count++;
+ }
+ assertEquals(1, count);
+ Preference pref = portlet.getPreference("template");
+ assertNotNull(pref);
+ assertEquals("template", pref.getName());
+ assertEquals("par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl", pref.getValue());
+ assertFalse(pref.isReadOnly());
+
+ assertEquals("Default:DefaultTheme::Mac:MacTheme::Vista:VistaTheme", application.getTheme());
+ assertEquals("Banner", application.getTitle());
+ assertEquals("*:/platform/administrators;*:/organization/management/executive-board", Utils.join(";", application.getAccessPermissions()));
+ assertFalse(application.getShowInfoBar());
+ assertTrue(application.getShowApplicationState());
+ assertFalse(application.getShowApplicationMode());
+ assertEquals("Banner Portlet", application.getDescription());
+ assertEquals("PortletIcon", application.getIcon());
+ assertEquals("250px", application.getWidth());
+ assertEquals("350px", application.getHeight());
+ }
+
+ // Verify navigation portlet app
+ {
+ @SuppressWarnings("unchecked")
+ Application<Portlet> application = (Application<Portlet>) children.get(1);
+ assertTrue(application.getType() == ApplicationType.PORTLET);
+ ApplicationState<Portlet> state = application.getState();
+ assertNotNull(state);
+ assertTrue(state instanceof TransientApplicationState);
+ TransientApplicationState<Portlet> tas = (TransientApplicationState<Portlet>) state;
+ assertEquals("web/NavigationPortlet", tas.getContentId());
+ assertNull(tas.getContentState());
+
+ assertNull(application.getTheme());
+ assertNull(application.getTitle());
+ assertEquals("Everyone", Utils.join(";", application.getAccessPermissions()));
+ assertFalse(application.getShowInfoBar());
+ assertTrue(application.getShowApplicationState());
+ assertTrue(application.getShowApplicationMode());
+ assertNull(application.getDescription());
+ assertNull(application.getIcon());
+ assertNull(application.getWidth());
+ assertNull(application.getHeight());
+ }
+ }
+
+ public void testPortalDataMarshalling()
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ Portlet portlet = new Portlet();
+ portlet.putPreference(new Preference("pref-1", "value-1", true));
+ portlet.putPreference(new Preference("pref-2", "value-2", false));
+ portlet.putPreference(new Preference("multi-value-pref", Arrays.asList("one", "two", "three"), false));
+ portlet.putPreference(new Preference("no-value-pref", (String) null, true));
+
+ ApplicationState<Portlet> state = new TransientApplicationState<Portlet>("app-ref/portlet-ref", portlet);
+ ApplicationData<Portlet> application = new ApplicationData<Portlet>(null, null,
+ ApplicationType.PORTLET, state, null, "app-title", "app-icon", "app-description", false, true, false,
+ "app-theme", "app-wdith", "app-height", new HashMap<String,String>(),
+ Collections.singletonList("app-edit-permissions"));
+
+ List<ComponentData> children = new ArrayList<ComponentData>();
+ children.add(application);
+ children.add(new BodyData(null, BodyType.PAGE));
+
+ ContainerData layout = new ContainerData(null, null, "container-name", "container-icon", "container-template",
+ "factoryId", "title", "description", "width", "height", Collections.singletonList("blah"), children);
+
+ Map<String,String> properties = new HashMap<String,String>();
+ properties.put("key1", "value1");
+ properties.put("key2", "value2");
+
+ PortalData expectedData = new PortalData(null, "name", "type", "locale", "label", "description",
+ Collections.singletonList("access-permissions"), "edit-permissions", properties, "skin", layout);
+
+ PortalConfig expected = new PortalConfig(expectedData);
+
+ SiteLayoutMarshaller marshaller = new SiteLayoutMarshaller();
+ marshaller.marshal(expected, baos);
+
+// System.out.println(baos.toString());
+
+ PortalConfig actual = marshaller.unmarshal(new ByteArrayInputStream(baos.toByteArray()));
+ assertNotNull(actual);
+ assertNull(actual.getStorageId());
+ assertNull(actual.getStorageName());
+ assertEquals("name", actual.getName());
+ assertEquals("label", actual.getLabel());
+ assertEquals("description", actual.getDescription());
+ assertEquals("portal", actual.getType());
+ assertEquals("locale", actual.getLocale());
+ assertEquals("access-permissions", Utils.join(";", actual.getAccessPermissions()));
+ assertEquals("edit-permissions", actual.getEditPermission());
+ assertEquals(properties, actual.getProperties());
+ assertEquals("skin", actual.getSkin());
+ assertNotNull(actual.getPortalLayout());
+ assertNotNull(actual.getPortalLayout().getChildren());
+ assertEquals(2, actual.getPortalLayout().getChildren().size());
+
+ compareComponents(expected.getPortalLayout().getChildren(), actual.getPortalLayout().getChildren());
+ }
+}
Deleted: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/exportimport/PageImportTaskTest.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/test/java/org/exoplatform/portal/mop/management/exportimport/PageImportTaskTest.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/exportimport/PageImportTaskTest.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,492 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
-
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-import org.exoplatform.commons.utils.LazyPageList;
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.Query;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.pom.data.ComponentData;
-import org.exoplatform.portal.pom.data.PageData;
-import org.mockito.ArgumentMatcher;
-import org.mockito.Matchers;
-
-import java.util.ArrayList;
-import java.util.Collections;
-
-import static org.mockito.Mockito.*;
-
-/**
- * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
- * @version $Revision$
- */
-public class PageImportTaskTest extends TestCase
-{
- private DataStorage dataStorage;
- private LazyPageList<Page> list;
- private SiteKey siteKey = new SiteKey("user", "foo");
-
- @Override
- @SuppressWarnings("unchecked")
- protected void setUp() throws Exception
- {
- dataStorage = mock(DataStorage.class);
- list = mock(LazyPageList.class);
- }
-
- public void testConserve_NoPages() throws Exception
- {
- Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
- PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
-
- when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
- when(list.getAvailable()).thenReturn(0); // no pages exist
-
- task.importData(ImportStrategy.CONSERVE);
-
- verify(dataStorage).find(query("user", "foo"));
- verify(list).getAvailable();
- verify(list, never()).getAll();
-
- for (Page page : importing.getPages())
- {
- verify(dataStorage).save(page);
- }
- verify(dataStorage, times(3)).save();
-
- verifyNoMoreInteractions(dataStorage, list);
-
- Assert.assertNotNull(task.getRollbackDeletes());
- Assert.assertEquals(importing, task.getRollbackDeletes());
- Assert.assertNull(task.getRollbackSaves());
- }
-
- public void testConserve_SamePages() throws Exception
- {
- Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
- Page.PageSet existing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
- PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
-
- when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
- when(list.getAvailable()).thenReturn(3);
- when(list.getAll()).thenReturn(existing.getPages());
-
- task.importData(ImportStrategy.CONSERVE);
-
- verify(dataStorage).find(query("user", "foo"));
- verify(list).getAvailable();
- verify(list).getAll();
-
- verifyNoMoreInteractions(dataStorage, list);
-
- assertNullOrEmpty(task.getRollbackDeletes());
- assertNullOrEmpty(task.getRollbackSaves());
- }
-
- public void testConserve_NewPages() throws Exception
- {
- Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
- Page.PageSet existing = new Builder().addPage("foo").addPage("bar").addPage("baz").build();
- PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
-
- when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
- when(list.getAvailable()).thenReturn(3);
- when(list.getAll()).thenReturn(existing.getPages());
-
- task.importData(ImportStrategy.CONSERVE);
-
- verify(dataStorage).find(query("user", "foo"));
- verify(list).getAvailable();
- verify(list).getAll();
-
- for (Page page : importing.getPages())
- {
- verify(dataStorage).save(page);
- }
- verify(dataStorage, times(3)).save();
-
- verifyNoMoreInteractions(dataStorage, list);
-
- Assert.assertNotNull(task.getRollbackDeletes());
- Assert.assertEquals(importing.getPages(), task.getRollbackDeletes().getPages());
- Assert.assertNull(task.getRollbackSaves());
- }
-
- public void testConserve_NewAndSamePages() throws Exception
- {
- Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").addPage("page4").build();
- Page.PageSet existing = new Builder().addPage("page2").addPage("bar").addPage("page3").build();
- PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
-
- when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
- when(list.getAvailable()).thenReturn(3);
- when(list.getAll()).thenReturn(existing.getPages());
-
- task.importData(ImportStrategy.CONSERVE);
-
- verify(dataStorage).find(query("user", "foo"));
- verify(list).getAvailable();
- verify(list).getAll();
-
- verify(dataStorage).save(importing.getPages().get(0));
- verify(dataStorage).save(importing.getPages().get(3));
-
- verify(dataStorage, times(2)).save();
-
- verifyNoMoreInteractions(dataStorage, list);
-
- Assert.assertNotNull(task.getRollbackDeletes());
- Assert.assertEquals(2, task.getRollbackDeletes().getPages().size());
- Assert.assertEquals(importing.getPages().get(0), task.getRollbackDeletes().getPages().get(0));
- Assert.assertEquals(importing.getPages().get(3), task.getRollbackDeletes().getPages().get(1));
- Assert.assertNull(task.getRollbackSaves());
- }
-
- public void testMerge_NoPages() throws Exception
- {
- Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
- PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
-
- when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
- when(list.getAvailable()).thenReturn(0); // no pages exist
-
- task.importData(ImportStrategy.MERGE);
-
- verify(dataStorage).find(query("user", "foo"));
- verify(list).getAvailable();
- verify(list, never()).getAll();
-
- for (Page page : importing.getPages())
- {
- verify(dataStorage).save(page);
- }
- verify(dataStorage, times(3)).save();
-
- verifyNoMoreInteractions(dataStorage, list);
-
- Assert.assertNotNull(task.getRollbackDeletes());
- Assert.assertEquals(importing, task.getRollbackDeletes());
- Assert.assertNull(task.getRollbackSaves());
- }
-
- public void testMerge_SamePages() throws Exception
- {
- Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
- Page.PageSet existing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
- PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
-
- when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
- when(list.getAvailable()).thenReturn(3);
- when(list.getAll()).thenReturn(existing.getPages());
-
- task.importData(ImportStrategy.MERGE);
-
- verify(dataStorage).find(query("user", "foo"));
- verify(list).getAvailable();
- verify(list).getAll();
-
- for (Page page : importing.getPages())
- {
- verify(dataStorage).save(page);
- }
- verify(dataStorage, times(3)).save();
-
- verifyNoMoreInteractions(dataStorage, list);
-
- assertNullOrEmpty(task.getRollbackDeletes());
- Assert.assertNotNull(task.getRollbackSaves());
- Assert.assertEquals(3, task.getRollbackSaves().getPages().size());
- Assert.assertEquals(existing.getPages(), task.getRollbackSaves().getPages());
- }
-
- public void testMerge_NewPages() throws Exception
- {
- Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
- Page.PageSet existing = new Builder().addPage("foo").addPage("bar").addPage("baz").build();
- PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
-
- when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
- when(list.getAvailable()).thenReturn(3);
- when(list.getAll()).thenReturn(existing.getPages());
-
- task.importData(ImportStrategy.MERGE);
-
- verify(dataStorage).find(query("user", "foo"));
- verify(list).getAvailable();
- verify(list).getAll();
-
- for (Page page : importing.getPages())
- {
- verify(dataStorage).save(page);
- }
- verify(dataStorage, times(3)).save();
-
- verifyNoMoreInteractions(dataStorage, list);
-
- Assert.assertNotNull(task.getRollbackDeletes());
- Assert.assertEquals(importing.getPages(), task.getRollbackDeletes().getPages());
- assertNullOrEmpty(task.getRollbackSaves());
- }
-
- public void testMerge_NewAndSamePages() throws Exception
- {
- Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").addPage("page4").build();
- Page.PageSet existing = new Builder().addPage("page2").addPage("bar").addPage("page3").build();
- PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
-
- when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
- when(list.getAvailable()).thenReturn(3);
- when(list.getAll()).thenReturn(existing.getPages());
-
- task.importData(ImportStrategy.MERGE);
-
- verify(dataStorage).find(query("user", "foo"));
- verify(list).getAvailable();
- verify(list).getAll();
-
- for (Page page : importing.getPages())
- {
- verify(dataStorage).save(page);
- }
- verify(dataStorage, times(4)).save();
-
- verifyNoMoreInteractions(dataStorage, list);
-
- Assert.assertNotNull(task.getRollbackDeletes());
- Assert.assertEquals(2, task.getRollbackDeletes().getPages().size());
- Assert.assertEquals(importing.getPages().get(0), task.getRollbackDeletes().getPages().get(0));
- Assert.assertEquals(importing.getPages().get(3), task.getRollbackDeletes().getPages().get(1));
-
- Assert.assertNotNull(task.getRollbackSaves());
- Assert.assertEquals(2, task.getRollbackSaves().getPages().size());
- Assert.assertEquals(existing.getPages().get(0), task.getRollbackSaves().getPages().get(0));
- Assert.assertEquals(existing.getPages().get(2), task.getRollbackSaves().getPages().get(1));
- }
-
- public void testOverwrite_NoPages() throws Exception
- {
- Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
- PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
-
- when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
- when(list.getAvailable()).thenReturn(0); // no pages exist
-
- task.importData(ImportStrategy.OVERWRITE);
-
- verify(dataStorage).find(query("user", "foo"));
- verify(list).getAvailable();
- verify(list, never()).getAll();
-
- for (Page page : importing.getPages())
- {
- verify(dataStorage).save(page);
- }
- verify(dataStorage, times(3)).save();
-
- verifyNoMoreInteractions(dataStorage, list);
-
- Assert.assertNotNull(task.getRollbackDeletes());
- Assert.assertEquals(importing, task.getRollbackDeletes());
- Assert.assertNull(task.getRollbackSaves());
- }
-
- public void testOverwrite_SamePages() throws Exception
- {
- Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
- Page.PageSet existing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
- PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
-
- when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
- when(list.getAvailable()).thenReturn(3);
- when(list.getAll()).thenReturn(existing.getPages());
-
- task.importData(ImportStrategy.OVERWRITE);
-
- verify(dataStorage).find(query("user", "foo"));
- verify(list).getAvailable();
- verify(list).getAll();
-
- int saveCount = importing.getPages().size() + existing.getPages().size();
- for (Page page : existing.getPages())
- {
- verify(dataStorage).remove(page);
- }
-
- for (Page page : importing.getPages())
- {
- verify(dataStorage).save(page);
- }
- verify(dataStorage, times(saveCount)).save();
-
- verifyNoMoreInteractions(dataStorage, list);
-
- assertNullOrEmpty(task.getRollbackDeletes());
- Assert.assertNotNull(task.getRollbackSaves());
- Assert.assertEquals(3, task.getRollbackSaves().getPages().size());
- Assert.assertEquals(existing.getPages(), task.getRollbackSaves().getPages());
- }
-
- public void testOverwrite_NewPages() throws Exception
- {
- Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
- Page.PageSet existing = new Builder().addPage("foo").addPage("bar").addPage("baz").build();
- PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
-
- when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
- when(list.getAvailable()).thenReturn(3);
- when(list.getAll()).thenReturn(existing.getPages());
-
- task.importData(ImportStrategy.OVERWRITE);
-
- verify(dataStorage).find(query("user", "foo"));
- verify(list).getAvailable();
- verify(list).getAll();
-
- int saveCount = importing.getPages().size() + existing.getPages().size();
- for (Page page : existing.getPages())
- {
- verify(dataStorage).remove(page);
- }
-
- for (Page page : importing.getPages())
- {
- verify(dataStorage).save(page);
- }
- verify(dataStorage, times(saveCount)).save();
-
- verifyNoMoreInteractions(dataStorage, list);
-
- Assert.assertNotNull(task.getRollbackDeletes());
- Assert.assertEquals(importing.getPages(), task.getRollbackDeletes().getPages());
-
- Assert.assertNotNull(task.getRollbackSaves());
- Assert.assertEquals(existing.getPages(), task.getRollbackSaves().getPages());
- }
-
- public void testOverwrite_NewAndSamePages() throws Exception
- {
- Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").addPage("page4").build();
- Page.PageSet existing = new Builder().addPage("page2").addPage("bar").addPage("page3").build();
- PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
-
- when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
- when(list.getAvailable()).thenReturn(3);
- when(list.getAll()).thenReturn(existing.getPages());
-
- task.importData(ImportStrategy.OVERWRITE);
-
- verify(dataStorage).find(query("user", "foo"));
- verify(list).getAvailable();
- verify(list).getAll();
-
- int saveCount = importing.getPages().size() + existing.getPages().size();
- for (Page page : existing.getPages())
- {
- verify(dataStorage).remove(page);
- }
-
- for (Page page : importing.getPages())
- {
- verify(dataStorage).save(page);
- }
- verify(dataStorage, times(saveCount)).save();
-
- verifyNoMoreInteractions(dataStorage, list);
-
- Assert.assertNotNull(task.getRollbackDeletes());
- Assert.assertEquals(2, task.getRollbackDeletes().getPages().size());
- Assert.assertEquals(importing.getPages().get(0), task.getRollbackDeletes().getPages().get(0));
- Assert.assertEquals(importing.getPages().get(3), task.getRollbackDeletes().getPages().get(1));
-
- Assert.assertNotNull(task.getRollbackSaves());
- Assert.assertEquals(existing.getPages(), task.getRollbackSaves().getPages());
- }
-
- private void assertNullOrEmpty(Page.PageSet pages)
- {
- if (pages != null)
- {
- Assert.assertTrue(pages.getPages().isEmpty());
- }
- }
-
- private Query<Page> query(String ownerType, String ownerId)
- {
- return argThat(new QueryMatcher(new Query<Page>(ownerType, ownerId, Page.class)));
- }
-
- private class QueryMatcher extends ArgumentMatcher<Query<Page>>
- {
- private Query<Page> query;
-
- public QueryMatcher(Query<Page> query)
- {
- this.query = query;
- }
-
- @Override
- public boolean matches(Object o)
- {
- if (query == o) return true;
- if (!(o instanceof Query)) return false;
-
- Query that = (Query) o;
-
- if (!query.getClassType().equals(that.getClassType())) return false;
- if (!query.getOwnerType().equals(that.getOwnerType())) return false;
- if (!query.getOwnerId().equals(that.getOwnerId())) return false;
-
- if (query.getName() != null ? !query.getName().equals(that.getName()) : that.getName() != null) return false;
- if (query.getTitle() != null ? !query.getTitle().equals(that.getTitle()) : that.getTitle() != null) return false;
-
- return true;
- }
- }
-
- private static class Builder
- {
- private Page.PageSet pages;
- public Builder()
- {
- pages = new Page.PageSet();
- pages.setPages(new ArrayList<Page>());
- }
-
- public Builder addPage(String name)
- {
- PageData page= new PageData(null, "", name, null, null, null, null, null, null, null, Collections.<String>emptyList(), Collections.<ComponentData>emptyList(), "", "", null, false);
- pages.getPages().add(new Page(page));
-
- return this;
- }
-
- public Page.PageSet build()
- {
- return pages;
- }
- }
-}
Copied: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/exportimport/PageImportTaskTest.java (from rev 6958, portal/branches/gatein-management/component/portal/src/test/java/org/exoplatform/portal/mop/management/exportimport/PageImportTaskTest.java)
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/exportimport/PageImportTaskTest.java (rev 0)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/management/exportimport/PageImportTaskTest.java 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,492 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.mop.management.exportimport;
+
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.Query;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.pom.data.ComponentData;
+import org.exoplatform.portal.pom.data.PageData;
+import org.mockito.ArgumentMatcher;
+import org.mockito.Matchers;
+
+import java.util.ArrayList;
+import java.util.Collections;
+
+import static org.mockito.Mockito.*;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class PageImportTaskTest extends TestCase
+{
+ private DataStorage dataStorage;
+ private LazyPageList<Page> list;
+ private SiteKey siteKey = new SiteKey("user", "foo");
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void setUp() throws Exception
+ {
+ dataStorage = mock(DataStorage.class);
+ list = mock(LazyPageList.class);
+ }
+
+ public void testConserve_NoPages() throws Exception
+ {
+ Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
+ PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
+
+ when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
+ when(list.getAvailable()).thenReturn(0); // no pages exist
+
+ task.importData(ImportStrategy.CONSERVE);
+
+ verify(dataStorage).find(query("user", "foo"));
+ verify(list).getAvailable();
+ verify(list, never()).getAll();
+
+ for (Page page : importing.getPages())
+ {
+ verify(dataStorage).save(page);
+ }
+ verify(dataStorage, times(3)).save();
+
+ verifyNoMoreInteractions(dataStorage, list);
+
+ Assert.assertNotNull(task.getRollbackDeletes());
+ Assert.assertEquals(importing, task.getRollbackDeletes());
+ Assert.assertNull(task.getRollbackSaves());
+ }
+
+ public void testConserve_SamePages() throws Exception
+ {
+ Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
+ Page.PageSet existing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
+ PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
+
+ when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
+ when(list.getAvailable()).thenReturn(3);
+ when(list.getAll()).thenReturn(existing.getPages());
+
+ task.importData(ImportStrategy.CONSERVE);
+
+ verify(dataStorage).find(query("user", "foo"));
+ verify(list).getAvailable();
+ verify(list).getAll();
+
+ verifyNoMoreInteractions(dataStorage, list);
+
+ assertNullOrEmpty(task.getRollbackDeletes());
+ assertNullOrEmpty(task.getRollbackSaves());
+ }
+
+ public void testConserve_NewPages() throws Exception
+ {
+ Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
+ Page.PageSet existing = new Builder().addPage("foo").addPage("bar").addPage("baz").build();
+ PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
+
+ when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
+ when(list.getAvailable()).thenReturn(3);
+ when(list.getAll()).thenReturn(existing.getPages());
+
+ task.importData(ImportStrategy.CONSERVE);
+
+ verify(dataStorage).find(query("user", "foo"));
+ verify(list).getAvailable();
+ verify(list).getAll();
+
+ for (Page page : importing.getPages())
+ {
+ verify(dataStorage).save(page);
+ }
+ verify(dataStorage, times(3)).save();
+
+ verifyNoMoreInteractions(dataStorage, list);
+
+ Assert.assertNotNull(task.getRollbackDeletes());
+ Assert.assertEquals(importing.getPages(), task.getRollbackDeletes().getPages());
+ Assert.assertNull(task.getRollbackSaves());
+ }
+
+ public void testConserve_NewAndSamePages() throws Exception
+ {
+ Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").addPage("page4").build();
+ Page.PageSet existing = new Builder().addPage("page2").addPage("bar").addPage("page3").build();
+ PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
+
+ when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
+ when(list.getAvailable()).thenReturn(3);
+ when(list.getAll()).thenReturn(existing.getPages());
+
+ task.importData(ImportStrategy.CONSERVE);
+
+ verify(dataStorage).find(query("user", "foo"));
+ verify(list).getAvailable();
+ verify(list).getAll();
+
+ verify(dataStorage).save(importing.getPages().get(0));
+ verify(dataStorage).save(importing.getPages().get(3));
+
+ verify(dataStorage, times(2)).save();
+
+ verifyNoMoreInteractions(dataStorage, list);
+
+ Assert.assertNotNull(task.getRollbackDeletes());
+ Assert.assertEquals(2, task.getRollbackDeletes().getPages().size());
+ Assert.assertEquals(importing.getPages().get(0), task.getRollbackDeletes().getPages().get(0));
+ Assert.assertEquals(importing.getPages().get(3), task.getRollbackDeletes().getPages().get(1));
+ Assert.assertNull(task.getRollbackSaves());
+ }
+
+ public void testMerge_NoPages() throws Exception
+ {
+ Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
+ PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
+
+ when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
+ when(list.getAvailable()).thenReturn(0); // no pages exist
+
+ task.importData(ImportStrategy.MERGE);
+
+ verify(dataStorage).find(query("user", "foo"));
+ verify(list).getAvailable();
+ verify(list, never()).getAll();
+
+ for (Page page : importing.getPages())
+ {
+ verify(dataStorage).save(page);
+ }
+ verify(dataStorage, times(3)).save();
+
+ verifyNoMoreInteractions(dataStorage, list);
+
+ Assert.assertNotNull(task.getRollbackDeletes());
+ Assert.assertEquals(importing, task.getRollbackDeletes());
+ Assert.assertNull(task.getRollbackSaves());
+ }
+
+ public void testMerge_SamePages() throws Exception
+ {
+ Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
+ Page.PageSet existing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
+ PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
+
+ when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
+ when(list.getAvailable()).thenReturn(3);
+ when(list.getAll()).thenReturn(existing.getPages());
+
+ task.importData(ImportStrategy.MERGE);
+
+ verify(dataStorage).find(query("user", "foo"));
+ verify(list).getAvailable();
+ verify(list).getAll();
+
+ for (Page page : importing.getPages())
+ {
+ verify(dataStorage).save(page);
+ }
+ verify(dataStorage, times(3)).save();
+
+ verifyNoMoreInteractions(dataStorage, list);
+
+ assertNullOrEmpty(task.getRollbackDeletes());
+ Assert.assertNotNull(task.getRollbackSaves());
+ Assert.assertEquals(3, task.getRollbackSaves().getPages().size());
+ Assert.assertEquals(existing.getPages(), task.getRollbackSaves().getPages());
+ }
+
+ public void testMerge_NewPages() throws Exception
+ {
+ Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
+ Page.PageSet existing = new Builder().addPage("foo").addPage("bar").addPage("baz").build();
+ PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
+
+ when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
+ when(list.getAvailable()).thenReturn(3);
+ when(list.getAll()).thenReturn(existing.getPages());
+
+ task.importData(ImportStrategy.MERGE);
+
+ verify(dataStorage).find(query("user", "foo"));
+ verify(list).getAvailable();
+ verify(list).getAll();
+
+ for (Page page : importing.getPages())
+ {
+ verify(dataStorage).save(page);
+ }
+ verify(dataStorage, times(3)).save();
+
+ verifyNoMoreInteractions(dataStorage, list);
+
+ Assert.assertNotNull(task.getRollbackDeletes());
+ Assert.assertEquals(importing.getPages(), task.getRollbackDeletes().getPages());
+ assertNullOrEmpty(task.getRollbackSaves());
+ }
+
+ public void testMerge_NewAndSamePages() throws Exception
+ {
+ Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").addPage("page4").build();
+ Page.PageSet existing = new Builder().addPage("page2").addPage("bar").addPage("page3").build();
+ PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
+
+ when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
+ when(list.getAvailable()).thenReturn(3);
+ when(list.getAll()).thenReturn(existing.getPages());
+
+ task.importData(ImportStrategy.MERGE);
+
+ verify(dataStorage).find(query("user", "foo"));
+ verify(list).getAvailable();
+ verify(list).getAll();
+
+ for (Page page : importing.getPages())
+ {
+ verify(dataStorage).save(page);
+ }
+ verify(dataStorage, times(4)).save();
+
+ verifyNoMoreInteractions(dataStorage, list);
+
+ Assert.assertNotNull(task.getRollbackDeletes());
+ Assert.assertEquals(2, task.getRollbackDeletes().getPages().size());
+ Assert.assertEquals(importing.getPages().get(0), task.getRollbackDeletes().getPages().get(0));
+ Assert.assertEquals(importing.getPages().get(3), task.getRollbackDeletes().getPages().get(1));
+
+ Assert.assertNotNull(task.getRollbackSaves());
+ Assert.assertEquals(2, task.getRollbackSaves().getPages().size());
+ Assert.assertEquals(existing.getPages().get(0), task.getRollbackSaves().getPages().get(0));
+ Assert.assertEquals(existing.getPages().get(2), task.getRollbackSaves().getPages().get(1));
+ }
+
+ public void testOverwrite_NoPages() throws Exception
+ {
+ Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
+ PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
+
+ when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
+ when(list.getAvailable()).thenReturn(0); // no pages exist
+
+ task.importData(ImportStrategy.OVERWRITE);
+
+ verify(dataStorage).find(query("user", "foo"));
+ verify(list).getAvailable();
+ verify(list, never()).getAll();
+
+ for (Page page : importing.getPages())
+ {
+ verify(dataStorage).save(page);
+ }
+ verify(dataStorage, times(3)).save();
+
+ verifyNoMoreInteractions(dataStorage, list);
+
+ Assert.assertNotNull(task.getRollbackDeletes());
+ Assert.assertEquals(importing, task.getRollbackDeletes());
+ Assert.assertNull(task.getRollbackSaves());
+ }
+
+ public void testOverwrite_SamePages() throws Exception
+ {
+ Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
+ Page.PageSet existing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
+ PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
+
+ when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
+ when(list.getAvailable()).thenReturn(3);
+ when(list.getAll()).thenReturn(existing.getPages());
+
+ task.importData(ImportStrategy.OVERWRITE);
+
+ verify(dataStorage).find(query("user", "foo"));
+ verify(list).getAvailable();
+ verify(list).getAll();
+
+ int saveCount = importing.getPages().size() + existing.getPages().size();
+ for (Page page : existing.getPages())
+ {
+ verify(dataStorage).remove(page);
+ }
+
+ for (Page page : importing.getPages())
+ {
+ verify(dataStorage).save(page);
+ }
+ verify(dataStorage, times(saveCount)).save();
+
+ verifyNoMoreInteractions(dataStorage, list);
+
+ assertNullOrEmpty(task.getRollbackDeletes());
+ Assert.assertNotNull(task.getRollbackSaves());
+ Assert.assertEquals(3, task.getRollbackSaves().getPages().size());
+ Assert.assertEquals(existing.getPages(), task.getRollbackSaves().getPages());
+ }
+
+ public void testOverwrite_NewPages() throws Exception
+ {
+ Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").build();
+ Page.PageSet existing = new Builder().addPage("foo").addPage("bar").addPage("baz").build();
+ PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
+
+ when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
+ when(list.getAvailable()).thenReturn(3);
+ when(list.getAll()).thenReturn(existing.getPages());
+
+ task.importData(ImportStrategy.OVERWRITE);
+
+ verify(dataStorage).find(query("user", "foo"));
+ verify(list).getAvailable();
+ verify(list).getAll();
+
+ int saveCount = importing.getPages().size() + existing.getPages().size();
+ for (Page page : existing.getPages())
+ {
+ verify(dataStorage).remove(page);
+ }
+
+ for (Page page : importing.getPages())
+ {
+ verify(dataStorage).save(page);
+ }
+ verify(dataStorage, times(saveCount)).save();
+
+ verifyNoMoreInteractions(dataStorage, list);
+
+ Assert.assertNotNull(task.getRollbackDeletes());
+ Assert.assertEquals(importing.getPages(), task.getRollbackDeletes().getPages());
+
+ Assert.assertNotNull(task.getRollbackSaves());
+ Assert.assertEquals(existing.getPages(), task.getRollbackSaves().getPages());
+ }
+
+ public void testOverwrite_NewAndSamePages() throws Exception
+ {
+ Page.PageSet importing = new Builder().addPage("page1").addPage("page2").addPage("page3").addPage("page4").build();
+ Page.PageSet existing = new Builder().addPage("page2").addPage("bar").addPage("page3").build();
+ PageImportTask task = new PageImportTask(importing, siteKey, dataStorage);
+
+ when(dataStorage.find(Matchers.<Query<Page>>any())).thenReturn(list);
+ when(list.getAvailable()).thenReturn(3);
+ when(list.getAll()).thenReturn(existing.getPages());
+
+ task.importData(ImportStrategy.OVERWRITE);
+
+ verify(dataStorage).find(query("user", "foo"));
+ verify(list).getAvailable();
+ verify(list).getAll();
+
+ int saveCount = importing.getPages().size() + existing.getPages().size();
+ for (Page page : existing.getPages())
+ {
+ verify(dataStorage).remove(page);
+ }
+
+ for (Page page : importing.getPages())
+ {
+ verify(dataStorage).save(page);
+ }
+ verify(dataStorage, times(saveCount)).save();
+
+ verifyNoMoreInteractions(dataStorage, list);
+
+ Assert.assertNotNull(task.getRollbackDeletes());
+ Assert.assertEquals(2, task.getRollbackDeletes().getPages().size());
+ Assert.assertEquals(importing.getPages().get(0), task.getRollbackDeletes().getPages().get(0));
+ Assert.assertEquals(importing.getPages().get(3), task.getRollbackDeletes().getPages().get(1));
+
+ Assert.assertNotNull(task.getRollbackSaves());
+ Assert.assertEquals(existing.getPages(), task.getRollbackSaves().getPages());
+ }
+
+ private void assertNullOrEmpty(Page.PageSet pages)
+ {
+ if (pages != null)
+ {
+ Assert.assertTrue(pages.getPages().isEmpty());
+ }
+ }
+
+ private Query<Page> query(String ownerType, String ownerId)
+ {
+ return argThat(new QueryMatcher(new Query<Page>(ownerType, ownerId, Page.class)));
+ }
+
+ private class QueryMatcher extends ArgumentMatcher<Query<Page>>
+ {
+ private Query<Page> query;
+
+ public QueryMatcher(Query<Page> query)
+ {
+ this.query = query;
+ }
+
+ @Override
+ public boolean matches(Object o)
+ {
+ if (query == o) return true;
+ if (!(o instanceof Query)) return false;
+
+ Query that = (Query) o;
+
+ if (!query.getClassType().equals(that.getClassType())) return false;
+ if (!query.getOwnerType().equals(that.getOwnerType())) return false;
+ if (!query.getOwnerId().equals(that.getOwnerId())) return false;
+
+ if (query.getName() != null ? !query.getName().equals(that.getName()) : that.getName() != null) return false;
+ if (query.getTitle() != null ? !query.getTitle().equals(that.getTitle()) : that.getTitle() != null) return false;
+
+ return true;
+ }
+ }
+
+ private static class Builder
+ {
+ private Page.PageSet pages;
+ public Builder()
+ {
+ pages = new Page.PageSet();
+ pages.setPages(new ArrayList<Page>());
+ }
+
+ public Builder addPage(String name)
+ {
+ PageData page= new PageData(null, "", name, null, null, null, null, null, null, null, Collections.<String>emptyList(), Collections.<ComponentData>emptyList(), "", "", null, false);
+ pages.getPages().add(new Page(page));
+
+ return this;
+ }
+
+ public Page.PageSet build()
+ {
+ return pages;
+ }
+ }
+}
Deleted: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-empty.xml
===================================================================
--- portal/branches/gatein-management/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-empty.xml 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-empty.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2011, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file 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.
- -->
-
-<node-navigation xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2">
- <priority>3</priority>
- <page-nodes/>
-</node-navigation>
Copied: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-empty.xml (from rev 6958, portal/branches/gatein-management/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-empty.xml)
===================================================================
--- portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-empty.xml (rev 0)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-empty.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file 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.
+ -->
+
+<node-navigation xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2">
+ <priority>3</priority>
+ <page-nodes/>
+</node-navigation>
Deleted: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-extended.xml
===================================================================
--- portal/branches/gatein-management/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-extended.xml 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-extended.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,53 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2011, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file 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.
- -->
-
-<node-navigation xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2">
- <priority>1</priority>
- <page-nodes>
- <node>
- <name>hello-node</name>
- <label lang="cn">Dobrý den</label>
- <label lang="fr">Bonjour</label>
- <label lang="en">Hello</label>
- <label lang="es">Hola</label>
- <label lang="ja">こんにちは</label>
- <label lang="it">Ciào</label>
- <label lang="zh">你好</label>
- <label lang="zh-TW">Li-ho</label>
- </node>
- <node>
- <name>hello-node2</name>
- <label xml:lang="cn">Dobrý den</label>
- <label xml:lang="fr">Bonjour</label>
- <label xml:lang="en">Hello</label>
- <label xml:lang="es">Hola</label>
- <label xml:lang="ja">こんにちは</label>
- <label xml:lang="it">Ciào</label>
- <label xml:lang="zh">你好</label>
- <label lang="zh-tw">Li-ho</label>
- </node>
- </page-nodes>
-</node-navigation>
Copied: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-extended.xml (from rev 6958, portal/branches/gatein-management/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-extended.xml)
===================================================================
--- portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-extended.xml (rev 0)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-extended.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,53 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file 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.
+ -->
+
+<node-navigation xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2">
+ <priority>1</priority>
+ <page-nodes>
+ <node>
+ <name>hello-node</name>
+ <label lang="cn">Dobrý den</label>
+ <label lang="fr">Bonjour</label>
+ <label lang="en">Hello</label>
+ <label lang="es">Hola</label>
+ <label lang="ja">こんにちは</label>
+ <label lang="it">Ciào</label>
+ <label lang="zh">你好</label>
+ <label lang="zh-TW">Li-ho</label>
+ </node>
+ <node>
+ <name>hello-node2</name>
+ <label xml:lang="cn">Dobrý den</label>
+ <label xml:lang="fr">Bonjour</label>
+ <label xml:lang="en">Hello</label>
+ <label xml:lang="es">Hola</label>
+ <label xml:lang="ja">こんにちは</label>
+ <label xml:lang="it">Ciào</label>
+ <label xml:lang="zh">你好</label>
+ <label lang="zh-tw">Li-ho</label>
+ </node>
+ </page-nodes>
+</node-navigation>
Deleted: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-fragment.xml
===================================================================
--- portal/branches/gatein-management/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-fragment.xml 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-fragment.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,53 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2011, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file 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.
- -->
-<node-navigation xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2">
- <priority>1</priority>
- <page-nodes>
- <parent-uri>home</parent-uri>
- <node>
- <name>home-1</name>
- <label>Home 1</label>
- <node>
- <name>home-1-1</name>
- <label>Home 1-1</label>
- </node>
- <node>
- <name>home-1-2</name>
- <label>Home 1-1</label>
- </node>
- </node>
- </page-nodes>
- <page-nodes>
- <parent-uri>foo-bar</parent-uri>
- <node>
- <name>foo</name>
- <label>Foo</label>
- </node>
- <node>
- <name>bar</name>
- <label>Bar</label>
- </node>
- </page-nodes>
-</node-navigation>
Copied: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-fragment.xml (from rev 6958, portal/branches/gatein-management/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-fragment.xml)
===================================================================
--- portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-fragment.xml (rev 0)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation-fragment.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,53 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file 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.
+ -->
+<node-navigation xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2">
+ <priority>1</priority>
+ <page-nodes>
+ <parent-uri>home</parent-uri>
+ <node>
+ <name>home-1</name>
+ <label>Home 1</label>
+ <node>
+ <name>home-1-1</name>
+ <label>Home 1-1</label>
+ </node>
+ <node>
+ <name>home-1-2</name>
+ <label>Home 1-1</label>
+ </node>
+ </node>
+ </page-nodes>
+ <page-nodes>
+ <parent-uri>foo-bar</parent-uri>
+ <node>
+ <name>foo</name>
+ <label>Foo</label>
+ </node>
+ <node>
+ <name>bar</name>
+ <label>Bar</label>
+ </node>
+ </page-nodes>
+</node-navigation>
Deleted: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation.xml
===================================================================
--- portal/branches/gatein-management/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation.xml 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,172 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2011, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file 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.
- -->
-
-<node-navigation xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2">
- <priority>111</priority>
- <page-nodes>
- <node>
- <uri>home</uri>
- <name>home</name>
- <label>#{portal.classic.home}</label>
- <visibility>DISPLAYED</visibility>
- <page-reference>portal::classic::homepage</page-reference>
- <node>
- <uri>home/home-1</uri>
- <name>home-1</name>
- <label>Home 1</label>
- <icon>StarAward</icon>
- <start-publication-date>2011-01-10T12:13:55-05:00</start-publication-date>
- <end-publication-date>2011-01-17T17:14:00-05:00</end-publication-date>
- <visibility>TEMPORAL</visibility>
- <node>
- <uri>home/home-1/empty</uri>
- <name>empty</name>
- <label>Empty</label>
- <visibility>HIDDEN</visibility>
- <page-reference>portal::classic::empty-page</page-reference>
- </node>
- </node>
- </node>
- <node>
- <uri>sitemap</uri>
- <name>sitemap</name>
- <label>#{portal.classic.sitemap}</label>
- <visibility>DISPLAYED</visibility>
- <page-reference>portal::classic::sitemap</page-reference>
- </node>
- <node>
- <uri>groupnavigation</uri>
- <name>groupnavigation</name>
- <label>#{portal.classic.groupnavigation}</label>
- <visibility>DISPLAYED</visibility>
- <page-reference>portal::classic::groupnavigation</page-reference>
- </node>
- <node>
- <uri>portalnavigation</uri>
- <name>portalnavigation</name>
- <label>#{portal.classic.portalnavigation}</label>
- <visibility>SYSTEM</visibility>
- <page-reference>portal::classic::portalnavigation</page-reference>
- </node>
- <node>
- <uri>register</uri>
- <name>register</name>
- <label>#{portal.classic.register}</label>
- <visibility>SYSTEM</visibility>
- <page-reference>portal::classic::register</page-reference>
- </node>
- <node>
- <uri>notfound</uri>
- <name>notfound</name>
- <label>NotFound</label>
- <visibility>SYSTEM</visibility>
- </node>
- <node>
- <uri>n0</uri>
- <name>n0</name>
- <label>n0</label>
- <visibility>DISPLAYED</visibility>
- <page-reference>portal::classic::n0</page-reference>
- <node>
- <uri>n0/n0</uri>
- <name>n0</name>
- <label>n0</label>
- <visibility>DISPLAYED</visibility>
- <page-reference>portal::classic::n0_n0</page-reference>
- <node>
- <uri>n0/n0/n0</uri>
- <name>n0</name>
- <label>n0</label>
- <visibility>DISPLAYED</visibility>
- <page-reference>portal::classic::n0_n0_n0</page-reference>
- </node>
- <node>
- <uri>n0/n0/n1</uri>
- <name>n1</name>
- <label>n1</label>
- <visibility>DISPLAYED</visibility>
- <page-reference>portal::classic::n0_n0_n1</page-reference>
- </node>
- <node>
- <uri>n0/n0/n2</uri>
- <name>n2</name>
- <label>n2</label>
- <visibility>DISPLAYED</visibility>
- <page-reference>portal::classic::n0_n0_n2</page-reference>
- </node>
- <node>
- <uri>n0/n0/n3</uri>
- <name>n3</name>
- <label>n3</label>
- <visibility>DISPLAYED</visibility>
- <page-reference>portal::classic::n0_n0_n3</page-reference>
- </node>
- <node>
- <uri>n0/n0/n4</uri>
- <name>n4</name>
- <label>n4</label>
- <visibility>DISPLAYED</visibility>
- <page-reference>portal::classic::n0_n0_n4</page-reference>
- </node>
- <node>
- <uri>n0/n0/n5</uri>
- <name>n5</name>
- <label>n5</label>
- <visibility>DISPLAYED</visibility>
- <page-reference>portal::classic::n0_n0_n5</page-reference>
- </node>
- <node>
- <uri>n0/n0/n6</uri>
- <name>n6</name>
- <label>n6</label>
- <visibility>DISPLAYED</visibility>
- <page-reference>portal::classic::n0_n0_n6</page-reference>
- </node>
- <node>
- <uri>n0/n0/n7</uri>
- <name>n7</name>
- <label>n7</label>
- <visibility>DISPLAYED</visibility>
- <page-reference>portal::classic::n0_n0_n7</page-reference>
- </node>
- <node>
- <uri>n0/n0/n8</uri>
- <name>n8</name>
- <label>n8</label>
- <visibility>DISPLAYED</visibility>
- <page-reference>portal::classic::n0_n0_n8</page-reference>
- </node>
- <node>
- <uri>n0/n0/n9</uri>
- <name>n9</name>
- <label>n9</label>
- <visibility>DISPLAYED</visibility>
- <page-reference>portal::classic::n0_n0_n9</page-reference>
- </node>
- </node>
- </node>
- </page-nodes>
-</node-navigation>
Copied: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation.xml (from rev 6958, portal/branches/gatein-management/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation.xml)
===================================================================
--- portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation.xml (rev 0)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/navigation.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,172 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file 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.
+ -->
+
+<node-navigation xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2">
+ <priority>111</priority>
+ <page-nodes>
+ <node>
+ <uri>home</uri>
+ <name>home</name>
+ <label>#{portal.classic.home}</label>
+ <visibility>DISPLAYED</visibility>
+ <page-reference>portal::classic::homepage</page-reference>
+ <node>
+ <uri>home/home-1</uri>
+ <name>home-1</name>
+ <label>Home 1</label>
+ <icon>StarAward</icon>
+ <start-publication-date>2011-01-10T12:13:55-05:00</start-publication-date>
+ <end-publication-date>2011-01-17T17:14:00-05:00</end-publication-date>
+ <visibility>TEMPORAL</visibility>
+ <node>
+ <uri>home/home-1/empty</uri>
+ <name>empty</name>
+ <label>Empty</label>
+ <visibility>HIDDEN</visibility>
+ <page-reference>portal::classic::empty-page</page-reference>
+ </node>
+ </node>
+ </node>
+ <node>
+ <uri>sitemap</uri>
+ <name>sitemap</name>
+ <label>#{portal.classic.sitemap}</label>
+ <visibility>DISPLAYED</visibility>
+ <page-reference>portal::classic::sitemap</page-reference>
+ </node>
+ <node>
+ <uri>groupnavigation</uri>
+ <name>groupnavigation</name>
+ <label>#{portal.classic.groupnavigation}</label>
+ <visibility>DISPLAYED</visibility>
+ <page-reference>portal::classic::groupnavigation</page-reference>
+ </node>
+ <node>
+ <uri>portalnavigation</uri>
+ <name>portalnavigation</name>
+ <label>#{portal.classic.portalnavigation}</label>
+ <visibility>SYSTEM</visibility>
+ <page-reference>portal::classic::portalnavigation</page-reference>
+ </node>
+ <node>
+ <uri>register</uri>
+ <name>register</name>
+ <label>#{portal.classic.register}</label>
+ <visibility>SYSTEM</visibility>
+ <page-reference>portal::classic::register</page-reference>
+ </node>
+ <node>
+ <uri>notfound</uri>
+ <name>notfound</name>
+ <label>NotFound</label>
+ <visibility>SYSTEM</visibility>
+ </node>
+ <node>
+ <uri>n0</uri>
+ <name>n0</name>
+ <label>n0</label>
+ <visibility>DISPLAYED</visibility>
+ <page-reference>portal::classic::n0</page-reference>
+ <node>
+ <uri>n0/n0</uri>
+ <name>n0</name>
+ <label>n0</label>
+ <visibility>DISPLAYED</visibility>
+ <page-reference>portal::classic::n0_n0</page-reference>
+ <node>
+ <uri>n0/n0/n0</uri>
+ <name>n0</name>
+ <label>n0</label>
+ <visibility>DISPLAYED</visibility>
+ <page-reference>portal::classic::n0_n0_n0</page-reference>
+ </node>
+ <node>
+ <uri>n0/n0/n1</uri>
+ <name>n1</name>
+ <label>n1</label>
+ <visibility>DISPLAYED</visibility>
+ <page-reference>portal::classic::n0_n0_n1</page-reference>
+ </node>
+ <node>
+ <uri>n0/n0/n2</uri>
+ <name>n2</name>
+ <label>n2</label>
+ <visibility>DISPLAYED</visibility>
+ <page-reference>portal::classic::n0_n0_n2</page-reference>
+ </node>
+ <node>
+ <uri>n0/n0/n3</uri>
+ <name>n3</name>
+ <label>n3</label>
+ <visibility>DISPLAYED</visibility>
+ <page-reference>portal::classic::n0_n0_n3</page-reference>
+ </node>
+ <node>
+ <uri>n0/n0/n4</uri>
+ <name>n4</name>
+ <label>n4</label>
+ <visibility>DISPLAYED</visibility>
+ <page-reference>portal::classic::n0_n0_n4</page-reference>
+ </node>
+ <node>
+ <uri>n0/n0/n5</uri>
+ <name>n5</name>
+ <label>n5</label>
+ <visibility>DISPLAYED</visibility>
+ <page-reference>portal::classic::n0_n0_n5</page-reference>
+ </node>
+ <node>
+ <uri>n0/n0/n6</uri>
+ <name>n6</name>
+ <label>n6</label>
+ <visibility>DISPLAYED</visibility>
+ <page-reference>portal::classic::n0_n0_n6</page-reference>
+ </node>
+ <node>
+ <uri>n0/n0/n7</uri>
+ <name>n7</name>
+ <label>n7</label>
+ <visibility>DISPLAYED</visibility>
+ <page-reference>portal::classic::n0_n0_n7</page-reference>
+ </node>
+ <node>
+ <uri>n0/n0/n8</uri>
+ <name>n8</name>
+ <label>n8</label>
+ <visibility>DISPLAYED</visibility>
+ <page-reference>portal::classic::n0_n0_n8</page-reference>
+ </node>
+ <node>
+ <uri>n0/n0/n9</uri>
+ <name>n9</name>
+ <label>n9</label>
+ <visibility>DISPLAYED</visibility>
+ <page-reference>portal::classic::n0_n0_n9</page-reference>
+ </node>
+ </node>
+ </node>
+ </page-nodes>
+</node-navigation>
Deleted: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-empty.xml
===================================================================
--- portal/branches/gatein-management/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-empty.xml 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-empty.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,35 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2011, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file 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.
- -->
-
-<page-set xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2">
- <page>
- <name>empty-page</name>
- <title>Empty</title>
- <access-permissions>Everyone</access-permissions>
- <edit-permission>*:/platform/administrators</edit-permission>
- <show-max-window>false</show-max-window>
- </page>
-
-</page-set>
\ No newline at end of file
Copied: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-empty.xml (from rev 6958, portal/branches/gatein-management/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-empty.xml)
===================================================================
--- portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-empty.xml (rev 0)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-empty.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,35 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file 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.
+ -->
+
+<page-set xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2">
+ <page>
+ <name>empty-page</name>
+ <title>Empty</title>
+ <access-permissions>Everyone</access-permissions>
+ <edit-permission>*:/platform/administrators</edit-permission>
+ <show-max-window>false</show-max-window>
+ </page>
+
+</page-set>
\ No newline at end of file
Deleted: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-homepage.xml
===================================================================
--- portal/branches/gatein-management/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-homepage.xml 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-homepage.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2011, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file 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.
- -->
-
-<page-set xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2">
-
- <page>
- <name>homepage</name>
- <title>Home Page</title>
- <access-permissions>Everyone</access-permissions>
- <edit-permission>*:/platform/administrators</edit-permission>
- <portlet-application>
- <portlet>
- <application-ref>web</application-ref>
- <portlet-ref>HomePagePortlet</portlet-ref>
- <preferences>
- <preference>
- <name>template</name>
- <value>system:/templates/groovy/webui/component/UIHomePagePortlet.gtmpl</value>
- <read-only>false</read-only>
- </preference>
- </preferences>
- </portlet>
- <title>Home Page portlet</title>
- <access-permissions>Everyone</access-permissions>
- <show-info-bar>false</show-info-bar>
- <show-application-state>false</show-application-state>
- <show-application-mode>false</show-application-mode>
- </portlet-application>
- </page>
-
-</page-set>
Copied: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-homepage.xml (from rev 6958, portal/branches/gatein-management/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-homepage.xml)
===================================================================
--- portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-homepage.xml (rev 0)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-homepage.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file 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.
+ -->
+
+<page-set xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2">
+
+ <page>
+ <name>homepage</name>
+ <title>Home Page</title>
+ <access-permissions>Everyone</access-permissions>
+ <edit-permission>*:/platform/administrators</edit-permission>
+ <portlet-application>
+ <portlet>
+ <application-ref>web</application-ref>
+ <portlet-ref>HomePagePortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>template</name>
+ <value>system:/templates/groovy/webui/component/UIHomePagePortlet.gtmpl</value>
+ <read-only>false</read-only>
+ </preference>
+ </preferences>
+ </portlet>
+ <title>Home Page portlet</title>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>false</show-info-bar>
+ <show-application-state>false</show-application-state>
+ <show-application-mode>false</show-application-mode>
+ </portlet-application>
+ </page>
+
+</page-set>
Deleted: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-loaded.xml
===================================================================
--- portal/branches/gatein-management/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-loaded.xml 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-loaded.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,123 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2011, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file 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.
- -->
-
-<page-set xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2">
- <page>
- <name>loaded-page</name>
- <title>Loaded Page</title>
- <access-permissions>manager:/platform/administrators;manager:/platform/users</access-permissions>
- <edit-permission>*:/platform/administrators</edit-permission>
- <show-max-window>false</show-max-window>
- <container id="rootContainer" template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
- <access-permissions>Everyone</access-permissions>
- <container id="c1" template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
- <access-permissions>*:/platform/users</access-permissions>
- <portlet-application>
- <portlet>
- <application-ref>web</application-ref>
- <portlet-ref>HomePagePortlet</portlet-ref>
- <preferences>
- <preference>
- <name>template</name>
- <value>system:/templates/groovy/webui/component/UIHomePagePortlet.gtmpl</value>
- <read-only>true</read-only>
- </preference>
- <preference>
- <name>empty-preference-value</name>
- <value></value>
- </preference>
- <preference>
- <name>no-preference-value</name>
- </preference>
- </preferences>
- </portlet>
- <theme>Mac:MacTheme::Default:DefaultTheme::Vista:VistaTheme</theme>
- <title>Home Page portlet</title>
- <access-permissions>Everyone</access-permissions>
- <show-info-bar>true</show-info-bar>
- <show-application-state>true</show-application-state>
- <show-application-mode>true</show-application-mode>
- </portlet-application>
- </container>
- <container id="c2" template="system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl">
- <access-permissions>*:/platform/guests</access-permissions>
- <factory-id>TableColumnContainer</factory-id>
- <container id="c2-1" template="system:/groovy/portal/webui/container/UIContainer.gtmpl" width="300px" height="400px">
- <access-permissions>Everyone</access-permissions>
- <portlet-application>
- <portlet>
- <application-ref>exoadmin</application-ref>
- <portlet-ref>ApplicationRegistryPortlet</portlet-ref>
- </portlet>
- <theme>Default:DefaultTheme::Mac:MacTheme::Vista:VistaTheme</theme>
- <title>Application Registry</title>
- <access-permissions>*:/platform/administrators;*:/organization/management/executive-board</access-permissions>
- <show-info-bar>false</show-info-bar>
- <show-application-state>true</show-application-state>
- <show-application-mode>false</show-application-mode>
- <description>Application Registry</description>
- <icon>PortletIcon</icon>
- <width>250px</width>
- <height>350px</height>
- </portlet-application>
- </container>
- <container id="c2-2" template="system:/groovy/portal/webui/container/UIContainer.gtmpl" width="200px" height="300px">
- <access-permissions>/platform/users</access-permissions>
- <gadget-application>
- <gadget>
- <gadget-ref>Calendar</gadget-ref>
- </gadget>
- <theme>Vista:VistaTheme::Mac:MacTheme::Default:DefaultTheme</theme>
- <title>Calendar Title</title>
- <access-permissions>*:/platform/administrators;*:/organization/management/executive-board</access-permissions>
- <show-info-bar>true</show-info-bar>
- <show-application-state>false</show-application-state>
- <show-application-mode>false</show-application-mode>
- <description>Calendar Description</description>
- <icon>StarAwardIcon</icon>
- <width>100px</width>
- <height>200px</height>
- </gadget-application>
- </container>
- </container>
- <container id="c3" template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
- <access-permissions>Everyone</access-permissions>
- <portlet-application>
- <portlet>
- <application-ref>web</application-ref>
- <portlet-ref>SiteMapPortlet</portlet-ref>
- </portlet>
- <theme>Default:DefaultTheme::Vista:VistaTheme::Mac:MacTheme</theme>
- <title>SiteMap</title>
- <access-permissions>*:/platform/users</access-permissions>
- <show-info-bar>true</show-info-bar>
- <show-application-state>true</show-application-state>
- <show-application-mode>false</show-application-mode>
- <description>SiteMap</description>
- </portlet-application>
- </container>
- </container>
- </page>
-</page-set>
\ No newline at end of file
Copied: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-loaded.xml (from rev 6958, portal/branches/gatein-management/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-loaded.xml)
===================================================================
--- portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-loaded.xml (rev 0)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/pages-loaded.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,123 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file 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.
+ -->
+
+<page-set xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2">
+ <page>
+ <name>loaded-page</name>
+ <title>Loaded Page</title>
+ <access-permissions>manager:/platform/administrators;manager:/platform/users</access-permissions>
+ <edit-permission>*:/platform/administrators</edit-permission>
+ <show-max-window>false</show-max-window>
+ <container id="rootContainer" template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ <container id="c1" template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>*:/platform/users</access-permissions>
+ <portlet-application>
+ <portlet>
+ <application-ref>web</application-ref>
+ <portlet-ref>HomePagePortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>template</name>
+ <value>system:/templates/groovy/webui/component/UIHomePagePortlet.gtmpl</value>
+ <read-only>true</read-only>
+ </preference>
+ <preference>
+ <name>empty-preference-value</name>
+ <value></value>
+ </preference>
+ <preference>
+ <name>no-preference-value</name>
+ </preference>
+ </preferences>
+ </portlet>
+ <theme>Mac:MacTheme::Default:DefaultTheme::Vista:VistaTheme</theme>
+ <title>Home Page portlet</title>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ <show-application-state>true</show-application-state>
+ <show-application-mode>true</show-application-mode>
+ </portlet-application>
+ </container>
+ <container id="c2" template="system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl">
+ <access-permissions>*:/platform/guests</access-permissions>
+ <factory-id>TableColumnContainer</factory-id>
+ <container id="c2-1" template="system:/groovy/portal/webui/container/UIContainer.gtmpl" width="300px" height="400px">
+ <access-permissions>Everyone</access-permissions>
+ <portlet-application>
+ <portlet>
+ <application-ref>exoadmin</application-ref>
+ <portlet-ref>ApplicationRegistryPortlet</portlet-ref>
+ </portlet>
+ <theme>Default:DefaultTheme::Mac:MacTheme::Vista:VistaTheme</theme>
+ <title>Application Registry</title>
+ <access-permissions>*:/platform/administrators;*:/organization/management/executive-board</access-permissions>
+ <show-info-bar>false</show-info-bar>
+ <show-application-state>true</show-application-state>
+ <show-application-mode>false</show-application-mode>
+ <description>Application Registry</description>
+ <icon>PortletIcon</icon>
+ <width>250px</width>
+ <height>350px</height>
+ </portlet-application>
+ </container>
+ <container id="c2-2" template="system:/groovy/portal/webui/container/UIContainer.gtmpl" width="200px" height="300px">
+ <access-permissions>/platform/users</access-permissions>
+ <gadget-application>
+ <gadget>
+ <gadget-ref>Calendar</gadget-ref>
+ </gadget>
+ <theme>Vista:VistaTheme::Mac:MacTheme::Default:DefaultTheme</theme>
+ <title>Calendar Title</title>
+ <access-permissions>*:/platform/administrators;*:/organization/management/executive-board</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ <show-application-state>false</show-application-state>
+ <show-application-mode>false</show-application-mode>
+ <description>Calendar Description</description>
+ <icon>StarAwardIcon</icon>
+ <width>100px</width>
+ <height>200px</height>
+ </gadget-application>
+ </container>
+ </container>
+ <container id="c3" template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ <portlet-application>
+ <portlet>
+ <application-ref>web</application-ref>
+ <portlet-ref>SiteMapPortlet</portlet-ref>
+ </portlet>
+ <theme>Default:DefaultTheme::Vista:VistaTheme::Mac:MacTheme</theme>
+ <title>SiteMap</title>
+ <access-permissions>*:/platform/users</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ <show-application-state>true</show-application-state>
+ <show-application-mode>false</show-application-mode>
+ <description>SiteMap</description>
+ </portlet-application>
+ </container>
+ </container>
+ </page>
+</page-set>
\ No newline at end of file
Deleted: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/portal.xml
===================================================================
--- portal/branches/gatein-management/component/portal/src/test/resources/org/exoplatform/portal/mop/management/portal.xml 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/portal.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -1,100 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2011, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file 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.
- -->
-
-<portal-config xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2">
- <portal-name>classic</portal-name>
- <label>site-label</label>
- <description>site-description</description>
- <locale>en</locale>
- <access-permissions>Everyone</access-permissions>
- <edit-permission>*:/platform/administrators</edit-permission>
- <properties>
- <entry key="sessionAlive">onDemand</entry>
- </properties>
- <portal-layout>
- <portlet-application>
- <portlet>
- <application-ref>web</application-ref>
- <portlet-ref>BannerPortlet</portlet-ref>
- <preferences>
- <preference>
- <name>template</name>
- <value>par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl</value>
- <read-only>false</read-only>
- </preference>
- </preferences>
- </portlet>
- <theme>Default:DefaultTheme::Mac:MacTheme::Vista:VistaTheme</theme>
- <title>Banner</title>
- <access-permissions>*:/platform/administrators;*:/organization/management/executive-board</access-permissions>
- <show-info-bar>false</show-info-bar>
- <show-application-state>true</show-application-state>
- <show-application-mode>false</show-application-mode>
- <description>Banner Portlet</description>
- <icon>PortletIcon</icon>
- <width>250px</width>
- <height>350px</height>
- </portlet-application>
- <portlet-application>
- <portlet>
- <application-ref>web</application-ref>
- <portlet-ref>NavigationPortlet</portlet-ref>
- </portlet>
- <access-permissions>Everyone</access-permissions>
- <show-info-bar>false</show-info-bar>
- <show-application-state>true</show-application-state>
- <show-application-mode>true</show-application-mode>
- </portlet-application>
- <portlet-application>
- <portlet>
- <application-ref>web</application-ref>
- <portlet-ref>BreadcumbsPortlet</portlet-ref>
- </portlet>
- <access-permissions>Everyone</access-permissions>
- <show-info-bar>false</show-info-bar>
- <show-application-state>true</show-application-state>
- <show-application-mode>true</show-application-mode>
- </portlet-application>
- <page-body/>
- <portlet-application>
- <portlet>
- <application-ref>web</application-ref>
- <portlet-ref>FooterPortlet</portlet-ref>
- <preferences>
- <preference>
- <name>template</name>
- <value>par:/groovy/groovy/webui/component/UIFooterPortlet.gtmpl</value>
- <read-only>false</read-only>
- </preference>
- </preferences>
- </portlet>
- <access-permissions>Everyone</access-permissions>
- <show-info-bar>false</show-info-bar>
- <show-application-state>true</show-application-state>
- <show-application-mode>true</show-application-mode>
- </portlet-application>
- </portal-layout>
-</portal-config>
\ No newline at end of file
Copied: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/portal.xml (from rev 6958, portal/branches/gatein-management/component/portal/src/test/resources/org/exoplatform/portal/mop/management/portal.xml)
===================================================================
--- portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/portal.xml (rev 0)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/mop/management/portal.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -0,0 +1,100 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file 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.
+ -->
+
+<portal-config xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2">
+ <portal-name>classic</portal-name>
+ <label>site-label</label>
+ <description>site-description</description>
+ <locale>en</locale>
+ <access-permissions>Everyone</access-permissions>
+ <edit-permission>*:/platform/administrators</edit-permission>
+ <properties>
+ <entry key="sessionAlive">onDemand</entry>
+ </properties>
+ <portal-layout>
+ <portlet-application>
+ <portlet>
+ <application-ref>web</application-ref>
+ <portlet-ref>BannerPortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>template</name>
+ <value>par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl</value>
+ <read-only>false</read-only>
+ </preference>
+ </preferences>
+ </portlet>
+ <theme>Default:DefaultTheme::Mac:MacTheme::Vista:VistaTheme</theme>
+ <title>Banner</title>
+ <access-permissions>*:/platform/administrators;*:/organization/management/executive-board</access-permissions>
+ <show-info-bar>false</show-info-bar>
+ <show-application-state>true</show-application-state>
+ <show-application-mode>false</show-application-mode>
+ <description>Banner Portlet</description>
+ <icon>PortletIcon</icon>
+ <width>250px</width>
+ <height>350px</height>
+ </portlet-application>
+ <portlet-application>
+ <portlet>
+ <application-ref>web</application-ref>
+ <portlet-ref>NavigationPortlet</portlet-ref>
+ </portlet>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>false</show-info-bar>
+ <show-application-state>true</show-application-state>
+ <show-application-mode>true</show-application-mode>
+ </portlet-application>
+ <portlet-application>
+ <portlet>
+ <application-ref>web</application-ref>
+ <portlet-ref>BreadcumbsPortlet</portlet-ref>
+ </portlet>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>false</show-info-bar>
+ <show-application-state>true</show-application-state>
+ <show-application-mode>true</show-application-mode>
+ </portlet-application>
+ <page-body/>
+ <portlet-application>
+ <portlet>
+ <application-ref>web</application-ref>
+ <portlet-ref>FooterPortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>template</name>
+ <value>par:/groovy/groovy/webui/component/UIFooterPortlet.gtmpl</value>
+ <read-only>false</read-only>
+ </preference>
+ </preferences>
+ </portlet>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>false</show-info-bar>
+ <show-application-state>true</show-application-state>
+ <show-application-mode>true</show-application-mode>
+ </portlet-application>
+ </portal-layout>
+</portal-config>
\ No newline at end of file
Modified: portal/trunk/packaging/jboss-as5/pkg/pom.xml
===================================================================
--- portal/trunk/packaging/jboss-as5/pkg/pom.xml 2011-07-30 02:15:53 UTC (rev 6959)
+++ portal/trunk/packaging/jboss-as5/pkg/pom.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -358,6 +358,30 @@
<artifactId>mop-spi</artifactId>
</dependency>
+ <!-- GateIn Management -->
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-rest</artifactId>
+ </dependency>
+
+ <!-- Staxnav -->
+ <dependency>
+ <groupId>org.staxnav</groupId>
+ <artifactId>staxnav.core</artifactId>
+ </dependency>
+
<!-- GateIn Captcha -->
<dependency>
<groupId>org.gatein.captcha</groupId>
Modified: portal/trunk/packaging/jboss-as6/pkg/pom.xml
===================================================================
--- portal/trunk/packaging/jboss-as6/pkg/pom.xml 2011-07-30 02:15:53 UTC (rev 6959)
+++ portal/trunk/packaging/jboss-as6/pkg/pom.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -356,6 +356,30 @@
<artifactId>mop-spi</artifactId>
</dependency>
+ <!-- GateIn Management -->
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-rest</artifactId>
+ </dependency>
+
+ <!-- Staxnav -->
+ <dependency>
+ <groupId>org.staxnav</groupId>
+ <artifactId>staxnav.core</artifactId>
+ </dependency>
+
<!-- GateIn Captcha -->
<dependency>
<groupId>org.gatein.captcha</groupId>
Modified: portal/trunk/packaging/jetty/pkg/pom.xml
===================================================================
--- portal/trunk/packaging/jetty/pkg/pom.xml 2011-07-30 02:15:53 UTC (rev 6959)
+++ portal/trunk/packaging/jetty/pkg/pom.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -356,6 +356,30 @@
<artifactId>mop-spi</artifactId>
</dependency>
+ <!-- GateIn Management -->
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-rest</artifactId>
+ </dependency>
+
+ <!-- Staxnav -->
+ <dependency>
+ <groupId>org.staxnav</groupId>
+ <artifactId>staxnav.core</artifactId>
+ </dependency>
+
<!-- GateIn Captcha -->
<dependency>
<groupId>org.gatein.captcha</groupId>
Modified: portal/trunk/packaging/tomcat/pkg/pom.xml
===================================================================
--- portal/trunk/packaging/tomcat/pkg/pom.xml 2011-07-30 02:15:53 UTC (rev 6959)
+++ portal/trunk/packaging/tomcat/pkg/pom.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -348,6 +348,30 @@
<artifactId>mop-spi</artifactId>
</dependency>
+ <!-- GateIn Management -->
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-rest</artifactId>
+ </dependency>
+
+ <!-- Staxnav -->
+ <dependency>
+ <groupId>org.staxnav</groupId>
+ <artifactId>staxnav.core</artifactId>
+ </dependency>
+
<!-- GateIn Captcha -->
<dependency>
<groupId>org.gatein.captcha</groupId>
Modified: portal/trunk/pom.xml
===================================================================
--- portal/trunk/pom.xml 2011-07-30 02:15:53 UTC (rev 6959)
+++ portal/trunk/pom.xml 2011-07-30 02:53:38 UTC (rev 6960)
@@ -49,6 +49,7 @@
<org.picketlink.idm>1.3.0.Alpha03</org.picketlink.idm>
<org.gatein.wsrp.version>2.1.0-Beta04</org.gatein.wsrp.version>
<org.gatein.mop.version>1.1.0-Beta05</org.gatein.mop.version>
+ <org.gatein.mgmt.version>1.0.0-Beta01</org.gatein.mgmt.version>
<org.slf4j.version>1.5.8</org.slf4j.version>
<commons-pool.version>1.5.5</commons-pool.version>
<rhino.version>1.6R5</rhino.version>
@@ -56,6 +57,7 @@
<javax.servlet.version>2.5</javax.servlet.version>
<version.chromattic>1.1.0-beta6</version.chromattic>
<version.reflext>1.1.0-beta12</version.reflext>
+ <org.staxnav.version>0.9.4</org.staxnav.version>
<jcip.version>1.0</jcip.version>
<!-- ************** -->
@@ -321,6 +323,27 @@
<artifactId>mop-core</artifactId>
<version>${org.gatein.mop.version}</version>
</dependency>
+ <!-- Gatein Mgmt -->
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-api</artifactId>
+ <version>${org.gatein.mgmt.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-spi</artifactId>
+ <version>${org.gatein.mgmt.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-core</artifactId>
+ <version>${org.gatein.mgmt.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-rest</artifactId>
+ <version>${org.gatein.mgmt.version}</version>
+ </dependency>
<!-- WSRP -->
<dependency>
<groupId>org.gatein.wsrp</groupId>
@@ -637,6 +660,13 @@
<version>${version.chromattic}</version>
</dependency>
+ <!-- Staxnav -->
+ <dependency>
+ <groupId>org.staxnav</groupId>
+ <artifactId>staxnav.core</artifactId>
+ <version>${org.staxnav.version}</version>
+ </dependency>
+
<!-- Picketlink -->
<dependency>
<groupId>org.picketlink.idm</groupId>
13 years, 5 months
gatein SVN: r6959 - portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations.
by do-not-reply@jboss.org
Author: nscavell
Date: 2011-07-29 22:15:53 -0400 (Fri, 29 Jul 2011)
New Revision: 6959
Modified:
portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java
Log:
Add debug message and throw exception for unknown zip entry.
Modified: portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java 2011-07-29 21:04:11 UTC (rev 6958)
+++ portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java 2011-07-30 02:15:53 UTC (rev 6959)
@@ -115,6 +115,8 @@
// Skip directories
if (entry.isDirectory()) continue;
+ log.debug("Parsing zip entry: " + entry);
+
// Parse zip entry
String[] parts = parseEntry(entry);
SiteKey siteKey = Utils.siteKey(parts[0], parts[1]);
@@ -166,6 +168,10 @@
// Add import task to run later
mopImport.navigationTask = new NavigationImportTask(navigation, siteKey, navigationService, descriptionService, dataStorage);
}
+ else
+ {
+ throw new OperationException(operationName, "Invalid zip entry: " + entry);
+ }
}
resultHandler.completed(NoResultModel.INSTANCE);
13 years, 5 months
gatein SVN: r6958 - in portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer: builder and 1 other directory.
by do-not-reply@jboss.org
Author: nscavell
Date: 2011-07-29 17:04:11 -0400 (Fri, 29 Jul 2011)
New Revision: 6958
Modified:
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java
Log:
Fix encoding issues.
Modified: portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java 2011-07-29 20:25:44 UTC (rev 6957)
+++ portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java 2011-07-29 21:04:11 UTC (rev 6958)
@@ -43,7 +43,7 @@
{
public static <N> StaxWriter<N> createWriter(Naming<N> naming, OutputStream outputStream) throws StaxNavException
{
- return buildDefaultWriter().withOutputStream(outputStream).build(naming);
+ return buildDefaultWriter(outputStream).build(naming);
}
public static StaxWriter<String> createWriter(OutputStream outputStream) throws StaxNavException
@@ -168,8 +168,14 @@
.withFormatting(createFormatter());
}
+ private static StaxWriterBuilder buildDefaultWriter(OutputStream outputStream)
+ {
+ return buildWriter().withEncoding("UTF-8").withVersion("1.0")
+ .withPropertyIfSupported("com.ctc.wstx.outputEscapeCr", Boolean.FALSE)
+ .withFormatting(createFormatter())
+ .withOutputStream(outputStream, "UTF-8");
+ }
-
private static final int DEFAULT_INDENT_SIZE = 3;
private static final char DEFAULT_INDENT_CHAR = ' ';
private static final String DEFAULT_NEWLINE;
Modified: portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java 2011-07-29 20:25:44 UTC (rev 6957)
+++ portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java 2011-07-29 21:04:11 UTC (rev 6958)
@@ -168,7 +168,7 @@
if (output instanceof OutputStream)
{
- if (outputEncoding == null)
+ if (outputEncoding != null)
{
try
{
13 years, 5 months
gatein SVN: r6957 - in epp/portal/branches/EPP_5_2_Branch/distribution/jboss-epp/serverAddon: gatein.ear and 1 other directory.
by do-not-reply@jboss.org
Author: hfnukal
Date: 2011-07-29 16:25:44 -0400 (Fri, 29 Jul 2011)
New Revision: 6957
Modified:
epp/portal/branches/EPP_5_2_Branch/distribution/jboss-epp/serverAddon/gatein.ear/pom.xml
epp/portal/branches/EPP_5_2_Branch/distribution/jboss-epp/serverAddon/pom.xml
Log:
JBEPP-972 Upgrade WSRP Component to the latest
Modified: epp/portal/branches/EPP_5_2_Branch/distribution/jboss-epp/serverAddon/gatein.ear/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/distribution/jboss-epp/serverAddon/gatein.ear/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
+++ epp/portal/branches/EPP_5_2_Branch/distribution/jboss-epp/serverAddon/gatein.ear/pom.xml 2011-07-29 20:25:44 UTC (rev 6957)
@@ -63,29 +63,29 @@
<version>${project.version}</version>
<type>war</type>
</dependency>
+ <!--<dependency>-->
+ <!--<groupId>org.gatein.wsrp</groupId>-->
+ <!--<artifactId>wsrp-admin-gui</artifactId>-->
+ <!--<version>${org.gatein.wsrp.version}</version>-->
+ <!--<type>war</type>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>org.gatein.wsrp</groupId>-->
+ <!--<artifactId>wsrp-producer</artifactId>-->
+ <!--<version>${org.gatein.wsrp.version}</version>-->
+ <!--<type>war</type>-->
+ <!--<exclusions>-->
+ <!--<exclusion>-->
+ <!--<artifactId>jaxws-api</artifactId>-->
+ <!--<groupId>javax.xml.ws</groupId>-->
+ <!--</exclusion>-->
+ <!--<exclusion>-->
+ <!--<artifactId>jbossxb</artifactId>-->
+ <!--<groupId>org.jboss</groupId>-->
+ <!--</exclusion>-->
+ <!--</exclusions>-->
+ <!--</dependency>-->
<dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-admin-gui</artifactId>
- <version>${org.gatein.wsrp.version}</version>
- <type>war</type>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-producer</artifactId>
- <version>${org.gatein.wsrp.version}</version>
- <type>war</type>
- <exclusions>
- <exclusion>
- <artifactId>jaxws-api</artifactId>
- <groupId>javax.xml.ws</groupId>
- </exclusion>
- <exclusion>
- <artifactId>jbossxb</artifactId>
- <groupId>org.jboss</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>integration</artifactId>
<version>${project.version}</version>
@@ -985,101 +985,101 @@
</dependency>
<!-- wsrp libs -->
+ <!--<dependency>-->
+ <!--<groupId>org.gatein.wsrp</groupId>-->
+ <!--<artifactId>wsrp-producer-lib</artifactId>-->
+ <!--<exclusions>-->
+ <!--<exclusion>-->
+ <!--<artifactId>jaxb-api</artifactId>-->
+ <!--<groupId>javax.xml.bind</groupId>-->
+ <!--</exclusion>-->
+ <!--<exclusion>-->
+ <!--<artifactId>mail</artifactId>-->
+ <!--<groupId>javax.mail</groupId>-->
+ <!--</exclusion>-->
+ <!--<exclusion>-->
+ <!--<artifactId>slf4j-api</artifactId>-->
+ <!--<groupId>org.slf4j</groupId>-->
+ <!--</exclusion>-->
+ <!--<exclusion>-->
+ <!--<artifactId>jaxws-api</artifactId>-->
+ <!--<groupId>javax.xml.ws</groupId>-->
+ <!--</exclusion>-->
+ <!--<exclusion>-->
+ <!--<artifactId>jsr181-api</artifactId>-->
+ <!--<groupId>javax.jws</groupId>-->
+ <!--</exclusion>-->
+ <!--<exclusion>-->
+ <!--<artifactId>saaj-api</artifactId>-->
+ <!--<groupId>javax.xml.soap</groupId>-->
+ <!--</exclusion>-->
+ <!--<exclusion>-->
+ <!--<artifactId>jbossxb</artifactId>-->
+ <!--<groupId>org.jboss</groupId>-->
+ <!--</exclusion>-->
+ <!--<exclusion>-->
+ <!--<artifactId>activation</artifactId>-->
+ <!--<groupId>javax.activation</groupId>-->
+ <!--</exclusion>-->
+ <!--<exclusion>-->
+ <!--<artifactId>jboss-logging-spi</artifactId>-->
+ <!--<groupId>org.jboss.logging</groupId>-->
+ <!--</exclusion>-->
+ <!--<exclusion>-->
+ <!--<artifactId>jaxb-api</artifactId>-->
+ <!--<groupId>sun-jaxb</groupId>-->
+ <!--</exclusion>-->
+ <!--<exclusion>-->
+ <!--<artifactId>xml-apis</artifactId>-->
+ <!--<groupId>apache-xerces</groupId>-->
+ <!--</exclusion>-->
+ <!--</exclusions>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>org.gatein.wsrp</groupId>-->
+ <!--<artifactId>wsrp-consumer</artifactId>-->
+ <!--<exclusions>-->
+ <!--<exclusion>-->
+ <!--<artifactId>mail</artifactId>-->
+ <!--<groupId>javax.mail</groupId>-->
+ <!--</exclusion>-->
+ <!--<exclusion>-->
+ <!--<artifactId>saaj-api</artifactId>-->
+ <!--<groupId>javax.xml.soap</groupId>-->
+ <!--</exclusion>-->
+ <!--<exclusion>-->
+ <!--<artifactId>test-framework</artifactId>-->
+ <!--<groupId>org.gatein.wsrp</groupId>-->
+ <!--</exclusion>-->
+ <!--<exclusion>-->
+ <!--<artifactId>wsdl4j</artifactId>-->
+ <!--<groupId>wsdl4j</groupId>-->
+ <!--</exclusion>-->
+ <!--<exclusion>-->
+ <!--<artifactId>jbossxb</artifactId>-->
+ <!--<groupId>org.jboss</groupId>-->
+ <!--</exclusion>-->
+ <!--<exclusion>-->
+ <!--<artifactId>slf4j-jdk14</artifactId>-->
+ <!--<groupId>org.slf4j</groupId>-->
+ <!--</exclusion>-->
+ <!--<exclusion>-->
+ <!--<artifactId>slf4j-api</artifactId>-->
+ <!--<groupId>org.slf4j</groupId>-->
+ <!--</exclusion>-->
+ <!--</exclusions>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>org.gatein.wsrp</groupId>-->
+ <!--<artifactId>wsrp-integration-api</artifactId>-->
+ <!--<exclusions>-->
+ <!--<exclusion>-->
+ <!--<artifactId>servlet-api</artifactId>-->
+ <!--<groupId>javax.servlet</groupId>-->
+ <!--</exclusion>-->
+ <!--</exclusions>-->
+ <!--</dependency>-->
<dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-producer-lib</artifactId>
- <exclusions>
- <exclusion>
- <artifactId>jaxb-api</artifactId>
- <groupId>javax.xml.bind</groupId>
- </exclusion>
- <exclusion>
- <artifactId>mail</artifactId>
- <groupId>javax.mail</groupId>
- </exclusion>
- <exclusion>
- <artifactId>slf4j-api</artifactId>
- <groupId>org.slf4j</groupId>
- </exclusion>
- <exclusion>
- <artifactId>jaxws-api</artifactId>
- <groupId>javax.xml.ws</groupId>
- </exclusion>
- <exclusion>
- <artifactId>jsr181-api</artifactId>
- <groupId>javax.jws</groupId>
- </exclusion>
- <exclusion>
- <artifactId>saaj-api</artifactId>
- <groupId>javax.xml.soap</groupId>
- </exclusion>
- <exclusion>
- <artifactId>jbossxb</artifactId>
- <groupId>org.jboss</groupId>
- </exclusion>
- <exclusion>
- <artifactId>activation</artifactId>
- <groupId>javax.activation</groupId>
- </exclusion>
- <exclusion>
- <artifactId>jboss-logging-spi</artifactId>
- <groupId>org.jboss.logging</groupId>
- </exclusion>
- <exclusion>
- <artifactId>jaxb-api</artifactId>
- <groupId>sun-jaxb</groupId>
- </exclusion>
- <exclusion>
- <artifactId>xml-apis</artifactId>
- <groupId>apache-xerces</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-consumer</artifactId>
- <exclusions>
- <exclusion>
- <artifactId>mail</artifactId>
- <groupId>javax.mail</groupId>
- </exclusion>
- <exclusion>
- <artifactId>saaj-api</artifactId>
- <groupId>javax.xml.soap</groupId>
- </exclusion>
- <exclusion>
- <artifactId>test-framework</artifactId>
- <groupId>org.gatein.wsrp</groupId>
- </exclusion>
- <exclusion>
- <artifactId>wsdl4j</artifactId>
- <groupId>wsdl4j</groupId>
- </exclusion>
- <exclusion>
- <artifactId>jbossxb</artifactId>
- <groupId>org.jboss</groupId>
- </exclusion>
- <exclusion>
- <artifactId>slf4j-jdk14</artifactId>
- <groupId>org.slf4j</groupId>
- </exclusion>
- <exclusion>
- <artifactId>slf4j-api</artifactId>
- <groupId>org.slf4j</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-integration-api</artifactId>
- <exclusions>
- <exclusion>
- <artifactId>servlet-api</artifactId>
- <groupId>javax.servlet</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-api</artifactId>
</dependency>
@@ -1386,13 +1386,13 @@
<contextRoot>dashboard</contextRoot>
<bundleFileName>dashboard.war</bundleFileName>
</webModule>
+ <!--<webModule>-->
+ <!--<groupId>org.gatein.wsrp</groupId>-->
+ <!--<artifactId>wsrp-producer</artifactId>-->
+ <!--<contextRoot>wsrp-producer</contextRoot>-->
+ <!--<bundleFileName>wsrp-producer.war</bundleFileName>-->
+ <!--</webModule>-->
<webModule>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-producer</artifactId>
- <contextRoot>wsrp-producer</contextRoot>
- <bundleFileName>wsrp-producer.war</bundleFileName>
- </webModule>
- <webModule>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.portlet.exoadmin</artifactId>
<contextRoot>exoadmin</contextRoot>
@@ -1423,13 +1423,13 @@
<bundleFileName>integration.war</bundleFileName>
<unpack>true</unpack>
</webModule>
+ <!--<webModule>-->
+ <!--<groupId>org.gatein.wsrp</groupId>-->
+ <!--<artifactId>wsrp-admin-gui</artifactId>-->
+ <!--<contextRoot>wsrp-admin-gui</contextRoot>-->
+ <!--<bundleFileName>wsrp-admin-gui.war</bundleFileName>-->
+ <!--</webModule>-->
<webModule>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-admin-gui</artifactId>
- <contextRoot>wsrp-admin-gui</contextRoot>
- <bundleFileName>wsrp-admin-gui.war</bundleFileName>
- </webModule>
- <webModule>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.gadgets-server</artifactId>
<contextRoot>eXoGadgetServer</contextRoot>
Modified: epp/portal/branches/EPP_5_2_Branch/distribution/jboss-epp/serverAddon/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/distribution/jboss-epp/serverAddon/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
+++ epp/portal/branches/EPP_5_2_Branch/distribution/jboss-epp/serverAddon/pom.xml 2011-07-29 20:25:44 UTC (rev 6957)
@@ -27,7 +27,14 @@
<version>${project.version}</version>
<type>ear</type>
</dependency>
-
+ <dependency>
+ <?move gatein-wsrp-integration.ear?>
+ <groupId>org.gatein.integration</groupId>
+ <artifactId>extension-ear</artifactId>
+ <type>ear</type>
+ <version>${project.version}</version>
+ </dependency>
+
</dependencies>
<build>
13 years, 5 months
gatein SVN: r6956 - in epp/portal/branches/EPP_5_2_Branch: component/web/security and 55 other directories.
by do-not-reply@jboss.org
Author: hfnukal
Date: 2011-07-29 16:24:55 -0400 (Fri, 29 Jul 2011)
New Revision: 6956
Added:
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/pom.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/SessionEventListenerAndBroadcaster.java
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/jcr/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/jcr/JCRPersister.java
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPConsumerStructureProvider.java
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPPortalStructureAccess.java
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/PortalStructureAccess.java
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/wss/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/wss/JBoss5WSSServiceIntegration.java
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/resources/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/resources/conf/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/resources/conf/wsrp-producer-config.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein/integration/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein/integration/wsrp/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein/integration/wsrp/structure/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein/integration/wsrp/structure/MOPConsumerStructureProviderTestCase.java
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/pom.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src/main/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src/main/resources/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src/main/resources/conf/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src/main/resources/conf/configuration.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/pom.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/META-INF/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/META-INF/gatein-wsse-consumer.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/META-INF/jboss-scanning.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/pom.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/configuration.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/consumers-configuration-nodetypes.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/jcr-configuration.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/migration-nodetypes.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/navigation.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/pages.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-configuration-nodetypes.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-pc-nodetypes.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-registrations-nodetypes.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/repository-configuration.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/wsrp-configuration.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/web.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/pom.xml
Removed:
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/pom.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/SessionEventListenerAndBroadcaster.java
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/jcr/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/jcr/JCRPersister.java
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPConsumerStructureProvider.java
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPPortalStructureAccess.java
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/PortalStructureAccess.java
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/wss/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/wss/JBoss5WSSServiceIntegration.java
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/resources/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/resources/conf/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/resources/conf/wsrp-producer-config.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein/integration/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein/integration/wsrp/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein/integration/wsrp/structure/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein/integration/wsrp/structure/MOPConsumerStructureProviderTestCase.java
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/pom.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src/main/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src/main/resources/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src/main/resources/conf/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src/main/resources/conf/configuration.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/pom.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/META-INF/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/META-INF/gatein-wsse-consumer.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/META-INF/jboss-scanning.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/pom.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/configuration.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/consumers-configuration-nodetypes.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/jcr-configuration.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/migration-nodetypes.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/navigation.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/pages.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-configuration-nodetypes.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-pc-nodetypes.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-registrations-nodetypes.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/repository-configuration.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/wsrp-configuration.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/web.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/pom.xml
Modified:
epp/portal/branches/EPP_5_2_Branch/component/web/security/pom.xml
epp/portal/branches/EPP_5_2_Branch/gadgets/core/pom.xml
epp/portal/branches/EPP_5_2_Branch/gadgets/eXoGadgets/pom.xml
epp/portal/branches/EPP_5_2_Branch/gadgets/server/pom.xml
epp/portal/branches/EPP_5_2_Branch/packaging/jetty/pkg/pom.xml
epp/portal/branches/EPP_5_2_Branch/packaging/module/src/main/javascript/portal.packaging.module.js
epp/portal/branches/EPP_5_2_Branch/packaging/reports/
epp/portal/branches/EPP_5_2_Branch/pom.xml
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/GroupManagement.java
epp/portal/branches/EPP_5_2_Branch/server/jboss/patch-ear/src/main/jboss/server/default/deploy/gatein.ear/integration.war/pom.xml
epp/portal/branches/EPP_5_2_Branch/testsuite/htmlunit-tests/pom.xml
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/configuration.xml
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.xml
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/jcr/repository-configuration.xml
epp/portal/branches/EPP_5_2_Branch/webui/portal/pom.xml
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ModelAdapter.java
Log:
JBEPP-972 Upgrade WSRP Component to the latest
Modified: epp/portal/branches/EPP_5_2_Branch/component/web/security/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/web/security/pom.xml 2011-07-29 18:51:47 UTC (rev 6955)
+++ epp/portal/branches/EPP_5_2_Branch/component/web/security/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -39,6 +39,12 @@
<dependency>
<groupId>org.exoplatform.core</groupId>
<artifactId>exo.core.component.organization.api</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>quartz</groupId>
+ <artifactId>quartz</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
@@ -62,6 +68,40 @@
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-tomcat</artifactId>
<scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>jpl-pattern</groupId>
+ <artifactId>jpl-pattern</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jpl-util</groupId>
+ <artifactId>jpl-util</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>cglib</groupId>
+ <artifactId>cglib</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.security</groupId>
+ <artifactId>jacc</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.security</groupId>
+ <artifactId>jaas</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>sun-jaxws</groupId>
+ <artifactId>jsr181-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>sun-jaxws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>trove</groupId>
+ <artifactId>trove</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.gatein.wci</groupId>
Modified: epp/portal/branches/EPP_5_2_Branch/gadgets/core/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/gadgets/core/pom.xml 2011-07-29 18:51:47 UTC (rev 6955)
+++ epp/portal/branches/EPP_5_2_Branch/gadgets/core/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -85,6 +85,12 @@
<dependency>
<groupId>org.gatein.shindig</groupId>
<artifactId>shindig-common</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>com.google.code.guice</groupId>
+ <artifactId>guice-jmx</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.gatein.shindig</groupId>
Modified: epp/portal/branches/EPP_5_2_Branch/gadgets/eXoGadgets/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/gadgets/eXoGadgets/pom.xml 2011-07-29 18:51:47 UTC (rev 6955)
+++ epp/portal/branches/EPP_5_2_Branch/gadgets/eXoGadgets/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -52,6 +52,12 @@
<groupId>org.gatein.shindig</groupId>
<artifactId>shindig-common</artifactId>
<scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>com.google.code.guice</groupId>
+ <artifactId>guice-jmx</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
</dependencies>
Modified: epp/portal/branches/EPP_5_2_Branch/gadgets/server/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/gadgets/server/pom.xml 2011-07-29 18:51:47 UTC (rev 6955)
+++ epp/portal/branches/EPP_5_2_Branch/gadgets/server/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -58,10 +58,24 @@
<artifactId>shindig-features</artifactId>
<scope>provided</scope>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.gatein.shindig</groupId>
<artifactId>shindig-social-api</artifactId>
<scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>net.oauth.core</groupId>
+ <artifactId>oauth-provider</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>net.oauth</groupId>
+ <artifactId>core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.google.code.guice</groupId>
+ <artifactId>guice-jmx</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<!-- external dependencies -->
@@ -80,18 +94,20 @@
<artifactId>json_simple</artifactId>
<scope>provided</scope>
</dependency>
+ <!--
<dependency>
<groupId>net.oauth</groupId>
<artifactId>core</artifactId>
<scope>provided</scope>
</dependency>
+ -->
<dependency>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>com.google.code.guice</groupId>
+ <groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<scope>provided</scope>
</dependency>
Modified: epp/portal/branches/EPP_5_2_Branch/packaging/jetty/pkg/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/packaging/jetty/pkg/pom.xml 2011-07-29 18:51:47 UTC (rev 6955)
+++ epp/portal/branches/EPP_5_2_Branch/packaging/jetty/pkg/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -550,11 +550,11 @@
<!-- Various -->
<dependency>
- <groupId>com.google.code.guice</groupId>
+ <groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
<dependency>
- <groupId>com.google.code.guice</groupId>
+ <groupId>com.google.inject</groupId>
<artifactId>guice-jmx</artifactId>
</dependency>
<dependency>
@@ -960,4 +960,4 @@
</profile>
</profiles>
-</project>
\ No newline at end of file
+</project>
Modified: epp/portal/branches/EPP_5_2_Branch/packaging/module/src/main/javascript/portal.packaging.module.js
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/packaging/module/src/main/javascript/portal.packaging.module.js 2011-07-29 18:51:47 UTC (rev 6955)
+++ epp/portal/branches/EPP_5_2_Branch/packaging/module/src/main/javascript/portal.packaging.module.js 2011-07-29 20:24:55 UTC (rev 6956)
@@ -41,7 +41,6 @@
var pcVersion = "${org.gatein.pc.version}";
var wciVersion = "${org.gatein.wci.version}";
var commonVersion = "${org.gatein.common.version}";
- var wsrpVersion = "${org.gatein.wsrp.version}";
var shindigVersion = "${org.shindig.version}";
var groovyVersion = "${org.codehaus.groovy.version}";
var rhinoVersion = "${rhino.version}";
@@ -79,17 +78,6 @@
addDependency(new Project("org.apache.portals.bridges", "portals-bridges-common", "jar", "1.0.4")).
addDependency(new Project("org.jboss", "jboss-common-core", "jar", "2.2.9.GA"));
-
- module.component.wsrp = new Project("org.exoplatform.portal", "gatein.portal.component.wsrp", "jar", module.version)
- .addDependency(new Project("org.gatein.wsrp", "wsrp-producer", "war", wsrpVersion))
- .addDependency(new Project("org.gatein.wsrp", "wsrp-admin-gui", "war", wsrpVersion))
- .addDependency(new Project("org.gatein.wsrp", "wsrp-producer-lib", "jar",wsrpVersion))
- .addDependency(new Project("org.gatein.wsrp", "wsrp-common", "jar", wsrpVersion))
- .addDependency(new Project("org.gatein.wsrp", "wsrp-wsrp1-ws", "jar", wsrpVersion))
- .addDependency(new Project("org.gatein.wsrp", "wsrp-wsrp2-ws", "jar", wsrpVersion))
- .addDependency(new Project("org.gatein.wsrp", "wsrp-consumer", "jar", wsrpVersion))
- .addDependency(new Project("org.gatein.wsrp", "wsrp-integration-api", "jar", wsrpVersion));
-
module.component.scripting =
new Project("org.exoplatform.portal", "exo.portal.component.scripting", "jar", module.version).
addDependency(new Project("rhino", "js", "jar", rhinoVersion)).
@@ -183,7 +171,6 @@
addDependency(module.component.resources).
addDependency(module.component.identity).
addDependency(module.component.pc).
- addDependency(module.component.wsrp).
addDependency(module.webui.eXo).
addDependency(kernel.container).
Property changes on: epp/portal/branches/EPP_5_2_Branch/packaging/reports
___________________________________________________________________
Modified: svn:ignore
- *.iml
.idea
+ .idea
Modified: epp/portal/branches/EPP_5_2_Branch/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/pom.xml 2011-07-29 18:51:47 UTC (rev 6955)
+++ epp/portal/branches/EPP_5_2_Branch/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -75,11 +75,12 @@
<modules>
<module>component</module>
- <module>gadgets</module>
+ <!--<module>gadgets</module>-->
<module>webui</module>
<module>portlet</module>
<module>web</module>
<module>server</module>
+ <module>wsrp-integration</module>
<module>examples</module>
<module>starter</module>
<module>packaging</module>
@@ -133,6 +134,11 @@
</dependency>
<dependency>
<groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.remote</artifactId>
+ <version>${org.exoplatform.kernel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.container</artifactId>
<version>${org.exoplatform.kernel.version}</version>
<exclusions>
@@ -222,6 +228,11 @@
<version>${org.exoplatform.jcr.version}</version>
</dependency>
<dependency>
+ <groupId>org.exoplatform.jcr</groupId>
+ <artifactId>exo.jcr.framework.command</artifactId>
+ <version>${org.exoplatform.jcr.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.component.ext</artifactId>
<version>${org.exoplatform.jcr.version}</version>
@@ -251,6 +262,11 @@
<artifactId>exo.jcr.component.ftp</artifactId>
<version>${org.exoplatform.jcr.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.exoplatform.ws</groupId>
+ <artifactId>exo.ws.commons</artifactId>
+ <version>${org.exoplatform.ws.version}</version>
+ </dependency>
<dependency>
<groupId>org.exoplatform.ws</groupId>
<artifactId>exo.ws.frameworks.servlet</artifactId>
@@ -258,9 +274,19 @@
</dependency>
<dependency>
<groupId>org.exoplatform.ws</groupId>
+ <artifactId>exo.ws.rest.ext</artifactId>
+ <version>${org.exoplatform.ws.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.ws</groupId>
<artifactId>exo.ws.rest.core</artifactId>
<version>${org.exoplatform.ws.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.exoplatform.ws</groupId>
+ <artifactId>exo.ws.frameworks.json</artifactId>
+ <version>${org.exoplatform.ws.version}</version>
+ </dependency>
<!-- GateIn components -->
<dependency>
@@ -329,13 +355,31 @@
<version>${org.gatein.pc.version}</version>
</dependency>
<dependency>
+ <groupId>org.gatein.mop</groupId>
+ <artifactId>mop-api</artifactId>
+ <version>${org.gatein.mop.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.mop</groupId>
+ <artifactId>mop-spi</artifactId>
+ <version>${org.gatein.mop.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.mop</groupId>
+ <artifactId>mop-core</artifactId>
+ <version>${org.gatein.mop.version}</version>
+ </dependency>
+ <!-- WSRP -->
+ <dependency>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-producer-lib</artifactId>
+ <scope>provided</scope>
<version>${org.gatein.wsrp.version}</version>
</dependency>
<dependency>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-consumer</artifactId>
+ <scope>provided</scope>
<version>${org.gatein.wsrp.version}</version>
<exclusions>
<exclusion>
@@ -346,24 +390,46 @@
</dependency>
<dependency>
<groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-jcr-impl</artifactId>
+ <scope>provided</scope>
+ <version>${org.gatein.wsrp.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-integration-api</artifactId>
+ <scope>provided</scope>
<version>${org.gatein.wsrp.version}</version>
</dependency>
<dependency>
- <groupId>org.gatein.mop</groupId>
- <artifactId>mop-api</artifactId>
- <version>${org.gatein.mop.version}</version>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-common</artifactId>
+ <scope>provided</scope>
+ <version>${org.gatein.wsrp.version}</version>
</dependency>
<dependency>
- <groupId>org.gatein.mop</groupId>
- <artifactId>mop-spi</artifactId>
- <version>${org.gatein.mop.version}</version>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-wsrp1-ws</artifactId>
+ <scope>provided</scope>
+ <version>${org.gatein.wsrp.version}</version>
</dependency>
<dependency>
- <groupId>org.gatein.mop</groupId>
- <artifactId>mop-core</artifactId>
- <version>${org.gatein.mop.version}</version>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-wsrp2-ws</artifactId>
+ <scope>provided</scope>
+ <version>${org.gatein.wsrp.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-wss</artifactId>
+ <scope>provided</scope>
+ <version>${org.gatein.wsrp.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-wss-jboss5</artifactId>
+ <scope>provided</scope>
+ <version>${org.gatein.wsrp.version}</version>
+ </dependency>
<!-- GateIn -->
<dependency>
@@ -662,7 +728,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.3.2</version>
+ <version>1.4</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
@@ -720,16 +786,6 @@
<artifactId>junit</artifactId>
<version>3.8.1</version>
</dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.2.1</version>
- </dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.0</version>
- </dependency>
<dependency>
<groupId>caja</groupId>
@@ -757,9 +813,9 @@
<version>2.0</version>
</dependency>
<dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.4</version>
+ <groupId>com.google.code.guice</groupId>
+ <artifactId>guice-jmx</artifactId>
+ <version>2.0</version>
</dependency>
<dependency>
<groupId>rome</groupId>
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/GroupManagement.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/GroupManagement.java 2011-07-29 18:51:47 UTC (rev 6955)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/GroupManagement.java 2011-07-29 20:24:55 UTC (rev 6956)
@@ -33,7 +33,7 @@
* Created by The eXo Platform SAS
* Author : Huu-Dung Kieu
* kieuhdung(a)gmail.com
- * 22 d�c. 08
+ * 22 dec. 08
*/
public class GroupManagement
{
Modified: epp/portal/branches/EPP_5_2_Branch/server/jboss/patch-ear/src/main/jboss/server/default/deploy/gatein.ear/integration.war/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/server/jboss/patch-ear/src/main/jboss/server/default/deploy/gatein.ear/integration.war/pom.xml 2011-07-29 18:51:47 UTC (rev 6955)
+++ epp/portal/branches/EPP_5_2_Branch/server/jboss/patch-ear/src/main/jboss/server/default/deploy/gatein.ear/integration.war/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -4,7 +4,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>3.2.0-Beta01-SNAPSHOT</version>
+ <version>5.2.0-epp-DEV02-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.packaging.jboss-as.integration</artifactId>
<packaging>war</packaging>
Modified: epp/portal/branches/EPP_5_2_Branch/testsuite/htmlunit-tests/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/testsuite/htmlunit-tests/pom.xml 2011-07-29 18:51:47 UTC (rev 6955)
+++ epp/portal/branches/EPP_5_2_Branch/testsuite/htmlunit-tests/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -26,7 +26,7 @@
<groupId>org.jboss.gatein</groupId>
<artifactId>gatein.tests.htmlunit</artifactId>
- <version>3.2.0-Beta01-SNAPSHOT</version>
+ <version>5.2.0-epp-DEV02-SNAPSHOT</version>
<packaging>jar</packaging>
<name>HTMLUnit Tests for GateIn</name>
<description>HTMLUnit Tests for GateIn</description>
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/configuration.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/configuration.xml 2011-07-29 18:51:47 UTC (rev 6955)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/configuration.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -27,7 +27,6 @@
<import>war:/conf/common/common-configuration.xml</import>
<import>war:/conf/common/resource-compressor-configuration.xml</import>
<import>war:/conf/common/portlet-container-configuration.xml</import>
-<!-- <import profiles="jboss">war:/conf/wsrp/wsrp-configuration.xml</import>-->
<import>war:/conf/common/logs-configuration.xml</import>
<import>war:/conf/common/autologin-configuration.xml</import>
<import>war:/conf/common/remindpwd-configuration.xml</import>
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.xml 2011-07-29 18:51:47 UTC (rev 6955)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -33,13 +33,13 @@
<description>JCR configuration file</description>
<value>war:/conf/jcr/repository-configuration.xml</value>
</value-param>
- <properties-param>
+ <!--<properties-param>
<name>working-conf</name>
<description>working-conf</description>
<property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"/>
<property name="source-name" value="${gatein.jcr.datasource.name}${container.name.suffix}"/>
<property name="dialect" value="${gatein.jcr.datasource.dialect}"/>
- </properties-param>
+ </properties-param>-->
</init-params>
</component>
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/jcr/repository-configuration.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/jcr/repository-configuration.xml 2011-07-29 18:51:47 UTC (rev 6955)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/jcr/repository-configuration.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -224,141 +224,6 @@
</properties>
</lock-manager>
</workspace>
-
- <!-- WSRP -->
- <workspace name="wsrp-system">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="${gatein.jcr.datasource.name}${container.name.suffix}"/>
- <property name="dialect" value="${gatein.jcr.datasource.dialect}"/>
- <property name="multi-db" value="false"/>
- <property name="update-storage" value="true"/>
- <property name="max-buffer-size" value="204800"/>
- <property name="swap-directory" value="${gatein.jcr.data.dir}/swap/wsrp${container.name.suffix}"/>
- </properties>
- <value-storages>
- <value-storage id="wsrp-system"
- class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="${gatein.jcr.storage.data.dir}/wsrp${container.name.suffix}"/>
- </properties>
- <filters>
- <filter property-type="Binary"/>
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured"/>
- <property name="root-permissions" value="*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove"/>
- </properties>
- </initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
- <properties>
- <property name="jbosscache-configuration" value="${gatein.jcr.cache.config}" />
- <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}" />
- <property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="jcr-${container.name.suffix}-wsrp-system" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="${gatein.jcr.index.data.dir}/wsrp-system${container.name.suffix}"/>
- <property name="changesfilter-class" value="${gatein.jcr.index.changefilterclass}" />
- <property name="jbosscache-configuration" value="${gatein.jcr.index.cache.config}" />
- <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}" />
- <property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="jcrindexer-${container.name.suffix}-wsrp-system" />
- <property name="max-volatile-time" value="60" />
- </properties>
- </query-handler>
- <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
- <properties>
- <property name="time-out" value="15m" />
- <property name="jbosscache-configuration" value="${gatein.jcr.lock.cache.config}" />
- <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}" />
- <property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="jcrlock-${container.name.suffix}-wsrp-system" />
- <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlock_wsrp_system" />
- <property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
- <property name="jbosscache-cl-cache.jdbc.table.drop" value="false" />
- <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="pk" />
- <property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn" />
- <property name="jbosscache-cl-cache.jdbc.node.column" value="node" />
- <property name="jbosscache-cl-cache.jdbc.parent.column" value="parent" />
- <property name="jbosscache-cl-cache.jdbc.datasource" value="${gatein.jcr.datasource.name}${container.name.suffix}" />
- </properties>
- </lock-manager>
- </workspace>
-
- <!-- Producer portlet states -->
- <workspace name="pc-system">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="${gatein.jcr.datasource.name}${container.name.suffix}"/>
- <property name="dialect" value="${gatein.jcr.datasource.dialect}"/>
- <property name="multi-db" value="false"/>
- <property name="update-storage" value="true"/>
- <property name="max-buffer-size" value="204800"/>
- <property name="swap-directory" value="${gatein.jcr.data.dir}/swap/pc${container.name.suffix}"/>
- </properties>
- <value-storages>
- <value-storage id="pc-system" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="${gatein.jcr.storage.data.dir}/pc${container.name.suffix}"/>
- </properties>
- <filters>
- <filter property-type="Binary"/>
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured"/>
- <property name="root-permissions" value="*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove"/>
- </properties>
- </initializer>
- <cache enabled="true"
- class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
- <properties>
- <property name="jbosscache-configuration" value="${gatein.jcr.cache.config}"/>
- <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
- <property name="jgroups-multiplexer-stack" value="true"/>
- <property name="jbosscache-cluster-name" value="jcr-${container.name.suffix}-pc-system"/>
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="${gatein.jcr.index.data.dir}/pc-system${container.name.suffix}"/>
- <property name="changesfilter-class" value="${gatein.jcr.index.changefilterclass}"/>
- <property name="jbosscache-configuration" value="${gatein.jcr.index.cache.config}"/>
- <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
- <property name="jgroups-multiplexer-stack" value="true"/>
- <property name="jbosscache-cluster-name" value="jcrindexer-${container.name.suffix}-pc-system"/>
- <property name="max-volatile-time" value="60"/>
- </properties>
- </query-handler>
- <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
- <properties>
- <property name="time-out" value="15m"/>
- <property name="jbosscache-configuration" value="${gatein.jcr.lock.cache.config}"/>
- <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
- <property name="jgroups-multiplexer-stack" value="true"/>
- <property name="jbosscache-cluster-name" value="jcrlock-${container.name.suffix}-pc-system"/>
- <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlock_portlet_state_system"/>
- <property name="jbosscache-cl-cache.jdbc.table.create" value="true"/>
- <property name="jbosscache-cl-cache.jdbc.table.drop" value="false"/>
- <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="pk"/>
- <property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn"/>
- <property name="jbosscache-cl-cache.jdbc.node.column" value="node"/>
- <property name="jbosscache-cl-cache.jdbc.parent.column" value="parent"/>
- <property name="jbosscache-cl-cache.jdbc.datasource" value="${gatein.jcr.datasource.name}${container.name.suffix}"/>
- </properties>
- </lock-manager>
- </workspace>
-
</workspaces>
</repository>
</repositories>
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/pom.xml 2011-07-29 18:51:47 UTC (rev 6955)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -81,6 +81,12 @@
<groupId>org.gatein.shindig</groupId>
<artifactId>shindig-common</artifactId>
<type>jar</type>
+ <exclusions>
+ <exclusion>
+ <groupId>com.google.code.guice</groupId>
+ <artifactId>guice-jmx</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ModelAdapter.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ModelAdapter.java 2011-07-29 18:51:47 UTC (rev 6955)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ModelAdapter.java 2011-07-29 20:24:55 UTC (rev 6956)
@@ -49,6 +49,7 @@
*/
public abstract class ModelAdapter<S, C extends Serializable>
{
+ private static final String LOCAL_STATE_ID = PortletContext.LOCAL_CONSUMER_CLONE.getId();
public static <S, C extends Serializable, I> ModelAdapter<S, C> getAdapter(ApplicationType<S> type)
{
@@ -82,7 +83,7 @@
@Override
public StatefulPortletContext<ExoPortletState> getPortletContext(ExoContainer container, String applicationId,
- ApplicationState<Portlet> applicationState) throws Exception
+ ApplicationState<Portlet> applicationState) throws Exception
{
DataStorage dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
Portlet preferences = dataStorage.load(applicationState, ApplicationType.PORTLET);
@@ -95,12 +96,12 @@
map.getState().put(pref.getName(), pref.getValues());
}
}
- return StatefulPortletContext.create("local._dumbvalue", ExoPortletStateType.getInstance(), map);
+ return StatefulPortletContext.create(LOCAL_STATE_ID, ExoPortletStateType.getInstance(), map);
}
@Override
public ApplicationState<Portlet> update(ExoContainer container, ExoPortletState updateState,
- ApplicationState<Portlet> applicationState) throws Exception
+ ApplicationState<Portlet> applicationState) throws Exception
{
// Compute new preferences
PortletBuilder builder = new PortletBuilder();
@@ -128,8 +129,7 @@
int indexOfSeparator = applicationState.lastIndexOf("/");
String appName = applicationState.substring(0, indexOfSeparator);
String portletName = applicationState.substring(indexOfSeparator + 1);
- return PortletContext.createPortletContext(PortletInvoker.LOCAL_PORTLET_INVOKER_ID + "./" + appName + "."
- + portletName);
+ return PortletContext.reference(PortletInvoker.LOCAL_PORTLET_INVOKER_ID, PortletContext.createPortletContext(appName, portletName));
}
@Override
@@ -140,7 +140,9 @@
TransientApplicationState<Portlet> transientState = (TransientApplicationState<Portlet>)applicationState;
Portlet pref = transientState.getContentState();
if (pref == null)
+ {
pref = new Portlet();
+ }
return pref;
}
else
@@ -148,18 +150,20 @@
DataStorage dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
Portlet pref = dataStorage.load(applicationState, ApplicationType.PORTLET);
if (pref == null)
+ {
pref = new Portlet();
+ }
return pref;
}
}
@Override
public ExoPortletState getStateFromModifiedContext(PortletContext originalPortletContext,
- PortletContext modifiedPortletContext)
+ PortletContext modifiedPortletContext)
{
if (modifiedPortletContext != null && modifiedPortletContext instanceof StatefulPortletContext)
{
- StatefulPortletContext statefulContext = (StatefulPortletContext) modifiedPortletContext;
+ StatefulPortletContext statefulContext = (StatefulPortletContext)modifiedPortletContext;
if (statefulContext.getState() instanceof ExoPortletState)
{
return (ExoPortletState)statefulContext.getState();
@@ -170,11 +174,11 @@
@Override
public ExoPortletState getstateFromClonedContext(PortletContext originalPortletContext,
- PortletContext clonedPortletContext)
+ PortletContext clonedPortletContext)
{
if (clonedPortletContext != null && clonedPortletContext instanceof StatefulPortletContext)
{
- StatefulPortletContext statefulContext = (StatefulPortletContext) clonedPortletContext;
+ StatefulPortletContext statefulContext = (StatefulPortletContext)clonedPortletContext;
if (statefulContext.getState() instanceof ExoPortletState)
{
return (ExoPortletState)statefulContext.getState();
@@ -184,18 +188,15 @@
}
};
+ private static final String DASHBOARD = "dashboard";
+ private static final String GADGET_PORTLET = "GadgetPortlet";
+ private static final PortletContext WRAPPER_CONTEXT = PortletContext.reference(PortletInvoker.LOCAL_PORTLET_INVOKER_ID, PortletContext.createPortletContext(DASHBOARD, GADGET_PORTLET));
+ private static final String WRAPPER_ID = WRAPPER_CONTEXT.getId();
private static final ModelAdapter<Gadget, ExoPortletState> GADGET = new ModelAdapter<Gadget, ExoPortletState>()
{
-
- /** . */
- private final String WRAPPER_ID = "local./" + "dashboard" + "." + "GadgetPortlet";
-
- /** . */
- private final PortletContext WRAPPER_CONTEXT = PortletContext.createPortletContext(WRAPPER_ID);
-
@Override
public StatefulPortletContext<ExoPortletState> getPortletContext(ExoContainer container, String applicationId,
- ApplicationState<Gadget> applicationState) throws Exception
+ ApplicationState<Gadget> applicationState) throws Exception
{
GadgetRegistryService gadgetService =
(GadgetRegistryService)container.getComponentInstanceOfType(GadgetRegistryService.class);
@@ -203,12 +204,12 @@
String url = GadgetUtil.reproduceUrl(model.getUrl(), model.isLocal());
ExoPortletState prefs = new ExoPortletState(WRAPPER_ID);
prefs.getState().put("url", Arrays.asList(url));
- return StatefulPortletContext.create("local._dumbvalue", ExoPortletStateType.getInstance(), prefs);
+ return StatefulPortletContext.create(LOCAL_STATE_ID, ExoPortletStateType.getInstance(), prefs);
}
@Override
public ApplicationState<Gadget> update(ExoContainer container, ExoPortletState updateState,
- ApplicationState<Gadget> gadgetApplicationState) throws Exception
+ ApplicationState<Gadget> gadgetApplicationState) throws Exception
{
throw new UnsupportedOperationException("Cannot edit gadget preferences");
}
@@ -228,11 +229,11 @@
@Override
public ExoPortletState getStateFromModifiedContext(PortletContext originalPortletContext,
- PortletContext modifiedPortletContext)
+ PortletContext modifiedPortletContext)
{
if (modifiedPortletContext != null && modifiedPortletContext instanceof StatefulPortletContext)
{
- StatefulPortletContext statefulContext = (StatefulPortletContext) modifiedPortletContext;
+ StatefulPortletContext statefulContext = (StatefulPortletContext)modifiedPortletContext;
if (statefulContext.getState() instanceof ExoPortletState)
{
return (ExoPortletState)statefulContext.getState();
@@ -243,11 +244,11 @@
@Override
public ExoPortletState getstateFromClonedContext(PortletContext originalPortletContext,
- PortletContext clonedPortletContext)
+ PortletContext clonedPortletContext)
{
if (clonedPortletContext != null && clonedPortletContext instanceof StatefulPortletContext)
{
- StatefulPortletContext statefulContext = (StatefulPortletContext) clonedPortletContext;
+ StatefulPortletContext statefulContext = (StatefulPortletContext)clonedPortletContext;
if (statefulContext.getState() instanceof ExoPortletState)
{
return (ExoPortletState)statefulContext.getState();
@@ -259,10 +260,9 @@
/**
* todo: this ModelAdapter is not quite good, what is really needed is a ModelAdapter<WSRP, byte[]> so that the
- * StatefulPortletContext returned by getPortletContext is actually of type PortletStateType.OPAQUE so that it
- * can be properly handled in WSRP...
- * This model needs to be revisited if we want to properly support consumer-side state management.
- * See GTNPORTAL-736.
+ * StatefulPortletContext returned by getPortletContext is actually of type PortletStateType.OPAQUE so that it can be
+ * properly handled in WSRP... This model needs to be revisited if we want to properly support consumer-side state
+ * management. See GTNPORTAL-736.
*/
private static final ModelAdapter<WSRP, WSRP> WSRP = new ModelAdapter<WSRP, WSRP>()
{
@@ -280,7 +280,7 @@
@Override
public StatefulPortletContext<WSRP> getPortletContext(ExoContainer container, String applicationId,
- ApplicationState<WSRP> state) throws Exception
+ ApplicationState<WSRP> state) throws Exception
{
DataStorage dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
WSRP wsrp = dataStorage.load(state, ApplicationType.WSRP_PORTLET);
@@ -319,11 +319,11 @@
@Override
public WSRP getStateFromModifiedContext(PortletContext originalPortletContext,
- PortletContext modifiedPortletContext)
+ PortletContext modifiedPortletContext)
{
WSRP wsrp = new WSRP();
wsrp.setPortletId(modifiedPortletContext.getId());
-
+
// from the originalPortletContext see if we are dealing with a cloned context or not.
if (originalPortletContext instanceof StatefulPortletContext)
{
@@ -333,7 +333,7 @@
wsrp.setCloned(((WSRP)originalState).isCloned());
}
}
-
+
if (modifiedPortletContext instanceof StatefulPortletContext)
{
Object modifiedState = ((StatefulPortletContext)modifiedPortletContext).getState();
@@ -342,7 +342,7 @@
wsrp.setState((byte[])modifiedState);
}
}
-
+
return wsrp;
}
@@ -352,14 +352,14 @@
WSRP wsrp = new WSRP();
wsrp.setPortletId(clonedPortletContext.getId());
wsrp.setCloned(true);
-
+
// if we have an associated state, record it as well...
if (clonedPortletContext instanceof StatefulPortletContext)
{
StatefulPortletContext statefulPortletContext = (StatefulPortletContext)clonedPortletContext;
wsrp.setState((byte[])statefulPortletContext.getState());
}
-
+
return wsrp;
}
};
@@ -367,10 +367,10 @@
public abstract PortletContext getProducerOfferedPortletContext(String applicationId);
public abstract StatefulPortletContext<C> getPortletContext(ExoContainer container, String applicationId,
- ApplicationState<S> applicationState) throws Exception;
+ ApplicationState<S> applicationState) throws Exception;
public abstract ApplicationState<S> update(ExoContainer container, C updateState,
- ApplicationState<S> applicationState) throws Exception;
+ ApplicationState<S> applicationState) throws Exception;
/**
* Returns the state of the gadget as preferences or null if the preferences cannot be edited as such.
@@ -381,21 +381,21 @@
* @throws Exception any exception
*/
public abstract Portlet getState(ExoContainer container, ApplicationState<S> applicationState) throws Exception;
-
+
/**
* Extracts the state based on what the current PortletContext is and the new modified PortletContext.
- *
+ *
* @param originalPortletContext The current PortletContext for the Portlet
* @param modifiedPortletContext The new modified PortletContext
* @return
*/
public abstract C getStateFromModifiedContext(PortletContext originalPortletContext, PortletContext modifiedPortletContext);
-
+
/**
* Extracts the state based on what the current PortletContext is and the new cloned PortletContext
- *
+ *
* @param originalPortletContext The current PortletContext for the Portlet
- * @param clonedPortletContext The new cloned PortletContext
+ * @param clonedPortletContext The new cloned PortletContext
* @return
*/
public abstract C getstateFromClonedContext(PortletContext originalPortletContext, PortletContext clonedPortletContext);
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/pom.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-component/pom.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>gatein-wsrp-integration-parent</artifactId>
- <groupId>org.gatein.integration</groupId>
- <version>1.0.0-Beta01-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>extension-component</artifactId>
- <packaging>jar</packaging>
- <name>GateIn WSRP Integration extension component</name>
-
- <dependencies>
- <!-- WSRP jars are in packaging/module.js -->
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-producer-lib</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-consumer</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-jcr-impl</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.gatein.mop</groupId>
- <artifactId>mop-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-integration-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-wss-jboss5</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.gatein.pc</groupId>
- <artifactId>pc-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.gatein.pc</groupId>
- <artifactId>pc-portlet</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.exoplatform.kernel</groupId>
- <artifactId>exo.kernel.container</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.exoplatform.portal</groupId>
- <artifactId>exo.portal.component.pc</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.exoplatform.portal</groupId>
- <artifactId>exo.portal.component.common</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.exoplatform.portal</groupId>
- <artifactId>exo.portal.component.portal</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.gatein.wci</groupId>
- <artifactId>wci-wci</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.ws.native</groupId>
- <artifactId>jbossws-native-core</artifactId>
- <version>3.1.2.GA</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- tests -->
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>1.8.5</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- </resources>
- </build>
-
-</project>
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/pom.xml (from rev 6033, portal/trunk/wsrp-integration/extension-component/pom.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/pom.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>gatein-wsrp-integration-parent</artifactId>
+ <groupId>org.gatein.integration</groupId>
+ <version>5.2.0-epp-DEV02-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>extension-component</artifactId>
+ <packaging>jar</packaging>
+ <name>GateIn WSRP Integration extension component</name>
+
+ <dependencies>
+ <!-- WSRP jars are in packaging/module.js -->
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-producer-lib</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-consumer</artifactId>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>apache-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-jcr-impl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.mop</groupId>
+ <artifactId>mop-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-integration-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-wss-jboss5</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-wss</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-portlet</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.container</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.component.pc</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.component.common</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.component.portal</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.gatein.wci</groupId>
+ <artifactId>wci-wci</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ws.native</groupId>
+ <artifactId>jbossws-native-core</artifactId>
+ <version>3.1.2.GA</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>wscommons-policy</groupId>
+ <artifactId>policy</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <!-- tests -->
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>1.8.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ </build>
+
+</project>
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/SessionEventListenerAndBroadcaster.java
===================================================================
--- portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/SessionEventListenerAndBroadcaster.java 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/SessionEventListenerAndBroadcaster.java 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,109 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2011, Red Hat Middleware, LLC, and individual
- * contributors as indicated by the @authors tag. See the
- * copyright.txt in the distribution for a full listing of
- * individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.integration.wsrp;
-
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.services.listener.Event;
-import org.exoplatform.services.listener.Listener;
-import org.gatein.wsrp.api.session.SessionEvent;
-import org.gatein.wsrp.api.session.SessionEventBroadcaster;
-import org.gatein.wsrp.api.session.SessionEventListener;
-
-import javax.servlet.http.HttpSession;
-import javax.servlet.http.HttpSessionEvent;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class SessionEventListenerAndBroadcaster extends Listener<PortalContainer, HttpSessionEvent> implements SessionEventBroadcaster
-{
- private Map<String, SessionEventListener> listeners = new ConcurrentHashMap<String, SessionEventListener>();
- private static final String SESSION_CREATED = "org.exoplatform.web.GenericHttpListener.sessionCreated";
- private static final String SESSION_DESTROYED = "org.exoplatform.web.GenericHttpListener.sessionDestroyed";
-
- public void registerListener(String listenerId, SessionEventListener listener)
- {
- listeners.put(listenerId, listener);
- }
-
- public void unregisterListener(String listenerId)
- {
- listeners.remove(listenerId);
- }
-
- public void notifyListenersOf(SessionEvent event)
- {
- for (SessionEventListener listener : listeners.values())
- {
- listener.onSessionEvent(event);
- }
- }
-
- @Override
- public void onEvent(Event<PortalContainer, HttpSessionEvent> event) throws Exception
- {
- String eventName = event.getEventName();
- SessionEvent.SessionEventType eventType;
- if (SESSION_CREATED.equals(eventName))
- {
- eventType = SessionEvent.SessionEventType.SESSION_CREATED;
- }
- else if (SESSION_DESTROYED.equals(eventName))
- {
- eventType = SessionEvent.SessionEventType.SESSION_DESTROYED;
- }
- else
- {
- // do nothing
- return;
- }
-
- notifyListenersOf(new SimpleSessionEvent(eventType, event.getData().getSession()));
- }
-
- private static class SimpleSessionEvent implements SessionEvent
- {
- private SessionEventType eventType;
- private HttpSession session;
-
- private SimpleSessionEvent(SessionEventType eventType, HttpSession session)
- {
- this.eventType = eventType;
- this.session = session;
- }
-
- public SessionEventType getType()
- {
- return eventType;
- }
-
- public HttpSession getSession()
- {
- return session;
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/SessionEventListenerAndBroadcaster.java (from rev 6033, portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/SessionEventListenerAndBroadcaster.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/SessionEventListenerAndBroadcaster.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/SessionEventListenerAndBroadcaster.java 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.integration.wsrp;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.services.listener.Event;
+import org.exoplatform.services.listener.Listener;
+import org.gatein.wsrp.api.session.SessionEvent;
+import org.gatein.wsrp.api.session.SessionEventBroadcaster;
+import org.gatein.wsrp.api.session.SessionEventListener;
+
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionEvent;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class SessionEventListenerAndBroadcaster extends Listener<PortalContainer, HttpSessionEvent> implements SessionEventBroadcaster
+{
+ private Map<String, SessionEventListener> listeners = new ConcurrentHashMap<String, SessionEventListener>();
+ private static final String SESSION_CREATED = "org.exoplatform.web.GenericHttpListener.sessionCreated";
+ private static final String SESSION_DESTROYED = "org.exoplatform.web.GenericHttpListener.sessionDestroyed";
+
+ public void registerListener(String listenerId, SessionEventListener listener)
+ {
+ listeners.put(listenerId, listener);
+ }
+
+ public void unregisterListener(String listenerId)
+ {
+ listeners.remove(listenerId);
+ }
+
+ public void notifyListenersOf(SessionEvent event)
+ {
+ for (SessionEventListener listener : listeners.values())
+ {
+ listener.onSessionEvent(event);
+ }
+ }
+
+ @Override
+ public void onEvent(Event<PortalContainer, HttpSessionEvent> event) throws Exception
+ {
+ String eventName = event.getEventName();
+ SessionEvent.SessionEventType eventType;
+ if (SESSION_CREATED.equals(eventName))
+ {
+ eventType = SessionEvent.SessionEventType.SESSION_CREATED;
+ }
+ else if (SESSION_DESTROYED.equals(eventName))
+ {
+ eventType = SessionEvent.SessionEventType.SESSION_DESTROYED;
+ }
+ else
+ {
+ // do nothing
+ return;
+ }
+
+ notifyListenersOf(new SimpleSessionEvent(eventType, event.getData().getSession()));
+ }
+
+ private static class SimpleSessionEvent implements SessionEvent
+ {
+ private SessionEventType eventType;
+ private HttpSession session;
+
+ private SimpleSessionEvent(SessionEventType eventType, HttpSession session)
+ {
+ this.eventType = eventType;
+ this.session = session;
+ }
+
+ public SessionEventType getType()
+ {
+ return eventType;
+ }
+
+ public HttpSession getSession()
+ {
+ return session;
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java
===================================================================
--- portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,390 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2011, Red Hat Middleware, LLC, and individual
- * contributors as indicated by the @authors tag. See the
- * copyright.txt in the distribution for a full listing of
- * individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.integration.wsrp;
-
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.container.ExoContainerContext;
-import org.exoplatform.container.configuration.ConfigurationManager;
-import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.pc.ExoKernelIntegration;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator;
-import org.exoplatform.services.listener.ListenerService;
-import org.gatein.common.logging.Logger;
-import org.gatein.common.logging.LoggerFactory;
-import org.gatein.integration.wsrp.jcr.JCRPersister;
-import org.gatein.integration.wsrp.structure.MOPConsumerStructureProvider;
-import org.gatein.integration.wsrp.structure.MOPPortalStructureAccess;
-import org.gatein.integration.wsrp.structure.PortalStructureAccess;
-import org.gatein.pc.api.PortletInvoker;
-import org.gatein.pc.federation.FederatingPortletInvoker;
-import org.gatein.pc.portlet.PortletInvokerInterceptor;
-import org.gatein.pc.portlet.aspects.EventPayloadInterceptor;
-import org.gatein.pc.portlet.container.ContainerPortletInvoker;
-import org.gatein.pc.portlet.impl.state.StateConverterV0;
-import org.gatein.pc.portlet.impl.state.StateManagementPolicyService;
-import org.gatein.pc.portlet.state.StateConverter;
-import org.gatein.pc.portlet.state.producer.PortletStatePersistenceManager;
-import org.gatein.pc.portlet.state.producer.ProducerPortletInvoker;
-import org.gatein.registration.RegistrationManager;
-import org.gatein.registration.RegistrationPersistenceManager;
-import org.gatein.registration.impl.RegistrationManagerImpl;
-import org.gatein.wci.ServletContainer;
-import org.gatein.wci.ServletContainerFactory;
-import org.gatein.wci.WebApp;
-import org.gatein.wci.WebAppEvent;
-import org.gatein.wci.WebAppLifeCycleEvent;
-import org.gatein.wci.WebAppListener;
-import org.gatein.wci.impl.DefaultServletContainerFactory;
-import org.gatein.wsrp.WSRPConstants;
-import org.gatein.wsrp.consumer.migration.JCRMigrationService;
-import org.gatein.wsrp.consumer.migration.MigrationService;
-import org.gatein.wsrp.consumer.registry.ActivatingNullInvokerHandler;
-import org.gatein.wsrp.consumer.registry.ConsumerRegistry;
-import org.gatein.wsrp.consumer.registry.JCRConsumerRegistry;
-import org.gatein.wsrp.payload.WSRPEventPayloadInterceptor;
-import org.gatein.wsrp.producer.ProducerHolder;
-import org.gatein.wsrp.producer.WSRPProducer;
-import org.gatein.wsrp.producer.config.JCRProducerConfigurationService;
-import org.gatein.wsrp.producer.config.ProducerConfigurationService;
-import org.gatein.wsrp.producer.invoker.RegistrationCheckingPortletInvoker;
-import org.gatein.wsrp.producer.state.JCRPortletStatePersistenceManager;
-import org.gatein.wsrp.registration.JCRRegistrationPersistenceManager;
-import org.picocontainer.Startable;
-
-import javax.servlet.ServletContext;
-import java.io.InputStream;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class WSRPServiceIntegration implements Startable, WebAppListener
-{
- private static final Logger log = LoggerFactory.getLogger(WSRPServiceIntegration.class);
-
- private static final String CLASSPATH = "classpath:/";
- private static final String PRODUCER_CONFIG_LOCATION = "producerConfigLocation";
- private static final String CONSUMERS_CONFIG_LOCATION = "consumersConfigLocation";
-
- private final InputStream configurationIS;
- private final String producerConfigLocation;
- private WSRPProducer producer;
-
- private ConsumerRegistry consumerRegistry;
- private ExoContainer container;
- private final ExoKernelIntegration exoKernelIntegration;
- private final boolean bypass;
- private static final String WSRP_ADMIN_GUI_CONTEXT_PATH = "/wsrp-admin-gui";
-
- public WSRPServiceIntegration(ExoContainerContext context, InitParams params, ConfigurationManager configurationManager,
- ExoKernelIntegration pc, NodeHierarchyCreator nhc) throws Exception
- {
- // IMPORTANT: even though NodeHierarchyCreator is not used anywhere in the code, it's still needed for pico
- // to properly make sure that this service is started after the PC one. Yes, Pico is crap. :/
-
- // todo: we currently only allow the service to go through initialization if we are running in the default portal
- // as this service is not meant to work with extensions yet...
- String consumersConfigLocation;
- if ("portal".equals(context.getName()))
- {
- if (params != null)
- {
- producerConfigLocation = params.getValueParam(PRODUCER_CONFIG_LOCATION).getValue();
- consumersConfigLocation = params.getValueParam(CONSUMERS_CONFIG_LOCATION).getValue();
- }
- else
- {
- throw new IllegalArgumentException("Improperly configured service: missing values for "
- + PRODUCER_CONFIG_LOCATION + "and " + CONSUMERS_CONFIG_LOCATION);
- }
-
- configurationIS = configurationManager.getInputStream(CLASSPATH + producerConfigLocation);
-
- container = context.getContainer();
-
- exoKernelIntegration = pc;
-
- bypass = false;
- }
- else
- {
- log.info("The WSRP service can only be started in the default portal context. WSRP was not started for '"
- + context.getName() + "'");
-
- producerConfigLocation = null;
- consumersConfigLocation = null;
- configurationIS = null;
- exoKernelIntegration = null;
- bypass = true;
- }
- }
-
- public void start()
- {
- if (!bypass)
- {
- startProducer();
- startConsumers();
-
- // listen for web app events so that we can inject services into WSRP admin UI "cleanly"
- // todo: this service injection should really be done using CDI... :/
- ServletContainerFactory factory = DefaultServletContainerFactory.getInstance();
- ServletContainer servletContainer = factory.getServletContainer();
- servletContainer.addWebAppListener(this);
-
- log.info("WSRP Service version '" + WSRPConstants.WSRP_SERVICE_VERSION + "' started");
- }
- }
-
- private void startProducer()
- {
-
- JCRProducerConfigurationService producerConfigurationService;
- try
- {
- JCRPersister persister = new JCRPersister(container, JCRPersister.WSRP_WORKSPACE_NAME);
- persister.initializeBuilderFor(JCRProducerConfigurationService.mappingClasses);
-
- producerConfigurationService = new JCRProducerConfigurationService(persister);
- producerConfigurationService.setDefaultConfigurationIS(configurationIS);
- producerConfigurationService.reloadConfiguration();
- }
- catch (Exception e)
- {
- throw new RuntimeException("Couldn't load WSRP producer configuration from " + producerConfigLocation, e);
- }
- container.registerComponentInstance(ProducerConfigurationService.class, producerConfigurationService);
-
- RegistrationPersistenceManager registrationPersistenceManager;
- try
- {
- JCRPersister persister = new JCRPersister(container, JCRPersister.WSRP_WORKSPACE_NAME);
- persister.initializeBuilderFor(JCRRegistrationPersistenceManager.mappingClasses);
-
- registrationPersistenceManager = new JCRRegistrationPersistenceManager(persister);
- }
- catch (Exception e)
- {
- throw new RuntimeException("Couldn't instantiate RegistrationPersistenceManager", e);
- }
- RegistrationManager registrationManager = new RegistrationManagerImpl();
- registrationManager.setPersistenceManager(registrationPersistenceManager);
-
- // retrieve container portlet invoker from eXo kernel
- ContainerPortletInvoker containerPortletInvoker =
- (ContainerPortletInvoker)container.getComponentInstanceOfType(ContainerPortletInvoker.class);
-
- // iterate over the container stack so that we can insert the WSRP-specific event payload interceptor
- PortletInvokerInterceptor previous = containerPortletInvoker;
- PortletInvokerInterceptor next = previous;
- do
- {
- PortletInvoker invoker = previous.getNext();
- if (invoker instanceof EventPayloadInterceptor)
- {
- // create a new WSRPEventPayloadInterceptor and make its next one the current event payload invoker
- WSRPEventPayloadInterceptor eventPayloadInterceptor = new WSRPEventPayloadInterceptor();
- eventPayloadInterceptor.setNext(invoker);
-
- // replace the current event payload interceptor by the WSRP-specific one
- previous.setNext(eventPayloadInterceptor);
-
- // we're done
- break;
- }
- else
- {
- previous = next;
- if (invoker instanceof PortletInvokerInterceptor)
- {
- next = (PortletInvokerInterceptor)invoker;
- }
- else
- {
- next = null;
- }
- }
- }
- while (next != null);
-
- // The producer persistence manager
- PortletStatePersistenceManager producerPersistenceManager;
- try
- {
- JCRPersister persister = new JCRPersister(container, JCRPersister.PORTLET_STATES_WORKSPACE_NAME);
- persister.initializeBuilderFor(JCRPortletStatePersistenceManager.mappingClasses);
-
- producerPersistenceManager = new JCRPortletStatePersistenceManager(persister);
- }
- catch (Exception e)
- {
- throw new RuntimeException("Couldn't instantiate PortletStatePersistenceManager", e);
- }
-
- // The producer state management policy
- StateManagementPolicyService producerStateManagementPolicy = new StateManagementPolicyService();
- producerStateManagementPolicy.setPersistLocally(true);
-
- // The producer state converter
- StateConverter producerStateConverter = new StateConverterV0();
-
- // The producer portlet invoker
- ProducerPortletInvoker producerPortletInvoker = new ProducerPortletInvoker();
- producerPortletInvoker.setNext(containerPortletInvoker);
- producerPortletInvoker.setPersistenceManager(producerPersistenceManager);
- producerPortletInvoker.setStateManagementPolicy(producerStateManagementPolicy);
- producerPortletInvoker.setStateConverter(producerStateConverter);
-
- RegistrationCheckingPortletInvoker wsrpPortletInvoker = new RegistrationCheckingPortletInvoker();
- wsrpPortletInvoker.setNext(producerPortletInvoker);
- wsrpPortletInvoker.setRegistrationManager(registrationManager);
-
-
- // create and wire WSRP producer
- producer = ProducerHolder.getProducer(true);
- producer.setPortletInvoker(wsrpPortletInvoker);
- producer.setRegistrationManager(registrationManager);
- producer.setConfigurationService(producerConfigurationService);
- exoKernelIntegration.getPortletApplicationRegistry().addListener(producer);
-
- producer.start();
- }
-
- private void startConsumers()
- {
- // retrieve federating portlet invoker from container
- FederatingPortletInvoker federatingPortletInvoker =
- (FederatingPortletInvoker)container.getComponentInstanceOfType(FederatingPortletInvoker.class);
-
- // add our Session event listener to the ListenerService for use in org.exoplatform.web.GenericHttpListener
- ListenerService listenerService = (ListenerService)container.getComponentInstanceOfType(ListenerService.class);
- SessionEventListenerAndBroadcaster sessionEventBroadcaster = new SessionEventListenerAndBroadcaster();
-
- // events from org.exoplatform.web.GenericHttpListener
- listenerService.addListener("org.exoplatform.web.GenericHttpListener.sessionCreated", sessionEventBroadcaster);
- listenerService.addListener("org.exoplatform.web.GenericHttpListener.sessionDestroyed", sessionEventBroadcaster);
-
- try
- {
- JCRPersister persister = new JCRPersister(container, JCRPersister.WSRP_WORKSPACE_NAME);
- persister.initializeBuilderFor(JCRConsumerRegistry.mappingClasses);
-
- consumerRegistry = new JCRConsumerRegistry(persister);
- consumerRegistry.setFederatingPortletInvoker(federatingPortletInvoker);
- consumerRegistry.setSessionEventBroadcaster(sessionEventBroadcaster);
-
- // create ConsumerStructureProvider and register it to listen to page events
- POMSessionManager sessionManager = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
- PortalStructureAccess structureAccess = new MOPPortalStructureAccess(sessionManager);
- MOPConsumerStructureProvider structureprovider = new MOPConsumerStructureProvider(structureAccess);
- listenerService.addListener(DataStorage.PAGE_CREATED, structureprovider);
- listenerService.addListener(DataStorage.PAGE_REMOVED, structureprovider);
- listenerService.addListener(DataStorage.PAGE_UPDATED, structureprovider);
-
- // migration service
- persister = new JCRPersister(container, JCRPersister.WSRP_WORKSPACE_NAME);
- persister.initializeBuilderFor(JCRMigrationService.mappingClasses);
-
- MigrationService migrationService = new JCRMigrationService(persister);
- migrationService.setStructureProvider(structureprovider);
- consumerRegistry.setMigrationService(migrationService);
-
- consumerRegistry.start();
-
- // set up a NullInvokerHandler so that when a remote producer is queried, we can start it if needed
- ActivatingNullInvokerHandler handler = new ActivatingNullInvokerHandler();
- handler.setConsumerRegistry(consumerRegistry);
- federatingPortletInvoker.setNullInvokerHandler(handler);
- }
- catch (Exception e)
- {
- throw new RuntimeException("Couldn't start WSRP consumers registry.", e);
- }
- container.registerComponentInstance(ConsumerRegistry.class, consumerRegistry);
- }
-
- public void stop()
- {
- if (!bypass)
- {
- // stop listening to web app events
- ServletContainerFactory factory = DefaultServletContainerFactory.getInstance();
- ServletContainer servletContainer = factory.getServletContainer();
- servletContainer.removeWebAppListener(this);
-
- stopProducer();
- stopConsumers();
- }
- }
-
- private void stopProducer()
- {
- producer.stop();
-
- producer = null;
- }
-
- private void stopConsumers()
- {
- try
- {
- consumerRegistry.stop();
- }
- catch (Exception e)
- {
- throw new RuntimeException("Couldn't stop WSRP consumers registry.", e);
- }
-
- consumerRegistry = null;
- }
-
- public void onEvent(WebAppEvent event)
- {
- if (event instanceof WebAppLifeCycleEvent)
- {
- WebAppLifeCycleEvent lifeCycleEvent = (WebAppLifeCycleEvent)event;
- WebApp webApp = event.getWebApp();
- ServletContext context = webApp.getServletContext();
-
- // if we see the WSRP admin GUI being deployed or undeployed, inject or remove services
- if (WSRP_ADMIN_GUI_CONTEXT_PATH.equals(webApp.getContextPath()))
- {
- switch (lifeCycleEvent.getType())
- {
- case WebAppLifeCycleEvent.ADDED:
- context.setAttribute("ConsumerRegistry", consumerRegistry);
- context.setAttribute("ProducerConfigurationService", producer.getConfigurationService());
- break;
- case WebAppLifeCycleEvent.REMOVED:
- context.removeAttribute("ConsumerRegistry");
- context.removeAttribute("ProducerConfigurationService");
- break;
- }
- }
- }
- }
-
-}
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java (from rev 6033, portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,390 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.integration.wsrp;
+
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.container.configuration.ConfigurationManager;
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.pc.ExoKernelIntegration;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator;
+import org.exoplatform.services.listener.ListenerService;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
+import org.gatein.integration.wsrp.jcr.JCRPersister;
+import org.gatein.integration.wsrp.structure.MOPConsumerStructureProvider;
+import org.gatein.integration.wsrp.structure.MOPPortalStructureAccess;
+import org.gatein.integration.wsrp.structure.PortalStructureAccess;
+import org.gatein.pc.api.PortletInvoker;
+import org.gatein.pc.federation.FederatingPortletInvoker;
+import org.gatein.pc.portlet.PortletInvokerInterceptor;
+import org.gatein.pc.portlet.aspects.EventPayloadInterceptor;
+import org.gatein.pc.portlet.container.ContainerPortletInvoker;
+import org.gatein.pc.portlet.impl.state.StateConverterV0;
+import org.gatein.pc.portlet.impl.state.StateManagementPolicyService;
+import org.gatein.pc.portlet.state.StateConverter;
+import org.gatein.pc.portlet.state.producer.PortletStatePersistenceManager;
+import org.gatein.pc.portlet.state.producer.ProducerPortletInvoker;
+import org.gatein.registration.RegistrationManager;
+import org.gatein.registration.RegistrationPersistenceManager;
+import org.gatein.registration.impl.RegistrationManagerImpl;
+import org.gatein.wci.ServletContainer;
+import org.gatein.wci.ServletContainerFactory;
+import org.gatein.wci.WebApp;
+import org.gatein.wci.WebAppEvent;
+import org.gatein.wci.WebAppLifeCycleEvent;
+import org.gatein.wci.WebAppListener;
+import org.gatein.wci.impl.DefaultServletContainerFactory;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.consumer.migration.JCRMigrationService;
+import org.gatein.wsrp.consumer.migration.MigrationService;
+import org.gatein.wsrp.consumer.registry.ActivatingNullInvokerHandler;
+import org.gatein.wsrp.consumer.registry.ConsumerRegistry;
+import org.gatein.wsrp.consumer.registry.JCRConsumerRegistry;
+import org.gatein.wsrp.payload.WSRPEventPayloadInterceptor;
+import org.gatein.wsrp.producer.ProducerHolder;
+import org.gatein.wsrp.producer.WSRPProducer;
+import org.gatein.wsrp.producer.config.JCRProducerConfigurationService;
+import org.gatein.wsrp.producer.config.ProducerConfigurationService;
+import org.gatein.wsrp.producer.invoker.RegistrationCheckingPortletInvoker;
+import org.gatein.wsrp.producer.state.JCRPortletStatePersistenceManager;
+import org.gatein.wsrp.registration.JCRRegistrationPersistenceManager;
+import org.picocontainer.Startable;
+
+import javax.servlet.ServletContext;
+import java.io.InputStream;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class WSRPServiceIntegration implements Startable, WebAppListener
+{
+ private static final Logger log = LoggerFactory.getLogger(WSRPServiceIntegration.class);
+
+ private static final String CLASSPATH = "classpath:/";
+ private static final String PRODUCER_CONFIG_LOCATION = "producerConfigLocation";
+ private static final String CONSUMERS_CONFIG_LOCATION = "consumersConfigLocation";
+
+ private final InputStream configurationIS;
+ private final String producerConfigLocation;
+ private WSRPProducer producer;
+
+ private ConsumerRegistry consumerRegistry;
+ private ExoContainer container;
+ private final ExoKernelIntegration exoKernelIntegration;
+ private final boolean bypass;
+ private static final String WSRP_ADMIN_GUI_CONTEXT_PATH = "/wsrp-admin-gui";
+
+ public WSRPServiceIntegration(ExoContainerContext context, InitParams params, ConfigurationManager configurationManager,
+ ExoKernelIntegration pc, NodeHierarchyCreator nhc) throws Exception
+ {
+ // IMPORTANT: even though NodeHierarchyCreator is not used anywhere in the code, it's still needed for pico
+ // to properly make sure that this service is started after the PC one. Yes, Pico is crap. :/
+
+ // todo: we currently only allow the service to go through initialization if we are running in the default portal
+ // as this service is not meant to work with extensions yet...
+ String consumersConfigLocation;
+ if ("portal".equals(context.getName()))
+ {
+ if (params != null)
+ {
+ producerConfigLocation = params.getValueParam(PRODUCER_CONFIG_LOCATION).getValue();
+ consumersConfigLocation = params.getValueParam(CONSUMERS_CONFIG_LOCATION).getValue();
+ }
+ else
+ {
+ throw new IllegalArgumentException("Improperly configured service: missing values for "
+ + PRODUCER_CONFIG_LOCATION + "and " + CONSUMERS_CONFIG_LOCATION);
+ }
+
+ configurationIS = configurationManager.getInputStream(CLASSPATH + producerConfigLocation);
+
+ container = context.getContainer();
+
+ exoKernelIntegration = pc;
+
+ bypass = false;
+ }
+ else
+ {
+ log.info("The WSRP service can only be started in the default portal context. WSRP was not started for '"
+ + context.getName() + "'");
+
+ producerConfigLocation = null;
+ consumersConfigLocation = null;
+ configurationIS = null;
+ exoKernelIntegration = null;
+ bypass = true;
+ }
+ }
+
+ public void start()
+ {
+ if (!bypass)
+ {
+ startProducer();
+ startConsumers();
+
+ // listen for web app events so that we can inject services into WSRP admin UI "cleanly"
+ // todo: this service injection should really be done using CDI... :/
+ ServletContainerFactory factory = DefaultServletContainerFactory.getInstance();
+ ServletContainer servletContainer = factory.getServletContainer();
+ servletContainer.addWebAppListener(this);
+
+ log.info("WSRP Service version '" + WSRPConstants.WSRP_SERVICE_VERSION + "' started");
+ }
+ }
+
+ private void startProducer()
+ {
+
+ JCRProducerConfigurationService producerConfigurationService;
+ try
+ {
+ JCRPersister persister = new JCRPersister(container, JCRPersister.WSRP_WORKSPACE_NAME);
+ persister.initializeBuilderFor(JCRProducerConfigurationService.mappingClasses);
+
+ producerConfigurationService = new JCRProducerConfigurationService(persister);
+ producerConfigurationService.setDefaultConfigurationIS(configurationIS);
+ producerConfigurationService.reloadConfiguration();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Couldn't load WSRP producer configuration from " + producerConfigLocation, e);
+ }
+ container.registerComponentInstance(ProducerConfigurationService.class, producerConfigurationService);
+
+ RegistrationPersistenceManager registrationPersistenceManager;
+ try
+ {
+ JCRPersister persister = new JCRPersister(container, JCRPersister.WSRP_WORKSPACE_NAME);
+ persister.initializeBuilderFor(JCRRegistrationPersistenceManager.mappingClasses);
+
+ registrationPersistenceManager = new JCRRegistrationPersistenceManager(persister);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Couldn't instantiate RegistrationPersistenceManager", e);
+ }
+ RegistrationManager registrationManager = new RegistrationManagerImpl();
+ registrationManager.setPersistenceManager(registrationPersistenceManager);
+
+ // retrieve container portlet invoker from eXo kernel
+ ContainerPortletInvoker containerPortletInvoker =
+ (ContainerPortletInvoker)container.getComponentInstanceOfType(ContainerPortletInvoker.class);
+
+ // iterate over the container stack so that we can insert the WSRP-specific event payload interceptor
+ PortletInvokerInterceptor previous = containerPortletInvoker;
+ PortletInvokerInterceptor next = previous;
+ do
+ {
+ PortletInvoker invoker = previous.getNext();
+ if (invoker instanceof EventPayloadInterceptor)
+ {
+ // create a new WSRPEventPayloadInterceptor and make its next one the current event payload invoker
+ WSRPEventPayloadInterceptor eventPayloadInterceptor = new WSRPEventPayloadInterceptor();
+ eventPayloadInterceptor.setNext(invoker);
+
+ // replace the current event payload interceptor by the WSRP-specific one
+ previous.setNext(eventPayloadInterceptor);
+
+ // we're done
+ break;
+ }
+ else
+ {
+ previous = next;
+ if (invoker instanceof PortletInvokerInterceptor)
+ {
+ next = (PortletInvokerInterceptor)invoker;
+ }
+ else
+ {
+ next = null;
+ }
+ }
+ }
+ while (next != null);
+
+ // The producer persistence manager
+ PortletStatePersistenceManager producerPersistenceManager;
+ try
+ {
+ JCRPersister persister = new JCRPersister(container, JCRPersister.PORTLET_STATES_WORKSPACE_NAME);
+ persister.initializeBuilderFor(JCRPortletStatePersistenceManager.mappingClasses);
+
+ producerPersistenceManager = new JCRPortletStatePersistenceManager(persister);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Couldn't instantiate PortletStatePersistenceManager", e);
+ }
+
+ // The producer state management policy
+ StateManagementPolicyService producerStateManagementPolicy = new StateManagementPolicyService();
+ producerStateManagementPolicy.setPersistLocally(true);
+
+ // The producer state converter
+ StateConverter producerStateConverter = new StateConverterV0();
+
+ // The producer portlet invoker
+ ProducerPortletInvoker producerPortletInvoker = new ProducerPortletInvoker();
+ producerPortletInvoker.setNext(containerPortletInvoker);
+ producerPortletInvoker.setPersistenceManager(producerPersistenceManager);
+ producerPortletInvoker.setStateManagementPolicy(producerStateManagementPolicy);
+ producerPortletInvoker.setStateConverter(producerStateConverter);
+
+ RegistrationCheckingPortletInvoker wsrpPortletInvoker = new RegistrationCheckingPortletInvoker();
+ wsrpPortletInvoker.setNext(producerPortletInvoker);
+ wsrpPortletInvoker.setRegistrationManager(registrationManager);
+
+
+ // create and wire WSRP producer
+ producer = ProducerHolder.getProducer(true);
+ producer.setPortletInvoker(wsrpPortletInvoker);
+ producer.setRegistrationManager(registrationManager);
+ producer.setConfigurationService(producerConfigurationService);
+ exoKernelIntegration.getPortletApplicationRegistry().addListener(producer);
+
+ producer.start();
+ }
+
+ private void startConsumers()
+ {
+ // retrieve federating portlet invoker from container
+ FederatingPortletInvoker federatingPortletInvoker =
+ (FederatingPortletInvoker)container.getComponentInstanceOfType(FederatingPortletInvoker.class);
+
+ // add our Session event listener to the ListenerService for use in org.exoplatform.web.GenericHttpListener
+ ListenerService listenerService = (ListenerService)container.getComponentInstanceOfType(ListenerService.class);
+ SessionEventListenerAndBroadcaster sessionEventBroadcaster = new SessionEventListenerAndBroadcaster();
+
+ // events from org.exoplatform.web.GenericHttpListener
+ listenerService.addListener("org.exoplatform.web.GenericHttpListener.sessionCreated", sessionEventBroadcaster);
+ listenerService.addListener("org.exoplatform.web.GenericHttpListener.sessionDestroyed", sessionEventBroadcaster);
+
+ try
+ {
+ JCRPersister persister = new JCRPersister(container, JCRPersister.WSRP_WORKSPACE_NAME);
+ persister.initializeBuilderFor(JCRConsumerRegistry.mappingClasses);
+
+ consumerRegistry = new JCRConsumerRegistry(persister);
+ consumerRegistry.setFederatingPortletInvoker(federatingPortletInvoker);
+ consumerRegistry.setSessionEventBroadcaster(sessionEventBroadcaster);
+
+ // create ConsumerStructureProvider and register it to listen to page events
+ POMSessionManager sessionManager = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ PortalStructureAccess structureAccess = new MOPPortalStructureAccess(sessionManager);
+ MOPConsumerStructureProvider structureprovider = new MOPConsumerStructureProvider(structureAccess);
+ listenerService.addListener(DataStorage.PAGE_CREATED, structureprovider);
+ listenerService.addListener(DataStorage.PAGE_REMOVED, structureprovider);
+ listenerService.addListener(DataStorage.PAGE_UPDATED, structureprovider);
+
+ // migration service
+ persister = new JCRPersister(container, JCRPersister.WSRP_WORKSPACE_NAME);
+ persister.initializeBuilderFor(JCRMigrationService.mappingClasses);
+
+ MigrationService migrationService = new JCRMigrationService(persister);
+ migrationService.setStructureProvider(structureprovider);
+ consumerRegistry.setMigrationService(migrationService);
+
+ consumerRegistry.start();
+
+ // set up a NullInvokerHandler so that when a remote producer is queried, we can start it if needed
+ ActivatingNullInvokerHandler handler = new ActivatingNullInvokerHandler();
+ handler.setConsumerRegistry(consumerRegistry);
+ federatingPortletInvoker.setNullInvokerHandler(handler);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Couldn't start WSRP consumers registry.", e);
+ }
+ container.registerComponentInstance(ConsumerRegistry.class, consumerRegistry);
+ }
+
+ public void stop()
+ {
+ if (!bypass)
+ {
+ // stop listening to web app events
+ ServletContainerFactory factory = DefaultServletContainerFactory.getInstance();
+ ServletContainer servletContainer = factory.getServletContainer();
+ servletContainer.removeWebAppListener(this);
+
+ stopProducer();
+ stopConsumers();
+ }
+ }
+
+ private void stopProducer()
+ {
+ producer.stop();
+
+ producer = null;
+ }
+
+ private void stopConsumers()
+ {
+ try
+ {
+ consumerRegistry.stop();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Couldn't stop WSRP consumers registry.", e);
+ }
+
+ consumerRegistry = null;
+ }
+
+ public void onEvent(WebAppEvent event)
+ {
+ if (event instanceof WebAppLifeCycleEvent)
+ {
+ WebAppLifeCycleEvent lifeCycleEvent = (WebAppLifeCycleEvent)event;
+ WebApp webApp = event.getWebApp();
+ ServletContext context = webApp.getServletContext();
+
+ // if we see the WSRP admin GUI being deployed or undeployed, inject or remove services
+ if (WSRP_ADMIN_GUI_CONTEXT_PATH.equals(webApp.getContextPath()))
+ {
+ switch (lifeCycleEvent.getType())
+ {
+ case WebAppLifeCycleEvent.ADDED:
+ context.setAttribute("ConsumerRegistry", consumerRegistry);
+ context.setAttribute("ProducerConfigurationService", producer.getConfigurationService());
+ break;
+ case WebAppLifeCycleEvent.REMOVED:
+ context.removeAttribute("ConsumerRegistry");
+ context.removeAttribute("ProducerConfigurationService");
+ break;
+ }
+ }
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/jcr
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/jcr/JCRPersister.java
===================================================================
--- portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/jcr/JCRPersister.java 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/jcr/JCRPersister.java 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,344 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2011, Red Hat Middleware, LLC, and individual
- * contributors as indicated by the @authors tag. See the
- * copyright.txt in the distribution for a full listing of
- * individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.integration.wsrp.jcr;
-
-import org.chromattic.api.Chromattic;
-import org.chromattic.api.ChromatticBuilder;
-import org.chromattic.api.ChromatticSession;
-import org.chromattic.api.format.FormatterContext;
-import org.chromattic.api.format.ObjectFormatter;
-import org.chromattic.spi.jcr.SessionLifeCycle;
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.container.ExoContainerContext;
-import org.exoplatform.services.jcr.RepositoryService;
-import org.exoplatform.services.jcr.core.ManageableRepository;
-import org.exoplatform.services.jcr.ext.common.SessionProvider;
-import org.gatein.common.util.ParameterValidation;
-import org.gatein.wsrp.jcr.ChromatticPersister;
-import org.gatein.wsrp.jcr.mapping.BaseMapping;
-
-import javax.jcr.Credentials;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class JCRPersister implements ChromatticPersister
-{
- private Chromattic chrome;
- public static final String WSRP_WORKSPACE_NAME = "wsrp-system";
- public static final String PORTLET_STATES_WORKSPACE_NAME = "pc-system";
- private static final String REPOSITORY_NAME = "repository";
- private String workspaceName;
- private Map<Class, Class<? extends BaseMapping>> modelToMapping;
-
- private ThreadLocal<ChromatticSession> sessionHolder = new ThreadLocal<ChromatticSession>();
-
- public JCRPersister(ExoContainer container, String workspaceName)
- {
- this.workspaceName = workspaceName;
- }
-
- public void initializeBuilderFor(List<Class> mappingClasses) throws Exception
- {
- ChromatticBuilder builder = ChromatticBuilder.create();
- builder.setOptionValue(ChromatticBuilder.INSTRUMENTOR_CLASSNAME, "org.chromattic.apt.InstrumentorImpl");
- if (PORTLET_STATES_WORKSPACE_NAME.equals(workspaceName))
- {
- builder.setOptionValue(ChromatticBuilder.SESSION_LIFECYCLE_CLASSNAME, PortletStatesSessionLifeCycle.class.getName());
- }
- else if (WSRP_WORKSPACE_NAME.equals(workspaceName))
- {
- builder.setOptionValue(ChromatticBuilder.SESSION_LIFECYCLE_CLASSNAME, WSRPSessionLifeCycle.class.getName());
- }
- else
- {
- throw new IllegalArgumentException("Unknown workspace name: '" + workspaceName + "'");
- }
-
- modelToMapping = new HashMap<Class, Class<? extends BaseMapping>>(mappingClasses.size());
- for (Class mappingClass : mappingClasses)
- {
- if (BaseMapping.class.isAssignableFrom(mappingClass))
- {
- Type[] interfaces = mappingClass.getGenericInterfaces();
- if (ParameterValidation.existsAndIsNotEmpty(interfaces))
- {
- Class type = (Class)((ParameterizedType)interfaces[0]).getActualTypeArguments()[0];
- modelToMapping.put(type, mappingClass);
- }
- }
- builder.add(mappingClass);
- }
-
- chrome = builder.build();
- }
-
- public ChromatticSession getSession()
- {
- ChromatticSession chromatticSession = sessionHolder.get();
- if (chromatticSession == null)
- {
- ChromatticSession session = chrome.openSession();
- sessionHolder.set(session);
- return session;
- }
- else
- {
- return chromatticSession;
- }
- }
-
- public void closeSession(boolean save)
- {
- ChromatticSession session = getOpenedSessionOrFail();
- if (save)
- {
- synchronized (this)
- {
- session.save();
- }
- }
- session.close();
- sessionHolder.set(null);
- }
-
- private ChromatticSession getOpenedSessionOrFail()
- {
- ChromatticSession session = sessionHolder.get();
- if (session == null)
- {
- throw new IllegalStateException("Cannot close the session as it hasn't been opened first!");
- }
- return session;
- }
-
- public synchronized void save()
- {
- getOpenedSessionOrFail().save();
- }
-
- public <T> boolean delete(T toDelete, org.gatein.wsrp.jcr.StoresByPathManager<T> manager)
- {
- Class<? extends Object> modelClass = toDelete.getClass();
- Class<? extends BaseMapping> baseMappingClass = modelToMapping.get(modelClass);
- if (baseMappingClass == null)
- {
- throw new IllegalArgumentException("Cannot find a mapping class for " + modelClass.getName());
- }
-
- ChromatticSession session = getSession();
-
- Object old = session.findByPath(baseMappingClass, manager.getChildPath(toDelete));
-
- if (old != null)
- {
- session.remove(old);
- closeSession(true);
- return true;
- }
- else
- {
- closeSession(false);
- return false;
- }
- }
-
- public static class WSRPSessionLifeCycle implements SessionLifeCycle
- {
- private ManageableRepository repository;
- private SessionProvider provider;
-
- public WSRPSessionLifeCycle()
- {
- try
- {
- ExoContainer container = ExoContainerContext.getCurrentContainer();
- RepositoryService repoService = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
- repository = repoService.getRepository(REPOSITORY_NAME);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
-
- provider = SessionProvider.createSystemProvider();
- }
-
- public Session login() throws RepositoryException
- {
- return provider.getSession(WSRP_WORKSPACE_NAME, repository);
- }
-
- public Session login(String s) throws RepositoryException
- {
- throw new UnsupportedOperationException();
- }
-
- public Session login(Credentials credentials, String s) throws RepositoryException
- {
- throw new UnsupportedOperationException();
- }
-
- public Session login(Credentials credentials) throws RepositoryException
- {
- throw new UnsupportedOperationException();
- }
-
- public void save(Session session) throws RepositoryException
- {
- session.save();
- }
-
- public void close(Session session)
- {
- session.logout();
- }
- }
-
- public static class PortletStatesSessionLifeCycle implements SessionLifeCycle
- {
- private ManageableRepository repository;
- private SessionProvider provider;
-
- public PortletStatesSessionLifeCycle()
- {
- try
- {
- ExoContainer container = ExoContainerContext.getCurrentContainer();
- RepositoryService repoService = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
- repository = repoService.getRepository(REPOSITORY_NAME);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
-
- provider = SessionProvider.createSystemProvider();
- }
-
- public Session login() throws RepositoryException
- {
- return provider.getSession(PORTLET_STATES_WORKSPACE_NAME, repository);
- }
-
- public Session login(String s) throws RepositoryException
- {
- throw new UnsupportedOperationException();
- }
-
- public Session login(Credentials credentials, String s) throws RepositoryException
- {
- throw new UnsupportedOperationException();
- }
-
- public Session login(Credentials credentials) throws RepositoryException
- {
- throw new UnsupportedOperationException();
- }
-
- public void save(Session session) throws RepositoryException
- {
- session.save();
- }
-
- public void close(Session session)
- {
- session.logout();
- }
- }
-
- public static class QNameFormatter implements ObjectFormatter
- {
- private static final String OPEN_BRACE_REPLACEMENT = "-__";
- private static final String CLOSE_BRACE_REPLACEMENT = "__-";
- private static final String COLON_REPLACEMENT = "_-_";
- private static final String CLOSE_BRACE = "}";
- private static final String OPEN_BRACE = "{";
- private static final String COLON = ":";
-
- public String decodeNodeName(FormatterContext formatterContext, String s)
- {
- return decode(s);
- }
-
- public String encodeNodeName(FormatterContext formatterContext, String s)
- {
- return encode(s);
- }
-
- public String decodePropertyName(FormatterContext formatterContext, String s)
- {
- return decode(s);
- }
-
- public String encodePropertyName(FormatterContext formatterContext, String s)
- {
- return encode(s);
- }
-
- public static String decode(String s)
- {
- return s.replace(CLOSE_BRACE_REPLACEMENT, CLOSE_BRACE).replace(OPEN_BRACE_REPLACEMENT, OPEN_BRACE).replace(COLON_REPLACEMENT, COLON);
- }
-
- public static String encode(String s)
- {
- return s.replace(OPEN_BRACE, OPEN_BRACE_REPLACEMENT).replace(CLOSE_BRACE, CLOSE_BRACE_REPLACEMENT).replace(COLON, COLON_REPLACEMENT);
- }
- }
-
- public static class PortletNameFormatter implements ObjectFormatter
- {
- public static final String SLASH_REPLACEMENT = "-_-";
- private static final String SLASH = "/";
-
- public String decodeNodeName(FormatterContext formatterContext, String s)
- {
- return decode(s);
- }
-
- public static String decode(String s)
- {
- return s.replace(SLASH_REPLACEMENT, SLASH);
- }
-
- public String encodeNodeName(FormatterContext formatterContext, String s) throws IllegalArgumentException, NullPointerException
- {
- return encode(s);
- }
-
- public static String encode(String s)
- {
- return s.replace(SLASH, SLASH_REPLACEMENT);
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/jcr/JCRPersister.java (from rev 6033, portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/jcr/JCRPersister.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/jcr/JCRPersister.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/jcr/JCRPersister.java 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,344 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.integration.wsrp.jcr;
+
+import org.chromattic.api.Chromattic;
+import org.chromattic.api.ChromatticBuilder;
+import org.chromattic.api.ChromatticSession;
+import org.chromattic.api.format.FormatterContext;
+import org.chromattic.api.format.ObjectFormatter;
+import org.chromattic.spi.jcr.SessionLifeCycle;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.services.jcr.RepositoryService;
+import org.exoplatform.services.jcr.core.ManageableRepository;
+import org.exoplatform.services.jcr.ext.common.SessionProvider;
+import org.gatein.common.util.ParameterValidation;
+import org.gatein.wsrp.jcr.ChromatticPersister;
+import org.gatein.wsrp.jcr.mapping.BaseMapping;
+
+import javax.jcr.Credentials;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class JCRPersister implements ChromatticPersister
+{
+ private Chromattic chrome;
+ public static final String WSRP_WORKSPACE_NAME = "wsrp-system";
+ public static final String PORTLET_STATES_WORKSPACE_NAME = "pc-system";
+ private static final String REPOSITORY_NAME = "repository";
+ private String workspaceName;
+ private Map<Class, Class<? extends BaseMapping>> modelToMapping;
+
+ private ThreadLocal<ChromatticSession> sessionHolder = new ThreadLocal<ChromatticSession>();
+
+ public JCRPersister(ExoContainer container, String workspaceName)
+ {
+ this.workspaceName = workspaceName;
+ }
+
+ public void initializeBuilderFor(List<Class> mappingClasses) throws Exception
+ {
+ ChromatticBuilder builder = ChromatticBuilder.create();
+ builder.setOptionValue(ChromatticBuilder.INSTRUMENTOR_CLASSNAME, "org.chromattic.apt.InstrumentorImpl");
+ if (PORTLET_STATES_WORKSPACE_NAME.equals(workspaceName))
+ {
+ builder.setOptionValue(ChromatticBuilder.SESSION_LIFECYCLE_CLASSNAME, PortletStatesSessionLifeCycle.class.getName());
+ }
+ else if (WSRP_WORKSPACE_NAME.equals(workspaceName))
+ {
+ builder.setOptionValue(ChromatticBuilder.SESSION_LIFECYCLE_CLASSNAME, WSRPSessionLifeCycle.class.getName());
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unknown workspace name: '" + workspaceName + "'");
+ }
+
+ modelToMapping = new HashMap<Class, Class<? extends BaseMapping>>(mappingClasses.size());
+ for (Class mappingClass : mappingClasses)
+ {
+ if (BaseMapping.class.isAssignableFrom(mappingClass))
+ {
+ Type[] interfaces = mappingClass.getGenericInterfaces();
+ if (ParameterValidation.existsAndIsNotEmpty(interfaces))
+ {
+ Class type = (Class)((ParameterizedType)interfaces[0]).getActualTypeArguments()[0];
+ modelToMapping.put(type, mappingClass);
+ }
+ }
+ builder.add(mappingClass);
+ }
+
+ chrome = builder.build();
+ }
+
+ public ChromatticSession getSession()
+ {
+ ChromatticSession chromatticSession = sessionHolder.get();
+ if (chromatticSession == null)
+ {
+ ChromatticSession session = chrome.openSession();
+ sessionHolder.set(session);
+ return session;
+ }
+ else
+ {
+ return chromatticSession;
+ }
+ }
+
+ public void closeSession(boolean save)
+ {
+ ChromatticSession session = getOpenedSessionOrFail();
+ if (save)
+ {
+ synchronized (this)
+ {
+ session.save();
+ }
+ }
+ session.close();
+ sessionHolder.set(null);
+ }
+
+ private ChromatticSession getOpenedSessionOrFail()
+ {
+ ChromatticSession session = sessionHolder.get();
+ if (session == null)
+ {
+ throw new IllegalStateException("Cannot close the session as it hasn't been opened first!");
+ }
+ return session;
+ }
+
+ public synchronized void save()
+ {
+ getOpenedSessionOrFail().save();
+ }
+
+ public <T> boolean delete(T toDelete, org.gatein.wsrp.jcr.StoresByPathManager<T> manager)
+ {
+ Class<? extends Object> modelClass = toDelete.getClass();
+ Class<? extends BaseMapping> baseMappingClass = modelToMapping.get(modelClass);
+ if (baseMappingClass == null)
+ {
+ throw new IllegalArgumentException("Cannot find a mapping class for " + modelClass.getName());
+ }
+
+ ChromatticSession session = getSession();
+
+ Object old = session.findByPath(baseMappingClass, manager.getChildPath(toDelete));
+
+ if (old != null)
+ {
+ session.remove(old);
+ closeSession(true);
+ return true;
+ }
+ else
+ {
+ closeSession(false);
+ return false;
+ }
+ }
+
+ public static class WSRPSessionLifeCycle implements SessionLifeCycle
+ {
+ private ManageableRepository repository;
+ private SessionProvider provider;
+
+ public WSRPSessionLifeCycle()
+ {
+ try
+ {
+ ExoContainer container = ExoContainerContext.getCurrentContainer();
+ RepositoryService repoService = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
+ repository = repoService.getRepository(REPOSITORY_NAME);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ provider = SessionProvider.createSystemProvider();
+ }
+
+ public Session login() throws RepositoryException
+ {
+ return provider.getSession(WSRP_WORKSPACE_NAME, repository);
+ }
+
+ public Session login(String s) throws RepositoryException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Session login(Credentials credentials, String s) throws RepositoryException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Session login(Credentials credentials) throws RepositoryException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void save(Session session) throws RepositoryException
+ {
+ session.save();
+ }
+
+ public void close(Session session)
+ {
+ session.logout();
+ }
+ }
+
+ public static class PortletStatesSessionLifeCycle implements SessionLifeCycle
+ {
+ private ManageableRepository repository;
+ private SessionProvider provider;
+
+ public PortletStatesSessionLifeCycle()
+ {
+ try
+ {
+ ExoContainer container = ExoContainerContext.getCurrentContainer();
+ RepositoryService repoService = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
+ repository = repoService.getRepository(REPOSITORY_NAME);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ provider = SessionProvider.createSystemProvider();
+ }
+
+ public Session login() throws RepositoryException
+ {
+ return provider.getSession(PORTLET_STATES_WORKSPACE_NAME, repository);
+ }
+
+ public Session login(String s) throws RepositoryException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Session login(Credentials credentials, String s) throws RepositoryException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Session login(Credentials credentials) throws RepositoryException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void save(Session session) throws RepositoryException
+ {
+ session.save();
+ }
+
+ public void close(Session session)
+ {
+ session.logout();
+ }
+ }
+
+ public static class QNameFormatter implements ObjectFormatter
+ {
+ private static final String OPEN_BRACE_REPLACEMENT = "-__";
+ private static final String CLOSE_BRACE_REPLACEMENT = "__-";
+ private static final String COLON_REPLACEMENT = "_-_";
+ private static final String CLOSE_BRACE = "}";
+ private static final String OPEN_BRACE = "{";
+ private static final String COLON = ":";
+
+ public String decodeNodeName(FormatterContext formatterContext, String s)
+ {
+ return decode(s);
+ }
+
+ public String encodeNodeName(FormatterContext formatterContext, String s)
+ {
+ return encode(s);
+ }
+
+ public String decodePropertyName(FormatterContext formatterContext, String s)
+ {
+ return decode(s);
+ }
+
+ public String encodePropertyName(FormatterContext formatterContext, String s)
+ {
+ return encode(s);
+ }
+
+ public static String decode(String s)
+ {
+ return s.replace(CLOSE_BRACE_REPLACEMENT, CLOSE_BRACE).replace(OPEN_BRACE_REPLACEMENT, OPEN_BRACE).replace(COLON_REPLACEMENT, COLON);
+ }
+
+ public static String encode(String s)
+ {
+ return s.replace(OPEN_BRACE, OPEN_BRACE_REPLACEMENT).replace(CLOSE_BRACE, CLOSE_BRACE_REPLACEMENT).replace(COLON, COLON_REPLACEMENT);
+ }
+ }
+
+ public static class PortletNameFormatter implements ObjectFormatter
+ {
+ public static final String SLASH_REPLACEMENT = "-_-";
+ private static final String SLASH = "/";
+
+ public String decodeNodeName(FormatterContext formatterContext, String s)
+ {
+ return decode(s);
+ }
+
+ public static String decode(String s)
+ {
+ return s.replace(SLASH_REPLACEMENT, SLASH);
+ }
+
+ public String encodeNodeName(FormatterContext formatterContext, String s) throws IllegalArgumentException, NullPointerException
+ {
+ return encode(s);
+ }
+
+ public static String encode(String s)
+ {
+ return s.replace(SLASH, SLASH_REPLACEMENT);
+ }
+ }
+}
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPConsumerStructureProvider.java
===================================================================
--- portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPConsumerStructureProvider.java 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPConsumerStructureProvider.java 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,308 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2011, Red Hat Middleware, LLC, and individual
- * contributors as indicated by the @authors tag. See the
- * copyright.txt in the distribution for a full listing of
- * individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.integration.wsrp.structure;
-
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.mop.Described;
-import org.exoplatform.portal.pom.spi.wsrp.WSRP;
-import org.exoplatform.services.listener.Event;
-import org.exoplatform.services.listener.Listener;
-import org.gatein.common.util.ParameterValidation;
-import org.gatein.mop.api.content.Customization;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Page;
-import org.gatein.mop.api.workspace.ui.UIComponent;
-import org.gatein.mop.api.workspace.ui.UIContainer;
-import org.gatein.mop.api.workspace.ui.UIWindow;
-import org.gatein.pc.api.PortletContext;
-import org.gatein.pc.api.PortletStateType;
-import org.gatein.pc.api.StatefulPortletContext;
-import org.gatein.wsrp.api.context.ConsumerStructureProvider;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class MOPConsumerStructureProvider extends Listener<DataStorage, org.exoplatform.portal.config.model.Page> implements ConsumerStructureProvider
-{
- private final PortalStructureAccess structureAccess;
- private Map<String, PageInfo> pageInfos;
- private boolean pagesHaveBeenInitialized;
-
- public MOPConsumerStructureProvider(PortalStructureAccess structureAccess)
- {
- ParameterValidation.throwIllegalArgExceptionIfNull(structureAccess, "PortalStructureAccess");
-
- this.structureAccess = structureAccess;
- pageInfos = new HashMap<String, PageInfo>();
- }
-
- public List<String> getPageIdentifiers()
- {
- if (!pagesHaveBeenInitialized)
- {
- // initialize page information
- Collection<Page> pages = structureAccess.getPages();
- for (Page page : pages)
- {
- addPage(page);
- }
-
- pagesHaveBeenInitialized = true;
- }
-
- LinkedList<String> identifiers = new LinkedList<String>(pageInfos.keySet());
- Collections.sort(identifiers);
- return identifiers;
- }
-
- private void addPage(Page page)
- {
- Described described = page.adapt(Described.class);
- PageInfo pageInfo = new PageInfo(page.getObjectId(), described.getName(), page.getName());
- pageInfos.put(pageInfo.getName(), pageInfo);
- UIContainer container = page.getRootComponent();
- processContainer(container, pageInfo);
-
- Collection<Page> children = page.getChildren();
- if (ParameterValidation.existsAndIsNotEmpty(children))
- {
- for (Page child : children)
- {
- addPage(child);
- }
- }
- }
-
- public List<String> getWindowIdentifiersFor(String pageId)
- {
- PageInfo pageInfo = pageInfos.get(pageId);
- if (pageInfo == null)
- {
- throw new IllegalArgumentException("Page '" + pageId + "' does not exist.");
- }
-
- return pageInfo.getChildrenWindows();
- }
-
- private void processContainer(UIContainer container, PageInfo pageInfo)
- {
- if (container != null)
- {
- List<UIComponent> components = container.getComponents();
- for (UIComponent component : components)
- {
- ObjectType<? extends UIComponent> type = component.getObjectType();
- if (ObjectType.WINDOW.equals(type))
- {
- Described described = component.adapt(Described.class);
- String name = described.getName();
-
- pageInfo.addWindow(name, component.getObjectId());
- }
- else if (ObjectType.CONTAINER.equals(type))
- {
- processContainer((UIContainer)component, pageInfo);
- }
- else
- {
- // ignore
- }
- }
- }
- }
-
- public void assignPortletToWindow(PortletContext portletContext, String windowId, String pageId, String exportedPortletHandle)
- {
- PageInfo pageInfo = pageInfos.get(pageId);
- String uuid = pageInfo.getWindowUUID(windowId);
- ParameterValidation.throwIllegalArgExceptionIfNull(uuid, "UUID for " + windowId);
-
- // get the window
- UIWindow window = structureAccess.getWindowFrom(uuid);
-
- // construct the new customization state
- WSRP wsrp = new WSRP();
- String portletId = portletContext.getId();
- wsrp.setPortletId(portletId);
- if (portletContext instanceof StatefulPortletContext)
- {
- StatefulPortletContext context = (StatefulPortletContext)portletContext;
- if (PortletStateType.OPAQUE.equals(context.getType()))
- {
- wsrp.setState((byte[])context.getState());
- }
- else
- {
- throw new IllegalArgumentException("Don't know how to deal with state: " + context.getState());
- }
- }
-
- // destroy existing customization as otherwise re-customizing will fail
- Customization<?> customization = window.getCustomization();
- customization.destroy();
-
- // and re-customize
- window.customize(WSRP.CONTENT_TYPE, portletId, wsrp);
-
- // Change the window's name so that it's less confusing to users
- Described described = window.adapt(Described.class);
- String newName = exportedPortletHandle + " (remote)";
- described.setName(newName); // should be the same as ApplicationRegistryService.REMOTE_DISPLAY_NAME_SUFFIX
-
- // update window mappings
- pageInfo.updateWindowName(windowId, newName);
-
- structureAccess.saveChangesTo(window);
- }
-
- @Override
- public void onEvent(Event<DataStorage, org.exoplatform.portal.config.model.Page> event) throws Exception
- {
- String eventName = event.getEventName();
-
- // get the MOP page from the event data
- org.exoplatform.portal.config.model.Page portalPage = event.getData();
- Page page = structureAccess.getPageFrom(portalPage);
-
- if (page == null && DataStorage.PAGE_REMOVED.equals(eventName))
- {
- // if we try to remove a page, when we get this event, the page has already been removed from JCR
- // so we need to work around that fact by retrieving the corresponding PageInfo from the portal page title
- // which should match the Described name and check that it matches the internal name before removing it
- removePage(portalPage.getTitle(), portalPage.getName());
-
- return;
- }
-
- if (page != null)
- {
- if (DataStorage.PAGE_CREATED.equals(eventName))
- {
- // add information for new page
- addPage(page);
- }
- else if (DataStorage.PAGE_UPDATED.equals(eventName))
- {
- removePage(page);
- addPage(page);
- }
- }
- }
-
- private void removePage(Page page)
- {
- Described described = page.adapt(Described.class);
- String name = described.getName();
-
- removePage(name, page.getName());
- }
-
- private void removePage(String name, String internalName)
- {
- PageInfo pageInfo = pageInfos.get(name);
- if (pageInfo != null && internalName.equals(pageInfo.getInternalName()))
- {
- // remove page info
- pageInfos.remove(name);
- }
- }
-
- private static class PageInfo
- {
- private final String uuid;
- private final Map<String, String> childrenWindows = new HashMap<String, String>();
-
- /** Name as provided by Described */
- private final String name;
-
- /** Name as automatically generated */
- private final String internalName;
-
- private PageInfo(String uuid, String name, String internalName)
- {
- this.uuid = uuid;
- this.name = name;
- this.internalName = internalName;
- }
-
- public String getUUID()
- {
- return uuid;
- }
-
- public String getInternalName()
- {
- return internalName;
- }
-
- public List<String> getChildrenWindows()
- {
- return new ArrayList<String>(childrenWindows.keySet());
- }
-
- public void addWindow(String windowName, String uuid)
- {
- // add suffix in case we have several windows with the same name in the page
- if (childrenWindows.containsKey(windowName))
- {
- if (windowName.endsWith("|"))
- {
- windowName += "|";
- }
- else
- {
- windowName += windowName + " |";
- }
- }
-
- childrenWindows.put(windowName, uuid);
- }
-
- public void updateWindowName(String oldWindowName, String newWindowName)
- {
- String windowUUID = getWindowUUID(oldWindowName);
- childrenWindows.remove(oldWindowName);
- childrenWindows.put(newWindowName, windowUUID);
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getWindowUUID(String windowId)
- {
- return childrenWindows.get(windowId);
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPConsumerStructureProvider.java (from rev 6033, portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPConsumerStructureProvider.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPConsumerStructureProvider.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPConsumerStructureProvider.java 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,308 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.integration.wsrp.structure;
+
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.mop.Described;
+import org.exoplatform.portal.pom.spi.wsrp.WSRP;
+import org.exoplatform.services.listener.Event;
+import org.exoplatform.services.listener.Listener;
+import org.gatein.common.util.ParameterValidation;
+import org.gatein.mop.api.content.Customization;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Page;
+import org.gatein.mop.api.workspace.ui.UIComponent;
+import org.gatein.mop.api.workspace.ui.UIContainer;
+import org.gatein.mop.api.workspace.ui.UIWindow;
+import org.gatein.pc.api.PortletContext;
+import org.gatein.pc.api.PortletStateType;
+import org.gatein.pc.api.StatefulPortletContext;
+import org.gatein.wsrp.api.context.ConsumerStructureProvider;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class MOPConsumerStructureProvider extends Listener<DataStorage, org.exoplatform.portal.config.model.Page> implements ConsumerStructureProvider
+{
+ private final PortalStructureAccess structureAccess;
+ private Map<String, PageInfo> pageInfos;
+ private boolean pagesHaveBeenInitialized;
+
+ public MOPConsumerStructureProvider(PortalStructureAccess structureAccess)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(structureAccess, "PortalStructureAccess");
+
+ this.structureAccess = structureAccess;
+ pageInfos = new HashMap<String, PageInfo>();
+ }
+
+ public List<String> getPageIdentifiers()
+ {
+ if (!pagesHaveBeenInitialized)
+ {
+ // initialize page information
+ Collection<Page> pages = structureAccess.getPages();
+ for (Page page : pages)
+ {
+ addPage(page);
+ }
+
+ pagesHaveBeenInitialized = true;
+ }
+
+ LinkedList<String> identifiers = new LinkedList<String>(pageInfos.keySet());
+ Collections.sort(identifiers);
+ return identifiers;
+ }
+
+ private void addPage(Page page)
+ {
+ Described described = page.adapt(Described.class);
+ PageInfo pageInfo = new PageInfo(page.getObjectId(), described.getName(), page.getName());
+ pageInfos.put(pageInfo.getName(), pageInfo);
+ UIContainer container = page.getRootComponent();
+ processContainer(container, pageInfo);
+
+ Collection<Page> children = page.getChildren();
+ if (ParameterValidation.existsAndIsNotEmpty(children))
+ {
+ for (Page child : children)
+ {
+ addPage(child);
+ }
+ }
+ }
+
+ public List<String> getWindowIdentifiersFor(String pageId)
+ {
+ PageInfo pageInfo = pageInfos.get(pageId);
+ if (pageInfo == null)
+ {
+ throw new IllegalArgumentException("Page '" + pageId + "' does not exist.");
+ }
+
+ return pageInfo.getChildrenWindows();
+ }
+
+ private void processContainer(UIContainer container, PageInfo pageInfo)
+ {
+ if (container != null)
+ {
+ List<UIComponent> components = container.getComponents();
+ for (UIComponent component : components)
+ {
+ ObjectType<? extends UIComponent> type = component.getObjectType();
+ if (ObjectType.WINDOW.equals(type))
+ {
+ Described described = component.adapt(Described.class);
+ String name = described.getName();
+
+ pageInfo.addWindow(name, component.getObjectId());
+ }
+ else if (ObjectType.CONTAINER.equals(type))
+ {
+ processContainer((UIContainer)component, pageInfo);
+ }
+ else
+ {
+ // ignore
+ }
+ }
+ }
+ }
+
+ public void assignPortletToWindow(PortletContext portletContext, String windowId, String pageId, String exportedPortletHandle)
+ {
+ PageInfo pageInfo = pageInfos.get(pageId);
+ String uuid = pageInfo.getWindowUUID(windowId);
+ ParameterValidation.throwIllegalArgExceptionIfNull(uuid, "UUID for " + windowId);
+
+ // get the window
+ UIWindow window = structureAccess.getWindowFrom(uuid);
+
+ // construct the new customization state
+ WSRP wsrp = new WSRP();
+ String portletId = portletContext.getId();
+ wsrp.setPortletId(portletId);
+ if (portletContext instanceof StatefulPortletContext)
+ {
+ StatefulPortletContext context = (StatefulPortletContext)portletContext;
+ if (PortletStateType.OPAQUE.equals(context.getType()))
+ {
+ wsrp.setState((byte[])context.getState());
+ }
+ else
+ {
+ throw new IllegalArgumentException("Don't know how to deal with state: " + context.getState());
+ }
+ }
+
+ // destroy existing customization as otherwise re-customizing will fail
+ Customization<?> customization = window.getCustomization();
+ customization.destroy();
+
+ // and re-customize
+ window.customize(WSRP.CONTENT_TYPE, portletId, wsrp);
+
+ // Change the window's name so that it's less confusing to users
+ Described described = window.adapt(Described.class);
+ String newName = exportedPortletHandle + " (remote)";
+ described.setName(newName); // should be the same as ApplicationRegistryService.REMOTE_DISPLAY_NAME_SUFFIX
+
+ // update window mappings
+ pageInfo.updateWindowName(windowId, newName);
+
+ structureAccess.saveChangesTo(window);
+ }
+
+ @Override
+ public void onEvent(Event<DataStorage, org.exoplatform.portal.config.model.Page> event) throws Exception
+ {
+ String eventName = event.getEventName();
+
+ // get the MOP page from the event data
+ org.exoplatform.portal.config.model.Page portalPage = event.getData();
+ Page page = structureAccess.getPageFrom(portalPage);
+
+ if (page == null && DataStorage.PAGE_REMOVED.equals(eventName))
+ {
+ // if we try to remove a page, when we get this event, the page has already been removed from JCR
+ // so we need to work around that fact by retrieving the corresponding PageInfo from the portal page title
+ // which should match the Described name and check that it matches the internal name before removing it
+ removePage(portalPage.getTitle(), portalPage.getName());
+
+ return;
+ }
+
+ if (page != null)
+ {
+ if (DataStorage.PAGE_CREATED.equals(eventName))
+ {
+ // add information for new page
+ addPage(page);
+ }
+ else if (DataStorage.PAGE_UPDATED.equals(eventName))
+ {
+ removePage(page);
+ addPage(page);
+ }
+ }
+ }
+
+ private void removePage(Page page)
+ {
+ Described described = page.adapt(Described.class);
+ String name = described.getName();
+
+ removePage(name, page.getName());
+ }
+
+ private void removePage(String name, String internalName)
+ {
+ PageInfo pageInfo = pageInfos.get(name);
+ if (pageInfo != null && internalName.equals(pageInfo.getInternalName()))
+ {
+ // remove page info
+ pageInfos.remove(name);
+ }
+ }
+
+ private static class PageInfo
+ {
+ private final String uuid;
+ private final Map<String, String> childrenWindows = new HashMap<String, String>();
+
+ /** Name as provided by Described */
+ private final String name;
+
+ /** Name as automatically generated */
+ private final String internalName;
+
+ private PageInfo(String uuid, String name, String internalName)
+ {
+ this.uuid = uuid;
+ this.name = name;
+ this.internalName = internalName;
+ }
+
+ public String getUUID()
+ {
+ return uuid;
+ }
+
+ public String getInternalName()
+ {
+ return internalName;
+ }
+
+ public List<String> getChildrenWindows()
+ {
+ return new ArrayList<String>(childrenWindows.keySet());
+ }
+
+ public void addWindow(String windowName, String uuid)
+ {
+ // add suffix in case we have several windows with the same name in the page
+ if (childrenWindows.containsKey(windowName))
+ {
+ if (windowName.endsWith("|"))
+ {
+ windowName += "|";
+ }
+ else
+ {
+ windowName += windowName + " |";
+ }
+ }
+
+ childrenWindows.put(windowName, uuid);
+ }
+
+ public void updateWindowName(String oldWindowName, String newWindowName)
+ {
+ String windowUUID = getWindowUUID(oldWindowName);
+ childrenWindows.remove(oldWindowName);
+ childrenWindows.put(newWindowName, windowUUID);
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getWindowUUID(String windowId)
+ {
+ return childrenWindows.get(windowId);
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPPortalStructureAccess.java
===================================================================
--- portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPPortalStructureAccess.java 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPPortalStructureAccess.java 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,111 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2011, Red Hat Middleware, LLC, and individual
- * contributors as indicated by the @authors tag. See the
- * copyright.txt in the distribution for a full listing of
- * individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.integration.wsrp.structure;
-
-import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.exoplatform.portal.pom.data.Mapper;
-import org.exoplatform.portal.pom.data.PageKey;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Page;
-import org.gatein.mop.api.workspace.Site;
-import org.gatein.mop.api.workspace.Workspace;
-import org.gatein.mop.api.workspace.ui.UIWindow;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class MOPPortalStructureAccess implements PortalStructureAccess
-{
- private static final String PAGES_CHILD_NAME = "pages";
- private final POMSessionManager pomManager;
-
- public MOPPortalStructureAccess(POMSessionManager pomManager)
- {
- this.pomManager = pomManager;
- }
-
- public Collection<Page> getPages()
- {
- POMSession session = pomManager.getSession();
- Workspace workspace = session.getWorkspace();
- Collection<Site> sites = workspace.getSites(ObjectType.PORTAL_SITE);
-
- List<Page> pages = new ArrayList<Page>(sites.size() * 10);
-
- for (Site site : sites)
- {
- Page pagesRoot = getPagesFrom(site);
- if (pagesRoot != null)
- {
- Collection<Page> children = pagesRoot.getChildren();
- for (Page child : children)
- {
- pages.add(child);
- }
- }
- }
-
- return pages;
- }
-
- public UIWindow getWindowFrom(String uuid)
- {
- POMSession session = pomManager.getSession();
- return session.findObjectById(ObjectType.WINDOW, uuid);
- }
-
- public void saveChangesTo(UIWindow window)
- {
- POMSession session = pomManager.getSession();
-
- // mark page for cache invalidation otherwise DataCache will use the previous customization id when trying to set
- // the portlet state in UIPortlet.setState and will not find it resulting in an error
- Page page = window.getPage();
- session.scheduleForEviction(new PageKey("portal", page.getSite().getName(), page.getName()));
-
- // save
- session.close(true);
- }
-
- public Page getPageFrom(org.exoplatform.portal.config.model.Page portalPage)
- {
- POMSession session = pomManager.getSession();
- Site site = session.getWorkspace().getSite(Mapper.parseSiteType(portalPage.getOwnerType()), portalPage.getOwnerId());
- return getPagesFrom(site).getChild(portalPage.getName());
- }
-
- private Page getPagesFrom(Site site)
- {
- // a site contains a root page with templates and pages
- // more info at http://code.google.com/p/chromattic/wiki/MOPUseCases
-
- return site.getRootPage().getChild(PAGES_CHILD_NAME);
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPPortalStructureAccess.java (from rev 6033, portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPPortalStructureAccess.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPPortalStructureAccess.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPPortalStructureAccess.java 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.integration.wsrp.structure;
+
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.data.Mapper;
+import org.exoplatform.portal.pom.data.PageKey;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Page;
+import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.api.workspace.Workspace;
+import org.gatein.mop.api.workspace.ui.UIWindow;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class MOPPortalStructureAccess implements PortalStructureAccess
+{
+ private static final String PAGES_CHILD_NAME = "pages";
+ private final POMSessionManager pomManager;
+
+ public MOPPortalStructureAccess(POMSessionManager pomManager)
+ {
+ this.pomManager = pomManager;
+ }
+
+ public Collection<Page> getPages()
+ {
+ POMSession session = pomManager.getSession();
+ Workspace workspace = session.getWorkspace();
+ Collection<Site> sites = workspace.getSites(ObjectType.PORTAL_SITE);
+
+ List<Page> pages = new ArrayList<Page>(sites.size() * 10);
+
+ for (Site site : sites)
+ {
+ Page pagesRoot = getPagesFrom(site);
+ if (pagesRoot != null)
+ {
+ Collection<Page> children = pagesRoot.getChildren();
+ for (Page child : children)
+ {
+ pages.add(child);
+ }
+ }
+ }
+
+ return pages;
+ }
+
+ public UIWindow getWindowFrom(String uuid)
+ {
+ POMSession session = pomManager.getSession();
+ return session.findObjectById(ObjectType.WINDOW, uuid);
+ }
+
+ public void saveChangesTo(UIWindow window)
+ {
+ POMSession session = pomManager.getSession();
+
+ // mark page for cache invalidation otherwise DataCache will use the previous customization id when trying to set
+ // the portlet state in UIPortlet.setState and will not find it resulting in an error
+ Page page = window.getPage();
+ session.scheduleForEviction(new PageKey("portal", page.getSite().getName(), page.getName()));
+
+ // save
+ session.close(true);
+ }
+
+ public Page getPageFrom(org.exoplatform.portal.config.model.Page portalPage)
+ {
+ POMSession session = pomManager.getSession();
+ Site site = session.getWorkspace().getSite(Mapper.parseSiteType(portalPage.getOwnerType()), portalPage.getOwnerId());
+ return getPagesFrom(site).getChild(portalPage.getName());
+ }
+
+ private Page getPagesFrom(Site site)
+ {
+ // a site contains a root page with templates and pages
+ // more info at http://code.google.com/p/chromattic/wiki/MOPUseCases
+
+ return site.getRootPage().getChild(PAGES_CHILD_NAME);
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/PortalStructureAccess.java
===================================================================
--- portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/PortalStructureAccess.java 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/PortalStructureAccess.java 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,44 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2011, Red Hat Middleware, LLC, and individual
- * contributors as indicated by the @authors tag. See the
- * copyright.txt in the distribution for a full listing of
- * individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.integration.wsrp.structure;
-
-import org.gatein.mop.api.workspace.Page;
-import org.gatein.mop.api.workspace.ui.UIWindow;
-
-import java.util.Collection;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public interface PortalStructureAccess
-{
- Collection<Page> getPages();
-
- UIWindow getWindowFrom(String uuid);
-
- void saveChangesTo(UIWindow window);
-
- Page getPageFrom(org.exoplatform.portal.config.model.Page portalPage);
-}
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/PortalStructureAccess.java (from rev 6033, portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/PortalStructureAccess.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/PortalStructureAccess.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/PortalStructureAccess.java 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.integration.wsrp.structure;
+
+import org.gatein.mop.api.workspace.Page;
+import org.gatein.mop.api.workspace.ui.UIWindow;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public interface PortalStructureAccess
+{
+ Collection<Page> getPages();
+
+ UIWindow getWindowFrom(String uuid);
+
+ void saveChangesTo(UIWindow window);
+
+ Page getPageFrom(org.exoplatform.portal.config.model.Page portalPage);
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/wss/JBoss5WSSServiceIntegration.java
===================================================================
--- portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/wss/JBoss5WSSServiceIntegration.java 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/wss/JBoss5WSSServiceIntegration.java 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,68 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2011, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.gatein.integration.wsrp.wss;
-
-import org.gatein.wsrp.wss.WebServiceSecurityFactory;
-import org.picocontainer.Startable;
-import org.wsrp.wss.jboss5.handlers.consumer.WSSecurityCredentialHandler;
-import org.wsrp.wss.jboss5.handlers.consumer.JBWSSecurityHandlerWrapper;
-
-/**
- * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
- * @version $Revision$
- */
-public class JBoss5WSSServiceIntegration implements Startable
-{
- private final WebServiceSecurityFactory wssFactory;
-
- private final WSSecurityCredentialHandler WS_CREDENTIAL_HANDLER = new WSSecurityCredentialHandler();
- private final JBWSSecurityHandlerWrapper JBWS_SECURITY_WRAPPER = new JBWSSecurityHandlerWrapper();
-
- public JBoss5WSSServiceIntegration()
- {
- wssFactory = WebServiceSecurityFactory.getInstance();
- }
-
- public void start()
- {
- startConsumer();
- }
-
- public void stop()
- {
- stopConsumer();
- }
-
- protected void startConsumer()
- {
- wssFactory.registerWebServiceSecurityHandler(WS_CREDENTIAL_HANDLER);
- wssFactory.registerWebServiceSecurityHandler(JBWS_SECURITY_WRAPPER);
- }
-
- protected void stopConsumer()
- {
- wssFactory.unregisterWebServiceSecurityHandler(WS_CREDENTIAL_HANDLER);
- wssFactory.unregisterWebServiceSecurityHandler(JBWS_SECURITY_WRAPPER);
- }
-}
-
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/wss/JBoss5WSSServiceIntegration.java (from rev 6033, portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/wss/JBoss5WSSServiceIntegration.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/wss/JBoss5WSSServiceIntegration.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/wss/JBoss5WSSServiceIntegration.java 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2011, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.gatein.integration.wsrp.wss;
+
+import org.gatein.wsrp.wss.WebServiceSecurityFactory;
+import org.picocontainer.Startable;
+import org.wsrp.wss.jboss5.handlers.consumer.WSSecurityCredentialHandler;
+import org.wsrp.wss.jboss5.handlers.consumer.JBWSSecurityHandlerWrapper;
+
+/**
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public class JBoss5WSSServiceIntegration implements Startable
+{
+ private final WebServiceSecurityFactory wssFactory;
+
+ private final WSSecurityCredentialHandler WS_CREDENTIAL_HANDLER = new WSSecurityCredentialHandler();
+ private final JBWSSecurityHandlerWrapper JBWS_SECURITY_WRAPPER = new JBWSSecurityHandlerWrapper();
+
+ public JBoss5WSSServiceIntegration()
+ {
+ wssFactory = WebServiceSecurityFactory.getInstance();
+ }
+
+ public void start()
+ {
+ startConsumer();
+ }
+
+ public void stop()
+ {
+ stopConsumer();
+ }
+
+ protected void startConsumer()
+ {
+ wssFactory.registerWebServiceSecurityHandler(WS_CREDENTIAL_HANDLER);
+ wssFactory.registerWebServiceSecurityHandler(JBWS_SECURITY_WRAPPER);
+ }
+
+ protected void stopConsumer()
+ {
+ wssFactory.unregisterWebServiceSecurityHandler(WS_CREDENTIAL_HANDLER);
+ wssFactory.unregisterWebServiceSecurityHandler(JBWS_SECURITY_WRAPPER);
+ }
+}
+
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/resources
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/resources/conf
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/resources/conf/wsrp-producer-config.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-component/src/main/resources/conf/wsrp-producer-config.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/resources/conf/wsrp-producer-config.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,35 +0,0 @@
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<!-- Configuration using registration with default registration property validator. -->
-<producer-configuration xmlns="urn:jboss:portal:wsrp:producer:v2_7"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:portal:wsrp:producer:v2_7 http://www.jboss.org/portal/xsd/jboss-wsrp-producer_2_7.xsd">
- <registration-configuration fullServiceDescriptionRequiresRegistration="true">
- <registration-property-validator>org.gatein.registration.policies.DefaultRegistrationPropertyValidator
- </registration-property-validator>
- </registration-configuration>
-</producer-configuration>
-
- <!-- Configuration without registration -->
- <!--<producer-configuration/>-->
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/resources/conf/wsrp-producer-config.xml (from rev 6033, portal/trunk/wsrp-integration/extension-component/src/main/resources/conf/wsrp-producer-config.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/resources/conf/wsrp-producer-config.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/resources/conf/wsrp-producer-config.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,35 @@
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<!-- Configuration using registration with default registration property validator. -->
+<producer-configuration xmlns="urn:jboss:portal:wsrp:producer:v2_7"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:portal:wsrp:producer:v2_7 http://www.jboss.org/portal/xsd/jboss-wsrp-producer_2_7.xsd">
+ <registration-configuration fullServiceDescriptionRequiresRegistration="true">
+ <registration-property-validator>org.gatein.registration.policies.DefaultRegistrationPropertyValidator
+ </registration-property-validator>
+ </registration-configuration>
+</producer-configuration>
+
+ <!-- Configuration without registration -->
+ <!--<producer-configuration/>-->
\ No newline at end of file
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein/integration
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein/integration/wsrp
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein/integration/wsrp/structure
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein/integration/wsrp/structure/MOPConsumerStructureProviderTestCase.java
===================================================================
--- portal/trunk/wsrp-integration/extension-component/src/test/java/org/gatein/integration/wsrp/structure/MOPConsumerStructureProviderTestCase.java 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein/integration/wsrp/structure/MOPConsumerStructureProviderTestCase.java 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,302 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2011, Red Hat Middleware, LLC, and individual
- * contributors as indicated by the @authors tag. See the
- * copyright.txt in the distribution for a full listing of
- * individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.integration.wsrp.structure;
-
-import junit.framework.TestCase;
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.mop.Described;
-import org.exoplatform.portal.pom.spi.wsrp.WSRP;
-import org.exoplatform.services.listener.Event;
-import org.gatein.mop.api.content.Customization;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Page;
-import org.gatein.mop.api.workspace.ui.UIComponent;
-import org.gatein.mop.api.workspace.ui.UIContainer;
-import org.gatein.mop.api.workspace.ui.UIWindow;
-import org.gatein.pc.api.PortletContext;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.mockito.Mockito.*;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class MOPConsumerStructureProviderTestCase extends TestCase
-{
- private MOPConsumerStructureProvider provider;
- private PortalStructureAccess structureAccess;
- private Page page1;
-
- public void testGetPageIdentifiers()
- {
- List<String> pageIdentifiers = provider.getPageIdentifiers();
- assertEquals(5, pageIdentifiers.size());
- assertTrue(pageIdentifiers.contains("page1"));
- assertTrue(pageIdentifiers.contains("page11"));
- assertTrue(pageIdentifiers.contains("page12"));
- assertTrue(pageIdentifiers.contains("page2"));
- assertTrue(pageIdentifiers.contains("page21"));
- }
-
- public void testGetWindowIdentifiersForInexistingPage()
- {
- try
- {
- provider.getWindowIdentifiersFor("inexisting");
- fail("Cannot retrieve windows for an inexistent page");
- }
- catch (IllegalArgumentException e)
- {
- // expected
- }
- }
-
- public void testGetWindowIdentifiersFor()
- {
- checkWindows("page1", "window11", "window12");
- checkWindows("page2");
- checkWindows("page11", "window111", "window112");
- checkWindows("page12", "window121");
- checkWindows("page21", "window211");
- }
-
- public void testAssignPortletToWindow()
- {
- String newCustomizationId = "new";
- String newWindowName = "portlet";
- provider.assignPortletToWindow(PortletContext.createPortletContext(newCustomizationId), "window11", "page1", newWindowName);
- verify(structureAccess).getWindowFrom(getIdFor("window11"));
-
- UIWindow window11 = structureAccess.getWindowFrom(getIdFor("window11"));
- verify(structureAccess).saveChangesTo(window11);
-
- Described described = window11.adapt(Described.class);
- verify(described).setName(newWindowName + " (remote)");
-
- WSRP state = new WSRP();
- state.setPortletId(newCustomizationId);
- verify(window11).customize(WSRP.CONTENT_TYPE, newCustomizationId, state);
-
- Customization<?> customization = window11.getCustomization();
- assertEquals(WSRP.CONTENT_TYPE, customization.getType());
- }
-
- public void testPageCreationEvent() throws Exception
- {
- Page foo = createPage("foo", new String[]{"foo1"}, new String[]{"windowfoo1"});
- Page foo1 = foo.getChild("foo1");
- addWindows(foo1, "windowfoo11");
- org.exoplatform.portal.config.model.Page portalPage = mock(org.exoplatform.portal.config.model.Page.class);
- when(structureAccess.getPageFrom(portalPage)).thenReturn(foo);
-
- int pageNumber = provider.getPageIdentifiers().size();
-
- provider.onEvent(new Event<DataStorage, org.exoplatform.portal.config.model.Page>(DataStorage.PAGE_CREATED, null, portalPage));
-
- List<String> identifiers = provider.getPageIdentifiers();
- assertEquals(pageNumber + 2, identifiers.size());
- assertTrue(identifiers.contains("foo"));
- assertTrue(identifiers.contains("foo1"));
-
- checkWindows("foo", "windowfoo1");
- checkWindows("foo1", "windowfoo11");
-
- assertEquals(foo1.getRootComponent().get("windowfoo11"), structureAccess.getWindowFrom(getIdFor("windowfoo11")));
- }
-
- public void testPageDeletionEvent() throws Exception
- {
- String pageToRemove = "page1";
-
- org.exoplatform.portal.config.model.Page portalPage = mock(org.exoplatform.portal.config.model.Page.class);
- when(portalPage.getName()).thenReturn(createInternalNameFrom(pageToRemove));
- when(portalPage.getTitle()).thenReturn(pageToRemove);
-
- // on delete, we actually get the event after the page has been removed from JCR so we don't have an actual page
- when(structureAccess.getPageFrom(portalPage)).thenReturn(null);
-
- int pageNumber = provider.getPageIdentifiers().size();
-
- provider.onEvent(new Event<DataStorage, org.exoplatform.portal.config.model.Page>(DataStorage.PAGE_REMOVED, null, portalPage));
-
- List<String> identifiers = provider.getPageIdentifiers();
- assertEquals(pageNumber - 1, identifiers.size());
- // deleting a page doesn't delete its children, see GTNPORTAL-1630
- assertFalse(identifiers.contains(pageToRemove));
- assertTrue(identifiers.contains("page11"));
- assertTrue(identifiers.contains("page12"));
- }
-
- public void testPageUpdatedEvent() throws Exception
- {
- // todo!
- }
-
- @Override
- protected void setUp() throws Exception
- {
- structureAccess = mock(PortalStructureAccess.class);
-
- page1 = createPage("page1", new String[]{"page11", "page12"}, new String[]{"window11", "window12"});
- Page page2 = createPage("page2", new String[]{"page21"}, null);
-
- Page page11 = page1.getChild("page11");
- addWindows(page11, "window111", "window112");
-
- Page page12 = page1.getChild("page12");
- addWindows(page12, "window121");
-
- Page page21 = page2.getChild("page21");
- addWindows(page21, "window211");
-
- ArrayList<Page> pages = new ArrayList<Page>();
- pages.add(page1);
- pages.add(page11);
- pages.add(page12);
- pages.add(page2);
- pages.add(page21);
- when(structureAccess.getPages()).thenReturn(pages);
-
- provider = new MOPConsumerStructureProvider(structureAccess);
-
- // needed to initialize state
- provider.getPageIdentifiers();
- }
-
- private void checkWindows(final String pageName, String... windowNames)
- {
- List<String> windows = provider.getWindowIdentifiersFor(pageName);
-
- if (windowNames != null)
- {
- assertEquals(windowNames.length, windows.size());
- for (String windowName : windowNames)
- {
- assertTrue(windows.contains(windowName));
- }
- }
- }
-
- private Page createPage(String name, String[] childrenPages, String[] windowNames)
- {
- Page page = mock(Page.class);
-
- when(page.getName()).thenReturn(createInternalNameFrom(name));
-
- // mock call to adapt
- Described described = mock(Described.class);
- when(described.getName()).thenReturn(name);
-
- when(page.adapt(Described.class)).thenReturn(described);
-
- if (childrenPages != null)
- {
- List<Page> children = new ArrayList<Page>(childrenPages.length);
- for (String pageId : childrenPages)
- {
- Page childPage = createPage(pageId, null, null);
- when(page.getChild(pageId)).thenReturn(childPage);
- children.add(childPage);
- }
-
- when(page.getChildren()).thenReturn(children);
- }
-
- addWindows(page, windowNames);
-
- return page;
- }
-
- private String createInternalNameFrom(String name)
- {
- return name + "internal";
- }
-
- private void addWindows(Page page, String... windowNames)
- {
- if (windowNames != null)
- {
- // mock page container
- UIContainer root = mock(UIContainer.class);
- when(page.getRootComponent()).thenReturn(root);
-
- // for each provided window name, create a mock UIWindow...
- List<UIComponent> children = new ArrayList<UIComponent>(windowNames.length);
- for (String windowName : windowNames)
- {
- UIWindow window = mock(UIWindow.class);
- when(window.getName()).thenThrow(new RuntimeException("Window.getName returns the internal name, not the human readable one"));
- when(window.getObjectId()).thenReturn(getIdFor(windowName));
-
- // need to use thenAnswer instead of thenReturn here because it doesn't play well with generics
- when(window.getObjectType()).thenAnswer(new Answer<Object>()
- {
- public Object answer(InvocationOnMock invocationOnMock) throws Throwable
- {
- return ObjectType.WINDOW;
- }
- });
-
- // mock call to adapt
- Described described = mock(Described.class);
- when(described.getName()).thenReturn(windowName);
-
- when(window.adapt(Described.class)).thenReturn(described);
-
- // mock Customization
- final Customization<WSRP> customization = mock(Customization.class);
- when(customization.getType()).thenReturn(WSRP.CONTENT_TYPE);
- when(window.getCustomization()).thenAnswer(new Answer<Object>()
- {
- public Object answer(InvocationOnMock invocationOnMock) throws Throwable
- {
- return customization;
- }
- });
-
- // add it to the list of windows for this page
- children.add(window);
-
- // make sure that we return the window when we ask for it from its uuid
- when(structureAccess.getWindowFrom(getIdFor(windowName))).thenReturn(window);
-
- // make sure that we return the window if we ask the root component for it
- when(root.get(windowName)).thenReturn(window);
- }
-
- // the container should return the list of windows when asked for its components
- when(root.getComponents()).thenReturn(children);
- }
- }
-
- private String getIdFor(String windowName)
- {
- return windowName + "Id";
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein/integration/wsrp/structure/MOPConsumerStructureProviderTestCase.java (from rev 6033, portal/trunk/wsrp-integration/extension-component/src/test/java/org/gatein/integration/wsrp/structure/MOPConsumerStructureProviderTestCase.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein/integration/wsrp/structure/MOPConsumerStructureProviderTestCase.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/test/java/org/gatein/integration/wsrp/structure/MOPConsumerStructureProviderTestCase.java 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,302 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.integration.wsrp.structure;
+
+import junit.framework.TestCase;
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.mop.Described;
+import org.exoplatform.portal.pom.spi.wsrp.WSRP;
+import org.exoplatform.services.listener.Event;
+import org.gatein.mop.api.content.Customization;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Page;
+import org.gatein.mop.api.workspace.ui.UIComponent;
+import org.gatein.mop.api.workspace.ui.UIContainer;
+import org.gatein.mop.api.workspace.ui.UIWindow;
+import org.gatein.pc.api.PortletContext;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.mockito.Mockito.*;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class MOPConsumerStructureProviderTestCase extends TestCase
+{
+ private MOPConsumerStructureProvider provider;
+ private PortalStructureAccess structureAccess;
+ private Page page1;
+
+ public void testGetPageIdentifiers()
+ {
+ List<String> pageIdentifiers = provider.getPageIdentifiers();
+ assertEquals(5, pageIdentifiers.size());
+ assertTrue(pageIdentifiers.contains("page1"));
+ assertTrue(pageIdentifiers.contains("page11"));
+ assertTrue(pageIdentifiers.contains("page12"));
+ assertTrue(pageIdentifiers.contains("page2"));
+ assertTrue(pageIdentifiers.contains("page21"));
+ }
+
+ public void testGetWindowIdentifiersForInexistingPage()
+ {
+ try
+ {
+ provider.getWindowIdentifiersFor("inexisting");
+ fail("Cannot retrieve windows for an inexistent page");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+ }
+
+ public void testGetWindowIdentifiersFor()
+ {
+ checkWindows("page1", "window11", "window12");
+ checkWindows("page2");
+ checkWindows("page11", "window111", "window112");
+ checkWindows("page12", "window121");
+ checkWindows("page21", "window211");
+ }
+
+ public void testAssignPortletToWindow()
+ {
+ String newCustomizationId = "/app.new";
+ String newWindowName = "portlet";
+ provider.assignPortletToWindow(PortletContext.createPortletContext(newCustomizationId), "window11", "page1", newWindowName);
+ verify(structureAccess).getWindowFrom(getIdFor("window11"));
+
+ UIWindow window11 = structureAccess.getWindowFrom(getIdFor("window11"));
+ verify(structureAccess).saveChangesTo(window11);
+
+ Described described = window11.adapt(Described.class);
+ verify(described).setName(newWindowName + " (remote)");
+
+ WSRP state = new WSRP();
+ state.setPortletId(newCustomizationId);
+ verify(window11).customize(WSRP.CONTENT_TYPE, newCustomizationId, state);
+
+ Customization<?> customization = window11.getCustomization();
+ assertEquals(WSRP.CONTENT_TYPE, customization.getType());
+ }
+
+ public void testPageCreationEvent() throws Exception
+ {
+ Page foo = createPage("foo", new String[]{"foo1"}, new String[]{"windowfoo1"});
+ Page foo1 = foo.getChild("foo1");
+ addWindows(foo1, "windowfoo11");
+ org.exoplatform.portal.config.model.Page portalPage = mock(org.exoplatform.portal.config.model.Page.class);
+ when(structureAccess.getPageFrom(portalPage)).thenReturn(foo);
+
+ int pageNumber = provider.getPageIdentifiers().size();
+
+ provider.onEvent(new Event<DataStorage, org.exoplatform.portal.config.model.Page>(DataStorage.PAGE_CREATED, null, portalPage));
+
+ List<String> identifiers = provider.getPageIdentifiers();
+ assertEquals(pageNumber + 2, identifiers.size());
+ assertTrue(identifiers.contains("foo"));
+ assertTrue(identifiers.contains("foo1"));
+
+ checkWindows("foo", "windowfoo1");
+ checkWindows("foo1", "windowfoo11");
+
+ assertEquals(foo1.getRootComponent().get("windowfoo11"), structureAccess.getWindowFrom(getIdFor("windowfoo11")));
+ }
+
+ public void testPageDeletionEvent() throws Exception
+ {
+ String pageToRemove = "page1";
+
+ org.exoplatform.portal.config.model.Page portalPage = mock(org.exoplatform.portal.config.model.Page.class);
+ when(portalPage.getName()).thenReturn(createInternalNameFrom(pageToRemove));
+ when(portalPage.getTitle()).thenReturn(pageToRemove);
+
+ // on delete, we actually get the event after the page has been removed from JCR so we don't have an actual page
+ when(structureAccess.getPageFrom(portalPage)).thenReturn(null);
+
+ int pageNumber = provider.getPageIdentifiers().size();
+
+ provider.onEvent(new Event<DataStorage, org.exoplatform.portal.config.model.Page>(DataStorage.PAGE_REMOVED, null, portalPage));
+
+ List<String> identifiers = provider.getPageIdentifiers();
+ assertEquals(pageNumber - 1, identifiers.size());
+ // deleting a page doesn't delete its children, see GTNPORTAL-1630
+ assertFalse(identifiers.contains(pageToRemove));
+ assertTrue(identifiers.contains("page11"));
+ assertTrue(identifiers.contains("page12"));
+ }
+
+ public void testPageUpdatedEvent() throws Exception
+ {
+ // todo!
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ structureAccess = mock(PortalStructureAccess.class);
+
+ page1 = createPage("page1", new String[]{"page11", "page12"}, new String[]{"window11", "window12"});
+ Page page2 = createPage("page2", new String[]{"page21"}, null);
+
+ Page page11 = page1.getChild("page11");
+ addWindows(page11, "window111", "window112");
+
+ Page page12 = page1.getChild("page12");
+ addWindows(page12, "window121");
+
+ Page page21 = page2.getChild("page21");
+ addWindows(page21, "window211");
+
+ ArrayList<Page> pages = new ArrayList<Page>();
+ pages.add(page1);
+ pages.add(page11);
+ pages.add(page12);
+ pages.add(page2);
+ pages.add(page21);
+ when(structureAccess.getPages()).thenReturn(pages);
+
+ provider = new MOPConsumerStructureProvider(structureAccess);
+
+ // needed to initialize state
+ provider.getPageIdentifiers();
+ }
+
+ private void checkWindows(final String pageName, String... windowNames)
+ {
+ List<String> windows = provider.getWindowIdentifiersFor(pageName);
+
+ if (windowNames != null)
+ {
+ assertEquals(windowNames.length, windows.size());
+ for (String windowName : windowNames)
+ {
+ assertTrue(windows.contains(windowName));
+ }
+ }
+ }
+
+ private Page createPage(String name, String[] childrenPages, String[] windowNames)
+ {
+ Page page = mock(Page.class);
+
+ when(page.getName()).thenReturn(createInternalNameFrom(name));
+
+ // mock call to adapt
+ Described described = mock(Described.class);
+ when(described.getName()).thenReturn(name);
+
+ when(page.adapt(Described.class)).thenReturn(described);
+
+ if (childrenPages != null)
+ {
+ List<Page> children = new ArrayList<Page>(childrenPages.length);
+ for (String pageId : childrenPages)
+ {
+ Page childPage = createPage(pageId, null, null);
+ when(page.getChild(pageId)).thenReturn(childPage);
+ children.add(childPage);
+ }
+
+ when(page.getChildren()).thenReturn(children);
+ }
+
+ addWindows(page, windowNames);
+
+ return page;
+ }
+
+ private String createInternalNameFrom(String name)
+ {
+ return name + "internal";
+ }
+
+ private void addWindows(Page page, String... windowNames)
+ {
+ if (windowNames != null)
+ {
+ // mock page container
+ UIContainer root = mock(UIContainer.class);
+ when(page.getRootComponent()).thenReturn(root);
+
+ // for each provided window name, create a mock UIWindow...
+ List<UIComponent> children = new ArrayList<UIComponent>(windowNames.length);
+ for (String windowName : windowNames)
+ {
+ UIWindow window = mock(UIWindow.class);
+ when(window.getName()).thenThrow(new RuntimeException("Window.getName returns the internal name, not the human readable one"));
+ when(window.getObjectId()).thenReturn(getIdFor(windowName));
+
+ // need to use thenAnswer instead of thenReturn here because it doesn't play well with generics
+ when(window.getObjectType()).thenAnswer(new Answer<Object>()
+ {
+ public Object answer(InvocationOnMock invocationOnMock) throws Throwable
+ {
+ return ObjectType.WINDOW;
+ }
+ });
+
+ // mock call to adapt
+ Described described = mock(Described.class);
+ when(described.getName()).thenReturn(windowName);
+
+ when(window.adapt(Described.class)).thenReturn(described);
+
+ // mock Customization
+ final Customization<WSRP> customization = mock(Customization.class);
+ when(customization.getType()).thenReturn(WSRP.CONTENT_TYPE);
+ when(window.getCustomization()).thenAnswer(new Answer<Object>()
+ {
+ public Object answer(InvocationOnMock invocationOnMock) throws Throwable
+ {
+ return customization;
+ }
+ });
+
+ // add it to the list of windows for this page
+ children.add(window);
+
+ // make sure that we return the window when we ask for it from its uuid
+ when(structureAccess.getWindowFrom(getIdFor(windowName))).thenReturn(window);
+
+ // make sure that we return the window if we ask the root component for it
+ when(root.get(windowName)).thenReturn(window);
+ }
+
+ // the container should return the list of windows when asked for its components
+ when(root.getComponents()).thenReturn(children);
+ }
+ }
+
+ private String getIdFor(String windowName)
+ {
+ return windowName + "Id";
+ }
+}
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/pom.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-config/pom.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,41 +0,0 @@
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>gatein-wsrp-integration-parent</artifactId>
- <groupId>org.gatein.integration</groupId>
- <version>1.0.0-Beta01-SNAPSHOT</version>
- </parent>
-
- <artifactId>extension-config</artifactId>
- <name>GateIn WSRP Integration extension config</name>
-
-
- <build>
- <finalName>extension-config</finalName>
- </build>
-
-</project>
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/pom.xml (from rev 6033, portal/trunk/wsrp-integration/extension-config/pom.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/pom.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,41 @@
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>gatein-wsrp-integration-parent</artifactId>
+ <groupId>org.gatein.integration</groupId>
+ <version>5.2.0-epp-DEV02-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>extension-config</artifactId>
+ <name>GateIn WSRP Integration extension config</name>
+
+
+ <build>
+ <finalName>extension-config</finalName>
+ </build>
+
+</project>
\ No newline at end of file
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src/main
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src/main/resources
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src/main/resources/conf
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src/main/resources/conf/configuration.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-config/src/main/resources/conf/configuration.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src/main/resources/conf/configuration.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
- <external-component-plugins>
- <!-- The full qualified name of the PortalContainerConfig -->
- <target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
- <component-plugin>
- <!-- The name of the plugin -->
- <name>Change PortalContainer Definitions</name>
- <!-- The name of the method to call on the PortalContainerConfig in order to register the changes on the PortalContainerDefinitions -->
- <set-method>registerChangePlugin</set-method>
- <!-- The full qualified name of the PortalContainerDefinitionChangePlugin -->
- <type>org.exoplatform.container.definition.PortalContainerDefinitionChangePlugin</type>
- <init-params>
- <value-param>
- <name>apply.default</name>
- <value>true</value>
- </value-param>
- <object-param>
- <name>change</name>
- <object type="org.exoplatform.container.definition.PortalContainerDefinitionChange$AddDependencies">
- <!-- The list of name of the dependencies to add -->
- <field name="dependencies">
- <collection type="java.util.ArrayList">
- <value profiles="jboss">
- <string>gatein-wsrp-integration</string>
- </value>
- </collection>
- </field>
- </object>
- </object-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
-</configuration>
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src/main/resources/conf/configuration.xml (from rev 6033, portal/trunk/wsrp-integration/extension-config/src/main/resources/conf/configuration.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src/main/resources/conf/configuration.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/src/main/resources/conf/configuration.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <external-component-plugins>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
+ <component-plugin>
+ <!-- The name of the plugin -->
+ <name>Change PortalContainer Definitions</name>
+ <!-- The name of the method to call on the PortalContainerConfig in order to register the changes on the PortalContainerDefinitions -->
+ <set-method>registerChangePlugin</set-method>
+ <!-- The full qualified name of the PortalContainerDefinitionChangePlugin -->
+ <type>org.exoplatform.container.definition.PortalContainerDefinitionChangePlugin</type>
+ <init-params>
+ <value-param>
+ <name>apply.default</name>
+ <value>true</value>
+ </value-param>
+ <object-param>
+ <name>change</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinitionChange$AddDependencies">
+ <!-- The list of name of the dependencies to add -->
+ <field name="dependencies">
+ <collection type="java.util.ArrayList">
+ <value profiles="jboss">
+ <string>gatein-wsrp-integration</string>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
\ No newline at end of file
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/pom.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-ear/pom.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,193 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>gatein-wsrp-integration-parent</artifactId>
- <groupId>org.gatein.integration</groupId>
- <version>1.0.0-Beta01-SNAPSHOT</version>
- </parent>
-
- <artifactId>extension-ear</artifactId>
- <packaging>ear</packaging>
-
- <name>GateIn WSRP Integration extension EAR</name>
-
- <dependencies>
- <dependency>
- <groupId>org.gatein.integration</groupId>
- <artifactId>extension-config</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.gatein.integration</groupId>
- <artifactId>extension-war</artifactId>
- <version>${project.version}</version>
- <type>war</type>
- </dependency>
- <dependency>
- <groupId>org.gatein.integration</groupId>
- <artifactId>extension-component</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-admin-gui</artifactId>
- <version>${org.gatein.wsrp.version}</version>
- <type>war</type>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-producer</artifactId>
- <version>${org.gatein.wsrp.version}</version>
- <type>war</type>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-producer-lib</artifactId>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-consumer</artifactId>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-jcr-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-wsrp1-ws</artifactId>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-wsrp2-ws</artifactId>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-integration-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-wss-jboss5</artifactId>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-wss</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-ear-plugin</artifactId>
- <configuration>
- <displayName>gatein-wsrp-integration</displayName>
- <defaultLibBundleDir>lib</defaultLibBundleDir>
- <modules>
- <webModule>
- <groupId>org.gatein.integration</groupId>
- <artifactId>extension-war</artifactId>
- <contextRoot>gatein-wsrp-integration</contextRoot>
- </webModule>
- <webModule>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-producer</artifactId>
- <contextRoot>wsrp-producer</contextRoot>
- </webModule>
- <webModule>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-admin-gui</artifactId>
- <contextRoot>wsrp-admin-gui</contextRoot>
- </webModule>
- <jarModule>
- <groupId>org.gatein.integration</groupId>
- <artifactId>extension-config</artifactId>
- <includeInApplicationXml>true</includeInApplicationXml>
- <bundleDir>/</bundleDir>
- </jarModule>
- <jarModule>
- <groupId>org.gatein.integration</groupId>
- <artifactId>extension-component</artifactId>
- <includeInApplicationXml>true</includeInApplicationXml>
- <bundleDir>/</bundleDir>
- </jarModule>
- <jarModule>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-producer-lib</artifactId>
- </jarModule>
- <jarModule>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-consumer</artifactId>
- </jarModule>
- <jarModule>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-jcr-impl</artifactId>
- </jarModule>
- <jarModule>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-common</artifactId>
- </jarModule>
- <jarModule>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-wsrp1-ws</artifactId>
- </jarModule>
- <jarModule>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-wsrp2-ws</artifactId>
- </jarModule>
- <jarModule>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-integration-api</artifactId>
- </jarModule>
- <jarModule>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-wss-jboss5</artifactId>
- </jarModule>
- <jarModule>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-wss</artifactId>
- </jarModule>
- </modules>
- </configuration>
- </plugin>
- </plugins>
- <finalName>gatein-wsrp-integration</finalName>
- </build>
-
-</project>
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/pom.xml (from rev 6033, portal/trunk/wsrp-integration/extension-ear/pom.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/pom.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>gatein-wsrp-integration-parent</artifactId>
+ <groupId>org.gatein.integration</groupId>
+ <version>5.2.0-epp-DEV02-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>extension-ear</artifactId>
+ <packaging>ear</packaging>
+
+ <name>GateIn WSRP Integration extension EAR</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.gatein.integration</groupId>
+ <artifactId>extension-config</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.integration</groupId>
+ <artifactId>extension-war</artifactId>
+ <version>${project.version}</version>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.integration</groupId>
+ <artifactId>extension-component</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-admin-gui</artifactId>
+ <version>${org.gatein.wsrp.version}</version>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-producer</artifactId>
+ <version>${org.gatein.wsrp.version}</version>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-producer-lib</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-consumer</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-jcr-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-wsrp1-ws</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-wsrp2-ws</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-integration-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-wss-jboss5</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-wss</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ear-plugin</artifactId>
+ <configuration>
+ <displayName>gatein-wsrp-integration</displayName>
+ <defaultLibBundleDir>lib</defaultLibBundleDir>
+ <modules>
+ <webModule>
+ <groupId>org.gatein.integration</groupId>
+ <artifactId>extension-war</artifactId>
+ <contextRoot>gatein-wsrp-integration</contextRoot>
+ </webModule>
+ <webModule>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-producer</artifactId>
+ <contextRoot>wsrp-producer</contextRoot>
+ </webModule>
+ <webModule>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-admin-gui</artifactId>
+ <contextRoot>wsrp-admin-gui</contextRoot>
+ </webModule>
+ <jarModule>
+ <groupId>org.gatein.integration</groupId>
+ <artifactId>extension-config</artifactId>
+ <includeInApplicationXml>true</includeInApplicationXml>
+ <bundleDir>/</bundleDir>
+ </jarModule>
+ <jarModule>
+ <groupId>org.gatein.integration</groupId>
+ <artifactId>extension-component</artifactId>
+ <includeInApplicationXml>true</includeInApplicationXml>
+ <bundleDir>/</bundleDir>
+ </jarModule>
+ <jarModule>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-producer-lib</artifactId>
+ </jarModule>
+ <jarModule>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-consumer</artifactId>
+ </jarModule>
+ <jarModule>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-jcr-impl</artifactId>
+ </jarModule>
+ <jarModule>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-common</artifactId>
+ </jarModule>
+ <jarModule>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-wsrp1-ws</artifactId>
+ </jarModule>
+ <jarModule>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-wsrp2-ws</artifactId>
+ </jarModule>
+ <jarModule>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-integration-api</artifactId>
+ </jarModule>
+ <jarModule>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-wss-jboss5</artifactId>
+ </jarModule>
+ <jarModule>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-wss</artifactId>
+ </jarModule>
+ </modules>
+ </configuration>
+ </plugin>
+ </plugins>
+ <finalName>gatein-wsrp-integration</finalName>
+ </build>
+
+</project>
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/META-INF
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/META-INF/gatein-wsse-consumer.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-ear/src/main/application/META-INF/gatein-wsse-consumer.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/META-INF/gatein-wsse-consumer.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,8 +0,0 @@
- <jboss-ws-security xmlns="http://www.jboss.com/ws-security/config"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.jboss.com/ws-security/config
- http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
-
- <!-- Configuration for the GateIn WSRP Consumer WS-Security -->
-
-</jboss-ws-security>
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/META-INF/gatein-wsse-consumer.xml (from rev 6033, portal/trunk/wsrp-integration/extension-ear/src/main/application/META-INF/gatein-wsse-consumer.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/META-INF/gatein-wsse-consumer.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/META-INF/gatein-wsse-consumer.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,8 @@
+ <jboss-ws-security xmlns="http://www.jboss.com/ws-security/config"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.jboss.com/ws-security/config
+ http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
+
+ <!-- Configuration for the GateIn WSRP Consumer WS-Security -->
+
+</jboss-ws-security>
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/META-INF/jboss-scanning.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-ear/src/main/application/META-INF/jboss-scanning.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/META-INF/jboss-scanning.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,25 +0,0 @@
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<scanning xmlns="urn:jboss:scanning:1.0">
-</scanning>
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/META-INF/jboss-scanning.xml (from rev 6033, portal/trunk/wsrp-integration/extension-ear/src/main/application/META-INF/jboss-scanning.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/META-INF/jboss-scanning.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/src/main/application/META-INF/jboss-scanning.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,25 @@
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<scanning xmlns="urn:jboss:scanning:1.0">
+</scanning>
\ No newline at end of file
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/pom.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-war/pom.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>gatein-wsrp-integration-parent</artifactId>
- <groupId>org.gatein.integration</groupId>
- <version>1.0.0-Beta01-SNAPSHOT</version>
- </parent>
-
- <artifactId>extension-war</artifactId>
- <packaging>war</packaging>
-
- <name>GateIn WSRP Integration extension WAR</name>
-
- <build>
- <finalName>gatein-wsrp-integration</finalName>
- </build>
-
-</project>
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/pom.xml (from rev 6033, portal/trunk/wsrp-integration/extension-war/pom.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/pom.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>gatein-wsrp-integration-parent</artifactId>
+ <groupId>org.gatein.integration</groupId>
+ <version>5.2.0-epp-DEV02-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>extension-war</artifactId>
+ <packaging>war</packaging>
+
+ <name>GateIn WSRP Integration extension WAR</name>
+
+ <build>
+ <finalName>gatein-wsrp-integration</finalName>
+ </build>
+
+</project>
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/configuration.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/configuration.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/configuration.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<configuration
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
- <import profiles="jboss">war:/conf/wsrp/wsrp-configuration.xml</import>
- <import profiles="jboss">war:/conf/wsrp/jcr-configuration.xml</import>
-</configuration>
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/configuration.xml (from rev 6033, portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/configuration.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/configuration.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/configuration.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <import profiles="jboss">war:/conf/wsrp/wsrp-configuration.xml</import>
+ <import profiles="jboss">war:/conf/wsrp/jcr-configuration.xml</import>
+</configuration>
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/consumers-configuration-nodetypes.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/consumers-configuration-nodetypes.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/consumers-configuration-nodetypes.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,191 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
- xmlns:jcr="http://www.jcp.org/jcr/1.0">
-
- <nodeType name="wsrp:producerinfos" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <childNodeDefinitions>
- <childNodeDefinition name="*" defaultPrimaryType="wsrp:producerinfo" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>wsrp:producerinfo</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="wsrp:producerinfo" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="producerid" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="cache" requiredType="Integer" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="active" requiredType="boolean" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- <childNodeDefinitions>
- <childNodeDefinition name="endpoint" defaultPrimaryType="wsrp:endpointinfo" autoCreated="true"
- mandatory="false"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>wsrp:endpointinfo</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- <childNodeDefinition name="registration" defaultPrimaryType="wsrp:registrationinfo" autoCreated="true"
- mandatory="false"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>wsrp:registrationinfo</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="wsrp:endpointinfo" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="wsdlurl" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="timeout" requiredType="Integer" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="enablewss" requiredType="boolean" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
- <nodeType name="wsrp:registrationinfo" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="consumername" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="handle" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="state" requiredType="Binary" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- <childNodeDefinitions>
- <childNodeDefinition name="*" defaultPrimaryType="wsrp:registrationproperty" autoCreated="false"
- mandatory="false"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>wsrp:registrationproperty</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="wsrp:registrationproperty" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="name" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="value" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="status" requiredType="Integer" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- <childNodeDefinitions>
- <childNodeDefinition name="description" defaultPrimaryType="" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>wsrp:registrationpropertydescription</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="wsrp:registrationpropertydescription" isMixin="false" hasOrderableChildNodes="true"
- primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="name" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="type" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="description" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="hint" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="label" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
-</nodeTypes>
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/consumers-configuration-nodetypes.xml (from rev 6033, portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/consumers-configuration-nodetypes.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/consumers-configuration-nodetypes.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/consumers-configuration-nodetypes.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
+ xmlns:jcr="http://www.jcp.org/jcr/1.0">
+
+ <nodeType name="wsrp:producerinfos" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <childNodeDefinitions>
+ <childNodeDefinition name="*" defaultPrimaryType="wsrp:producerinfo" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>wsrp:producerinfo</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="wsrp:producerinfo" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="producerid" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="cache" requiredType="Integer" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="active" requiredType="boolean" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ <childNodeDefinitions>
+ <childNodeDefinition name="endpoint" defaultPrimaryType="wsrp:endpointinfo" autoCreated="true"
+ mandatory="false"
+ onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>wsrp:endpointinfo</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ <childNodeDefinition name="registration" defaultPrimaryType="wsrp:registrationinfo" autoCreated="true"
+ mandatory="false"
+ onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>wsrp:registrationinfo</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="wsrp:endpointinfo" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="wsdlurl" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="timeout" requiredType="Integer" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="enablewss" requiredType="boolean" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+
+ <nodeType name="wsrp:registrationinfo" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="consumername" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="handle" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="state" requiredType="Binary" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ <childNodeDefinitions>
+ <childNodeDefinition name="*" defaultPrimaryType="wsrp:registrationproperty" autoCreated="false"
+ mandatory="false"
+ onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>wsrp:registrationproperty</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="wsrp:registrationproperty" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="name" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="value" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="status" requiredType="Integer" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ <childNodeDefinitions>
+ <childNodeDefinition name="description" defaultPrimaryType="" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>wsrp:registrationpropertydescription</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="wsrp:registrationpropertydescription" isMixin="false" hasOrderableChildNodes="true"
+ primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="name" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="type" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="description" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="hint" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="label" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+
+</nodeTypes>
\ No newline at end of file
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/jcr-configuration.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/jcr-configuration.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/jcr-configuration.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
-
- <external-component-plugins>
- <!-- The full qualified name of the RepositoryServiceConfiguration -->
- <target-component>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</target-component>
- <component-plugin>
- <!-- The name of the plugin -->
- <name>Sample RepositoryServiceConfiguration Plugin</name>
- <!-- The name of the method to call on the RepositoryServiceConfiguration in order to add the RepositoryServiceConfigurations -->
- <set-method>addConfig</set-method>
- <!-- The full qualified name of the RepositoryServiceConfigurationPlugin -->
- <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationPlugin</type>
- <init-params>
- <value-param>
- <name>conf-path</name>
- <description>JCR configuration file</description>
- <value>war:/conf/wsrp/repository-configuration.xml</value>
- </value-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
-</configuration>
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/jcr-configuration.xml (from rev 6033, portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/jcr-configuration.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/jcr-configuration.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/jcr-configuration.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <external-component-plugins>
+ <!-- The full qualified name of the RepositoryServiceConfiguration -->
+ <target-component>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</target-component>
+ <component-plugin>
+ <!-- The name of the plugin -->
+ <name>Sample RepositoryServiceConfiguration Plugin</name>
+ <!-- The name of the method to call on the RepositoryServiceConfiguration in order to add the RepositoryServiceConfigurations -->
+ <set-method>addConfig</set-method>
+ <!-- The full qualified name of the RepositoryServiceConfigurationPlugin -->
+ <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationPlugin</type>
+ <init-params>
+ <value-param>
+ <name>conf-path</name>
+ <description>JCR configuration file</description>
+ <value>war:/conf/wsrp/repository-configuration.xml</value>
+ </value-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/migration-nodetypes.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/migration-nodetypes.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/migration-nodetypes.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,114 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
- xmlns:jcr="http://www.jcp.org/jcr/1.0">
-
- <nodeType name="wsrp:exportinfos" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <childNodeDefinitions>
- <childNodeDefinition name="*" defaultPrimaryType="wsrp:exportinfo" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>wsrp:exportinfo</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="wsrp:exportinfo" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="exporttime" requiredType="Long" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="expirationtime" requiredType="Long" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="exportcontext" requiredType="Binary" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- <childNodeDefinitions>
- <childNodeDefinition name="*" defaultPrimaryType="wsrp:exportedstate" autoCreated="false"
- mandatory="false"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>wsrp:exportedstate</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- <childNodeDefinition name="*" defaultPrimaryType="wsrp:exporterror" autoCreated="false"
- mandatory="false"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>wsrp:exporterror</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="wsrp:exportedstate" isMixin="false" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="handle" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="state" requiredType="Binary" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
- <nodeType name="wsrp:exporterror" isMixin="false" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="errorcode" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="handles" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-</nodeTypes>
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/migration-nodetypes.xml (from rev 6033, portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/migration-nodetypes.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/migration-nodetypes.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/migration-nodetypes.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
+ xmlns:jcr="http://www.jcp.org/jcr/1.0">
+
+ <nodeType name="wsrp:exportinfos" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <childNodeDefinitions>
+ <childNodeDefinition name="*" defaultPrimaryType="wsrp:exportinfo" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>wsrp:exportinfo</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="wsrp:exportinfo" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="exporttime" requiredType="Long" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="expirationtime" requiredType="Long" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="exportcontext" requiredType="Binary" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ <childNodeDefinitions>
+ <childNodeDefinition name="*" defaultPrimaryType="wsrp:exportedstate" autoCreated="false"
+ mandatory="false"
+ onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>wsrp:exportedstate</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ <childNodeDefinition name="*" defaultPrimaryType="wsrp:exporterror" autoCreated="false"
+ mandatory="false"
+ onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>wsrp:exporterror</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="wsrp:exportedstate" isMixin="false" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="handle" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="state" requiredType="Binary" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+
+ <nodeType name="wsrp:exporterror" isMixin="false" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="errorcode" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="handles" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+</nodeTypes>
\ No newline at end of file
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Property changes on: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/navigation.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/navigation.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/navigation.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<node-navigation
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_1 http://www.gatein.org/xml/ns/gatein_objects_1_1"
- xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_1">
- <priority>2</priority>
-
- <page-nodes>
- <!-- TODO: enable when the extension mechanism can handle child nodes properly -->
- <!-- <node>
- <uri>administration</uri>
- <name>administration</name>
- <label>#{administration.title}</label> -->
- <node>
- <!-- <uri>administration/wsrpConfiguration</uri> -->
- <uri>wsrpConfiguration</uri>
- <name>wsrpConfiguration</name>
- <!-- TODO: add a proper i18n label here -->
- <label>WSRP</label>
- <page-reference>group::/platform/administrators::wsrpConfiguration</page-reference>
- </node>
- <!-- </node> -->
- </page-nodes>
-</node-navigation>
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/navigation.xml (from rev 6033, portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/navigation.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/navigation.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/navigation.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<node-navigation
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_1 http://www.gatein.org/xml/ns/gatein_objects_1_1"
+ xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_1">
+ <priority>2</priority>
+
+ <page-nodes>
+ <!-- TODO: enable when the extension mechanism can handle child nodes properly -->
+ <!-- <node>
+ <uri>administration</uri>
+ <name>administration</name>
+ <label>#{administration.title}</label> -->
+ <node>
+ <!-- <uri>administration/wsrpConfiguration</uri> -->
+ <uri>wsrpConfiguration</uri>
+ <name>wsrpConfiguration</name>
+ <!-- TODO: add a proper i18n label here -->
+ <label>WSRP</label>
+ <page-reference>group::/platform/administrators::wsrpConfiguration</page-reference>
+ </node>
+ <!-- </node> -->
+ </page-nodes>
+</node-navigation>
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/pages.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/pages.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/pages.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<page-set
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_1 http://www.gatein.org/xml/ns/gatein_objects_1_1"
- xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_1">
-
- <page>
- <name>wsrpConfiguration</name>
- <title>WSRP Admin</title>
- <access-permissions>manager:/platform/administrators</access-permissions>
- <edit-permission>manager:/platform/administrators</edit-permission>
- <portlet-application>
- <portlet>
- <application-ref>wsrp-admin-gui</application-ref>
- <portlet-ref>WSRPConfigurationPortlet</portlet-ref>
- </portlet>
- <title>WSRP Admin</title>
- <access-permissions>manager:/platform/administrators</access-permissions>
- <show-info-bar>false</show-info-bar>
- </portlet-application>
- </page>
-
-</page-set>
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/pages.xml (from rev 6033, portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/pages.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/pages.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/portal/group/platform/administrators/pages.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<page-set
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_1 http://www.gatein.org/xml/ns/gatein_objects_1_1"
+ xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_1">
+
+ <page>
+ <name>wsrpConfiguration</name>
+ <title>WSRP Admin</title>
+ <access-permissions>manager:/platform/administrators</access-permissions>
+ <edit-permission>manager:/platform/administrators</edit-permission>
+ <portlet-application>
+ <portlet>
+ <application-ref>wsrp-admin-gui</application-ref>
+ <portlet-ref>WSRPConfigurationPortlet</portlet-ref>
+ </portlet>
+ <title>WSRP Admin</title>
+ <access-permissions>manager:/platform/administrators</access-permissions>
+ <show-info-bar>false</show-info-bar>
+ </portlet-application>
+ </page>
+
+</page-set>
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-configuration-nodetypes.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-configuration-nodetypes.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-configuration-nodetypes.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,141 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
- xmlns:jcr="http://www.jcp.org/jcr/1.0">
-
- <nodeType name="wsrp:producerconfiguration" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="strictmode" requiredType="boolean" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- <childNodeDefinitions>
- <childNodeDefinition name="registrationrequirements" defaultPrimaryType="wsrp:registrationrequirements"
- autoCreated="true" mandatory="false" onParentVersion="COPY" protected="false"
- sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>wsrp:registrationrequirements</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="wsrp:registrationrequirements" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="registrationrequired" requiredType="boolean" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="registrationrequiredforfulldescription" requiredType="boolean" autoCreated="false"
- mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="policyclassname" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="validatorclassname" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- <childNodeDefinitions>
- <childNodeDefinition name="*" defaultPrimaryType="wsrp:registrationpropertydescription" autoCreated="false"
- mandatory="false"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>wsrp:registrationpropertydescription</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="wsrp:registrationproperty" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="value" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="status" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- <childNodeDefinitions>
- <childNodeDefinition name="description" defaultPrimaryType="" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>wsrp:registrationpropertydescription</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="wsrp:registrationpropertydescription" isMixin="false" hasOrderableChildNodes="true"
- primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="name" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="type" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="description" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="hint" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="label" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
-</nodeTypes>
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-configuration-nodetypes.xml (from rev 6033, portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-configuration-nodetypes.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-configuration-nodetypes.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-configuration-nodetypes.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
+ xmlns:jcr="http://www.jcp.org/jcr/1.0">
+
+ <nodeType name="wsrp:producerconfiguration" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="strictmode" requiredType="boolean" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ <childNodeDefinitions>
+ <childNodeDefinition name="registrationrequirements" defaultPrimaryType="wsrp:registrationrequirements"
+ autoCreated="true" mandatory="false" onParentVersion="COPY" protected="false"
+ sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>wsrp:registrationrequirements</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="wsrp:registrationrequirements" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="registrationrequired" requiredType="boolean" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="registrationrequiredforfulldescription" requiredType="boolean" autoCreated="false"
+ mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="policyclassname" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="validatorclassname" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ <childNodeDefinitions>
+ <childNodeDefinition name="*" defaultPrimaryType="wsrp:registrationpropertydescription" autoCreated="false"
+ mandatory="false"
+ onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>wsrp:registrationpropertydescription</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="wsrp:registrationproperty" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="value" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="status" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ <childNodeDefinitions>
+ <childNodeDefinition name="description" defaultPrimaryType="" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>wsrp:registrationpropertydescription</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="wsrp:registrationpropertydescription" isMixin="false" hasOrderableChildNodes="true"
+ primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="name" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="type" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="description" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="hint" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="label" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+
+</nodeTypes>
\ No newline at end of file
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-pc-nodetypes.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-pc-nodetypes.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-pc-nodetypes.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
- xmlns:jcr="http://www.jcp.org/jcr/1.0">
- <nodeType name="pc:producerstates" isMixin="false" hasOrderableChildNodes="false">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions/>
- <childNodeDefinitions>
- <childNodeDefinition name="*" defaultPrimaryType="" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>pc:statecontext</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="pc:statecontext" isMixin="false" hasOrderableChildNodes="false">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="id" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- <childNodeDefinitions>
- <childNodeDefinition name="state" defaultPrimaryType="pc:state" autoCreated="true" mandatory="false"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>pc:state</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="pc:state" isMixin="false" hasOrderableChildNodes="false">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="pc:portletid" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="pc:terminationtime" requiredType="Date" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="*" requiredType="undefined" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- <childNodeDefinitions/>
- </nodeType>
-
-</nodeTypes>
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-pc-nodetypes.xml (from rev 6033, portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-pc-nodetypes.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-pc-nodetypes.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-pc-nodetypes.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
+ xmlns:jcr="http://www.jcp.org/jcr/1.0">
+ <nodeType name="pc:producerstates" isMixin="false" hasOrderableChildNodes="false">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions/>
+ <childNodeDefinitions>
+ <childNodeDefinition name="*" defaultPrimaryType="" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>pc:statecontext</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="pc:statecontext" isMixin="false" hasOrderableChildNodes="false">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="id" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ <childNodeDefinitions>
+ <childNodeDefinition name="state" defaultPrimaryType="pc:state" autoCreated="true" mandatory="false"
+ onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>pc:state</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="pc:state" isMixin="false" hasOrderableChildNodes="false">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="pc:portletid" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="pc:terminationtime" requiredType="Date" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="*" requiredType="undefined" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ <childNodeDefinitions/>
+ </nodeType>
+
+</nodeTypes>
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-registrations-nodetypes.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-registrations-nodetypes.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-registrations-nodetypes.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,198 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
- xmlns:jcr="http://www.jcp.org/jcr/1.0">
-
- <nodeType name="wsrp:consumersandgroups" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <childNodeDefinitions>
- <childNodeDefinition name="*" defaultPrimaryType="wsrp:consumer"
- autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false"
- sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>wsrp:consumer</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- <childNodeDefinition name="*" defaultPrimaryType="wsrp:consumergroup"
- autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false"
- sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>wsrp:consumergroup</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="wsrp:consumer" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="name" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="id" requiredType="String" autoCreated="false"
- mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="consumeragent" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="status" requiredType="String"
- autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="group" requiredType="Path" autoCreated="false" mandatory="false"
- onParentVersion="COPY"
- protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- <childNodeDefinitions>
- <childNodeDefinition name="*" defaultPrimaryType="wsrp:registration" autoCreated="false"
- mandatory="false"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>wsrp:registration</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- <childNodeDefinition name="capabilities" defaultPrimaryType="wsrp:consumercapabilities" autoCreated="true"
- mandatory="false"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>wsrp:consumercapabilities</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="wsrp:registration" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="status" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="registrationhandle" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="portlethandles" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="true">
- </propertyDefinition>
- </propertyDefinitions>
- <childNodeDefinitions>
- <childNodeDefinition name="properties" defaultPrimaryType="wsrp:registrationproperties" autoCreated="false"
- mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>wsrp:registrationproperties</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="wsrp:registrationproperties" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <!-- residual properties so that we can store an arbritrary number of registration properties -->
- <propertyDefinitions>
- <propertyDefinition name="*" requiredType="undefined" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
- <nodeType name="wsrp:consumergroup" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="name" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="status" requiredType="String"
- autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- <childNodeDefinitions>
- <childNodeDefinition name="*" defaultPrimaryType="wsrp:consumer" autoCreated="false"
- mandatory="false"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>wsrp:consumer</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="wsrp:consumercapabilities" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="modes" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="true">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="windowstates" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="true">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="userscopes" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="true">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="userprofiledata" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="true">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="supportsgetmethod" requiredType="boolean" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
-</nodeTypes>
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-registrations-nodetypes.xml (from rev 6033, portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-registrations-nodetypes.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-registrations-nodetypes.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/producer-registrations-nodetypes.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,198 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
+ xmlns:jcr="http://www.jcp.org/jcr/1.0">
+
+ <nodeType name="wsrp:consumersandgroups" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <childNodeDefinitions>
+ <childNodeDefinition name="*" defaultPrimaryType="wsrp:consumer"
+ autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false"
+ sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>wsrp:consumer</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ <childNodeDefinition name="*" defaultPrimaryType="wsrp:consumergroup"
+ autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false"
+ sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>wsrp:consumergroup</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="wsrp:consumer" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="name" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="id" requiredType="String" autoCreated="false"
+ mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="consumeragent" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="status" requiredType="String"
+ autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="group" requiredType="Path" autoCreated="false" mandatory="false"
+ onParentVersion="COPY"
+ protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ <childNodeDefinitions>
+ <childNodeDefinition name="*" defaultPrimaryType="wsrp:registration" autoCreated="false"
+ mandatory="false"
+ onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>wsrp:registration</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ <childNodeDefinition name="capabilities" defaultPrimaryType="wsrp:consumercapabilities" autoCreated="true"
+ mandatory="false"
+ onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>wsrp:consumercapabilities</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="wsrp:registration" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="status" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="registrationhandle" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="portlethandles" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="true">
+ </propertyDefinition>
+ </propertyDefinitions>
+ <childNodeDefinitions>
+ <childNodeDefinition name="properties" defaultPrimaryType="wsrp:registrationproperties" autoCreated="false"
+ mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>wsrp:registrationproperties</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="wsrp:registrationproperties" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <!-- residual properties so that we can store an arbritrary number of registration properties -->
+ <propertyDefinitions>
+ <propertyDefinition name="*" requiredType="undefined" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+
+ <nodeType name="wsrp:consumergroup" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="name" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="status" requiredType="String"
+ autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ <childNodeDefinitions>
+ <childNodeDefinition name="*" defaultPrimaryType="wsrp:consumer" autoCreated="false"
+ mandatory="false"
+ onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>wsrp:consumer</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="wsrp:consumercapabilities" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="modes" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="true">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="windowstates" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="true">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="userscopes" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="true">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="userprofiledata" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="true">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="supportsgetmethod" requiredType="boolean" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+
+</nodeTypes>
\ No newline at end of file
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/repository-configuration.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/repository-configuration.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/repository-configuration.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,176 +0,0 @@
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<repository-service default-repository="repository">
- <repositories>
- <repository name="repository" system-workspace="system" default-workspace="portal-system">
- <security-domain>gatein-domain</security-domain>
- <access-control>optional</access-control>
- <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
- <workspaces>
- <!-- WSRP -->
- <workspace name="wsrp-system">
- <container
- class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="${gatein.jcr.datasource.name}${container.name.suffix}"/>
- <property name="dialect" value="${gatein.jcr.datasource.dialect}"/>
- <property name="multi-db" value="false"/>
- <property name="update-storage" value="true"/>
- <property name="max-buffer-size" value="204800"/>
- <property name="swap-directory" value="${gatein.jcr.data.dir}/swap/wsrp${container.name.suffix}"/>
- </properties>
- <value-storages>
- <value-storage id="wsrp-system"
- class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="${gatein.jcr.storage.data.dir}/wsrp${container.name.suffix}"/>
- </properties>
- <filters>
- <filter property-type="Binary"/>
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured"/>
- <property name="root-permissions"
- value="*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove"/>
- </properties>
- </initializer>
- <cache enabled="true"
- class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
- <properties>
- <property name="jbosscache-configuration" value="${gatein.jcr.cache.config}"/>
- <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
- <property name="jgroups-multiplexer-stack" value="true"/>
- <property name="jbosscache-cluster-name" value="jcr-${container.name.suffix}-wsrp-system"/>
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir"
- value="${gatein.jcr.index.data.dir}/wsrp-system${container.name.suffix}"/>
- <property name="changesfilter-class" value="${gatein.jcr.index.changefilterclass}"/>
- <property name="jbosscache-configuration" value="${gatein.jcr.index.cache.config}"/>
- <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
- <property name="jgroups-multiplexer-stack" value="true"/>
- <property name="jbosscache-cluster-name" value="jcrindexer-${container.name.suffix}-wsrp-system"/>
- <property name="max-volatile-time" value="60"/>
- </properties>
- </query-handler>
- <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
- <properties>
- <property name="time-out" value="15m"/>
- <property name="jbosscache-configuration" value="${gatein.jcr.lock.cache.config}"/>
- <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
- <property name="jgroups-multiplexer-stack" value="true"/>
- <property name="jbosscache-cluster-name" value="jcrlock-${container.name.suffix}-wsrp-system"/>
- <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlock_wsrp_system"/>
- <property name="jbosscache-cl-cache.jdbc.table.create" value="true"/>
- <property name="jbosscache-cl-cache.jdbc.table.drop" value="false"/>
- <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="pk"/>
- <property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn"/>
- <property name="jbosscache-cl-cache.jdbc.node.column" value="node"/>
- <property name="jbosscache-cl-cache.jdbc.parent.column" value="parent"/>
- <property name="jbosscache-cl-cache.jdbc.datasource"
- value="${gatein.jcr.datasource.name}${container.name.suffix}"/>
- </properties>
- </lock-manager>
- </workspace>
-
- <!-- Producer portlet states -->
- <workspace name="pc-system">
- <container
- class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="${gatein.jcr.datasource.name}${container.name.suffix}"/>
- <property name="dialect" value="${gatein.jcr.datasource.dialect}"/>
- <property name="multi-db" value="false"/>
- <property name="update-storage" value="true"/>
- <property name="max-buffer-size" value="204800"/>
- <property name="swap-directory" value="${gatein.jcr.data.dir}/swap/pc${container.name.suffix}"/>
- </properties>
- <value-storages>
- <value-storage id="pc-system"
- class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="${gatein.jcr.storage.data.dir}/pc${container.name.suffix}"/>
- </properties>
- <filters>
- <filter property-type="Binary"/>
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured"/>
- <property name="root-permissions"
- value="*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove"/>
- </properties>
- </initializer>
- <cache enabled="true"
- class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
- <properties>
- <property name="jbosscache-configuration" value="${gatein.jcr.cache.config}"/>
- <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
- <property name="jgroups-multiplexer-stack" value="true"/>
- <property name="jbosscache-cluster-name" value="jcr-${container.name.suffix}-pc-system"/>
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="${gatein.jcr.index.data.dir}/pc-system${container.name.suffix}"/>
- <property name="changesfilter-class" value="${gatein.jcr.index.changefilterclass}"/>
- <property name="jbosscache-configuration" value="${gatein.jcr.index.cache.config}"/>
- <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
- <property name="jgroups-multiplexer-stack" value="true"/>
- <property name="jbosscache-cluster-name" value="jcrindexer-${container.name.suffix}-pc-system"/>
- <property name="max-volatile-time" value="60"/>
- </properties>
- </query-handler>
- <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
- <properties>
- <property name="time-out" value="15m"/>
- <property name="jbosscache-configuration" value="${gatein.jcr.lock.cache.config}"/>
- <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
- <property name="jgroups-multiplexer-stack" value="true"/>
- <property name="jbosscache-cluster-name" value="jcrlock-${container.name.suffix}-pc-system"/>
- <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlock_portlet_state_system"/>
- <property name="jbosscache-cl-cache.jdbc.table.create" value="true"/>
- <property name="jbosscache-cl-cache.jdbc.table.drop" value="false"/>
- <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="pk"/>
- <property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn"/>
- <property name="jbosscache-cl-cache.jdbc.node.column" value="node"/>
- <property name="jbosscache-cl-cache.jdbc.parent.column" value="parent"/>
- <property name="jbosscache-cl-cache.jdbc.datasource"
- value="${gatein.jcr.datasource.name}${container.name.suffix}"/>
- </properties>
- </lock-manager>
- </workspace>
- </workspaces>
- </repository>
- </repositories>
-</repository-service>
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/repository-configuration.xml (from rev 6033, portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/repository-configuration.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/repository-configuration.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/repository-configuration.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,176 @@
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<repository-service default-repository="repository">
+ <repositories>
+ <repository name="repository" system-workspace="system" default-workspace="portal-system">
+ <security-domain>gatein-domain</security-domain>
+ <access-control>optional</access-control>
+ <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+ <workspaces>
+ <!-- WSRP -->
+ <workspace name="wsrp-system">
+ <container
+ class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="${gatein.jcr.datasource.name}${container.name.suffix}"/>
+ <property name="dialect" value="${gatein.jcr.datasource.dialect}"/>
+ <property name="multi-db" value="false"/>
+ <property name="update-storage" value="true"/>
+ <property name="max-buffer-size" value="204800"/>
+ <property name="swap-directory" value="${gatein.jcr.data.dir}/swap/wsrp${container.name.suffix}"/>
+ </properties>
+ <value-storages>
+ <value-storage id="wsrp-system"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="${gatein.jcr.storage.data.dir}/wsrp${container.name.suffix}"/>
+ </properties>
+ <filters>
+ <filter property-type="Binary"/>
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured"/>
+ <property name="root-permissions"
+ value="*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove"/>
+ </properties>
+ </initializer>
+ <cache enabled="true"
+ class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
+ <properties>
+ <property name="jbosscache-configuration" value="${gatein.jcr.cache.config}"/>
+ <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
+ <property name="jgroups-multiplexer-stack" value="true"/>
+ <property name="jbosscache-cluster-name" value="jcr-${container.name.suffix}-wsrp-system"/>
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir"
+ value="${gatein.jcr.index.data.dir}/wsrp-system${container.name.suffix}"/>
+ <property name="changesfilter-class" value="${gatein.jcr.index.changefilterclass}"/>
+ <property name="jbosscache-configuration" value="${gatein.jcr.index.cache.config}"/>
+ <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
+ <property name="jgroups-multiplexer-stack" value="true"/>
+ <property name="jbosscache-cluster-name" value="jcrindexer-${container.name.suffix}-wsrp-system"/>
+ <property name="max-volatile-time" value="60"/>
+ </properties>
+ </query-handler>
+ <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
+ <properties>
+ <property name="time-out" value="15m"/>
+ <property name="jbosscache-configuration" value="${gatein.jcr.lock.cache.config}"/>
+ <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
+ <property name="jgroups-multiplexer-stack" value="true"/>
+ <property name="jbosscache-cluster-name" value="jcrlock-${container.name.suffix}-wsrp-system"/>
+ <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlock_wsrp_system"/>
+ <property name="jbosscache-cl-cache.jdbc.table.create" value="true"/>
+ <property name="jbosscache-cl-cache.jdbc.table.drop" value="false"/>
+ <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="pk"/>
+ <property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn"/>
+ <property name="jbosscache-cl-cache.jdbc.node.column" value="node"/>
+ <property name="jbosscache-cl-cache.jdbc.parent.column" value="parent"/>
+ <property name="jbosscache-cl-cache.jdbc.datasource"
+ value="${gatein.jcr.datasource.name}${container.name.suffix}"/>
+ </properties>
+ </lock-manager>
+ </workspace>
+
+ <!-- Producer portlet states -->
+ <workspace name="pc-system">
+ <container
+ class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="${gatein.jcr.datasource.name}${container.name.suffix}"/>
+ <property name="dialect" value="${gatein.jcr.datasource.dialect}"/>
+ <property name="multi-db" value="false"/>
+ <property name="update-storage" value="true"/>
+ <property name="max-buffer-size" value="204800"/>
+ <property name="swap-directory" value="${gatein.jcr.data.dir}/swap/pc${container.name.suffix}"/>
+ </properties>
+ <value-storages>
+ <value-storage id="pc-system"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="${gatein.jcr.storage.data.dir}/pc${container.name.suffix}"/>
+ </properties>
+ <filters>
+ <filter property-type="Binary"/>
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured"/>
+ <property name="root-permissions"
+ value="*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove"/>
+ </properties>
+ </initializer>
+ <cache enabled="true"
+ class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
+ <properties>
+ <property name="jbosscache-configuration" value="${gatein.jcr.cache.config}"/>
+ <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
+ <property name="jgroups-multiplexer-stack" value="true"/>
+ <property name="jbosscache-cluster-name" value="jcr-${container.name.suffix}-pc-system"/>
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="${gatein.jcr.index.data.dir}/pc-system${container.name.suffix}"/>
+ <property name="changesfilter-class" value="${gatein.jcr.index.changefilterclass}"/>
+ <property name="jbosscache-configuration" value="${gatein.jcr.index.cache.config}"/>
+ <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
+ <property name="jgroups-multiplexer-stack" value="true"/>
+ <property name="jbosscache-cluster-name" value="jcrindexer-${container.name.suffix}-pc-system"/>
+ <property name="max-volatile-time" value="60"/>
+ </properties>
+ </query-handler>
+ <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
+ <properties>
+ <property name="time-out" value="15m"/>
+ <property name="jbosscache-configuration" value="${gatein.jcr.lock.cache.config}"/>
+ <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
+ <property name="jgroups-multiplexer-stack" value="true"/>
+ <property name="jbosscache-cluster-name" value="jcrlock-${container.name.suffix}-pc-system"/>
+ <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlock_portlet_state_system"/>
+ <property name="jbosscache-cl-cache.jdbc.table.create" value="true"/>
+ <property name="jbosscache-cl-cache.jdbc.table.drop" value="false"/>
+ <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="pk"/>
+ <property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn"/>
+ <property name="jbosscache-cl-cache.jdbc.node.column" value="node"/>
+ <property name="jbosscache-cl-cache.jdbc.parent.column" value="parent"/>
+ <property name="jbosscache-cl-cache.jdbc.datasource"
+ value="${gatein.jcr.datasource.name}${container.name.suffix}"/>
+ </properties>
+ </lock-manager>
+ </workspace>
+ </workspaces>
+ </repository>
+ </repositories>
+</repository-service>
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/wsrp-configuration.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/wsrp-configuration.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/wsrp-configuration.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,229 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<configuration
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
-
- <component>
- <key>org.gatein.integration.wsrp.WSRPServiceIntegration</key>
- <type>org.gatein.integration.wsrp.WSRPServiceIntegration</type>
- <init-params>
- <value-param>
- <name>producerConfigLocation</name>
- <description>Location of the default producer configuration file</description>
- <value>conf/wsrp-producer-config.xml</value>
- </value-param>
- <value-param>
- <name>consumersConfigLocation</name>
- <description>Location of the default consumers configuration file</description>
- <value>conf/wsrp-consumers-config.xml</value>
- </value-param>
- </init-params>
- </component>
-
- <!-- TODO: this should be removed to a JBoss5 specific configuration file -->
- <component>
- <type>org.gatein.portal.wsrp.wss.JBoss5WSSServiceIntegration</type>
- </component>
-
-
- <external-component-plugins>
- <target-component>org.exoplatform.services.jcr.RepositoryService</target-component>
- <component-plugin>
- <name>add.namespaces</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.jcr.impl.AddNamespacesPlugin</type>
- <init-params>
- <properties-param>
- <name>namespaces</name>
- <property name="wsrp" value="http://www.gatein.org/jcr/wsrp/1.0/"/>
- <property name="pc" value="http://www.gatein.org/jcr/pc/1.0/"/>
- </properties-param>
- </init-params>
- </component-plugin>
- <component-plugin>
- <name>add.nodeType</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.jcr.impl.AddNodeTypePlugin</type>
- <init-params>
- <values-param>
- <name>autoCreatedInNewRepository</name>
- <description>Node types configuration file</description>
- <value>war:/conf/wsrp/consumers-configuration-nodetypes.xml</value>
- <value>war:/conf/wsrp/producer-configuration-nodetypes.xml</value>
- <value>war:/conf/wsrp/producer-registrations-nodetypes.xml</value>
- <value>war:/conf/wsrp/producer-pc-nodetypes.xml</value>
- <value>war:/conf/wsrp/migration-nodetypes.xml</value>
- </values-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
-
- <external-component-plugins>
- <target-component>org.exoplatform.application.registry.ApplicationRegistryService</target-component>
- <component-plugin>
- <name>new.portal.portlets.registry</name>
- <set-method>initListener</set-method>
- <type>org.exoplatform.application.registry.ApplicationCategoriesPlugins</type>
- <description>this listener init the portlets are registered in PortletRegister</description>
- <init-params>
- <object-param>
- <name>administration</name>
- <description>description</description>
- <object type="org.exoplatform.application.registry.ApplicationCategory">
- <field name="name">
- <string>WSRP</string>
- </field>
- <field name="displayName">
- <string>WSRP</string>
- </field>
- <field name="description">
- <string>WSRP administration</string>
- </field>
- <field name="accessPermissions">
- <collection type="java.util.ArrayList" item-type="java.lang.String">
- <value>
- <string>*:/platform/administrators</string>
- </value>
- <value>
- <string>*:/organization/management/executive-board</string>
- </value>
- </collection>
- </field>
- <field name="applications">
- <collection type="java.util.ArrayList">
- <value>
- <object type="org.exoplatform.application.registry.Application">
- <field name="applicationName">
- <string>WSRPConfigurationPortlet</string>
- </field>
- <field name="categoryName">
- <string>WSRP</string>
- </field>
- <field name="displayName">
- <string>WSRP Configuration</string>
- </field>
- <field name="description">
- <string>WSRP Configuration</string>
- </field>
- <field name="type">
- <string>portlet</string>
- </field>
- <field name="contentId">
- <string>wsrp-admin-gui/WSRPConfigurationPortlet</string>
- </field>
- <field name="accessPermissions">
- <collection type="java.util.ArrayList" item-type="java.lang.String">
- <value>
- <string>*:/platform/administrators</string>
- </value>
- <value>
- <string>*:/organization/management/executive-board</string>
- </value>
- </collection>
- </field>
- </object>
- </value>
- </collection>
- </field>
- </object>
- </object-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
-
- <external-component-plugins>
- <target-component>org.exoplatform.portal.config.UserPortalConfigService</target-component>
- <component-plugin>
- <!-- The name of the plugin -->
- <name>new.portal.config.user.listener</name>
- <!-- The name of the method to call on the UserPortalConfigService in order to register the NewPortalConfigs -->
- <set-method>initListener</set-method>
- <!-- The full qualified name of the NewPortalConfigListener -->
- <type>org.exoplatform.portal.config.NewPortalConfigListener</type>
- <description>this listener init the portal configuration</description>
- <init-params>
- <object-param>
- <name>group.configuration</name>
- <description>description</description>
- <object type="org.exoplatform.portal.config.NewPortalConfig">
- <field name="predefinedOwner">
- <collection type="java.util.HashSet">
- <value>
- <string>platform/administrators</string>
- </value>
- </collection>
- </field>
- <field name="ownerType">
- <string>group</string>
- </field>
- <field name="templateLocation">
- <string>war:/conf/wsrp/portal</string>
- </field>
- </object>
- </object-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
-
-
- <!--<external-component-plugins>
- <target-component>org.exoplatform.commons.chromattic.ChromatticManager</target-component>
- <component-plugin>
- <name>chromattic</name>
- <set-method>addLifeCycle</set-method>
- <type>org.exoplatform.commons.chromattic.ChromatticLifeCycle</type>
- <init-params>
- <value-param>
- <name>domain-name</name>
- <value>wsrp</value>
- </value-param>
- <value-param>
- <name>workspace-name</name>
- <value>wsrp-system</value>
- </value-param>
- <values-param>
- <name>entities</name>
- <value>org.gatein.integration.wsrp.state.mapping.RegistrationPropertyDescriptionMapping</value>
- <value>org.gatein.integration.wsrp.state.consumer.mapping.ProducerInfoMapping</value>
- <value>org.gatein.integration.wsrp.state.consumer.mapping.ProducerInfosMapping</value>
- <value>org.gatein.integration.wsrp.state.consumer.mapping.RegistrationInfoMapping</value>
- <value>org.gatein.integration.wsrp.state.consumer.mapping.RegistrationPropertyMapping</value>
- <value>org.gatein.integration.wsrp.state.consumer.mapping.EndpointInfoMapping</value>
- <value>org.gatein.integration.wsrp.state.producer.configuration.mapping.ProducerConfigurationMapping</value>
- <value>org.gatein.integration.wsrp.state.producer.configuration.mapping.RegistrationRequirementsMapping</value>
- <value>org.gatein.integration.wsrp.state.producer.registrations.mapping.ConsumerCapabilitiesMapping</value>
- <value>org.gatein.integration.wsrp.state.producer.registrations.mapping.ConsumerGroupMapping</value>
- <value>org.gatein.integration.wsrp.state.producer.registrations.mapping.ConsumerMapping</value>
- <value>org.gatein.integration.wsrp.state.producer.registrations.mapping.ConsumersAndGroupsMapping</value>
- <value>org.gatein.integration.wsrp.state.producer.registrations.mapping.RegistrationMapping</value>
- <value>org.gatein.integration.wsrp.state.producer.registrations.mapping.RegistrationPropertiesMapping</value>
- </values-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>-->
-
-</configuration>
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/wsrp-configuration.xml (from rev 6033, portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/wsrp-configuration.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/wsrp-configuration.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/wsrp-configuration.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,229 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <component>
+ <key>org.gatein.integration.wsrp.WSRPServiceIntegration</key>
+ <type>org.gatein.integration.wsrp.WSRPServiceIntegration</type>
+ <init-params>
+ <value-param>
+ <name>producerConfigLocation</name>
+ <description>Location of the default producer configuration file</description>
+ <value>conf/wsrp-producer-config.xml</value>
+ </value-param>
+ <value-param>
+ <name>consumersConfigLocation</name>
+ <description>Location of the default consumers configuration file</description>
+ <value>conf/wsrp-consumers-config.xml</value>
+ </value-param>
+ </init-params>
+ </component>
+
+ <!-- TODO: this should be removed to a JBoss5 specific configuration file -->
+ <component>
+ <type>org.gatein.portal.wsrp.wss.JBoss5WSSServiceIntegration</type>
+ </component>
+
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.jcr.RepositoryService</target-component>
+ <component-plugin>
+ <name>add.namespaces</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.jcr.impl.AddNamespacesPlugin</type>
+ <init-params>
+ <properties-param>
+ <name>namespaces</name>
+ <property name="wsrp" value="http://www.gatein.org/jcr/wsrp/1.0/"/>
+ <property name="pc" value="http://www.gatein.org/jcr/pc/1.0/"/>
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>add.nodeType</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.jcr.impl.AddNodeTypePlugin</type>
+ <init-params>
+ <values-param>
+ <name>autoCreatedInNewRepository</name>
+ <description>Node types configuration file</description>
+ <value>war:/conf/wsrp/consumers-configuration-nodetypes.xml</value>
+ <value>war:/conf/wsrp/producer-configuration-nodetypes.xml</value>
+ <value>war:/conf/wsrp/producer-registrations-nodetypes.xml</value>
+ <value>war:/conf/wsrp/producer-pc-nodetypes.xml</value>
+ <value>war:/conf/wsrp/migration-nodetypes.xml</value>
+ </values-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.application.registry.ApplicationRegistryService</target-component>
+ <component-plugin>
+ <name>new.portal.portlets.registry</name>
+ <set-method>initListener</set-method>
+ <type>org.exoplatform.application.registry.ApplicationCategoriesPlugins</type>
+ <description>this listener init the portlets are registered in PortletRegister</description>
+ <init-params>
+ <object-param>
+ <name>administration</name>
+ <description>description</description>
+ <object type="org.exoplatform.application.registry.ApplicationCategory">
+ <field name="name">
+ <string>WSRP</string>
+ </field>
+ <field name="displayName">
+ <string>WSRP</string>
+ </field>
+ <field name="description">
+ <string>WSRP administration</string>
+ </field>
+ <field name="accessPermissions">
+ <collection type="java.util.ArrayList" item-type="java.lang.String">
+ <value>
+ <string>*:/platform/administrators</string>
+ </value>
+ <value>
+ <string>*:/organization/management/executive-board</string>
+ </value>
+ </collection>
+ </field>
+ <field name="applications">
+ <collection type="java.util.ArrayList">
+ <value>
+ <object type="org.exoplatform.application.registry.Application">
+ <field name="applicationName">
+ <string>WSRPConfigurationPortlet</string>
+ </field>
+ <field name="categoryName">
+ <string>WSRP</string>
+ </field>
+ <field name="displayName">
+ <string>WSRP Configuration</string>
+ </field>
+ <field name="description">
+ <string>WSRP Configuration</string>
+ </field>
+ <field name="type">
+ <string>portlet</string>
+ </field>
+ <field name="contentId">
+ <string>wsrp-admin-gui/WSRPConfigurationPortlet</string>
+ </field>
+ <field name="accessPermissions">
+ <collection type="java.util.ArrayList" item-type="java.lang.String">
+ <value>
+ <string>*:/platform/administrators</string>
+ </value>
+ <value>
+ <string>*:/organization/management/executive-board</string>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.portal.config.UserPortalConfigService</target-component>
+ <component-plugin>
+ <!-- The name of the plugin -->
+ <name>new.portal.config.user.listener</name>
+ <!-- The name of the method to call on the UserPortalConfigService in order to register the NewPortalConfigs -->
+ <set-method>initListener</set-method>
+ <!-- The full qualified name of the NewPortalConfigListener -->
+ <type>org.exoplatform.portal.config.NewPortalConfigListener</type>
+ <description>this listener init the portal configuration</description>
+ <init-params>
+ <object-param>
+ <name>group.configuration</name>
+ <description>description</description>
+ <object type="org.exoplatform.portal.config.NewPortalConfig">
+ <field name="predefinedOwner">
+ <collection type="java.util.HashSet">
+ <value>
+ <string>platform/administrators</string>
+ </value>
+ </collection>
+ </field>
+ <field name="ownerType">
+ <string>group</string>
+ </field>
+ <field name="templateLocation">
+ <string>war:/conf/wsrp/portal</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+
+
+ <!--<external-component-plugins>
+ <target-component>org.exoplatform.commons.chromattic.ChromatticManager</target-component>
+ <component-plugin>
+ <name>chromattic</name>
+ <set-method>addLifeCycle</set-method>
+ <type>org.exoplatform.commons.chromattic.ChromatticLifeCycle</type>
+ <init-params>
+ <value-param>
+ <name>domain-name</name>
+ <value>wsrp</value>
+ </value-param>
+ <value-param>
+ <name>workspace-name</name>
+ <value>wsrp-system</value>
+ </value-param>
+ <values-param>
+ <name>entities</name>
+ <value>org.gatein.integration.wsrp.state.mapping.RegistrationPropertyDescriptionMapping</value>
+ <value>org.gatein.integration.wsrp.state.consumer.mapping.ProducerInfoMapping</value>
+ <value>org.gatein.integration.wsrp.state.consumer.mapping.ProducerInfosMapping</value>
+ <value>org.gatein.integration.wsrp.state.consumer.mapping.RegistrationInfoMapping</value>
+ <value>org.gatein.integration.wsrp.state.consumer.mapping.RegistrationPropertyMapping</value>
+ <value>org.gatein.integration.wsrp.state.consumer.mapping.EndpointInfoMapping</value>
+ <value>org.gatein.integration.wsrp.state.producer.configuration.mapping.ProducerConfigurationMapping</value>
+ <value>org.gatein.integration.wsrp.state.producer.configuration.mapping.RegistrationRequirementsMapping</value>
+ <value>org.gatein.integration.wsrp.state.producer.registrations.mapping.ConsumerCapabilitiesMapping</value>
+ <value>org.gatein.integration.wsrp.state.producer.registrations.mapping.ConsumerGroupMapping</value>
+ <value>org.gatein.integration.wsrp.state.producer.registrations.mapping.ConsumerMapping</value>
+ <value>org.gatein.integration.wsrp.state.producer.registrations.mapping.ConsumersAndGroupsMapping</value>
+ <value>org.gatein.integration.wsrp.state.producer.registrations.mapping.RegistrationMapping</value>
+ <value>org.gatein.integration.wsrp.state.producer.registrations.mapping.RegistrationPropertiesMapping</value>
+ </values-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>-->
+
+</configuration>
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/web.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/web.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/web.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- id="WebApp_ID" version="2.5">
-
- <display-name>gatein-wsrp-integration</display-name>
-
- <!-- ================================================================== -->
- <!-- LISTENER -->
- <!-- ================================================================== -->
- <listener>
- <listener-class>org.exoplatform.container.web.PortalContainerConfigOwner</listener-class>
- </listener>
-</web-app>
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/web.xml (from rev 6033, portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/web.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/web.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ id="WebApp_ID" version="2.5">
+
+ <display-name>gatein-wsrp-integration</display-name>
+
+ <!-- ================================================================== -->
+ <!-- LISTENER -->
+ <!-- ================================================================== -->
+ <listener>
+ <listener-class>org.exoplatform.container.web.PortalContainerConfigOwner</listener-class>
+ </listener>
+</web-app>
\ No newline at end of file
Deleted: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/pom.xml
===================================================================
--- portal/trunk/wsrp-integration/pom.xml 2011-03-15 14:23:31 UTC (rev 6033)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -1,49 +0,0 @@
-<!--
- ~ JBoss, a division of Red Hat
- ~ Copyright 2011, 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <name>GateIn WSRP Integration</name>
-
- <groupId>org.gatein.integration</groupId>
- <artifactId>gatein-wsrp-integration-parent</artifactId>
- <version>1.0.0-Beta01-SNAPSHOT</version>
-
- <packaging>pom</packaging>
-
- <parent>
- <groupId>org.exoplatform.portal</groupId>
- <artifactId>exo.portal.parent</artifactId>
- <version>3.2.0-Beta01-SNAPSHOT</version>
- </parent>
-
- <description>GateIn WSRP Integration extension parent</description>
- <modules>
- <module>extension-config</module>
- <module>extension-component</module>
- <module>extension-war</module>
- <module>extension-ear</module>
- </modules>
-</project>
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/pom.xml (from rev 6033, portal/trunk/wsrp-integration/pom.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/pom.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/pom.xml 2011-07-29 20:24:55 UTC (rev 6956)
@@ -0,0 +1,106 @@
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>GateIn WSRP Integration</name>
+
+ <groupId>org.gatein.integration</groupId>
+ <artifactId>gatein-wsrp-integration-parent</artifactId>
+
+ <packaging>pom</packaging>
+
+ <parent>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.parent</artifactId>
+ <version>5.2.0-epp-DEV02-SNAPSHOT</version>
+ </parent>
+
+ <description>GateIn WSRP Integration extension parent</description>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>extension-config</module>
+ <module>extension-component</module>
+ <module>extension-war</module>
+ <module>extension-ear-as5</module>
+ <module>extension-ear-as6</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>pkg-tomcat</id>
+ <modules/>
+ </profile>
+ <profile>
+ <id>pkg-tomcat7</id>
+ <modules/>
+ </profile>
+ <profile>
+ <id>pkg-jetty</id>
+ <modules/>
+ </profile>
+ <profile>
+ <id>pkg-jbossas</id>
+ <modules>
+ <module>extension-config</module>
+ <module>extension-component</module>
+ <module>extension-war</module>
+ <module>extension-ear-as5</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>pkg-jbossas6</id>
+ <modules>
+ <module>extension-config</module>
+ <module>extension-component</module>
+ <module>extension-war</module>
+ <module>extension-ear-as6</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>pkg-jbossas5</id>
+ <modules>
+ <module>extension-config</module>
+ <module>extension-component</module>
+ <module>extension-war</module>
+ <module>extension-ear-as5</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>epp-distribution</id>
+ <modules>
+ <module>extension-config</module>
+ <module>extension-component</module>
+ <module>extension-war</module>
+ <module>extension-ear</module>
+ </modules>
+ </profile>
+ </profiles>
+</project>
\ No newline at end of file
13 years, 5 months
gatein SVN: r6955 - portal/branches/gatein-management.
by do-not-reply@jboss.org
Author: nscavell
Date: 2011-07-29 14:51:47 -0400 (Fri, 29 Jul 2011)
New Revision: 6955
Modified:
portal/branches/gatein-management/pom.xml
Log:
Update gatein-management dependency version.
Modified: portal/branches/gatein-management/pom.xml
===================================================================
--- portal/branches/gatein-management/pom.xml 2011-07-29 18:36:01 UTC (rev 6954)
+++ portal/branches/gatein-management/pom.xml 2011-07-29 18:51:47 UTC (rev 6955)
@@ -49,7 +49,7 @@
<org.picketlink.idm>1.3.0.Alpha03</org.picketlink.idm>
<org.gatein.wsrp.version>2.1.0-Beta04</org.gatein.wsrp.version>
<org.gatein.mop.version>1.1.0-Beta05</org.gatein.mop.version>
- <org.gatein.mgmt.version>1.0.0-Alpha03-SNAPSHOT</org.gatein.mgmt.version>
+ <org.gatein.mgmt.version>1.0.0-Beta01</org.gatein.mgmt.version>
<org.slf4j.version>1.5.8</org.slf4j.version>
<commons-pool.version>1.5.5</commons-pool.version>
<rhino.version>1.6R5</rhino.version>
13 years, 5 months
gatein SVN: r6954 - in portal/branches/gatein-management: component/common and 21 other directories.
by do-not-reply@jboss.org
Author: nscavell
Date: 2011-07-29 14:36:01 -0400 (Fri, 29 Jul 2011)
New Revision: 6954
Added:
portal/branches/gatein-management/component/common/src/main/java/org/gatein/
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/Exceptions.java
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/StaxNavUtils.java
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilder.java
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilderImpl.java
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriter.java
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterImpl.java
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueType.java
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueTypes.java
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilder.java
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilderImpl.java
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilder.java
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/NoOpFormatter.java
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/SimpleFormatter.java
portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/XmlStreamingFormatter.java
portal/branches/gatein-management/component/common/src/test/java/org/gatein/
portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/
portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/
portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/
portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/AbstractStaxWriterTest.java
portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/LocalStaxWriterTest.java
portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/QualifiedStaxWriterTest.java
Modified:
portal/branches/gatein-management/component/common/pom.xml
portal/branches/gatein-management/component/portal/pom.xml
portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshaller.java
portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/DelimitedValueType.java
portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshaller.java
portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshaller.java
portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshaller.java
portal/branches/gatein-management/packaging/jboss-as5/pkg/pom.xml
portal/branches/gatein-management/packaging/jboss-as6/pkg/pom.xml
portal/branches/gatein-management/packaging/jetty/pkg/pom.xml
portal/branches/gatein-management/packaging/tomcat/pkg/pom.xml
portal/branches/gatein-management/pom.xml
Log:
Move stax writer into gatein, update staxnav version.
Modified: portal/branches/gatein-management/component/common/pom.xml
===================================================================
--- portal/branches/gatein-management/component/common/pom.xml 2011-07-29 17:42:53 UTC (rev 6953)
+++ portal/branches/gatein-management/component/common/pom.xml 2011-07-29 18:36:01 UTC (rev 6954)
@@ -67,6 +67,11 @@
<groupId>org.chromattic</groupId>
<artifactId>chromattic.spi</artifactId>
</dependency>
+ <!-- Staxnav -->
+ <dependency>
+ <groupId>org.staxnav</groupId>
+ <artifactId>staxnav.core</artifactId>
+ </dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
@@ -86,6 +91,12 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>1.8.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.chromattic</groupId>
<artifactId>chromattic.core</artifactId>
<scope>test</scope>
Added: portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/Exceptions.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/Exceptions.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/Exceptions.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.navigator;
+
+import org.staxnav.StaxNavException;
+import org.staxnav.StaxNavigator;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class Exceptions
+{
+ public static <N> StaxNavException expectedElement(StaxNavigator<N> navigator, N expected)
+ {
+ return expectedElement(navigator, navigator.getNaming().getLocalPart(expected));
+ }
+
+ public static StaxNavException expectedElement(StaxNavigator navigator, String expected)
+ {
+ StringBuilder message = new StringBuilder().append("Expected '").append(expected)
+ .append("' but found '").append(navigator.getLocalName()).append("' instead.");
+
+ return new StaxNavException(navigator.getLocation(), message.toString());
+ }
+
+ public static StaxNavException unexpectedElement(StaxNavigator navigator)
+ {
+ return new StaxNavException(navigator.getLocation(), "Unexpected element '" + navigator.getLocalName() + "'");
+ }
+
+ public static StaxNavException unknownElement(StaxNavigator navigator)
+ {
+ return new StaxNavException(navigator.getLocation(), "Unknown element '" + navigator.getLocalName() + "'");
+ }
+
+ public static StaxNavException invalidSequence(StaxNavigator navigator)
+ {
+ return new StaxNavException(navigator.getLocation(), "Element '" + navigator.getLocalName() + "' is out of sequence.");
+ }
+
+ public static StaxNavException contentRequired(StaxNavigator navigator)
+ {
+ return new StaxNavException(navigator.getLocation(), "Content for element '" + navigator.getLocalName() + "' is required.");
+ }
+
+ public static StaxNavException invalidParent(StaxNavigator navigator)
+ {
+ return new StaxNavException(navigator.getLocation(), "Invalid parent for element '" + navigator.getLocalName() + "'");
+ }
+
+ public static StaxNavException unexpectedEndOfFile(StaxNavigator navigator)
+ {
+ return new StaxNavException(navigator.getLocation(), "Unexpected end of file.");
+ }
+}
Added: portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/StaxNavUtils.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/StaxNavUtils.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/StaxNavUtils.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,197 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.navigator;
+
+import org.gatein.common.xml.stax.navigator.builder.StaxNavBuilder;
+import org.gatein.common.xml.stax.navigator.builder.StaxNavBuilderImpl;
+import org.staxnav.EnumElement;
+import org.staxnav.Naming;
+import org.staxnav.StaxNavException;
+import org.staxnav.StaxNavigator;
+import org.staxnav.ValueType;
+
+import javax.xml.namespace.QName;
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.gatein.common.xml.stax.navigator.Exceptions.*;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class StaxNavUtils
+{
+ public static <N> StaxNavigator<N> createNavigator(Naming<N> naming, InputStream in) throws StaxNavException
+ {
+ return buildDefaultNavigator().withInputStream(in).build(naming);
+ }
+
+ public static StaxNavigator<String> createNavigator(InputStream in) throws StaxNavException
+ {
+ return createNavigator(new Naming.Local(), in);
+ }
+
+ public static StaxNavigator<QName> createQualifiedNavigator(InputStream in) throws StaxNavException
+ {
+ return createNavigator(new Naming.Qualified(), in);
+ }
+
+ public static <E extends Enum<E> & EnumElement<E>> StaxNavigator<E> createNavigator(Class<E> enumeratedClass,
+ E noSuchElement, InputStream in) throws StaxNavException
+ {
+ Naming<E> naming;
+ if (EnumElement.class.isAssignableFrom(enumeratedClass))
+ {
+ naming = new Naming.Enumerated.Mapped<E>(enumeratedClass, noSuchElement);
+ }
+ else
+ {
+ naming = new Naming.Enumerated.Simple<E>(enumeratedClass, noSuchElement);
+ }
+
+ return createNavigator(naming, in);
+ }
+
+ public static <N> StaxNavigator<N> createNavigator(Naming<N> naming, Reader reader) throws StaxNavException
+ {
+ return buildDefaultNavigator().withReader(reader).build(naming);
+ }
+
+ public static StaxNavigator<String> createNavigator(Reader reader) throws StaxNavException
+ {
+ return createNavigator(new Naming.Local(), reader);
+ }
+
+ public static StaxNavigator<QName> createQualifiedNavigator(Reader reader) throws StaxNavException
+ {
+ return createNavigator(new Naming.Qualified(), reader);
+ }
+
+ public static <E extends Enum<E> & EnumElement<E>> StaxNavigator<E> createNavigator(Class<E> enumeratedClass,
+ E noSuchElement, Reader reader) throws StaxNavException
+ {
+ Naming<E> naming;
+ if (EnumElement.class.isAssignableFrom(enumeratedClass))
+ {
+ naming = new Naming.Enumerated.Mapped<E>(enumeratedClass, noSuchElement);
+ }
+ else
+ {
+ naming = new Naming.Enumerated.Simple<E>(enumeratedClass, noSuchElement);
+ }
+
+ return createNavigator(naming, reader);
+ }
+
+ public static <N> void requiresChild(StaxNavigator<N> navigator, N element)
+ {
+ if (navigator.child() != element)
+ {
+ throw expectedElement(navigator, element);
+ }
+ }
+
+ public static <N> void requiresSibling(StaxNavigator<N> navigator, N element)
+ {
+ if (!navigator.sibling(element))
+ {
+ throw expectedElement(navigator, element);
+ }
+ }
+
+ public static String getRequiredAttribute(StaxNavigator navigator, String attributeName) throws StaxNavException
+ {
+ String value = navigator.getAttribute(attributeName);
+ if (value == null)
+ {
+ throw new StaxNavException(navigator.getLocation(), "Attribute '" + attributeName + "' is required for element '" + navigator.getLocalName() + "'");
+ }
+
+ return value;
+ }
+
+ public static <N> String getContent(StaxNavigator<N> navigator, boolean trim)
+ {
+ boolean before = navigator.getTrimContent();
+ try
+ {
+ navigator.setTrimContent(trim);
+ return navigator.getContent();
+ }
+ finally
+ {
+ navigator.setTrimContent(before);
+ }
+ }
+
+ public static <N> String getRequiredContent(StaxNavigator<N> navigator, boolean trim)
+ {
+ String content = getContent(navigator, trim);
+ if (content == null || content.length() == 0)
+ {
+ throw contentRequired(navigator);
+ }
+
+ return content;
+ }
+
+ public static <N, V> V parseContent(StaxNavigator<N> navigator, ValueType<V> valueType, V defaultValue)
+ {
+ String content = getContent(navigator, true);
+ if (content != null && content.length() != 0)
+ {
+ return navigator.parseContent(valueType);
+ }
+ else
+ {
+ return defaultValue;
+ }
+ }
+
+ public static <N, V> V parseRequiredContent(StaxNavigator<N> navigator, ValueType<V> valueType)
+ {
+ V value = parseContent(navigator, valueType, null);
+ if (value == null)
+ {
+ throw contentRequired(navigator);
+ }
+
+ return value;
+ }
+
+ public static <N> Set<N> forNames(N...names)
+ {
+ return new HashSet<N>(Arrays.asList(names));
+ }
+
+ private static StaxNavBuilder buildDefaultNavigator()
+ {
+ return new StaxNavBuilderImpl();
+ }
+
+ private StaxNavUtils() {}
+}
Added: portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilder.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilder.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilder.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.navigator.builder;
+
+import org.staxnav.Naming;
+import org.staxnav.StaxNavException;
+import org.staxnav.StaxNavigator;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import java.io.InputStream;
+import java.io.Reader;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public interface StaxNavBuilder
+{
+ StaxNavBuilder withProperty(String name, Object value);
+
+ StaxNavBuilder withPropertyIfSupported(String name, Object value);
+
+ StaxNavBuilder withInputStream(InputStream inputStream);
+
+ StaxNavBuilder withInputStream(InputStream inputStream, String encoding);
+
+ StaxNavBuilder withReader(Reader reader);
+
+ StaxNavBuilder withSource(Source source);
+
+ StaxNavBuilder withXmlStreamReader(XMLStreamReader reader);
+
+ <N> StaxNavigator<N> build(Naming<N> naming) throws StaxNavException, IllegalStateException;
+}
Added: portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilderImpl.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilderImpl.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/navigator/builder/StaxNavBuilderImpl.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,203 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.navigator.builder;
+
+import org.staxnav.Naming;
+import org.staxnav.StaxNavException;
+import org.staxnav.StaxNavigator;
+import org.staxnav.StaxNavigatorFactory;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class StaxNavBuilderImpl implements StaxNavBuilder
+{
+ private Object input;
+ private String inputEncoding;
+ private XMLStreamReader reader;
+
+ private Map<String, Object> properties = new HashMap<String, Object>();
+ private Map<String, Object> supportedProperties = new HashMap<String, Object>();
+
+ @Override
+ public StaxNavBuilder withProperty(String name, Object value)
+ {
+ if (name == null) throw new IllegalArgumentException("name is null");
+ if (value == null) throw new IllegalArgumentException("value is null");
+
+ properties.put(name, value);
+ return this;
+ }
+
+ @Override
+ public StaxNavBuilder withPropertyIfSupported(String name, Object value)
+ {
+ if (name == null) throw new IllegalArgumentException("name is null");
+ if (value == null) throw new IllegalArgumentException("value is null");
+
+ supportedProperties.put(name, value);
+ return this;
+ }
+
+ @Override
+ public StaxNavBuilder withInputStream(InputStream inputStream)
+ {
+ if (inputStream == null) throw new IllegalArgumentException("inputStream is null");
+
+ input = inputStream;
+ return this;
+ }
+
+ @Override
+ public StaxNavBuilder withInputStream(InputStream inputStream, String encoding)
+ {
+ if (inputStream == null) throw new IllegalArgumentException("inputStream is null");
+ if (encoding == null) throw new IllegalArgumentException("encoding is null");
+
+ input = inputStream;
+ inputEncoding = encoding;
+ return this;
+ }
+
+ @Override
+ public StaxNavBuilder withReader(Reader reader)
+ {
+ if (reader == null) throw new IllegalArgumentException("reader is null");
+
+ this.input = reader;
+ return this;
+ }
+
+ @Override
+ public StaxNavBuilder withSource(Source source)
+ {
+ if (source == null) throw new IllegalArgumentException("source is null");
+
+ input = source;
+ return this;
+ }
+
+ @Override
+ public StaxNavBuilder withXmlStreamReader(XMLStreamReader reader)
+ {
+ if (reader == null) throw new IllegalArgumentException("reader is null");
+
+ this.reader = reader;
+ return this;
+ }
+
+ @Override
+ public <N> StaxNavigator<N> build(Naming<N> naming) throws StaxNavException, IllegalStateException
+ {
+ if (naming == null) throw new IllegalArgumentException("naming is null");
+
+ if (reader == null && input == null)
+ throw new IllegalStateException("Cannot build stax reader. Try calling withInputStream/withReader or pass in own XMLStreamReader.");
+
+ if (reader == null)
+ {
+ //TODO: Create solution to properly cache XMLInputFactory
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+
+ // Set properties
+ for (Map.Entry<String, Object> entry : properties.entrySet())
+ {
+ factory.setProperty(entry.getKey(), entry.getValue());
+ }
+
+ // Set properties if supported
+ for (Map.Entry<String, Object> entry : supportedProperties.entrySet())
+ {
+ String name = entry.getKey();
+ if (factory.isPropertySupported(name))
+ {
+ factory.setProperty(name, entry.getValue());
+ }
+ }
+
+ if (input instanceof InputStream)
+ {
+ if (inputEncoding == null)
+ {
+ try
+ {
+ reader = factory.createXMLStreamReader((InputStream) input, inputEncoding);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(e);
+ }
+ }
+ else
+ {
+ try
+ {
+ reader = factory.createXMLStreamReader((InputStream) input);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(null, "Exception creating XMLStreamReader with inputStream: " + input, e);
+ }
+ }
+ }
+ else if (input instanceof Reader)
+ {
+ try
+ {
+ reader = factory.createXMLStreamReader((Reader) input);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(null, "Exception creating XMLStreamReader with reader: " + input, e);
+ }
+ }
+ else if (input instanceof Source)
+ {
+ try
+ {
+ reader = factory.createXMLStreamReader((Source) input);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(null, "Exception creating XMLStreamReader with Source: " + input, e);
+ }
+ }
+ else
+ {
+ throw new IllegalStateException("Unknown input: " + input); // should never happen...
+ }
+ }
+
+ return StaxNavigatorFactory.create(naming, reader);
+ }
+}
Added: portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriter.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriter.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriter.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,152 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer;
+
+import org.staxnav.StaxNavException;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public interface StaxWriter<N>
+{
+ /**
+ * Writes the start tag of an xml element. Requires that an element has been started first.
+ *
+ * @param element element to start
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ StaxWriter<N> writeStartElement(N element) throws StaxNavException;
+
+ /**
+ * Writes an attribute for an xml element. Requires that an element has been started first.
+ *
+ * @param name the name of the attribute
+ * @param value the value of the attribute
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ StaxWriter<N> writeAttribute(String name, String value) throws StaxNavException;
+
+ /**
+ * Writes an attribute for an xml element. Requires that an element has been started first.
+ *
+ * @param name QName object representing the name of the attribute
+ * @param value the value of the attribute
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ StaxWriter<N> writeAttribute(QName name, String value) throws StaxNavException;
+
+ /**
+ * Writes xml content. Requires an xml element has been started first.
+ *
+ * @param content content to be written
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ StaxWriter<N> writeContent(String content) throws StaxNavException;
+
+ /**
+ * Writes xml content based on the ValueType responsible for converting the content to string. Requires an xml element has been started first.
+ *
+ * @param valueType object responsible for writing content to string
+ * @param content content to be written
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ <V> StaxWriter<N> writeContent(WritableValueType<V> valueType, V content) throws StaxNavException;
+
+ /**
+ * Writes an end tag for the previously started element. Requires that an element has been started first.
+ *
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ StaxWriter<N> writeEndElement() throws StaxNavException;
+
+ /**
+ * Convenience method for calling <code>writeStartElement</code>, <code>writeContent</code>, <code>writeEndElement</code>
+ *
+ * @param element element to write
+ * @param content content to be written
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ <V> StaxWriter<N> writeElement(N element, String content) throws StaxNavException;
+
+ /**
+ * Convenience method for calling <code>writeStartElement</code>, <code>writeContent</code>, <code>writeEndElement</code>
+ *
+ * @param element element to write
+ * @param valueType object responsible for writing content to string
+ * @param content content to be written
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ <V> StaxWriter<N> writeElement(N element, WritableValueType<V> valueType, V content) throws StaxNavException;
+
+ /**
+ * Writes the namespace. If prefix is an empty string, "xmlns", or null this will delegate to writeDefaultNamespace
+ * @param prefix the prefix to bind the namespace to
+ * @param uri the uri to bind the prefix to
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ StaxWriter<N> writeNamespace(String prefix, String uri) throws StaxNavException;
+
+ /**
+ * Writes the default namespace
+ * @param uri the uri to bind the default namespace to
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ StaxWriter<N> writeDefaultNamespace(String uri) throws StaxNavException;
+
+ /**
+ * Writes an xml comment
+ * @param comment the comment to write
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ StaxWriter<N> writeComment(String comment) throws StaxNavException;
+
+ /**
+ * Writes a cdata section
+ * @param cdata content of the cdata
+ * @return StaxWriter
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ StaxWriter<N> writeCData(String cdata) throws StaxNavException;
+
+ /**
+ * Calling finish will flush and close the underlying stream. It will also call any endElements for you
+ * if they were never explicitly called.
+ *
+ * @throws org.staxnav.StaxNavException if an exception occurs
+ */
+ void finish() throws StaxNavException;
+}
\ No newline at end of file
Added: portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterImpl.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterImpl.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterImpl.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,503 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer;
+
+
+import org.gatein.common.xml.stax.writer.formatting.NoOpFormatter;
+import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
+import org.staxnav.Naming;
+import org.staxnav.StaxNavException;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.util.ArrayDeque;
+import java.util.Deque;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class StaxWriterImpl<N> implements StaxWriter<N>, XMLStreamConstants
+{
+ private Naming<N> naming;
+ private XMLStreamWriter writer;
+ private XmlStreamingFormatter formatter;
+
+ private Deque<Element> elementStack = new ArrayDeque<Element>();
+
+ public StaxWriterImpl(Naming<N> naming, XMLStreamWriter writer)
+ {
+ this(naming, writer, null);
+ }
+
+ public StaxWriterImpl(Naming<N> naming, XMLStreamWriter writer, XmlStreamingFormatter formatter)
+ {
+ this(naming, writer, formatter, null, null);
+ }
+
+ public StaxWriterImpl(Naming<N> naming, XMLStreamWriter writer, XmlStreamingFormatter formatter, String encoding, String version)
+ {
+ this.naming = naming;
+ this.writer = writer;
+ if (formatter == null) formatter = new NoOpFormatter();
+
+ this.formatter = formatter;
+ elementStack.push(new RootElement(writer, formatter, encoding, version));
+ }
+
+ public StaxWriter<N> writeAttribute(String name, String value)
+ {
+ if (name == null) throw new IllegalArgumentException("name cannot be null");
+ if (value == null) throw new IllegalArgumentException("value cannot be null");
+
+ Element current = elementStack.peek();
+ current.writeAttribute(name, value);
+ return this;
+ }
+
+ public StaxWriter<N> writeAttribute(QName name, String value)
+ {
+ if (name == null) throw new IllegalArgumentException("name cannot be null");
+
+ Element current = elementStack.peek();
+ current.writeAttribute(name, value);
+ return this;
+ }
+
+ public StaxWriter<N> writeStartElement(N element) throws StaxNavException
+ {
+ Element current = elementStack.peek();
+ if (current instanceof RootElement)
+ {
+ if (((RootElement) current).started)
+ {
+ current = new StreamElement(writer, formatter);
+ elementStack.push(current);
+ }
+ }
+ else
+ {
+ current = new StreamElement(writer, formatter);
+ elementStack.push(current);
+ }
+
+ current.writeStartElement(naming, element);
+ return this;
+ }
+
+ public StaxWriter<N> writeEndElement() throws StaxNavException
+ {
+ if (elementStack.isEmpty()) throw new StaxNavException(null, "No matching startElement was found for this endElement");
+
+ elementStack.pop().end();
+
+ return this;
+ }
+
+ public StaxWriter<N> writeContent(String content) throws StaxNavException
+ {
+ return writeContent(WritableValueTypes.STRING, content);
+ }
+
+ public <V> StaxWriter<N> writeContent(WritableValueType<V> valueType, V content) throws StaxNavException
+ {
+ if (valueType == null) throw new IllegalArgumentException("valueType cannot be null.");
+ if (content == null) throw new IllegalArgumentException("content cannot be null.");
+
+ Element current = elementStack.peek();
+ current.writeContent(valueType.format(content));
+
+ return this;
+ }
+
+ public <V> StaxWriter<N> writeElement(N element, String content) throws StaxNavException
+ {
+ return writeElement(element, WritableValueTypes.STRING, content);
+ }
+
+ public <V> StaxWriter<N> writeElement(N element, WritableValueType<V> valueType, V content) throws StaxNavException
+ {
+ writeStartElement(element).writeContent(valueType, content).writeEndElement();
+ return this;
+ }
+
+ public StaxWriter<N> writeNamespace(String prefix, String uri) throws StaxNavException
+ {
+ Element current = elementStack.peek();
+ current.writeNamespace(prefix, uri);
+ return this;
+ }
+
+ public StaxWriter<N> writeDefaultNamespace(String uri) throws StaxNavException
+ {
+ Element current = elementStack.peek();
+ current.writeDefaultNamespace(uri);
+ return this;
+ }
+
+ public StaxWriter<N> writeComment(final String comment) throws StaxNavException
+ {
+ Element current = elementStack.peek();
+ current.writeComment(comment);
+ return this;
+ }
+
+ public StaxWriter<N> writeCData(String cdata) throws StaxNavException
+ {
+ Element current = elementStack.peek();
+ current.writeCData(cdata);
+ return this;
+ }
+
+ public void finish() throws StaxNavException
+ {
+ while (!elementStack.isEmpty())
+ {
+ elementStack.pop().end();
+ }
+ }
+
+ private static abstract class Element
+ {
+ abstract void writeAttribute(String name, String value) throws StaxNavException;
+
+ abstract <N> void writeAttribute(QName name, String value) throws StaxNavException;
+
+ abstract <N> void writeStartElement(Naming<N> naming, N name) throws StaxNavException;
+
+ abstract void writeContent(String content) throws StaxNavException;
+
+ abstract void writeNamespace(String prefix, String uri) throws StaxNavException;
+
+ abstract void writeDefaultNamespace(String uri) throws StaxNavException;
+
+ abstract void writeComment(String comment) throws StaxNavException;
+
+ abstract void writeCData(String cdata) throws StaxNavException;
+
+ abstract void end();
+
+ XMLStreamWriter writer;
+ XmlStreamingFormatter formatter;
+ private List<StreamClosure> closures;
+
+ Element(XMLStreamWriter writer, XmlStreamingFormatter formatter)
+ {
+ this(writer, formatter, null);
+ }
+
+ Element(XMLStreamWriter writer, XmlStreamingFormatter formatter, List<StreamClosure> closures)
+ {
+ this.writer = writer;
+ this.formatter = formatter;
+ this.closures = closures;
+ }
+
+ void apply(int event, StreamClosure closure) throws StaxNavException
+ {
+ try
+ {
+ formatter.before(writer, event);
+ closure.execute(writer);
+ formatter.after(writer, event);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(e);
+ }
+ }
+ }
+
+ private static class RootElement extends Element
+ {
+ private String encoding;
+ private String version;
+ private Element element;
+ private boolean started;
+
+ RootElement(XMLStreamWriter writer, XmlStreamingFormatter formatter, String encoding, String version)
+ {
+ super(writer, formatter);
+ this.encoding = encoding;
+ this.version = version;
+ }
+
+ public void writeAttribute(String name, String value) throws StaxNavException
+ {
+ get().writeAttribute(name, value);
+ }
+
+ public <N> void writeAttribute(QName name, String value) throws StaxNavException
+ {
+ get().writeAttribute(name, value);
+ }
+
+ public <N> void writeStartElement(Naming<N> naming, N name) throws StaxNavException
+ {
+ get().writeStartElement(naming, name);
+ started = true;
+ }
+
+ public void writeContent(String content) throws StaxNavException
+ {
+ get().writeContent(content);
+ }
+
+ public void writeNamespace(String prefix, String uri) throws StaxNavException
+ {
+ get().writeNamespace(prefix, uri);
+ }
+
+ public void writeDefaultNamespace(String uri) throws StaxNavException
+ {
+ get().writeDefaultNamespace(uri);
+ }
+
+ public void writeComment(String comment) throws StaxNavException
+ {
+ get().writeComment(comment);
+ }
+
+ public void writeCData(String cdata) throws StaxNavException
+ {
+ get().writeCData(cdata);
+ }
+
+ public void end()
+ {
+ if (started)
+ {
+ get().end();
+ }
+ endDocument();
+ }
+
+ private Element get()
+ {
+ if (element == null)
+ {
+ startDocument();
+ element = new StreamElement(writer, formatter);
+ }
+ return element;
+ }
+
+ private void startDocument() throws StaxNavException
+ {
+ apply(START_DOCUMENT, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ if (encoding == null && version == null)
+ {
+ writer.writeStartDocument();
+ }
+ else if (encoding == null)
+ {
+ writer.writeStartDocument(version);
+ }
+ else
+ {
+ writer.writeStartDocument(encoding, version);
+ }
+ }
+ });
+ }
+
+ private void endDocument() throws StaxNavException
+ {
+ try
+ {
+ apply(END_DOCUMENT, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ writer.writeEndDocument();
+ }
+ });
+
+ writer.flush();
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(e);
+ }
+ finally
+ {
+ try
+ {
+ writer.close();
+ }
+ catch (XMLStreamException e)
+ {
+ }
+ }
+ }
+ }
+
+ private static class StreamElement extends Element
+ {
+ StreamElement(XMLStreamWriter writer, XmlStreamingFormatter formatter)
+ {
+ super(writer, formatter);
+ }
+
+ public void writeAttribute(final String name, final String value) throws StaxNavException
+ {
+ apply(ATTRIBUTE, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ writer.writeAttribute(name, value);
+ }
+ });
+ }
+
+ public <N> void writeAttribute(QName name, final String value) throws StaxNavException
+ {
+ final String prefix = name.getPrefix();
+ final String uri = name.getNamespaceURI();
+ final String localPart = name.getLocalPart();
+
+ apply(ATTRIBUTE, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ if (uri == null || XMLConstants.NULL_NS_URI.equals(uri))
+ {
+ writer.writeAttribute(localPart, value);
+ }
+ else if (prefix == null || XMLConstants.DEFAULT_NS_PREFIX.equals(prefix))
+ {
+ writer.writeAttribute(uri, localPart, value);
+ }
+ else
+ {
+ writer.writeAttribute(prefix, uri, localPart, value);
+ }
+ }
+ });
+ }
+
+ public <N> void writeStartElement(Naming<N> naming, N name) throws StaxNavException
+ {
+ final String prefix = naming.getPrefix(name);
+ final String uri = naming.getURI(name);
+ final String localPart = naming.getLocalPart(name);
+
+ apply(START_ELEMENT, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ if (uri == null || XMLConstants.NULL_NS_URI.equals(uri))
+ {
+ writer.writeStartElement(localPart);
+ }
+ else if (prefix == null || XMLConstants.DEFAULT_NS_PREFIX.equals(prefix))
+ {
+ writer.writeStartElement(uri, localPart);
+ }
+ else
+ {
+ writer.writeStartElement(prefix, localPart, uri);
+ }
+ }
+ });
+ }
+
+ public void writeContent(final String content) throws StaxNavException
+ {
+ apply(CHARACTERS, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ writer.writeCharacters(content);
+ }
+ });
+ }
+
+ public void writeNamespace(final String prefix, final String uri) throws StaxNavException
+ {
+ apply(NAMESPACE, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ writer.writeNamespace(prefix, uri);
+ }
+ });
+ }
+
+ public void writeDefaultNamespace(final String uri) throws StaxNavException
+ {
+ apply(NAMESPACE, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ writer.writeDefaultNamespace(uri);
+ }
+ });
+ }
+
+ public void writeComment(final String comment) throws StaxNavException
+ {
+ apply(COMMENT, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ writer.writeComment(comment);
+ }
+ });
+ }
+
+ public void writeCData(final String cdata) throws StaxNavException
+ {
+ apply(CDATA, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ writer.writeCData(cdata);
+ }
+ });
+ }
+
+ public void end()
+ {
+ apply(END_ELEMENT, new StreamClosure()
+ {
+ public void execute(XMLStreamWriter writer) throws XMLStreamException
+ {
+ writer.writeEndElement();
+ }
+ });
+ }
+ }
+
+ private static interface StreamClosure
+ {
+ void execute(XMLStreamWriter writer) throws XMLStreamException;
+ }
+}
Added: portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/StaxWriterUtils.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,193 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer;
+
+import org.gatein.common.xml.stax.writer.builder.StaxFormatterBuilder;
+import org.gatein.common.xml.stax.writer.builder.StaxFormatterBuilderImpl;
+import org.gatein.common.xml.stax.writer.builder.StaxWriterBuilder;
+import org.gatein.common.xml.stax.writer.builder.StaxWriterBuilderImpl;
+import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
+import org.staxnav.EnumElement;
+import org.staxnav.Naming;
+import org.staxnav.StaxNavException;
+
+import javax.xml.namespace.QName;
+import java.io.OutputStream;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class StaxWriterUtils
+{
+ public static <N> StaxWriter<N> createWriter(Naming<N> naming, OutputStream outputStream) throws StaxNavException
+ {
+ return buildDefaultWriter().withOutputStream(outputStream).build(naming);
+ }
+
+ public static StaxWriter<String> createWriter(OutputStream outputStream) throws StaxNavException
+ {
+ return createWriter(new Naming.Local(), outputStream);
+ }
+
+ public static StaxWriter<QName> createQualifiedWriter(OutputStream outputStream) throws StaxNavException
+ {
+ return createWriter(new Naming.Qualified(), outputStream);
+ }
+
+ public static <E extends Enum<E> & EnumElement<E>> StaxWriter<E> createWriter(Class<E> enumeratedClass,
+ OutputStream outputStream) throws StaxNavException
+ {
+ Naming<E> naming;
+ if (EnumElement.class.isAssignableFrom(enumeratedClass))
+ {
+ naming = new Naming.Enumerated.Mapped<E>(enumeratedClass, null);
+ }
+ else
+ {
+ naming = new Naming.Enumerated.Simple<E>(enumeratedClass, null);
+ }
+
+ return createWriter(naming, outputStream);
+ }
+
+ public static <N> StaxWriter<N> createWriter(Naming<N> naming, Writer writer) throws StaxNavException
+ {
+ return buildDefaultWriter().withWriter(writer).build(naming);
+ }
+
+ public static StaxWriter<String> createWriter(Writer writer) throws StaxNavException
+ {
+ return createWriter(new Naming.Local(), writer);
+ }
+
+ public static StaxWriter<QName> createQualifiedWriter(Writer writer) throws StaxNavException
+ {
+ return createWriter(new Naming.Qualified(), writer);
+ }
+
+ public static <E extends Enum<E> & EnumElement<E>> StaxWriter<E> createWriter(Class<E> enumeratedClass,
+ Writer writer) throws StaxNavException
+ {
+ Naming<E> naming;
+ if (EnumElement.class.isAssignableFrom(enumeratedClass))
+ {
+ naming = new Naming.Enumerated.Mapped<E>(enumeratedClass, null);
+ }
+ else
+ {
+ naming = new Naming.Enumerated.Simple<E>(enumeratedClass, null);
+ }
+
+ return createWriter(naming, writer);
+ }
+
+ public static StaxWriterBuilder buildWriter()
+ {
+ return new StaxWriterBuilderImpl();
+ }
+
+ public static XmlStreamingFormatter createFormatter()
+ {
+ return buildFormatter().withNewline(DEFAULT_NEWLINE)
+ .ofIndentSize(DEFAULT_INDENT_SIZE).withIndentCharacter(DEFAULT_INDENT_CHAR)
+ .build();
+ }
+
+ public static XmlStreamingFormatter createFormatter(int indentSize)
+ {
+ return buildFormatter().withNewline(DEFAULT_NEWLINE)
+ .ofIndentSize(indentSize).withIndentCharacter(DEFAULT_INDENT_CHAR)
+ .build();
+ }
+
+ public static StaxFormatterBuilder buildFormatter()
+ {
+ return new StaxFormatterBuilderImpl();
+ }
+
+ public static <N> void writeOptionalElement(StaxWriter<N> writer, N element, String content)
+ {
+ if (content == null) return;
+
+ writer.writeElement(element, content);
+ }
+
+ public static <N, V> void writeOptionalElement(StaxWriter<N> writer, N element, WritableValueType<V> valueType, V value)
+ {
+ if (value == null) return;
+
+ writer.writeElement(element, valueType, value);
+ }
+
+ public static <N> void writeOptionalContent(StaxWriter<N> writer, N element, String content)
+ {
+ writer.writeStartElement(element);
+ if (content != null)
+ {
+ writer.writeContent(content);
+ }
+ writer.writeEndElement();
+ }
+
+ public static <N, V> void writeOptionalContent(StaxWriter<N> writer, N element, WritableValueType<V> valueType, V value)
+ {
+ writer.writeStartElement(element);
+ if (value != null)
+ {
+ writer.writeContent(valueType, value);
+ }
+ writer.writeEndElement();
+ }
+
+ private static StaxWriterBuilder buildDefaultWriter()
+ {
+ return buildWriter().withEncoding("UTF-8").withVersion("1.0")
+ .withPropertyIfSupported("com.ctc.wstx.outputEscapeCr", Boolean.FALSE)
+ .withFormatting(createFormatter());
+ }
+
+
+
+ private static final int DEFAULT_INDENT_SIZE = 3;
+ private static final char DEFAULT_INDENT_CHAR = ' ';
+ private static final String DEFAULT_NEWLINE;
+
+ static
+ {
+ String newline = null;
+ try
+ {
+ newline = System.getProperty("line.separator");
+ }
+ catch (Throwable ignored)
+ {
+ }
+ if (newline == null) newline = "\n";
+
+ DEFAULT_NEWLINE = newline;
+ }
+
+ private StaxWriterUtils(){}
+}
Added: portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueType.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueType.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueType.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer;
+
+import org.staxnav.StaxNavException;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public interface WritableValueType<V>
+{
+ String format(V value) throws StaxNavException;
+}
Added: portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueTypes.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueTypes.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/WritableValueTypes.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer;
+
+import org.staxnav.StaxNavException;
+
+import javax.xml.bind.DatatypeConverter;
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public abstract class WritableValueTypes
+{
+ /**
+ * Returns a value type for an enum class.
+ *
+ * @param <E> the enum parameter type
+ * @return the corresponding value type
+ */
+ public static <E extends Enum<E>> WritableValueType<E> getEnumType()
+ {
+ return new EnumType<E>();
+ }
+
+ public static final WritableValueType<String> STRING = new WritableValueType<String>()
+ {
+ @Override
+ public String format(String value) throws StaxNavException
+ {
+ return value;
+ }
+ };
+
+ public static final WritableValueType<String> TRIMMED_STRING = new WritableValueType<String>()
+ {
+ @Override
+ public String format(String value) throws StaxNavException
+ {
+ return value.trim();
+ }
+ };
+
+ public static final WritableValueType<Boolean> BOOLEAN = new WritableValueType<Boolean>()
+ {
+ @Override
+ public String format(Boolean value) throws StaxNavException
+ {
+ return value.toString();
+ }
+ };
+
+ public static final WritableValueType<Integer> INTEGER = new WritableValueType<Integer>()
+ {
+ @Override
+ public String format(Integer value) throws StaxNavException
+ {
+ return value.toString();
+ }
+ };
+
+ public static final WritableValueType<Date> DATE = new WritableValueType<Date>()
+ {
+ @Override
+ public String format(Date value) throws StaxNavException
+ {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(value);
+ return DatatypeConverter.printDate(cal);
+ }
+ };
+
+ public static final WritableValueType<Date> DATE_TIME = new WritableValueType<Date>()
+ {
+
+ @Override
+ public String format(Date value) throws StaxNavException
+ {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(value);
+ return DatatypeConverter.printDateTime(cal);
+ }
+ };
+
+ protected static class EnumType<E extends Enum<E>> implements WritableValueType<E>
+ {
+ @Override
+ public String format(E value) throws StaxNavException
+ {
+ return value.name();
+ }
+ }
+}
Added: portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilder.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilder.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilder.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer.builder;
+
+
+import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public interface StaxFormatterBuilder
+{
+ StaxFormatterBuilder withIndentCharacter(char indentCharacter);
+
+ StaxFormatterBuilder ofIndentSize(int indentSize);
+
+ StaxFormatterBuilder withNewline(String newline);
+
+ XmlStreamingFormatter build() throws IllegalStateException;
+}
Added: portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilderImpl.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilderImpl.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxFormatterBuilderImpl.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer.builder;
+
+
+import org.gatein.common.xml.stax.writer.formatting.SimpleFormatter;
+import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class StaxFormatterBuilderImpl implements StaxFormatterBuilder
+{
+ private Character indentCharacter;
+ private Integer indentSize;
+ private String newline;
+
+ public StaxFormatterBuilder withIndentCharacter(char indentCharacter)
+ {
+ this.indentCharacter = indentCharacter;
+ return this;
+ }
+
+ public StaxFormatterBuilder ofIndentSize(int indentSize)
+ {
+ this.indentSize = indentSize;
+ return this;
+ }
+
+ public StaxFormatterBuilder withNewline(String newline)
+ {
+ this.newline = newline;
+ return this;
+ }
+
+ public XmlStreamingFormatter build()
+ {
+ if (indentCharacter == null) throw new IllegalStateException("indent character is required value for this builder.");
+ if (indentSize == null) throw new IllegalArgumentException("indent size is a required value for this builder.");
+ if (newline == null) throw new IllegalArgumentException("newline is a required value for this builder.");
+
+ return new SimpleFormatter(indentCharacter, indentSize, newline);
+ }
+}
Added: portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilder.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilder.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilder.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer.builder;
+
+
+import org.gatein.common.xml.stax.writer.StaxWriter;
+import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
+import org.staxnav.Naming;
+import org.staxnav.StaxNavException;
+
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Result;
+import java.io.OutputStream;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public interface StaxWriterBuilder
+{
+ StaxWriterBuilder withProperty(String name, Object value);
+
+ StaxWriterBuilder withPropertyIfSupported(String name, Object value);
+
+ StaxWriterBuilder withEncoding(String encoding);
+
+ StaxWriterBuilder withVersion(String version);
+
+ StaxWriterBuilder withFormatting(XmlStreamingFormatter formatter);
+
+ StaxWriterBuilder withOutputStream(OutputStream outputStream);
+
+ StaxWriterBuilder withOutputStream(OutputStream outputStream, String encoding);
+
+ StaxWriterBuilder withWriter(Writer writer);
+
+ StaxWriterBuilder withResult(Result result);
+
+ StaxWriterBuilder withXmlStreamWriter(XMLStreamWriter writer);
+
+ <N> StaxWriter<N> build(Naming<N> naming) throws StaxNavException, IllegalStateException;
+}
Added: portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/builder/StaxWriterBuilderImpl.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,224 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer.builder;
+
+import org.gatein.common.xml.stax.writer.StaxWriter;
+import org.gatein.common.xml.stax.writer.StaxWriterImpl;
+import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
+import org.staxnav.Naming;
+import org.staxnav.StaxNavException;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Result;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class StaxWriterBuilderImpl implements StaxWriterBuilder
+{
+ private XMLStreamWriter writer;
+ private Object output;
+ private String outputEncoding;
+ private String version;
+ private String encoding;
+
+ private XmlStreamingFormatter formatter;
+
+ private Map<String, Object> properties = new HashMap<String, Object>();
+ private Map<String, Object> supportedProperties = new HashMap<String, Object>();
+
+ public StaxWriterBuilder withProperty(String name, Object value)
+ {
+ if (name == null) throw new IllegalArgumentException("name is null");
+ if (value == null) throw new IllegalArgumentException("value is null");
+
+ properties.put(name, value);
+ return this;
+ }
+
+ public StaxWriterBuilder withPropertyIfSupported(String name, Object value)
+ {
+ if (name == null) throw new IllegalArgumentException("name is null");
+ if (value == null) throw new IllegalArgumentException("value is null");
+
+ supportedProperties.put(name, value);
+ return this;
+ }
+
+ public StaxWriterBuilder withOutputStream(OutputStream outputStream)
+ {
+ if (outputStream == null) throw new IllegalArgumentException("outputStream is null");
+
+ output = outputStream;
+ return this;
+ }
+
+ public StaxWriterBuilder withOutputStream(OutputStream outputStream, String encoding)
+ {
+ if (outputStream == null) throw new IllegalArgumentException("outputStream is null");
+ if (encoding == null) throw new IllegalArgumentException("encoding is null");
+
+ output = outputStream;
+ outputEncoding = encoding;
+ return this;
+ }
+
+ public StaxWriterBuilder withWriter(Writer writer)
+ {
+ if (writer == null) throw new IllegalArgumentException("writer is null");
+
+ this.output = writer;
+ return this;
+ }
+
+ public StaxWriterBuilder withResult(Result result)
+ {
+ if (result == null) throw new IllegalArgumentException("result is null");
+
+ output = result;
+ return this;
+ }
+
+ public StaxWriterBuilder withXmlStreamWriter(XMLStreamWriter writer)
+ {
+ if (writer == null) throw new IllegalArgumentException("writer is null");
+
+ this.writer = writer;
+ return this;
+ }
+
+ public StaxWriterBuilder withEncoding(String encoding)
+ {
+ if (encoding == null) throw new IllegalArgumentException("encoding is null");
+
+ this.encoding = encoding;
+ return this;
+ }
+
+ public StaxWriterBuilder withVersion(String version)
+ {
+ if (version == null) throw new IllegalArgumentException("version is null");
+
+ this.version = version;
+ return this;
+ }
+
+ public StaxWriterBuilder withFormatting(XmlStreamingFormatter formatter)
+ {
+ if (formatter == null) throw new IllegalArgumentException("formatter is null");
+
+ this.formatter = formatter;
+ return this;
+ }
+
+ public <N> StaxWriter<N> build(Naming<N> naming) throws StaxNavException, IllegalStateException
+ {
+ if (naming == null) throw new IllegalArgumentException("naming is null");
+
+ if (writer == null && output == null)
+ throw new IllegalStateException("Cannot build stax writer. Try calling withOutputStream/withWriter or pass in own XMLStreamWriter.");
+
+ if (writer == null)
+ {
+ //TODO: Create solution to properly cache XMLOutputFactory
+ XMLOutputFactory factory = XMLOutputFactory.newInstance();
+
+ // Set properties
+ for (Map.Entry<String, Object> entry : properties.entrySet())
+ {
+ factory.setProperty(entry.getKey(), entry.getValue());
+ }
+
+ // Set properties if supported
+ for (Map.Entry<String, Object> entry : supportedProperties.entrySet())
+ {
+ String name = entry.getKey();
+ if (factory.isPropertySupported(name))
+ {
+ factory.setProperty(name, entry.getValue());
+ }
+ }
+
+ if (output instanceof OutputStream)
+ {
+ if (outputEncoding == null)
+ {
+ try
+ {
+ writer = factory.createXMLStreamWriter((OutputStream) output, outputEncoding);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(e);
+ }
+ }
+ else
+ {
+ try
+ {
+ writer = factory.createXMLStreamWriter((OutputStream) output);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(null, "Exception creating XMLStreamWriter with OutputStream: " + output, e);
+ }
+ }
+ }
+ else if (output instanceof Writer)
+ {
+ try
+ {
+ writer = factory.createXMLStreamWriter((Writer) output);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(null, "Exception creating XMLStreamWriter with Writer: " + output, e);
+ }
+ }
+ else if (output instanceof Result)
+ {
+ try
+ {
+ writer = factory.createXMLStreamWriter((Result) output);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new StaxNavException(null, "Exception creating XMLStreamWriter with Result: " + output, e);
+ }
+ }
+ else
+ {
+ throw new IllegalStateException("Unknown output: " + output); // should never happen...
+ }
+ }
+
+ return new StaxWriterImpl<N>(naming, writer, formatter, encoding, version);
+ }
+}
Added: portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/NoOpFormatter.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/NoOpFormatter.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/NoOpFormatter.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer.formatting;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class NoOpFormatter implements XmlStreamingFormatter
+{
+ @Override
+ public void before(XMLStreamWriter writer, int event) throws XMLStreamException
+ {
+ // No-op
+ }
+
+ @Override
+ public void after(XMLStreamWriter writer, int event) throws XMLStreamException
+ {
+ // No-op
+ }
+}
Added: portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/SimpleFormatter.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/SimpleFormatter.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/SimpleFormatter.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer.formatting;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class SimpleFormatter implements XmlStreamingFormatter
+{
+
+ public static final int DEFAULT_INDENT_SIZE = 3;
+ public static final char DEFAULT_INDENT_CHAR = ' ';
+ public static final String DEFAULT_NEWLINE;
+
+ static
+ {
+ String newline = null;
+ try
+ {
+ newline = System.getProperty("line.separator");
+ }
+ catch (Throwable ignored)
+ {
+ }
+ if (newline == null) newline = "\n";
+
+ DEFAULT_NEWLINE = newline;
+ }
+
+ private String indentSequence;
+ private String newline;
+ private int depth = 0;
+
+ private int previousEvent;
+
+ public SimpleFormatter()
+ {
+ this(DEFAULT_INDENT_CHAR, DEFAULT_INDENT_SIZE, DEFAULT_NEWLINE);
+ }
+
+ public SimpleFormatter(char indentCharacter, int indentSize, String newline)
+ {
+ if (newline == null) throw new IllegalArgumentException("newline cannot be null");
+ this.newline = newline;
+
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < indentSize; i++)
+ {
+ sb.append(indentCharacter);
+ }
+ indentSequence = sb.toString();
+ }
+
+ public void before(XMLStreamWriter writer, int event) throws XMLStreamException
+ {
+ switch (event)
+ {
+ case START_ELEMENT:
+ depth++;
+ nl(writer);
+ indent(writer);
+ break;
+ case END_ELEMENT:
+ if (previousEvent == END_ELEMENT)
+ {
+ nl(writer);
+ indent(writer);
+ }
+ depth--;
+ }
+ }
+
+ public void after(XMLStreamWriter writer, int event) throws XMLStreamException
+ {
+ previousEvent = event;
+ }
+
+ private void nl(XMLStreamWriter writer) throws XMLStreamException
+ {
+ writer.writeCharacters(newline);
+ }
+
+ private void indent(XMLStreamWriter writer) throws XMLStreamException
+ {
+ for (int i = 0; i < depth - 1; i++)
+ {
+ writer.writeCharacters(indentSequence);
+ }
+ }
+}
Added: portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/XmlStreamingFormatter.java
===================================================================
--- portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/XmlStreamingFormatter.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/main/java/org/gatein/common/xml/stax/writer/formatting/XmlStreamingFormatter.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax.writer.formatting;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public interface XmlStreamingFormatter extends XMLStreamConstants
+{
+ void before(XMLStreamWriter writer, int event) throws XMLStreamException;
+
+ void after(XMLStreamWriter writer, int event) throws XMLStreamException;
+}
Added: portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/AbstractStaxWriterTest.java
===================================================================
--- portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/AbstractStaxWriterTest.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/AbstractStaxWriterTest.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,357 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax;
+
+import junit.framework.TestCase;
+import org.gatein.common.xml.stax.writer.StaxWriter;
+import org.gatein.common.xml.stax.writer.StaxWriterImpl;
+import org.gatein.common.xml.stax.writer.WritableValueType;
+import org.gatein.common.xml.stax.writer.formatting.XmlStreamingFormatter;
+import org.mockito.InOrder;
+import org.staxnav.Naming;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamWriter;
+
+import static org.mockito.Mockito.*;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public abstract class AbstractStaxWriterTest<N> extends TestCase
+{
+ static final String ENCODING = "UTF-8";
+ static final String VERSION = "1.0";
+
+ private Naming<N> naming;
+ protected XMLStreamWriter stream;
+ protected XmlStreamingFormatter formatter;
+ protected StaxWriter<N> writer;
+
+ public abstract Naming<N> getNaming();
+
+ @Override
+ public void setUp() throws Exception
+ {
+ naming = getNaming();
+ formatter = mock(XmlStreamingFormatter.class);
+ stream = mock(XMLStreamWriter.class);
+ writer = new StaxWriterImpl<N>(naming, stream, formatter, ENCODING, VERSION);
+ }
+
+ protected N createName(String localPart)
+ {
+ return naming.getName(null, null, localPart);
+ }
+
+ public void testEncodingAndVersion() throws Exception
+ {
+ String encoding = "UTF-8";
+ String version = "1.0";
+ StaxWriter<N> writer = new StaxWriterImpl<N>(naming, stream, formatter, encoding, version);
+ writer.writeElement(createName("foo"), "blah");
+
+ verify(stream).writeStartDocument(encoding, version);
+
+ reset(stream);
+ encoding = "encoding";
+ version = "version";
+ writer = new StaxWriterImpl<N>(naming, stream, formatter, encoding, version);
+ writer.writeElement(createName("foo"), "blah");
+
+ verify(stream).writeStartDocument(encoding, version);
+ }
+
+ public void testEncoding() throws Exception
+ {
+ String encoding = "ISO-8859-1";
+ StaxWriter<N> writer = new StaxWriterImpl<N>(naming, stream, formatter, encoding, null);
+ writer.writeElement(createName("foo"), "blah");
+
+ verify(stream).writeStartDocument(encoding, null);
+ }
+
+ public void testNoEncoding() throws Exception
+ {
+ StaxWriter<N> writer = new StaxWriterImpl<N>(naming, stream, formatter);
+ writer.writeElement(createName("foo"), "blah");
+
+ verify(stream).writeStartDocument();
+ }
+
+ public void testStartDocument() throws Exception
+ {
+ writer.writeStartElement(createName("foo"));
+ writer.writeComment("some comment");
+ writer.writeCData("some cdata < & ...");
+
+ verify(stream, times(1)).writeStartDocument(ENCODING, VERSION);
+
+ }
+
+ public void testWriteStartElement() throws Exception
+ {
+ writer.writeStartElement(createName("foo"));
+ verify(stream).writeStartElement("foo");
+ }
+
+ public void testWriteAttribute() throws Exception
+ {
+ writer.writeStartElement(createName("foo")).writeAttribute("name", "value");
+
+ verify(stream).writeAttribute("name", "value");
+ }
+
+ public void testWriteQNameAttribute() throws Exception
+ {
+ writer.writeStartElement(createName("foo"))
+ .writeAttribute(new QName("uri", "local", "pre"), "value")
+ .writeAttribute(new QName("uri", "local"), "value");
+
+ verify(stream).writeAttribute("pre", "uri", "local", "value");
+ verify(stream).writeAttribute("uri", "local", "value");
+ }
+
+ public void testWriteElement() throws Exception
+ {
+ writer.writeElement(createName("foo"), "content");
+
+ verify(stream).writeStartElement("foo");
+ verify(stream).writeCharacters("content");
+ verify(stream).writeEndElement();
+ }
+
+ public void testWriteContent() throws Exception
+ {
+
+ writer.writeStartElement(createName("foo")).writeContent("blah");
+ verify(stream).writeCharacters("blah");
+
+ WritableValueType<String> vt = new WritableValueType<String>()
+ {
+ @Override
+ public String format(String value)
+ {
+ return "some value";
+ }
+ };
+
+ writer.writeStartElement(createName("bar")).writeContent(vt, "content");
+ verify(stream).writeCharacters("some value");
+ }
+
+ public void testWriteNullContent() throws Exception
+ {
+ try
+ {
+ writer.writeContent(null);
+ fail("IllegalArgumentException expected to be thrown");
+ }
+ catch (IllegalArgumentException e){}
+ }
+
+ public void testNamespace() throws Exception
+ {
+ writer.writeStartElement(createName("foo")).writeNamespace("xsi", XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
+
+ verify(stream).writeNamespace("xsi", XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
+ }
+
+ public void testDefaultNamespace() throws Exception
+ {
+ String namespace = "http://www.example.com/ns/mynamespace";
+
+ writer.writeStartElement(createName("foo")).writeDefaultNamespace(namespace);
+
+ verify(stream).writeDefaultNamespace(namespace);
+ }
+
+ public void testComment() throws Exception
+ {
+ writer.writeComment("Some comment");
+ writer.writeStartElement(createName("foo"));
+
+ verify(stream, times(1)).writeStartDocument(ENCODING, VERSION);
+ verify(stream).writeComment("Some comment");
+ }
+
+ public void testCData() throws Exception
+ {
+ String cdata = "Some cdata stuff here < & \" ";
+ writer.writeCData(cdata);
+ writer.writeStartElement(createName("foo"));
+
+ verify(stream).writeStartDocument(ENCODING, VERSION);
+ verify(stream).writeCData(cdata);
+ }
+
+ public void testFinish() throws Exception
+ {
+ writer.writeStartElement(createName("foo")).finish();
+
+ verify(stream).flush();
+ verify(stream).close();
+ }
+
+ public void testFinishNoElements() throws Exception
+ {
+ writer.writeComment("comment");
+ writer.finish();
+ verify(stream).flush();
+ verify(stream).close();
+ }
+
+ public void testEndElementOnFinish() throws Exception
+ {
+ writer.writeStartElement(createName("foo")).
+ writeStartElement(createName("bar")).
+ writeElement(createName("foobar"), "stuff");
+
+ // Even though we never explicitly call endElement for the first two start elements, finish will do that for us.
+ writer.finish();
+
+ verify(stream).writeStartElement("foo");
+ verify(stream).writeStartElement("bar");
+ verify(stream).writeStartElement("foobar");
+ verify(stream).writeCharacters("stuff");
+ verify(stream, times(3)).writeEndElement();
+ }
+
+ public void testFormatter() throws Exception
+ {
+ InOrder order = inOrder(formatter, stream);
+
+ // Start element
+ writer.writeStartElement(createName("foo"));
+ verifyFormatter(order, XMLStreamConstants.START_DOCUMENT, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ // first start element also writes the document
+ order.verify(stream).writeStartDocument(ENCODING, VERSION);
+ }
+ });
+ verifyFormatter(order, XMLStreamConstants.START_ELEMENT, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ order.verify(stream).writeStartElement("foo");
+ }
+ });
+
+ // Namespace
+ writer.writeNamespace("prefix", "uri");
+ verifyFormatter(order, XMLStreamConstants.NAMESPACE, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ order.verify(stream).writeNamespace("prefix", "uri");
+ }
+ });
+
+ // Default namespace
+ writer.writeDefaultNamespace("uri");
+ verifyFormatter(order, XMLStreamConstants.NAMESPACE, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ order.verify(stream).writeDefaultNamespace("uri");
+ }
+ });
+
+ // Attribute
+ writer.writeAttribute("name", "value");
+ verifyFormatter(order, XMLStreamConstants.ATTRIBUTE, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ order.verify(stream).writeAttribute("name", "value");
+ }
+ });
+
+ // Comment
+ writer.writeComment("comment");
+ verifyFormatter(order, XMLStreamConstants.COMMENT, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ order.verify(stream).writeComment("comment");
+ }
+ });
+
+ // CData
+ writer.writeCData("cdata");
+ verifyFormatter(order, XMLStreamConstants.CDATA, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ order.verify(stream).writeCData("cdata");
+ }
+ });
+
+ // Content
+ writer.writeContent("content");
+ verifyFormatter(order, XMLStreamConstants.CHARACTERS, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ order.verify(stream).writeCharacters("content");
+ }
+ });
+
+ // End element
+ writer.writeEndElement();
+ verifyFormatter(order, XMLStreamConstants.END_ELEMENT, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ order.verify(stream).writeEndElement();
+ }
+ });
+
+ // End document
+ writer.finish();
+ verifyFormatter(order, XMLStreamConstants.END_DOCUMENT, new VerifyClosure()
+ {
+ public void verify(InOrder order) throws Exception
+ {
+ order.verify(stream).writeEndDocument();
+ }
+ });
+ }
+
+ protected void verifyFormatter(InOrder order, int event, VerifyClosure closure) throws Exception
+ {
+ order.verify(formatter).before(stream, event);
+ closure.verify(order);
+ order.verify(formatter).after(stream, event);
+ }
+
+ private static interface VerifyClosure
+ {
+ void verify(InOrder order) throws Exception;
+ }
+}
Added: portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/LocalStaxWriterTest.java
===================================================================
--- portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/LocalStaxWriterTest.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/LocalStaxWriterTest.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax;
+
+import org.staxnav.Naming;
+
+public class LocalStaxWriterTest extends AbstractStaxWriterTest<String>
+{
+ @Override
+ public Naming<String> getNaming()
+ {
+ return new Naming.Local();
+ }
+}
\ No newline at end of file
Added: portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/QualifiedStaxWriterTest.java
===================================================================
--- portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/QualifiedStaxWriterTest.java (rev 0)
+++ portal/branches/gatein-management/component/common/src/test/java/org/gatein/common/xml/stax/QualifiedStaxWriterTest.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.common.xml.stax;
+
+import org.mockito.Mockito;
+import org.staxnav.Naming;
+
+import javax.xml.namespace.QName;
+
+public class QualifiedStaxWriterTest extends AbstractStaxWriterTest<QName>
+{
+ @Override
+ public Naming<QName> getNaming()
+ {
+ return new Naming.Qualified();
+ }
+
+ public void testWriteQualifiedStartElement() throws Exception
+ {
+ QName bar = new QName("uri", "pre", "bar");
+
+ writer.writeStartElement(bar);
+ Mockito.verify(stream).writeStartElement(bar.getPrefix(), bar.getLocalPart(), bar.getNamespaceURI());
+
+ QName foobar = new QName("http://www.gatein.org/xml/ns/gatein_objects_1_0", "foobar");
+ writer.writeStartElement(foobar);
+ Mockito.verify(stream).writeStartElement(foobar.getNamespaceURI(), foobar.getLocalPart());
+ }
+}
\ No newline at end of file
Modified: portal/branches/gatein-management/component/portal/pom.xml
===================================================================
--- portal/branches/gatein-management/component/portal/pom.xml 2011-07-29 17:42:53 UTC (rev 6953)
+++ portal/branches/gatein-management/component/portal/pom.xml 2011-07-29 18:36:01 UTC (rev 6954)
@@ -79,11 +79,6 @@
</dependency>
<dependency>
- <groupId>org.gatein.management</groupId>
- <artifactId>gatein-management-common</artifactId>
- </dependency>
-
- <dependency>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-core</artifactId>
</dependency>
Modified: portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshaller.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshaller.java 2011-07-29 17:42:53 UTC (rev 6953)
+++ portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/AbstractMarshaller.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -34,15 +34,13 @@
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageBody;
import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.pom.data.ComponentData;
-import org.exoplatform.portal.pom.data.ContainerData;
+import org.gatein.common.xml.stax.writer.StaxWriter;
+import org.gatein.common.xml.stax.writer.WritableValueTypes;
import org.exoplatform.portal.pom.data.ModelDataStorage;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.exoplatform.portal.pom.spi.portlet.PortletBuilder;
import org.exoplatform.portal.pom.spi.portlet.Preference;
-import org.gatein.common.xml.stax.writer.StaxWriter;
-import org.gatein.common.xml.stax.writer.WritableValueTypes;
import org.gatein.management.api.binding.Marshaller;
import org.staxnav.StaxNavigator;
import org.staxnav.ValueType;
@@ -170,7 +168,7 @@
container.setChildren(new ArrayList<ModelObject>());
}
container.getChildren().add(unmarshalContainer(navigator.fork()));
- current = navigator.getName();
+ current = navigator.sibling();
break;
case PORTLET_APPLICATION:
if (container.getChildren() == null)
@@ -178,7 +176,7 @@
container.setChildren(new ArrayList<ModelObject>());
}
container.getChildren().add(unmarshalPortletApplication(navigator.fork()));
- current = navigator.getName();
+ current = navigator.sibling();
break;
case GADGET_APPLICATION:
if (container.getChildren() == null)
@@ -186,7 +184,7 @@
container.setChildren(new ArrayList<ModelObject>());
}
container.getChildren().add(unmarshalGadgetApplication(navigator.fork()));
- current = navigator.getName();
+ current = navigator.sibling();
break;
case UNKNOWN:
throw unknownElement(navigator);
@@ -294,7 +292,7 @@
boolean showInfoBarParsed = false;
- Element current = navigator.getName();
+ Element current = navigator.sibling();
while (current != null)
{
switch (current)
@@ -497,7 +495,7 @@
boolean showInfoBarParsed = false;
- Element current = navigator.getName();
+ Element current = navigator.sibling();
while (current != null)
{
switch (current)
Modified: portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/DelimitedValueType.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/DelimitedValueType.java 2011-07-29 17:42:53 UTC (rev 6953)
+++ portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/DelimitedValueType.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -22,14 +22,11 @@
package org.exoplatform.portal.mop.management.binding.xml;
-import org.exoplatform.portal.pom.config.Utils;
import org.gatein.common.xml.stax.writer.WritableValueType;
+import org.exoplatform.portal.pom.config.Utils;
import org.staxnav.StaxNavException;
import org.staxnav.ValueType;
-import java.util.Arrays;
-import java.util.List;
-
/**
* @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
* @version $Revision$
Modified: portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshaller.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshaller.java 2011-07-29 17:42:53 UTC (rev 6953)
+++ portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/NavigationMarshaller.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -285,7 +285,7 @@
case NODE:
PageNode child = unmarshalNode(navigator.fork());
children.add(child);
- current = navigator.getName();
+ current = navigator.sibling();
break;
case UNKNOWN:
throw unknownElement(navigator);
Modified: portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshaller.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshaller.java 2011-07-29 17:42:53 UTC (rev 6953)
+++ portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/PageMarshaller.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -188,7 +188,7 @@
page.setChildren(new ArrayList<ModelObject>());
}
page.getChildren().add(unmarshalContainer(navigator.fork()));
- current = navigator.getName();
+ current = navigator.sibling();
break;
case PORTLET_APPLICATION:
if (page.getChildren() == null)
@@ -196,7 +196,7 @@
page.setChildren(new ArrayList<ModelObject>());
}
page.getChildren().add(unmarshalPortletApplication(navigator.fork()));
- current = navigator.getName();
+ current = navigator.sibling();
break;
case GADGET_APPLICATION:
if (page.getChildren() == null)
@@ -204,7 +204,7 @@
page.setChildren(new ArrayList<ModelObject>());
}
page.getChildren().add(unmarshalGadgetApplication(navigator.fork()));
- current = navigator.getName();
+ current = navigator.sibling();
break;
case UNKNOWN:
throw unknownElement(navigator);
Modified: portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshaller.java
===================================================================
--- portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshaller.java 2011-07-29 17:42:53 UTC (rev 6953)
+++ portal/branches/gatein-management/component/portal/src/main/java/org/exoplatform/portal/mop/management/binding/xml/SiteLayoutMarshaller.java 2011-07-29 18:36:01 UTC (rev 6954)
@@ -231,7 +231,7 @@
throw expectedElement(navigator, Element.PORTAL_LAYOUT);
}
portalLayout.getChildren().add(unmarshalPortletApplication(navigator.fork()));
- current = navigator.getName();
+ current = navigator.sibling();
break;
case GADGET_APPLICATION:
if (portalLayout == null)
@@ -239,7 +239,7 @@
throw expectedElement(navigator, Element.PORTAL_LAYOUT);
}
portalLayout.getChildren().add(unmarshalGadgetApplication(navigator.fork()));
- current = navigator.getName();
+ current = navigator.sibling();
break;
case CONTAINER:
if (portalLayout == null)
@@ -247,7 +247,7 @@
throw expectedElement(navigator, Element.PORTAL_LAYOUT);
}
portalLayout.getChildren().add(unmarshalContainer(navigator.fork()));
- current = navigator.getName();
+ current = navigator.sibling();
break;
case UNKNOWN:
throw unknownElement(navigator);
Modified: portal/branches/gatein-management/packaging/jboss-as5/pkg/pom.xml
===================================================================
--- portal/branches/gatein-management/packaging/jboss-as5/pkg/pom.xml 2011-07-29 17:42:53 UTC (rev 6953)
+++ portal/branches/gatein-management/packaging/jboss-as5/pkg/pom.xml 2011-07-29 18:36:01 UTC (rev 6954)
@@ -369,10 +369,6 @@
</dependency>
<dependency>
<groupId>org.gatein.management</groupId>
- <artifactId>gatein-management-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.gatein.management</groupId>
<artifactId>gatein-management-core</artifactId>
</dependency>
<dependency>
Modified: portal/branches/gatein-management/packaging/jboss-as6/pkg/pom.xml
===================================================================
--- portal/branches/gatein-management/packaging/jboss-as6/pkg/pom.xml 2011-07-29 17:42:53 UTC (rev 6953)
+++ portal/branches/gatein-management/packaging/jboss-as6/pkg/pom.xml 2011-07-29 18:36:01 UTC (rev 6954)
@@ -367,10 +367,6 @@
</dependency>
<dependency>
<groupId>org.gatein.management</groupId>
- <artifactId>gatein-management-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.gatein.management</groupId>
<artifactId>gatein-management-core</artifactId>
</dependency>
<dependency>
Modified: portal/branches/gatein-management/packaging/jetty/pkg/pom.xml
===================================================================
--- portal/branches/gatein-management/packaging/jetty/pkg/pom.xml 2011-07-29 17:42:53 UTC (rev 6953)
+++ portal/branches/gatein-management/packaging/jetty/pkg/pom.xml 2011-07-29 18:36:01 UTC (rev 6954)
@@ -367,10 +367,6 @@
</dependency>
<dependency>
<groupId>org.gatein.management</groupId>
- <artifactId>gatein-management-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.gatein.management</groupId>
<artifactId>gatein-management-core</artifactId>
</dependency>
<dependency>
Modified: portal/branches/gatein-management/packaging/tomcat/pkg/pom.xml
===================================================================
--- portal/branches/gatein-management/packaging/tomcat/pkg/pom.xml 2011-07-29 17:42:53 UTC (rev 6953)
+++ portal/branches/gatein-management/packaging/tomcat/pkg/pom.xml 2011-07-29 18:36:01 UTC (rev 6954)
@@ -359,10 +359,6 @@
</dependency>
<dependency>
<groupId>org.gatein.management</groupId>
- <artifactId>gatein-management-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.gatein.management</groupId>
<artifactId>gatein-management-core</artifactId>
</dependency>
<dependency>
Modified: portal/branches/gatein-management/pom.xml
===================================================================
--- portal/branches/gatein-management/pom.xml 2011-07-29 17:42:53 UTC (rev 6953)
+++ portal/branches/gatein-management/pom.xml 2011-07-29 18:36:01 UTC (rev 6954)
@@ -57,7 +57,7 @@
<javax.servlet.version>2.5</javax.servlet.version>
<version.chromattic>1.1.0-beta6</version.chromattic>
<version.reflext>1.1.0-beta12</version.reflext>
- <org.staxnav.version>0.9.3</org.staxnav.version>
+ <org.staxnav.version>0.9.4</org.staxnav.version>
<jcip.version>1.0</jcip.version>
<!-- ************** -->
@@ -336,11 +336,6 @@
</dependency>
<dependency>
<groupId>org.gatein.management</groupId>
- <artifactId>gatein-management-common</artifactId>
- <version>${org.gatein.mgmt.version}</version>
- </dependency>
- <dependency>
- <groupId>org.gatein.management</groupId>
<artifactId>gatein-management-core</artifactId>
<version>${org.gatein.mgmt.version}</version>
</dependency>
13 years, 5 months
gatein SVN: r6953 - in portal/branches/api: examples/portlets/api/src/main/java/org/gatein/portal/samples/api and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-07-29 13:42:53 -0400 (Fri, 29 Jul 2011)
New Revision: 6953
Modified:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java
portal/branches/api/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/NavigationPortlet.java
Log:
- Fixed getDashboards.
- Added userId implementation.
Modified: portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java
===================================================================
--- portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java 2011-07-29 16:50:35 UTC (rev 6952)
+++ portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java 2011-07-29 17:42:53 UTC (rev 6953)
@@ -25,7 +25,6 @@
import org.exoplatform.application.gadget.GadgetRegistryService;
import org.exoplatform.application.gadget.SourceStorage;
import org.exoplatform.application.registry.ApplicationRegistryService;
-import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.configuration.ConfigurationManager;
@@ -70,7 +69,6 @@
import org.picocontainer.Startable;
import java.net.URI;
-import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -95,6 +93,7 @@
public static final Context APPLICATION_CONTEXT = GenericContext.builder().requiredComponent("application", Identifiable.class, Pattern.compile("\\w+"))
.requiredComponent("portlet", Portlet.class, Pattern.compile("\\w+")).withDefaultSeparator("/").build();
private static final Context GADGET_CONTEXT = GenericContext.builder().requiredComponent("name", Gadget.class, Pattern.compile("\\w+")).build();
+ private static final Context USER_CONTEXT = GenericContext.builder().requiredComponent("name", Identifiable.class, Pattern.compile("[a-zA-Z0-9]+")).build();
private static final Context CATEGORY_CONTEXT = GenericContext.builder().requiredComponent("name", Category.class, Pattern.compile("\\w+")).build();
private static final Context WSRP_CONTEXT = GenericContext.builder().requiredComponent("invoker", Identifiable.class, Pattern.compile("\\w+"))
.requiredComponent("portletcontext", WSRP.class, Pattern.compile(GROUP_CHARS + "+")).build();
@@ -205,10 +204,8 @@
final UserHandler userHandler = organizationService.getUserHandler();
// todo: optimize
- ListAccess<User> usersAccess = userHandler.findAllUsers();
- List<User> users = Arrays.asList(usersAccess.load(0, usersAccess.getSize()));
+ List<User> users = userHandler.getUserPageList(1000).getAll();
-
// todo: check for correctness
return new AdaptedIterableIdentifiableCollection<User, Site>(users.size(), users.iterator())
{
@@ -341,7 +338,7 @@
public Id userId(String user)
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return USER_CONTEXT.create(user);
}
public Id groupId(String root, String... children)
Modified: portal/branches/api/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/NavigationPortlet.java
===================================================================
--- portal/branches/api/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/NavigationPortlet.java 2011-07-29 16:50:35 UTC (rev 6952)
+++ portal/branches/api/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/NavigationPortlet.java 2011-07-29 17:42:53 UTC (rev 6953)
@@ -23,7 +23,7 @@
package org.gatein.portal.samples.api;
import org.gatein.api.GateIn;
-import org.gatein.api.portal.Portal;
+import org.gatein.api.portal.Site;
import org.gatein.api.util.IterableIdentifiableCollection;
import javax.portlet.GenericPortlet;
@@ -49,10 +49,12 @@
protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
{
- IterableIdentifiableCollection<Portal> portals = gateIn.getPortals();
- for (Portal portal : portals)
+ IterableIdentifiableCollection<? extends Site> portals = gateIn.getSites();
+ for (Site portal : portals)
{
- response.getWriter().println(portal.getNavigation());
+ String s = portal.toString();
+ System.out.println(s);
+ response.getWriter().println(s);
}
}
}
13 years, 5 months