JBoss Portal SVN: r12173 - branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/META-INF.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-10-27 06:36:56 -0400 (Mon, 27 Oct 2008)
New Revision: 12173
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
Log:
Was missing some interceptors
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2008-10-27 08:49:22 UTC (rev 12172)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2008-10-27 10:36:56 UTC (rev 12173)
@@ -318,6 +318,16 @@
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
</mbean>
+ <mbean code="org.jboss.portal.portlet.aspects.portlet.RequestAttributeConversationInterceptor"
+ name="portal:service=Interceptor,type=Portlet,name=RequestAttributeConversation" xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
+ <mbean code="org.jboss.portal.portlet.aspects.portlet.EventPayloadInterceptor"
+ name="portal:service=Interceptor,type=Portlet,name=EventPayload" xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
<mbean code="org.jboss.portal.core.aspects.portlet.TransactionInterceptor"
name="portal:service=Interceptor,type=Portlet,name=Transaction" xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
@@ -366,6 +376,8 @@
<depends-list-element>portal:service=Interceptor,type=Portlet,name=Ajax</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=SignOut</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=ProducerCache</depends-list-element>
+ <depends-list-element>portal:service=Interceptor,type=Portlet,name=RequestAttributeConversation</depends-list-element>
+ <depends-list-element>portal:service=Interceptor,type=Portlet,name=EventPayload</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=Header</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=Transaction</depends-list-element>
<depends-list-element>portal:service=Dispatcher,type=Portlet,name=ContainerPortlet</depends-list-element>
17 years, 6 months
JBoss Portal SVN: r12172 - in modules/cms/tags/JBP_CMS_1_2_1: build and 1 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-10-27 04:49:22 -0400 (Mon, 27 Oct 2008)
New Revision: 12172
Modified:
modules/cms/tags/JBP_CMS_1_2_1/build/pom.xml
modules/cms/tags/JBP_CMS_1_2_1/cms-jackrabbit/pom.xml
modules/cms/tags/JBP_CMS_1_2_1/pom.xml
Log:
Tagging CMS module
Modified: modules/cms/tags/JBP_CMS_1_2_1/build/pom.xml
===================================================================
--- modules/cms/tags/JBP_CMS_1_2_1/build/pom.xml 2008-10-27 08:44:19 UTC (rev 12171)
+++ modules/cms/tags/JBP_CMS_1_2_1/build/pom.xml 2008-10-27 08:49:22 UTC (rev 12172)
@@ -18,7 +18,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.portal.cms</groupId>
<artifactId>module-parent</artifactId>
- <version>trunk-SNAPSHOT</version>
+ <version>1.2.1</version>
<packaging>pom</packaging>
<name>JBoss Portal CMS</name>
<url>http://www.jboss.com/products/jbossmc</url>
@@ -44,10 +44,10 @@
<version.ehcache>1.4.1</version.ehcache>
<version.javax.jcr>1.0</version.javax.jcr>
<version.jackrabbit.core>1.4.5</version.jackrabbit.core>
- <version.jboss.portal.common>1.2.0</version.jboss.portal.common>
- <version.jboss.portal.identity>1.0.2</version.jboss.portal.identity>
- <version.jboss.portal.test>1.2.0.Beta2</version.jboss.portal.test>
- <version.jboss.portal>2.7.0.CR1</version.jboss.portal>
+ <version.jboss.portal.common>1.2.2</version.jboss.portal.common>
+ <version.jboss.portal.identity>1.0.5</version.jboss.portal.identity>
+ <version.jboss.portal.test>1.2.1</version.jboss.portal.test>
+ <version.jboss.portal>2.7.0.GA</version.jboss.portal>
</properties>
Modified: modules/cms/tags/JBP_CMS_1_2_1/cms-jackrabbit/pom.xml
===================================================================
--- modules/cms/tags/JBP_CMS_1_2_1/cms-jackrabbit/pom.xml 2008-10-27 08:44:19 UTC (rev 12171)
+++ modules/cms/tags/JBP_CMS_1_2_1/cms-jackrabbit/pom.xml 2008-10-27 08:49:22 UTC (rev 12172)
@@ -5,7 +5,7 @@
<groupId>org.jboss.portal.cms</groupId>
<artifactId>module-parent</artifactId>
<relativePath>../build/pom.xml</relativePath>
- <version>trunk-SNAPSHOT</version>
+ <version>1.2.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cms-jackrabbit</artifactId>
Modified: modules/cms/tags/JBP_CMS_1_2_1/pom.xml
===================================================================
--- modules/cms/tags/JBP_CMS_1_2_1/pom.xml 2008-10-27 08:44:19 UTC (rev 12171)
+++ modules/cms/tags/JBP_CMS_1_2_1/pom.xml 2008-10-27 08:49:22 UTC (rev 12172)
@@ -5,7 +5,7 @@
<artifactId>module-aggregator</artifactId>
<packaging>pom</packaging>
<name>JBoss Portal CMS Module</name>
- <version>trunk-SNAPSHOT</version>
+ <version>1.2.1</version>
<url>http://labs.jboss.com/jbossportal</url>
<dependencies/>
17 years, 6 months
JBoss Portal SVN: r12171 - modules/cms/tags.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-10-27 04:44:19 -0400 (Mon, 27 Oct 2008)
New Revision: 12171
Added:
modules/cms/tags/JBP_CMS_1_2_1/
Log:
Tagging CMS
Copied: modules/cms/tags/JBP_CMS_1_2_1 (from rev 12170, modules/cms/trunk)
17 years, 6 months
JBoss Portal SVN: r12170 - branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-sar/META-INF.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-10-25 15:06:31 -0400 (Sat, 25 Oct 2008)
New Revision: 12170
Modified:
branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
Log:
integrating cms-module version 1.2.1 (still pending tagging since need to make sure test suite passes 100% in multi-db mode on hudson)
Modified: branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2008-10-25 18:30:46 UTC (rev 12169)
+++ branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2008-10-25 19:06:31 UTC (rev 12170)
@@ -410,7 +410,9 @@
<shared>false</shared>
<cacheloader>
<class>org.jboss.portal.cms.hibernate.state.PortalCMSCacheLoader</class>
- <properties></properties>
+ <properties>
+ cmsSessionFactory=java:/portal/cms/CMSSessionFactory
+ </properties>
<async>false</async>
<fetchPersistentState>false</fetchPersistentState>
<ignoreModifications>false</ignoreModifications>
@@ -468,7 +470,8 @@
carefully and should be synonymous to the 'root' user in a Unix system. By default: this value is the built-in
'admin' user account. This can be changed to any other user account registered in your Portal
-->
- <attribute name="CmsRootUserName">admin</attribute>
+ <attribute name="CmsRootUserName">admin</attribute>
+ <attribute name="CmsSessionFactory">java:/portal/cms/CMSSessionFactory</attribute>
<depends optional-attribute-name="IdentityServiceController" proxy-type="attribute">portal:service=Module,type=IdentityServiceController</depends>
</mbean>
17 years, 6 months
JBoss Portal SVN: r12169 - in modules/cms/trunk/cms-jackrabbit: src/main/java/org/jboss/portal/cms/hibernate/state and 4 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-10-25 14:30:46 -0400 (Sat, 25 Oct 2008)
New Revision: 12169
Removed:
modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/hibernate/state/Tools.java
Modified:
modules/cms/trunk/cms-jackrabbit/pom.xml
modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java
modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/hibernate/state/PortalCMSCacheLoader.java
modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java
modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/security/AuthorizationProviderImpl.java
modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/util/HibernateUtil.java
modules/cms/trunk/cms-jackrabbit/src/test/resources/jboss-beans-security-test.xml
modules/cms/trunk/cms-jackrabbit/src/test/resources/jboss-beans-security.xml
modules/cms/trunk/cms-jackrabbit/src/test/resources/pm-cache.xml
Log:
trying to fix the postresql issue with the test suite
Modified: modules/cms/trunk/cms-jackrabbit/pom.xml
===================================================================
--- modules/cms/trunk/cms-jackrabbit/pom.xml 2008-10-24 22:35:12 UTC (rev 12168)
+++ modules/cms/trunk/cms-jackrabbit/pom.xml 2008-10-25 18:30:46 UTC (rev 12169)
@@ -220,13 +220,13 @@
<artifactId>postgresql</artifactId>
<version>8.1-407.jdbc3</version>
<scope>test</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.0.2.0</version>
<scope>test</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
@@ -299,6 +299,9 @@
<tasks>
<delete dir="repotest" />
<delete dir="repotest-hsqldb" />
+ <delete dir="repotest-postgresql8" />
+ <delete dir="repotest-mysql5" />
+ <delete dir="repotest-oracle10g" />
<delete file="test.properties" />
<delete file="test.script" />
</tasks>
@@ -314,6 +317,9 @@
<tasks>
<delete dir="repotest" />
<delete dir="repotest-hsqldb" />
+ <delete dir="repotest-postgresql8" />
+ <delete dir="repotest-mysql5" />
+ <delete dir="repotest-oracle10g" />
<delete file="test.properties" />
<delete file="test.script" />
</tasks>
Modified: modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java
===================================================================
--- modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java 2008-10-24 22:35:12 UTC (rev 12168)
+++ modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java 2008-10-25 18:30:46 UTC (rev 12169)
@@ -56,6 +56,7 @@
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.portal.cms.hibernate.HibernateStoreConstants;
import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.cms.util.HibernateUtil;
import javax.jcr.PropertyType;
import javax.management.MBeanServer;
@@ -208,8 +209,7 @@
initialized = true;
try
- {
- Tools.init(this.jndiName);
+ {
if (pmCache == null)
{
@@ -269,7 +269,7 @@
// pre-load the cache with property nodes
if (!JBossCachePersistenceManager.preloaded)
{
- JBossCachePersistenceManager.loadProperties();
+ JBossCachePersistenceManager.loadProperties(this.jndiName);
log.info("-------------------------------------------------");
log.info("JBossCachePersistenceManager is fully loaded.....");
log.info("-------------------------------------------------");
@@ -285,7 +285,7 @@
*
*
*/
- private static synchronized void loadProperties() throws Exception
+ private static synchronized void loadProperties(String hibernateJndiName) throws Exception
{
if (JBossCachePersistenceManager.preloaded)
{
@@ -296,22 +296,22 @@
.info("Pre-loading the PersistenceManager Cache in the background (started).......");
CacheLoader wspProp = new CacheLoader(CacheLoader.wspProp,
- PortalCMSCacheLoader.WSP_PROP_NODE);
+ PortalCMSCacheLoader.WSP_PROP_NODE, hibernateJndiName);
Thread wspPropLoader = new Thread(wspProp);
CacheLoader versionProp = new CacheLoader(CacheLoader.versionProp,
- PortalCMSCacheLoader.VERSION_PROP_NODE);
+ PortalCMSCacheLoader.VERSION_PROP_NODE, hibernateJndiName);
Thread versionPropLoader = new Thread(versionProp);
CacheLoader wspNode = new CacheLoader(CacheLoader.wspNode,
- PortalCMSCacheLoader.WSP_NODE_NODE);
+ PortalCMSCacheLoader.WSP_NODE_NODE, hibernateJndiName);
Thread wspNodeLoader = new Thread(wspNode);
CacheLoader versionNode = new CacheLoader(CacheLoader.versionNode,
- PortalCMSCacheLoader.VERSION_NODE_NODE);
+ PortalCMSCacheLoader.VERSION_NODE_NODE, hibernateJndiName);
Thread versionNodeLoader = new Thread(versionNode);
CacheLoader wspRef = new CacheLoader(CacheLoader.wspRef,
- PortalCMSCacheLoader.WSP_REF_NODE);
+ PortalCMSCacheLoader.WSP_REF_NODE, hibernateJndiName);
Thread wspRefLoader = new Thread(wspRef);
CacheLoader versionRef = new CacheLoader(CacheLoader.versionRef,
- PortalCMSCacheLoader.VERSION_REF_NODE);
+ PortalCMSCacheLoader.VERSION_REF_NODE, hibernateJndiName);
Thread versionRefLoader = new Thread(versionRef);
wspPropLoader.start();
@@ -359,11 +359,14 @@
private String nodePrefix = null;
private boolean done = false;
+
+ private String hibernateJndiName = null;
- private CacheLoader(String nodeQuery, String nodePrefix)
+ private CacheLoader(String nodeQuery, String nodePrefix, String hibernateJndiName)
{
this.nodeQuery = nodeQuery;
this.nodePrefix = nodePrefix;
+ this.hibernateJndiName = hibernateJndiName;
}
public void run()
@@ -371,7 +374,7 @@
Session session = null;
try
{
- session = Tools.getOpenSession();
+ session = HibernateUtil.getSessionFactory(this.hibernateJndiName).openSession();
List rs = session.createQuery(this.nodeQuery).list();
if (rs != null)
{
@@ -441,7 +444,7 @@
}
finally
{
- Tools.closeSession(session);
+ HibernateUtil.closeSession(session);
this.done = true;
}
}
@@ -522,7 +525,7 @@
boolean success = false;
try
{
- session = Tools.getOpenSession();
+ session = HibernateUtil.getSessionFactory(this.jndiName).openSession();
tx = session.beginTransaction();
InputStream in = new ByteArrayInputStream(nodeData);
@@ -552,7 +555,7 @@
{
tx.rollback();
}
- Tools.closeSession(session);
+ HibernateUtil.closeSession(session);
}
}
@@ -798,7 +801,7 @@
boolean success = false;
try
{
- session = Tools.getOpenSession();
+ session = HibernateUtil.getSessionFactory(this.jndiName).openSession();
tx = session.beginTransaction();
InputStream in = new ByteArrayInputStream(propertyData);
@@ -828,7 +831,7 @@
{
tx.rollback();
}
- Tools.closeSession(session);
+ HibernateUtil.closeSession(session);
}
}
@@ -1112,7 +1115,7 @@
boolean success = false;
try
{
- session = Tools.getOpenSession();
+ session = HibernateUtil.getSessionFactory(this.jndiName).openSession();
tx = session.beginTransaction();
InputStream in = new ByteArrayInputStream(nodeData);
@@ -1142,7 +1145,7 @@
{
tx.rollback();
}
- Tools.closeSession(session);
+ HibernateUtil.closeSession(session);
}
}
@@ -1255,9 +1258,6 @@
*/
public void close() throws Exception
{
- // cleanup session factory.
- Tools.destroy();
-
// cleanup the jboss cache service
if (pmCache != null)
{
@@ -1309,7 +1309,7 @@
Transaction tx = null;
try
{
- session = Tools.getOpenSession();
+ session = HibernateUtil.getSessionFactory(this.jndiName).openSession();
tx = session.beginTransaction();
storeHB(changeLog);
tx.commit();
@@ -1321,7 +1321,7 @@
}
finally
{
- Tools.closeSession(session);
+ HibernateUtil.closeSession(session);
}
}
@@ -1409,7 +1409,7 @@
throw new IllegalStateException("not initialized");
}
- Session session = Tools.getOpenSession();
+ Session session = HibernateUtil.getSessionFactory(this.jndiName).openSession();
try
{
List rs = session.createQuery(query).setString(0, id).list();
@@ -1424,7 +1424,7 @@
}
finally
{
- Tools.closeSession(session);
+ HibernateUtil.closeSession(session);
}
}
@@ -1464,14 +1464,35 @@
*/
public InputStream get(String blobId) throws Exception
{
- Session session = Tools.getCurrentSession();
+ Session session = HibernateUtil.getSessionFactory(jndiName).getCurrentSession();
try
{
List rs = session.createQuery(blobSelectData).setString(0, blobId)
.list();
Iterator iter = rs.iterator();
java.sql.Blob blob = (java.sql.Blob)iter.next();
- InputStream is = blob.getBinaryStream();
+
+ /**
+ * This needs to be done this way due to issues with a combination of Postgresql driver handling blobs and Jackrabbit 1.4
+ *
+ * Its fine for: hsqldb, mysql5, and oracle10g
+ */
+ InputStream is = null;
+
+ InputStream blobStream = blob.getBinaryStream();
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024]; //using a 1K buffer
+ int bytesRead = -1;
+ while((bytesRead=blobStream.read(buffer)) != -1)
+ {
+ bos.write(buffer, 0, bytesRead);
+ bos.flush();
+ }
+
+ try{blobStream.close();}catch(Exception e){}
+
+ is = new ByteArrayInputStream(bos.toByteArray());
+
return is;
}
catch (Exception e)
@@ -1494,7 +1515,7 @@
{
boolean update = exists(blobId);
- Session session = Tools.getCurrentSession();
+ Session session = HibernateUtil.getSessionFactory(jndiName).getCurrentSession();
if (update)
{
try
@@ -1578,7 +1599,7 @@
// public synchronized boolean remove(String blobId) throws Exception
public boolean remove(String blobId) throws Exception
{
- Session session = Tools.getCurrentSession();
+ Session session = HibernateUtil.getSessionFactory(jndiName).getCurrentSession();
try
{
Query query = session.createQuery(nodeBinValSelect).setString(0,
Modified: modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/hibernate/state/PortalCMSCacheLoader.java
===================================================================
--- modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/hibernate/state/PortalCMSCacheLoader.java 2008-10-24 22:35:12 UTC (rev 12168)
+++ modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/hibernate/state/PortalCMSCacheLoader.java 2008-10-25 18:30:46 UTC (rev 12169)
@@ -30,6 +30,8 @@
import org.jboss.cache.loader.CacheLoader;
import org.jboss.logging.Logger;
+import org.jboss.portal.cms.util.HibernateUtil;
+
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -98,6 +100,7 @@
*
*/
private TreeCache cache = null;
+ private String cmsSessionFactory = null;
/**
@@ -105,6 +108,7 @@
*/
public void setConfig(Properties properties)
{
+ this.cmsSessionFactory = (String)properties.get("cmsSessionFactory");
}
/**
@@ -696,7 +700,7 @@
Session session = null;
try
{
- session = Tools.getOpenSession();
+ session = HibernateUtil.getSessionFactory(this.cmsSessionFactory).openSession();
List rs = session.createQuery(query).list();
for (Iterator itr = rs.iterator(); itr.hasNext();)
@@ -711,7 +715,7 @@
}
finally
{
- Tools.closeSession(session);
+ HibernateUtil.closeSession(session);
}
return children;
}
@@ -726,7 +730,7 @@
Session session = null;
try
{
- session = Tools.getOpenSession();
+ session = HibernateUtil.getSessionFactory(this.cmsSessionFactory).openSession();
//node = session.createQuery(query).setString(0,id).uniqueResult();
List rs = session.createQuery(query).setString(0, id).list();
@@ -737,7 +741,7 @@
}
finally
{
- Tools.closeSession(session);
+ HibernateUtil.closeSession(session);
}
return node;
}
@@ -750,7 +754,7 @@
{
Object node = null;
- Session session = Tools.getCurrentSession();
+ Session session = HibernateUtil.getSessionFactory(this.cmsSessionFactory).getCurrentSession();
//node = session.createQuery(query).setString(0,id).uniqueResult();
List rs = session.createQuery(query).setString(0, id).list();
if (rs != null && !rs.isEmpty())
@@ -766,7 +770,7 @@
*/
private void save(Object object) throws Exception
{
- Session session = Tools.getCurrentSession();
+ Session session = HibernateUtil.getSessionFactory(this.cmsSessionFactory).getCurrentSession();
if (((Base)object).getKey() != null)
{
session.merge(object);
@@ -787,7 +791,7 @@
removedValue = this.loadManagedNode(loadQuery, id);
if (removedValue != null)
{
- Session session = Tools.getCurrentSession();
+ Session session = HibernateUtil.getSessionFactory(this.cmsSessionFactory).getCurrentSession();
session.delete(removedValue);
}
return removedValue;
Deleted: modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/hibernate/state/Tools.java
===================================================================
--- modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/hibernate/state/Tools.java 2008-10-24 22:35:12 UTC (rev 12168)
+++ modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/hibernate/state/Tools.java 2008-10-25 18:30:46 UTC (rev 12169)
@@ -1,193 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.cms.hibernate.state;
-
-import org.hibernate.HibernateException;
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.metadata.ClassMetadata;
-import org.hibernate.tool.hbm2ddl.SchemaExport;
-import org.jboss.logging.Logger;
-
-import javax.naming.InitialContext;
-
-/**
- * Static state is evil.
- * <p/>
- * Created on Aug 29, 2006
- * <p/>
- * A Tool for performing some Hibernate related utilities. This is designed to work in both managed as well as
- * non-managed environments
- *
- * @author <a href="mailto:sohil.shah@jboss.com">Sohil Shah</a>
- */
-public class Tools
-{
- private static final Logger log = Logger.getLogger(Tools.class);
-
- //hibernate configuration relation information
- private static SessionFactory sessionFactory = null;
- private static Configuration cfg = null;
- private static boolean autoClose = false;
-
- public static void destroy()
- {
- sessionFactory = null;
- }
-
- /**
- *
- *
- */
- public static void init(String jndiName)
- {
- if (Tools.sessionFactory == null)
- {
- try
- {
- log.debug("Loading the PersistenceManager Hibernate System (Started)...........................");
-
- boolean loadSuccess = true;
- try
- {
- //just to initialize the session factory
- Tools.sessionFactory = (SessionFactory)new InitialContext().lookup(jndiName);
- }
- catch (Exception e)
- {
- //some reason this is not found in JNDI environment....try and load from hibernate.cfg.xml from
- //classpath
- loadSuccess = false;
- }
-
- if (!loadSuccess)
- {
- //configure session factory from configuration
- Tools.cfg = new Configuration();
- Tools.cfg.configure();
- Tools.sessionFactory = Tools.cfg.buildSessionFactory();
- Tools.generateSiteSchema(Tools.cfg);
- }
-
-
- log.debug("Loading the PersistenceManager Hibernate System (Done)...........................");
- }
- catch (Exception e)
- {
- log.error("org.jboss.portal.cms.hibernate.state.Tools", e);
- }
- }
- }
-
- //---------------------------------------------------------------------------------------------------------------------------------------------------
- /**
- *
- */
- public static SessionFactory getSessionFactory()
- {
- return Tools.sessionFactory;
- }
-
- /** @return */
- public static Session getCurrentSession()
- {
- Session session = Tools.sessionFactory.getCurrentSession();
- return session;
- }
-
- /** @return */
- public static Session getOpenSession()
- {
- Session session = Tools.sessionFactory.openSession();
- return session;
- }
-
- /** @param session */
- public static void closeSession(Session session)
- {
- if (session != null && session.isOpen() && !Tools.autoClose)
- {
- session.close();
- }
- }
-
- //-----------------------schema generation capabilities-------------------------------------------------------------------------------------------
- /** @param cfg */
- private static void generateSiteSchema(Configuration cfg)
- {
- if (!doesSiteSchemaExist())
- {
- SchemaExport export = new SchemaExport(cfg);
- export.create(true, //print to the console
- true //run inside the database
- );
- }
- else
- {
- log.info("Site Schema successfully found....No need to recreate it.");
- }
- }
-
- /** @return */
- private static boolean doesSiteSchemaExist()
- {
- Session session = null;
- Transaction tx = null;
- try
- {
- session = Tools.sessionFactory.openSession();
- tx = session.beginTransaction();
- ClassMetadata cmd = (ClassMetadata)Tools.sessionFactory.getAllClassMetadata().values().iterator().next();
- if (cmd != null)
- {
- Query query = session.createQuery("from " + cmd.getEntityName());
- query.setFirstResult(0);
- query.setMaxResults(0);
- try
- {
- query.list();
- }
- catch (HibernateException e)
- {
- // We consider that exception means that the schema deos not exist
- return false;
- }
- }
- //if I get here the schemaExists, dont recreate it
- return true;
- }
- finally
- {
- if (tx != null)
- {
- tx.rollback(); //does not matter since this is only a read operation
- //this is only so that this operation executes within the context
- //of a transaction that performs any necessary cleanup automatically
- }
- Tools.closeSession(session);
- }
- }
-}
Modified: modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java
===================================================================
--- modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java 2008-10-24 22:35:12 UTC (rev 12168)
+++ modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java 2008-10-25 18:30:46 UTC (rev 12169)
@@ -29,7 +29,6 @@
import org.hibernate.Transaction;
import org.jboss.portal.cms.CMSException;
import org.jboss.portal.cms.CMSInterceptor;
-import org.jboss.portal.cms.hibernate.state.Tools;
import org.jboss.portal.cms.impl.jcr.JCRCMS;
import org.jboss.portal.cms.impl.jcr.JCRCommand;
import org.jboss.portal.cms.impl.jcr.command.SearchCommand;
@@ -41,6 +40,7 @@
import org.jboss.portal.cms.security.PermRoleAssoc;
import org.jboss.portal.cms.security.Permission;
import org.jboss.portal.cms.security.PortalCMSSecurityContext;
+import org.jboss.portal.cms.util.HibernateUtil;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.identity.Role;
import org.jboss.portal.identity.RoleModule;
@@ -315,7 +315,6 @@
this.jndiBinding.bind();
}
- Tools.init(this.cmsSessionFactory);
try
{
@@ -360,7 +359,7 @@
Collection parsedPermissions = this.parseDefaultPermissions(permissions);
try
{
- session = Tools.getOpenSession();
+ session = HibernateUtil.getSessionFactory(this.cmsSessionFactory).openSession();
tx = session.beginTransaction();
for (Iterator itr = parsedPermissions.iterator(); itr.hasNext();)
{
@@ -378,7 +377,7 @@
}
finally
{
- Tools.closeSession(session);
+ HibernateUtil.closeSession(session);
}
}
}
@@ -401,7 +400,6 @@
this.jndiBinding.unbind();
this.jndiBinding = null;
}
- Tools.destroy();
}
/**
@@ -488,7 +486,7 @@
boolean bootRequired = false;
String hsqlQuery = "select count(permission) from org.jboss.portal.cms.security.Permission as permission";
- Session session = Tools.getOpenSession();
+ Session session = HibernateUtil.getSessionFactory(this.cmsSessionFactory).openSession();
Transaction tx = session.beginTransaction();
try
{
@@ -506,7 +504,7 @@
}
finally
{
- Tools.closeSession(session);
+ HibernateUtil.closeSession(session);
}
return bootRequired;
Modified: modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/security/AuthorizationProviderImpl.java
===================================================================
--- modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/security/AuthorizationProviderImpl.java 2008-10-24 22:35:12 UTC (rev 12168)
+++ modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/security/AuthorizationProviderImpl.java 2008-10-25 18:30:46 UTC (rev 12169)
@@ -25,7 +25,7 @@
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
-import org.jboss.portal.cms.hibernate.state.Tools;
+import org.jboss.portal.cms.util.HibernateUtil;
import org.jboss.portal.cms.impl.jcr.JCRCMS;
import org.jboss.portal.identity.AnonymousRole;
import org.jboss.portal.identity.IdentityContext;
@@ -70,6 +70,8 @@
private String cmsRootUserName = null;
private User adminUser = null;
+
+ private String cmsSessionFactory = null;
/**
*
@@ -135,7 +137,16 @@
{
this.cmsRootUserName = cmsRootUserName;
}
+
+ public String getCmsSessionFactory()
+ {
+ return cmsSessionFactory;
+ }
+ public void setCmsSessionFactory(String cmsSessionFactory)
+ {
+ this.cmsSessionFactory = cmsSessionFactory;
+ }
// ------DomainConfigurator
// impl------------------------------------------------------------------
/**
@@ -223,7 +234,7 @@
if (adminUser == null)
{
- Session session = Tools.getOpenSession();
+ Session session = HibernateUtil.getSessionFactory(this.cmsSessionFactory).openSession();
Transaction tx = session.beginTransaction();
try
{
@@ -237,7 +248,7 @@
}
finally
{
- Tools.closeSession(session);
+ HibernateUtil.closeSession(session);
}
}
@@ -385,7 +396,7 @@
private void store(Permission permission)
{
// persist this into the database
- Session session = Tools.getCurrentSession();
+ Session session = HibernateUtil.getSessionFactory(this.cmsSessionFactory).getCurrentSession();
session.saveOrUpdate(permission);
}
@@ -396,7 +407,7 @@
*/
private void remove(Collection permissions)
{
- Session session = Tools.getCurrentSession();
+ Session session = HibernateUtil.getSessionFactory(this.cmsSessionFactory).getCurrentSession();
if (permissions != null)
{
for (Iterator itr = permissions.iterator(); itr.hasNext();)
@@ -415,7 +426,7 @@
*/
private Collection findPermissionsByUser(String userId)
{
- Session session = Tools.getOpenSession();
+ Session session = HibernateUtil.getSessionFactory(this.cmsSessionFactory).openSession();
Transaction tx = session.beginTransaction();
try
{
@@ -483,7 +494,7 @@
}
finally
{
- Tools.closeSession(session);
+ HibernateUtil.closeSession(session);
}
}
@@ -499,7 +510,7 @@
String lookupByRole = "SELECT permission from Permission permission JOIN permission.roleAssoc role WHERE role.roleId=?";
- Session session = Tools.getOpenSession();
+ Session session = HibernateUtil.getSessionFactory(this.cmsSessionFactory).openSession();
Transaction tx = session.beginTransaction();
try
{
@@ -518,7 +529,7 @@
}
finally
{
- Tools.closeSession(session);
+ HibernateUtil.closeSession(session);
}
return permissions;
@@ -536,7 +547,7 @@
String lookupByCriteria = "SELECT permission from Permission permission JOIN permission.criteria criteria WHERE criteria.name=? AND criteria.value=?";
- Session session = Tools.getOpenSession();
+ Session session = HibernateUtil.getSessionFactory(this.cmsSessionFactory).openSession();
Transaction tx = session.beginTransaction();
try
{
@@ -556,7 +567,7 @@
}
finally
{
- Tools.closeSession(session);
+ HibernateUtil.closeSession(session);
}
return permissions;
Modified: modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/util/HibernateUtil.java
===================================================================
--- modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/util/HibernateUtil.java 2008-10-24 22:35:12 UTC (rev 12168)
+++ modules/cms/trunk/cms-jackrabbit/src/main/java/org/jboss/portal/cms/util/HibernateUtil.java 2008-10-25 18:30:46 UTC (rev 12169)
@@ -23,6 +23,7 @@
package org.jboss.portal.cms.util;
+import org.hibernate.Session;
import org.hibernate.SessionFactory;
import javax.naming.InitialContext;
@@ -46,4 +47,27 @@
throw new IllegalStateException("No HibernateSessionFactory can be found in the JNDI tree at: " + jndiName);
}
}
+
+ /** @return */
+ public static Session getCurrentSession(SessionFactory sessionFactory)
+ {
+ Session session = sessionFactory.getCurrentSession();
+ return session;
+ }
+
+ /** @return */
+ public static Session getOpenSession(SessionFactory sessionFactory)
+ {
+ Session session = sessionFactory.openSession();
+ return session;
+ }
+
+ /** @param session */
+ public static void closeSession(Session session)
+ {
+ if (session != null && session.isOpen())
+ {
+ session.close();
+ }
+ }
}
Modified: modules/cms/trunk/cms-jackrabbit/src/test/resources/jboss-beans-security-test.xml
===================================================================
--- modules/cms/trunk/cms-jackrabbit/src/test/resources/jboss-beans-security-test.xml 2008-10-24 22:35:12 UTC (rev 12168)
+++ modules/cms/trunk/cms-jackrabbit/src/test/resources/jboss-beans-security-test.xml 2008-10-25 18:30:46 UTC (rev 12169)
@@ -124,6 +124,7 @@
<bean name="AuthorizationProvider" class="org.jboss.portal.cms.security.AuthorizationProviderImpl">
<property name="identityServiceController"><inject bean="IdentityServiceController"/></property>
<property name="cmsRootUserName">admin</property>
+ <property name="cmsSessionFactory">java:/SessionFactory</property>
</bean>
<bean name="AuthorizationManager" class="org.jboss.portal.cms.test.security.TestAuthorizationManagerImpl">
Modified: modules/cms/trunk/cms-jackrabbit/src/test/resources/jboss-beans-security.xml
===================================================================
--- modules/cms/trunk/cms-jackrabbit/src/test/resources/jboss-beans-security.xml 2008-10-24 22:35:12 UTC (rev 12168)
+++ modules/cms/trunk/cms-jackrabbit/src/test/resources/jboss-beans-security.xml 2008-10-25 18:30:46 UTC (rev 12169)
@@ -124,6 +124,7 @@
<bean name="AuthorizationProvider" class="org.jboss.portal.cms.security.AuthorizationProviderImpl">
<property name="identityServiceController"><inject bean="IdentityServiceController"/></property>
<property name="cmsRootUserName">admin</property>
+ <property name="cmsSessionFactory">java:/SessionFactory</property>
</bean>
<bean name="AuthorizationManager" class="org.jboss.portal.cms.security.AuthorizationManagerImpl">
Modified: modules/cms/trunk/cms-jackrabbit/src/test/resources/pm-cache.xml
===================================================================
--- modules/cms/trunk/cms-jackrabbit/src/test/resources/pm-cache.xml 2008-10-24 22:35:12 UTC (rev 12168)
+++ modules/cms/trunk/cms-jackrabbit/src/test/resources/pm-cache.xml 2008-10-25 18:30:46 UTC (rev 12169)
@@ -174,7 +174,9 @@
<shared>false</shared>
<cacheloader>
<class>org.jboss.portal.cms.hibernate.state.PortalCMSCacheLoader</class>
- <properties></properties>
+ <properties>
+ cmsSessionFactory=java:/SessionFactory
+ </properties>
<async>false</async>
<fetchPersistentState>true</fetchPersistentState>
<ignoreModifications>false</ignoreModifications>
17 years, 6 months
JBoss Portal SVN: r12168 - in branches/JBoss_Portal_2_6_6_JBPORTAL-2212: cms/src/main/org/jboss/portal/cms/impl/jcr and 3 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-10-24 18:35:12 -0400 (Fri, 24 Oct 2008)
New Revision: 12168
Modified:
branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/cms/CommandFactory.java
branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java
branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/cms/impl/jcr/command/AsyncStoreArchiveCommand.java
branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java
branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java
branches/JBoss_Portal_2_6_6_JBPORTAL-2212/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
Log:
JBPORTAL-2212 - Uploading an archive fails on the slave node
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/cms/CommandFactory.java
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/cms/CommandFactory.java 2008-10-24 15:54:35 UTC (rev 12167)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/cms/CommandFactory.java 2008-10-24 22:35:12 UTC (rev 12168)
@@ -25,10 +25,8 @@
import org.jboss.portal.cms.model.Content;
import org.jboss.portal.cms.model.File;
import org.jboss.portal.cms.model.Folder;
-import org.jboss.portal.cms.CMS;
import org.jboss.portal.search.impl.jcr.JCRQuery;
-import java.io.InputStream;
import java.util.List;
import java.util.Locale;
@@ -74,9 +72,9 @@
Command createContentCreateNewVersionCommand(List contents, boolean bMakeLive);
- Command createStoreArchiveCommand(String sRootPath, InputStream is, String sLanguage);
+ Command createStoreArchiveCommand(String sRootPath, byte[] archiveBytes, String sLanguage);
- Command createAsyncStoreArchiveCommand(CMS cms, String sRootPath, InputStream is, String sLanguage);
+ Command createAsyncStoreArchiveCommand(String sRootPath, byte[] archiveBytes, String sLanguage);
Command createItemExistsCommand(String sPath);
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java 2008-10-24 15:54:35 UTC (rev 12167)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java 2008-10-24 22:35:12 UTC (rev 12168)
@@ -50,12 +50,10 @@
import org.jboss.portal.cms.model.Content;
import org.jboss.portal.cms.model.File;
import org.jboss.portal.cms.model.Folder;
-import org.jboss.portal.cms.CMS;
import org.jboss.portal.search.impl.jcr.JCRQuery;
import org.jboss.portal.cms.impl.jcr.command.AsyncStoreArchiveCommand;
-import java.io.InputStream;
import java.util.List;
import java.util.Locale;
@@ -154,14 +152,14 @@
return new ContentCreateNewVersionCommand(contents, bMakeLive);
}
- public Command createStoreArchiveCommand(String sRootPath, InputStream is, String sLanguage)
+ public Command createStoreArchiveCommand(String sRootPath, byte[] archiveBytes, String sLanguage)
{
- return new StoreArchiveCommand(sRootPath, is, sLanguage);
+ return new StoreArchiveCommand(sRootPath, archiveBytes, sLanguage);
}
- public Command createAsyncStoreArchiveCommand(CMS cms, String sRootPath, InputStream is, String sLanguage)
+ public Command createAsyncStoreArchiveCommand(String sRootPath, byte[] archiveBytes, String sLanguage)
{
- return new AsyncStoreArchiveCommand(cms,sRootPath, is, sLanguage);
+ return new AsyncStoreArchiveCommand(sRootPath, archiveBytes, sLanguage);
}
public Command createItemExistsCommand(String sPath)
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/cms/impl/jcr/command/AsyncStoreArchiveCommand.java
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/cms/impl/jcr/command/AsyncStoreArchiveCommand.java 2008-10-24 15:54:35 UTC (rev 12167)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/cms/impl/jcr/command/AsyncStoreArchiveCommand.java 2008-10-24 22:35:12 UTC (rev 12168)
@@ -22,18 +22,20 @@
******************************************************************************/
package org.jboss.portal.cms.impl.jcr.command;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
import org.apache.log4j.Logger;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.portal.cms.impl.jcr.JCRCMS;
import org.jboss.portal.cms.impl.jcr.JCRCommand;
import org.jboss.portal.cms.impl.jcr.JCRCommandContext;
+import org.jboss.portal.cms.CMS;
import org.jboss.portal.cms.CMSException;
-import java.io.InputStream;
-
-import org.jboss.portal.cms.CMS;
-
/**
* Saves an uploaded archive to the repo.
*
@@ -47,9 +49,8 @@
private static Logger log = Logger.getLogger(AsyncStoreArchiveCommand.class);
String msRootPath;
- InputStream mIS;
+ byte[] archiveBytes;
String msLanguage;
- CMS cms = null;
private Object user = null;
private Object approvePublishWorkflow = null;
@@ -60,12 +61,11 @@
* @param is
* @param sLanguage
*/
- public AsyncStoreArchiveCommand(CMS cms, String sRootPath, InputStream is, String sLanguage)
+ public AsyncStoreArchiveCommand(String sRootPath, byte[] archiveBytes, String sLanguage)
{
this.msRootPath = sRootPath;
- this.mIS = is;
+ this.archiveBytes = archiveBytes;
this.msLanguage = sLanguage;
- this.cms = cms;
}
/**
@@ -111,7 +111,9 @@
JCRCMS.turnOnWorkflow();
}
- JCRCommand storeArchiveCommand = (JCRCommand)cms.getCommandFactory().createStoreArchiveCommand(msRootPath, mIS, msLanguage);
+ CMS cms = this.findCMSService();
+ JCRCommand storeArchiveCommand = (JCRCommand)cms.getCommandFactory().
+ createStoreArchiveCommand(msRootPath, archiveBytes, msLanguage);
cms.execute(storeArchiveCommand);
log.info("Async Processing finished..................");
@@ -123,5 +125,12 @@
log.error("-----------------------------------------------------------------------------");
}
}
+
+ //Find the CMS Service for the Asynchronous processing
+ private CMS findCMSService() throws Exception
+ {
+ MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+ return (CMS)MBeanProxy.get(CMS.class, new ObjectName("portal:service=CMS"), mbeanServer);
+ }
}
}
\ No newline at end of file
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java 2008-10-24 15:54:35 UTC (rev 12167)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java 2008-10-24 22:35:12 UTC (rev 12168)
@@ -56,7 +56,7 @@
private static Logger log = Logger.getLogger(StoreArchiveCommand.class);
String msRootPath;
- InputStream mIS;
+ byte[] archiveBytes;
String msLanguage;
/**
@@ -64,10 +64,10 @@
* @param is
* @param sLanguage
*/
- public StoreArchiveCommand(String sRootPath, InputStream is, String sLanguage)
+ public StoreArchiveCommand(String sRootPath, byte[] archiveBytes, String sLanguage)
{
this.msRootPath = sRootPath;
- this.mIS = is;
+ this.archiveBytes = archiveBytes;
this.msLanguage = sLanguage;
}
@@ -234,13 +234,8 @@
FileOutputStream fos = new FileOutputStream(zipFile.getCanonicalPath());
try
{
- int count;
- byte[] data = new byte[1024];
- while ((count = this.mIS.read(data, 0, 1024)) != -1)
- {
- fos.write(data, 0, count);
- fos.flush();
- }
+ fos.write(this.archiveBytes);
+ fos.close();
}
finally
{
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java 2008-10-24 15:54:35 UTC (rev 12167)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2212/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java 2008-10-24 22:35:12 UTC (rev 12168)
@@ -95,7 +95,8 @@
try
{
is = IOTools.safeBufferedWrapper(new FileInputStream(sZipFile));
- Command storearchiveCMD = service.getCommandFactory().createStoreArchiveCommand("", is, "en");
+ byte[] archiveBytes = IOTools.getBytes(is);
+ Command storearchiveCMD = service.getCommandFactory().createStoreArchiveCommand("", archiveBytes, "en");
service.execute(storearchiveCMD);
}
finally
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2212/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2212/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2008-10-24 15:54:35 UTC (rev 12167)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2212/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2008-10-24 22:35:12 UTC (rev 12168)
@@ -990,9 +990,9 @@
// check if the current item is a form field or an uploaded file
if (!item.isFormField())
{
- InputStream is = item.getInputStream();
+ byte[] archiveBytes = item.get();
- Command storearchiveCMD = CMSService.getCommandFactory().createAsyncStoreArchiveCommand(CMSService, sPath, is, sLanguage);
+ Command storearchiveCMD = CMSService.getCommandFactory().createAsyncStoreArchiveCommand(sPath, archiveBytes, sLanguage);
CMSService.execute(storearchiveCMD);
List messages = new ArrayList();
17 years, 6 months
JBoss Portal SVN: r12167 - branches.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-10-24 11:54:35 -0400 (Fri, 24 Oct 2008)
New Revision: 12167
Added:
branches/JBoss_Portal_2_6_6_JBPORTAL-2212/
Log:
patching upload issue in cluster mode
Copied: branches/JBoss_Portal_2_6_6_JBPORTAL-2212 (from rev 12166, tags/JBoss_Portal_2_6_6)
17 years, 6 months
JBoss Portal SVN: r12166 - branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2008-10-24 11:32:26 -0400 (Fri, 24 Oct 2008)
New Revision: 12166
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletDefinitionsTestCase.java
Log:
portlet def testcases fix
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletDefinitionsTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletDefinitionsTestCase.java 2008-10-24 14:39:14 UTC (rev 12165)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletDefinitionsTestCase.java 2008-10-24 15:32:26 UTC (rev 12166)
@@ -11,7 +11,7 @@
public class PortletDefinitionsTestCase extends JBossPortalSeleniumTestCase{
private static final String T_LINK_PREF = "//a[contains(@id,''def-list:portlet-pref-{0}'')]";
- private static final String SUBMIT_CREATE_INST = "//input[contains(@id,'add_instance_form:_id19jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj')]";
+ private static final String SUBMIT_CREATE_INST = "//input[contains(@name,'add_instance_form:j_id19')]";
private static final String INPUT_INSTANCE_NAME = "//input[contains(@id,'add_instance_form:instanceId')]";
private static final String T_LINK_CREATE = "//a[contains(@id,''def-list:create-instance-{0}'')]";
private static final String SUBMIT_PROVIDER_VIEW = "//input[contains(@id,'definition-form:view-portlets')]";
@@ -23,7 +23,6 @@
private static final String LINK_TAB_PD = "//a[contains(@id,'admin-subtab-form:portlet-def-link')]";
private static final String LINK_PD_MAIN = "//a[contains(@id,'man-form:def-link')]";
-
@BeforeMethod(groups = { "log" })
public void loginBeforeTest() {
login("admin", "admin");
@@ -39,12 +38,11 @@
public void testShowInfo(){
selenium.click(LINK_ADMIN_PORT);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent("Portlet Instance Information"));
- Assert.assertTrue(selenium.isElementPresent(LINK_NAME_ADMIN_PORT));
+ Assert.assertTrue(selenium.isTextPresent("Administration Portlet details "));
Assert.assertTrue(selenium.isTextPresent("Administration Portlet"));
Assert.assertTrue(selenium.isTextPresent("Management Portlet"));
Assert.assertTrue(selenium.isTextPresent("management,admin"));
- Assert.assertTrue(selenium.isTextPresent("de it en"));
+ Assert.assertTrue(selenium.isTextPresent("Portlet Modes"));
}
@Test(enabled = true)
@@ -54,11 +52,11 @@
selenium.click(MessageFormat.format(T_LINK_CREATE,r-1));
selenium.waitForPageToLoad(PAGE_LOAD);
+
selenium.type(INPUT_INSTANCE_NAME, "littleAdmin");
selenium.click(SUBMIT_CREATE_INST);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("littleAdmin portlet details"));
- Assert.assertTrue(selenium.isTextPresent("Portlet Instance Information"));
}
@Test(enabled = true)
17 years, 6 months
JBoss Portal SVN: r12165 - branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2008-10-24 10:39:14 -0400 (Fri, 24 Oct 2008)
New Revision: 12165
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
Log:
portal admin testcases fix
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2008-10-24 13:39:56 UTC (rev 12164)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2008-10-24 14:39:14 UTC (rev 12165)
@@ -14,6 +14,8 @@
@Test(groups = { "admin_portal" }, enabled = true, description = "Partal administrating.")
public class AdminPortalTestCase extends JBossPortalSeleniumTestCase {
+ private static final String SUB_LAYOUT_ADD_CENTER = "//input[contains(@id,'layoutForm:a_center')]";
+ private static final String INP_WINDOW_NAME = "//input[contains(@id,'windowForm:windowName')]";
private static final String SUBMIT_RENAME_PORTAL = "//input[contains(@id,'renameForm:rename')]";
private static final String INPUT_RENAME_PORTAL = "//input[contains(@id,'renameForm:newName')]";
private static final String SUBMIT_DELETE_PORTAL_CONF = "//input[contains(@id,'delete-view:confirm-form:delete')]";
@@ -22,10 +24,10 @@
private static final String INPUT_PORTALNAME = "//input[contains(@id,'create-portal-form:name')]";
private static final String INPUT_SUBMIT_CREATEPORTAL = "//input[contains(@id,'create-portal-form:create-portal')]";
- private final String TAB_PORTALOBJ_ID = "//div[@id='current']/a";
+ private final String TAB_PORTALOBJ_ID = "Link=Admin";
private final String LINK_PORTALS_ID = "link=*Portal Objects*";
- private final String LINK_PORTAL_HOME = "//input[contains(@id,'obj-temp-form:object-link-0')]";
+ private final String LINK_PORTAL_HOME = "//a[contains(@id,'obj-temp-form:object-link-0')]";
private final String TABLE_PORTAL_ADMIN = "//table[contains(@id,'obj-nav-form:portal-datatable')]";
private final String POR_TL_MAIN = "//a[contains(@id,''obj-nav-form:portal-datatable:{0}:object-iid-link'')]";
@@ -42,7 +44,7 @@
private final String PAG_TL_SECURITY = "//a[contains(@id,''obj-nav-form:pages-datatable:{0}:security-link'')]";
private final String PAG_TL_PROPERTIES = "//a[contains(@id,''obj-nav-form:pages-datatable:{0}:prop-link'')]";
private final String PAG_TL_THEME = "//a[contains(@id,''obj-nav-form:pages-datatable:{0}:theme-link'')]";
- private final String PAG_TL_RENAME = "//a[contains(@id,''obj-nav-form:pages-datatable:{0}:rename-link_1'')]";
+ private final String PAG_TL_RENAME = "//a[contains(@id,''obj-nav-form:pages-datatable:{0}:rename-link'')]";
private final String PAG_TL_DISPLAY = "//a[contains(@id,''obj-nav-form:pages-datatable:{0}:rename-display'')]";
private final String PAG_TL_DELETE = "//a[contains(@id,''obj-nav-form:pages-datatable:{0}:delete-link'')]";
private final String PAG_TL_MAKEDEF = "//a[contains(@id,''obj-nav-form:pages-datatable:{0}:default-link'')]";
@@ -227,10 +229,13 @@
selenium.click(MessageFormat.format(PAG_TL_LAYOUT, r));
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type("windowForm:windowName", windowName);
+
selenium.click("link=Who's online portlet");
selenium.waitForPageToLoad("30000");
- selenium.click("layoutForm:a_center");
+
+ selenium.type(INP_WINDOW_NAME, windowName);
+
+ selenium.click(SUB_LAYOUT_ADD_CENTER);
selenium.waitForPageToLoad("30000");
Assert.assertTrue(selenium.isTextPresent(windowName));
@@ -251,6 +256,7 @@
clickIfVisible(TAB_PORTALOBJ_ID);
clickIfVisible(LINK_PORTALS_ID);
+ //selenium.setSpeed("8000");
clickIfVisible(LINK_PORTAL_HOME ,"Create a portal named:");
int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
17 years, 6 months
JBoss Portal SVN: r12164 - branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2008-10-24 09:39:56 -0400 (Fri, 24 Oct 2008)
New Revision: 12164
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java
Log:
wsrp tests fix
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2008-10-24 12:03:56 UTC (rev 12163)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2008-10-24 13:39:56 UTC (rev 12164)
@@ -11,9 +11,10 @@
*/
@Test(groups = { "cms_wsrp" }, enabled = true, description = "WSRP test case.")
public class WSRPTestCase extends JBossPortalSeleniumTestCase {
- private static final String SUBMIT_REFRESH_CANCEL = "//input[contains(@id,'edit-cons-form:list-cons-link_1')]";
+ private static final String INP_CONSUMER_NAME = "//input[contains(@id,'edit-cons-form:id')]";
+ private static final String SUBMIT_REFRESH_CANCEL = "//a[contains(@id,'edit-cons-form:list-cons-link')]";
private static final String SUBMIT_PROD_SAVE = "//input[contains(@id,'producer-form:save-producer')]";
- private static final String SUBMIT_CONSDEL_CONF = "//input[contains(@id,':destroy-link')]";
+ private static final String SUBMIT_CONSDEL_CONF = "//a[contains(@id,'confirm-delete-form:destroy-link')]";
private static final String SUBMIT_CONS_REGVAL = "//input[contains(@id,'edit-cons-form:refresh-cons-link')]";
private static final String SUBMIT_REFRESHFINAL = "//input[contains(@id,'edit-cons-form:refresh-cons-link')]";
@@ -22,8 +23,8 @@
private static final String SUBMIT_REFRESHSAVE = "//input[contains(@id,'edit-cons-form:refresh-cons-link')]";
private static final String INPUT_CONSWSDL = "//input[contains(@id,'edit-cons-form:wsdl')]";
private static final String INPUT_CACHEEXP = "//input[contains(@id,'edit-cons-form:cache')]";
- private static final String SUBMIT_ADDPROP_INIT = "//input[contains(@id,'producer-form:add-reg-prop')]";
- private static final String SUBMIT_ADDPROP = "//input[contains(@id,'producer-form:add-reg-prop')]";
+ private static final String SUBMIT_ADDPROP_INIT = "//a[contains(@id,'producer-form:add-reg-prop')]";
+ private static final String SUBMIT_ADDPROP = "//a[contains(@id,'producer-form:add-reg-prop')]";
private static final String INPUT_PROPHINT = "//input[contains(@id,'producer-form:reg-properties:0:hint')]";
private static final String INPUT_PROPLABEL = "//input[contains(@id,'producer-form:reg-properties:0:label')]";
private static final String INPUT_PROPNAME = "//input[contains(@id,'producer-form:reg-properties:0:name')]";
@@ -222,7 +223,7 @@
selenium.click("link=WSRP");
selenium.waitForPageToLoad(PAGE_LOAD);
- clickIfVisible(ID_LINK_PRODCONF);
+ clickIfVisible(ID_LINK_PRODCONF,"Producer configuration");
clickAndWait(SUBMIT_ADDPROP_INIT);
@@ -275,7 +276,7 @@
// rename the consumer
clickAndWait(MessageFormat.format(LINK_T_CONS_CON,r-1));
- selenium.type(INPUT_USERNAME, nameNew);
+ selenium.type(INP_CONSUMER_NAME, nameNew);
clickAndWait(SUBMIT_REFRESHSAVE);
clickIfVisible(ID_LINK_CONSCONF);
@@ -300,7 +301,7 @@
selenium.click(SUBMIT_CREATECONS);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.setSpeed("5000");
+ //selenium.setSpeed("5000");
selenium.type(INPUT_CACHEEXP, timeout);
selenium.type(INPUT_CONSWSDL, address);
@@ -310,7 +311,7 @@
selenium.click(SUBMIT_CONS_REGVAL);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.setSpeed("0");
+ //selenium.setSpeed("0");
selenium.click(SUBMIT_REFRESHFINAL);
selenium.waitForPageToLoad(PAGE_LOAD);
17 years, 6 months