-
Notifications
You must be signed in to change notification settings - Fork 466
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generalize DelegatingResourceDefinition to accomodate non-lazy decora…
…tors.
- Loading branch information
Showing
2 changed files
with
130 additions
and
73 deletions.
There are no files selected for viewing
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
107 changes: 107 additions & 0 deletions
107
controller/src/main/java/org/jboss/as/controller/ProvidedResourceDefinition.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,107 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.jboss.as.controller; | ||
|
||
import java.util.List; | ||
import java.util.function.Supplier; | ||
|
||
import org.jboss.as.controller.access.management.AccessConstraintDefinition; | ||
import org.jboss.as.controller.descriptions.DescriptionProvider; | ||
import org.jboss.as.controller.registry.ImmutableManagementResourceRegistration; | ||
import org.jboss.as.controller.registry.ManagementResourceRegistration; | ||
import org.jboss.as.version.Stability; | ||
import org.wildfly.common.function.Functions; | ||
|
||
/** | ||
* Generalized {@link ResourceDefinition} decorator. | ||
*/ | ||
public class ProvidedResourceDefinition implements ResourceDefinition { | ||
|
||
private final Supplier<ResourceDefinition> provider; | ||
|
||
public ProvidedResourceDefinition(ResourceDefinition definition) { | ||
this(Functions.constantSupplier(definition)); | ||
} | ||
|
||
public ProvidedResourceDefinition(Supplier<ResourceDefinition> provider) { | ||
this.provider = provider; | ||
} | ||
|
||
@Override | ||
public PathElement getPathElement() { | ||
return this.provider.get().getPathElement(); | ||
} | ||
|
||
@Override | ||
public DescriptionProvider getDescriptionProvider(ImmutableManagementResourceRegistration registration) { | ||
return this.provider.get().getDescriptionProvider(registration); | ||
} | ||
|
||
@Override | ||
public void registerOperations(ManagementResourceRegistration registration) { | ||
this.provider.get().registerOperations(registration); | ||
} | ||
|
||
@Override | ||
public void registerAttributes(ManagementResourceRegistration registration) { | ||
this.provider.get().registerAttributes(registration); | ||
} | ||
|
||
@Override | ||
public void registerNotifications(ManagementResourceRegistration registration) { | ||
this.provider.get().registerNotifications(registration); | ||
} | ||
|
||
@Override | ||
public void registerChildren(ManagementResourceRegistration registration) { | ||
this.provider.get().registerChildren(registration); | ||
} | ||
|
||
@Override | ||
public void registerCapabilities(ManagementResourceRegistration registration) { | ||
this.provider.get().registerCapabilities(registration); | ||
} | ||
|
||
@Override | ||
public void registerAdditionalRuntimePackages(ManagementResourceRegistration registration) { | ||
this.provider.get().registerAdditionalRuntimePackages(registration); | ||
} | ||
|
||
@Override | ||
public boolean isFeature() { | ||
return this.provider.get().isFeature(); | ||
} | ||
|
||
@Override | ||
public boolean isOrderedChild() { | ||
return this.provider.get().isOrderedChild(); | ||
} | ||
|
||
@Override | ||
public boolean isRuntime() { | ||
return this.provider.get().isRuntime(); | ||
} | ||
|
||
@Override | ||
public List<AccessConstraintDefinition> getAccessConstraints() { | ||
return this.provider.get().getAccessConstraints(); | ||
} | ||
|
||
@Override | ||
public int getMaxOccurs() { | ||
return this.provider.get().getMaxOccurs(); | ||
} | ||
|
||
@Override | ||
public int getMinOccurs() { | ||
return this.provider.get().getMinOccurs(); | ||
} | ||
|
||
@Override | ||
public Stability getStability() { | ||
return this.provider.get().getStability(); | ||
} | ||
} |