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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Apr 16 05:06:20 EDT 2009


Author: emuckenhuber
Date: 2009-04-16 05:06:20 -0400 (Thu, 16 Apr 2009)
New Revision: 87407

Added:
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValueVisitor.java
Modified:
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractPersisitedValue.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCollectionValue.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedGenericValue.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedSimpleValue.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValue.java
Log:
extract managedObject values from the persistence information

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractPersisitedValue.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractPersisitedValue.java	2009-04-16 08:53:22 UTC (rev 87406)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractPersisitedValue.java	2009-04-16 09:06:20 UTC (rev 87407)
@@ -23,6 +23,7 @@
 
 import javax.xml.bind.annotation.XmlAttribute;
 
+
 /**
  * A abstract persisted value.
  * 
@@ -53,4 +54,9 @@
       return this.info.equals(info);
    }
    
+   public void visit(PersistedValueVisitor visitor)
+   {
+      // nothing here
+   }
+   
 }

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCollectionValue.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCollectionValue.java	2009-04-16 08:53:22 UTC (rev 87406)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCollectionValue.java	2009-04-16 09:06:20 UTC (rev 87407)
@@ -73,15 +73,21 @@
       return values.size();
    }
    
-   public PersistedValue getValue(int i)
+   protected void toString(StringBuilder builder)
    {
-      if(values == null) return null; // throw Exception ?
-      return this.values.get(i);
+      builder.append(", values = ").append(getValues());
    }
    
-   protected void toString(StringBuilder builder)
+   @Override
+   public void visit(PersistedValueVisitor visitor)
    {
-      builder.append(", values = ").append(getValues());
+      if(this.values != null && this.values.isEmpty() == false)
+      {
+         for(PersistedValue value : this.values)
+         {
+            value.visit(visitor);
+         }
+      }
    }
 }
 

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedGenericValue.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedGenericValue.java	2009-04-16 08:53:22 UTC (rev 87406)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedGenericValue.java	2009-04-16 09:06:20 UTC (rev 87407)
@@ -58,4 +58,11 @@
       builder.append(", managed-object = ").append(getManagedObject());
    }
    
+   @Override
+   public void visit(PersistedValueVisitor visitor)
+   {
+      if(this.managedObject != null)
+         visitor.addPersistedManagedObject(this.managedObject);
+   }
+   
 }

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedSimpleValue.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedSimpleValue.java	2009-04-16 08:53:22 UTC (rev 87406)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedSimpleValue.java	2009-04-16 09:06:20 UTC (rev 87407)
@@ -127,5 +127,10 @@
    {
       builder.append(", value = ").append(getValue());
    }
+
+   public void visit(PersistedValueVisitor visitor)
+   {
+      // nothing here
+   }
    
 }

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValue.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValue.java	2009-04-16 08:53:22 UTC (rev 87406)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValue.java	2009-04-16 09:06:20 UTC (rev 87407)
@@ -54,5 +54,12 @@
     */
    boolean hasModificationFlag(ModificationInfo info);
    
+   
+   /**
+    * Visit this value.
+    * 
+    * @param visitor the visitor
+    */
+   void visit(PersistedValueVisitor visitor);
 }
 

Added: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValueVisitor.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValueVisitor.java	                        (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValueVisitor.java	2009-04-16 09:06:20 UTC (rev 87407)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.system.server.profileservice.persistence.xml;
+
+import java.util.Collection;
+
+import org.jboss.metatype.api.types.MetaType;
+
+
+/**
+ * A persisted value visitor, extracting persisted managed objects.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface PersistedValueVisitor
+{
+
+   /**
+    * Get the meta type of the property.
+    * 
+    * @return the metaType.
+    */
+   MetaType getMetaType();
+   
+   /**
+    * Get the persisted managed objects of this node.
+    * 
+    * @return the persisted managed objects.
+    */
+   Collection<PersistedManagedObject> getManagedObjects();
+   
+   /**
+    * Add a persisted managed object.
+    * 
+    * @param mo the persisted managed object.
+    */
+   void addPersistedManagedObject(PersistedManagedObject mo);
+
+   /**
+    * Visit a persisted value.
+    * 
+    * @param the value
+    */
+   void visit(PersistedValue value);
+ 
+}
+




More information about the jboss-cvs-commits mailing list