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 #78 from lucasponce/HWKALERTS-68
HWKALERTS-68
- Loading branch information
Showing
115 changed files
with
4,382 additions
and
2,154 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
35 changes: 35 additions & 0 deletions
35
hawkular-alerts-actions-api/src/main/java/org/hawkular/alerts/actions/api/ActionPlugin.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,35 @@ | ||
/* | ||
* Copyright 2015 Red Hat, Inc. and/or its affiliates | ||
* and other contributors as indicated by the @author tags. | ||
* | ||
* Licensed 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.hawkular.alerts.actions.api; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Define an alerts actions plugin implementation | ||
* Plugin must have a unique name that will be used at registration phase | ||
* Plugin must implement ActionPluginListener interface | ||
* | ||
* @author Lucas Ponce | ||
*/ | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.TYPE) | ||
public @interface ActionPlugin { | ||
String name(); | ||
} |
54 changes: 54 additions & 0 deletions
54
...lerts-actions-api/src/main/java/org/hawkular/alerts/actions/api/ActionPluginListener.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,54 @@ | ||
/* | ||
* Copyright 2015 Red Hat, Inc. and/or its affiliates | ||
* and other contributors as indicated by the @author tags. | ||
* | ||
* Licensed 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.hawkular.alerts.actions.api; | ||
|
||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
/** | ||
* A listener that will initialize the plugin and process incoming messages. | ||
* | ||
* @author Lucas Ponce | ||
*/ | ||
public interface ActionPluginListener { | ||
|
||
/** | ||
* The alerts engine registers the plugins available with their properties. | ||
* This method is invoked at plugin registration time. | ||
* | ||
* @return a list of properties available on this plugin | ||
*/ | ||
Set<String> getProperties(); | ||
|
||
/** | ||
* The alerts engine registers the plugins available with their default values. | ||
* This method is invoked at plugin registration time. | ||
* Default values can be modified by the alerts engine. | ||
* | ||
* | ||
* @return a list of default values for properties available on this plugin | ||
*/ | ||
Map<String, String> getDefaultProperties(); | ||
|
||
/** | ||
* This method is invoked by the ActionService to process a new action generated by the engine. | ||
* | ||
* @param msg PluginMessage received to be processed by the plugin | ||
* @throws Exception any problem | ||
*/ | ||
void process(PluginMessage msg) throws Exception; | ||
} |
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
36 changes: 36 additions & 0 deletions
36
hawkular-alerts-actions-api/src/main/java/org/hawkular/alerts/actions/api/PluginMessage.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,36 @@ | ||
/* | ||
* Copyright 2015 Red Hat, Inc. and/or its affiliates | ||
* and other contributors as indicated by the @author tags. | ||
* | ||
* Licensed 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.hawkular.alerts.actions.api; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import java.util.Map; | ||
import org.hawkular.alerts.api.model.action.Action; | ||
|
||
/** | ||
* A message sent to the plugin from the alerts engine | ||
* It has the alert payload as well as action properties | ||
* | ||
* @author Lucas Ponce | ||
*/ | ||
public interface PluginMessage { | ||
|
||
@JsonInclude | ||
Action getAction(); | ||
|
||
@JsonInclude | ||
Map<String, String> getProperties(); | ||
} |
48 changes: 48 additions & 0 deletions
48
...rts-actions-api/src/main/java/org/hawkular/alerts/actions/api/PluginOperationMessage.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,48 @@ | ||
/* | ||
* Copyright 2015 Red Hat, Inc. and/or its affiliates | ||
* and other contributors as indicated by the @author tags. | ||
* | ||
* Licensed 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.hawkular.alerts.actions.api; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
/** | ||
* A message sent to the alerts engine from the plugin | ||
* It defines a code of operation and payloads | ||
* | ||
* It used for plugin registration but additional operations should be supported | ||
* | ||
* @author Lucas Ponce | ||
*/ | ||
public interface PluginOperationMessage { | ||
|
||
enum Operation { | ||
REGISTRATION | ||
} | ||
|
||
@JsonInclude | ||
Operation getOperation(); | ||
|
||
@JsonInclude | ||
String getActionPlugin(); | ||
|
||
@JsonInclude | ||
Set<String> getPropertyNames(); | ||
|
||
@JsonInclude | ||
Map<String, String> getDefaultProperties(); | ||
} |
162 changes: 0 additions & 162 deletions
162
...alerts-actions-api/src/main/java/org/hawkular/alerts/actions/api/model/ActionMessage.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.