Skip to content

Commit fbd4f18

Browse files
ctomckabir
authored andcommitted
AS7-5112 Add deprecation information to management API metadata
* initial support for deprecation of attributes * initial support for deprecating operations fix for list & map attribute marshaller
1 parent 0b7174e commit fbd4f18

File tree

40 files changed

+454
-686
lines changed

40 files changed

+454
-686
lines changed

clustering/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/CommonAttributes.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
package org.jboss.as.clustering.infinispan.subsystem;
22

3+
import javax.xml.stream.XMLStreamException;
4+
import javax.xml.stream.XMLStreamWriter;
5+
36
import org.infinispan.eviction.EvictionStrategy;
47
import org.infinispan.transaction.LockingMode;
58
import org.infinispan.util.concurrent.IsolationLevel;
69
import org.jboss.as.controller.AttributeDefinition;
10+
import org.jboss.as.controller.AttributeMarshaller;
711
import org.jboss.as.controller.ObjectListAttributeDefinition;
812
import org.jboss.as.controller.ObjectTypeAttributeDefinition;
913
import org.jboss.as.controller.SimpleAttributeDefinition;
@@ -16,6 +20,7 @@
1620
import org.jboss.as.server.ServerEnvironment;
1721
import org.jboss.dmr.ModelNode;
1822
import org.jboss.dmr.ModelType;
23+
import org.jboss.dmr.Property;
1924

2025
/**
2126
* Attributes used in setting up Infinispan configurations
@@ -309,7 +314,22 @@ public interface CommonAttributes {
309314
SimpleListAttributeDefinition PROPERTIES = SimpleListAttributeDefinition.Builder.of(ModelKeys.PROPERTIES, PROPERTY).
310315
setAllowNull(true).
311316
build();
312-
SimpleMapAttributeDefinition INDEXING_PROPERTIES = new SimpleMapAttributeDefinition(ModelKeys.INDEXING_PROPERTIES, ModelKeys.INDEXING_PROPERTIES,true,true);
317+
SimpleMapAttributeDefinition INDEXING_PROPERTIES = new SimpleMapAttributeDefinition.Builder(ModelKeys.INDEXING_PROPERTIES, true)
318+
.setAllowExpression(true)
319+
.setAttributeMarshaller(new AttributeMarshaller() {
320+
@Override
321+
public void marshallAsElement(AttributeDefinition attribute, ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException {
322+
resourceModel = resourceModel.get(attribute.getName());
323+
if (!resourceModel.isDefined()) { return; }
324+
for (Property property : resourceModel.asPropertyList()) {
325+
writer.writeStartElement(org.jboss.as.controller.parsing.Element.PROPERTY.getLocalName());
326+
writer.writeAttribute(org.jboss.as.controller.parsing.Element.NAME.getLocalName(), property.getName());
327+
writer.writeCharacters(property.getValue().asString());
328+
writer.writeEndElement();
329+
}
330+
}
331+
})
332+
.build();
313333
SimpleAttributeDefinition PURGE =
314334
new SimpleAttributeDefinitionBuilder(ModelKeys.PURGE, ModelType.BOOLEAN, true)
315335
.setXmlName(Attribute.PURGE.getLocalName())

clustering/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemXMLWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ private void processCommonCacheAttributesElements(XMLExtendedStreamWriter writer
289289
if (cache.get(ModelKeys.INDEXING).isDefined()|| cache.get(ModelKeys.INDEXING_PROPERTIES).isDefined()){
290290
writer.writeStartElement(Element.INDEXING.getLocalName());
291291
CommonAttributes.INDEXING.marshallAsAttribute(cache, writer);
292-
CommonAttributes.INDEXING_PROPERTIES.marshalToElement(cache.get(ModelKeys.INDEXING_PROPERTIES),writer);
292+
CommonAttributes.INDEXING_PROPERTIES.marshallAsElement(cache,writer);
293293
writer.writeEndElement();
294294
}
295295
}

controller/src/main/java/org/jboss/as/controller/AbstractAttributeDefinitionBuilder.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public abstract class AbstractAttributeDefinitionBuilder<BUILDER extends Abstrac
5555
protected AttributeAccess.Flag[] flags;
5656
protected AttributeMarshaller attributeMarshaller = null;
5757
protected boolean resourceOnly = false;
58+
protected DeprecationData deprecated = null;
5859

5960
public AbstractAttributeDefinitionBuilder(final String attributeName, final ModelType type) {
6061
this(attributeName, type, false);
@@ -243,4 +244,9 @@ public BUILDER setResourceOnly() {
243244
this.resourceOnly = true;
244245
return (BUILDER) this;
245246
}
247+
248+
public BUILDER setDeprecated(ModelVersion since) {
249+
this.deprecated = new DeprecationData(since);
250+
return (BUILDER) this;
251+
}
246252
}

0 commit comments

Comments
 (0)