[jboss-cvs] JBossAS SVN: r87448 - branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Apr 16 14:03:29 EDT 2009


Author: emuckenhuber
Date: 2009-04-16 14:03:29 -0400 (Thu, 16 Apr 2009)
New Revision: 87448

Modified:
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/DelegatingPersistencePlugin.java
Log:
[JBAS-6796] use the default managed object plugin, if no type is specified.

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/DelegatingPersistencePlugin.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/DelegatingPersistencePlugin.java	2009-04-16 18:02:49 UTC (rev 87447)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/DelegatingPersistencePlugin.java	2009-04-16 18:03:29 UTC (rev 87448)
@@ -89,11 +89,29 @@
       if(mo == null)
          throw new IllegalArgumentException("Null managed object.");
       
-      ManagedObjectPersistencePlugin plugin = getPlugin(mo.getAttachmentName());
+      ManagedObjectPersistencePlugin plugin = getPlugin(mo);
       return plugin.createPersistedManagedObject(persisted, mo);
    }
-
+   
    /**
+    * Extract the type name and get the plugin.
+    * 
+    * @param mo the managed object
+    * @return the managed object plugin
+    */
+   protected ManagedObjectPersistencePlugin getPlugin(ManagedObject mo)
+   {
+      String type = mo.getAttachmentName();
+      if(type == null && mo.getAttachment() != null)
+         type = mo.getAttachment().getClass().getName();
+      // As the console is creating their own ManagedObjectImpl
+      // it could happen that the MO is not populated correctly.
+      if(type == null)
+         return defaultPlugin;
+      return getPlugin(type);
+   }
+   
+   /**
     * Get the plugin.
     * 
     * @param type the managed object type




More information about the jboss-cvs-commits mailing list