forked from wso2/carbon-identity-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a33b657
commit de08da0
Showing
3 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
...xecution/src/main/java/org/wso2/carbon/identity/action/execution/EventContextBuilder.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,39 @@ | ||
/* | ||
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). | ||
* | ||
* WSO2 LLC. licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.wso2.carbon.identity.action.execution; | ||
|
||
import org.wso2.carbon.identity.action.execution.exception.ActionExecutionRequestBuilderException; | ||
import org.wso2.carbon.identity.action.execution.model.ActionType; | ||
import org.wso2.carbon.identity.action.execution.model.EventContext; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* This interface defines the Action Execution Builder. | ||
* Action Execution Builder is the component that is responsible for building the Action Execution based on the | ||
* action type and the event context. | ||
*/ | ||
public interface EventContextBuilder { | ||
|
||
ActionType getSupportedActionType(); | ||
|
||
EventContext builEventContext(Map<String, Object> eventContext) throws | ||
ActionExecutionRequestBuilderException; | ||
|
||
} |
53 changes: 53 additions & 0 deletions
53
...n/src/main/java/org/wso2/carbon/identity/action/execution/EventContextBuilderFactory.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 (c) 2024, WSO2 LLC. (http://www.wso2.com). | ||
* | ||
* WSO2 LLC. licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.wso2.carbon.identity.action.execution; | ||
|
||
import org.wso2.carbon.identity.action.execution.model.ActionExecutionRequest; | ||
import org.wso2.carbon.identity.action.execution.model.ActionType; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* This class defines the Action Execution Request Builder Factory. | ||
* Action Execution Request Builder Factory is the component that is responsible for building | ||
* {@link ActionExecutionRequest} | ||
* based on the action type and the event context. | ||
*/ | ||
public class EventContextBuilderFactory { | ||
|
||
private static final Map<ActionType, EventContextBuilder> actionInvocationBuilders = | ||
new HashMap<>(); | ||
|
||
public static EventContextBuilder getActionExecutionBuilder(ActionType actionType) { | ||
|
||
return actionInvocationBuilders.get(actionType); | ||
} | ||
|
||
public static void registerActionExecutionBuilder(EventContextBuilder actionExecutionBuilder) { | ||
|
||
actionInvocationBuilders.put(actionExecutionBuilder.getSupportedActionType(), actionExecutionBuilder); | ||
} | ||
|
||
public static void unregisterActionExecutionBuilder(ActionExecutionRequestBuilder actionExecutionBuilder) { | ||
|
||
actionInvocationBuilders.remove(actionExecutionBuilder.getSupportedActionType()); | ||
} | ||
|
||
} |
52 changes: 52 additions & 0 deletions
52
...execution/src/main/java/org/wso2/carbon/identity/action/execution/model/EventContext.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,52 @@ | ||
/* | ||
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). | ||
* | ||
* WSO2 LLC. licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.wso2.carbon.identity.action.execution.model; | ||
|
||
import java.util.Map; | ||
|
||
public class EventContext { | ||
|
||
private String actionId; | ||
Map<String, Object> eventContext; | ||
|
||
public EventContext(Map<String, Object> eventContext) { | ||
|
||
this.eventContext = eventContext; | ||
} | ||
|
||
public void setEventContext(Map<String, Object> eventContext) { | ||
|
||
this.eventContext = eventContext; | ||
} | ||
|
||
public Map<String, Object> getEventContext() { | ||
|
||
return eventContext; | ||
} | ||
|
||
public void setAction(String actionId) { | ||
|
||
this.actionId = actionId; | ||
} | ||
|
||
public String getAction() { | ||
|
||
return actionId; | ||
} | ||
} |