-
Notifications
You must be signed in to change notification settings - Fork 465
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate discovery subsystem to SubsystemResourceXMLSchema.
- Loading branch information
Showing
12 changed files
with
254 additions
and
56 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
...n/java/org/wildfly/extension/discovery/AggregateDiscoveryProviderResourceDescription.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.wildfly.extension.discovery; | ||
|
||
import java.util.List; | ||
import java.util.function.Function; | ||
import java.util.stream.Stream; | ||
|
||
import org.jboss.as.controller.AttributeDefinition; | ||
import org.jboss.as.controller.OperationContext; | ||
import org.jboss.as.controller.OperationFailedException; | ||
import org.jboss.as.controller.PathElement; | ||
import org.jboss.dmr.ModelNode; | ||
import org.wildfly.discovery.impl.AggregateDiscoveryProvider; | ||
import org.wildfly.discovery.spi.DiscoveryProvider; | ||
import org.wildfly.subsystem.resource.capability.CapabilityReference; | ||
import org.wildfly.subsystem.resource.capability.CapabilityReferenceListAttributeDefinition; | ||
import org.wildfly.subsystem.service.ServiceDependency; | ||
|
||
/** | ||
* Describes an aggregate discovery provider resource. | ||
* @author Paul Ferraro | ||
*/ | ||
public enum AggregateDiscoveryProviderResourceDescription implements DiscoveryProviderResourceDescription { | ||
INSTANCE; | ||
|
||
static final CapabilityReferenceListAttributeDefinition<DiscoveryProvider> PROVIDER_NAMES = new CapabilityReferenceListAttributeDefinition.Builder<>("providers", CapabilityReference.builder(DiscoveryProviderResourceRegistrar.DISCOVERY_PROVIDER_CAPABILITY, DiscoveryProviderResourceRegistrar.DISCOVERY_PROVIDER_DESCRIPTOR).build()).build(); | ||
|
||
private final PathElement path = PathElement.pathElement("aggregate-provider"); | ||
|
||
@Override | ||
public PathElement getPathElement() { | ||
return this.path; | ||
} | ||
|
||
@Override | ||
public Stream<AttributeDefinition> getAttributes() { | ||
return Stream.of(PROVIDER_NAMES); | ||
} | ||
|
||
@Override | ||
public ServiceDependency<DiscoveryProvider> resolve(OperationContext context, ModelNode model) throws OperationFailedException { | ||
return AggregateDiscoveryProviderResourceDescription.PROVIDER_NAMES.resolve(context, model).map(new Function<>() { | ||
@Override | ||
public DiscoveryProvider apply(List<DiscoveryProvider> providers) { | ||
return new AggregateDiscoveryProvider(providers.toArray(DiscoveryProvider[]::new)); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...y/src/main/java/org/wildfly/extension/discovery/DiscoveryProviderResourceDescription.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.wildfly.extension.discovery; | ||
|
||
import org.jboss.as.controller.ResourceDescription; | ||
import org.wildfly.discovery.spi.DiscoveryProvider; | ||
import org.wildfly.subsystem.resource.ResourceModelResolver; | ||
import org.wildfly.subsystem.service.ServiceDependency; | ||
|
||
/** | ||
* Describes a discovery provider resource | ||
*/ | ||
public interface DiscoveryProviderResourceDescription extends ResourceDescription, ResourceModelResolver<ServiceDependency<DiscoveryProvider>> { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
.../src/main/java/org/wildfly/extension/discovery/DiscoverySubsystemResourceDescription.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.wildfly.extension.discovery; | ||
|
||
import org.jboss.as.controller.SubsystemResourceDescription; | ||
|
||
/** | ||
* Describes the discovery subsystem resource. | ||
*/ | ||
public enum DiscoverySubsystemResourceDescription implements SubsystemResourceDescription { | ||
INSTANCE; | ||
|
||
@Override | ||
public String getName() { | ||
return "discovery"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.