JBoss Portal SVN: r11480 - in branches/JBoss_Portal_Branch_2_6_SYBASE/core/src: resources/portal-core-sar/conf/hibernate/portal and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-17 16:03:45 -0400 (Thu, 17 Jul 2008)
New Revision: 11480
Modified:
branches/JBoss_Portal_Branch_2_6_SYBASE/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectIdUserType.java
branches/JBoss_Portal_Branch_2_6_SYBASE/core/src/resources/portal-core-sar/conf/hibernate/portal/domain.hbm.xml
Log:
test
Modified: branches/JBoss_Portal_Branch_2_6_SYBASE/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectIdUserType.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6_SYBASE/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectIdUserType.java 2008-07-17 19:47:31 UTC (rev 11479)
+++ branches/JBoss_Portal_Branch_2_6_SYBASE/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectIdUserType.java 2008-07-17 20:03:45 UTC (rev 11480)
@@ -48,7 +48,7 @@
public String toString(Object value)
{
- return ((PortalObjectId)value).toString(PortalObjectPath.LEGACY_FORMAT);
+ return ((PortalObjectId)value).toString(PortalObjectPath.LEGACY_FORMAT).trim();
}
public Class returnedClass()
Modified: branches/JBoss_Portal_Branch_2_6_SYBASE/core/src/resources/portal-core-sar/conf/hibernate/portal/domain.hbm.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6_SYBASE/core/src/resources/portal-core-sar/conf/hibernate/portal/domain.hbm.xml 2008-07-17 19:47:31 UTC (rev 11479)
+++ branches/JBoss_Portal_Branch_2_6_SYBASE/core/src/resources/portal-core-sar/conf/hibernate/portal/domain.hbm.xml 2008-07-17 20:03:45 UTC (rev 11480)
@@ -41,7 +41,7 @@
<natural-id>
<property
name="path"
- column="`PATH`"
+ column="PATH_"
type="org.jboss.portal.core.impl.model.portal.PortalObjectIdUserType"
not-null="false"
unique="false"/>
15 years, 11 months
JBoss Portal SVN: r11479 - in modules/common/trunk/common/src: test/java/org/jboss/portal/test/common and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-07-17 15:47:31 -0400 (Thu, 17 Jul 2008)
New Revision: 11479
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/mx/JavaBeanModelMBeanBuilder.java
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/JavaBeanModelMBeanBuilderTestCase.java
Log:
- Fixed a bug where overriden setters and getters would be improperly detected as duplicated methods.
- Added more tests.
Modified: modules/common/trunk/common/src/main/java/org/jboss/portal/common/mx/JavaBeanModelMBeanBuilder.java
===================================================================
--- modules/common/trunk/common/src/main/java/org/jboss/portal/common/mx/JavaBeanModelMBeanBuilder.java 2008-07-17 19:35:49 UTC (rev 11478)
+++ modules/common/trunk/common/src/main/java/org/jboss/portal/common/mx/JavaBeanModelMBeanBuilder.java 2008-07-17 19:47:31 UTC (rev 11479)
@@ -22,6 +22,13 @@
******************************************************************************/
package org.jboss.portal.common.mx;
+import javax.management.Descriptor;
+import javax.management.modelmbean.ModelMBeanAttributeInfo;
+import javax.management.modelmbean.ModelMBeanConstructorInfo;
+import javax.management.modelmbean.ModelMBeanInfo;
+import javax.management.modelmbean.ModelMBeanInfoSupport;
+import javax.management.modelmbean.ModelMBeanNotificationInfo;
+import javax.management.modelmbean.ModelMBeanOperationInfo;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
@@ -31,14 +38,6 @@
import java.util.Map;
import java.util.Set;
-import javax.management.Descriptor;
-import javax.management.modelmbean.ModelMBeanAttributeInfo;
-import javax.management.modelmbean.ModelMBeanConstructorInfo;
-import javax.management.modelmbean.ModelMBeanInfo;
-import javax.management.modelmbean.ModelMBeanInfoSupport;
-import javax.management.modelmbean.ModelMBeanNotificationInfo;
-import javax.management.modelmbean.ModelMBeanOperationInfo;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -46,7 +45,7 @@
* @version $Revision: 7452 $
*/
public class JavaBeanModelMBeanBuilder
-{
+{
private final static String CURRENCY_TIME_LIMIT = "currencyTimeLimit";
private final static String GET_METHOD = "getMethod";
private final static String SET_METHOD = "setMethod";
@@ -56,6 +55,9 @@
private ArrayList mmais;
private ArrayList mmois;
private String className;
+ private static final String GET = "get";
+ private static final String IS = "is";
+ private static final String SET = "set";
public JavaBeanModelMBeanBuilder(Class from, Class to) throws Exception
{
@@ -87,119 +89,49 @@
//
for (Class c = from;c != null && !c.equals(to);c = c.getSuperclass())
{
- Map currentClassGetters = new HashMap();
- Map currentClassSetters = new HashMap();
+ Map<String,Method> currentClassGetters = new HashMap<String, Method>();
+ Map<String, Method> currentClassSetters = new HashMap<String, Method>();
Method[] methods = c.getDeclaredMethods();
- for (int i = 0; i < methods.length; i++)
+ for (Method method : methods)
{
- Method method = methods[i];
int modifiers = method.getModifiers();
if (Modifier.isPublic(modifiers) &&
- !Modifier.isAbstract(modifiers) &&
- !Modifier.isStatic(modifiers))
+ !Modifier.isAbstract(modifiers) &&
+ !Modifier.isStatic(modifiers))
{
String methodName = method.getName();
Class returnType = method.getReturnType();
Class[] parameterTypes = method.getParameterTypes();
- if (methodName.startsWith("get") &&
- !void.class.equals(returnType) &&
- parameterTypes.length == 0 &&
- methodName.length() > 3)
- {
- String propertyName = methodName.substring(3);
- // Try to locate an existing setter for the same property
- Method beanSetter = (Method)currentClassSetters.get(propertyName);
- if (beanSetter == null)
- {
- beanSetter = (Method)beanSetters.get(propertyName);
- }
-
- // Check we do not have a setter with a different return type
- if (beanSetter != null && !beanSetter.getParameterTypes()[0].equals(returnType))
- {
- throw new IllegalArgumentException("Property " + propertyName + " has a setter" +
- " type " + beanSetter.getParameterTypes()[0] + " different from the corresponding" +
- " getter type " + returnType);
- }
-
- // Get an existing bean getter
- Method beanGetter = (Method)currentClassGetters.get(propertyName);
- if (beanGetter != null)
- {
- throw new IllegalArgumentException("Property " + propertyName + " has two getters " +
- beanGetter + " and " + method);
- }
-
- //
- currentClassGetters.put(propertyName, method);
- }
- else if (methodName.startsWith("is") &&
- !void.class.equals(returnType) &&
- parameterTypes.length == 0 &&
- methodName.length() > 2)
+ int prefixLength = 0;
+ boolean isPotentialGetter = false;
+ if(methodName.startsWith(GET))
{
- String propertyName = methodName.substring(2);
-
- // Try to locate an existing setter for the same property
- Method beanSetter = (Method)beanSetters.get(propertyName);
- if (beanSetter != null)
- {
- beanSetter = (Method)currentClassSetters.get(propertyName);
- }
-
- // Check we do not have a setter with a different return type
- if (beanSetter != null && !beanSetter.getParameterTypes()[0].equals(returnType))
- {
- throw new IllegalArgumentException("Property " + propertyName + " has a setter" +
- " type " + beanSetter.getParameterTypes()[0] + " different from the corresponding" +
- " getter type " + returnType);
- }
-
- // Get an existing getter
- Method beanGetter = (Method)beanGetters.get(propertyName);
- if (beanGetter != null)
- {
- throw new IllegalArgumentException("Property " + propertyName + " has two getters " +
- beanGetter + " and " + method);
- }
-
- //
- currentClassGetters.put(propertyName, method);
+ prefixLength = 3;
+ isPotentialGetter = true;
}
- else if (methodName.startsWith("set") &&
- void.class.equals(returnType) &&
- parameterTypes.length == 1 &&
- methodName.length() > 3)
+ else if(methodName.startsWith(IS))
{
- String propertyName = methodName.substring(3);
+ prefixLength = 2;
+ isPotentialGetter = true;
+ } else if (methodName.startsWith(SET))
+ {
+ prefixLength = 3;
+ }
- // Try to locate an existing getter
- Method beanGetter = (Method)beanGetters.get(propertyName);
- if (beanGetter == null)
+ if (methodName.length() > prefixLength)
+ {
+ if (isPotentialGetter && !void.class.equals(returnType) && parameterTypes.length == 0)
{
- beanGetter = (Method)currentClassGetters.get(propertyName);
+ processPropertyOperation(method, currentClassGetters, currentClassSetters, beanSetters,
+ prefixLength, false);
}
-
- // Check we do not have a getter with a different return type
- if (beanGetter != null && !beanGetter.getReturnType().equals(parameterTypes[0]))
+ else if (methodName.startsWith(SET) && void.class.equals(returnType) && parameterTypes.length == 1)
{
- throw new IllegalArgumentException("Property " + propertyName + " has a setter" +
- " type " + parameterTypes[0] + " different from the corresponding" +
- " getter type " + beanGetter.getReturnType());
+ processPropertyOperation(method, currentClassSetters, currentClassGetters, beanGetters,
+ prefixLength, true);
}
-
- // Get an existing setter
- Method beanSetter = (Method)beanSetters.get(propertyName);
- if (beanSetter != null)
- {
- throw new IllegalArgumentException("Property " + propertyName + " cannot have two setters " +
- beanSetter + " and " + method);
- }
-
- //
- currentClassSetters.put(propertyName, method);
}
//
@@ -283,6 +215,63 @@
}
/**
+ * Process a property operation either setter or getter, checking for consistency. "Reverse" operation is defined here
+ * as a setter for a getter operation, and a getter for a setter operation.
+ * Hence, if we are currently checking a getter, <code>beanReverseOperations</code> will refer to known setters so far,
+ * <code>currentClassOperations</code> to the already known getter for this class at this hierachical level,
+ * <code>currentClassReverseOperations</code> to the already known setter for this class at this hierachical level.
+ *
+ * @param operation
+ * @param currentClassOperations known property operations for the hierarchy level being currently examined
+ * @param currentClassReverseOperations known property "reverse" operations for the hierarchy level being currently examined
+ * @param beanReverseOperations known "reverse" property operations for this bean
+ * @param prefixLength
+ * @param isSetter
+ */
+ private void processPropertyOperation(Method operation, Map<String, Method> currentClassOperations,
+ Map<String, Method> currentClassReverseOperations, Map beanReverseOperations,
+ int prefixLength, boolean isSetter)
+ {
+ String propertyName = operation.getName().substring(prefixLength);
+
+ // Try to locate an existing setter for the same property
+ Method reverseOp = currentClassReverseOperations.get(propertyName);
+ if (reverseOp == null)
+ {
+ reverseOp = (Method)beanReverseOperations.get(propertyName);
+ }
+
+ // check that if we know a reverse operation, the types match
+ if (reverseOp != null)
+ {
+ Class opType = isSetter ? operation.getParameterTypes()[0] : operation.getReturnType();
+ Class reverseOpType = isSetter ? reverseOp.getReturnType() : reverseOp.getParameterTypes()[0];
+ if (!reverseOpType.equals(opType))
+ {
+ throw new IllegalArgumentException("Property " + propertyName + " has a " + getterOrSetter(isSetter) +
+ " type " + reverseOpType + " different from the corresponding " + getterOrSetter(!isSetter) +
+ " type " + opType);
+ }
+ }
+
+ // Check that we don't have twice the same operation
+ Method op = currentClassOperations.get(propertyName);
+ if (op != null)
+ {
+ throw new IllegalArgumentException("Property " + propertyName + " has two " + getterOrSetter(isSetter) + "s " +
+ op + " and " + operation);
+ }
+
+ //
+ currentClassOperations.put(propertyName, operation);
+ }
+
+ private String getterOrSetter(boolean isSetter)
+ {
+ return isSetter ? "setter" : "getter";
+ }
+
+ /**
* Remove an interface from the management interface.
*/
public void remove(Class itf)
Modified: modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/JavaBeanModelMBeanBuilderTestCase.java
===================================================================
--- modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/JavaBeanModelMBeanBuilderTestCase.java 2008-07-17 19:35:49 UTC (rev 11478)
+++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/JavaBeanModelMBeanBuilderTestCase.java 2008-07-17 19:47:31 UTC (rev 11479)
@@ -25,20 +25,20 @@
import junit.framework.TestCase;
import org.jboss.portal.common.mx.JavaBeanModelMBeanBuilder;
+import javax.management.Attribute;
import javax.management.AttributeNotFoundException;
+import javax.management.Descriptor;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanOperationInfo;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.management.ObjectName;
-import javax.management.Attribute;
-import javax.management.Descriptor;
import javax.management.modelmbean.ModelMBeanInfo;
+import javax.management.modelmbean.ModelMBeanOperationInfo;
import javax.management.modelmbean.RequiredModelMBean;
-import javax.management.modelmbean.ModelMBeanOperationInfo;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
-import java.util.Arrays;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -131,10 +131,26 @@
Set ops = getOperations(info);
Set expectedOps = new HashSet();
expectedOps.add(TestOperation.newGetter("getTest", "java.util.Set"));
+ expectedOps.add(TestOperation.newGetter("isSet", "boolean"));
+ expectedOps.add(TestOperation.newSetter("setSet", "boolean"));
+ expectedOps.add(TestOperation.newSetter("setFoo", "java.lang.String"));
assertEquals(expectedOps, ops);
}
+ public void testMismatchedPropertyOperations()
+ {
+ try
+ {
+ JavaBeanModelMBeanBuilder builder = new JavaBeanModelMBeanBuilder(TestMismatchedSetterGetter.class, Object.class);
+ fail();
+ }
+ catch (Exception expected)
+ {
+ // expected
+ }
+ }
+
public void testAttributesAreNotCached() throws Exception
{
AttributesAreNotCached aanc = new AttributesAreNotCached();
@@ -337,6 +353,21 @@
//nothing
return new HashSet();
}
+
+ public boolean isSet()
+ {
+ return false;
+ }
+
+ public void setSet(boolean set)
+ {
+ // nothing
+ }
+
+ public void setFoo(String foo)
+ {
+ // nothing
+ }
}
public class TestOverridenExtend extends TestOverridenBase
@@ -346,8 +377,31 @@
//nothing
return new HashSet();
}
+
+ public boolean isSet()
+ {
+ return true;
+ }
+
+ public void setFoo(String foo)
+ {
+ // nothing
+ }
}
+ public class TestMismatchedSetterGetter
+ {
+ public void setFoo(String foo)
+ {
+ // nothing
+ }
+
+ public boolean getFoo()
+ {
+ return false;
+ }
+ }
+
public static class TestAttribute
{
15 years, 11 months
JBoss Portal SVN: r11478 - branches/JBoss_Portal_Branch_2_6_SYBASE/cms/src/resources/hibernate.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-17 15:35:49 -0400 (Thu, 17 Jul 2008)
New Revision: 11478
Modified:
branches/JBoss_Portal_Branch_2_6_SYBASE/cms/src/resources/hibernate/domain.hbm.xml
Log:
test
Modified: branches/JBoss_Portal_Branch_2_6_SYBASE/cms/src/resources/hibernate/domain.hbm.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6_SYBASE/cms/src/resources/hibernate/domain.hbm.xml 2008-07-17 19:04:16 UTC (rev 11477)
+++ branches/JBoss_Portal_Branch_2_6_SYBASE/cms/src/resources/hibernate/domain.hbm.xml 2008-07-17 19:35:49 UTC (rev 11478)
@@ -60,7 +60,7 @@
<property
name="data"
column="NODE_DATA"
- type="binary"
+ type="org.jboss.portal.jems.hibernate.MaterializedBlobType"
length="100000000"
not-null="true"/>
</class>
@@ -79,7 +79,7 @@
<property
name="data"
column="PROP_DATA"
- type="binary"
+ type="org.jboss.portal.jems.hibernate.MaterializedBlobType"
length="100000000"
not-null="true"/>
</class>
@@ -98,7 +98,7 @@
<property
name="data"
column="REFS_DATA"
- type="binary"
+ type="org.jboss.portal.jems.hibernate.MaterializedBlobType"
length="100000000"
not-null="true"/>
</class>
@@ -136,7 +136,7 @@
<property
name="data"
column="NODE_DATA"
- type="binary"
+ type="org.jboss.portal.jems.hibernate.MaterializedBlobType"
length="100000000"
not-null="true"/>
</class>
@@ -155,7 +155,7 @@
<property
name="data"
column="PROP_DATA"
- type="binary"
+ type="org.jboss.portal.jems.hibernate.MaterializedBlobType"
length="100000000"
not-null="true"/>
</class>
@@ -174,7 +174,7 @@
<property
name="data"
column="REFS_DATA"
- type="binary"
+ type="org.jboss.portal.jems.hibernate.MaterializedBlobType"
length="100000000"
not-null="true"/>
</class>
15 years, 11 months
JBoss Portal SVN: r11477 - branches/JBoss_Portal_Branch_2_6_SYBASE/testsuite.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-17 15:04:16 -0400 (Thu, 17 Jul 2008)
New Revision: 11477
Removed:
branches/JBoss_Portal_Branch_2_6_SYBASE/testsuite/apache-tomcat-5.5.26/
branches/JBoss_Portal_Branch_2_6_SYBASE/testsuite/jboss-4.2.2.GA/
branches/JBoss_Portal_Branch_2_6_SYBASE/testsuite/output/
Log:
clean
15 years, 11 months
JBoss Portal SVN: r11475 - in examples/trunk/JSFHelloUser: src/main/java/org/jboss/portal/portlet/samples and 4 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-17 07:47:56 -0400 (Thu, 17 Jul 2008)
New Revision: 11475
Added:
examples/trunk/JSFHelloUser/src/main/java/org/jboss/portal/portlet/samples/jsf/
examples/trunk/JSFHelloUser/src/main/java/org/jboss/portal/portlet/samples/jsf/UserBean.java
examples/trunk/JSFHelloUser/src/main/webapp/jsf/
examples/trunk/JSFHelloUser/src/main/webapp/jsf/edit.jsp
examples/trunk/JSFHelloUser/src/main/webapp/jsf/hello.jsp
examples/trunk/JSFHelloUser/src/main/webapp/jsf/help.jsp
examples/trunk/JSFHelloUser/src/main/webapp/jsf/welcome.jsp
Removed:
examples/trunk/JSFHelloUser/src/main/webapp/jsf/edit.jsp
examples/trunk/JSFHelloUser/src/main/webapp/jsf/hello.jsp
examples/trunk/JSFHelloUser/src/main/webapp/jsf/help.jsp
examples/trunk/JSFHelloUser/src/main/webapp/jsf/welcome.jsp
examples/trunk/JSFHelloUser/src/main/webapp/jsp/
Modified:
examples/trunk/JSFHelloUser/pom.xml
examples/trunk/JSFHelloUser/src/main/webapp/WEB-INF/portlet.xml
examples/trunk/JSFHelloUser/src/main/webapp/WEB-INF/web.xml
Log:
On the way to a simple portlet
Modified: examples/trunk/JSFHelloUser/pom.xml
===================================================================
--- examples/trunk/JSFHelloUser/pom.xml 2008-07-17 10:30:38 UTC (rev 11474)
+++ examples/trunk/JSFHelloUser/pom.xml 2008-07-17 11:47:56 UTC (rev 11475)
@@ -17,5 +17,32 @@
<version>2.0</version>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss.portletbridge</groupId>
+ <artifactId>portletbridge-api</artifactId>
+ <version>1.0.0.B3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portletbridge</groupId>
+ <artifactId>portletbridge-impl</artifactId>
+ <version>1.0.0.B3</version>
+ </dependency>
</dependencies>
+
+ <repositories>
+ <repository>
+ <id>JBoss repository</id>
+ <url>http://repository.jboss.com/maven2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+
+ </repositories>
+
</project>
\ No newline at end of file
Added: examples/trunk/JSFHelloUser/src/main/java/org/jboss/portal/portlet/samples/jsf/UserBean.java
===================================================================
--- examples/trunk/JSFHelloUser/src/main/java/org/jboss/portal/portlet/samples/jsf/UserBean.java (rev 0)
+++ examples/trunk/JSFHelloUser/src/main/java/org/jboss/portal/portlet/samples/jsf/UserBean.java 2008-07-17 11:47:56 UTC (rev 11475)
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.samples.jsf;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class UserBean
+{
+
+ private String userName;
+
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ public void setUserName(String userName)
+ {
+ this.userName = userName;
+ }
+
+}
+
Modified: examples/trunk/JSFHelloUser/src/main/webapp/WEB-INF/portlet.xml
===================================================================
--- examples/trunk/JSFHelloUser/src/main/webapp/WEB-INF/portlet.xml 2008-07-17 10:30:38 UTC (rev 11474)
+++ examples/trunk/JSFHelloUser/src/main/webapp/WEB-INF/portlet.xml 2008-07-17 11:47:56 UTC (rev 11475)
@@ -6,17 +6,31 @@
version="2.0">
<portlet>
<portlet-name>JSFHelloUserPortlet</portlet-name>
- <portlet-class>
- org.jboss.portal.portlet.samples.JSPHelloUserPortlet
- </portlet-class>
+ <portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
<supports>
- <mime-type>text/html</mime-type>
- <mode>view</mode>
- <mode>edit</mode>
- <mode>help</mode>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ <portlet-mode>edit</portlet-mode>
+ <portlet-mode>help</portlet-mode>
</supports>
<portlet-info>
- <title>JSF Hello User Portlet</title>
+ <title>JSF Hello User Portlet</title>
</portlet-info>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/jsf/welcome.jsp</value>
+ </init-param>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.edit</name>
+ <value>/jsf/edit.jsp</value>
+ </init-param>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.help</name>
+ <value>/jsf/help.jsp</value>
+ </init-param>
+
</portlet>
</portlet-app>
\ No newline at end of file
Modified: examples/trunk/JSFHelloUser/src/main/webapp/WEB-INF/web.xml
===================================================================
--- examples/trunk/JSFHelloUser/src/main/webapp/WEB-INF/web.xml 2008-07-17 10:30:38 UTC (rev 11474)
+++ examples/trunk/JSFHelloUser/src/main/webapp/WEB-INF/web.xml 2008-07-17 11:47:56 UTC (rev 11475)
@@ -1,4 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
-<web-app>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"
+ version="2.5">
+ <servlet>
+ <servlet-name>JSFServlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>JSFServlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+
</web-app>
Copied: examples/trunk/JSFHelloUser/src/main/webapp/jsf (from rev 11374, examples/trunk/JSFHelloUser/src/main/webapp/jsp)
Deleted: examples/trunk/JSFHelloUser/src/main/webapp/jsf/edit.jsp
===================================================================
--- examples/trunk/JSFHelloUser/src/main/webapp/jsp/edit.jsp 2008-07-09 17:54:14 UTC (rev 11374)
+++ examples/trunk/JSFHelloUser/src/main/webapp/jsf/edit.jsp 2008-07-17 11:47:56 UTC (rev 11475)
@@ -1,2 +0,0 @@
-<div class="portlet-section-header">Edit mode</div>
-<div class='Portlet-section-body">This is the edit mode, a convenient place to let the user change his portlet preferences.</div>
\ No newline at end of file
Copied: examples/trunk/JSFHelloUser/src/main/webapp/jsf/edit.jsp (from rev 11474, examples/trunk/JSFHelloUser/src/main/webapp/jsp/edit.jsp)
===================================================================
--- examples/trunk/JSFHelloUser/src/main/webapp/jsf/edit.jsp (rev 0)
+++ examples/trunk/JSFHelloUser/src/main/webapp/jsf/edit.jsp 2008-07-17 11:47:56 UTC (rev 11475)
@@ -0,0 +1,7 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+
+<f:view>
+<div class="portlet-section-header"><h:outputText value="Edit mode"/></div>
+<div class='Portlet-section-body">This is the edit mode, a convenient place to let the user change his portlet preferences.</div>
+</f:view>
\ No newline at end of file
Deleted: examples/trunk/JSFHelloUser/src/main/webapp/jsf/hello.jsp
===================================================================
--- examples/trunk/JSFHelloUser/src/main/webapp/jsp/hello.jsp 2008-07-09 17:54:14 UTC (rev 11374)
+++ examples/trunk/JSFHelloUser/src/main/webapp/jsf/hello.jsp 2008-07-17 11:47:56 UTC (rev 11475)
@@ -1,8 +0,0 @@
-<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
-<portlet:defineObjects/>
-
-<div class="portlet-section-header">Remember we love you: <%= renderRequest.getParameter("yourname") %></div>
-
-<portlet:renderURL var="myRenderURL"/>
-<br/>
-<a href="<%= myRenderURL %>">Ask me again</a></div>
Copied: examples/trunk/JSFHelloUser/src/main/webapp/jsf/hello.jsp (from rev 11474, examples/trunk/JSFHelloUser/src/main/webapp/jsp/hello.jsp)
===================================================================
--- examples/trunk/JSFHelloUser/src/main/webapp/jsf/hello.jsp (rev 0)
+++ examples/trunk/JSFHelloUser/src/main/webapp/jsf/hello.jsp 2008-07-17 11:47:56 UTC (rev 11475)
@@ -0,0 +1,12 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<f:view>
+<portlet:defineObjects/>
+
+<div class="portlet-section-header">Remember we love you: <h:outputText value="#{user.userName}"/>}</div>
+
+<br/>
+<h:commandLink action="back">
+ <h:outputText value="Ask Me Again"/>
+</h:commandLink>
+</f:view>
\ No newline at end of file
Deleted: examples/trunk/JSFHelloUser/src/main/webapp/jsf/help.jsp
===================================================================
--- examples/trunk/JSFHelloUser/src/main/webapp/jsp/help.jsp 2008-07-09 17:54:14 UTC (rev 11374)
+++ examples/trunk/JSFHelloUser/src/main/webapp/jsf/help.jsp 2008-07-17 11:47:56 UTC (rev 11475)
@@ -1,2 +0,0 @@
-<div class="portlet-section-header">Help mode</div>
-<div class='Portlet-section-body">This is the help mode, a convenient place to give the user some help information.</div>
\ No newline at end of file
Copied: examples/trunk/JSFHelloUser/src/main/webapp/jsf/help.jsp (from rev 11474, examples/trunk/JSFHelloUser/src/main/webapp/jsp/help.jsp)
===================================================================
--- examples/trunk/JSFHelloUser/src/main/webapp/jsf/help.jsp (rev 0)
+++ examples/trunk/JSFHelloUser/src/main/webapp/jsf/help.jsp 2008-07-17 11:47:56 UTC (rev 11475)
@@ -0,0 +1,6 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<f:view>
+<div class="portlet-section-header">Help mode</div>
+<div class='Portlet-section-body">This is the help mode, a convenient place to give the user some help information.</div>
+</f:view>
\ No newline at end of file
Deleted: examples/trunk/JSFHelloUser/src/main/webapp/jsf/welcome.jsp
===================================================================
--- examples/trunk/JSFHelloUser/src/main/webapp/jsp/welcome.jsp 2008-07-09 17:54:14 UTC (rev 11374)
+++ examples/trunk/JSFHelloUser/src/main/webapp/jsf/welcome.jsp 2008-07-17 11:47:56 UTC (rev 11475)
@@ -1,35 +0,0 @@
-<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
-
-<div class="portlet-section-header">Welcome !</div>
-
-<br/>
-
-<div class="portlet-font">Welcome on the JSP Hello User portlet,
-my name is JBoss Portal. What's yours ?</div>
-
-<br/>
-
-<div class="portlet-font">Method 1: We simply pass the parameter to the render phase:<br/>
-<a href="<portlet:renderURL><portlet:param name="yourname" value="John Doe"/></portlet:renderURL>">John Doe</a></div>
-
-<br/>
-
-<div class="portlet-font">Method 2: We pass the parameter to the render phase, using valid XML:
-Please check the source code to see the difference with Method 1.
-<portlet:renderURL var="myRenderURL">
- <portlet:param name="yourname" value='John Doe'/>
-</portlet:renderURL>
-<br/>
-<a href="<%= myRenderURL %>">John Doe</a></div>
-
-<br/>
-
-<div class="portlet-font">Method 3: We use a form:<br/>
-
-<portlet:actionURL var="myActionURL"/>
-<form action="<%= myActionURL %>" method="POST">
- <span class="portlet-form-field-label">Name:</span>
- <input class="portlet-form-input-field" type="text" name="yourname"/>
- <input class="portlet-form-button" type="Submit"/>
-</form>
-</div>
\ No newline at end of file
Copied: examples/trunk/JSFHelloUser/src/main/webapp/jsf/welcome.jsp (from rev 11474, examples/trunk/JSFHelloUser/src/main/webapp/jsp/welcome.jsp)
===================================================================
--- examples/trunk/JSFHelloUser/src/main/webapp/jsf/welcome.jsp (rev 0)
+++ examples/trunk/JSFHelloUser/src/main/webapp/jsf/welcome.jsp 2008-07-17 11:47:56 UTC (rev 11475)
@@ -0,0 +1,20 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+
+<f:view>
+
+<div class="portlet-section-header">Welcome !</div>
+
+<br/>
+
+<div class="portlet-font">Welcome on the JSP Hello User portlet,
+my name is JBoss Portal. What's yours ?</div>
+
+<br/>
+
+<h:form>
+ <h:inputText value="#{user.userName}"/>
+ <h:commandButton action="sayHello" value="Say Hello"/>
+</h:form>
+
+</f:view>
\ No newline at end of file
15 years, 11 months
JBoss Portal SVN: r11474 - branches/JBoss_Portal_Branch_2_7/build.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-17 06:30:38 -0400 (Thu, 17 Jul 2008)
New Revision: 11474
Modified:
branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml
Log:
Upgrade hibernate
Modified: branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml 2008-07-17 10:29:52 UTC (rev 11473)
+++ branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml 2008-07-17 10:30:38 UTC (rev 11474)
@@ -72,7 +72,7 @@
<componentref name="facelets" version="1.1.15-B1"/>
<componentref name="richfaces" version="3.2.1.GA"/>
<componentref name="jboss/portlet-bridge" version="1.0.0.B3"/>
- <componentref name="hibernate" version="3.2.0.CR2"/>
+ <componentref name="hibernate" version="3.2.4.SP1"/>
<componentref name="httpunit" version="1.6"/>
<componentref name="hsqldb" version="1.8.0.2"/>
<componentref name="ibm-wsdl4j" version="1.6.2"/>
15 years, 11 months
JBoss Portal SVN: r11473 - in branches/JBoss_Portal_Branch_2_7: core/src/resources/portal-core-sar/conf/hibernate/portal and 1 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-17 06:29:52 -0400 (Thu, 17 Jul 2008)
New Revision: 11473
Added:
branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/DialectFactory.java
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/hibernate/instance/domain.hbm.xml
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/hibernate/portal/domain.hbm.xml
branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java
Log:
- Sybase fixings
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/hibernate/instance/domain.hbm.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/hibernate/instance/domain.hbm.xml 2008-07-17 10:10:18 UTC (rev 11472)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/hibernate/instance/domain.hbm.xml 2008-07-17 10:29:52 UTC (rev 11473)
@@ -69,7 +69,7 @@
fetch="join">
<cache usage="@portal.hibernate.cache.usage@"/>
<key column="INSTANCE_PK"/>
- <index column="ROLE" type="string"/>
+ <index column="`ROLE`" type="string"/>
<one-to-many class="org.jboss.portal.core.impl.model.instance.persistent.PersistentRoleSecurityBinding"/>
</map>
<map
@@ -148,7 +148,7 @@
</id>
<property
name="role"
- column="ROLE"
+ column="`ROLE`"
not-null="true"
unique="false"/>
<set
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/hibernate/portal/domain.hbm.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/hibernate/portal/domain.hbm.xml 2008-07-17 10:10:18 UTC (rev 11472)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/hibernate/portal/domain.hbm.xml 2008-07-17 10:29:52 UTC (rev 11473)
@@ -41,7 +41,7 @@
<natural-id>
<property
name="path"
- column="PATH"
+ column="`PATH`"
type="org.jboss.portal.core.impl.model.portal.PortalObjectIdUserType"
not-null="false"
unique="false"/>
@@ -83,7 +83,7 @@
<cache usage="@portal.hibernate.cache.usage@"/>
<key column="NODE_KEY"/>
<index
- column="ROLE"
+ column="`ROLE`"
type="string"/>
<one-to-many class="org.jboss.portal.core.impl.model.portal.ObjectNodeSecurityConstraint"/>
</map>
@@ -191,7 +191,7 @@
</id>
<property
name="role"
- column="ROLE"
+ column="`ROLE`"
not-null="true"
unique="false"/>
<set
Copied: branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/DialectFactory.java (from rev 11462, branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/DialectFactory.java)
===================================================================
--- branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/DialectFactory.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/DialectFactory.java 2008-07-17 10:29:52 UTC (rev 11473)
@@ -0,0 +1,119 @@
+/******************************************************************************
+ * 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.jems.hibernate;
+
+import org.hibernate.HibernateException;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Ripped off hibernate 3.1 that is not in 3.0. A factory for generating Dialect instances.
+ *
+ * @author Steve Ebersole
+ * @version $Revision$
+ */
+public class DialectFactory
+{
+
+
+ private DialectFactory()
+ {
+ }
+
+ /**
+ * Determine the appropriate Dialect to use given the database product name and major version.
+ *
+ * @param databaseName The name of the database product (obtained from metadata).
+ * @param databaseMajorVersion The major version of the database product (obtained from metadata).
+ * @return An appropriate dialect instance.
+ */
+ public static String determineDialect(String databaseName, int databaseMajorVersion)
+ {
+ if (databaseName == null)
+ {
+ throw new HibernateException("Hibernate Dialect must be explicitly set");
+ }
+
+ DatabaseDialectMapper mapper = (DatabaseDialectMapper)MAPPERS.get(databaseName);
+ if (mapper == null)
+ {
+ throw new HibernateException("Hibernate Dialect must be explicitly set for database: " + databaseName);
+ }
+
+ return mapper.getDialectClass(databaseMajorVersion);
+ }
+
+ /**
+ * For a given database product name, instances of DatabaseDialectMapper know which Dialect to use for different
+ * versions.
+ */
+ public static interface DatabaseDialectMapper
+ {
+ public String getDialectClass(int majorVersion);
+ }
+
+ /** A simple DatabaseDialectMapper for dialects which are independent of the underlying database product version. */
+ public static class VersionInsensitiveMapper implements DatabaseDialectMapper
+ {
+ private String dialectClassName;
+
+ public VersionInsensitiveMapper(String dialectClassName)
+ {
+ this.dialectClassName = dialectClassName;
+ }
+
+ public String getDialectClass(int majorVersion)
+ {
+ return dialectClassName;
+ }
+ }
+
+ private static final Map MAPPERS = new HashMap();
+
+ static
+ {
+ // TODO : this is the stuff it'd be nice to move to a properties file or some other easily user-editable place
+ MAPPERS.put("HSQL Database Engine", new VersionInsensitiveMapper("org.hibernate.dialect.HSQLDialect"));
+ MAPPERS.put("DB2/NT", new VersionInsensitiveMapper("org.hibernate.dialect.DB2Dialect"));
+ MAPPERS.put("MySQL", new VersionInsensitiveMapper("org.hibernate.dialect.MySQLDialect"));
+ MAPPERS.put("PostgreSQL", new VersionInsensitiveMapper("org.hibernate.dialect.PostgreSQLDialect"));
+ MAPPERS.put("Microsoft SQL Server Database", new VersionInsensitiveMapper("org.hibernate.dialect.SQLServerDialect"));
+ MAPPERS.put("Microsoft SQL Server", new VersionInsensitiveMapper("org.hibernate.dialect.SQLServerDialect"));
+ MAPPERS.put("Sybase SQL Server", new VersionInsensitiveMapper("org.hibernate.dialect.SybaseDialect"));
+ MAPPERS.put("Informix Dynamic Server", new VersionInsensitiveMapper("org.hibernate.dialect.InformixDialect"));
+
+ MAPPERS.put(
+ "Oracle",
+ new DatabaseDialectMapper()
+ {
+ public String getDialectClass(int majorVersion)
+ {
+ return majorVersion > 8
+ ? "org.hibernate.dialect.Oracle9Dialect"
+ : "org.hibernate.dialect.OracleDialect";
+ }
+ }
+ );
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java 2008-07-17 10:10:18 UTC (rev 11472)
+++ branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java 2008-07-17 10:29:52 UTC (rev 11473)
@@ -22,22 +22,13 @@
******************************************************************************/
package org.jboss.portal.jems.hibernate;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.util.Collection;
-import java.util.Iterator;
-
-import javax.naming.InitialContext;
-import javax.sql.DataSource;
-
+import bsh.EvalError;
+import bsh.Interpreter;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
-import org.hibernate.dialect.DialectFactory;
import org.hibernate.exception.SQLGrammarException;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.tool.hbm2ddl.SchemaExport;
@@ -48,8 +39,14 @@
import org.jboss.portal.common.util.LoaderResource;
import org.jboss.portal.jems.as.system.AbstractJBossService;
-import bsh.EvalError;
-import bsh.Interpreter;
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.util.Collection;
+import java.util.Iterator;
/**
* Configures and binds the hibernate session factory.
@@ -233,7 +230,7 @@
DatabaseMetaData meta = conn.getMetaData();
String databaseName = meta.getDatabaseProductName();
int databaseMajorVersion = getDatabaseMajorVersion(meta);
- dialectName = DialectFactory.determineDialect(databaseName, databaseMajorVersion).getClass().getCanonicalName();
+ dialectName = DialectFactory.determineDialect(databaseName, databaseMajorVersion);
config.setProperty(Environment.DIALECT, dialectName);
log.debug("Detected dialect " + dialectName + ", database is (" + databaseName + "," + databaseMajorVersion + ")");
}
15 years, 11 months
JBoss Portal SVN: r11472 - in branches/JBoss_Portal_Branch_2_6: core/src/resources/portal-core-sar/conf/hibernate/portal and 1 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-17 06:10:18 -0400 (Thu, 17 Jul 2008)
New Revision: 11472
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/hibernate/instance/domain.hbm.xml
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/hibernate/portal/domain.hbm.xml
branches/JBoss_Portal_Branch_2_6/jems/src/main/org/jboss/portal/jems/hibernate/DialectFactory.java
Log:
Fixes for Sybase ASE
Modified: branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/hibernate/instance/domain.hbm.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/hibernate/instance/domain.hbm.xml 2008-07-17 08:12:53 UTC (rev 11471)
+++ branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/hibernate/instance/domain.hbm.xml 2008-07-17 10:10:18 UTC (rev 11472)
@@ -60,7 +60,7 @@
column="SER_STATE"
not-null="false"
unique="false"
- length="50000000"/>
+ length="16384"/>
<map
name="relatedSecurityBindings"
sort="unsorted"
@@ -69,7 +69,7 @@
fetch="join">
<cache usage="@portal.hibernate.cache.usage@"/>
<key column="INSTANCE_PK"/>
- <index column="ROLE" type="string"/>
+ <index column="`ROLE`" type="string"/>
<one-to-many class="org.jboss.portal.core.impl.model.instance.persistent.PersistentRoleSecurityBinding"/>
</map>
<map
@@ -117,7 +117,7 @@
column="SER_STATE"
not-null="false"
unique="false"
- length="50000000"/>
+ length="16384"/>
<properties
name="user_and_portlet_ref"
unique="true">
@@ -148,7 +148,7 @@
</id>
<property
name="role"
- column="ROLE"
+ column="`ROLE`"
not-null="true"
unique="false"/>
<set
Modified: branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/hibernate/portal/domain.hbm.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/hibernate/portal/domain.hbm.xml 2008-07-17 08:12:53 UTC (rev 11471)
+++ branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/hibernate/portal/domain.hbm.xml 2008-07-17 10:10:18 UTC (rev 11472)
@@ -41,7 +41,7 @@
<natural-id>
<property
name="path"
- column="PATH"
+ column="`PATH`"
type="org.jboss.portal.core.impl.model.portal.PortalObjectIdUserType"
not-null="false"
unique="false"/>
@@ -83,7 +83,7 @@
<cache usage="@portal.hibernate.cache.usage@"/>
<key column="NODE_KEY"/>
<index
- column="ROLE"
+ column="`ROLE`"
type="string"/>
<one-to-many class="org.jboss.portal.core.impl.model.portal.ObjectNodeSecurityConstraint"/>
</map>
@@ -191,7 +191,7 @@
</id>
<property
name="role"
- column="ROLE"
+ column="`ROLE`"
not-null="true"
unique="false"/>
<set
Modified: branches/JBoss_Portal_Branch_2_6/jems/src/main/org/jboss/portal/jems/hibernate/DialectFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/jems/src/main/org/jboss/portal/jems/hibernate/DialectFactory.java 2008-07-17 08:12:53 UTC (rev 11471)
+++ branches/JBoss_Portal_Branch_2_6/jems/src/main/org/jboss/portal/jems/hibernate/DialectFactory.java 2008-07-17 10:10:18 UTC (rev 11472)
@@ -98,22 +98,20 @@
MAPPERS.put("DB2/NT", new VersionInsensitiveMapper("org.hibernate.dialect.DB2Dialect"));
MAPPERS.put("MySQL", new VersionInsensitiveMapper("org.hibernate.dialect.MySQLDialect"));
MAPPERS.put("PostgreSQL", new VersionInsensitiveMapper("org.hibernate.dialect.PostgreSQLDialect"));
- MAPPERS.put("Microsoft SQL Server Database", new VersionInsensitiveMapper("org.hibernate.dialect.SQLServerDialect"));
+ MAPPERS.put("Microsoft SQL Server Database", new VersionInsensitiveMapper(
+ "org.hibernate.dialect.SQLServerDialect"));
MAPPERS.put("Microsoft SQL Server", new VersionInsensitiveMapper("org.hibernate.dialect.SQLServerDialect"));
MAPPERS.put("Sybase SQL Server", new VersionInsensitiveMapper("org.hibernate.dialect.SybaseDialect"));
+ MAPPERS.put("Adaptive Server Enterprise", new VersionInsensitiveMapper("org.hibernate.dialect.SybaseDialect"));
MAPPERS.put("Informix Dynamic Server", new VersionInsensitiveMapper("org.hibernate.dialect.InformixDialect"));
- MAPPERS.put(
- "Oracle",
- new DatabaseDialectMapper()
+ MAPPERS.put("Oracle", new DatabaseDialectMapper()
+ {
+ public String getDialectClass(int majorVersion)
{
- public String getDialectClass(int majorVersion)
- {
- return majorVersion > 8
- ? "org.hibernate.dialect.Oracle9Dialect"
- : "org.hibernate.dialect.OracleDialect";
- }
+ return majorVersion > 8 ? "org.hibernate.dialect.Oracle9Dialect" : "org.hibernate.dialect.OracleDialect";
}
- );
+ });
+
}
}
15 years, 11 months
JBoss Portal SVN: r11471 - branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-17 04:12:53 -0400 (Thu, 17 Jul 2008)
New Revision: 11471
Modified:
branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java
Log:
Rollback, it didn't try to guess the Hibernate Dialect. Don't know why so far
Modified: branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java 2008-07-16 21:01:37 UTC (rev 11470)
+++ branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java 2008-07-17 08:12:53 UTC (rev 11471)
@@ -24,14 +24,20 @@
import java.lang.reflect.Method;
import java.net.URL;
+import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.util.Collection;
import java.util.Iterator;
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.dialect.DialectFactory;
import org.hibernate.exception.SQLGrammarException;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.tool.hbm2ddl.SchemaExport;
@@ -213,6 +219,31 @@
/** During this step the session factory is created and the content creation is triggered. */
protected void startService() throws Exception
{
+ // Detect the dialect if necessary
+ dialectName = config.getProperty(Environment.DIALECT);
+ if (dialectName == null)
+ {
+ String dataSourceJNDI = config.getProperty(Environment.DATASOURCE);
+ log.debug("Detecting dialect with datasource " + dataSourceJNDI + " ...");
+ DataSource ds = (DataSource)new InitialContext().lookup(dataSourceJNDI);
+ Connection conn = null;
+ try
+ {
+ conn = ds.getConnection();
+ DatabaseMetaData meta = conn.getMetaData();
+ String databaseName = meta.getDatabaseProductName();
+ int databaseMajorVersion = getDatabaseMajorVersion(meta);
+ dialectName = DialectFactory.determineDialect(databaseName, databaseMajorVersion).getClass().getCanonicalName();
+ config.setProperty(Environment.DIALECT, dialectName);
+ log.debug("Detected dialect " + dialectName + ", database is (" + databaseName + "," + databaseMajorVersion + ")");
+ }
+ finally
+ {
+ IOTools.safeClose(conn);
+ }
+ }
+ log.debug("Using dialect " + dialectName);
+
//
createSessionFactory();
15 years, 11 months
JBoss Portal SVN: r11470 - branches/JBoss_Portal_Branch_2_7/core-cms/src/main/org/jboss/portal/core/cms/ui.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-07-16 17:01:37 -0400 (Wed, 16 Jul 2008)
New Revision: 11470
Modified:
branches/JBoss_Portal_Branch_2_7/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
Log:
adding support for more than just .html relative links within the rendered CMS content
Modified: branches/JBoss_Portal_Branch_2_7/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2008-07-16 20:58:03 UTC (rev 11469)
+++ branches/JBoss_Portal_Branch_2_7/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2008-07-16 21:01:37 UTC (rev 11470)
@@ -255,7 +255,11 @@
{
String relURI = m.group(3) != null ? m.group(3) : m.group(4);
URLFactory urlFactory = resourceURLFactory;
- if (relURI.endsWith(".html"))
+ if (
+ relURI.endsWith(".html") ||
+ relURI.endsWith(".htm") ||
+ relURI.endsWith(".xhtml")
+ )
{
urlFactory = textURLFactory;
}
15 years, 11 months