Search in sources :

Example 1 with Capabilities

use of org.jboss.hal.meta.capabilitiy.Capabilities in project console by hal.

the class OperationFactoryTest method setUp.

@Before
public void setUp() {
    AddressTemplate template = AddressTemplate.of("/{selected.profile}/subsystem=resource-adapters/resource-adapter=*/connection-definitions=*");
    ModelNode rrd = ExternalModelNode.read(OperationFactoryTest.class.getResourceAsStream("connection-definition.dmr"));
    metadata = new Metadata(template, () -> SecurityContext.RWX, new ResourceDescription(rrd), new Capabilities(null));
    address = ResourceAddress.root();
    operationFactory = new OperationFactory();
}
Also used : AddressTemplate(org.jboss.hal.meta.AddressTemplate) ResourceDescription(org.jboss.hal.meta.description.ResourceDescription) Capabilities(org.jboss.hal.meta.capabilitiy.Capabilities) Metadata(org.jboss.hal.meta.Metadata) ModelNode(org.jboss.hal.dmr.ModelNode) ExternalModelNode(org.jboss.hal.dmr.ExternalModelNode) Before(org.junit.Before)

Example 2 with Capabilities

use of org.jboss.hal.meta.capabilitiy.Capabilities in project console by hal.

the class DefaultFormItemProvider method checkCapabilityReference.

private void checkCapabilityReference(ModelNode attributeDescription, FormItem<?> formItem) {
    SuggestHandler suggestHandler = null;
    if (attributeDescription.hasDefined(CAPABILITY_REFERENCE)) {
        Dispatcher dispatcher = Core.INSTANCE.dispatcher();
        StatementContext statementContext = Core.INSTANCE.statementContext();
        String reference = attributeDescription.get(CAPABILITY_REFERENCE).asString();
        Capabilities capabilities = metadata.getCapabilities();
        if (capabilities.supportsSuggestions()) {
            suggestHandler = new SuggestCapabilitiesAutoComplete(dispatcher, statementContext, reference, metadata.getTemplate());
        } else if (capabilities.contains(reference)) {
            suggestHandler = new ReadChildrenAutoComplete(dispatcher, statementContext, capabilities.lookup(reference));
        }
    }
    if (suggestHandler != null) {
        formItem.registerSuggestHandler(suggestHandler);
    }
}
Also used : SuggestCapabilitiesAutoComplete(org.jboss.hal.ballroom.autocomplete.SuggestCapabilitiesAutoComplete) Capabilities(org.jboss.hal.meta.capabilitiy.Capabilities) Dispatcher(org.jboss.hal.dmr.dispatch.Dispatcher) SuggestHandler(org.jboss.hal.ballroom.form.SuggestHandler) ReadChildrenAutoComplete(org.jboss.hal.ballroom.autocomplete.ReadChildrenAutoComplete) StatementContext(org.jboss.hal.meta.StatementContext)

Aggregations

Capabilities (org.jboss.hal.meta.capabilitiy.Capabilities)2 ReadChildrenAutoComplete (org.jboss.hal.ballroom.autocomplete.ReadChildrenAutoComplete)1 SuggestCapabilitiesAutoComplete (org.jboss.hal.ballroom.autocomplete.SuggestCapabilitiesAutoComplete)1 SuggestHandler (org.jboss.hal.ballroom.form.SuggestHandler)1 ExternalModelNode (org.jboss.hal.dmr.ExternalModelNode)1 ModelNode (org.jboss.hal.dmr.ModelNode)1 Dispatcher (org.jboss.hal.dmr.dispatch.Dispatcher)1 AddressTemplate (org.jboss.hal.meta.AddressTemplate)1 Metadata (org.jboss.hal.meta.Metadata)1 StatementContext (org.jboss.hal.meta.StatementContext)1 ResourceDescription (org.jboss.hal.meta.description.ResourceDescription)1 Before (org.junit.Before)1