openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r768452 - in /openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa: conf/ meta/ util/
Date Sat, 25 Apr 2009 02:57:41 GMT
Author: ppoddar
Date: Sat Apr 25 02:57:40 2009
New Revision: 768452

URL: http://svn.apache.org/viewvc?rev=768452&view=rev
Log:
OPENJPA-1050: Use parametrized types wherever applicable

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/CacheMarshallersValue.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractCFMetaDataFactory.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataFactory.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NoneMetaDataFactory.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/CacheMarshallersValue.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/CacheMarshallersValue.java?rev=768452&r1=768451&r2=768452&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/CacheMarshallersValue.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/CacheMarshallersValue.java
Sat Apr 25 02:57:40 2009
@@ -42,7 +42,7 @@
         Localizer.forPackage(CacheMarshallersValue.class);
 
     private Configuration _conf;
-    private Map _marshallers;
+    private Map<String,CacheMarshaller> _marshallers;
     private boolean _initialized;
 
     public CacheMarshallersValue(Configuration conf) {
@@ -55,12 +55,12 @@
         setScope(getClass());
     }
 
-    public Object instantiate(Class elemType, Configuration conf,
+    public Object instantiate(Class<?> elemType, Configuration conf,
         boolean fatal) {
         CacheMarshaller[] ms = (CacheMarshaller[])
             super.instantiate(elemType, conf, fatal);
         if (ms != null) {
-            _marshallers = new HashMap();
+            _marshallers = new HashMap<String,CacheMarshaller>();
             for (int i = 0; i < ms.length; i++) {
                 String mid = ms[i].getId();
                 if (mid != null)
@@ -108,7 +108,7 @@
         return v.getMarshallerById(id);
     }
 
-    public Map getInstancesAsMap() {
+    public Map<String,CacheMarshaller> getInstancesAsMap() {
         return _marshallers;
     }
 

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java?rev=768452&r1=768451&r2=768452&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java
Sat Apr 25 02:57:40 2009
@@ -211,7 +211,7 @@
      * Return the set of option strings supported by this runtime. This set
      * is mutable.
      */
-    public Collection supportedOptions();
+    public Collection<String> supportedOptions();
 
     /**
      * Get a name of the Specification. Specification determines various 
@@ -1567,7 +1567,7 @@
     public String getCacheMarshallers();
 
     /**
-     * A comma-separted list of the plugin strings specifying the
+     * A comma-separated list of the plugin strings specifying the
      * {@link CacheMarshaller}s to use.
      *
      * @since 1.1.0
@@ -1579,7 +1579,7 @@
      *
      * @since 1.1.0 
      */
-    public Map getCacheMarshallerInstances();
+    public Map<String,CacheMarshaller> getCacheMarshallerInstances();
     
     /**
      * Affirms if all configured elements are initialized eagerly as opposed

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java?rev=768452&r1=768451&r2=768452&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
Sat Apr 25 02:57:40 2009
@@ -158,8 +158,7 @@
     public RemoteCommitProviderValue remoteProviderPlugin;
     public AutoDetachValue autoDetach;
 
-    private Collection supportedOptions = new HashSet(33);
-    private String spec = null;
+    private Collection<String> supportedOptions = new HashSet<String>(33);
     private final StoreFacadeTypeRegistry _storeFacadeRegistry =
         new StoreFacadeTypeRegistry();
     private BrokerFactoryEventManager _brokerFactoryEventManager =
@@ -575,7 +574,7 @@
             loadGlobals();
     }
 
-    public Collection supportedOptions() {
+    public Collection<String> supportedOptions() {
         return supportedOptions;
     }
 

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractCFMetaDataFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractCFMetaDataFactory.java?rev=768452&r1=768451&r2=768452&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractCFMetaDataFactory.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractCFMetaDataFactory.java
Sat Apr 25 02:57:40 2009
@@ -70,17 +70,17 @@
     private static final Localizer _loc = Localizer.forPackage
         (AbstractMetaDataFactory.class);
 
-    protected Collection files = null;
-    protected Collection urls = null;
-    protected Collection rsrcs = null;
-    protected Collection cpath = null;
+    protected Collection<File> files = null;
+    protected Collection<URL> urls = null;
+    protected Collection<String> rsrcs = null;
+    protected Collection<String> cpath = null;
 
-    private Set _typeNames = null;
+    private Set<String> _typeNames = null;
 
     /**
      * Set of {@link File}s of metadata files or directories supplied by user.
      */
-    public void setFiles(Collection files) {
+    public void setFiles(Collection<File> files) {
         this.files = files;
     }
 
@@ -93,7 +93,7 @@
             this.files = null;
         else {
             String[] strs = Strings.split(files, ";", 0);
-            this.files = new HashSet((int) (strs.length * 1.33 + 1));
+            this.files = new HashSet<File>((int) (strs.length * 1.33 + 1));
 
             File file;
             for (int i = 0; i < strs.length; i++) {
@@ -108,7 +108,7 @@
     /**
      * Set of {@link URL}s of metadata files or jars supplied by user.
      */
-    public void setURLs(Collection urls) {
+    public void setURLs(Collection<URL> urls) {
         this.urls = urls;
     }
 
@@ -121,7 +121,7 @@
             this.urls = null;
         else {
             String[] strs = Strings.split(urls, ";", 0);
-            this.urls = new HashSet((int) (strs.length * 1.33 + 1));
+            this.urls = new HashSet<URL>((int) (strs.length * 1.33 + 1));
             try {
                 for (int i = 0; i < strs.length; i++)
                     this.urls.add(new URL(strs[i]));
@@ -134,7 +134,7 @@
     /**
      * Set of resource paths of metadata files or jars supplied by user.
      */
-    public void setResources(Collection rsrcs) {
+    public void setResources(Collection<String> rsrcs) {
         this.rsrcs = rsrcs;
     }
 
@@ -145,14 +145,14 @@
     public void setResources(String rsrcs) {
         // keep list mutable so subclasses can add implicit locations
         this.rsrcs = (StringUtils.isEmpty(rsrcs)) ? null
-            : new ArrayList(Arrays.asList(Strings.split(rsrcs, ";", 0)));
+          : new ArrayList<String>(Arrays.asList(Strings.split(rsrcs, ";", 0)));
     }
 
     /**
      * Set of classpath directories or jars to scan for metadata supplied
      * by user.
      */
-    public void setClasspathScan(Collection cpath) {
+    public void setClasspathScan(Collection<String> cpath) {
         this.cpath = cpath;
     }
 
@@ -163,7 +163,7 @@
     public void setClasspathScan(String cpath) {
         // keep list mutable so subclasses can add implicit locations
         this.cpath = (StringUtils.isEmpty(cpath)) ? null
-            : new ArrayList(Arrays.asList(Strings.split(cpath, ";", 0)));
+          : new ArrayList<String>(Arrays.asList(Strings.split(cpath, ";", 0)));
     }
 
     public boolean store(ClassMetaData[] metas, QueryMetaData[] queries,
@@ -175,10 +175,11 @@
 
         if (!strict && (mode & MODE_META) != 0)
             mode |= MODE_MAPPING;
-        Class cls = (metas.length == 0) ? null : metas[0].getDescribedType();
+        Class<?> cls = (metas.length == 0) ? null : metas[0].getDescribedType();
         ClassLoader loader = repos.getConfiguration().
             getClassResolverInstance().getClassLoader(cls, null);
-        Map clsNames = new HashMap((int) (metas.length * 1.33 + 1));
+        Map<String,ClassMetaData> clsNames = new HashMap<String,ClassMetaData>
+        	((int) (metas.length * 1.33 + 1));
         for (int i = 0; i < metas.length; i++)
             clsNames.put(metas[i].getDescribedType().getName(), metas[i]);
 
@@ -591,7 +592,8 @@
         return null;
     }
 
-    public Set getPersistentTypeNames(boolean devpath, ClassLoader envLoader) {
+    public Set<String> getPersistentTypeNames(boolean devpath, 
+    	ClassLoader envLoader) {
         // some configured locations might be implicit in spec, so return
         // null if we don't find any classes, rather than if we don't have
         // any locations

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataFactory.java?rev=768452&r1=768451&r2=768452&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataFactory.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataFactory.java
Sat Apr 25 02:57:40 2009
@@ -74,7 +74,7 @@
      * {@link MetaDataModes#MODE_META MODE_META}, so long as
      * the <code>strict</code> property hasn't been set
      */
-    public void load(Class cls, int mode, ClassLoader envLoader);
+    public void load(Class<?> cls, int mode, ClassLoader envLoader);
 
     /**
      * Store the given metadata.
@@ -94,7 +94,7 @@
      *
      * @return false if any metadata could not be dropped
      */
-    public boolean drop(Class[] cls, int mode, ClassLoader envLoader);
+    public boolean drop(Class<?>[] cls, int mode, ClassLoader envLoader);
 
     /**
      * Return the metadata defaults for this factory.
@@ -111,17 +111,18 @@
      * @see MetaDataRepository#getPersistentTypeNames
      * @see MetaDataRepository#loadPersistentTypes
      */
-    public Set getPersistentTypeNames(boolean devpath, ClassLoader envLoader);
+    public Set<String> getPersistentTypeNames(boolean devpath, 
+    		ClassLoader envLoader);
 
     /**
      * Return the type defining the given query name, if any.
      */
-    public Class getQueryScope(String queryName, ClassLoader loader);
+    public Class<?> getQueryScope(String queryName, ClassLoader loader);
 
     /**
      * Return the type defining the given result set mapping name, if any.
      */
-    public Class getResultSetMappingScope(String resultSetMappingName,
+    public Class<?> getResultSetMappingScope(String resultSetMappingName,
         ClassLoader loader);
     
     /**
@@ -138,12 +139,12 @@
     /**
      * Add any extension keys used by this instance to the given set.
      */
-    public void addClassExtensionKeys(Collection exts);
+    public void addClassExtensionKeys(Collection<?> exts);
 
     /**
      * Add any extension keys used by this instance to the given set.
      */
-    public void addFieldExtensionKeys (Collection exts);
+    public void addFieldExtensionKeys (Collection<?> exts);
 
     /**
      * Load XMLClassMetadata for the given class. Loaded

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java?rev=768452&r1=768451&r2=768452&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
Sat Apr 25 02:57:40 2009
@@ -90,7 +90,7 @@
      */
     public static final int VALIDATE_RUNTIME = 8;
 
-    protected static final Class[] EMPTY_CLASSES = new Class[0];
+    protected static final Class<?>[] EMPTY_CLASSES = new Class[0];
     protected static final NonPersistentMetaData[] EMPTY_NON_PERSISTENT = 
     	new NonPersistentMetaData[0];
     protected final ClassMetaData[] EMPTY_METAS;
@@ -777,7 +777,7 @@
      * the repository, and return it. Use the default access type.
      */
     public ClassMetaData addMetaData(Class cls) {
-        return addMetaData(cls, ClassMetaData.ACCESS_UNKNOWN);
+        return addMetaData(cls, AccessCode.UNKNOWN);
     }
 
     /**
@@ -1272,8 +1272,8 @@
         return _factory.getPersistentTypeNames(devpath, envLoader);
     }
     
-    public synchronized Collection loadPersistentTypes(boolean devpath,
-            ClassLoader envLoader) {
+    public synchronized Collection<Class<?>> loadPersistentTypes(
+    		boolean devpath, ClassLoader envLoader) {
     	return loadPersistentTypes(devpath, envLoader, false);
     }
 
@@ -1361,7 +1361,7 @@
      * that this method only works during runtime when the repository is
      * registered as a {@link RegisterClassListener}.
      */
-    Collection getPCSubclasses(Class cls) {
+    Collection<Class<?>> getPCSubclasses(Class cls) {
         Collection subs = (Collection) _subs.get(cls);
         if (subs == null)
             return Collections.EMPTY_LIST;

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NoneMetaDataFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NoneMetaDataFactory.java?rev=768452&r1=768451&r2=768452&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NoneMetaDataFactory.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NoneMetaDataFactory.java
Sat Apr 25 02:57:40 2009
@@ -98,7 +98,7 @@
     }
 
     public int getDefaultAccessType() {
-        return ClassMetaData.ACCESS_UNKNOWN;
+        return AccessCode.UNKNOWN;
     }
 
     public int getDefaultIdentityType() {

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java?rev=768452&r1=768451&r2=768452&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java
Sat Apr 25 02:57:40 2009
@@ -36,6 +36,7 @@
 import org.apache.openjpa.kernel.StoreManager;
 import org.apache.openjpa.lib.util.J2DoPrivHelper;
 import org.apache.openjpa.lib.util.Localizer;
+import org.apache.openjpa.meta.AccessCode;
 import org.apache.openjpa.meta.ClassMetaData;
 import org.apache.openjpa.meta.FieldMetaData;
 import org.apache.openjpa.meta.JavaTypes;
@@ -100,7 +101,7 @@
             oid = ((ObjectId) oid).getId();
         Class oidType = oid.getClass();
         for (int i = 0; i < fmds.length; i++) {
-            if (meta.getAccessType() == ClassMetaData.ACCESS_FIELD)
+            if (AccessCode.isField(meta.getAccessType()))
                 pks[i] = Reflection.get(oid, Reflection.findField(oidType, 
                     fmds[i].getName(), true));
             else
@@ -239,7 +240,7 @@
         for (int i = 0; i < fmds.length; i++) {
             val = (convert) ? JavaTypes.convert(pks[i],
                 fmds[i].getObjectIdFieldTypeCode()) : pks[i];
-            if (meta.getAccessType() == ClassMetaData.ACCESS_FIELD)
+            if (AccessCode.isField(meta.getAccessType()))
                 Reflection.set(copy, Reflection.findField(oidType, 
                     fmds[i].getName(), true), val); 
             else
@@ -378,7 +379,7 @@
             if (fmds[i].getManagement() != FieldMetaData.MANAGE_PERSISTENT)
                 continue;
 
-            if (meta.getAccessType() == ClassMetaData.ACCESS_FIELD) {
+            if (AccessCode.isField(meta.getAccessType())) {
                     field = Reflection.findField(oidType, fmds[i].getName(),
                         true);
                     Reflection.set(copy, field, Reflection.get(oid, field));
@@ -403,7 +404,7 @@
 
         ClassMetaData meta = fmd.getDefiningMetaData();
         Class oidType = oid.getClass();
-        if (meta.getAccessType() == ClassMetaData.ACCESS_FIELD)
+        if (AccessCode.isField(meta.getAccessType()))
             return Reflection.get(oid, Reflection.findField(oidType, 
                 fmd.getName(), true));
         return Reflection.get(oid, Reflection.findGetter(oidType, fmd.getName(),



Mime
View raw message