db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r580998 - in /db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb: constraints/ model/
Date Mon, 01 Oct 2007 16:05:36 GMT
Author: arminw
Date: Mon Oct  1 09:05:27 2007
New Revision: 580998

URL: http://svn.apache.org/viewvc?rev=580998&view=rev
Log:
- get rid of commos-lang dependency
- fix super-reference automatic super-class detection

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ClassDescriptorConstraints.java
    db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java
    db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/model/ClassDescriptorDef.java
    db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/model/PropertyHelper.java
    db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/model/ReferenceDescriptorDef.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ClassDescriptorConstraints.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ClassDescriptorConstraints.java?rev=580998&r1=580997&r2=580998&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ClassDescriptorConstraints.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ClassDescriptorConstraints.java
Mon Oct  1 09:05:27 2007
@@ -22,12 +22,18 @@
 
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Properties;
 
 import xdoclet.modules.ojb.CommaListIterator;
 import xdoclet.modules.ojb.LogHelper;
-import xdoclet.modules.ojb.model.*;
-import org.apache.commons.lang.SystemUtils;
+import xdoclet.modules.ojb.model.ClassDescriptorDef;
+import xdoclet.modules.ojb.model.FeatureDescriptorDef;
+import xdoclet.modules.ojb.model.ObjectCacheDef;
+import xdoclet.modules.ojb.model.ProcedureArgumentDef;
+import xdoclet.modules.ojb.model.ProcedureDef;
+import xdoclet.modules.ojb.model.PropertyHelper;
 
 /**
  * Checks constraints for class descriptors. Note that constraints may modify the class descriptor.
@@ -173,7 +179,7 @@
             }
             else if(curExtent.hasSuperReference())
             {
-                String eol = SystemUtils.LINE_SEPARATOR;
+                String eol = PropertyHelper.LINE_SEPARATOR;
                 String msg = new StringBuffer().append("Sub-class ").append(curExtent.getName())
                         .append(" declare a 'super-reference' to class ").append(classDef.getName())
                         .append(eol).append("If table per sub-class inheritance is used,
it's not allowed to use the 'extent' attribute in class ")

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java?rev=580998&r1=580997&r2=580998&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java
Mon Oct  1 09:05:27 2007
@@ -425,7 +425,7 @@
         ClassDescriptorDef cld = (ClassDescriptorDef) fieldDef.getOwner();
         if(fieldDef.isPrimaryKey() && cld.hasSuperReference() && !cld.hasSuperReferenceViaForeignKey())
         {
-            String eol = SystemUtils.LINE_SEPARATOR;
+            String eol = PropertyHelper.LINE_SEPARATOR;
             LogHelper.warn(true,
                        FieldDescriptorConstraints.class,
                        "checkTablePerSubclass",

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/model/ClassDescriptorDef.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/model/ClassDescriptorDef.java?rev=580998&r1=580997&r2=580998&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/model/ClassDescriptorDef.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/model/ClassDescriptorDef.java
Mon Oct  1 09:05:27 2007
@@ -20,13 +20,23 @@
  */
 
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.SortedMap;
+import java.util.TreeMap;
 
 import xdoclet.modules.ojb.CommaListIterator;
 import xdoclet.modules.ojb.LogHelper;
-import xdoclet.modules.ojb.constraints.*;
+import xdoclet.modules.ojb.constraints.ClassDescriptorConstraints;
+import xdoclet.modules.ojb.constraints.CollectionDescriptorConstraints;
+import xdoclet.modules.ojb.constraints.ConstraintException;
+import xdoclet.modules.ojb.constraints.FieldDescriptorConstraints;
+import xdoclet.modules.ojb.constraints.ReferenceDescriptorConstraints;
 import xjavadoc.XClass;
-import org.apache.commons.lang.SystemUtils;
 
 /**
  * Definition of a class for the ojb repository file.
@@ -162,7 +172,7 @@
 
             if(hasSuperReference())
             {
-                String eol = SystemUtils.LINE_SEPARATOR;
+                String eol = PropertyHelper.LINE_SEPARATOR;
                 String msg = new StringBuffer().append("This class ").append(getName())
                         .append(" is a sub-class and declare a 'super-reference' to its super
class").append(eol)
                         .append("If table per sub-class inheritance is used, it's not allowed
to include non-primary key inherited fields in the sub-class.")
@@ -653,7 +663,7 @@
         ReferenceDescriptorDef subClassSuperRef = subType.getSuperReference();
         if(subClassSuperRef != null && subClassSuperRef.isTablePerSubclass())
         {
-            String eol = SystemUtils.LINE_SEPARATOR;
+            String eol = PropertyHelper.LINE_SEPARATOR;
             String msg = new StringBuffer().append("Sub-class ").append(subType.getName())
                     .append(" declare a 'super-reference' to class ").append(getName()).append(eol)
                     .append("If table per sub-class inheritance is used, it's not allowed
to declare an 'extent' attribute in class ")

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/model/PropertyHelper.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/model/PropertyHelper.java?rev=580998&r1=580997&r2=580998&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/model/PropertyHelper.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/model/PropertyHelper.java
Mon Oct  1 09:05:27 2007
@@ -27,6 +27,8 @@
  */
 public abstract class PropertyHelper
 {
+    public static final String LINE_SEPARATOR = getSystemProperty("line.separator");
+
     // ojb repository properties
 
     public static final String OJB_PROPERTY_STATE_DETECTION                 = "state-detection";
@@ -276,5 +278,21 @@
     public static boolean toBoolean(String value, boolean defaultValue)
     {
         return "true".equals(value) ? true : ("false".equals(value) ? false : defaultValue);
+    }
+
+    // copied from apache commons-lang
+    private static String getSystemProperty(String property)
+    {
+        try
+        {
+            return System.getProperty(property);
+        } catch (SecurityException ex)
+        {
+            // we are not allowed to look at this property
+            System.err.println(
+                "Caught a SecurityException reading the system property '" + property
+                + "'; the SystemUtils property value will default to null.");
+            return null;
+        }
     }
 }

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/model/ReferenceDescriptorDef.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/model/ReferenceDescriptorDef.java?rev=580998&r1=580997&r2=580998&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/model/ReferenceDescriptorDef.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/xdoclet/java/src/xdoclet/modules/ojb/model/ReferenceDescriptorDef.java
Mon Oct  1 09:05:27 2007
@@ -1,9 +1,7 @@
 package xdoclet.modules.ojb.model;
 
-import java.util.List;
 
 import xdoclet.modules.ojb.LogHelper;
-import org.apache.commons.lang.ClassUtils;
 import xjavadoc.XClass;
 
 /*
@@ -132,11 +130,13 @@
                     }
                     if(superClassStr == null)
                     {
-                        Class ownerClass = ClassUtils.getClass(classDef.getQualifiedName());
-                        List superClasses = ClassUtils.getAllSuperclasses(ownerClass);
-                        if(!superClasses.isEmpty())
+                        Class ownerClass = Class.forName(classDef.getQualifiedName());
+                        Class superClass = ownerClass.getSuperclass();
+                        if(superClass != null
+                                && !superClass.isInterface()
+                                && !superClass.isPrimitive()
+                                && !superClass.equals(Object.class))
                         {
-                            Class superClass = (Class) superClasses.get(0);
                             superClassStr = superClass.getName();
                         }
                     }



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


Mime
View raw message