[jboss-cvs] JBossAS SVN: r85726 - in branches/Branch_5_x: system/src/main/org/jboss/deployers/plugins/managed and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Mar 11 03:48:44 EDT 2009
Author: scott.stark at jboss.org
Date: 2009-03-11 03:48:43 -0400 (Wed, 11 Mar 2009)
New Revision: 85726
Added:
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedPair.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedPropertiesValue.java
Modified:
branches/Branch_5_x/component-matrix/pom.xml
branches/Branch_5_x/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java
branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectPeristenceHandler.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectRecreation.java
Log:
JBAS-6596, update handling of ObjectName properties
Modified: branches/Branch_5_x/component-matrix/pom.xml
===================================================================
--- branches/Branch_5_x/component-matrix/pom.xml 2009-03-11 07:39:39 UTC (rev 85725)
+++ branches/Branch_5_x/component-matrix/pom.xml 2009-03-11 07:48:43 UTC (rev 85726)
@@ -73,7 +73,7 @@
<version.org.jboss.jpa>1.0.0-CR1</version.org.jboss.jpa>
<version.org.jboss.logbridge>1.0.0.CR3</version.org.jboss.logbridge>
<version.org.jboss.logmanager>1.0.0.CR3</version.org.jboss.logmanager>
- <version.org.jboss.man>2.1.0.CR3</version.org.jboss.man>
+ <version.org.jboss.man>2.1.0.CR4</version.org.jboss.man>
<version.org.jboss.mdr>2.0.1.GA</version.org.jboss.mdr>
<version.org.jboss.metadata>1.0.0.CR16</version.org.jboss.metadata>
<version.org.jboss.microcontainer>2.0.4.GA</version.org.jboss.microcontainer>
Modified: branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java 2009-03-11 07:39:39 UTC (rev 85725)
+++ branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java 2009-03-11 07:48:43 UTC (rev 85726)
@@ -116,6 +116,7 @@
CollectionMetaType beansType = new CollectionMetaType(BeanMetaDataFactory.class.getName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
for(BeanMetaDataFactory bmdf : beanFactories)
{
+
ManagedObject bmdfMO = mof.initManagedObject(bmdf, metaData);
if(bmdfMO == null)
continue;
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectPeristenceHandler.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectPeristenceHandler.java 2009-03-11 07:39:39 UTC (rev 85725)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectPeristenceHandler.java 2009-03-11 07:48:43 UTC (rev 85726)
@@ -42,6 +42,7 @@
import org.jboss.metatype.api.values.GenericValue;
import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.api.values.PropertiesMetaValue;
import org.jboss.metatype.api.values.SimpleValue;
import org.jboss.metatype.api.values.TableValue;
import org.jboss.system.server.profileservice.persistence.xml.ModificationInfo;
@@ -51,6 +52,8 @@
import org.jboss.system.server.profileservice.persistence.xml.PersistedEnumValue;
import org.jboss.system.server.profileservice.persistence.xml.PersistedGenericValue;
import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedPair;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedPropertiesValue;
import org.jboss.system.server.profileservice.persistence.xml.PersistedProperty;
import org.jboss.system.server.profileservice.persistence.xml.PersistedSimpleValue;
import org.jboss.system.server.profileservice.persistence.xml.PersistedTableValue;
@@ -241,6 +244,11 @@
persistedValue = createTableValue(
(TableValue) value);
}
+ else if(metaType.isProperties())
+ {
+ persistedValue = createPropertiesValue(
+ (PropertiesMetaValue) value);
+ }
else
{
throw new IllegalStateException("unknown metaType");
@@ -248,6 +256,7 @@
return persistedValue;
}
+
/**
* Create the persistence enum value.
*
@@ -434,6 +443,24 @@
return table;
}
+ private PersistedValue createPropertiesValue(PropertiesMetaValue value)
+ {
+ PersistedPropertiesValue properties = new PersistedPropertiesValue();
+ List<PersistedPair> pairs = properties.getEntries();
+ if(pairs == null)
+ {
+ pairs = new ArrayList<PersistedPair>();
+ properties.setEntries(pairs);
+ }
+ for(Object key : value.keySet())
+ {
+ Object kvalue = value.get(key);
+ PersistedPair pair = new PersistedPair(key.toString(), kvalue.toString());
+ pairs.add(pair);
+ }
+ return properties;
+ }
+
/**
* Create a emtpy xml meta data, based on the meta type
*
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectRecreation.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectRecreation.java 2009-03-11 07:39:39 UTC (rev 85725)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectRecreation.java 2009-03-11 07:48:43 UTC (rev 85726)
@@ -45,6 +45,7 @@
import org.jboss.metatype.api.types.MapCompositeMetaType;
import org.jboss.metatype.api.types.MetaType;
import org.jboss.metatype.api.types.Name;
+import org.jboss.metatype.api.types.PropertiesMetaType;
import org.jboss.metatype.api.types.SimpleMetaType;
import org.jboss.metatype.api.types.TableMetaType;
import org.jboss.metatype.api.values.ArrayValue;
@@ -59,6 +60,7 @@
import org.jboss.metatype.api.values.GenericValueSupport;
import org.jboss.metatype.api.values.MapCompositeValueSupport;
import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.PropertiesMetaValue;
import org.jboss.metatype.api.values.SimpleValue;
import org.jboss.metatype.api.values.SimpleValueSupport;
import org.jboss.metatype.api.values.TableValue;
@@ -71,6 +73,8 @@
import org.jboss.system.server.profileservice.persistence.xml.PersistedEnumValue;
import org.jboss.system.server.profileservice.persistence.xml.PersistedGenericValue;
import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedPair;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedPropertiesValue;
import org.jboss.system.server.profileservice.persistence.xml.PersistedProperty;
import org.jboss.system.server.profileservice.persistence.xml.PersistedSimpleValue;
import org.jboss.system.server.profileservice.persistence.xml.PersistedTableValue;
@@ -314,6 +318,12 @@
(PersistedArrayValue) valueElement,
(ArrayMetaType) metaType);
}
+ else if(metaType.isProperties())
+ {
+ metaValue = createPropertiesValue(
+ (PersistedPropertiesValue) valueElement,
+ (PropertiesMetaType) metaType);
+ }
else
{
throw new IllegalStateException("unknown metaType");
@@ -484,6 +494,18 @@
return support;
}
+ protected MetaValue createPropertiesValue(
+ PersistedPropertiesValue value, PropertiesMetaType metaType)
+ {
+ PropertiesMetaValue properties = new PropertiesMetaValue();
+ for(PersistedPair pair : value.getEntries())
+ {
+ properties.setProperty(pair.getKey(), pair.getValue());
+ }
+
+ return properties;
+ }
+
/**
* Create array value.
*
Added: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedPair.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedPair.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedPair.java 2009-03-11 07:48:43 UTC (rev 85726)
@@ -0,0 +1,66 @@
+/*
+ * 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: 85526 $
+ */
+public class PersistedPair extends PersistedSimpleValue
+{
+ /** The name. */
+ private String key;
+
+ public PersistedPair()
+ {
+ super("pair");
+ }
+
+ public PersistedPair(String key, String value)
+ {
+ super("pair");
+ this.key = key;
+ super.setValue(value);
+ }
+
+ @XmlAttribute(name = "key")
+ public String getKey()
+ {
+ return this.key;
+ }
+
+ public void setKey(String key)
+ {
+ this.key = key;
+ }
+
+ protected void toString(StringBuilder builder)
+ {
+ builder.append(", key = ").append(getKey());
+ }
+
+}
Added: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedPropertiesValue.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedPropertiesValue.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedPropertiesValue.java 2009-03-11 07:48:43 UTC (rev 85726)
@@ -0,0 +1,51 @@
+/*
+ * 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.List;
+
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * The persisted TableValue.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision: 85526 $
+ */
+public class PersistedPropertiesValue extends AbstractPersisitedValue implements PersistedValue
+{
+
+ /** The entries. */
+ List<PersistedPair> entries;
+
+ @XmlElement(name = "entry")
+ public List<PersistedPair> getEntries()
+ {
+ return entries;
+ }
+
+ public void setEntries(List<PersistedPair> entries)
+ {
+ this.entries = entries;
+ }
+
+}
Modified: branches/Branch_5_x/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java
===================================================================
--- branches/Branch_5_x/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java 2009-03-11 07:39:39 UTC (rev 85725)
+++ branches/Branch_5_x/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java 2009-03-11 07:48:43 UTC (rev 85726)
@@ -35,8 +35,10 @@
import org.jboss.managed.api.ManagedProperty;
import org.jboss.managed.spi.factory.InstanceClassFactory;
import org.jboss.metadata.spi.MetaData;
+import org.jboss.metatype.api.types.MetaType;
import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.spi.values.MetaMapper;
import org.jboss.system.metadata.ServiceAnnotationMetaData;
import org.jboss.system.metadata.ServiceAttributeMetaData;
import org.jboss.system.metadata.ServiceDependencyValueMetaData;
@@ -253,8 +255,19 @@
}
if (attributeValue != null)
{
- PropertyInfo propertyInfo = beanInfo.getProperty(name);
- Object plainValue = metaValueFactory.unwrap(value, propertyInfo.getType());
+ Object plainValue = null;
+ // Look for a MetaMapper
+ MetaType propertyType = property.getMetaType();
+ MetaMapper metaMapper = property.getTransientAttachment(MetaMapper.class);
+ if(metaMapper != null)
+ {
+ plainValue = metaMapper.unwrapMetaValue(value);
+ }
+ else
+ {
+ PropertyInfo propertyInfo = beanInfo.getProperty(name);
+ plainValue = metaValueFactory.unwrap(value, propertyInfo.getType());
+ }
// Unwrap the ServiceValueMetaData types
if (attributeValue instanceof ServiceTextValueMetaData)
@@ -262,10 +275,13 @@
ServiceTextValueMetaData text = (ServiceTextValueMetaData) attributeValue;
text.setText(String.valueOf(plainValue));
}
- else if (value instanceof ServiceDependencyValueMetaData)
+ else if (attributeValue instanceof ServiceDependencyValueMetaData)
{
ServiceDependencyValueMetaData depends = (ServiceDependencyValueMetaData) attributeValue;
- depends.setDependency(String.valueOf(plainValue));
+ if (plainValue instanceof ObjectName)
+ depends.setObjectName((ObjectName) plainValue);
+ else
+ depends.setDependency(String.valueOf(plainValue));
}
// TODO: unwrap other ServiceValueMetaData types
else
More information about the jboss-cvs-commits
mailing list