Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #857 from bstansberry/WFCORE-781
[WFCORE-781] Add ability to use capability-provided integrations from… … services and DUPs
- Loading branch information
Showing
12 changed files
with
212 additions
and
10 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
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
100 changes: 100 additions & 0 deletions
100
controller/src/main/java/org/jboss/as/controller/capability/CapabilityServiceSupport.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,100 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2015, Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. See the copyright.txt file in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
|
||
package org.jboss.as.controller.capability; | ||
|
||
import org.jboss.msc.service.ServiceName; | ||
|
||
/** | ||
* Provides support for capability integration outside the management layer, | ||
* in service implementations. | ||
* <p> | ||
* Note that use of this interface in no way creates a requirement on the | ||
* referenced capability by the caller. | ||
* | ||
* @author Brian Stansberry | ||
*/ | ||
public interface CapabilityServiceSupport { | ||
|
||
/** | ||
* Exception thrown when support for an unregistered capability is requested. This is a checked | ||
* exception because {@code CapabilityServiceSupport} is used outside the management layer and | ||
* the requirements for capability availability available in {@link org.jboss.as.controller.OperationContext} | ||
* are not possible. So callers need to be aware of and handle non-existent capabilities. | ||
*/ | ||
class NoSuchCapabilityException extends Exception { | ||
|
||
static final long serialVersionUID = 1L; | ||
|
||
public NoSuchCapabilityException(String message) { | ||
super(message); | ||
} | ||
} | ||
|
||
/** | ||
* Gets the runtime API associated with a given capability, if there is one. | ||
* @param capabilityName the name of the capability. Cannot be {@code null} | ||
* @param apiType class of the java type that exposes the API. Cannot be {@code null} | ||
* @param <T> the java type that exposes the API | ||
* @return the runtime API. Will not return {@code null} | ||
* | ||
* @throws NoSuchCapabilityException if no matching capability is registered | ||
* @throws java.lang.IllegalArgumentException if the capability does not provide a runtime API | ||
* @throws java.lang.ClassCastException if the runtime API exposed by the capability cannot be cast to type {code T} | ||
*/ | ||
<T> T getCapabilityRuntimeAPI(String capabilityName, Class<T> apiType) throws NoSuchCapabilityException; | ||
|
||
/** | ||
* Gets the runtime API associated with a given {@link RuntimeCapability#isDynamicallyNamed() dynamically named} | ||
* capability, if there is one. | ||
* | ||
* @param capabilityBaseName the base name of the capability. Cannot be {@code null} | ||
* @param dynamicPart the dynamic part of the capability name. Cannot be {@code null} | ||
* @param apiType class of the java type that exposes the API. Cannot be {@code null} | ||
* @param <T> the java type that exposes the API | ||
* @return the runtime API. Will not return {@code null} | ||
* | ||
* @throws NoSuchCapabilityException if no matching capability is registered | ||
* @throws java.lang.IllegalArgumentException if the capability does not provide a runtime API | ||
* @throws java.lang.ClassCastException if the runtime API exposed by the capability cannot be cast to type {code T} | ||
*/ | ||
<T> T getCapabilityRuntimeAPI(String capabilityBaseName, String dynamicPart, Class<T> apiType) throws NoSuchCapabilityException; | ||
|
||
/** | ||
* Gets the name of a service associated with a given capability. This method does not confirm that the | ||
* capability is currently registered. | ||
* | ||
* @param capabilityName the name of the capability. Cannot be {@code null} | ||
* @return the name of the service. Will not return {@code null} | ||
*/ | ||
ServiceName getCapabilityServiceName(String capabilityName); | ||
|
||
/** | ||
* Gets the name of a service associated with a given {@link RuntimeCapability#isDynamicallyNamed() dynamically named} | ||
* capability. This method does not confirm that the capability is currently registered. | ||
* | ||
* @param capabilityBaseName the base name of the capability. Cannot be {@code null} | ||
* @param dynamicPart the dynamic part of the capability name. Cannot be {@code null} | ||
* @return the name of the service. Will not return {@code null} | ||
*/ | ||
ServiceName getCapabilityServiceName(String capabilityBaseName, String dynamicPart); | ||
} |
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
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.