-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Solve #1011, Add action scheduler interface
- Loading branch information
1 parent
75dbb57
commit f7dbdbb
Showing
8 changed files
with
282 additions
and
43 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
66 changes: 66 additions & 0 deletions
66
smart-common/src/main/java/org/smartdata/model/action/ActionScheduler.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,66 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF 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.smartdata.model.action; | ||
|
||
import org.smartdata.model.ActionInfo; | ||
import org.smartdata.model.LaunchAction; | ||
|
||
import java.util.List; | ||
|
||
public interface ActionScheduler { | ||
|
||
List<String> getSupportedActions(); | ||
|
||
/** | ||
* Called when new action submitted to CmdletManager. | ||
* | ||
* @param actionInfo | ||
* @return acceptable if true, or discard | ||
*/ | ||
boolean onSubmit(ActionInfo actionInfo); | ||
|
||
/** | ||
* Trying to schedule an action for Dispatch. | ||
* @param actionInfo | ||
* @param action | ||
* @return | ||
*/ | ||
ScheduleResult onSchedule(ActionInfo actionInfo, LaunchAction action); | ||
|
||
/** | ||
* Called after and an Cmdlet get scheduled. | ||
* | ||
* @param actionInfo | ||
* @param result | ||
*/ | ||
void postSchedule(ActionInfo actionInfo, ScheduleResult result); | ||
|
||
/** | ||
* Called just before dispatch for execution. | ||
* | ||
* @param action | ||
*/ | ||
void onPreDispatch(LaunchAction action); | ||
|
||
/** | ||
* Called when action finished execution. | ||
* | ||
* @param actionInfo | ||
*/ | ||
void onActionFinished(ActionInfo actionInfo); | ||
} |
33 changes: 33 additions & 0 deletions
33
smart-common/src/main/java/org/smartdata/model/action/CmdletScheduler.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,33 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF 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.smartdata.model.action; | ||
|
||
// TODO: to be implemented | ||
public interface CmdletScheduler { | ||
|
||
boolean onSubmitCmdlet(); | ||
boolean postSubmitCmdlet(); | ||
|
||
ScheduleResult onSchedule(); | ||
void postSchedule(); | ||
|
||
void onDispatch(); | ||
|
||
void onActionMessage(); | ||
void onCmdletFinished(); | ||
} |
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.