Skip to content

Commit

Permalink
MODE-637 - Adding Repository properties based on JCR Descriptors
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.jboss.org/repos/modeshape/trunk@2173 76366958-4244-0410-ad5e-bbfabb93f86b
  • Loading branch information
tejones committed Aug 21, 2010
1 parent 8455a0c commit b15f230
Show file tree
Hide file tree
Showing 5 changed files with 745 additions and 498 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,19 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.managed.api.ComponentType;
import org.jboss.managed.api.ManagedComponent;
import org.jboss.metatype.api.values.CollectionValueSupport;
import org.jboss.metatype.api.values.CompositeValueSupport;
import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.MetaValueFactory;
import org.modeshape.jboss.managed.ManagedEngine;
import org.modeshape.jboss.managed.ManagedRepository;
import org.modeshape.rhq.plugin.util.ModeShapeManagementView;
import org.modeshape.rhq.plugin.util.PluginConstants;
import org.modeshape.rhq.plugin.util.ProfileServiceUtil;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertyList;
import org.rhq.core.domain.configuration.PropertyMap;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
Expand Down Expand Up @@ -105,6 +112,36 @@ public Set<DiscoveredResourceDetails> discoverResources(
discoveryContext.getDefaultPluginConfiguration(), // Plugin config
null // Process info from a process scan
);

Configuration c = detail.getPluginConfiguration();

operation = "getRepositoryProperties";

MetaValue[] args = new MetaValue[] {
MetaValueFactory.getInstance().create(name)};

MetaValue properties = ModeShapeManagementView
.executeManagedOperation(mc, operation, args);

MetaValue[] propertyArray = ((CollectionValueSupport) properties)
.getElements();

PropertyList list = new PropertyList("propertyList");
PropertyMap propMap = null;
c.put(list);

for (MetaValue property : propertyArray) {

CompositeValueSupport proCvs = (CompositeValueSupport) property;
propMap = new PropertyMap("map");
propMap.put(new PropertySimple("label", ProfileServiceUtil
.stringValue(proCvs.get("label"))));
propMap.put(new PropertySimple("value", ProfileServiceUtil
.stringValue(proCvs.get("value"))));
list.add(propMap);
}



// Add to return values
discoveredResources.add(detail);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@

<service name="Repositories" description="ModeShape Repositories"
class="RepositoryComponent" discovery="RepositoryDiscoveryComponent">

<resource-configuration>
<c:list-property name="propertyList" displayName="Properties"
description="Properties for this sequencer" readOnly="true">
<c:map-property name="map" description="Properties for this sequencer"
readOnly="true">
<c:simple-property name="label" displayName="Name"
description="The name of this property" required="false"
readOnly="true" />
<c:simple-property name="value" displayName="Value"
description="The value of this property" required="false"
readOnly="true" />
</c:map-property>
</c:list-property>
</resource-configuration>
</service>

<service name="Sequencing Service" description="ModeShape Sequencing Service"
Expand Down
Loading

0 comments on commit b15f230

Please sign in to comment.