tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r606537 - in /openejb/trunk/openejb3: container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java pom.xml
Date Sun, 23 Dec 2007 04:58:50 GMT
Author: dblevins
Date: Sat Dec 22 20:58:49 2007
New Revision: 606537

URL: http://svn.apache.org/viewvc?rev=606537&view=rev
Log:
Upgrade to xbean 3.3-SNAPSHOT which has XBEAN-100 (case insensitive property names)
Use the same options on all objectrecipes, log all unset properties on warn
Improved unset properties detection for Resources when creating "sub-components" with left
over properties

Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
    openejb/trunk/openejb3/pom.xml

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java?rev=606537&r1=606536&r2=606537&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
Sat Dec 22 20:58:49 2007
@@ -733,8 +733,7 @@
 
     public void createContainer(ContainerInfo serviceInfo) throws OpenEJBException {
 
-        ObjectRecipe serviceRecipe = new ObjectRecipe(serviceInfo.className, serviceInfo.factoryMethod,
serviceInfo.constructorArgs.toArray(new String[0]), null);
-        serviceRecipe.setAllProperties(serviceInfo.properties);
+        ObjectRecipe serviceRecipe = createRecipe(serviceInfo);
 
         serviceRecipe.setProperty("id", new StaticRecipe(serviceInfo.id));
         serviceRecipe.setProperty("transactionManager", new StaticRecipe(props.get(TransactionManager.class.getName())));
@@ -746,6 +745,8 @@
         
         Object service = serviceRecipe.create();
 
+        logUnusedProperties(serviceRecipe, serviceInfo);
+
         Class interfce = serviceInterfaces.get(serviceInfo.service);
         checkImplementation(interfce, service.getClass(), serviceInfo.service, serviceInfo.id);
 
@@ -786,11 +787,12 @@
 
     public void createProxyFactory(ProxyFactoryInfo serviceInfo) throws OpenEJBException
{
 
-        ObjectRecipe serviceRecipe = new ObjectRecipe(serviceInfo.className, serviceInfo.factoryMethod,
serviceInfo.constructorArgs.toArray(new String[0]), null);
-        serviceRecipe.setAllProperties(serviceInfo.properties);
+        ObjectRecipe serviceRecipe = createRecipe(serviceInfo);
 
         Object service = serviceRecipe.create();
 
+        logUnusedProperties(serviceRecipe, serviceInfo);
+
         Class interfce = serviceInterfaces.get(serviceInfo.service);
         checkImplementation(interfce, service.getClass(), serviceInfo.service, serviceInfo.id);
 
@@ -837,19 +839,14 @@
     }
 
     public void createResource(ResourceInfo serviceInfo) throws OpenEJBException {
-        ObjectRecipe serviceRecipe = new ObjectRecipe(serviceInfo.className, serviceInfo.factoryMethod,
serviceInfo.constructorArgs.toArray(new String[0]), null);
-        serviceRecipe.setAllProperties(serviceInfo.properties);
+        ObjectRecipe serviceRecipe = createRecipe(serviceInfo);
         serviceRecipe.setProperty("transactionManager", transactionManager);
         serviceRecipe.setProperty("properties", new UnsetPropertiesRecipe());
-        serviceRecipe.allow(Option.IGNORE_MISSING_PROPERTIES);
 
         replaceResourceAdapterProperty(serviceRecipe);
 
         Object service = serviceRecipe.create();
 
-        for (String property : serviceRecipe.getUnsetProperties().keySet()) {
-            logger.warning("Property '" + property + "' not supported by '" + serviceInfo.id
+ "'");
-        }
 
         // Java Connector spec ResourceAdapters and ManagedConnectionFactories need special
activation
         if (service instanceof ResourceAdapter) {
@@ -877,13 +874,18 @@
                 resourceAdapter.start(bootstrapContext);
             } catch (ResourceAdapterInternalException e) {
                 throw new OpenEJBException(e);
-            }            
+            }
+
+            Map<String, Object> unset = serviceRecipe.getUnsetProperties();
+            unset.remove("threadPoolSize");
+            logUnusedProperties(unset, serviceInfo)
+                    ;
         } else if (service instanceof ManagedConnectionFactory) {
             ManagedConnectionFactory managedConnectionFactory = (ManagedConnectionFactory)
service;
 
             // connection manager is constructed via a recipe so we automatically expose
all cmf properties
             ObjectRecipe connectionManagerRecipe = new ObjectRecipe(GeronimoConnectionManagerFactory.class,
"create");
-            connectionManagerRecipe.allow(Option.IGNORE_MISSING_PROPERTIES);
+            connectionManagerRecipe.allow(Option.CASE_INSENSITIVE_PROPERTIES);
             connectionManagerRecipe.setAllProperties(serviceInfo.properties);
             connectionManagerRecipe.setProperty("name", serviceInfo.id);
 
@@ -900,12 +902,18 @@
                 throw new RuntimeException("Invalid connection manager specified for connector
identity = " + serviceInfo.id);
             }
 
-            for (String property : serviceRecipe.getUnsetProperties().keySet()) {
-                logger.warning("Property '" + property + "' not supported by '" + serviceInfo.id
+ "'");
+            Map<String, Object> unsetA = serviceRecipe.getUnsetProperties();
+            Map<String, Object> unsetB = connectionManagerRecipe.getUnsetProperties();
+            Map<String, Object> unset = new HashMap<String, Object>();
+            for (Map.Entry<String, Object> entry : unsetA.entrySet()) {
+                if (unsetB.containsKey(entry.getKey())) unset.put(entry.getKey(),entry.getValue());
             }
+            logUnusedProperties(unset, serviceInfo);
 
             // service becomes a ConnectorReference which merges connection manager and mcf
             service = new ConnectorReference(connectionManager, managedConnectionFactory);
+        } else {
+            logUnusedProperties(serviceRecipe, serviceInfo);
         }
 
         try {
@@ -932,14 +940,15 @@
 
     public void createConnectionManager(ConnectionManagerInfo serviceInfo) throws OpenEJBException
{
 
-        ObjectRecipe serviceRecipe = new ObjectRecipe(serviceInfo.className, serviceInfo.factoryMethod,
serviceInfo.constructorArgs.toArray(new String[0]), null);
-        serviceRecipe.setAllProperties(serviceInfo.properties);
+        ObjectRecipe serviceRecipe = createRecipe(serviceInfo);
 
         Object object = props.get("TransactionManager");
         serviceRecipe.setProperty("transactionManager", new StaticRecipe(object));
 
         Object service = serviceRecipe.create();
 
+        logUnusedProperties(serviceRecipe, serviceInfo);
+
         Class interfce = serviceInterfaces.get(serviceInfo.service);
         checkImplementation(interfce, service.getClass(), serviceInfo.service, serviceInfo.id);
 
@@ -963,11 +972,12 @@
 
     public void createSecurityService(SecurityServiceInfo serviceInfo) throws OpenEJBException
{
 
-        ObjectRecipe serviceRecipe = new ObjectRecipe(serviceInfo.className, serviceInfo.factoryMethod,
serviceInfo.constructorArgs.toArray(new String[0]), null);
-        serviceRecipe.setAllProperties(serviceInfo.properties);
+        ObjectRecipe serviceRecipe = createRecipe(serviceInfo);
 
         Object service = serviceRecipe.create();
 
+        logUnusedProperties(serviceRecipe, serviceInfo);
+
         Class interfce = serviceInterfaces.get(serviceInfo.service);
         checkImplementation(interfce, service.getClass(), serviceInfo.service, serviceInfo.id);
 
@@ -993,11 +1003,13 @@
 
     public void createTransactionManager(TransactionServiceInfo serviceInfo) throws OpenEJBException
{
 
-        ObjectRecipe serviceRecipe = new ObjectRecipe(serviceInfo.className, serviceInfo.factoryMethod,
serviceInfo.constructorArgs.toArray(new String[0]), null);
-        serviceRecipe.setAllProperties(serviceInfo.properties);
+        ServiceInfo info = (ServiceInfo) serviceInfo;
+        ObjectRecipe serviceRecipe = createRecipe(info);
 
         Object service = serviceRecipe.create();
 
+        logUnusedProperties(serviceRecipe, info);
+
         Class interfce = serviceInterfaces.get(serviceInfo.service);
         checkImplementation(interfce, service.getClass(), serviceInfo.service, serviceInfo.id);
 
@@ -1038,6 +1050,25 @@
         JtaEntityManagerRegistry jtaEntityManagerRegistry = new JtaEntityManagerRegistry(synchronizationRegistry);
         Assembler.getContext().put(JtaEntityManagerRegistry.class.getName(), jtaEntityManagerRegistry);
         SystemInstance.get().setComponent(JtaEntityManagerRegistry.class, jtaEntityManagerRegistry);
+    }
+
+    private void logUnusedProperties(ObjectRecipe serviceRecipe, ServiceInfo info) {
+        Map<String, Object> unsetProperties = serviceRecipe.getUnsetProperties();
+        logUnusedProperties(unsetProperties, info);
+    }
+
+    private void logUnusedProperties(Map<String, Object> unsetProperties, ServiceInfo
info) {
+        for (String property : unsetProperties.keySet()) {
+            logger.warning("Property '" + property + "' not supported by '" + info.id + "'");
+        }
+    }
+
+    private ObjectRecipe createRecipe(ServiceInfo info) {
+        ObjectRecipe serviceRecipe = new ObjectRecipe(info.className, info.factoryMethod,
info.constructorArgs.toArray(new String[0]), null);
+        serviceRecipe.allow(Option.CASE_INSENSITIVE_PROPERTIES);
+        serviceRecipe.allow(Option.IGNORE_MISSING_PROPERTIES);
+        serviceRecipe.setAllProperties(info.properties);
+        return serviceRecipe;
     }
 
     @SuppressWarnings({"unchecked"})

Modified: openejb/trunk/openejb3/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/pom.xml?rev=606537&r1=606536&r2=606537&view=diff
==============================================================================
--- openejb/trunk/openejb3/pom.xml (original)
+++ openejb/trunk/openejb3/pom.xml Sat Dec 22 20:58:49 2007
@@ -107,7 +107,7 @@
     <version>3.0-SNAPSHOT</version>
         -->
     <derbyVersion>10.3.2.1</derbyVersion>
-    <xbeanVersion>3.2</xbeanVersion>
+    <xbeanVersion>3.3-SNAPSHOT</xbeanVersion>
   </properties>
 
   <build>



Mime
View raw message