You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by we...@apache.org on 2004/10/12 22:12:32 UTC
cvs commit: jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletregistry PersistenceStorePortletRegistry.java
weaver 2004/10/12 13:12:32
Added: components/registry/src/test/org/apache/jetspeed/components/portletregistry
TestPortletRegistryDAO.java
components/registry/src/java/META-INF
registry_repository.xml registry-dao.xml
components/registry/src/java/org/apache/jetspeed/components/portletregistry
PersistenceStorePortletRegistry.java
Log:
see: http://nagoya.apache.org/jira/browse/JS2-144#action_53959
Revision Changes Path
1.1 jakarta-jetspeed-2/components/registry/src/test/org/apache/jetspeed/components/portletregistry/TestPortletRegistryDAO.java
Index: TestPortletRegistryDAO.java
===================================================================
/*
* Created on Oct 8, 2004
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package org.apache.jetspeed.components.portletregistry;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.Locale;
import javax.portlet.PortletMode;
import org.apache.jetspeed.components.persistence.store.LockFailedException;
import org.apache.jetspeed.components.util.DatasourceTestCase;
import org.apache.jetspeed.om.common.DublinCore;
import org.apache.jetspeed.om.common.GenericMetadata;
import org.apache.jetspeed.om.common.JetspeedServiceReference;
import org.apache.jetspeed.om.common.UserAttribute;
import org.apache.jetspeed.om.common.UserAttributeRef;
import org.apache.jetspeed.om.common.portlet.ContentTypeComposite;
import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
import org.apache.jetspeed.om.common.preference.PreferenceComposite;
import org.apache.jetspeed.om.impl.DublinCoreImpl;
import org.apache.jetspeed.om.impl.JetspeedServiceReferenceImpl;
import org.apache.jetspeed.om.impl.UserAttributeImpl;
import org.apache.jetspeed.om.impl.UserAttributeRefImpl;
import org.apache.jetspeed.om.portlet.impl.ContentTypeImpl;
import org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl;
import org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl;
import org.apache.jetspeed.om.servlet.impl.WebApplicationDefinitionImpl;
import org.apache.jetspeed.util.JetspeedLocale;
import org.apache.pluto.om.common.PreferenceSetCtrl;
import org.apache.pluto.om.portlet.PortletApplicationDefinition;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* <p>
* TestPortletRegistryDAO
* </p>
* <p>
*
* </p>
* @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
* @version $Id: TestPortletRegistryDAO.java,v 1.1 2004/10/12 20:12:32 weaver Exp $
*
*/
public class TestPortletRegistryDAO extends DatasourceTestCase
{
public static final String APP_1_NAME = "RegistryTestPortlet";
protected static final String MODE_EDIT = "EDIT";
protected static final String MODE_HELP = "HELP";
protected static final String MODE_VIEW = "VIEW";
protected static final String PORTLET_0_CLASS = "com.portlet.MyClass0";
protected static final String PORTLET_0_NAME = "Portlet 0";
protected static final String PORTLET_0_UID = "com.portlet.MyClass0.Portlet 0";
protected static final String PORTLET_1_CLASS = "com.portlet.MyClass";
protected static final String PORTLET_1_NAME = "Portlet 1";
protected static final String PORTLET_1_UID = "com.portlet.MyClass.Portlet 1";
protected PortletRegistry portletRegistry;
/*
* @see TestCase#setUp()
*/
protected void setUp() throws Exception
{
super.setUp();
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("/META-INF/registry-dao.xml");
this.portletRegistry = (PortletRegistry) ctx.getBean("portletRegistry");
buildTestData();
}
/*
* @see TestCase#tearDown()
*/
protected void tearDown() throws Exception
{
//super.tearDown();
Iterator itr = portletRegistry.getPortletApplications().iterator();
while(itr.hasNext())
{
portletRegistry.removeApplication((PortletApplicationDefinition)itr.next());
}
}
public void test1() throws Exception
{
assertNotNull(portletRegistry);
}
public void testData() throws Exception
{
verifyData(false);
}
private void addDublinCore(GenericMetadata metadata)
{
DublinCore dc = new DublinCoreImpl(metadata);
dc.addTitle(JetspeedLocale.getDefaultLocale(), "Test title 1");
dc.addTitle(JetspeedLocale.getDefaultLocale(), "Test title 2");
dc.addTitle(JetspeedLocale.getDefaultLocale(), "Test title 3");
dc.addContributor(JetspeedLocale.getDefaultLocale(), "Contrib 1");
dc.addCoverage(JetspeedLocale.getDefaultLocale(), "Coverage 1");
dc.addCoverage(JetspeedLocale.getDefaultLocale(), "Coverage 2");
dc.addCreator(JetspeedLocale.getDefaultLocale(), "Creator 1");
dc.addDescription(JetspeedLocale.getDefaultLocale(), "Description 1");
dc.addFormat(JetspeedLocale.getDefaultLocale(), "Format 1");
dc.addIdentifier(JetspeedLocale.getDefaultLocale(), "Identifier 1");
dc.addLanguage(JetspeedLocale.getDefaultLocale(), "Language 1");
dc.addPublisher(JetspeedLocale.getDefaultLocale(), "Publisher 1");
dc.addRelation(JetspeedLocale.getDefaultLocale(), "Relation 1");
dc.addRight(JetspeedLocale.getDefaultLocale(), "Right 1");
dc.addSource(JetspeedLocale.getDefaultLocale(), "Source 1");
dc.addSubject(JetspeedLocale.getDefaultLocale(), "Subject 1");
dc.addType(JetspeedLocale.getDefaultLocale(), "Type 1");
}
/**
* <p>
* buildTestData
* </p>
*
* @throws RegistryException
* @throws LockFailedException
*/
private void buildTestData() throws RegistryException, LockFailedException
{
// Create an Application and a Web app
PortletApplicationDefinitionImpl app = new PortletApplicationDefinitionImpl();
app.setName("App_1");
app.setApplicationIdentifier("App_1");
UserAttributeRef uaRef = new UserAttributeRefImpl("user-name-family", "user.name.family");
app.addUserAttributeRef(uaRef);
UserAttribute ua = new UserAttributeImpl("user.name.family", "User Last Name");
app.addUserAttribute(ua);
JetspeedServiceReference service1 = new JetspeedServiceReferenceImpl("PortletEntityAccessComponent");
app.addJetspeedService(service1);
JetspeedServiceReference service2 = new JetspeedServiceReferenceImpl("PortletRegistryComponent");
app.addJetspeedService(service2);
addDublinCore(app.getMetadata());
WebApplicationDefinitionImpl webApp = new WebApplicationDefinitionImpl();
webApp.setContextRoot("/app1");
webApp.addDescription(Locale.FRENCH, "Description: La fromage est dans ma pantalon!");
webApp.addDisplayName(Locale.FRENCH, "Display Name: La fromage est dans ma pantalon!");
PortletDefinitionComposite portlet = new PortletDefinitionImpl();
portlet.setClassName("org.apache.Portlet");
portlet.setName("Portlet 1");
portlet.addDescription(Locale.getDefault(), "POrtlet description.");
portlet.addDisplayName(Locale.getDefault(), "Portlet display Name.");
portlet.addInitParameter("testparam", "test value", "This is a test portlet parameter", Locale.getDefault());
addDublinCore(portlet.getMetadata());
// PreferenceComposite pc = new PrefsPreference();
app.addPortletDefinition(portlet);
PreferenceSetCtrl prefSetCtrl = (PreferenceSetCtrl) portlet.getPreferenceSet();
PreferenceComposite pc =(PreferenceComposite) prefSetCtrl.add("preference 1", Arrays.asList(new String[]{"value 1", "value 2"}));
pc.addDescription(JetspeedLocale.getDefaultLocale(), "Preference Description");
assertNotNull(pc.getValueAt(0));
portlet.addLanguage(portletRegistry.createLanguage(Locale.getDefault(), "Portlet 1", "Portlet 1", "This is Portlet 1", null));
ContentTypeComposite html = new ContentTypeImpl();
html.setContentType("html/text");
ContentTypeComposite wml = new ContentTypeImpl();
html.addPortletMode(new PortletMode(MODE_EDIT));
html.addPortletMode(new PortletMode(MODE_VIEW));
html.addPortletMode(new PortletMode(MODE_HELP));
wml.setContentType("wml");
wml.addPortletMode(new PortletMode(MODE_HELP));
wml.addPortletMode(new PortletMode(MODE_VIEW));
portlet.addContentType(html);
portlet.addContentType(wml);
app.setWebApplicationDefinition(webApp);
portletRegistry.updatePortletApplication(app);
}
protected void verifyData(boolean afterUpdates) throws Exception
{
MutablePortletApplication app;
WebApplicationDefinitionImpl webApp;
PortletDefinitionComposite portlet;
// Now makes sure everthing got persisted
app = null;
app = (PortletApplicationDefinitionImpl) portletRegistry.getPortletApplication("App_1");
assertNotNull(app);
webApp = (WebApplicationDefinitionImpl) app.getWebApplicationDefinition();
portlet = (PortletDefinitionImpl) app.getPortletDefinitionByName("Portlet 1");
assertNotNull("Failed to reteive portlet application", app);
validateDublinCore(app.getMetadata());
Collection services = app.getJetspeedServices();
assertNotNull("jetspeed services is null", services);
System.out.println("services is " + services);
assertNotNull("Failed to reteive portlet application via registry", portletRegistry.getPortletApplication("App_1"));
assertNotNull("Web app was not saved along with the portlet app.", webApp);
assertNotNull("Portlet was not saved along with the portlet app.", app.getPortletDefinitionByName("Portlet 1"));
if (!afterUpdates)
{
assertTrue("\"user.name.family\" user attribute was not found.", app.getUserAttributes().size() == 1);
}
else
{
assertTrue("\"user.name.family\" and user.pets user attributes were not found.", app.getUserAttributes().size() == 2);
}
portlet = (PortletDefinitionComposite) portletRegistry.getPortletDefinitionByUniqueName("App_1::Portlet 1");
assertNotNull("Portlet could not be retreived by unique name.", portlet);
validateDublinCore(portlet.getMetadata());
assertNotNull("Portlet Application was not set in the portlet defintion.", portlet
.getPortletApplicationDefinition());
assertNotNull("French description was not materialized for the web app.", webApp.getDescription(Locale.FRENCH));
assertNotNull("French display name was not materialized for the web app.", webApp.getDisplayName(Locale.FRENCH));
assertNotNull("description was not materialized for the portlet.", portlet.getDescription(Locale.getDefault()));
assertNotNull("display name was not materialized for the portlet.", portlet.getDisplayName(Locale.getDefault()));
assertNotNull("\"testparam\" portlet parameter was not saved", portlet.getInitParameterSet().get("testparam"));
assertNotNull("\"preference 1\" was not found.", portlet.getPreferenceSet().get("preference 1"));
assertNotNull("Language information not found for Portlet 1", portlet.getLanguageSet().get(Locale.getDefault()));
assertNotNull("Content Type html not found.", portlet.getContentTypeSet().get("html/text"));
assertNotNull("Content Type wml not found.", portlet.getContentTypeSet().get("wml"));
Iterator itr = portlet.getPreferenceSet().get("preference 1").getValues();
int valueCount = 0;
while (itr.hasNext())
{
itr.next();
valueCount++;
}
assertEquals("\"preference 1\" did not have 2 values.", 2, valueCount);
// Pull out our Web app and add a Description to it
webApp = null;
app = portletRegistry.getPortletApplication("App_1");
webApp = (WebApplicationDefinitionImpl) app.getWebApplicationDefinition();
assertNotNull("Web app was not located by query.", webApp);
webApp.addDescription(Locale.getDefault(), "Web app description");
webApp = null;
app = portletRegistry.getPortletApplication("App_1");
webApp = (WebApplicationDefinitionImpl) app.getWebApplicationDefinition();
assertNotNull("Web app was not located by query.", webApp);
assertNotNull("Web app did NOT persist its description", webApp.getDescription(Locale.getDefault()));
}
protected void validateDublinCore( GenericMetadata metadata )
{
DublinCore dc = new DublinCoreImpl(metadata);
assertEquals(dc.getTitles().size(), 3);
assertEquals(dc.getContributors().size(), 1);
assertEquals(dc.getCoverages().size(), 2);
assertEquals(dc.getCreators().size(), 1);
assertEquals(dc.getDescriptions().size(), 1);
assertEquals(dc.getFormats().size(), 1);
assertEquals(dc.getIdentifiers().size(), 1);
assertEquals(dc.getLanguages().size(), 1);
assertEquals(dc.getPublishers().size(), 1);
assertEquals(dc.getRelations().size(), 1);
assertEquals(dc.getRights().size(), 1);
assertEquals(dc.getSources().size(), 1);
assertEquals(dc.getSubjects().size(), 1);
assertEquals(dc.getTypes().size(), 1);
}
}
1.1 jakarta-jetspeed-2/components/registry/src/java/META-INF/registry_repository.xml
Index: registry_repository.xml
===================================================================
<!--
Copyright [year] The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
- L O C A L I Z E D F I E L D
-->
<descriptor-repository version="1.0">
<class-descriptor
class="org.apache.jetspeed.om.portlet.impl.PortletApplicationLocalizedFieldImpl"
table="PA_METADATA_FIELDS"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="parentId"
column="OBJECT_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="value"
column="VALUE"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="name"
column="NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="locale"
column="LOCALE_STRING"
jdbc-type="VARCHAR"
conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
/>
</class-descriptor>
<class-descriptor
class="org.apache.jetspeed.om.portlet.impl.PortletDefinitionLocalizedFieldImpl"
table="PD_METADATA_FIELDS"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="parentId"
column="OBJECT_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="value"
column="VALUE"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="name"
column="NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="locale"
column="LOCALE_STRING"
jdbc-type="VARCHAR"
conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
/>
</class-descriptor>
<!--
- P O R T L E T A P P L I C A T I O N
-->
<class-descriptor
class="org.apache.jetspeed.om.common.portlet.MutablePortletApplication"
>
<extent-class class-ref="org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl" />
</class-descriptor>
<class-descriptor
class="org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl"
table="PORTLET_APPLICATION"
>
<field-descriptor
name="id"
column="APPLICATION_ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="checksum"
column="CHECKSUM"
jdbc-type="VARCHAR"
/>
<!--conversion="org.apache.jetspeed.util.ojb.LongtoStringFieldConversion"-->
<!--conversion="org.apache.jetspeed.util.ojb.ObjectIDtoLongFieldConversion" -->
<field-descriptor
name="name"
column="APP_NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="applicationIdentifier"
column="APP_IDENTIFIER"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="version"
column="VERSION"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="description"
column="DESCRIPTION"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="webApplicationId"
column="WEB_APP_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="applicationType"
column="APP_TYPE"
jdbc-type="INTEGER"
/>
<collection-descriptor
name="metadataFields"
element-class-ref="org.apache.jetspeed.om.portlet.impl.PortletApplicationLocalizedFieldImpl"
auto-delete="object"
auto-update = "object"
auto-retrieve = "true"
>
<inverse-foreignkey field-ref="parentId"/>
</collection-descriptor>
<reference-descriptor
name="webApplication"
class-ref="org.apache.jetspeed.om.servlet.impl.WebApplicationDefinitionImpl"
auto-delete="true"
auto-update = "true"
auto-retrieve = "true"
>
<foreignkey field-ref="webApplicationId"/>
</reference-descriptor>
<collection-descriptor
name="portlets"
element-class-ref="org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl"
auto-delete="true"
auto-update = "true"
auto-retrieve = "true"
>
<inverse-foreignkey field-ref="appId"/>
</collection-descriptor>
<collection-descriptor
name="userAttributes"
element-class-ref="org.apache.jetspeed.om.impl.UserAttributeImpl"
auto-delete="object"
auto-update = "object"
auto-retrieve = "true"
>
<inverse-foreignkey field-ref="appId"/>
</collection-descriptor>
<collection-descriptor
name="userAttributeRefs"
element-class-ref="org.apache.jetspeed.om.impl.UserAttributeRefImpl"
auto-delete="object"
auto-update = "object"
auto-retrieve = "true"
>
<inverse-foreignkey field-ref="appId"/>
</collection-descriptor>
<collection-descriptor
name="services"
element-class-ref="org.apache.jetspeed.om.impl.JetspeedServiceReferenceImpl"
auto-delete="true"
auto-update = "true"
auto-retrieve = "true"
>
<inverse-foreignkey field-ref="appId"/>
</collection-descriptor>
</class-descriptor>
<!--
- W E B A P P L I C A T I O N
-->
<class-descriptor
class="org.apache.jetspeed.om.servlet.impl.WebApplicationDefinitionImpl"
table="WEB_APPLICATION"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="contextRoot"
column="CONTEXT_ROOT"
jdbc-type="VARCHAR"
/>
<collection-descriptor
name="descriptions"
element-class-ref="org.apache.jetspeed.om.impl.WebAppDescriptionImpl"
auto-delete="true"
auto-update = "true"
auto-retrieve = "true"
>
<inverse-foreignkey field-ref="parentId"/>
</collection-descriptor>
<collection-descriptor
name="displayNames"
element-class-ref="org.apache.jetspeed.om.impl.WebAppDisplayNameImpl"
auto-delete="true"
auto-update = "true"
auto-retrieve = "true"
>
<inverse-foreignkey field-ref="parentId"/>
</collection-descriptor>
<collection-descriptor
name="securityRoles"
element-class-ref="org.apache.jetspeed.om.servlet.impl.SecurityRoleImpl"
auto-delete="false"
auto-update = "true"
auto-retrieve = "true"
>
<inverse-foreignkey field-ref="webAppId"/>
</collection-descriptor>
</class-descriptor>
<!--
- P O R T L E T D E F I N I T I O N
-->
<class-descriptor
class="org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl"
table="PORTLET_DEFINITION"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="portletIdentifier"
column="PORTLET_IDENTIFIER"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="name"
column="NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="className"
column="CLASS_NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="appId"
column="APPLICATION_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="expirationCache"
column="EXPIRATION_CACHE"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="resourceBundle"
column="RESOURCE_BUNDLE"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="preferenceValidatorClassname"
column="PREFERENCE_VALIDATOR"
jdbc-type="VARCHAR"
/>
<collection-descriptor
name="metadataFields"
element-class-ref="org.apache.jetspeed.om.portlet.impl.PortletDefinitionLocalizedFieldImpl"
auto-delete="object"
auto-update = "object"
auto-retrieve = "true"
>
<inverse-foreignkey field-ref="parentId"/>
</collection-descriptor>
<reference-descriptor
name="app"
class-ref="org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl"
auto-delete="false"
auto-update = "true"
auto-retrieve = "true"
>
<foreignkey field-ref="appId"/>
</reference-descriptor>
<collection-descriptor
name="displayNames"
element-class-ref="org.apache.jetspeed.om.impl.PortletDisplayNameImpl"
auto-delete="true"
auto-update = "true"
auto-retrieve = "true"
>
<inverse-foreignkey field-ref="parentId"/>
</collection-descriptor>
<collection-descriptor
name="languageSet"
element-class-ref="org.apache.jetspeed.om.impl.LanguageImpl"
auto-delete="true"
auto-update = "true"
auto-retrieve = "true"
>
<inverse-foreignkey field-ref="portletId"/>
</collection-descriptor>
<collection-descriptor
name="contentTypes"
element-class-ref="org.apache.jetspeed.om.portlet.impl.ContentTypeImpl"
auto-delete="true"
auto-update = "true"
auto-retrieve = "true"
>
<inverse-foreignkey field-ref="portletId"/>
</collection-descriptor>
<collection-descriptor
name="parameterSet"
proxy="true"
element-class-ref="org.apache.jetspeed.om.impl.PortletInitParameterImpl"
auto-delete="true"
auto-update = "true"
auto-retrieve = "true"
>
<inverse-foreignkey field-ref="parentId"/>
</collection-descriptor>
<collection-descriptor
name="securityRoleRefSet"
element-class-ref="org.apache.jetspeed.om.impl.SecurityRoleRefImpl"
auto-delete="true"
auto-update = "true"
auto-retrieve = "true"
>
<inverse-foreignkey field-ref="portletId"/>
</collection-descriptor>
<collection-descriptor
name="descriptions"
element-class-ref="org.apache.jetspeed.om.impl.PortletDescriptionImpl"
auto-delete="true"
auto-update = "true"
auto-retrieve = "true"
>
<inverse-foreignkey field-ref="parentId"/>
</collection-descriptor>
<!--
<collection-descriptor
name="portletEntities"
element-class-ref="org.apache.jetspeed.components.portletentity.PortletEntityImpl"
auto-delete="true"
auto-update = "true"
auto-retrieve = "true"
>
<inverse-foreignkey field-ref="portletId"/>
</collection-descriptor>
-->
</class-descriptor>
<!--
- L A N G U A G E
-->
<class-descriptor
class="org.apache.jetspeed.om.impl.LanguageImpl"
table="LANGUAGE"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="portletId"
column="PORTLET_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="title"
column="TITLE"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="shortTitle"
column="SHORT_TITLE"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="keywords"
column="KEYWORDS"
jdbc-type="VARCHAR"
conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
/>
<field-descriptor
name="locale"
column="LOCALE_STRING"
jdbc-type="VARCHAR"
conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
/>
</class-descriptor>
<!--
- C O N T E N T T Y P E
-->
<class-descriptor
class="org.apache.jetspeed.om.common.portlet.ContentTypeComposite"
>
<extent-class class-ref="org.apache.jetspeed.om.portlet.impl.ContentTypeImpl" />
</class-descriptor>
<class-descriptor
class="org.apache.jetspeed.om.portlet.impl.ContentTypeImpl"
table="PORTLET_CONTENT_TYPE"
>
<field-descriptor
name="contentTypeId"
column="CONTENT_TYPE_ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="portletId"
column="PORTLET_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="contentType"
column="CONTENT_TYPE"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="portletModes"
column="MODES"
jdbc-type="VARCHAR"
conversion="org.apache.jetspeed.util.ojb.CSVtoPortletModeFieldConversion"
/>
</class-descriptor>
<!--
- P A R A M E T E R
-->
<!--
<class-descriptor
class="org.apache.jetspeed.om.common.ParameterImpl"
table="PARAMETER"
>
<extent-class class-ref="org.apache.jetspeed.om.common.extended.PortletInitParameterImpl" />
<extent-class class-ref="org.apache.jetspeed.om.common.extended.ServletInitParameterImpl" />
</class-descriptor>
-->
<class-descriptor
class="org.apache.jetspeed.om.impl.ServletInitParameterImpl"
table="PARAMETER"
>
<field-descriptor
name="parameterId"
column="PARAMETER_ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="parentId"
column="PARENT_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="name"
column="NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="value"
column="PARAMETER_VALUE"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="ojbConcreteClass"
column="CLASS_NAME"
jdbc-type="VARCHAR"
/>
</class-descriptor>
<class-descriptor
class="org.apache.jetspeed.om.impl.PortletInitParameterImpl"
table="PARAMETER"
>
<field-descriptor
name="parameterId"
column="PARAMETER_ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="parentId"
column="PARENT_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="name"
column="NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="value"
column="PARAMETER_VALUE"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="ojbConcreteClass"
column="CLASS_NAME"
jdbc-type="VARCHAR"
/>
<collection-descriptor
name="descriptions"
element-class-ref="org.apache.jetspeed.om.impl.ParameterDescriptionImpl"
auto-delete="true"
auto-update = "true"
auto-retrieve = "true"
>
<inverse-foreignkey field-ref="parentId"/>
</collection-descriptor>
</class-descriptor>
<!--
- L O C A L I Z E D D E S C R I P I T I O N
-->
<class-descriptor
class="org.apache.jetspeed.om.impl.PortletDescriptionImpl"
table="LOCALIZED_DESCRIPTION"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="parentId"
column="OBJECT_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="ojbConcreteClass"
column="CLASS_NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="description"
column="DESCRIPTION"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="locale"
column="LOCALE_STRING"
jdbc-type="VARCHAR"
conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
/>
</class-descriptor>
<class-descriptor
class="org.apache.jetspeed.om.impl.PortletAppDescriptionImpl"
table="LOCALIZED_DESCRIPTION"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="parentId"
column="OBJECT_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="ojbConcreteClass"
column="CLASS_NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="description"
column="DESCRIPTION"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="locale"
column="LOCALE_STRING"
jdbc-type="VARCHAR"
conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
/>
</class-descriptor>
<class-descriptor
class="org.apache.jetspeed.om.impl.WebAppDescriptionImpl"
table="LOCALIZED_DESCRIPTION"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="parentId"
column="OBJECT_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="ojbConcreteClass"
column="CLASS_NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="description"
column="DESCRIPTION"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="locale"
column="LOCALE_STRING"
jdbc-type="VARCHAR"
conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
/>
</class-descriptor>
<class-descriptor
class="org.apache.jetspeed.om.impl.PortletEntityDescriptionImpl"
table="LOCALIZED_DESCRIPTION"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="parentId"
column="OBJECT_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="ojbConcreteClass"
column="CLASS_NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="description"
column="DESCRIPTION"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="locale"
column="LOCALE_STRING"
jdbc-type="VARCHAR"
conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
/>
</class-descriptor>
<class-descriptor
class="org.apache.jetspeed.om.impl.ParameterDescriptionImpl"
table="LOCALIZED_DESCRIPTION"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="parentId"
column="OBJECT_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="ojbConcreteClass"
column="CLASS_NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="description"
column="DESCRIPTION"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="locale"
column="LOCALE_STRING"
jdbc-type="VARCHAR"
conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
/>
</class-descriptor>
<class-descriptor
class="org.apache.jetspeed.om.impl.PreferenceDescriptionImpl"
table="LOCALIZED_DESCRIPTION"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="parentId"
column="OBJECT_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="ojbConcreteClass"
column="CLASS_NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="description"
column="DESCRIPTION"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="locale"
column="LOCALE_STRING"
jdbc-type="VARCHAR"
conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
/>
</class-descriptor>
<class-descriptor
class="org.apache.jetspeed.om.impl.SecurityRoleRefDescriptionImpl"
table="LOCALIZED_DESCRIPTION"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="parentId"
column="OBJECT_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="ojbConcreteClass"
column="CLASS_NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="description"
column="DESCRIPTION"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="locale"
column="LOCALE_STRING"
jdbc-type="VARCHAR"
conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
/>
</class-descriptor>
<class-descriptor
class="org.apache.jetspeed.om.impl.PortletDisplayNameImpl"
table="LOCALIZED_DISPLAY_NAME"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="parentId"
column="OBJECT_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="ojbConcreteClass"
column="CLASS_NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="displayName"
column="DISPLAY_NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="locale"
column="LOCALE_STRING"
jdbc-type="VARCHAR"
conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
/>
</class-descriptor>
<class-descriptor
class="org.apache.jetspeed.om.impl.WebAppDisplayNameImpl"
table="LOCALIZED_DISPLAY_NAME"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="parentId"
column="OBJECT_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="ojbConcreteClass"
column="CLASS_NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="displayName"
column="DISPLAY_NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="locale"
column="LOCALE_STRING"
jdbc-type="VARCHAR"
conversion="org.apache.jetspeed.util.ojb.LocaleFieldConversion"
/>
</class-descriptor>
<!--
- P O R T L E T E N T I T Y
-->
<class-descriptor
class="org.apache.jetspeed.components.portletentity.PortletEntityImpl"
table="PORTLET_ENTITY"
>
<field-descriptor
name="oid"
column="PEID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="appName"
column="APP_NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="portletName"
column="PORTLET_NAME"
jdbc-type="VARCHAR"
/>
<!--
<field-descriptor
name="portletId"
column="PORTLET_DEFINITION_ID"
jdbc-type="BIGINT"
/>
-->
<field-descriptor
name="id"
column="ID"
jdbc-type="VARCHAR"
autoincrement="true"
conversion="org.apache.jetspeed.util.ojb.ObjectIDtoStringFieldConversion"
/>
<!-- conversion="org.apache.jetspeed.util.ojb.ObjectIDtoStringFieldConversion" -->
<!--
<reference-descriptor
name="portletDefinition"
class-ref="org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl"
auto-delete="false"
auto-update = "true"
auto-retrieve = "true"
>
<foreignkey field-ref="portletId"/>
</reference-descriptor>
-->
</class-descriptor>
<!--
- S E C U R T I T Y R O L E R E F
-->
<class-descriptor
class="org.apache.jetspeed.om.impl.SecurityRoleRefImpl"
table="SECURITY_ROLE_REFERENCE"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
access="anonymous"
/>
<field-descriptor
name="portletId"
column="PORTLET_DEFINITION_ID"
jdbc-type="BIGINT"
access="anonymous"
/>
<field-descriptor
name="name"
column="ROLE_NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="link"
column="ROLE_LINK"
jdbc-type="VARCHAR"
/>
<collection-descriptor
name="descriptions"
element-class-ref="org.apache.jetspeed.om.impl.SecurityRoleRefDescriptionImpl"
auto-delete="true"
auto-update = "true"
auto-retrieve = "true"
>
<inverse-foreignkey field-ref="parentId"/>
</collection-descriptor>
</class-descriptor>
<!--
- S E C U R I T Y R O L E
-->
<class-descriptor
class="org.apache.jetspeed.om.servlet.impl.SecurityRoleImpl"
table="SECURITY_ROLE"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
access="anonymous"
/>
<field-descriptor
name="webAppId"
column="WEB_APPLICATION_ID"
jdbc-type="BIGINT"
access="anonymous"
/>
<field-descriptor
name="roleName"
column="ROLE_NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="description"
column="DESCRIPTION"
jdbc-type="VARCHAR"
/>
</class-descriptor>
<!--
- U S E R A T T R I B U T E R E F
-->
<class-descriptor
class="org.apache.jetspeed.om.impl.UserAttributeRefImpl"
table="USER_ATTRIBUTE_REF"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
indexed="true"
/>
<field-descriptor
name="appId"
column="APPLICATION_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="name"
column="NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="nameLink"
column="NAME_LINK"
jdbc-type="VARCHAR"
/>
</class-descriptor>
<!--
- U S E R A T T R I B U T E
-->
<class-descriptor
class="org.apache.jetspeed.om.impl.UserAttributeImpl"
table="USER_ATTRIBUTE"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
indexed="true"
/>
<field-descriptor
name="appId"
column="APPLICATION_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="name"
column="NAME"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="description"
column="DESCRIPTION"
jdbc-type="VARCHAR"
/>
</class-descriptor>
<!--
- S E R V I C E S
-->
<class-descriptor
class="org.apache.jetspeed.om.impl.JetspeedServiceReferenceImpl"
table="JETSPEED_SERVICE"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
access="anonymous"
/>
<field-descriptor
name="appId"
column="APPLICATION_ID"
jdbc-type="BIGINT"
/>
<field-descriptor
name="name"
column="NAME"
jdbc-type="VARCHAR"
/>
</class-descriptor>
</descriptor-repository>
1.1 jakarta-jetspeed-2/components/registry/src/java/META-INF/registry-dao.xml
Index: registry-dao.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<!--
- Application context definition for PortletRegistry using Apache OJB.
-->
<beans>
<!-- Transaction manager for a single OJB PersistenceBroker (alternative to JTA) -->
<bean id="transactionManager" class="org.springframework.orm.ojb.PersistenceBrokerTransactionManager"/>
<!-- Transaction manager that delegates to JTA (for a transactional JNDI DataSource) -->
<!--
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"/>
-->
<!-- ========================= BUSINESS OBJECT DEFINITIONS ========================= -->
<!--
- A parent bean definition which is a base definition for transaction proxies.
- It is markes as abstract, since it is never supposed to be instantiated itself.
- We set shared transaction attributes here, following our naming patterns.
- The attributes can still be overridden in child bean definitions.
-->
<bean id="baseTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true">
<property name="transactionManager"><ref bean="transactionManager"/></property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!--
- PortletRegsitry business object: OJB implementation, as an inner bean wrapped
- by an outer transactional proxy. The two bean definitions could have been separate,
- but this is cleaner as there is no need to ever access the unwrapped object.
-->
<bean id="portletRegistryImpl" class="org.apache.jetspeed.components.portletregistry.PersistenceStorePortletRegistry" init-method="init"/>
<bean id="portletRegistry" parent="baseTransactionProxy" >
<property name="target">
<ref bean="portletRegistryImpl"/>
</property>
</bean>
</beans>
1.1 jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletregistry/PersistenceStorePortletRegistry.java
Index: PersistenceStorePortletRegistry.java
===================================================================
/*
* Copyright 2000-2001,2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.jetspeed.components.portletregistry;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;
import org.apache.jetspeed.om.common.MutableLanguage;
import org.apache.jetspeed.om.common.Support;
import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
import org.apache.jetspeed.om.impl.LanguageImpl;
import org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl;
import org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl;
import org.apache.ojb.broker.metadata.DescriptorRepository;
import org.apache.ojb.broker.metadata.MetadataManager;
import org.apache.ojb.broker.metadata.RepositoryPersistor;
import org.apache.ojb.broker.query.Criteria;
import org.apache.ojb.broker.query.QueryFactory;
import org.apache.pluto.om.common.Language;
import org.apache.pluto.om.common.ObjectID;
import org.apache.pluto.om.portlet.PortletApplicationDefinition;
import org.apache.pluto.om.portlet.PortletDefinition;
import org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport;
/**
* <p>
* OjbPortletRegistry
* </p>
* <p>
*
* </p>
*
* @author <a href="mailto:weaver@apache.org">Scott T. Weaver </a>
* @version $Id: PersistenceStorePortletRegistry.java,v 1.1 2004/10/12 20:12:32 weaver Exp $
*
*/
public class PersistenceStorePortletRegistry extends PersistenceBrokerDaoSupport implements PortletRegistry
{
/**
*
*/
public PersistenceStorePortletRegistry()
{
super();
PortletDefinitionImpl.setPortletRegistry(this);
}
public Language createLanguage( Locale locale, String title, String shortTitle, String description,
Collection keywords ) throws RegistryException
{
try
{
MutableLanguage lc = new LanguageImpl();
lc.setLocale(locale);
lc.setTitle(title);
lc.setShortTitle(shortTitle);
lc.setKeywords(keywords);
return lc;
}
catch (Exception e)
{
throw new RegistryException("Unable to create language object.");
}
}
public List getAllPortletDefinitions()
{
Criteria c = new Criteria();
List list = new ArrayList(getPersistenceBrokerTemplate().getCollectionByQuery(
QueryFactory.newQuery(PortletDefinitionImpl.class, c)));
postLoadColl(list);
return list;
}
public MutablePortletApplication getPortletApplication( ObjectID id )
{
Criteria c = new Criteria();
c.addEqualTo("id", new Long(id.toString()));
MutablePortletApplication app = (MutablePortletApplication) getPersistenceBrokerTemplate().getObjectByQuery(
QueryFactory.newQuery(PortletApplicationDefinitionImpl.class, c));
postLoad(app);
return app;
}
public MutablePortletApplication getPortletApplication( String name )
{
Criteria c = new Criteria();
c.addEqualTo("name", name);
MutablePortletApplication app = (MutablePortletApplication) getPersistenceBrokerTemplate().getObjectByQuery(
QueryFactory.newQuery(PortletApplicationDefinitionImpl.class, c));
postLoad(app);
return app;
}
public MutablePortletApplication getPortletApplicationByIdentifier( String identifier )
{
Criteria c = new Criteria();
c.addEqualTo("applicationIdentifier", identifier);
MutablePortletApplication app = (MutablePortletApplication) getPersistenceBrokerTemplate().getObjectByQuery(
QueryFactory.newQuery(PortletApplicationDefinitionImpl.class, c));
postLoad(app);
return app;
}
public List getPortletApplications()
{
Criteria c = new Criteria();
List list = new ArrayList(getPersistenceBrokerTemplate().getCollectionByQuery(
QueryFactory.newQuery(PortletApplicationDefinitionImpl.class, c)));
postLoadColl(list);
return list;
}
public PortletDefinitionComposite getPortletDefinitionByIdentifier( String identifier )
{
Criteria c = new Criteria();
c.addEqualTo("portletIdentifier", identifier);
PortletDefinitionComposite def = (PortletDefinitionComposite) getPersistenceBrokerTemplate().getObjectByQuery(
QueryFactory.newQuery(PortletDefinitionImpl.class, c));
if (def != null && def.getPortletApplicationDefinition() == null)
{
final String msg = "getPortletDefinitionByIdentifier() returned a PortletDefinition that has no parent PortletApplication.";
throw new IllegalStateException(msg);
}
postLoad(def);
return def;
}
public PortletDefinitionComposite getPortletDefinitionByUniqueName( String name )
{
String appName = PortletRegistryHelper.parseAppName(name);
String portletName = PortletRegistryHelper.parsePortletName(name);
Criteria c = new Criteria();
c.addEqualTo("app.name", appName);
c.addEqualTo("name", portletName);
PortletDefinitionComposite def = (PortletDefinitionComposite) getPersistenceBrokerTemplate().getObjectByQuery(
QueryFactory.newQuery(PortletDefinitionImpl.class, c));
if (def != null && def.getPortletApplicationDefinition() == null)
{
final String msg = "getPortletDefinitionByIdentifier() returned a PortletDefinition that has no parent PortletApplication.";
throw new IllegalStateException(msg);
}
postLoad(def);
return def;
}
public boolean portletApplicationExists( String appIdentity )
{
return getPortletApplicationByIdentifier(appIdentity) != null;
}
public boolean portletDefinitionExists( String portletName, MutablePortletApplication app )
{
return getPortletDefinitionByUniqueName(app.getName() + "::" + portletName) != null;
}
public boolean portletDefinitionExists( String portletIdentity )
{
return getPortletDefinitionByIdentifier(portletIdentity) != null;
}
public void registerPortletApplication( PortletApplicationDefinition newApp ) throws RegistryException
{
getPersistenceBrokerTemplate().store(newApp);
}
public void removeApplication( PortletApplicationDefinition app ) throws RegistryException
{
getPersistenceBrokerTemplate().delete(app);
String appNodePath = MutablePortletApplication.PREFS_ROOT + "/" +((MutablePortletApplication)app).getName();
try
{
if(Preferences.systemRoot().nodeExists(appNodePath))
{
Preferences node = Preferences.systemRoot().node(appNodePath);
// log.info("Removing Application preference node "+node.absolutePath());
node.removeNode();
}
}
catch (BackingStoreException e)
{
throw new RegistryException(e.toString(), e);
}
}
public void updatePortletApplication( PortletApplicationDefinition app ) throws RegistryException
{
getPersistenceBrokerTemplate().store(app);
}
private void postLoad( Object obj )
{
if (obj != null)
{
if (obj instanceof Support)
{
try
{
((Support) obj).postLoad(obj);
}
catch (Exception e)
{
}
}
}
}
private void postLoadColl( Collection coll )
{
if (coll != null && !coll.isEmpty())
{
Iterator itr = coll.iterator();
Object test = itr.next();
if (test instanceof Support)
{
Support testSupport = (Support) test;
try
{
testSupport.postLoad(testSupport);
}
catch (Exception e1)
{
}
while (itr.hasNext())
{
Support support = (Support) itr.next();
try
{
support.postLoad(support);
}
catch (Exception e)
{
}
}
}
}
}
public void savePortletDefinition( PortletDefinition portlet )
{
getPersistenceBrokerTemplate().store(portlet);
}
/**
*
* <p>
* initDao
* </p>
* Loads the correct repository descriptor for PortletRegistry
*
* @see org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport#initDao()
* @throws Exception
*/
public void init() throws Exception
{
MetadataManager metaManager = MetadataManager.getInstance();
RepositoryPersistor persistor = new RepositoryPersistor();
URL descriptorUrl = getClass().getClassLoader().getResource("META-INF/registry_repository.xml");
// log.info("Merging OJB respository: "+descriptorUrl);
DescriptorRepository repo = persistor.readDescriptorRepository(descriptorUrl.openStream());
metaManager.mergeDescriptorRepository(repo);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org