[jboss-cvs] JBossAS SVN: r81823 - in trunk/system/src/main/org/jboss/system/server/profileservice: persistence and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Nov 30 09:27:46 EST 2008


Author: emuckenhuber
Date: 2008-11-30 09:27:45 -0500 (Sun, 30 Nov 2008)
New Revision: 81823

Added:
   trunk/system/src/main/org/jboss/system/server/profileservice/persistence/
   trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/
   trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractElement.java
   trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractMapSupport.java
   trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedArrayValue.java
   trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCollectionValue.java
   trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCompositeValue.java
   trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedElement.java
   trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedEnumValue.java
   trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedGenericValue.java
   trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedManagedObject.java
   trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedProperty.java
   trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedSimpleValue.java
   trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedTableValue.java
   trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValue.java
   trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistenceConstants.java
   trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/package-info.java
Log:
[JBAS-3768] initial ManagedObject persistence format.

Added: trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractElement.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractElement.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractElement.java	2008-11-30 14:27:45 UTC (rev 81823)
@@ -0,0 +1,101 @@
+/*
+ * 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 javax.xml.bind.annotation.XmlAttribute;
+
+
+/**
+ * The abstract element.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractElement implements PersistedElement
+{
+   
+   /** The name. */
+   private String name;
+   
+   /** The class name. */
+   private String className;
+   
+   public AbstractElement()
+   {
+      //
+   }
+   
+   public AbstractElement(String name)
+   {
+      this(name, null);
+   }
+   
+   public AbstractElement(String name, String className)
+   {
+      this.name = name;
+      this.className = className;
+   }
+
+   @XmlAttribute(name = "name")
+   public String getName()
+   {
+      return this.name;
+   }
+   
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   @XmlAttribute(name = "class-name")
+   public String getClassName()
+   {
+      return this.className;
+   }
+
+   public void setClassName(String className)
+   {
+      this.className = className;
+   }
+   
+   public String toString()
+   {
+      StringBuilder builder = new StringBuilder();
+      builder.append(getClass().getSimpleName());
+      builder.append('@').append(Integer.toHexString(System.identityHashCode(this)));
+      builder.append("{name = ").append(getName());
+      toString(builder);
+      builder.append("}");
+      return builder.toString();
+   }
+   
+   /**
+    * Additional information for toString().
+    * 
+    * @param builder the builder.
+    */
+   protected void toString(StringBuilder builder)
+   {
+      //
+   }
+ 
+}

Added: trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractMapSupport.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractMapSupport.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractMapSupport.java	2008-11-30 14:27:45 UTC (rev 81823)
@@ -0,0 +1,92 @@
+/*
+ * 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 java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A Map helper class.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractMapSupport<T extends PersistedElement> extends AbstractElement
+{
+   /** The map. */
+   private Map<String, T> map = new HashMap<String, T>();
+
+   public AbstractMapSupport()
+   {
+      //
+   }
+   
+   public AbstractMapSupport(String name)
+   {
+      super(name, null);
+   }
+   
+   public AbstractMapSupport(String name, String className)
+   {
+      super(name, className);
+   }
+   
+   public Set<String> keySet()
+   {
+      return map.keySet();
+   }
+
+   public T get(String name)
+   {
+      return map.get(name);
+   }
+   
+   public void put(String name, T element)
+   {
+      if(name == null)
+         throw new IllegalArgumentException("Null name.");
+
+      this.map.put(name, element);
+   }
+   
+   public Collection<T> values()
+   {
+      return this.map.values();
+   }
+   
+   public void createMap(Collection<T> collection)
+   {
+      if(collection == null)
+         throw new IllegalArgumentException("null children.");
+      
+      for(T element : collection)
+      {
+         if(element.getName() == null)
+            throw new IllegalStateException("name required for element: "+ element);
+         
+         this.map.put(element.getName(), element);
+      }
+   }
+
+}

Added: trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedArrayValue.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedArrayValue.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedArrayValue.java	2008-11-30 14:27:45 UTC (rev 81823)
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+/**
+ * The persisted ArrayValue.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistedArrayValue extends PersistedCollectionValue
+{
+
+}
+

Added: trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCollectionValue.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCollectionValue.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCollectionValue.java	2008-11-30 14:27:45 UTC (rev 81823)
@@ -0,0 +1,85 @@
+/*
+ * 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.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+
+/**
+ * The persisted collection value.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistedCollectionValue extends AbstractElement implements PersistedValue
+{
+   /** The values. */
+   private List<PersistedValue> values = new ArrayList<PersistedValue>();
+   
+   @XmlElements( value = {
+         @XmlElement(name = "simple", type = PersistedSimpleValue.class),
+         @XmlElement(name = "enum", type = PersistedEnumValue.class),
+         @XmlElement(name = "generic", type = PersistedGenericValue.class),
+         @XmlElement(name = "collection", type = PersistedCollectionValue.class),
+         @XmlElement(name = "composite", type = PersistedCompositeValue.class),
+         @XmlElement(name = "table", type = PersistedTableValue.class),
+         @XmlElement(name = "array", type = PersistedArrayValue.class)
+   })
+   public List<PersistedValue> getValues()
+   {
+      return this.values;
+   }
+   
+   public void setValues(List<PersistedValue> collection)
+   {
+      this.values = collection;
+   }
+   
+   public void addValue(PersistedValue value)
+   {
+      if(this.values == null)
+         this.values = new ArrayList<PersistedValue>();
+      
+      this.values.add(value);
+   }
+
+   public int size()
+   {
+      if(values == null) return 0;
+      return values.size();
+   }
+   
+   public PersistedValue getValue(int i)
+   {
+      if(values == null) return null; // throw Exception ?
+      return this.values.get(i);
+   }
+   
+   protected void toString(StringBuilder builder)
+   {
+      builder.append(", values = ").append(getValues());
+   }
+}
+

Added: trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCompositeValue.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCompositeValue.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCompositeValue.java	2008-11-30 14:27:45 UTC (rev 81823)
@@ -0,0 +1,63 @@
+/*
+ * 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.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+
+/**
+ * The persisted composite value.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistedCompositeValue extends AbstractMapSupport<PersistedValue> implements PersistedValue
+{
+
+   @XmlElements( value = {
+         @XmlElement(name = "simple", type = PersistedSimpleValue.class),
+         @XmlElement(name = "enum", type = PersistedEnumValue.class),
+         @XmlElement(name = "generic", type = PersistedGenericValue.class),
+         @XmlElement(name = "collection", type = PersistedCollectionValue.class),
+         @XmlElement(name = "composite", type = PersistedCompositeValue.class),
+         @XmlElement(name = "table", type = PersistedTableValue.class),
+         @XmlElement(name = "array", type = PersistedArrayValue.class)
+   })
+   public List<PersistedValue> getValues()
+   {
+      return new ArrayList<PersistedValue>(super.values());
+   }
+   
+   public void setValues(List<PersistedValue> values)
+   {
+      super.createMap(values);
+   }
+   
+   protected void toString(StringBuilder builder)
+   {
+      builder.append(", keySet = ").append(keySet());
+   }
+   
+}

Added: trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedElement.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedElement.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedElement.java	2008-11-30 14:27:45 UTC (rev 81823)
@@ -0,0 +1,46 @@
+/*
+ * 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;
+
+/**
+ * A Element.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface PersistedElement
+{
+   /**
+    * GetName()
+    * 
+    * @return the name
+    */
+   String getName();
+   
+   /**
+    * SetName
+    * 
+    * @param name the name
+    */
+   void setName(String name);
+
+}

Added: trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedEnumValue.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedEnumValue.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedEnumValue.java	2008-11-30 14:27:45 UTC (rev 81823)
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+/**
+ * The persisted EnumValue.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistedEnumValue extends PersistedSimpleValue
+{
+
+   @Override
+   protected void toString(StringBuilder builder)
+   {
+      builder.append(", enum-value = ").append(getValue());
+   }
+   
+}

Added: trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedGenericValue.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedGenericValue.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedGenericValue.java	2008-11-30 14:27:45 UTC (rev 81823)
@@ -0,0 +1,56 @@
+/*
+ * 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 static org.jboss.system.server.profileservice.persistence.xml.PersistenceConstants.MANAGED_OBJECT_ELEMENT_NAME;
+
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * The persisted generic value.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistedGenericValue extends AbstractElement implements PersistedValue
+{
+   
+   /** A managed-object. */
+   private PersistedManagedObject managedObject;
+   
+   @XmlElement(name = MANAGED_OBJECT_ELEMENT_NAME, type = PersistedManagedObject.class)
+   public PersistedManagedObject getManagedObject()
+   {
+      return managedObject;
+   }
+   
+   public void setManagedObject(PersistedManagedObject managedObject)
+   {
+      this.managedObject = managedObject;
+   }
+
+   protected void toString(StringBuilder builder)
+   {
+      builder.append(", managed-object = ").append(getManagedObject());
+   }
+   
+}

Added: trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedManagedObject.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedManagedObject.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedManagedObject.java	2008-11-30 14:27:45 UTC (rev 81823)
@@ -0,0 +1,101 @@
+/*
+ * 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 static org.jboss.system.server.profileservice.persistence.xml.PersistenceConstants.MANAGED_OBJECT_ELEMENT_NAME;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * A persisted xml representation of a ManagedObject.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at JBossXmlSchema(
+      xmlns = { @XmlNs(namespaceURI = "http://www.w3.org/2001/XMLSchema", prefix = "xs") },
+      ignoreUnresolvedFieldOrClass=false,
+      namespace = PersistenceConstants.NAMESPACE_1_0, 
+      elementFormDefault = XmlNsForm.QUALIFIED,
+      normalizeSpace=true)
+ at XmlRootElement(name = MANAGED_OBJECT_ELEMENT_NAME)
+ at XmlType(name = "managedObjectType", namespace = PersistenceConstants.NAMESPACE_1_0)
+public class PersistedManagedObject extends AbstractMapSupport<PersistedProperty>
+{
+   /** The original name. */
+   private String originalName;
+   
+   public PersistedManagedObject()
+   {
+      //
+   }
+   
+   public PersistedManagedObject(String name)
+   {
+      super(name);
+   }
+   
+   public PersistedManagedObject(String name, String className)
+   {
+      super(name, className);
+   }
+   
+   @XmlAttribute(name = "original-name")
+   public String getOriginalName()
+   {
+      return originalName;
+   }
+   
+   public void setOriginalName(String originalName)
+   {
+      this.originalName = originalName;
+   }
+   
+   @XmlElementWrapper(name="properties")
+   @XmlElement(name = "property")
+   public List<PersistedProperty> getProperties()
+   {
+      return new ArrayList(super.values());
+   }
+   
+   public void setProperties(List<PersistedProperty> properties)
+   {
+      super.createMap(properties);
+   }
+   
+   protected void toString(StringBuilder builder)
+   {
+      builder.append(", original-name = ").append(getOriginalName());
+   }
+
+}

Added: trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedProperty.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedProperty.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedProperty.java	2008-11-30 14:27:45 UTC (rev 81823)
@@ -0,0 +1,80 @@
+/*
+ * 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 javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * The persisted ManagedProperty.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at XmlType(name = "persited-propertyType")
+public class PersistedProperty extends AbstractElement
+{
+   
+   /** The value */
+   private PersistedValue value;
+   
+   public PersistedProperty()
+   {
+      //
+   }
+   
+   public PersistedProperty(String name)
+   {
+      super(name);
+   }
+   
+   public PersistedProperty(String name, String className)
+   {
+      super(name, className);
+   }
+   
+   @XmlElements( value = {
+         @XmlElement(name = "simple", type = PersistedSimpleValue.class),
+         @XmlElement(name = "enum", type = PersistedEnumValue.class),
+         @XmlElement(name = "composite", type = PersistedCompositeValue.class),
+         @XmlElement(name = "generic", type = PersistedGenericValue.class),
+         @XmlElement(name = "collection", type = PersistedCollectionValue.class),
+         @XmlElement(name = "table", type = PersistedTableValue.class),
+         @XmlElement(name = "array", type = PersistedArrayValue.class)
+   })
+   public PersistedValue getValue()
+   {
+      return value;
+   }
+   
+   public void setValue(PersistedValue value)
+   {
+      this.value = value;
+   }
+   
+   protected void toString(StringBuilder builder)
+   {
+      builder.append(", value = ").append(getValue());
+   }
+   
+}

Added: trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedSimpleValue.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedSimpleValue.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedSimpleValue.java	2008-11-30 14:27:45 UTC (rev 81823)
@@ -0,0 +1,109 @@
+/*
+ * 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 javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlValue;
+
+/**
+ * The SimpleValue/SimpleMetaType.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistedSimpleValue implements PersistedValue, PersistedElement
+{
+   /** The name. */
+   private String name;
+   
+   /** The class name. */
+   private String className;
+   
+   /** The value. */
+   String value;
+   
+   public PersistedSimpleValue()
+   {
+      //
+   }
+   
+   public PersistedSimpleValue(String name)
+   {
+      this(name, null);
+   }
+   
+   public PersistedSimpleValue(String name, String className)
+   {
+      this.name = name;
+      this.className = className;
+   }
+
+   @XmlAttribute(name = "name")
+   public String getName()
+   {
+      return this.name;
+   }
+   
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   @XmlAttribute(name = "class-name")
+   public String getClassName()
+   {
+      return this.className;
+   }
+
+   public void setClassName(String className)
+   {
+      this.className = className;
+   }
+   
+   @XmlValue 
+   public String getValue()
+   {
+      return value;
+   }
+   
+   public void setValue(String value)
+   {
+      this.value = value;
+   }
+   
+   public String toString()
+   {
+      StringBuilder builder = new StringBuilder();
+      builder.append(getClass().getSimpleName());
+      builder.append('@').append(Integer.toHexString(System.identityHashCode(this)));
+      builder.append("{name = ").append(getName());
+      toString(builder);
+      builder.append("}");
+      return builder.toString();
+   }
+   
+   protected void toString(StringBuilder builder)
+   {
+      builder.append(", value = ").append(getValue());
+   }
+   
+}

Added: trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedTableValue.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedTableValue.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedTableValue.java	2008-11-30 14:27:45 UTC (rev 81823)
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+/**
+ * TODO The persisted TableValue.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistedTableValue extends AbstractElement implements PersistedValue
+{
+
+}
+

Added: trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValue.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValue.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValue.java	2008-11-30 14:27:45 UTC (rev 81823)
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+/**
+ * A Value.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface PersistedValue extends PersistedElement
+{
+   
+}
+

Added: trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistenceConstants.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistenceConstants.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistenceConstants.java	2008-11-30 14:27:45 UTC (rev 81823)
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+/**
+ * The PersistenceConstants.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistenceConstants
+{
+
+   /** The xml namespace. */
+   public static final String NAMESPACE_1_0 = "urn:jboss:managed-persistence:1.0";
+   
+   /** The managed-object name. */
+   public static final String MANAGED_OBJECT_ELEMENT_NAME = "managed-object";   
+   
+}

Added: trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/package-info.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/package-info.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/package-info.java	2008-11-30 14:27:45 UTC (rev 81823)
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+ at XmlSchema(namespace = PersistenceConstants.NAMESPACE_1_0, 
+      elementFormDefault = XmlNsForm.QUALIFIED,
+      xmlns = { @XmlNs(namespaceURI = "http://www.w3.org/2001/XMLSchema", prefix = "xs") }
+)
+package org.jboss.system.server.profileservice.persistence.xml;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlSchema;
+




More information about the jboss-cvs-commits mailing list