Return-Path: Delivered-To: apmail-portals-jetspeed-dev-archive@www.apache.org Received: (qmail 46851 invoked from network); 20 Oct 2008 07:44:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Oct 2008 07:44:47 -0000 Received: (qmail 47195 invoked by uid 500); 20 Oct 2008 07:44:48 -0000 Delivered-To: apmail-portals-jetspeed-dev-archive@portals.apache.org Received: (qmail 47160 invoked by uid 500); 20 Oct 2008 07:44:48 -0000 Mailing-List: contact jetspeed-dev-help@portals.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Jetspeed Developers List" Delivered-To: mailing list jetspeed-dev@portals.apache.org Received: (qmail 47149 invoked by uid 99); 20 Oct 2008 07:44:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Oct 2008 00:44:48 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Oct 2008 07:43:47 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 87417238896D; Mon, 20 Oct 2008 00:44:25 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r706142 - in /portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade: ./ components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/ components/jetspeed-registry/src/main/java/org/apache/jetspeed/component... Date: Mon, 20 Oct 2008 07:44:24 -0000 To: jetspeed-dev@portals.apache.org From: woonsan@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081020074425.87417238896D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: woonsan Date: Mon Oct 20 00:44:24 2008 New Revision: 706142 URL: http://svn.apache.org/viewvc?rev=706142&view=rev Log: Fixed a bug querying by getPortletDefinitionByIdentifier() with unique name. Also, modified the getUserNames() method of PersistenceBrokerPortletPreferencesProvider interface to return Collection instead of Iterator. It was because the existing method throws exception from OJB layer, 'Resources no longer reachable, RsIterator will be automatic cleaned up on PB.close/.commitTransaction/.abortTransaction'. So, I thought that the method should return a copied collection of user names, instead of the rs iterator. And, updated the data migration guide document. Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PersistenceBrokerPortletPreferencesProvider.java portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/serializer/JetspeedRegistrySerializer.java portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesProvider.java portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/pom.xml portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/xdocs/guides/guide-migration.xml Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java?rev=706142&r1=706141&r2=706142&view=diff ============================================================================== --- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java (original) +++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java Mon Oct 20 00:44:24 2008 @@ -208,7 +208,7 @@ // (becuase the PortletApplication has yet to be registered). if(this.portletDefinition == null) { - PortletDefinition pd = registry.getPortletDefinitionByIdentifier(getPortletUniqueName()); + PortletDefinition pd = registry.getPortletDefinitionByUniqueName(getPortletUniqueName()); if ( pd != null ) { // only store a really found PortletDefinition Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PersistenceBrokerPortletPreferencesProvider.java URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PersistenceBrokerPortletPreferencesProvider.java?rev=706142&r1=706141&r2=706142&view=diff ============================================================================== --- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PersistenceBrokerPortletPreferencesProvider.java (original) +++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PersistenceBrokerPortletPreferencesProvider.java Mon Oct 20 00:44:24 2008 @@ -17,8 +17,10 @@ package org.apache.jetspeed.components.portletpreferences; import java.util.HashMap; +import java.util.Collection; import java.util.Iterator; import java.util.List; +import java.util.LinkedList; import java.util.Map; import org.apache.jetspeed.cache.CacheElement; @@ -185,30 +187,23 @@ return new PreferenceSetImpl(prefs); } - public Iterator getUserNames(PortletEntity pe) + public Collection getUserNames(MutablePortletEntity pe) { + Collection userNames = new LinkedList(); + Criteria c = new Criteria(); c.addEqualTo("entityId", pe.getId()); final ReportQueryByCriteria q = QueryFactory.newReportQuery(PreferenceValueImpl.class, c, true); - q.setAttributes(new String[]{"userName"}); - - return new Iterator(){ - private final Iterator iterator = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(q); - public boolean hasNext() - { - return iterator.hasNext(); - } - - public String next() - { - return (String)iterator.next()[0]; - } + q.setAttributes(new String[]{"userName"}); - public void remove() - { - throw new UnsupportedOperationException(); - } - }; + Iterator iterator = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(q); + + while (iterator.hasNext()) + { + userNames.add((String)iterator.next()[0]); + } + + return userNames; } public void savePreferenceSet(PortletDefinition pd, PreferenceSetComposite preferenceSet) Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/serializer/JetspeedRegistrySerializer.java URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/serializer/JetspeedRegistrySerializer.java?rev=706142&r1=706141&r2=706142&view=diff ============================================================================== --- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/serializer/JetspeedRegistrySerializer.java (original) +++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/serializer/JetspeedRegistrySerializer.java Mon Oct 20 00:44:24 2008 @@ -287,13 +287,14 @@ catch (Exception e) { throw new SerializerException(SerializerException.CREATE_SERIALIZED_OBJECT_FAILED.create(new String[] { - "PortletApplicationDefinition", e.getMessage() })); + "PortletApplicationDefinition", e.getMessage() }), e); } } } private JSApplication exportPA(PortletApplication pa, Map settings, Log log) throws SerializerException { + JSApplication jsApplication = null; /** * while more PAs for each portletDef * list:entityMan:getPortletEntity(pd) @@ -302,12 +303,14 @@ PortletDefinition pd = null; JSPortlets portlets = new JSPortlets(); + while (pi.hasNext()) { try { pd = (PortletDefinition) pi.next(); JSPortlet p = exportPD(pd, settings, log); + if (p != null) { log.debug("--processed PA " + pa.getName() + " with pd=" + pd.getPortletName()); @@ -315,68 +318,63 @@ } else log.debug("--processed PA " + pa.getName() + " with NULL pd=" + pd.getPortletName()); - } catch (Exception e) { throw new SerializerException(SerializerException.CREATE_SERIALIZED_OBJECT_FAILED.create(new String[] { - "PortletDefinition", e.getMessage() })); + "PortletDefinition", e.getMessage() }), e); } } + if (!portlets.isEmpty()) { - JSApplication app = new JSApplication(); + jsApplication = new JSApplication(); log.debug("--exporting PA " + pa.getName() + " with id=" + pa.getId()); - app.setID(pa.getId().toString()); - app.setName(pa.getName()); - app.setPortlets(portlets); - return app; + jsApplication.setID(pa.getId().toString()); + jsApplication.setName(pa.getName()); + jsApplication.setPortlets(portlets); } - return null; + + return jsApplication; } private JSPortlet exportPD(PortletDefinition pd, Map settings, Log log) throws SerializerException { + JSPortlet jsPortlet = null; + try { Collection col = entityAccess.getPortletEntities(pd); + if ((col == null) || (col.size() == 0)) return null; - Iterator list = null; - try - { - list = col.iterator(); - } - catch (Exception e) - { - throw new SerializerException(SerializerException.GET_EXISTING_OBJECTS.create(new String[] { - "entityAccess", e.getMessage() })); - } + JSEntities entities = new JSEntities(); - while (list.hasNext()) + for (Object item : col) { - PortletEntity entity = (PortletEntity) list.next(); + PortletEntity entity = (PortletEntity) item; JSEntity jsEntity = exportEntityPref(entity, settings, log); + if (jsEntity != null) entities.add(jsEntity); - } + if (!entities.isEmpty()) { - JSPortlet portlet = new JSPortlet(); - portlet.setName(pd.getPortletName()); + jsPortlet = new JSPortlet(); + jsPortlet.setName(pd.getPortletName()); log.debug("-----exporting for PD=" + pd.getPortletName()); - portlet.setEntities(entities); - return portlet; + jsPortlet.setEntities(entities); } - return null; } catch (Exception e) { throw new SerializerException(SerializerException.CREATE_SERIALIZED_OBJECT_FAILED.create(new String[] { - "Entity", e.getMessage() })); + "Entity", e.getMessage() }), e); } + + return jsPortlet; } JSEntity exportEntityPref(PortletEntity entity, Map settings, Log log) @@ -389,19 +387,22 @@ if (isSettingSet(settings, JetspeedSerializer.KEY_PROCESS_USER_PREFERENCES)) { JSEntityPreferences entityPreferences = new JSEntityPreferences(); - Iterator userNames = prefsProvider.getUserNames(entity); - while (userNames.hasNext()) + Collection userNames = prefsProvider.getUserNames(entity); + + for (String userName : userNames) { - String userName = userNames.next(); - PreferenceSetComposite preferenceSet = prefsProvider.getPreferenceSet(entity, userNames.next()); + PreferenceSetComposite preferenceSet = prefsProvider.getPreferenceSet(entity, userName); + JSEntityPreference userPreference = new JSEntityPreference(); userPreference.setName(userName); Iterator preferences = preferenceSet.iterator(); JSNVPElements v = new JSNVPElements(); + while (preferences.hasNext()) { Preference p = preferences.next(); Iterator values = p.getValues(); + while (values.hasNext()) { JSNVPElement element = new JSNVPElement(); @@ -410,11 +411,13 @@ v.add(element); } } + if (v.size() > 0) { userPreference.setPreferences(v); entityPreferences.add(userPreference); } + if (!entityPreferences.isEmpty()) { log.debug("processed preferences for entity=" + entity.getId()); @@ -422,6 +425,7 @@ } } } + return jsEntity; } } Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesProvider.java URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesProvider.java?rev=706142&r1=706141&r2=706142&view=diff ============================================================================== --- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesProvider.java (original) +++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesProvider.java Mon Oct 20 00:44:24 2008 @@ -16,7 +16,7 @@ */ package org.apache.jetspeed.components.portletpreferences; -import java.util.Iterator; +import java.util.Collection; import org.apache.jetspeed.container.PortletEntity; import org.apache.jetspeed.om.common.preference.PreferenceSetComposite; @@ -28,7 +28,7 @@ public PreferenceSetComposite getPreferenceSet(PortletDefinition pd); public PreferenceSetComposite getPreferenceSet(PortletEntity pe); public PreferenceSetComposite getPreferenceSet(PortletEntity pe, String userName); - public Iterator getUserNames(PortletEntity pe); + public Collection getUserNames(MutablePortletEntity pe); public void savePreferenceSet(PortletDefinition pd, PreferenceSetComposite preferenceSet); public void savePreferenceSet(PortletEntity pe, PreferenceSetComposite preferenceSet); public void savePreferenceSet(PortletEntity pe, String userName, PreferenceSetComposite preferenceSet); Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/pom.xml URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/pom.xml?rev=706142&r1=706141&r2=706142&view=diff ============================================================================== --- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/pom.xml (original) +++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/pom.xml Mon Oct 20 00:44:24 2008 @@ -279,7 +279,7 @@ 1.8 1.2 3.0.1 - 1.3.2 + 1.4 2.1 1.1 1.3 Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/xdocs/guides/guide-migration.xml URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/xdocs/guides/guide-migration.xml?rev=706142&r1=706141&r2=706142&view=diff ============================================================================== --- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/xdocs/guides/guide-migration.xml (original) +++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/xdocs/guides/guide-migration.xml Mon Oct 20 00:44:24 2008 @@ -25,8 +25,364 @@ +
+

The following tables describe database schema changes from version 2.1.3 to version 2.2.

+ + + + + + + + + + + + + + + + + + + + +
Table
SECURITY_USER_ROLE
SECURITY_USER_GROUP
SECURITY_GROUP_ROLE
PREFS_NODE
PREFS_PROPERTY_VALUE
+
+ + + + + + + + + + + + + + + + + +
Table
PORTLET_PREFERENCE
PORTLET_PREFERENCE_VALUE
SECURITY_ATTRIBUTE
SECURITY_PRINCIPAL_ASSOC
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Altering ActionTableColumn2.1.32.2
TypeSizeRequiredTypeSizeRequired
MODIFYPARAMETERPARAMETER_VALUELONGVARCHARYesLONGVARCHARNo
MODIFYPORTLET_ENTITYIDVARCHAR255YesVARCHAR80Yes
MODIFYPORTLET_ENTITYAPP_NAMEVARCHAR255YesVARCHAR80Yes
MODIFYPORTLET_ENTITYPORTLET_NAMEVARCHAR255YesVARCHAR80Yes
DROPSECURITY_PRINCIPALCLASSNAMEVARCHAR254Yes
DROPSECURITY_PRINCIPALIS_MAPPING_ONLYBOOLEANINTYes
DROPSECURITY_PRINCIPALIS_ENABLEDBOOLEANINTYes
DROPSECURITY_PRINCIPALFULL_PATHVARCHAR254Yes
ADDSECURITY_PRINCIPALPRINCIPAL_TYPEVARCHAR20Yes
ADDSECURITY_PRINCIPALPRINCIPAL_NAMEVARCHAR200Yes
ADDSECURITY_PRINCIPALIS_MAPPEDBOOLEANINTYes
ADDSECURITY_PRINCIPALIS_ENABLEDBOOLEANINTYes
ADDSECURITY_PRINCIPALIS_READONLYBOOLEANINTYes
ADDSECURITY_PRINCIPALIS_REMOVABLEBOOLEANINTYes
DROPSECURITY_PERMISSIONCLASSNAMEVARCHAR254Yes
ADDSECURITY_PERMISSIONPERMISSION_TYPEVARCHAR30Yes
DROPSECURITY_PERMISSIONCREATION_DATETIMESTAMPYes
DROPSECURITY_PERMISSIONMODIFIED_DATETIMESTAMPYes
DROPSECURITY_CREDENTIALCOLUMN_VALUEVARCHAR254Yes
ADDSECURITY_CREDENTIALCREDENTIAL_VALUEVARCHAR254Yes
DROPSECURITY_CREDENTIALCLASSNAMEVARCHAR254No
ADDSECURITY_CREDENTIALUPDATE_ALLOWEDBOOLEANINTYes
ADDSECURITY_CREDENTIALIS_STATE_READONLYBOOLEANINTYes
+
+ + + + + + + + + + + + + + +
TableIndexTypeColumn(s)
SECURITY_PERMISSIONUIX_SECURITY_PERMISSIONuniquePERMISSION_TYPE, NAME
+
+ + + + + + + + + + + + + + + + + + + + + + +
TableIndex2.1.32.2
TypeColumn(s)TypeColumn(s)
SECURITY_PRINCIPALUIX_SECURITY_PRINCIPALuniqueFULL_PATHuniquePRINCIPAL_TYPE, PRINCIPAL_NAME
+
+
-

The following tables describe database schema changes from version 2.1.3 to version 2.1.2. +

The following tables describe database schema changes from version 2.1.2 to version 2.1.3.

--------------------------------------------------------------------- To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org For additional commands, e-mail: jetspeed-dev-help@portals.apache.org