JBoss Portal SVN: r6173 - trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-06 06:19:51 -0500 (Tue, 06 Feb 2007)
New Revision: 6173
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java
Log:
make compile on 1.4
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java 2007-02-06 05:05:56 UTC (rev 6172)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java 2007-02-06 11:19:51 UTC (rev 6173)
@@ -212,11 +212,15 @@
}
catch (ClassNotFoundException e)
{
- throw new IllegalArgumentException("Couldn't find policy class " + policyClassName + ".", e);
+ IllegalArgumentException iae = new IllegalArgumentException("Couldn't find policy class " + policyClassName + ".");
+ iae.initCause(e);
+ throw iae;
}
catch (Exception e)
{
- throw new IllegalArgumentException("Couldn't instantiate policy class.", e);
+ IllegalArgumentException iae = new IllegalArgumentException("Couldn't instantiate policy class.");
+ iae.initCause(e);
+ throw iae;
}
}
else
@@ -241,11 +245,15 @@
}
catch (ClassNotFoundException e)
{
- throw new IllegalArgumentException("Couldn't find validator class " + validatorClassName + ".", e);
+ IllegalArgumentException iae = new IllegalArgumentException("Couldn't find validator class " + validatorClassName + ".");
+ iae.initCause(e);
+ throw iae;
}
catch (Exception e)
{
- throw new IllegalArgumentException("Couldn't instantiate validator class.", e);
+ IllegalArgumentException iae = new IllegalArgumentException("Couldn't instantiate validator class.");
+ iae.initCause(e);
+ throw iae;
}
policy = new DefaultRegistrationPolicy();
19 years, 2 months
JBoss Portal SVN: r6172 - in trunk/cms/src: resources/test/jcr and 1 other directory.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-02-06 00:05:56 -0500 (Tue, 06 Feb 2007)
New Revision: 6172
Modified:
trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java
trunk/cms/src/resources/test/jcr/repository.xml
Log:
fixed the JBossCachePersistenceManager to work with test suite with multiple dbs
Modified: trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java 2007-02-06 04:14:55 UTC (rev 6171)
+++ trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java 2007-02-06 05:05:56 UTC (rev 6172)
@@ -58,6 +58,8 @@
import javax.jcr.PropertyType;
import javax.management.MBeanServer;
+import javax.naming.InitialContext;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -108,13 +110,20 @@
protected BLOBStore blobStore = null;
/**
- *
+ * JackRabbit initalizes multiple instances of the Persistence Manager to perform its operations.
+ * A static TreeCache is used to make sure there is only once instance of the cache per VM where
+ * the CMS node runs.
+ *
+ * One side effect of using a static instance is proper cleanup which is addressed in the close
+ * method
*/
private static TreeCacheMBean pmCache = null;
- private static boolean createdByMe;
private static boolean preloaded = false;
- /** Creates a new <code>SimpleDbPersistenceManager</code> instance. */
+ /**
+ *
+ *
+ */
public JBossCachePersistenceManager()
{
schemaObjectPrefix = "";
@@ -163,7 +172,7 @@
*
*/
public void init(PMContext context) throws Exception
- {
+ {
if (initialized)
{
throw new IllegalStateException("already initialized");
@@ -200,39 +209,45 @@
try
{
Tools.init(this.jndiName);
- if (JBossCachePersistenceManager.pmCache == null)
+ if (pmCache == null)
{
- // julien : removed that, it should be deployed by the portal-cms.sar properly
+ /*
+ * performing an mbean lookup of the tree cache service. Ideally it would be nice to avoid this
+ * and have the service be injected from the sar config. But, a PersistenceManager's lifecycle is managed
+ * by JackRabbit and is not easily modeled as a JMX mbean service.
+ *
+ * The typical mbean lifecycle doesn't map here unless the PM serves as a wrapper/proxy to an mbean
+ * service, but not sure if the extra layer is necessary.
+ *
+ * Also, see the close method to see how the PM cache service is cleaned up.
+ */
+ try
+ {
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ pmCache = (TreeCacheMBean)MBeanProxyExt.create(TreeCacheMBean.class,
+ "cms.pm.cache:service=TreeCache", server);
+ }
+ catch (Exception e)
+ {
+ }
-// try
-// {
-// MBeanServer server = MBeanServerLocator.locateJBoss();
-// JBossCachePersistenceManager.pmCache = (TreeCacheMBean)MBeanProxyExt.create(TreeCacheMBean.class, "cms.pm.cache:service=TreeCache", server);
-// }
-// catch (Exception e)
-// {
-// }
- // For now we always create the cache, we could try a JMX lookup commented above because not properly done
- pmCache = null;
-
//try to load from specified configuration if any
//if nothing found in the environment...chances are running in a non-managed environment
- if (JBossCachePersistenceManager.pmCache == null)
+ if (pmCache == null)
{
InputStream is = null;
try
{
- JBossCachePersistenceManager.pmCache = new TreeCache();
- createdByMe = true;
+ pmCache = new TreeCache();
//configure the cache
PropertyConfigurator configurator = new PropertyConfigurator();
is = JBossCachePersistenceManager.class.getClassLoader().getResourceAsStream("pm-cache.xml");
- configurator.configure(JBossCachePersistenceManager.pmCache, is);
+ configurator.configure(pmCache, is);
- JBossCachePersistenceManager.pmCache.createService();
- JBossCachePersistenceManager.pmCache.startService();
+ pmCache.createService();
+ pmCache.startService();
}
finally
{
@@ -1168,19 +1183,23 @@
*/
public void close() throws Exception
{
+ //cleanup session factory.
+ Tools.destroy();
+
+ //cleanup the jboss cache service
+ if(pmCache != null)
+ {
+ pmCache.stopService();
+ pmCache.destroyService();
+ pmCache = null;
+ preloaded = false;
+ }
+
if (!initialized)
{
throw new IllegalStateException("not initialized");
}
- // We created it, we destroy it
- if (createdByMe && pmCache != null)
- {
- TreeCacheMBean cache = pmCache;
- pmCache = null;
- cache.destroy();
- }
-
try
{
if (externalBLOBs)
Modified: trunk/cms/src/resources/test/jcr/repository.xml
===================================================================
--- trunk/cms/src/resources/test/jcr/repository.xml 2007-02-06 04:14:55 UTC (rev 6171)
+++ trunk/cms/src/resources/test/jcr/repository.xml 2007-02-06 05:05:56 UTC (rev 6172)
@@ -62,11 +62,11 @@
<!--
persistence manager of the workspace.
- Use XMLPersistenceManager for LocalFileSystem Store and HibernatePersistentManager .
+ Use XMLPersistenceManager for LocalFileSystem Store and HibernatePersistenceManager .
-->
<!-- HibernatePersistentManager: uses RDBMS + Hibernate for storage -->
- <PersistenceManager class="org.jboss.portal.cms.hibernate.state.HibernatePersistenceManager">
+ <PersistenceManager class="org.jboss.portal.cms.hibernate.state.JBossCachePersistenceManager">
<param name="schemaObjectPrefix" value="WSP"/>
<param name="JNDIName" value="java:/SessionFactory"/>
<param name="externalBLOBs" value="false"/>
@@ -109,11 +109,11 @@
<!--
Configures the persistence manager to be used for persisting version state.
- Use XMLPersistenceManager for LocalFileSystem Store and HibernatePersistentManager for HibernateStore.
+ Use XMLPersistenceManager for LocalFileSystem Store and HibernatePersistenceManager for HibernateStore.
-->
<!-- HibernatePersistentManager: uses RDBMS + Hibernate for storage -->
- <PersistenceManager class="org.jboss.portal.cms.hibernate.state.HibernatePersistenceManager">
+ <PersistenceManager class="org.jboss.portal.cms.hibernate.state.JBossCachePersistenceManager">
<param name="schemaObjectPrefix" value="Version"/>
<param name="JNDIName" value="java:/SessionFactory"/>
<param name="externalBLOBs" value="false"/>
19 years, 2 months
JBoss Portal SVN: r6171 - in trunk: registration/src/main/org/jboss/portal/registration/policies and 7 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-05 23:14:55 -0500 (Mon, 05 Feb 2007)
New Revision: 6171
Added:
trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPropertyValidator.java
trunk/registration/src/main/org/jboss/portal/registration/policies/RegistrationPropertyValidator.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationServiceImpl.java
trunk/wsrp/src/resources/tests/test-producer-configuration-lib-jar/invalid1.xml
trunk/wsrp/src/resources/tests/test-producer-configuration-lib-jar/invalid2.xml
Modified:
trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationManagerImpl.java
trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPolicy.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/config/ProducerConfigurationTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationFactory.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationService.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerRegistrationRequirements.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationImpl.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java
trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
trunk/wsrp/src/resources/portal-wsrp-sar/conf/config.xml
trunk/wsrp/src/resources/tests/test-producer-configuration-lib-jar/extended.xml
Log:
- Added support for policy configuration from the Producer configuration file.
- Improved robustness of configuration file parsing.
- Made producer depend on configuration service instead of the reverse.
- Updated test cases.
Modified: trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationManagerImpl.java
===================================================================
--- trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationManagerImpl.java 2007-02-06 00:12:05 UTC (rev 6170)
+++ trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationManagerImpl.java 2007-02-06 04:14:55 UTC (rev 6171)
@@ -71,6 +71,7 @@
public void setPolicy(RegistrationPolicy policy)
{
this.policy = policy;
+ policy.setManager(this);
}
public RegistrationPersistenceManager getPersistenceManager()
@@ -83,20 +84,6 @@
this.persistenceManager = persistenceManager;
}
-
- protected void startService() throws Exception
- {
- super.startService();
- policy.setManager(this);
- }
-
-
- protected void stopService() throws Exception
- {
- policy.setManager(null);
- super.stopService();
- }
-
public Registration addRegistrationTo(String consumerName, Map registrationProperties, boolean createConsumerIfNeeded)
throws RegistrationException
{
Modified: trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPolicy.java
===================================================================
--- trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPolicy.java 2007-02-06 00:12:05 UTC (rev 6170)
+++ trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPolicy.java 2007-02-06 04:14:55 UTC (rev 6171)
@@ -33,6 +33,7 @@
import org.jboss.portal.registration.RegistrationManager;
import org.jboss.portal.registration.RegistrationPolicy;
+import javax.xml.namespace.QName;
import java.util.Collections;
import java.util.Iterator;
import java.util.Map;
@@ -47,6 +48,7 @@
public class DefaultRegistrationPolicy extends AbstractJBossService implements RegistrationPolicy
{
private RegistrationManager manager;
+ private RegistrationPropertyValidator validator;
public RegistrationManager getManager()
@@ -87,7 +89,11 @@
else
{
// check that values are consistent with ProducerRegistrationRequirement
- // todo: implement
+ for (Iterator properties = registrationProperties.entrySet().iterator(); properties.hasNext();)
+ {
+ Map.Entry property = (Map.Entry)properties.next();
+ validator.validateValueFor((QName)property.getKey(), property.getValue());
+ }
}
}
@@ -129,4 +135,14 @@
{
// this is already the behavior in the RegistrationPersistenceManager so no need to do anything
}
+
+ public void setValidator(RegistrationPropertyValidator validator)
+ {
+ this.validator = validator;
+ }
+
+ public RegistrationPropertyValidator getValidator()
+ {
+ return validator;
+ }
}
Added: trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPropertyValidator.java
===================================================================
--- trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPropertyValidator.java (rev 0)
+++ trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPropertyValidator.java 2007-02-06 04:14:55 UTC (rev 6171)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * 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.registration.policies;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class DefaultRegistrationPropertyValidator implements RegistrationPropertyValidator
+{
+ public void validateValueFor(QName propertyName, Object value) throws IllegalArgumentException
+ {
+ // accepts only non-null, non-empty String values
+ if (!(value instanceof String) || ((String)value).length() <= 0)
+ {
+ throw new IllegalArgumentException(value + " is not a valid value for property '" + propertyName +
+ "'. DefaultRegistrationPropertyValidator only accepts non-null, non-empty Strings.");
+ }
+ }
+}
Added: trunk/registration/src/main/org/jboss/portal/registration/policies/RegistrationPropertyValidator.java
===================================================================
--- trunk/registration/src/main/org/jboss/portal/registration/policies/RegistrationPropertyValidator.java (rev 0)
+++ trunk/registration/src/main/org/jboss/portal/registration/policies/RegistrationPropertyValidator.java 2007-02-06 04:14:55 UTC (rev 6171)
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * 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.registration.policies;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface RegistrationPropertyValidator
+{
+ void validateValueFor(QName propertyName, Object value) throws IllegalArgumentException;
+}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/config/ProducerConfigurationTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/config/ProducerConfigurationTestCase.java 2007-02-06 00:12:05 UTC (rev 6170)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/config/ProducerConfigurationTestCase.java 2007-02-06 04:14:55 UTC (rev 6171)
@@ -24,16 +24,22 @@
package org.jboss.portal.test.wsrp.config;
import junit.framework.TestCase;
+import org.jboss.portal.registration.RegistrationPolicy;
+import org.jboss.portal.registration.policies.DefaultRegistrationPolicy;
+import org.jboss.portal.registration.policies.DefaultRegistrationPropertyValidator;
+import org.jboss.portal.registration.policies.RegistrationPropertyValidator;
import org.jboss.portal.wsrp.producer.config.ProducerConfiguration;
import org.jboss.portal.wsrp.producer.config.ProducerConfigurationFactory;
import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
import org.jboss.portal.wsrp.registration.LocalizedString;
import org.jboss.portal.wsrp.registration.RegistrationPropertyDescription;
+import org.jboss.xb.binding.JBossXBException;
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
import javax.xml.namespace.QName;
+import java.io.IOException;
import java.net.URL;
import java.util.Locale;
import java.util.Map;
@@ -57,14 +63,15 @@
public void testExtendedUnmarshalling() throws Exception
{
- URL wsrpXMLLocation = Thread.currentThread().getContextClassLoader().getResource("extended.xml");
- assertNotNull(wsrpXMLLocation);
-
- Object o = unmarshaller.unmarshal(wsrpXMLLocation.openStream(), factory, null);
- assertNotNull(o);
- assertTrue(o instanceof ProducerConfiguration);
- ProducerRegistrationRequirements requirements = ((ProducerConfiguration)o).getRegistrationRequirements();
+ ProducerConfiguration producerConfiguration = getProducerConfiguration("extended.xml");
+ ProducerRegistrationRequirements requirements = producerConfiguration.getRegistrationRequirements();
assertNotNull(requirements);
+ RegistrationPolicy policy = requirements.getPolicy();
+ assertNotNull(policy);
+ assertTrue(policy instanceof DefaultRegistrationPolicy);
+ RegistrationPropertyValidator propertyValidator = ((DefaultRegistrationPolicy)policy).getValidator();
+ assertNotNull(propertyValidator);
+ assertTrue(propertyValidator instanceof DefaultRegistrationPropertyValidator);
assertTrue(requirements.requiresRegistration());
assertTrue(requirements.fullServiceDescriptionRequiresRegistration());
Map properties = requirements.getRegistrationProperties();
@@ -77,12 +84,8 @@
public void testMinimalUnmarshalling() throws Exception
{
- URL wsrpXMLLocation = Thread.currentThread().getContextClassLoader().getResource("minimal.xml");
- assertNotNull(wsrpXMLLocation);
- Object o = unmarshaller.unmarshal(wsrpXMLLocation.openStream(), factory, null);
- assertNotNull(o);
- assertTrue(o instanceof ProducerConfiguration);
- ProducerRegistrationRequirements requirements = ((ProducerConfiguration)o).getRegistrationRequirements();
+ ProducerConfiguration producerConfiguration = getProducerConfiguration("minimal.xml");
+ ProducerRegistrationRequirements requirements = producerConfiguration.getRegistrationRequirements();
assertNotNull(requirements);
assertTrue(requirements.requiresRegistration());
assertTrue(!requirements.fullServiceDescriptionRequiresRegistration());
@@ -91,6 +94,39 @@
assertTrue(properties.isEmpty());
}
+ public void testInvalidProducerConfiguration() throws Exception
+ {
+ try
+ {
+ getProducerConfiguration("invalid1.xml");
+ fail("Invalid value for fullServiceDescriptionRequiresRegistration should have caused failure");
+ }
+ catch (Exception expected)
+ {
+ }
+
+ try
+ {
+ getProducerConfiguration("invalid2.xml");
+ fail("Only one registration-configuration element allowed!");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ private ProducerConfiguration getProducerConfiguration(String fileName)
+ throws JBossXBException, IOException
+ {
+ URL location = Thread.currentThread().getContextClassLoader().getResource(fileName);
+ assertNotNull(location);
+
+ Object o = unmarshaller.unmarshal(location.openStream(), factory, null);
+ assertNotNull(o);
+ assertTrue(o instanceof ProducerConfiguration);
+ return (ProducerConfiguration)o;
+ }
+
private void checkRegistrationProperty(ProducerRegistrationRequirements requirements, int index)
{
RegistrationPropertyDescription desc = requirements.getRegistrationPropertyWith("name" + index);
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2007-02-06 00:12:05 UTC (rev 6170)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2007-02-06 04:14:55 UTC (rev 6171)
@@ -75,8 +75,8 @@
import org.jboss.portal.wsrp.core.UnsupportedModeFault;
import org.jboss.portal.wsrp.core.UnsupportedWindowStateFault;
import org.jboss.portal.wsrp.producer.config.ProducerConfiguration;
+import org.jboss.portal.wsrp.producer.config.ProducerConfigurationService;
import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
-import org.jboss.portal.wsrp.producer.config.impl.ProducerRegistrationRequirementsImpl;
import java.rmi.RemoteException;
import java.util.HashSet;
@@ -114,9 +114,6 @@
/** Registration Manager */
private RegistrationManager registrationManager;
- private static final ProducerRegistrationRequirements DEFAULT_REGISTRATION_REQUIREMENTS =
- new ProducerRegistrationRequirementsImpl(false, false, false);
-
private int sessionExpirationTime = DEFAULT_SESSION_EXPIRATION_TIME;
private CookieProtocol requiresInitCookie = CookieProtocol.none;
@@ -124,6 +121,8 @@
/** Supported locales. */
private String[] supportedLocales = new String[]{"en", "en-US"};
+ private ProducerConfigurationService configurationService;
+
public WSRPProducerImpl()
{
markupHandler = new MarkupHandler(this);
@@ -134,14 +133,7 @@
public ProducerRegistrationRequirements getProducerRegistrationRequirements()
{
- ProducerRegistrationRequirements registrationRequirements = DEFAULT_REGISTRATION_REQUIREMENTS;
- if (producerConfiguration != null)
- {
- registrationRequirements = producerConfiguration.getRegistrationRequirements();
- }
-
- // still need to check for null, in case there wasn't any registration info in the descriptor
- return registrationRequirements != null ? registrationRequirements : DEFAULT_REGISTRATION_REQUIREMENTS;
+ return producerConfiguration.getRegistrationRequirements();
}
// ServiceDescription implementation ********************************************************************************
@@ -264,10 +256,23 @@
this.registrationManager = registrationManager;
}
+ public void setProducerConfigurationService(ProducerConfigurationService configurationService)
+ {
+ this.configurationService = configurationService;
+ }
+
+ public ProducerConfigurationService getConfigurationService()
+ {
+ return configurationService;
+ }
+
protected void startService() throws Exception
{
super.startService();
- getProducerRegistrationRequirements().addRegistrationPropertyChangeListeners(registrationManager);
+ producerConfiguration = configurationService.getConfiguration();
+ ProducerRegistrationRequirements registrationRequirements = getProducerRegistrationRequirements();
+ registrationManager.setPolicy(registrationRequirements.getPolicy());
+ registrationRequirements.addRegistrationPropertyChangeListeners(registrationManager);
}
protected void stopService() throws Exception
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationFactory.java 2007-02-06 00:12:05 UTC (rev 6170)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationFactory.java 2007-02-06 04:14:55 UTC (rev 6171)
@@ -46,6 +46,7 @@
{
private static final String REGISTRATION_CONFIG = "registration-configuration";
private static final boolean DEBUG = false;
+ private boolean registrationDone = false;
public Object newRoot(Object root, UnmarshallingContext nav, String nsURI, String localName, Attributes attrs)
{
@@ -70,6 +71,12 @@
if (REGISTRATION_CONFIG.equals(localName))
{
+ // check that we don't have several registration-configuration elements.
+ if (registrationDone)
+ {
+ throw new IllegalArgumentException("Only one registration-configuration element can be defined!");
+ }
+
ProducerRegistrationRequirements registrationRequirements = new ProducerRegistrationRequirementsImpl();
registrationRequirements.setRequiresRegistration(true);
String descRequiresRegistration = attrs.getValue("fullServiceDescriptionRequiresRegistration");
@@ -77,6 +84,15 @@
{
registrationRequirements.setFullServiceDescriptionRequiresRegistration(true);
}
+ else if (descRequiresRegistration == null || "false".equals(descRequiresRegistration))
+ {
+ registrationRequirements.setFullServiceDescriptionRequiresRegistration(false);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Invalid value for fullServiceDescriptionRequiresRegistration attribute. Acceptable values are: true, false.");
+ }
+ registrationDone = true;
return registrationRequirements;
}
return null;
@@ -105,6 +121,23 @@
}
}
+ public Object setValue(ProducerRegistrationRequirementsImpl regReq, UnmarshallingContext nav, String nsURI,
+ String localName, String value)
+ {
+ if ("registration-policy".equals(localName))
+ {
+ value = StringPropertyReplacer.replaceProperties(value);
+ regReq.setPolicyClassName(value);
+ }
+ else if ("registration-property-validator".equals(localName))
+ {
+ value = StringPropertyReplacer.replaceProperties(value);
+ regReq.setValidatorClassName(value);
+ }
+
+ return null;
+ }
+
public void setValue(RegistrationPropertyDescription desc, UnmarshallingContext nav, String nsURI,
String localName, String value)
{
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationService.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationService.java 2007-02-06 00:12:05 UTC (rev 6170)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationService.java 2007-02-06 04:14:55 UTC (rev 6171)
@@ -23,73 +23,12 @@
package org.jboss.portal.wsrp.producer.config;
-import org.jboss.portal.common.util.URLTools;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.wsrp.WSRPProducer;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-
-import java.net.URL;
-import java.util.Enumeration;
-
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
* @since 2.6
*/
-public class ProducerConfigurationService extends AbstractJBossService
+public interface ProducerConfigurationService
{
- private String configLocation;
- private WSRPProducer producer;
-
- public String getConfigLocation()
- {
- return configLocation;
- }
-
- public void setConfigLocation(String configLocation)
- {
- this.configLocation = configLocation;
- }
-
- public WSRPProducer getProducer()
- {
- return producer;
- }
-
- public void setProducer(WSRPProducer producer)
- {
- this.producer = producer;
- }
-
- protected void startService() throws Exception
- {
- // Setup URLs
- if (configLocation == null)
- {
- throw new Exception("The config location is null");
- }
-
- // make sure we pick the furthest down the path in case there's several similarly named resources in the path
- Enumeration resources = Thread.currentThread().getContextClassLoader().getResources(configLocation);
- URL configURL = null;
- while (resources.hasMoreElements())
- {
- configURL = (URL)resources.nextElement();
- }
-
- if (configURL == null)
- {
- throw new Exception("The config " + configLocation + " does not exist");
- }
- if (!URLTools.exists(configURL))
- {
- throw new Exception("The config " + configURL + " does not exist");
- }
-
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- ObjectModelFactory factory = new ProducerConfigurationFactory();
- producer.setProducerConfiguration((ProducerConfiguration)unmarshaller.unmarshal(configURL.openStream(), factory, null));
- }
+ public ProducerConfiguration getConfiguration();
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerRegistrationRequirements.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerRegistrationRequirements.java 2007-02-06 00:12:05 UTC (rev 6170)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerRegistrationRequirements.java 2007-02-06 04:14:55 UTC (rev 6171)
@@ -23,6 +23,7 @@
package org.jboss.portal.wsrp.producer.config;
+import org.jboss.portal.registration.RegistrationPolicy;
import org.jboss.portal.registration.RegistrationPropertyChangeListener;
import org.jboss.portal.wsrp.registration.RegistrationPropertyDescription;
@@ -70,4 +71,7 @@
void removeRegistrationPropertyChangeListener(RegistrationPropertyChangeListener listener);
+ void setPolicy(RegistrationPolicy policy);
+
+ RegistrationPolicy getPolicy();
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationImpl.java 2007-02-06 00:12:05 UTC (rev 6170)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationImpl.java 2007-02-06 04:14:55 UTC (rev 6171)
@@ -34,6 +34,8 @@
public class ProducerConfigurationImpl implements ProducerConfiguration
{
private ProducerRegistrationRequirements requirements;
+ private static final ProducerRegistrationRequirements DEFAULT_REGISTRATION_REQUIREMENTS =
+ new ProducerRegistrationRequirementsImpl(false, false, false);
public ProducerRegistrationRequirements getRegistrationRequirements()
{
@@ -42,6 +44,11 @@
public void setRegistrationRequirements(ProducerRegistrationRequirements requirements)
{
+ if (requirements == null)
+ {
+ requirements = DEFAULT_REGISTRATION_REQUIREMENTS;
+ }
+
this.requirements = requirements;
}
}
Added: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationServiceImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationServiceImpl.java (rev 0)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationServiceImpl.java 2007-02-06 04:14:55 UTC (rev 6171)
@@ -0,0 +1,93 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2007, 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.wsrp.producer.config.impl;
+
+import org.jboss.portal.common.util.URLTools;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.wsrp.producer.config.ProducerConfiguration;
+import org.jboss.portal.wsrp.producer.config.ProducerConfigurationFactory;
+import org.jboss.portal.wsrp.producer.config.ProducerConfigurationService;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+
+import java.net.URL;
+import java.util.Enumeration;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class ProducerConfigurationServiceImpl extends AbstractJBossService implements ProducerConfigurationService
+{
+ private String configLocation;
+ private ProducerConfiguration configuration;
+
+ public String getConfigLocation()
+ {
+ return configLocation;
+ }
+
+ public void setConfigLocation(String configLocation)
+ {
+ this.configLocation = configLocation;
+ }
+
+
+ public ProducerConfiguration getConfiguration()
+ {
+ return configuration;
+ }
+
+ protected void startService() throws Exception
+ {
+ // Setup URLs
+ if (configLocation == null)
+ {
+ throw new Exception("The config location is null");
+ }
+
+ // make sure we pick the furthest down the path in case there's several similarly named resources in the path
+ Enumeration resources = Thread.currentThread().getContextClassLoader().getResources(configLocation);
+ URL configURL = null;
+ while (resources.hasMoreElements())
+ {
+ configURL = (URL)resources.nextElement();
+ }
+
+ if (configURL == null)
+ {
+ throw new Exception("The config " + configLocation + " does not exist");
+ }
+ if (!URLTools.exists(configURL))
+ {
+ throw new Exception("The config " + configURL + " does not exist");
+ }
+
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ ObjectModelFactory factory = new ProducerConfigurationFactory();
+ configuration = (ProducerConfiguration)unmarshaller.unmarshal(configURL.openStream(), factory, null);
+ }
+}
Property changes on: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationServiceImpl.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java 2007-02-06 00:12:05 UTC (rev 6170)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java 2007-02-06 04:14:55 UTC (rev 6171)
@@ -24,7 +24,10 @@
package org.jboss.portal.wsrp.producer.config.impl;
import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.registration.RegistrationPolicy;
import org.jboss.portal.registration.RegistrationPropertyChangeListener;
+import org.jboss.portal.registration.policies.DefaultRegistrationPolicy;
+import org.jboss.portal.registration.policies.RegistrationPropertyValidator;
import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
import org.jboss.portal.wsrp.registration.RegistrationPropertyDescription;
@@ -46,6 +49,9 @@
private boolean requiresRegistration;
private boolean fullServiceDescriptionRequiresRegistration;
private transient Set listeners = new HashSet(3);
+ private RegistrationPolicy policy;
+ private String policyClassName;
+ private String validatorClassName;
/** property name (QName) -> PropertyDescription */
private Map registrationProperties;
@@ -174,4 +180,90 @@
ParameterValidation.throwIllegalArgExceptionIfNull(listener, "RegistrationPropertyChangeListener");
listeners.remove(listener);
}
+
+ public void setPolicy(RegistrationPolicy policy)
+ {
+ this.policy = policy;
+
+ if (policy != null)
+ {
+ policyClassName = policy.getClass().getName();
+ }
+ }
+
+
+ public RegistrationPolicy getPolicy()
+ {
+ if (policy == null)
+ {
+ if (policyClassName != null)
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Class policyClass = loader.loadClass(policyClassName);
+ Class expectedInterface = loader.loadClass("org.jboss.portal.registration.RegistrationPolicy");
+ if (!expectedInterface.isAssignableFrom(policyClass))
+ {
+ throw new IllegalArgumentException("Policy class does not implement RegistrationPolicy!");
+ }
+ RegistrationPolicy policy = (RegistrationPolicy)policyClass.newInstance();
+ setPolicy(policy);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new IllegalArgumentException("Couldn't find policy class " + policyClassName + ".", e);
+ }
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException("Couldn't instantiate policy class.", e);
+ }
+ }
+ else
+ {
+ if (validatorClassName == null)
+ {
+ throw new IllegalArgumentException("No RegistrationPolicy was defined, was thus expecting a registration " +
+ "property validator to assign to DefaultRegistrationPolicy!");
+ }
+
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ RegistrationPropertyValidator validator;
+ try
+ {
+ Class validatorClass = loader.loadClass(validatorClassName);
+ Class expectedInterface = loader.loadClass("org.jboss.portal.registration.policies.RegistrationPropertyValidator");
+ if (!expectedInterface.isAssignableFrom(validatorClass))
+ {
+ throw new IllegalArgumentException("Validator class does not implement RegistrationPropertyValidator!");
+ }
+ validator = (RegistrationPropertyValidator)validatorClass.newInstance();
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new IllegalArgumentException("Couldn't find validator class " + validatorClassName + ".", e);
+ }
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException("Couldn't instantiate validator class.", e);
+ }
+
+ policy = new DefaultRegistrationPolicy();
+ ((DefaultRegistrationPolicy)policy).setValidator(validator);
+ }
+ }
+
+ return policy;
+ }
+
+
+ public void setPolicyClassName(String policyClassName)
+ {
+ this.policyClassName = policyClassName;
+ }
+
+ public void setValidatorClassName(String validatorClassName)
+ {
+ this.validatorClassName = validatorClassName;
+ }
}
Modified: trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2007-02-06 00:12:05 UTC (rev 6170)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2007-02-06 04:14:55 UTC (rev 6171)
@@ -80,6 +80,7 @@
<depends optional-attribute-name="Invoker"
proxy-type="attribute">portal:service=PortletInvoker,type=WSRPProducer</depends>
<depends optional-attribute-name="RegistrationManager" proxy-type="attribute">portal.wsrp:service=RegistrationManager</depends>
+ <depends optional-attribute-name="ProducerConfigurationService" proxy-type="attribute">portal.wsrp:service=ProducerConfiguration</depends>
</mbean>
<!-- Registration manager -->
@@ -87,7 +88,6 @@
name="portal.wsrp:service=RegistrationManager" xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends optional-attribute-name="Policy" proxy-type="attribute">portal.wsrp:service=RegistrationPolicy</depends>
<depends optional-attribute-name="PersistenceManager" proxy-type="attribute">portal.wsrp:service=PersistenceManager</depends>
</mbean>
@@ -106,12 +106,11 @@
</mbean>
<!-- Producer configuration service -->
- <mbean code="org.jboss.portal.wsrp.producer.config.ProducerConfigurationService"
+ <mbean code="org.jboss.portal.wsrp.producer.config.impl.ProducerConfigurationServiceImpl"
name="portal.wsrp:service=ProducerConfiguration" xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <attribute name="ConfigLocation">conf/config.xml</attribute>
- <depends optional-attribute-name="Producer" proxy-type="attribute">portal.wsrp:service=WSRPProducer</depends>
+ <attribute name="ConfigLocation">conf/config.xml</attribute>
</mbean>
<!-- Configure a consumer that is the portal itself -->
Modified: trunk/wsrp/src/resources/portal-wsrp-sar/conf/config.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/conf/config.xml 2007-02-06 00:12:05 UTC (rev 6170)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/conf/config.xml 2007-02-06 04:14:55 UTC (rev 6171)
@@ -22,6 +22,8 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<producer-configuration>
- <registration-configuration fullServiceDescriptionRequiresRegistration="true"/>
+ <registration-configuration fullServiceDescriptionRequiresRegistration="true">
+ <registration-property-validator>org.jboss.portal.registration.policies.DefaultRegistrationPropertyValidator</registration-property-validator>
+ </registration-configuration>
</producer-configuration>
Modified: trunk/wsrp/src/resources/tests/test-producer-configuration-lib-jar/extended.xml
===================================================================
--- trunk/wsrp/src/resources/tests/test-producer-configuration-lib-jar/extended.xml 2007-02-06 00:12:05 UTC (rev 6170)
+++ trunk/wsrp/src/resources/tests/test-producer-configuration-lib-jar/extended.xml 2007-02-06 04:14:55 UTC (rev 6171)
@@ -23,6 +23,7 @@
<producer-configuration>
<registration-configuration fullServiceDescriptionRequiresRegistration="true">
+ <registration-property-validator>org.jboss.portal.registration.policies.DefaultRegistrationPropertyValidator</registration-property-validator>
<registration-property-description>
<name>name1</name>
<type>xsd:string</type>
Added: trunk/wsrp/src/resources/tests/test-producer-configuration-lib-jar/invalid1.xml
===================================================================
--- trunk/wsrp/src/resources/tests/test-producer-configuration-lib-jar/invalid1.xml (rev 0)
+++ trunk/wsrp/src/resources/tests/test-producer-configuration-lib-jar/invalid1.xml 2007-02-06 04:14:55 UTC (rev 6171)
@@ -0,0 +1,27 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<producer-configuration>
+ <registration-configuration fullServiceDescriptionRequiresRegistration="invalid"/>
+</producer-configuration>
+
Added: trunk/wsrp/src/resources/tests/test-producer-configuration-lib-jar/invalid2.xml
===================================================================
--- trunk/wsrp/src/resources/tests/test-producer-configuration-lib-jar/invalid2.xml (rev 0)
+++ trunk/wsrp/src/resources/tests/test-producer-configuration-lib-jar/invalid2.xml 2007-02-06 04:14:55 UTC (rev 6171)
@@ -0,0 +1,28 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<producer-configuration>
+ <registration-configuration/>
+ <registration-configuration/>
+</producer-configuration>
+
19 years, 2 months
JBoss Portal SVN: r6170 - trunk/build/ide/intellij/idea60/modules/cms.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-05 19:12:05 -0500 (Mon, 05 Feb 2007)
New Revision: 6170
Modified:
trunk/build/ide/intellij/idea60/modules/cms/cms.iml
Log:
update jackrabbit lib in cms project def
Modified: trunk/build/ide/intellij/idea60/modules/cms/cms.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/cms/cms.iml 2007-02-06 00:09:08 UTC (rev 6169)
+++ trunk/build/ide/intellij/idea60/modules/cms/cms.iml 2007-02-06 00:12:05 UTC (rev 6170)
@@ -52,15 +52,6 @@
<orderEntry type="module-library">
<library>
<CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/jackrabbit/lib/jackrabbit-core-1.0.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
<root url="jar://$MODULE_DIR$/../../../../../../thirdparty/jcr/lib/jcr-1.0.jar!/" />
</CLASSES>
<JAVADOC />
@@ -170,6 +161,15 @@
</orderEntry>
<orderEntry type="module" module-name="identity" />
<orderEntry type="module" module-name="workflow" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/jackrabbit/lib/jackrabbit-core.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
19 years, 2 months
JBoss Portal SVN: r6169 - in trunk: cms/src/main/org/jboss/portal/cms/hibernate/state and 4 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-05 19:09:08 -0500 (Mon, 05 Feb 2007)
New Revision: 6169
Modified:
trunk/cms/build.xml
trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/HibernatePersistenceManager.java
trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java
trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/Tools.java
trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java
trunk/cms/src/main/org/jboss/portal/test/cms/JackrabbitTestCase.java
trunk/cms/src/main/org/jboss/portal/test/cms/TestRepositoryBootStrap.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java
trunk/cms/src/resources/test/jcr/repository.xml
trunk/core/build.xml
Log:
attempt to make CMS test run for the db matrix (it works on my machine with two DB). Issue is related to static services like JBossCachePM or HibernatePM, needs to be more corrected
Modified: trunk/cms/build.xml
===================================================================
--- trunk/cms/build.xml 2007-02-05 20:55:30 UTC (rev 6168)
+++ trunk/cms/build.xml 2007-02-06 00:09:08 UTC (rev 6169)
@@ -376,7 +376,15 @@
</target>
<target name="tests" depends="init">
<execute-tests>
- <x-test>
+ <x-sysproperty>
+
+<!--
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>
+-->
+
+ </x-sysproperty>
+ <x-test>
<!-- general cms setup related tests -->
<test todir="${test.reports}" name="org.jboss.portal.test.cms.JackrabbitTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.TestRepositoryBootStrap"/>
@@ -400,7 +408,7 @@
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderDelete"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderGet"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderUpdate"/>
-
+
<!-- cms fine grained security related tests -->
<!--test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestSecureFileGet"/-->
</x-test>
Modified: trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/HibernatePersistenceManager.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/HibernatePersistenceManager.java 2007-02-05 20:55:30 UTC (rev 6168)
+++ trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/HibernatePersistenceManager.java 2007-02-06 00:09:08 UTC (rev 6169)
@@ -201,6 +201,8 @@
throw new IllegalStateException("not initialized");
}
+ org.jboss.portal.cms.hibernate.state.Tools.destroy();
+
try
{
if (externalBLOBs)
Modified: trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java 2007-02-05 20:55:30 UTC (rev 6168)
+++ trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java 2007-02-06 00:09:08 UTC (rev 6169)
@@ -111,6 +111,7 @@
*
*/
private static TreeCacheMBean pmCache = null;
+ private static boolean createdByMe;
private static boolean preloaded = false;
/** Creates a new <code>SimpleDbPersistenceManager</code> instance. */
@@ -201,16 +202,20 @@
Tools.init(this.jndiName);
if (JBossCachePersistenceManager.pmCache == null)
{
- try
- {
- MBeanServer server = MBeanServerLocator.locateJBoss();
- JBossCachePersistenceManager.pmCache = (TreeCacheMBean)MBeanProxyExt.create(TreeCacheMBean.class, "cms.pm.cache:service=TreeCache", server);
- }
- catch (Exception e)
- {
- JBossCachePersistenceManager.pmCache = null;
- }
+ // julien : removed that, it should be deployed by the portal-cms.sar properly
+
+// try
+// {
+// MBeanServer server = MBeanServerLocator.locateJBoss();
+// JBossCachePersistenceManager.pmCache = (TreeCacheMBean)MBeanProxyExt.create(TreeCacheMBean.class, "cms.pm.cache:service=TreeCache", server);
+// }
+// catch (Exception e)
+// {
+// }
+ // For now we always create the cache, we could try a JMX lookup commented above because not properly done
+ pmCache = null;
+
//try to load from specified configuration if any
//if nothing found in the environment...chances are running in a non-managed environment
if (JBossCachePersistenceManager.pmCache == null)
@@ -219,6 +224,7 @@
try
{
JBossCachePersistenceManager.pmCache = new TreeCache();
+ createdByMe = true;
//configure the cache
PropertyConfigurator configurator = new PropertyConfigurator();
@@ -1167,6 +1173,14 @@
throw new IllegalStateException("not initialized");
}
+ // We created it, we destroy it
+ if (createdByMe && pmCache != null)
+ {
+ TreeCacheMBean cache = pmCache;
+ pmCache = null;
+ cache.destroy();
+ }
+
try
{
if (externalBLOBs)
Modified: trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/Tools.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/Tools.java 2007-02-05 20:55:30 UTC (rev 6168)
+++ trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/Tools.java 2007-02-06 00:09:08 UTC (rev 6169)
@@ -34,7 +34,9 @@
import javax.naming.InitialContext;
-/*
+/**
+ * Static state is evil.
+ *
* Created on Aug 29, 2006
*
* A Tool for performing some Hibernate related utilities. This is designed to work in both managed as well as non-managed environments
@@ -50,6 +52,11 @@
private static Configuration cfg = null;
private static boolean autoClose = false;
+ public static void destroy()
+ {
+ sessionFactory = null;
+ }
+
/**
*
*
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java 2007-02-05 20:55:30 UTC (rev 6168)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java 2007-02-06 00:09:08 UTC (rev 6169)
@@ -43,10 +43,10 @@
{
/** . */
- private DataSourceSupport.Config dataSourceConfigParameter;
+ protected DataSourceSupport.Config dataSourceConfigParameter;
/** . */
- private TestRuntimeContext runtimeContext;
+ protected TestRuntimeContext runtimeContext;
public AbstractCMSTestCase()
{
@@ -71,7 +71,7 @@
runtimeContext.start();
}
- protected void tearDown() throws Exception
+ public void tearDown() throws Exception
{
runtimeContext.stop();
}
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/JackrabbitTestCase.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/JackrabbitTestCase.java 2007-02-05 20:55:30 UTC (rev 6168)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/JackrabbitTestCase.java 2007-02-06 00:09:08 UTC (rev 6169)
@@ -66,7 +66,7 @@
jcr.start();
}
- protected void tearDown() throws Exception
+ public void tearDown() throws Exception
{
jcr.stop();
jcr = null;
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/TestRepositoryBootStrap.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/TestRepositoryBootStrap.java 2007-02-05 20:55:30 UTC (rev 6168)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/TestRepositoryBootStrap.java 2007-02-06 00:09:08 UTC (rev 6169)
@@ -63,7 +63,7 @@
service.start();
}
- protected void tearDown() throws Exception
+ public void tearDown() throws Exception
{
service.stop();
}
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java 2007-02-05 20:55:30 UTC (rev 6168)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java 2007-02-06 00:09:08 UTC (rev 6169)
@@ -65,7 +65,7 @@
service.setConfig(config.getDocumentElement());
service.setRepositoryName("repo");
- service.setHomeDir("repotest");
+ service.setHomeDir("repotest-" + dataSourceConfigParameter.getName());
service.startService();
}
Modified: trunk/cms/src/resources/test/jcr/repository.xml
===================================================================
--- trunk/cms/src/resources/test/jcr/repository.xml 2007-02-05 20:55:30 UTC (rev 6168)
+++ trunk/cms/src/resources/test/jcr/repository.xml 2007-02-06 00:09:08 UTC (rev 6169)
@@ -66,7 +66,7 @@
-->
<!-- HibernatePersistentManager: uses RDBMS + Hibernate for storage -->
- <PersistenceManager class="org.jboss.portal.cms.hibernate.state.JBossCachePersistenceManager">
+ <PersistenceManager class="org.jboss.portal.cms.hibernate.state.HibernatePersistenceManager">
<param name="schemaObjectPrefix" value="WSP"/>
<param name="JNDIName" value="java:/SessionFactory"/>
<param name="externalBLOBs" value="false"/>
@@ -113,7 +113,7 @@
-->
<!-- HibernatePersistentManager: uses RDBMS + Hibernate for storage -->
- <PersistenceManager class="org.jboss.portal.cms.hibernate.state.JBossCachePersistenceManager">
+ <PersistenceManager class="org.jboss.portal.cms.hibernate.state.HibernatePersistenceManager">
<param name="schemaObjectPrefix" value="Version"/>
<param name="JNDIName" value="java:/SessionFactory"/>
<param name="externalBLOBs" value="false"/>
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-02-05 20:55:30 UTC (rev 6168)
+++ trunk/core/build.xml 2007-02-06 00:09:08 UTC (rev 6169)
@@ -535,10 +535,8 @@
<execute-tests>
<x-sysproperty>
-<!--
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>
--->
<sysproperty
key="jboss.aop.path"
19 years, 2 months
JBoss Portal SVN: r6167 - trunk/core/src/resources.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-05 15:54:10 -0500 (Mon, 05 Feb 2007)
New Revision: 6167
Removed:
trunk/core/src/resources/portal-cms-sar/
Log:
remove empty dirs
19 years, 2 months
JBoss Portal SVN: r6165 - in trunk: core/src/main/org/jboss/portal/core/deployment/jboss and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-05 15:51:11 -0500 (Mon, 05 Feb 2007)
New Revision: 6165
Removed:
trunk/common/src/main/org/jboss/portal/common/metadata/MetaData.java
Modified:
trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeployment.java
trunk/core/src/main/org/jboss/portal/core/model/instance/metadata/InstanceMetaData.java
trunk/core/src/main/org/jboss/portal/core/model/portal/metadata/PortalObjectMetaData.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/metadata/ModesMetaData.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/metadata/WindowStatesMetaData.java
Log:
remove useless interface
Deleted: trunk/common/src/main/org/jboss/portal/common/metadata/MetaData.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/metadata/MetaData.java 2007-02-05 20:43:32 UTC (rev 6164)
+++ trunk/common/src/main/org/jboss/portal/common/metadata/MetaData.java 2007-02-05 20:51:11 UTC (rev 6165)
@@ -1,31 +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.common.metadata;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public interface MetaData
-{
-}
Modified: trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeployment.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeployment.java 2007-02-05 20:43:32 UTC (rev 6164)
+++ trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeployment.java 2007-02-05 20:51:11 UTC (rev 6165)
@@ -24,7 +24,6 @@
import org.jboss.deployment.DeploymentException;
import org.jboss.logging.Logger;
-import org.jboss.portal.common.metadata.MetaData;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.util.XML;
import org.jboss.portal.common.xml.NullEntityResolver;
@@ -153,7 +152,7 @@
}
// The object to create
- MetaData metaData = null;
+ Object metaData = null;
//
Element metaDataElt = XML.getUniqueChild(deploymentElt, "portal", false);
@@ -277,7 +276,7 @@
protected PortalObjectId parentRef;
/** Meta data of the deployed portal object. */
- protected MetaData metaData;
+ protected Object metaData;
/** The handle of the deployed object if not null. */
protected PortalObjectId ref;
Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/metadata/InstanceMetaData.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/metadata/InstanceMetaData.java 2007-02-05 20:43:32 UTC (rev 6164)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/metadata/InstanceMetaData.java 2007-02-05 20:51:11 UTC (rev 6165)
@@ -23,7 +23,6 @@
package org.jboss.portal.core.model.instance.metadata;
import org.apache.log4j.Logger;
-import org.jboss.portal.common.metadata.MetaData;
import org.jboss.portal.common.util.XML;
import org.jboss.portal.portlet.impl.jsr168.metadata.PreferenceMetaData;
import org.jboss.portal.security.metadata.SecurityConstraintsMetaData;
@@ -40,7 +39,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class InstanceMetaData implements MetaData
+public class InstanceMetaData
{
/** The logger. */
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/metadata/PortalObjectMetaData.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/metadata/PortalObjectMetaData.java 2007-02-05 20:43:32 UTC (rev 6164)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/metadata/PortalObjectMetaData.java 2007-02-05 20:51:11 UTC (rev 6165)
@@ -23,7 +23,6 @@
package org.jboss.portal.core.model.portal.metadata;
import org.jboss.logging.Logger;
-import org.jboss.portal.common.metadata.MetaData;
import org.jboss.portal.common.util.XML;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
@@ -46,7 +45,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public abstract class PortalObjectMetaData implements MetaData
+public abstract class PortalObjectMetaData
{
private static Logger log = Logger.getLogger(PortalObjectMetaData.class);
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/metadata/ModesMetaData.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/metadata/ModesMetaData.java 2007-02-05 20:43:32 UTC (rev 6164)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/metadata/ModesMetaData.java 2007-02-05 20:51:11 UTC (rev 6165)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.metadata;
-import org.jboss.portal.common.metadata.MetaData;
-
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
@@ -32,7 +30,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class ModesMetaData implements MetaData
+public class ModesMetaData
{
/** The modes as strings. */
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/metadata/WindowStatesMetaData.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/metadata/WindowStatesMetaData.java 2007-02-05 20:43:32 UTC (rev 6164)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/metadata/WindowStatesMetaData.java 2007-02-05 20:51:11 UTC (rev 6165)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.metadata;
-import org.jboss.portal.common.metadata.MetaData;
-
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
@@ -32,7 +30,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class WindowStatesMetaData implements MetaData
+public class WindowStatesMetaData
{
/** The modes as strings. */
19 years, 2 months
JBoss Portal SVN: r6164 - trunk/core/src/resources/portal-core-war/WEB-INF.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-05 15:43:32 -0500 (Mon, 05 Feb 2007)
New Revision: 6164
Modified:
trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
Log:
introducer plugable content renderer for the content framework
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2007-02-05 20:38:32 UTC (rev 6163)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2007-02-05 20:43:32 UTC (rev 6164)
@@ -137,6 +137,6 @@
<service>
<service-name>ContentEditorRegistry</service-name>
<service-class>org.jboss.portal.core.portlet.dashboard.ContentEditorRegistry</service-class>
- <service-ref>:registry=ContentEditor</service-ref>
+ <service-ref>:service=ContentEditorRegistry</service-ref>
</service>
</portlet-app>
19 years, 2 months