-
1. Re: Extending Wildfly, Documentation Example, Debugging The Model [Please Help]
jblodgett Sep 18, 2018 12:41 PM (in response to jblodgett)Update. I found the mistake that was cause the first error. I had forgot to set the subsytem xml in the test. ie KernelServices services = super.createKernelServicesBuilder(null).setSubsystemXml(subsystemXml).build();
All the tests now have this error.
java.lang.IllegalArgumentException: JBAS014821: Operation contains a parameter 'tick' which is not one of the expected parameters []. {"operation" => "add","tick" => 12345L,"address" => [("subsystem" => "tracker"),("type" => "tst")]}
-
2. Re: Extending Wildfly, Documentation Example, Debugging The Model [Please Help]
ctomc Sep 19, 2018 5:16 AM (in response to jblodgett)how does your model look like?
ResourceDefintion itself?
-
3. Re: Extending Wildfly, Documentation Example, Debugging The Model [Please Help]
jblodgett Sep 20, 2018 2:32 PM (in response to ctomc)Hi Tomaz, thanks for responding.
my in resources/schema/acme.xsd file
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:com.acme.corp.tracker:1.0"
xmlns="urn:com.acme.corp.tracker:1.0"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="1.0"><!-- The subsystem root element -->
<xs:element name="subsystem" type="subsystemType"/><xs:complexType name="subsystemType">
<xs:all>
<xs:element name="deployment-types" type="deployment-typesType"/>
</xs:all>
</xs:complexType>
<xs:complexType name="deployment-typesType">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="deployment-type" type="deployment-typeType"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="deployment-typeType">
<xs:attribute name="suffix" use="required"/>
<xs:attribute name="tick" type="xs:long" use="optional" default="10000"/>
</xs:complexType>
</xs:schema>
My resource Definiiton located at ./extension/TypeDefinition.java
public class TypeDefinition extends SimpleResourceDefinition implements ResourceDefinition{
public static final TypeDefinition INSTANCE = new TypeDefinition();
//we define attribute named tick
protected static final SimpleAttributeDefinition TICK =new SimpleAttributeDefinitionBuilder("tick", ModelType.LONG)
.setAllowExpression(true)
.setXmlName("tick")
.setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
.setDefaultValue(new ModelNode(1000))
.setAllowNull(false)
.build();
private TypeDefinition(){
super(SubsystemExtension.TYPE_PATH, SubsystemExtension.getResourceDescriptionResolver(TYPE),
TypeAddHandler.INSTANCE,
TypeRemoveHandler.INSTANCE);
}
@Override
public void registerOperations(ManagementResourceRegistration resourceRegistration) {super.registerOperations(resourceRegistration);
//you can register aditional operations here
}@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration){resourceRegistration.registerReadWriteAttribute(TICK, null, TrackerTickHandler.INSTANCE);
}
}