JBoss Portal SVN: r6365 - trunk/portlet/src/main/org/jboss/portal/portlet/container.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-21 13:23:06 -0500 (Wed, 21 Feb 2007)
New Revision: 6365
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java
Log:
- Reverted mistakenly committed file.
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java 2007-02-21 17:52:02 UTC (rev 6364)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java 2007-02-21 18:23:06 UTC (rev 6365)
@@ -50,14 +50,12 @@
import org.jboss.portal.portlet.invocation.response.SecurityErrorResponse;
import org.jboss.portal.portlet.invocation.response.UnavailableResponse;
import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
-import org.jboss.portal.portlet.state.producer.PortletStateChangeRequiredException;
import javax.portlet.Portlet;
import javax.portlet.PortletConfig;
import javax.portlet.PortletException;
import javax.portlet.PortletSecurityException;
import javax.portlet.PreferencesValidator;
-import javax.portlet.ReadOnlyException;
import javax.portlet.UnavailableException;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
@@ -434,10 +432,6 @@
//
return new ErrorResponse(e);
}
- catch (ReadOnlyException e)
- {
- throw new PortletStateChangeRequiredException(e.getLocalizedMessage());
- }
catch (Exception e)
{
log.error("The portlet threw an exception", e);
19 years, 2 months
JBoss Portal SVN: r6364 - in trunk: wsrp/src/main/org/jboss/portal/test/wsrp/other and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-21 12:52:02 -0500 (Wed, 21 Feb 2007)
New Revision: 6364
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/UserContextConverterTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/UserContextConverter.java
Log:
- Removed unused constant.
- Changed @since as this will be backported to 2.4 branch.
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java 2007-02-21 15:31:49 UTC (rev 6363)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java 2007-02-21 17:52:02 UTC (rev 6364)
@@ -50,12 +50,14 @@
import org.jboss.portal.portlet.invocation.response.SecurityErrorResponse;
import org.jboss.portal.portlet.invocation.response.UnavailableResponse;
import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
+import org.jboss.portal.portlet.state.producer.PortletStateChangeRequiredException;
import javax.portlet.Portlet;
import javax.portlet.PortletConfig;
import javax.portlet.PortletException;
import javax.portlet.PortletSecurityException;
import javax.portlet.PreferencesValidator;
+import javax.portlet.ReadOnlyException;
import javax.portlet.UnavailableException;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
@@ -362,7 +364,7 @@
public String toString()
{
- return "PortletContainer[name=" + getId() + ",+application=" + application.getId() + "]";
+ return "PortletContainer[name=" + getId() + ",+application=" + application.getId() + "]";
}
/** Initialize the portlet. */
@@ -432,6 +434,10 @@
//
return new ErrorResponse(e);
}
+ catch (ReadOnlyException e)
+ {
+ throw new PortletStateChangeRequiredException(e.getLocalizedMessage());
+ }
catch (Exception e)
{
log.error("The portlet threw an exception", e);
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/UserContextConverterTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/UserContextConverterTestCase.java 2007-02-21 15:31:49 UTC (rev 6363)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/UserContextConverterTestCase.java 2007-02-21 17:52:02 UTC (rev 6364)
@@ -33,7 +33,7 @@
*
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
- * @since 2.6
+ * @since 2.4
*/
public class UserContextConverterTestCase extends TestCase
{
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/UserContextConverter.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/UserContextConverter.java 2007-02-21 15:31:49 UTC (rev 6363)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/UserContextConverter.java 2007-02-21 17:52:02 UTC (rev 6364)
@@ -51,8 +51,6 @@
*/
public class UserContextConverter
{
- public static final String XSD_DATETIME_FORMAT = "yyy-MM-dd'T'HH:mm:ss.SSSZ";
-
public static UserContext createPortalUserContextFrom(org.jboss.portal.wsrp.core.UserContext userContext,
String[] desiredLocales, String preferredLocale)
{
19 years, 2 months
JBoss Portal SVN: r6363 - in branches/JBoss_Portal_Branch_2_4: common/src/main/org/jboss/portal/common and 3 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-02-21 10:31:49 -0500 (Wed, 21 Feb 2007)
New Revision: 6363
Removed:
branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/test/
Modified:
branches/JBoss_Portal_Branch_2_4/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml
branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/Tools.java
branches/JBoss_Portal_Branch_2_4/test/src/etc/datasources.xml
branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/HibernateSupport.java
Log:
Rollback changes of the day.
Modified: branches/JBoss_Portal_Branch_2_4/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_4/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml 2007-02-21 13:55:54 UTC (rev 6362)
+++ branches/JBoss_Portal_Branch_2_4/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml 2007-02-21 15:31:49 UTC (rev 6363)
@@ -34,13 +34,6 @@
</constructor>
</bean>
- <bean name="HibernateConfig" class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
- <constructor factoryMethod="getBean">
- <factory bean="BeanFactory"/>
- <parameter>HibernateConfig</parameter>
- </constructor>
- </bean>
-
<bean name="JNDISupport" class="org.jboss.portal.test.framework.embedded.JNDISupport">
</bean>
@@ -55,11 +48,13 @@
<property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
<property name="connectionManagerReference"><inject bean="ConnectionManagerSupport"
property="connectionManagerReference"/></property>
- <property name="config"><inject bean="DataSourceConfig"/></property>
+ <property name="driverClass"><inject bean="DataSourceConfig" property="driverClass"/></property>
+ <property name="connectionURL"><inject bean="DataSourceConfig" property="connectionURL"/></property>
+ <property name="userName"><inject bean="DataSourceConfig" property="userName"/></property>
+ <property name="password"><inject bean="DataSourceConfig" property="password"/></property>
</bean>
<bean name="HibernateSupport" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
- <property name="config"><inject bean="HibernateConfig"/></property>
<property name="jNDIName">java:/SessionFactory</property>
<property name="mappings">
<list elementClass="java.lang.String">
@@ -69,7 +64,7 @@
</bean>
<!--
- <bean name="TestBean" class="org.jboss.portal.test.identity.db.DBUserTestCase">
+ <bean name="TestBean" class="org.jboss.portal.test.identity.UserTestCase">
<constructor factoryMethod="getBean">
<factory bean="BeanFactory"/>
<parameter>TestBean</parameter>
Modified: branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/Tools.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/Tools.java 2007-02-21 13:55:54 UTC (rev 6362)
+++ branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/Tools.java 2007-02-21 15:31:49 UTC (rev 6363)
@@ -26,7 +26,6 @@
import org.apache.log4j.Logger;
import org.jboss.portal.common.logging.Log4JWriter;
-import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -786,24 +785,4 @@
ObjectInputStream ois = new ObjectInputStream(bais);
return ois.readObject();
}
-
- public static BufferedInputStream safeBufferedWrapper(InputStream in)
- {
- if (in != null)
- {
- if (in instanceof BufferedInputStream)
- {
- return (BufferedInputStream)in;
- }
- else
- {
- return new BufferedInputStream(in);
- }
- }
- else
- {
- return null;
- }
- }
-
}
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_4/test/src/etc/datasources.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_4/test/src/etc/datasources.xml 2007-02-21 13:55:54 UTC (rev 6362)
+++ branches/JBoss_Portal_Branch_2_4/test/src/etc/datasources.xml 2007-02-21 15:31:49 UTC (rev 6363)
@@ -23,7 +23,7 @@
<datasources>
<datasource>
- <datasource-name>hsqldb</datasource-name>
+ <display-name>hsqldb</display-name>
<connection-url>jdbc:hsqldb:file:test</connection-url>
<driver-class>org.hsqldb.jdbcDriver</driver-class>
<user-name>sa</user-name>
Modified: branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java 2007-02-21 13:55:54 UTC (rev 6362)
+++ branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java 2007-02-21 15:31:49 UTC (rev 6363)
@@ -20,12 +20,10 @@
* 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.test.framework.embedded;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.util.XML;
-import org.jboss.portal.common.test.MultiValuedTestParameterValue;
import org.jboss.resource.adapter.jdbc.local.LocalTxDataSource;
import org.jboss.resource.connectionmanager.CachedConnectionManagerReference;
import org.w3c.dom.Document;
@@ -38,10 +36,8 @@
import java.sql.Connection;
import java.sql.Statement;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Hashtable;
import java.util.Iterator;
-import java.util.List;
/**
* An helper to setup JDNI available objects
@@ -59,7 +55,7 @@
private CachedConnectionManagerReference connectionManagerReference;
//
- private Config config;
+ private Config cfg;
private String jndiName = "java:/DefaultDS";
@@ -68,7 +64,7 @@
public DataSourceSupport(Config cfg)
{
- this.config = cfg;
+ this.cfg = cfg;
}
public DataSourceSupport()
@@ -85,10 +81,10 @@
//
ds = new LocalTxDataSource();
- ds.setConnectionURL(config.getConnectionURL());
- ds.setDriverClass(config.getDriverClass());
- ds.setUserName(config.getUserName());
- ds.setPassword(config.getPassword());
+ ds.setConnectionURL(cfg.getConnectionURL());
+ ds.setDriverClass(cfg.getDriverClass());
+ ds.setUserName(cfg.getUserName());
+ ds.setPassword(cfg.getPassword());
ds.setJndiName(jndiName);
ds.setMaxSize(10);
ds.setMinSize(0);
@@ -103,7 +99,7 @@
public void stop()
{
// Make hsqldb flush its data on the disk
- if ("org.hsqldb.jdbcDriver".equals(config.driverClass))
+ if ("org.hsqldb.jdbcDriver".equals(cfg.driverClass))
{
try
{
@@ -136,16 +132,56 @@
{
}
- public Config getConfig()
+ public String getConnectionURL()
{
- return config;
+ return cfg.connectionURL;
}
- public void setConfig(Config config)
+ public void setConnectionURL(String connectionURL)
{
- this.config = config;
+ this.cfg.connectionURL = connectionURL;
}
+ public String getDriverClass()
+ {
+ return cfg.driverClass;
+ }
+
+ public void setDriverClass(String driverClass)
+ {
+ this.cfg.driverClass = driverClass;
+ }
+
+ public String getUserName()
+ {
+ return cfg.userName;
+ }
+
+ public void setUserName(String userName)
+ {
+ this.cfg.userName = userName;
+ }
+
+ public String getPassword()
+ {
+ return cfg.password;
+ }
+
+ public void setPassword(String password)
+ {
+ this.cfg.password = password;
+ }
+
+ public String getJndiName()
+ {
+ return jndiName;
+ }
+
+ public void setJndiName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
public TransactionManager getTransactionManager()
{
return transactionManager;
@@ -169,40 +205,26 @@
public static class Config
{
- /** . */
- private String name;
-
- /** . */
+ private String displayName;
private String connectionURL;
-
- /** . */
private String driverClass;
-
- /** . */
private String userName;
-
- /** . */
private String password;
- public Config(String name, String connectionURL, String driverClass, String userName, String password)
+ public Config(String displayName, String connectionURL, String driverClass, String userName, String password)
{
- this.name = name;
+ this.displayName = displayName;
this.connectionURL = connectionURL;
this.driverClass = driverClass;
this.userName = userName;
this.password = password;
}
- public Config()
+ public String getDisplayName()
{
-
+ return displayName;
}
- public String getName()
- {
- return name;
- }
-
public String getConnectionURL()
{
return connectionURL;
@@ -225,74 +247,32 @@
public String toString()
{
- return "Datasource[" + name + "]";
+ return "DataSource[" + displayName + "]";
}
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public void setConnectionURL(String connectionURL)
- {
- this.connectionURL = connectionURL;
- }
-
- public void setDriverClass(String driverClass)
- {
- this.driverClass = driverClass;
- }
-
- public void setUserName(String userName)
- {
- this.userName = userName;
- }
-
- public void setPassword(String password)
- {
- this.password = password;
- }
-
- public static MultiValuedTestParameterValue fromXML2(URL url) throws Exception
- {
- Config[] configs = fromXML(url);
- List list = Arrays.asList(configs);
- return new MultiValuedTestParameterValue(list);
- }
-
public static Config[] fromXML(URL url) throws Exception
{
ArrayList configs = new ArrayList();
InputStream in = null;
try
{
- in = Tools.safeBufferedWrapper(url.openStream());
+ in = url.openStream();
Document doc = XML.getDocumentBuilderFactory().newDocumentBuilder().parse(in);
for (Iterator i = XML.getChildrenIterator(doc.getDocumentElement(), "datasource"); i.hasNext();)
{
Element childElt = (Element)i.next();
-
- // Parse the datasource name, taking in account the deprecated display-name element
- Element nameElt = XML.getUniqueChild(childElt, "datasource-name", false);
- if (nameElt == null)
- {
- System.out.println("XML element datasource-name is not present, trying deprecated display-name element instead, you should fix your datasources.xml");
- nameElt = XML.getUniqueChild(childElt, "display-name", true);
- }
-
- // Parse the rest of the configuration
+ Element displayNameURLElt = XML.getUniqueChild(childElt, "display-name", true);
Element connectionURLElt = XML.getUniqueChild(childElt, "connection-url", true);
Element driverClassElt = XML.getUniqueChild(childElt, "driver-class", true);
Element userNameElt = XML.getUniqueChild(childElt, "user-name", true);
Element passwordElt = XML.getUniqueChild(childElt, "password", true);
- String name = XML.asString(nameElt);
+ String displayName = XML.asString(displayNameURLElt);
String connectionURL = XML.asString(connectionURLElt);
String driverClass = XML.asString(driverClassElt);
String userName = XML.asString(userNameElt);
String password = XML.asString(passwordElt);
Config dsCfg = new Config(
- name,
+ displayName,
connectionURL,
driverClass,
userName,
@@ -306,5 +286,6 @@
Tools.safeClose(in);
}
}
+
}
}
Modified: branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/HibernateSupport.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/HibernateSupport.java 2007-02-21 13:55:54 UTC (rev 6362)
+++ branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/HibernateSupport.java 2007-02-21 15:31:49 UTC (rev 6363)
@@ -20,7 +20,6 @@
* 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.test.framework.embedded;
import org.hibernate.HibernateException;
@@ -31,20 +30,11 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Settings;
import org.hibernate.tool.hbm2ddl.SchemaExport;
-import org.jboss.portal.common.util.XML;
-import org.jboss.portal.common.util.Tools;
-import org.w3c.dom.Element;
-import org.w3c.dom.Document;
import javax.transaction.Synchronization;
import java.util.Collection;
import java.util.Iterator;
-import java.util.Map;
-import java.util.LinkedHashMap;
-import java.util.HashMap;
import java.util.Properties;
-import java.io.InputStream;
-import java.net.URL;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -53,6 +43,8 @@
public class HibernateSupport
{
+ public static final String DS_JNDI_NAME = "java:/DefaultDS";
+
/** . */
protected String jndiName;
@@ -60,20 +52,17 @@
protected Collection mappings;
/** . */
- protected Config config;
+ protected Configuration cfg;
/** . */
protected SessionFactory factory;
/** . */
- protected Session session;
+ protected Settings settings;
/** . */
- protected Configuration cfg;
+ protected Session session;
- /** . */
- protected Settings settings;
-
public Collection getMappings()
{
return mappings;
@@ -84,16 +73,11 @@
this.mappings = mappings;
}
- public Config getConfig()
+ public Configuration getConfig()
{
- return config;
+ return cfg;
}
- public void setConfig(Config config)
- {
- this.config = config;
- }
-
public SessionFactory getSessionFactory()
{
return factory;
@@ -111,8 +95,10 @@
protected void createConfiguration()
{
- Configuration cfg = new Configuration();
+ //
+ cfg = new Configuration();
+ //
for (Iterator i = mappings.iterator(); i.hasNext();)
{
String mapping = (String)i.next();
@@ -121,21 +107,25 @@
//
Properties props = new Properties();
- props.putAll(config.properties);
- cfg.addProperties(props);
+ props.setProperty("hibernate.show_sql", "true");
+ props.setProperty("hibernate.transaction.flush_before_completion", "true");
+ props.setProperty("hibernate.transaction.auto_close_session", "true");
+ props.setProperty("hibernate.transaction.factory_class", "org.hibernate.transaction.JTATransactionFactory");
+ props.setProperty("hibernate.transaction.manager_lookup_class", "org.hibernate.transaction.JBossTransactionManagerLookup");
+ props.setProperty("hibernate.connection.datasource", DS_JNDI_NAME);
+ props.setProperty("hibernate.cache.provider_class", "org.hibernate.cache.HashtableCacheProvider");
//
- cfg.setProperty("hibernate.connection.datasource", "java:/DefaultDS");
-
- //
if (jndiName != null)
{
- cfg.setProperty("hibernate.session_factory_name", jndiName);
+ props.setProperty("hibernate.session_factory_name", jndiName);
}
//
- this.settings = cfg.buildSettings();
- this.cfg = cfg;
+ cfg.setProperties(props);
+
+ //
+ settings = cfg.buildSettings();
}
protected void createSessionFactory()
@@ -162,7 +152,7 @@
protected void destroyConfiguration()
{
- config = null;
+ cfg = null;
}
public void create() throws Exception
@@ -314,105 +304,4 @@
});
return session;
}
-
- public static class Config
- {
-
- /** . */
- private String name;
-
- /** . */
- private Map properties;
-
- public Config(String name, Map properties)
- {
- this.name = name;
- this.properties = properties;
- }
-
- public String getName()
- {
- return name;
- }
-
- public Map getProperties()
- {
- return properties;
- }
- }
-
- /** . */
- private static Map configs;
-
- public static Map fromXML(URL url) throws Exception
- {
- Map configs = new LinkedHashMap();
- InputStream in = null;
- try
- {
- in = Tools.safeBufferedWrapper(url.openStream());
- Document doc = XML.getDocumentBuilderFactory().newDocumentBuilder().parse(in);
- for (Iterator i = XML.getChildrenIterator(doc.getDocumentElement(), "configuration"); i.hasNext();)
- {
- Element childElt = (Element)i.next();
-
- //
- Element configurationNameElt = XML.getUniqueChild(childElt, "configuration-name", true);
- String configurationName = XML.asString(configurationNameElt);
-
- //
- Map properties = new HashMap();
- Element propertiesElt = XML.getUniqueChild(childElt, "properties", false);
- if (propertiesElt != null)
- {
- for (Iterator j = XML.getChildrenIterator(propertiesElt, "property");j.hasNext();)
- {
- Element propertyElt = (Element)j.next();
- Element nameElt = XML.getUniqueChild(propertyElt, "name", true);
- Element valueElt = XML.getUniqueChild(propertyElt, "value", true);
- String name = XML.asString(nameElt);
- String value = XML.asString(valueElt);
- properties.put(name, value);
- }
- }
-
- //
- Config config = new Config(configurationName, properties);
- configs.put(configurationName, config);
- }
- return configs;
- }
- finally
- {
- Tools.safeClose(in);
- }
- }
-
- public synchronized static Config getConfig(String name) throws Exception
- {
- if (configs == null)
- {
- URL url = Thread.currentThread().getContextClassLoader().getResource("hibernates.xml");
- configs = fromXML(url);
-
- // Remove and merge default with all
- Config defaultCfg = (Config)configs.remove("default");
-
- //
- for (Iterator i = configs.values().iterator();i.hasNext();)
- {
- Config cfg = (Config)i.next();
- if ("default".equals(cfg.getName()) == false)
- {
- Map tmp = new HashMap(defaultCfg.properties);
- tmp.putAll(cfg.properties);
- cfg.properties = tmp;
- }
- }
-
- }
-
- //
- return (Config)configs.get(name);
- }
}
19 years, 2 months
JBoss Portal SVN: r6362 - branches/JBoss_Portal_Branch_2_4/cms/src/resources/portal-cms-jar/org/jboss/portal/cms.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-02-21 08:55:54 -0500 (Wed, 21 Feb 2007)
New Revision: 6362
Modified:
branches/JBoss_Portal_Branch_2_4/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml
Log:
Fix beans declaration for CMS
Modified: branches/JBoss_Portal_Branch_2_4/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_4/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml 2007-02-21 13:11:17 UTC (rev 6361)
+++ branches/JBoss_Portal_Branch_2_4/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml 2007-02-21 13:55:54 UTC (rev 6362)
@@ -34,6 +34,13 @@
</constructor>
</bean>
+ <bean name="HibernateConfig" class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>HibernateConfig</parameter>
+ </constructor>
+ </bean>
+
<bean name="JNDISupport" class="org.jboss.portal.test.framework.embedded.JNDISupport">
</bean>
@@ -48,13 +55,11 @@
<property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
<property name="connectionManagerReference"><inject bean="ConnectionManagerSupport"
property="connectionManagerReference"/></property>
- <property name="driverClass"><inject bean="DataSourceConfig" property="driverClass"/></property>
- <property name="connectionURL"><inject bean="DataSourceConfig" property="connectionURL"/></property>
- <property name="userName"><inject bean="DataSourceConfig" property="userName"/></property>
- <property name="password"><inject bean="DataSourceConfig" property="password"/></property>
+ <property name="config"><inject bean="DataSourceConfig"/></property>
</bean>
<bean name="HibernateSupport" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config"><inject bean="HibernateConfig"/></property>
<property name="jNDIName">java:/SessionFactory</property>
<property name="mappings">
<list elementClass="java.lang.String">
@@ -64,7 +69,7 @@
</bean>
<!--
- <bean name="TestBean" class="org.jboss.portal.test.identity.UserTestCase">
+ <bean name="TestBean" class="org.jboss.portal.test.identity.db.DBUserTestCase">
<constructor factoryMethod="getBean">
<factory bean="BeanFactory"/>
<parameter>TestBean</parameter>
19 years, 2 months
JBoss Portal SVN: r6361 - in branches/JBoss_Portal_Branch_2_4: common/src/main/org/jboss/portal/common/test and 2 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-02-21 08:11:17 -0500 (Wed, 21 Feb 2007)
New Revision: 6361
Added:
branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/test/
branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/test/MonoValuedTestParameterValue.java
branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/test/MultiValuedTestParameterValue.java
branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/test/TestParameterValue.java
Modified:
branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/Tools.java
branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/HibernateSupport.java
Log:
Try to port back the DB matrix testing to 2.4.
Added: branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/test/MonoValuedTestParameterValue.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/test/MonoValuedTestParameterValue.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/test/MonoValuedTestParameterValue.java 2007-02-21 13:11:17 UTC (rev 6361)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * 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.test;
+
+/**
+ * A mono value.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class MonoValuedTestParameterValue extends TestParameterValue
+{
+
+ /** The value. */
+ protected final Object value;
+
+ public MonoValuedTestParameterValue(Object value)
+ {
+ this.value = value;
+ }
+
+ public Object get()
+ {
+ return value;
+ }
+}
Added: branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/test/MultiValuedTestParameterValue.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/test/MultiValuedTestParameterValue.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/test/MultiValuedTestParameterValue.java 2007-02-21 13:11:17 UTC (rev 6361)
@@ -0,0 +1,90 @@
+/******************************************************************************
+ * 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.test;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Arrays;
+
+/**
+ * A multi value.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class MultiValuedTestParameterValue extends TestParameterValue
+{
+
+ /** . */
+ protected final Collection value;
+
+ public MultiValuedTestParameterValue(Object[] value) throws IllegalArgumentException
+ {
+ if (value == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.value = Arrays.asList(value);
+ }
+
+ public MultiValuedTestParameterValue(Collection value) throws IllegalArgumentException
+ {
+ if (value == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.value = value;
+ }
+
+ public Object get()
+ {
+ return value;
+ }
+
+ /**
+ * Return an iterator over the values.
+ */
+ public Iterator iterator()
+ {
+ return new Iterator()
+ {
+ Iterator i = value.iterator();
+ public boolean hasNext()
+ {
+ return i.hasNext();
+ }
+ public Object next()
+ {
+ return new MonoValuedTestParameterValue(i.next());
+ }
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+}
Added: branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/test/TestParameterValue.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/test/TestParameterValue.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/test/TestParameterValue.java 2007-02-21 13:11:17 UTC (rev 6361)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * 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.test;
+
+import java.io.Serializable;
+
+/**
+ * The value of a test parameter.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class TestParameterValue implements Serializable
+{
+ /**
+ * Return the actual value.
+ *
+ * @return
+ */
+ public abstract Object get();
+
+ public int hashCode()
+ {
+ Object o = get();
+ return o == null ? 0 : o.hashCode();
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof TestParameterValue)
+ {
+ TestParameterValue that = (TestParameterValue)obj;
+ Object thisO = get();
+ Object thatO = that.get();
+ return thisO == null ? thatO == null : thisO.equals(thatO);
+ }
+ return false;
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/Tools.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/Tools.java 2007-02-21 11:47:55 UTC (rev 6360)
+++ branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/Tools.java 2007-02-21 13:11:17 UTC (rev 6361)
@@ -26,6 +26,7 @@
import org.apache.log4j.Logger;
import org.jboss.portal.common.logging.Log4JWriter;
+import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -785,4 +786,24 @@
ObjectInputStream ois = new ObjectInputStream(bais);
return ois.readObject();
}
+
+ public static BufferedInputStream safeBufferedWrapper(InputStream in)
+ {
+ if (in != null)
+ {
+ if (in instanceof BufferedInputStream)
+ {
+ return (BufferedInputStream)in;
+ }
+ else
+ {
+ return new BufferedInputStream(in);
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+
}
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java 2007-02-21 11:47:55 UTC (rev 6360)
+++ branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java 2007-02-21 13:11:17 UTC (rev 6361)
@@ -20,10 +20,12 @@
* 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.test.framework.embedded;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.util.XML;
+import org.jboss.portal.common.test.MultiValuedTestParameterValue;
import org.jboss.resource.adapter.jdbc.local.LocalTxDataSource;
import org.jboss.resource.connectionmanager.CachedConnectionManagerReference;
import org.w3c.dom.Document;
@@ -36,8 +38,10 @@
import java.sql.Connection;
import java.sql.Statement;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
/**
* An helper to setup JDNI available objects
@@ -55,7 +59,7 @@
private CachedConnectionManagerReference connectionManagerReference;
//
- private Config cfg;
+ private Config config;
private String jndiName = "java:/DefaultDS";
@@ -64,7 +68,7 @@
public DataSourceSupport(Config cfg)
{
- this.cfg = cfg;
+ this.config = cfg;
}
public DataSourceSupport()
@@ -81,10 +85,10 @@
//
ds = new LocalTxDataSource();
- ds.setConnectionURL(cfg.getConnectionURL());
- ds.setDriverClass(cfg.getDriverClass());
- ds.setUserName(cfg.getUserName());
- ds.setPassword(cfg.getPassword());
+ ds.setConnectionURL(config.getConnectionURL());
+ ds.setDriverClass(config.getDriverClass());
+ ds.setUserName(config.getUserName());
+ ds.setPassword(config.getPassword());
ds.setJndiName(jndiName);
ds.setMaxSize(10);
ds.setMinSize(0);
@@ -99,7 +103,7 @@
public void stop()
{
// Make hsqldb flush its data on the disk
- if ("org.hsqldb.jdbcDriver".equals(cfg.driverClass))
+ if ("org.hsqldb.jdbcDriver".equals(config.driverClass))
{
try
{
@@ -132,56 +136,16 @@
{
}
- public String getConnectionURL()
+ public Config getConfig()
{
- return cfg.connectionURL;
+ return config;
}
- public void setConnectionURL(String connectionURL)
+ public void setConfig(Config config)
{
- this.cfg.connectionURL = connectionURL;
+ this.config = config;
}
- public String getDriverClass()
- {
- return cfg.driverClass;
- }
-
- public void setDriverClass(String driverClass)
- {
- this.cfg.driverClass = driverClass;
- }
-
- public String getUserName()
- {
- return cfg.userName;
- }
-
- public void setUserName(String userName)
- {
- this.cfg.userName = userName;
- }
-
- public String getPassword()
- {
- return cfg.password;
- }
-
- public void setPassword(String password)
- {
- this.cfg.password = password;
- }
-
- public String getJndiName()
- {
- return jndiName;
- }
-
- public void setJndiName(String jndiName)
- {
- this.jndiName = jndiName;
- }
-
public TransactionManager getTransactionManager()
{
return transactionManager;
@@ -205,26 +169,40 @@
public static class Config
{
- private String displayName;
+ /** . */
+ private String name;
+
+ /** . */
private String connectionURL;
+
+ /** . */
private String driverClass;
+
+ /** . */
private String userName;
+
+ /** . */
private String password;
- public Config(String displayName, String connectionURL, String driverClass, String userName, String password)
+ public Config(String name, String connectionURL, String driverClass, String userName, String password)
{
- this.displayName = displayName;
+ this.name = name;
this.connectionURL = connectionURL;
this.driverClass = driverClass;
this.userName = userName;
this.password = password;
}
- public String getDisplayName()
+ public Config()
{
- return displayName;
+
}
+ public String getName()
+ {
+ return name;
+ }
+
public String getConnectionURL()
{
return connectionURL;
@@ -247,32 +225,74 @@
public String toString()
{
- return "DataSource[" + displayName + "]";
+ return "Datasource[" + name + "]";
}
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public void setConnectionURL(String connectionURL)
+ {
+ this.connectionURL = connectionURL;
+ }
+
+ public void setDriverClass(String driverClass)
+ {
+ this.driverClass = driverClass;
+ }
+
+ public void setUserName(String userName)
+ {
+ this.userName = userName;
+ }
+
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+ public static MultiValuedTestParameterValue fromXML2(URL url) throws Exception
+ {
+ Config[] configs = fromXML(url);
+ List list = Arrays.asList(configs);
+ return new MultiValuedTestParameterValue(list);
+ }
+
public static Config[] fromXML(URL url) throws Exception
{
ArrayList configs = new ArrayList();
InputStream in = null;
try
{
- in = url.openStream();
+ in = Tools.safeBufferedWrapper(url.openStream());
Document doc = XML.getDocumentBuilderFactory().newDocumentBuilder().parse(in);
for (Iterator i = XML.getChildrenIterator(doc.getDocumentElement(), "datasource"); i.hasNext();)
{
Element childElt = (Element)i.next();
- Element displayNameURLElt = XML.getUniqueChild(childElt, "datasource-name", true);
+
+ // Parse the datasource name, taking in account the deprecated display-name element
+ Element nameElt = XML.getUniqueChild(childElt, "datasource-name", false);
+ if (nameElt == null)
+ {
+ System.out.println("XML element datasource-name is not present, trying deprecated display-name element instead, you should fix your datasources.xml");
+ nameElt = XML.getUniqueChild(childElt, "display-name", true);
+ }
+
+ // Parse the rest of the configuration
Element connectionURLElt = XML.getUniqueChild(childElt, "connection-url", true);
Element driverClassElt = XML.getUniqueChild(childElt, "driver-class", true);
Element userNameElt = XML.getUniqueChild(childElt, "user-name", true);
Element passwordElt = XML.getUniqueChild(childElt, "password", true);
- String displayName = XML.asString(displayNameURLElt);
+ String name = XML.asString(nameElt);
String connectionURL = XML.asString(connectionURLElt);
String driverClass = XML.asString(driverClassElt);
String userName = XML.asString(userNameElt);
String password = XML.asString(passwordElt);
Config dsCfg = new Config(
- displayName,
+ name,
connectionURL,
driverClass,
userName,
@@ -286,6 +306,5 @@
Tools.safeClose(in);
}
}
-
}
}
Modified: branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/HibernateSupport.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/HibernateSupport.java 2007-02-21 11:47:55 UTC (rev 6360)
+++ branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/HibernateSupport.java 2007-02-21 13:11:17 UTC (rev 6361)
@@ -20,6 +20,7 @@
* 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.test.framework.embedded;
import org.hibernate.HibernateException;
@@ -30,11 +31,20 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Settings;
import org.hibernate.tool.hbm2ddl.SchemaExport;
+import org.jboss.portal.common.util.XML;
+import org.jboss.portal.common.util.Tools;
+import org.w3c.dom.Element;
+import org.w3c.dom.Document;
import javax.transaction.Synchronization;
import java.util.Collection;
import java.util.Iterator;
+import java.util.Map;
+import java.util.LinkedHashMap;
+import java.util.HashMap;
import java.util.Properties;
+import java.io.InputStream;
+import java.net.URL;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -43,8 +53,6 @@
public class HibernateSupport
{
- public static final String DS_JNDI_NAME = "java:/DefaultDS";
-
/** . */
protected String jndiName;
@@ -52,17 +60,20 @@
protected Collection mappings;
/** . */
- protected Configuration cfg;
+ protected Config config;
/** . */
protected SessionFactory factory;
/** . */
- protected Settings settings;
+ protected Session session;
/** . */
- protected Session session;
+ protected Configuration cfg;
+ /** . */
+ protected Settings settings;
+
public Collection getMappings()
{
return mappings;
@@ -73,11 +84,16 @@
this.mappings = mappings;
}
- public Configuration getConfig()
+ public Config getConfig()
{
- return cfg;
+ return config;
}
+ public void setConfig(Config config)
+ {
+ this.config = config;
+ }
+
public SessionFactory getSessionFactory()
{
return factory;
@@ -95,10 +111,8 @@
protected void createConfiguration()
{
- //
- cfg = new Configuration();
+ Configuration cfg = new Configuration();
- //
for (Iterator i = mappings.iterator(); i.hasNext();)
{
String mapping = (String)i.next();
@@ -107,25 +121,21 @@
//
Properties props = new Properties();
- props.setProperty("hibernate.show_sql", "true");
- props.setProperty("hibernate.transaction.flush_before_completion", "true");
- props.setProperty("hibernate.transaction.auto_close_session", "true");
- props.setProperty("hibernate.transaction.factory_class", "org.hibernate.transaction.JTATransactionFactory");
- props.setProperty("hibernate.transaction.manager_lookup_class", "org.hibernate.transaction.JBossTransactionManagerLookup");
- props.setProperty("hibernate.connection.datasource", DS_JNDI_NAME);
- props.setProperty("hibernate.cache.provider_class", "org.hibernate.cache.HashtableCacheProvider");
+ props.putAll(config.properties);
+ cfg.addProperties(props);
//
+ cfg.setProperty("hibernate.connection.datasource", "java:/DefaultDS");
+
+ //
if (jndiName != null)
{
- props.setProperty("hibernate.session_factory_name", jndiName);
+ cfg.setProperty("hibernate.session_factory_name", jndiName);
}
//
- cfg.setProperties(props);
-
- //
- settings = cfg.buildSettings();
+ this.settings = cfg.buildSettings();
+ this.cfg = cfg;
}
protected void createSessionFactory()
@@ -152,7 +162,7 @@
protected void destroyConfiguration()
{
- cfg = null;
+ config = null;
}
public void create() throws Exception
@@ -304,4 +314,105 @@
});
return session;
}
+
+ public static class Config
+ {
+
+ /** . */
+ private String name;
+
+ /** . */
+ private Map properties;
+
+ public Config(String name, Map properties)
+ {
+ this.name = name;
+ this.properties = properties;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Map getProperties()
+ {
+ return properties;
+ }
+ }
+
+ /** . */
+ private static Map configs;
+
+ public static Map fromXML(URL url) throws Exception
+ {
+ Map configs = new LinkedHashMap();
+ InputStream in = null;
+ try
+ {
+ in = Tools.safeBufferedWrapper(url.openStream());
+ Document doc = XML.getDocumentBuilderFactory().newDocumentBuilder().parse(in);
+ for (Iterator i = XML.getChildrenIterator(doc.getDocumentElement(), "configuration"); i.hasNext();)
+ {
+ Element childElt = (Element)i.next();
+
+ //
+ Element configurationNameElt = XML.getUniqueChild(childElt, "configuration-name", true);
+ String configurationName = XML.asString(configurationNameElt);
+
+ //
+ Map properties = new HashMap();
+ Element propertiesElt = XML.getUniqueChild(childElt, "properties", false);
+ if (propertiesElt != null)
+ {
+ for (Iterator j = XML.getChildrenIterator(propertiesElt, "property");j.hasNext();)
+ {
+ Element propertyElt = (Element)j.next();
+ Element nameElt = XML.getUniqueChild(propertyElt, "name", true);
+ Element valueElt = XML.getUniqueChild(propertyElt, "value", true);
+ String name = XML.asString(nameElt);
+ String value = XML.asString(valueElt);
+ properties.put(name, value);
+ }
+ }
+
+ //
+ Config config = new Config(configurationName, properties);
+ configs.put(configurationName, config);
+ }
+ return configs;
+ }
+ finally
+ {
+ Tools.safeClose(in);
+ }
+ }
+
+ public synchronized static Config getConfig(String name) throws Exception
+ {
+ if (configs == null)
+ {
+ URL url = Thread.currentThread().getContextClassLoader().getResource("hibernates.xml");
+ configs = fromXML(url);
+
+ // Remove and merge default with all
+ Config defaultCfg = (Config)configs.remove("default");
+
+ //
+ for (Iterator i = configs.values().iterator();i.hasNext();)
+ {
+ Config cfg = (Config)i.next();
+ if ("default".equals(cfg.getName()) == false)
+ {
+ Map tmp = new HashMap(defaultCfg.properties);
+ tmp.putAll(cfg.properties);
+ cfg.properties = tmp;
+ }
+ }
+
+ }
+
+ //
+ return (Config)configs.get(name);
+ }
}
19 years, 2 months
JBoss Portal SVN: r6360 - branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-02-21 06:47:55 -0500 (Wed, 21 Feb 2007)
New Revision: 6360
Modified:
branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
Log:
It's datasource-name... not database-name.
Modified: branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java 2007-02-21 11:34:19 UTC (rev 6359)
+++ branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java 2007-02-21 11:47:55 UTC (rev 6360)
@@ -261,13 +261,7 @@
for (Iterator i = XML.getChildrenIterator(doc.getDocumentElement(), "datasource"); i.hasNext();)
{
Element childElt = (Element)i.next();
- Element displayNameURLElt = XML.getUniqueChild(childElt, "database-name", true);
- if (displayNameURLElt == null)
- {
- System.out.println("XML element datasource-name is not present, trying deprecated display-name element instead, you should fix your datasources.xml");
- displayNameURLElt = XML.getUniqueChild(childElt, "display-name", true);
- }
-
+ Element displayNameURLElt = XML.getUniqueChild(childElt, "datasource-name", true);
Element connectionURLElt = XML.getUniqueChild(childElt, "connection-url", true);
Element driverClassElt = XML.getUniqueChild(childElt, "driver-class", true);
Element userNameElt = XML.getUniqueChild(childElt, "user-name", true);
19 years, 2 months
JBoss Portal SVN: r6359 - trunk/core-search/src/resources/portal-search-war/WEB-INF/jsp.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-02-21 06:34:19 -0500 (Wed, 21 Feb 2007)
New Revision: 6359
Modified:
trunk/core-search/src/resources/portal-search-war/WEB-INF/jsp/search.jsp
trunk/core-search/src/resources/portal-search-war/WEB-INF/jsp/viewResults.jsp
Log:
Moved classes
Modified: trunk/core-search/src/resources/portal-search-war/WEB-INF/jsp/search.jsp
===================================================================
--- trunk/core-search/src/resources/portal-search-war/WEB-INF/jsp/search.jsp 2007-02-21 10:45:53 UTC (rev 6358)
+++ trunk/core-search/src/resources/portal-search-war/WEB-INF/jsp/search.jsp 2007-02-21 11:34:19 UTC (rev 6359)
@@ -1,4 +1,4 @@
-<%@ page import="org.jboss.portal.search.SearchConstants" %>
+<%@ page import="org.jboss.portal.core.search.SearchConstants" %>
<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
Modified: trunk/core-search/src/resources/portal-search-war/WEB-INF/jsp/viewResults.jsp
===================================================================
--- trunk/core-search/src/resources/portal-search-war/WEB-INF/jsp/viewResults.jsp 2007-02-21 10:45:53 UTC (rev 6358)
+++ trunk/core-search/src/resources/portal-search-war/WEB-INF/jsp/viewResults.jsp 2007-02-21 11:34:19 UTC (rev 6359)
@@ -1,4 +1,4 @@
-<%@ page import="org.jboss.portal.search.SearchConstants" %>
+<%@ page import="org.jboss.portal.core.search.SearchConstants" %>
<%@ page import="org.jboss.portal.search.result.ResultSet" %>
<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
19 years, 2 months
JBoss Portal SVN: r6358 - in branches/JBoss_Portal_Branch_2_4/test/src: main/org/jboss/portal/test/framework/embedded and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-02-21 05:45:53 -0500 (Wed, 21 Feb 2007)
New Revision: 6358
Modified:
branches/JBoss_Portal_Branch_2_4/test/src/etc/datasources.xml
branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
Log:
"display-name" is deprecated in datasources.xml. Replaced by "database-name"
Modified: branches/JBoss_Portal_Branch_2_4/test/src/etc/datasources.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_4/test/src/etc/datasources.xml 2007-02-21 05:55:02 UTC (rev 6357)
+++ branches/JBoss_Portal_Branch_2_4/test/src/etc/datasources.xml 2007-02-21 10:45:53 UTC (rev 6358)
@@ -23,7 +23,7 @@
<datasources>
<datasource>
- <display-name>hsqldb</display-name>
+ <datasource-name>hsqldb</datasource-name>
<connection-url>jdbc:hsqldb:file:test</connection-url>
<driver-class>org.hsqldb.jdbcDriver</driver-class>
<user-name>sa</user-name>
Modified: branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java 2007-02-21 05:55:02 UTC (rev 6357)
+++ branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java 2007-02-21 10:45:53 UTC (rev 6358)
@@ -261,7 +261,13 @@
for (Iterator i = XML.getChildrenIterator(doc.getDocumentElement(), "datasource"); i.hasNext();)
{
Element childElt = (Element)i.next();
- Element displayNameURLElt = XML.getUniqueChild(childElt, "display-name", true);
+ Element displayNameURLElt = XML.getUniqueChild(childElt, "database-name", true);
+ if (displayNameURLElt == null)
+ {
+ System.out.println("XML element datasource-name is not present, trying deprecated display-name element instead, you should fix your datasources.xml");
+ displayNameURLElt = XML.getUniqueChild(childElt, "display-name", true);
+ }
+
Element connectionURLElt = XML.getUniqueChild(childElt, "connection-url", true);
Element driverClassElt = XML.getUniqueChild(childElt, "driver-class", true);
Element userNameElt = XML.getUniqueChild(childElt, "user-name", true);
19 years, 2 months
JBoss Portal SVN: r6357 - in trunk/wsrp: src/main/org/jboss/portal/test/wsrp/deployment and 8 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-21 00:55:02 -0500 (Wed, 21 Feb 2007)
New Revision: 6357
Added:
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationProperty.java
trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/
trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/
trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml
trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/ehcache.xml
trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/hibernate.cfg.xml
Modified:
trunk/wsrp/build.xml
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistry.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/registration/RegistrationPropertyDescription.java
trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsp/consumers/consumer.jsp
Log:
- Started implementation of persistence of registrations on the consumer.
- Modified classes to work with Hibernate.
- Added Hibernate configuration files.
- Added service descriptions.
- Modified build to accomodate token filtering.
- Broke almost all the consumer tests (and some others too) but WSRP deploys correctly so hopefully only minor work is left (hence the commit).
Modified: trunk/wsrp/build.xml
===================================================================
--- trunk/wsrp/build.xml 2007-02-20 22:07:16 UTC (rev 6356)
+++ trunk/wsrp/build.xml 2007-02-21 05:55:02 UTC (rev 6357)
@@ -200,9 +200,21 @@
<target name="compile"
description="Compile all source files."
- depends="_default:compile-classes,
- _default:compile-etc,
- _default:compile-resources">
+ depends="_default:compile-classes,_default:compile-etc">
+ <!-- essentially accomplish _default:compile-resources that needs to be done here to filter hibernate conf files -->
+ <mkdir dir="${build.resources}"/>
+ <copy todir="${build.resources}">
+ <filterset>
+ <filtersfile file="../build/etc/single.properties"/>
+ <filter token="portal.datasource.name" value="${portal.datasource.name}"/>
+ </filterset>
+ <fileset dir="${source.resources}" includes="**/domain.hbm.xml"/>
+ <fileset dir="${source.resources}" includes="**/hibernate.cfg.xml"/>
+ <fileset dir="${source.resources}" includes="**/jboss-service.xml"/>
+ </copy>
+ <copy todir="${build.resources}" filtering="no">
+ <fileset dir="${source.resources}"/>
+ </copy>
<mkdir dir="${build.lib.test}"/>
<mkdir dir="${build.resources.test}"/>
<property name="compile.disable" value="true"/>
@@ -212,7 +224,7 @@
<!--| Generate Output |-->
<!--| |-->
<!--| Generates the target output for this module. Target output is |-->
- <!--| the output which is ment to be released or used by external |-->
+ <!--| the output which is meant to be released or used by external |-->
<!--| modules. |-->
<!--+====================================================================+-->
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java 2007-02-20 22:07:16 UTC (rev 6356)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java 2007-02-21 05:55:02 UTC (rev 6357)
@@ -84,10 +84,10 @@
assertEquals("markup-1", serviceFactory1.getMarkupURL());
assertEquals("registration-1", serviceFactory1.getRegistrationURL());
assertEquals("portlet-management-1", serviceFactory1.getPortletManagementURL());
- assertEquals(endInfo.getServiceDescriptionInterfaceURL(), serviceFactory1.getServiceDescriptionURL());
- assertEquals(endInfo.getMarkupInterfaceURL(), serviceFactory1.getMarkupURL());
- assertEquals(endInfo.getRegistrationInterfaceURL(), serviceFactory1.getRegistrationURL());
- assertEquals(endInfo.getPortletManagementInterfaceURL(), serviceFactory1.getPortletManagementURL());
+ assertEquals(endInfo.getServiceDescriptionURL(), serviceFactory1.getServiceDescriptionURL());
+ assertEquals(endInfo.getMarkupURL(), serviceFactory1.getMarkupURL());
+ assertEquals(endInfo.getRegistrationURL(), serviceFactory1.getRegistrationURL());
+ assertEquals(endInfo.getPortletManagementURL(), serviceFactory1.getPortletManagementURL());
//
service = services.get(1);
@@ -116,10 +116,10 @@
endInfo = info.getEndpointConfigurationInfo();
assertNotNull(endInfo);
assertTrue(endInfo.usesWSDL());
- assertEquals("http://wsrp.bea.com:7001/producer/producer?WSDL", endInfo.getWSDLLocationIfAvailable());
+ assertEquals("http://wsrp.bea.com:7001/producer/producer?WSDL", endInfo.getWsdlDefinitionURL());
RegistrationInfo regInfo = info.getRegistrationInfo();
assertNotNull(regInfo);
- assertTrue(regInfo.requiresRegistration());
+ assertTrue(regInfo.isRequiresRegistration());
RegistrationData registrationData = regInfo.getRegistrationData();
assertNotNull(registrationData);
assertEquals("JBoss Portal 2.4 Test", registrationData.getConsumerName());
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java 2007-02-20 22:07:16 UTC (rev 6356)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java 2007-02-21 05:55:02 UTC (rev 6357)
@@ -29,6 +29,7 @@
import org.jboss.portal.wsrp.core.WSRP_v1_PortletManagement_PortType;
import org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType;
import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
+import org.jboss.portal.wsrp.services.PerEndpointSOAPInvokerServiceFactory;
import org.jboss.portal.wsrp.services.RemoteSOAPInvokerServiceFactory;
import org.jboss.portal.wsrp.services.ServiceFactory;
@@ -39,13 +40,31 @@
*/
public class EndpointConfigurationInfo
{
+ /** DB primary key */
+ private Long key;
+
+ private String serviceDescriptionURL;
+ private String markupURL;
+ private String registrationURL;
+ private String portletManagementURL;
+ private String wsdlDefinitionURL;
+
+ // transient variables
+ /** Access to the WS */
private ServiceFactory serviceFactory;
+ /** Whether the service factory needs refreshing */
+ private boolean dirty;
+
static final String SERVICE_DESCRIPTION = "service description";
static final String MARKUP = "markup";
static final String PORTLET_MANAGEMENT = "portlet management";
static final String REGISTRATION = "registration";
+ public EndpointConfigurationInfo()
+ {
+ }
+
public EndpointConfigurationInfo(ProducerInfo producerInfo)
{
ParameterValidation.throwIllegalArgExceptionIfNull(producerInfo, "ProducerInfo");
@@ -58,50 +77,106 @@
setServiceFactory(serviceFactory);
}
+
+ public Long getKey()
+ {
+ return key;
+ }
+
+ public void setKey(Long key)
+ {
+ this.key = key;
+ }
+
public boolean usesWSDL()
{
- return getServiceFactory() instanceof RemoteSOAPInvokerServiceFactory;
+ return wsdlDefinitionURL != null;
}
- public String getWSDLLocationIfAvailable()
+ public String getWsdlDefinitionURL()
{
- if (usesWSDL())
- {
- RemoteSOAPInvokerServiceFactory remoteSF = (RemoteSOAPInvokerServiceFactory)getServiceFactory();
- return remoteSF.getWsdlDefinitionURL();
- }
- else
- {
- return null;
- }
+ return wsdlDefinitionURL;
}
- public String getServiceDescriptionInterfaceURL()
+ public String getServiceDescriptionURL()
{
- return getServiceFactory().getServiceDescriptionURL();
+ return serviceDescriptionURL;
}
- public String getMarkupInterfaceURL()
+ public String getMarkupURL()
{
- return getServiceFactory().getMarkupURL();
+ return markupURL;
}
- public String getPortletManagementInterfaceURL()
+ public String getPortletManagementURL()
{
- return getServiceFactory().getPortletManagementURL();
+ return portletManagementURL;
}
- public String getRegistrationInterfaceURL()
+ public String getRegistrationURL()
{
- return getServiceFactory().getRegistrationURL();
+ return registrationURL;
}
- ServiceFactory getServiceFactory()
+ public void setServiceDescriptionURL(String serviceDescriptionURL)
{
- if (serviceFactory == null)
+ this.serviceDescriptionURL = serviceDescriptionURL;
+ dirty = true;
+ }
+
+ public void setMarkupURL(String markupURL)
+ {
+ this.markupURL = markupURL;
+ dirty = true;
+ }
+
+ public void setRegistrationURL(String registrationURL)
+ {
+ this.registrationURL = registrationURL;
+ dirty = true;
+ }
+
+ public void setPortletManagementURL(String portletManagementURL)
+ {
+ this.portletManagementURL = portletManagementURL;
+ dirty = true;
+ }
+
+ public void setWsdlDefinitionURL(String wsdlDefinitionURL)
+ {
+ this.wsdlDefinitionURL = wsdlDefinitionURL;
+ dirty = true;
+ }
+
+ public void refreshServiceFactory()
+ {
+ if (dirty)
{
- throw new IllegalStateException("ServiceFactory hasn't been initialized for this EndpointConfigurationInfo");
+ // todo: implement update of service factory when URLs are changed...
+ if (serviceFactory == null)
+ {
+ if (usesWSDL())
+ {
+ serviceFactory = new RemoteSOAPInvokerServiceFactory();
+ ((RemoteSOAPInvokerServiceFactory)serviceFactory).setWsdlDefinitionURL(wsdlDefinitionURL);
+ }
+ else
+ {
+ serviceFactory = new PerEndpointSOAPInvokerServiceFactory();
+ ((PerEndpointSOAPInvokerServiceFactory)serviceFactory).setServiceDescriptionURL(serviceDescriptionURL);
+ ((PerEndpointSOAPInvokerServiceFactory)serviceFactory).setMarkupURL(markupURL);
+ ((PerEndpointSOAPInvokerServiceFactory)serviceFactory).setPortletManagementURL(portletManagementURL);
+ ((PerEndpointSOAPInvokerServiceFactory)serviceFactory).setRegistrationURL(registrationURL);
+ }
+ }
+
+ dirty = false;
}
+ }
+
+ ServiceFactory getServiceFactory()
+ {
+ refreshServiceFactory();
return serviceFactory;
}
@@ -109,6 +184,17 @@
{
ParameterValidation.throwIllegalArgExceptionIfNull(serviceFactory, "ServiceFactory");
this.serviceFactory = serviceFactory;
+ serviceDescriptionURL = serviceFactory.getServiceDescriptionURL();
+ markupURL = serviceFactory.getMarkupURL();
+ portletManagementURL = serviceFactory.getPortletManagementURL();
+ registrationURL = serviceFactory.getRegistrationURL();
+
+ if (serviceFactory instanceof RemoteSOAPInvokerServiceFactory)
+ {
+ wsdlDefinitionURL = ((RemoteSOAPInvokerServiceFactory)serviceFactory).getWsdlDefinitionURL();
+ }
+
+ dirty = false;
}
WSRP_v1_ServiceDescription_PortType getServiceDescriptionService() throws InvokerUnavailableException
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-02-20 22:07:16 UTC (rev 6356)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-02-21 05:55:02 UTC (rev 6357)
@@ -64,6 +64,9 @@
// Persistent information
+ /** DB primary key */
+ private Long key;
+
/** Configuration of the remote WS endpoints */
private EndpointConfigurationInfo persistentEndpointInfo;
@@ -76,13 +79,14 @@
/** The cache expiration duration (in seconds) for cached values */
private Integer persitentExpirationCacheSeconds;
+ /** The activated status of the associated Consumer */
+ private boolean persistentActive;
+
// Transient information
/** The Cookie handling policy required by the Producer */
private CookieProtocol requiresInitCookie;
- private boolean isInitialized;
-
/** The Producer-Offered Portlets (handle -> WSRPPortlet) */
private Map popsMap;
@@ -115,6 +119,17 @@
persistentRegistrationInfo = RegistrationInfo.REGISTRATION_NOT_NEEDED;
}
+
+ public Long getKey()
+ {
+ return key;
+ }
+
+ public void setKey(Long key)
+ {
+ this.key = key;
+ }
+
public EndpointConfigurationInfo getEndpointConfigurationInfo()
{
return persistentEndpointInfo;
@@ -136,6 +151,29 @@
this.persistentRegistrationInfo = registrationInfo;
}
+ /**
+ * Determines whether the associated consumer is active.
+ *
+ * @return
+ * @since 2.6
+ */
+ public boolean isActive()
+ {
+ return persistentActive;
+ }
+
+ /**
+ * Activates or de-activate this Consumer. Note that this shouldn't be called directly as ConsumersRegistry will
+ * handle activation.
+ *
+ * @param active
+ * @since 2.6
+ */
+ public void setActive(boolean active)
+ {
+ this.persistentActive = active;
+ }
+
CookieProtocol getRequiresInitCookie()
{
return requiresInitCookie;
@@ -147,7 +185,7 @@
* @param forceRefresh whether or not to force a refresh regardless of whether one would have been required based on
* cache expiration
* @return <code>true</code> if the producer's information just was refreshed, <code>false</code>
- * @throws PortletInvokerException
+ * @throws PortletInvokerException if registration was required but couldn't be achieved properly
*/
public boolean refresh(boolean forceRefresh) throws PortletInvokerException
{
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-02-20 22:07:16 UTC (rev 6356)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-02-21 05:55:02 UTC (rev 6357)
@@ -25,8 +25,6 @@
import org.jboss.logging.Logger;
import org.jboss.portal.common.util.ParameterValidation;
-import org.jboss.portal.common.value.StringValue;
-import org.jboss.portal.registration.Registration;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.WSRPUtils;
@@ -56,13 +54,16 @@
{
public final static RegistrationInfo REGISTRATION_NOT_NEEDED = new RegistrationInfo();
private final Logger log = Logger.getLogger(getClass());
- private Registration registration;
+
+ private Long key;
+ private String consumerName;
+ private String registrationHandle;
+ private byte[] registrationState;
private boolean requiresRegistration;
- private Map registrationProperties; // todo: remove and compute from registration
+ private Map registrationProperties;
+
private transient RegistrationData registrationData;
- private boolean isRegistrationValid; // todo: remove and compute from registration
- private RegistrationContext registrationContext; // todo: remove and compute from registration
- private String consumerName;
+ private transient boolean isRegistrationValid;
public RegistrationInfo(ProducerInfo producerInfo)
{
@@ -79,16 +80,47 @@
requiresRegistration = false;
}
- public boolean requiresRegistration()
+
+ public Long getKey()
{
- return requiresRegistration;
+ return key;
}
- public Registration getRegistration()
+ public void setKey(Long key)
{
- return registration;
+ this.key = key;
}
+ public String getRegistrationHandle()
+ {
+ return registrationHandle;
+ }
+
+ public void setRegistrationHandle(String registrationHandle)
+ {
+ this.registrationHandle = registrationHandle;
+ }
+
+ public byte[] getRegistrationState()
+ {
+ return registrationState;
+ }
+
+ public void setRegistrationState(byte[] registrationState)
+ {
+ this.registrationState = registrationState;
+ }
+
+ public void setRequiresRegistration(boolean requiresRegistration)
+ {
+ this.requiresRegistration = requiresRegistration;
+ }
+
+ public boolean isRequiresRegistration()
+ {
+ return requiresRegistration;
+ }
+
public RegistrationData getRegistrationData()
{
if (registrationData == null)
@@ -102,10 +134,10 @@
for (Iterator entries = regProps.values().iterator(); entries.hasNext();)
{
RegistrationProperty prop = (RegistrationProperty)entries.next();
- String value = prop.getValueAsString();
+ String value = prop.getValue();
if (value != null && !prop.isInvalid())
{
- properties.add(WSRPTypeFactory.createProperty(prop.getName(), prop.getLang(), prop.getValueAsString()));
+ properties.add(WSRPTypeFactory.createProperty(prop.getName(), prop.getLang(), prop.getValue()));
}
}
@@ -190,6 +222,11 @@
}
}
+ public void setRegistrationProperties(Map registrationProperties)
+ {
+ this.registrationProperties = registrationProperties;
+ }
+
public Set getRegistrationPropertyNames()
{
return getRegistrationProperties().keySet();
@@ -287,6 +324,7 @@
{
log.info("Producer '" + producerId + "' doesn't require registration.");
requiresRegistration = false;
+ isRegistrationValid = true;
configurationValid = true;
}
@@ -326,77 +364,30 @@
void resetRegistration()
{
registrationData = null;
- registrationContext = null;
+ registrationHandle = null;
+ registrationState = null;
isRegistrationValid = false;
}
public boolean isRegistrationValid()
{
-// return !requiresRegistration() || (registration != null && RegistrationStatus.VALID == registration.getStatus());
return isRegistrationValid;
}
public void setRegistrationContext(RegistrationContext registrationContext)
{
- // todo: remove
- this.registrationContext = registrationContext;
+ ParameterValidation.throwIllegalArgExceptionIfNull(registrationContext, "RegistrationContext");
+ String handle = registrationContext.getRegistrationHandle();
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(handle, "registration handle", "RegistrationContext");
+ registrationHandle = handle;
+ registrationState = registrationContext.getRegistrationState();
isRegistrationValid = true;
}
public RegistrationContext getRegistrationContext()
{
+ RegistrationContext registrationContext = WSRPTypeFactory.createRegistrationContext(registrationHandle);
+ registrationContext.setRegistrationState(registrationState);
return registrationContext;
}
-
- public static class RegistrationProperty extends org.jboss.portal.portlet.state.Property
- {
- private RegistrationPropertyDescription description;
- private boolean isInvalid;
- private String lang;
-
- public RegistrationProperty(String name, String stringValue)
- {
- super(name, new StringValue(stringValue));
- }
-
- public String getValueAsString()
- {
- return getValue().asString();
- }
-
- public RegistrationPropertyDescription getDescription()
- {
- return description;
- }
-
- public void setDescription(RegistrationPropertyDescription description)
- {
- this.description = description;
- }
-
- public boolean isInvalid()
- {
- return isInvalid;
- }
-
- public void setInvalid(boolean invalid)
- {
- isInvalid = invalid;
- }
-
- public void setValue(String stringValue)
- {
- value = new StringValue(stringValue);
- }
-
- public String getLang()
- {
- return lang;
- }
-
- public void setLang(String lang)
- {
- this.lang = lang;
- }
- }
}
Added: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationProperty.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationProperty.java (rev 0)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationProperty.java 2007-02-21 05:55:02 UTC (rev 6357)
@@ -0,0 +1,113 @@
+/******************************************************************************
+ * 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.consumer;
+
+import org.jboss.portal.wsrp.registration.RegistrationPropertyDescription;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RegistrationProperty
+{
+ private Long key;
+ private RegistrationPropertyDescription description;
+ private boolean invalid;
+ private String lang;
+ private String name;
+ private String value;
+
+
+ public RegistrationProperty()
+ {
+ }
+
+ public RegistrationProperty(String name, String stringValue)
+ {
+ this.name = name;
+ this.value = stringValue;
+ }
+
+
+ public Long getKey()
+ {
+ return key;
+ }
+
+ public void setKey(Long key)
+ {
+ this.key = key;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public RegistrationPropertyDescription getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(RegistrationPropertyDescription description)
+ {
+ this.description = description;
+ }
+
+ public boolean isInvalid()
+ {
+ return invalid;
+ }
+
+ public void setInvalid(boolean invalid)
+ {
+ this.invalid = invalid;
+ }
+
+ public void setValue(String stringValue)
+ {
+ value = stringValue;
+ }
+
+ public String getLang()
+ {
+ return lang;
+ }
+
+ public void setLang(String lang)
+ {
+ this.lang = lang;
+ }
+}
Property changes on: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationProperty.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistry.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistry.java 2007-02-20 22:07:16 UTC (rev 6356)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistry.java 2007-02-21 05:55:02 UTC (rev 6357)
@@ -39,5 +39,4 @@
WSRPConsumer getConsumer(String id);
FederatingPortletInvoker getFederatingPortletInvoker();
-
-}
+}
\ No newline at end of file
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/registration/RegistrationPropertyDescription.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/registration/RegistrationPropertyDescription.java 2007-02-20 22:07:16 UTC (rev 6356)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/registration/RegistrationPropertyDescription.java 2007-02-21 05:55:02 UTC (rev 6357)
@@ -27,6 +27,7 @@
import javax.xml.namespace.QName;
import java.net.URI;
+import java.net.URISyntaxException;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
@@ -35,17 +36,18 @@
*/
public class RegistrationPropertyDescription implements Cloneable
{
+ private Long key;
private QName name;
private QName type;
- private URI schemaLocation;
+ private String schemaLocation;
private LocalizedString description;
private LocalizedString hint;
private LocalizedString label;
private String[] usages;
private QName[] aliases;
+
private transient ProducerRegistrationRequirements parent;
-
public RegistrationPropertyDescription(QName name, QName type)
{
this.name = name;
@@ -89,6 +91,17 @@
", label=" + label;
}
+
+ public Long getKey()
+ {
+ return key;
+ }
+
+ public void setKey(Long key)
+ {
+ this.key = key;
+ }
+
public QName getName()
{
return name;
@@ -111,13 +124,36 @@
notifyParentOfChangeIfNeeded();
}
- public URI getSchemaLocation()
+ public String getSchemaLocation()
{
return schemaLocation;
}
- public void setSchemaLocation(URI schemaLocation)
+ public URI getSchemaLocationAsURI()
{
+ try
+ {
+ return new URI(schemaLocation);
+ }
+ catch (URISyntaxException e)
+ {
+ // shouldn't happen
+ throw new IllegalArgumentException("Invalid URI: " + schemaLocation + ". Cause: " + e.getLocalizedMessage());
+ }
+ }
+
+ public void setSchemaLocation(String schemaLocation)
+ {
+ // first check if schemaLocation is a valid URI
+ try
+ {
+ new URI(schemaLocation);
+ }
+ catch (URISyntaxException e)
+ {
+ throw new IllegalArgumentException("Invalid URI: " + schemaLocation + ". Cause: " + e.getLocalizedMessage());
+ }
+
this.schemaLocation = schemaLocation;
notifyParentOfChangeIfNeeded();
}
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-20 22:07:16 UTC (rev 6356)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2007-02-21 05:55:02 UTC (rev 6357)
@@ -79,13 +79,13 @@
<xmbean/>
<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="RegistrationManager" proxy-type="attribute">portal.wsrp:service=RegistrationManager,type=Producer</depends>
<depends optional-attribute-name="ProducerConfigurationService" proxy-type="attribute">portal.wsrp:service=ProducerConfiguration</depends>
</mbean>
<!-- Registration manager -->
<mbean code="org.jboss.portal.registration.impl.RegistrationManagerImpl"
- name="portal.wsrp:service=RegistrationManager" xmbean-dd=""
+ name="portal.wsrp:service=RegistrationManager,type=Producer" xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<depends optional-attribute-name="PersistenceManager" proxy-type="attribute">portal.wsrp:service=PersistenceManager</depends>
@@ -115,28 +115,28 @@
proxy-type="attribute">portal.wsrp:service=ConsumersRegistry</depends>
</mbean>
- <!--<mbean
+ <mbean
code="org.jboss.portal.jems.hibernate.SessionFactoryBinder"
name="portal:service=Hibernate,type=WSRPConsumer"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<depends>jboss.jca:service=DataSourceBinding,name=@portal.datasource.name@</depends>
- --><!-- Uncomment in clustered mode : hibernate depends on its tree cache service @portal.single.xml.close@
+ <!-- Uncomment in clustered mode : hibernate depends on its tree cache service @portal.single.xml.close@
<depends>portal:service=TreeCacheProvider,type=hibernate</depends>
- @portal.single.xml.open@ --><!--
+ @portal.single.xml.open@ -->
<attribute name="DoChecking">true</attribute>
<attribute name="ConfigLocation">conf/consumer/hibernate/hibernate.cfg.xml</attribute>
- <attribute name="JNDIName">java:/portal/PortletSessionFactory</attribute>
- </mbean>-->
+ <attribute name="JNDIName">java:/portal/WSRPConsumerSessionFactory</attribute>
+ </mbean>
<!-- Consumers registry for WSRP consumer configuration portlet -->
<mbean code="org.jboss.portal.wsrp.portlet.consumers.ConsumersRegistryService"
name="portal.wsrp:service=ConsumersRegistry"
xmbean-dd="" xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <!--<depends>portal:service=Hibernate,type=WSRPConsumer</depends>
- <attribute name="SessionFactoryJNDIName">java:/portal/PortletSessionFactory</attribute>-->
+ <depends>portal:service=Hibernate,type=WSRPConsumer</depends>
+ <attribute name="SessionFactoryJNDIName">java:/portal/WSRPConsumerSessionFactory</attribute>
<depends optional-attribute-name="FederatingPortletInvoker" proxy-type="attribute">portal:service=PortletInvoker,type=Federating</depends>
</mbean>
</server>
Added: trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml (rev 0)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml 2007-02-21 05:55:02 UTC (rev 6357)
@@ -0,0 +1,252 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+ <hibernate-mapping>
+ <class
+ name="org.jboss.portal.wsrp.consumer.ProducerInfo"
+ table="JBP_PRODUCER_INFO">
+ <cache usage="@portal.hibernate.cache.usage@"/>
+ <id
+ name="key"
+ column="PK"
+ access="field">
+ <generator class="native">
+ <param name="sequence">wsrpconsumer_seq</param>
+ </generator>
+ </id>
+ <many-to-one
+ name="endpointConfigurationInfo"
+ column="ENDPOINT_ID"
+ class="org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo"
+ unique="true"
+ not-null="true"/>
+ <many-to-one
+ name="registrationInfo"
+ column="REGISTRATION_ID"
+ class="org.jboss.portal.wsrp.consumer.RegistrationInfo"
+ unique="true"
+ not-null="false"/>
+ <property
+ name="expirationCacheSeconds"
+ column="EXPIRATION_CACHE_SECONDS"
+ not-null="false"
+ unique="false"/>
+ <property
+ name="active"
+ column="ACTIVE"
+ not-null="true"
+ unique="false"/>
+ </class>
+
+ <class
+ name="org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo"
+ table="JBP_ENDPOINT_INFO">
+ <cache usage="@portal.hibernate.cache.usage@"/>
+ <id
+ name="key"
+ column="PK"
+ type="java.lang.Long">
+ <generator class="native">
+ <param name="sequence">wsrpconsumer_seq</param>
+ </generator>
+ </id>
+ <property
+ name="serviceDescriptionURL"
+ column="SD_URL"
+ type="java.lang.String"
+ not-null="true"/>
+ <property
+ name="markupURL"
+ column="M_URL"
+ type="java.lang.String"
+ not-null="true"/>
+ <property
+ name="portletManagementURL"
+ column="PM_URL"
+ type="java.lang.String"
+ not-null="true"/>
+ <property
+ name="registrationURL"
+ column="R_URL"
+ type="java.lang.String"
+ not-null="true"/>
+ <property
+ name="wsdlDefinitionURL"
+ column="WSDL_URL"
+ type="java.lang.String"
+ not-null="false"/>
+ </class>
+
+ <class
+ name="org.jboss.portal.wsrp.consumer.RegistrationInfo"
+ table="JBP_REGISTRATION_INFO">
+ <cache usage="@portal.hibernate.cache.usage@"/>
+ <id
+ name="key"
+ column="PK"
+ type="java.lang.Long">
+ <generator class="native">
+ <param name="sequence">wsrpconsumer_seq</param>
+ </generator>
+ </id>
+ <property
+ name="consumerName"
+ column="CONSUMER_NAME"
+ type="java.lang.String"
+ not-null="true"
+ unique="true"/>
+ <property
+ name="registrationHandle"
+ column="HANDLE"
+ type="java.lang.String"/>
+ <property
+ name="registrationState"
+ column="STATE"
+ type="binary"/>
+ <map
+ name="registrationProperties">
+ <cache usage="@portal.hibernate.cache.usage@"/>
+ <key column="REG_PROP_PK"/>
+ <map-key
+ type="string"
+ column="NAME"/>
+ <one-to-many class="org.jboss.portal.wsrp.consumer.RegistrationProperty"/>
+ </map>
+ </class>
+ <class
+ name="org.jboss.portal.wsrp.consumer.RegistrationProperty"
+ table="JBP_REG_PROPERTY">
+ <cache usage="@portal.hibernate.cache.usage@"/>
+ <id
+ name="key"
+ column="PK"
+ type="java.lang.Long">
+ <generator class="native">
+ <param name="sequence">wsrpconsumer_seq</param>
+ </generator>
+ </id>
+ <property
+ name="name"
+ column="NAME"
+ type="java.lang.String"
+ not-null="true"/>
+ <property
+ name="value"
+ column="VALUE"
+ type="java.lang.String"/>
+ <property
+ name="invalid"
+ column="INVALID"
+ type="boolean"/>
+ <property
+ name="lang"
+ column="LANG"
+ type="java.lang.String"/>
+ <many-to-one
+ name="description"
+ column="DESC_PK"
+ class="org.jboss.portal.wsrp.registration.RegistrationPropertyDescription"
+ not-null="true"
+ unique="true"/>
+ </class>
+ <class
+ name="org.jboss.portal.wsrp.registration.RegistrationPropertyDescription"
+ table="JBP_REG_PROP_DESC">
+ <cache usage="@portal.hibernate.cache.usage@"/>
+ <id
+ name="key"
+ column="PK"
+ type="java.lang.Long">
+ <generator class="native">
+ <param name="sequence">portlet_seq</param>
+ </generator>
+ </id>
+ <property
+ name="name"
+ column="NAME"
+ type="org.jboss.portal.jems.hibernate.QNameUserType"
+ not-null="true"/>
+ <property
+ name="type"
+ column="TYPE"
+ type="org.jboss.portal.jems.hibernate.QNameUserType"
+ not-null="true"/>
+ <property
+ name="schemaLocation"
+ column="SCHEMA"
+ type="java.lang.String"/>
+ <component
+ name="description"
+ class="org.jboss.portal.wsrp.registration.LocalizedString">
+ <property name="value" column="DESC_VALUE"/>
+ <property name="locale" column="DESC_LOCALE"/>
+ <property name="resourceName" column="DESC_RES"/>
+ </component>
+ <component
+ name="hint"
+ class="org.jboss.portal.wsrp.registration.LocalizedString">
+ <property name="value" column="HINT_VALUE"/>
+ <property name="locale" column="HINT_LOCALE"/>
+ <property name="resourceName" column="HINT_RES"/>
+ </component>
+ <component
+ name="label"
+ class="org.jboss.portal.wsrp.registration.LocalizedString">
+ <property name="value" column="LABEL_VALUE"/>
+ <property name="locale" column="LABEL_LOCALE"/>
+ <property name="resourceName" column="LABEL_RES"/>
+ </component>
+ <array
+ name="usages"
+ table="JBP_REG_PROP_DESC_USAGES"
+ cascade="all"
+ fetch="join">
+ <cache usage="@portal.hibernate.cache.usage@"/>
+ <key column="PK"/>
+ <index column="IDX"/>
+ <element
+ column="USAGE"
+ type="java.lang.String"
+ not-null="true"
+ unique="false"/>
+ </array>
+ <array
+ name="aliases"
+ table="JBP_REG_PROP_DESC_ALIASES"
+ cascade="all"
+ fetch="join">
+ <cache usage="@portal.hibernate.cache.usage@"/>
+ <key column="PK"/>
+ <index column="IDX"/>
+ <element
+ column="ALIAS"
+ type="org.jboss.portal.jems.hibernate.QNameUserType"
+ not-null="true"
+ unique="false"/>
+ </array>
+ </class>
+</hibernate-mapping>
Added: trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/ehcache.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/ehcache.xml (rev 0)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/ehcache.xml 2007-02-21 05:55:02 UTC (rev 6357)
@@ -0,0 +1,60 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<ehcache>
+
+ <!-- Sets the path to the directory where cache .data files are created.
+
+ If the path is a Java System Property it is replaced by
+ its value in the running VM.
+
+ The following properties are translated:
+ user.home - User's home directory
+ user.dir - User's current working directory
+ java.io.tmpdir - Default temp file path -->
+ <diskStore path="java.io.tmpdir/wsrpconsumer"/>
+
+
+ <!--Default Cache configuration. These will applied to caches programmatically created through
+ the CacheManager.
+
+ The following attributes are required for defaultCache:
+
+ maxInMemory - Sets the maximum number of objects that will be created in memory
+ eternal - Sets whether elements are eternal. If eternal, timeouts are ignored and the element
+ is never expired.
+ timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only used
+ if the element is not eternal. Idle time is now - last accessed time
+ timeToLiveSeconds - Sets the time to live for an element before it expires. Is only used
+ if the element is not eternal. TTL is now - creation time
+ overflowToDisk - Sets whether elements can overflow to disk when the in-memory cache
+ has reached the maxInMemory limit.
+
+ -->
+ <defaultCache
+ maxElementsInMemory="10000"
+ eternal="false"
+ timeToIdleSeconds="1800"
+ timeToLiveSeconds="1800"
+ overflowToDisk="false"
+ />
+</ehcache>
\ No newline at end of file
Added: trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/hibernate.cfg.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/hibernate.cfg.xml (rev 0)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/hibernate.cfg.xml 2007-02-21 05:55:02 UTC (rev 6357)
@@ -0,0 +1,58 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+<hibernate-configuration>
+ <session-factory>
+ <property name="connection.datasource">java:@portal.datasource.name@</property>
+ <property name="show_sql">@portal.sql.show@</property>
+ <property name="cache.use_second_level_cache">true</property>
+ <property name="cache.use_query_cache">true</property>
+
+ <!--
+ | Uncomment in clustered mode : use transactional replicated cache
+ @portal.single.xml.close@
+ <property name="cache.provider_class">org.jboss.portal.jems.hibernate.JMXTreeCacheProvider</property>
+ <property name="cache.object_name">portal:service=TreeCacheProvider,type=hibernate</property>
+ @portal.single.xml.open@
+ -->
+
+ <!--
+ | Comment in clustered mode
+ @portal.clustered.xml.close@
+ <property name="cache.provider_configuration_file_resource_path">conf/consumer/hibernate/ehcache.xml</property>
+ <property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
+ @portal.clustered.xml.open@
+ -->
+
+ <!-- Force the dialect instead of using autodetection -->
+ <!--
+ <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
+ -->
+
+ <!-- Mapping files -->
+ <mapping resource="conf/consumer/hibernate/domain.hbm.xml"/>
+ </session-factory>
+</hibernate-configuration>
\ No newline at end of file
Modified: trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsp/consumers/consumer.jsp
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsp/consumers/consumer.jsp 2007-02-20 22:07:16 UTC (rev 6356)
+++ trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsp/consumers/consumer.jsp 2007-02-21 05:55:02 UTC (rev 6357)
@@ -58,33 +58,33 @@
<tr>
<th class="portlet-form-field-label">Service Description URL:</th>
<td><input type="text" name='service-description-url' size='50'
- value='<%=endInfo.getServiceDescriptionInterfaceURL()%>'/></td>
+ value='<%=endInfo.getServiceDescriptionURL()%>'/></td>
</tr>
<tr>
<th class="portlet-form-field-label">Markup URL:</th>
- <td><input type="text" name='markup-url' size='50' value='<%=endInfo.getMarkupInterfaceURL()%>'/></td>
+ <td><input type="text" name='markup-url' size='50' value='<%=endInfo.getMarkupURL()%>'/></td>
</tr>
<tr>
<th class="portlet-form-field-label">Registration URL:</th>
<td><input type="text" name='registration-url' size='50'
- value='<%=endInfo.getRegistrationInterfaceURL()%>'/>
+ value='<%=endInfo.getRegistrationURL()%>'/>
</td>
</tr>
<tr>
<th class="portlet-form-field-label">Portlet Management URL:</th>
<td><input type="text" name='portlet-management-url' size='50'
- value='<%=endInfo.getPortletManagementInterfaceURL()%>'/></td>
+ value='<%=endInfo.getPortletManagementURL()%>'/></td>
</tr>
</table>
<input type="radio" name="endpoint" <%=usesWSDL ? "checked='true'" : ""%> value="endpoint-wsdl-url"/>
WSDL interface URL
<input type='text' style='display:<%=usesWSDL ? "inline;" : "none;"%>' name='endpoint-wsdl-url' size='50'
- value='<%=endInfo.getWSDLLocationIfAvailable()%>'/>
+ value='<%=endInfo.getWsdlDefinitionURL()%>'/>
</td>
</tr>
<tr>
<%
- boolean requiresReg = regInfo.requiresRegistration();
+ boolean requiresReg = regInfo.isRequiresRegistration();
%>
<th><input type='checkbox' name='registration' value='registration'
<%=requiresReg ? "checked='true'" : ""%>/>Requires registration?
@@ -112,7 +112,7 @@
for (Iterator names = propertyNames.iterator(); names.hasNext();)
{
String name = (String)names.next();
- RegistrationInfo.RegistrationProperty prop = regInfo.getRegistrationProperty(name);
+ org.jboss.portal.wsrp.consumer.RegistrationProperty prop = regInfo.getRegistrationProperty(name);
RegistrationPropertyDescription desc = prop.getDescription();
if (desc != null)
{
@@ -122,7 +122,7 @@
<tr>
<td><input type="text" size="25" name="<%=formName + propIndex%>" value="<%=name%>"/>
</td>
- <td><input type="text" size="25" name="<%=formValue + propIndex%>" value="<%=prop.getValueAsString()%>"/>
+ <td><input type="text" size="25" name="<%=formValue + propIndex%>" value="<%=prop.getValue()%>"/>
</td>
<td><%=description%>
</td>
19 years, 2 months
JBoss Portal SVN: r6356 - in trunk: identity/src/main/org/jboss/portal/identity/auth and 1 other directory.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-02-20 17:07:16 -0500 (Tue, 20 Feb 2007)
New Revision: 6356
Added:
trunk/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLoginModule.java
Modified:
trunk/core/src/resources/portal-core-sar/conf/login-config.xml
Log:
- added SynchronizingLoginModule
Modified: trunk/core/src/resources/portal-core-sar/conf/login-config.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/conf/login-config.xml 2007-02-20 22:00:51 UTC (rev 6355)
+++ trunk/core/src/resources/portal-core-sar/conf/login-config.xml 2007-02-20 22:07:16 UTC (rev 6356)
@@ -47,21 +47,6 @@
<module-option name="password-stacking">useFirstPass</module-option>
</login-module>
- <!--Uncomment this if you want to fall down to users kept in DB after LDAP authentication fails
- This may be usefull if you want to use Admin user provided with portal database schema-->
- <!--Note that this may lead to the security risk - with LDAP when storing user profile information
- that are not mapped as attribute you may have LDAP user synchronized into DB with no password set.
- Please see HibernateUserProfileImpl module options "synchronizeNonExistingUsers", "acceptOtherImplementations"
- "defaultSynchronizePassword" or "randomSynchronizePassword" to manage this behaviour-->
- <!--<login-module code = "org.jboss.portal.identity.auth.DBIdentityLoginModule" flag="sufficient">
- <module-option name="dsJndiName">java:/PortalDS</module-option>
- <module-option name="principalsQuery">SELECT jbp_password FROM jbp_users WHERE jbp_uname=?</module-option>
- <module-option name="rolesQuery">SELECT jbp_roles.jbp_name, 'Roles' FROM jbp_role_membership INNER JOIN jbp_roles ON jbp_role_membership.jbp_rid = jbp_roles.jbp_rid INNER JOIN jbp_users ON jbp_role_membership.jbp_uid = jbp_users.jbp_uid WHERE jbp_users.jbp_uname=?</module-option>
- <module-option name="hashAlgorithm">MD5</module-option>
- <module-option name="hashEncoding">HEX</module-option>
- <module-option name="additionalRole">Authenticated</module-option>
- </login-module>-->
-
<!--Use can use this module instead of IdentityLoginModule to bind to LDAP. It simply extends JBossSX LdapExtLoginModule so
all configuration that can be applied to LdapExtLoginModule also can be applied here. For user that
was authenticated successfully it will try to take identity modules from portal, check if such user (and roles it belongs to)
@@ -96,6 +81,37 @@
<module-option name="searchScope">SUBTREE_SCOPE</module-option>
<module-option name="allowEmptyPasswords">false</module-option>
</login-module>-->
+
+ <!--This login module should be placed at the end of authentication stack. It always returns
+ true in login() method so it should be always "optional" and exists after other "required" module in the stack.
+ It will try to synchronize authenticated user into portal store using portal identity modules. Each subject principal assigned
+ by previous modules will be tried to synchronize into portal as a role. -->
+ <!--<login-module code="org.jboss.portal.identity.auth.SynchronizingLoginModule" flag="optional">
+ <module-option name="synchronizeIdentity">true</module-option>
+ <module-option name="synchronizeRoles">true</module-option>
+ <module-option name="additionalRole">Authenticated</module-option>
+ <module-option name="defaultAssignedRole">User</module-option>
+ <module-option name="userModuleJNDIName">java:/portal/UserModule</module-option>
+ <module-option name="roleModuleJNDIName">java:/portal/RoleModule</module-option>
+ <module-option name="membershipModuleJNDIName">java:/portal/MembershipModule</module-option>
+ <module-option name="userProfileModuleJNDIName">java:/portal/UserProfileModule</module-option>
+ </login-module>-->
+
+ <!--Uncomment this if you want to fall down to users kept in DB if LDAP authentication fails
+ This may be usefull if you want to use Admin user provided with portal database schema-->
+ <!--Note that this may lead to the security risk - with LDAP when storing user profile information
+ that are not mapped as attribute you may have LDAP user synchronized into DB with no password set.
+ Please see HibernateUserProfileImpl module options "synchronizeNonExistingUsers", "acceptOtherImplementations"
+ "defaultSynchronizePassword" or "randomSynchronizePassword" to manage this behaviour-->
+ <!--<login-module code = "org.jboss.portal.identity.auth.DBIdentityLoginModule" flag="sufficient">
+ <module-option name="dsJndiName">java:/PortalDS</module-option>
+ <module-option name="principalsQuery">SELECT jbp_password FROM jbp_users WHERE jbp_uname=?</module-option>
+ <module-option name="rolesQuery">SELECT jbp_roles.jbp_name, 'Roles' FROM jbp_role_membership INNER JOIN jbp_roles ON jbp_role_membership.jbp_rid = jbp_roles.jbp_rid INNER JOIN jbp_users ON jbp_role_membership.jbp_uid = jbp_users.jbp_uid WHERE jbp_users.jbp_uname=?</module-option>
+ <module-option name="hashAlgorithm">MD5</module-option>
+ <module-option name="hashEncoding">HEX</module-option>
+ <module-option name="additionalRole">Authenticated</module-option>
+ </login-module>-->
+
</authentication>
</application-policy>
</policy>
Added: trunk/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLoginModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLoginModule.java (rev 0)
+++ trunk/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLoginModule.java 2007-02-20 22:07:16 UTC (rev 6356)
@@ -0,0 +1,395 @@
+/*
+* 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.identity.auth;
+
+import org.jboss.security.auth.spi.UsernamePasswordLoginModule;
+import org.jboss.security.SimpleGroup;
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.identity.MembershipModule;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.common.transaction.Transactions;
+
+import javax.security.auth.login.LoginException;
+import javax.security.auth.Subject;
+import javax.security.auth.callback.CallbackHandler;
+import javax.naming.InitialContext;
+import javax.transaction.TransactionManager;
+import java.security.acl.Group;
+import java.security.Principal;
+import java.util.Map;
+import java.util.Enumeration;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class SynchronizingLoginModule extends UsernamePasswordLoginModule
+{
+
+private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(SynchronizingLoginModule.class);
+
+ protected String additionalRole;
+ protected String defaultAssignedRole;
+ protected String synchronizeIdentity;
+ protected String synchronizeRoles;
+ protected String userModuleJNDIName;
+ protected String roleModuleJNDIName;
+ protected String membershipModuleJNDIName;
+ protected String userProfileModuleJNDIName;
+
+
+ private UserModule userModule;
+ private RoleModule roleModule;
+ private MembershipModule membershipModule;
+ private UserProfileModule userProfileModule;
+
+ private String userName;
+ private String password;
+
+ public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options)
+ {
+ super.initialize(subject, callbackHandler, sharedState, options);
+
+
+ userModuleJNDIName = (String)options.get("userModuleJNDIName");
+ roleModuleJNDIName = (String)options.get("roleModuleJNDIName");
+ membershipModuleJNDIName = (String)options.get("membershipModuleJNDIName");
+ userProfileModuleJNDIName = (String)options.get("userProfileModuleJNDIName");
+ additionalRole = (String)options.get("additionalRole");
+ synchronizeIdentity = (String)options.get("synchronizeIdentity");
+ synchronizeRoles = (String)options.get("synchronizeRoles");
+ defaultAssignedRole = (String)options.get("defaultAssignedRole");
+
+ // Some info
+ if (log.isTraceEnabled())
+ {
+ log.trace("additionalRole = " + additionalRole);
+ log.trace("userModuleJNDIName = " + userModuleJNDIName);
+ log.trace("roleModuleJNDIName = " + roleModuleJNDIName);
+ log.trace("membershipModuleJNDIName = " + membershipModuleJNDIName);
+ log.trace("userProfileModuleJNDIName = " + userProfileModuleJNDIName);
+ log.trace("synchronizeIdentity = " + synchronizeIdentity);
+ log.trace("synchronizeRoles = " + synchronizeRoles);
+ log.trace("defaultAssignedRole = " + defaultAssignedRole);
+ }
+ }
+
+ protected UserModule getUserModule() throws Exception
+ {
+ if (userModule == null)
+ {
+ userModule = (UserModule)new InitialContext().lookup(userModuleJNDIName);
+ }
+ if (userModule == null)
+ {
+ throw new IdentityException("Cannot obtain UserModule using JNDI name:" + userModuleJNDIName);
+ }
+
+ return userModule;
+ }
+
+ protected RoleModule getRoleModule() throws Exception
+ {
+
+ if (roleModule == null)
+ {
+ roleModule = (RoleModule)new InitialContext().lookup(roleModuleJNDIName);
+ }
+ if (roleModule == null)
+ {
+ throw new IdentityException("Cannot obtain RoleModule using JNDI name:" + roleModuleJNDIName);
+ }
+ return roleModule;
+ }
+
+ protected MembershipModule getMembershipModule() throws Exception
+ {
+
+ if (membershipModule == null)
+ {
+ membershipModule = (MembershipModule)new InitialContext().lookup(membershipModuleJNDIName);
+ }
+ if (membershipModule == null)
+ {
+ throw new IdentityException("Cannot obtain MembershipModule using JNDI name:" + membershipModuleJNDIName);
+ }
+ return membershipModule;
+ }
+
+ protected UserProfileModule getUserProfileModule() throws Exception
+ {
+
+ if (userProfileModule == null)
+ {
+ userProfileModule = (UserProfileModule)new InitialContext().lookup(userProfileModuleJNDIName);
+ }
+ if (userProfileModule == null)
+ {
+ throw new IdentityException("Cannot obtain UserProfileModule using JNDI name:" + userProfileModuleJNDIName);
+ }
+ return userProfileModule;
+ }
+
+ /**
+ * We must implement this - just return "" - it's ok as we override validatePassword
+ * @return
+ * @throws LoginException
+ */
+ protected String getUsersPassword() throws LoginException
+ {
+ return "";
+ }
+
+
+ /**
+ * This always returns true - so this module always pass.
+ * @param string
+ * @param string1
+ * @return
+ */
+ protected boolean validatePassword(String string, String string1)
+ {
+ return true;
+ }
+
+ /** Subclass to use the PortalPrincipal to make the username easier to retrieve by the portal. */
+ protected Principal createIdentity(String username) throws Exception
+ {
+ return new UserPrincipal(username);
+ }
+
+ protected Group[] getRoleSets() throws LoginException
+ {
+ Group group = new SimpleGroup("Roles");
+ if (additionalRole != null)
+ {
+ try
+ {
+ group.addMember(createIdentity(additionalRole));
+ }
+ catch (Exception e)
+ {
+ //just a try
+ log.error("Error when adding additional role: ", e);
+ }
+ }
+ return new Group[]{group};
+ }
+
+
+ public boolean commit() throws LoginException
+ {
+ if (isSynchronizeIdentity())
+ {
+ try
+ {
+ performSynchronization(getUsername(), getUsersPassword());
+ }
+ catch (Throwable e)
+ {
+ log.warn("Failed to sychronize identity of user: " + getUsername(), e);
+ }
+ }
+
+
+ return super.commit();
+ }
+
+ private void performSynchronization(final String name, final String password) throws Exception
+ {
+
+ log.debug("$$Synchronizing user: " + name);
+
+ try
+ {
+ TransactionManager tm = (TransactionManager)new InitialContext().lookup("java:/TransactionManager");
+ Transactions.required(tm, new Transactions.Runnable()
+ {
+ public Object run() throws Exception
+ {
+ try
+ {
+
+
+ User user = null;
+ //check if user exist
+ try
+ {
+
+ user = getUserModule().findUserByUserName(name);
+
+ //synchronize password from LDAP to DB
+ if (!user.validatePassword(password))
+ {
+ user.updatePassword(password);
+ }
+ }
+ catch (Exception e)
+ {
+ // nothing as user can simply not exist
+ }
+
+ //if not try to synchronize it
+ if (user == null)
+ {
+ user = getUserModule().createUser(name, password);
+ getUserProfileModule().setProperty(user, User.INFO_USER_ENABLED, Boolean.TRUE);
+
+ }
+
+ Set rolesToAssign = new HashSet();
+
+ //now check and try synchronize all the roles
+ if (isSynchronizeRoles())
+ {
+ //obtain user principals
+ Set principals = subject.getPrincipals();
+ Group roles = null;
+ for (Iterator iterator = principals.iterator(); iterator.hasNext();)
+ {
+ Object o = iterator.next();
+ if (!(o instanceof Group))
+ {
+ continue;
+ }
+ Group group = (Group)o;
+
+ if (group.getName().equals("Roles"))
+ {
+ roles = group;
+ break;
+ }
+ }
+
+ if (roles != null)
+ {
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("$$Processing Group: " + roles.getName());
+ Enumeration xx = roles.members();
+ while (xx.hasMoreElements())
+ {
+ Principal o = (Principal)xx.nextElement();
+ log.debug("$$Principal in group: " + o.getName() + "; " + o.toString());
+ }
+ }
+
+ //based on code implementation its just one SimpleGroup called "Roles"
+
+ Enumeration en = roles.members();
+ while (en.hasMoreElements())
+ {
+ Principal p = (Principal)en.nextElement();
+ String roleName = p.getName();
+ log.debug("$$Processing role principal object related to current user: " + roleName);
+ //check if such role is present
+
+ Role role = null;
+ try
+ {
+ role = getRoleModule().findRoleByName(roleName);
+ }
+ catch (Exception e)
+ {
+ //
+ }
+
+ if (role == null)
+ {
+ try
+ {
+ role = getRoleModule().createRole(roleName, roleName);
+ }
+ catch (Throwable e)
+ {
+ log.warn("Error when trying to synchronize role: " + roleName, e);
+ continue;
+ }
+ }
+
+ rolesToAssign.add(role);
+ }
+ }
+ }
+
+ if (defaultAssignedRole != null)
+ {
+ try
+ {
+ rolesToAssign.add(getRoleModule().findRoleByName(defaultAssignedRole));
+ }
+ catch(Exception e)
+ {
+ //
+ log.warn("Cannot find defaultAssignedRole: " + defaultAssignedRole, e);
+ }
+ }
+
+ if (rolesToAssign.size() > 0)
+ {
+ getMembershipModule().assignRoles(user, rolesToAssign);
+ }
+
+ return null;
+
+ }
+ catch (Exception e)
+ {
+ throw new LoginException(e.toString());
+ }
+ }
+ });
+ }
+ catch (Exception e)
+ {
+ Throwable cause = e.getCause();
+ throw new LoginException(cause.toString());
+ }
+ }
+
+ protected boolean isSynchronizeIdentity()
+ {
+ if (synchronizeIdentity != null && synchronizeIdentity.equalsIgnoreCase("false"))
+ {
+ return Boolean.FALSE.booleanValue();
+ }
+ return Boolean.TRUE.booleanValue();
+ }
+
+ protected boolean isSynchronizeRoles()
+ {
+ if (synchronizeRoles != null && synchronizeRoles.equalsIgnoreCase("false"))
+ {
+ return Boolean.FALSE.booleanValue();
+ }
+ return Boolean.TRUE.booleanValue();
+ }
+}
19 years, 2 months