Skip to content

Commit

Permalink
Merge pull request #78 from lucasponce/HWKALERTS-68
Browse files Browse the repository at this point in the history
HWKALERTS-68
  • Loading branch information
jshaughn committed Jul 31, 2015
2 parents 73236ca + 63f25b2 commit 0719ca3
Show file tree
Hide file tree
Showing 115 changed files with 4,382 additions and 2,154 deletions.
12 changes: 4 additions & 8 deletions hawkular-alerts-actions-api/pom.xml
Expand Up @@ -33,20 +33,14 @@

<dependencies>

<!-- Hawkular Alerts dependencies -->
<dependency>
<groupId>org.hawkular.alerts</groupId>
<artifactId>hawkular-alerts-api</artifactId>
<version>${project.version}</version>
</dependency>

<!-- The hawkular platform will provide these -->
<dependency>
<groupId>org.hawkular.bus</groupId>
<artifactId>hawkular-bus-mdb</artifactId>
<version>${version.org.hawkular.bus}</version>
<scope>provided</scope>
</dependency>

<!-- Wildfly dependencies -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson2-provider</artifactId>
Expand All @@ -56,6 +50,7 @@
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
Expand All @@ -70,6 +65,7 @@
<scope>provided</scope>
</dependency>

<!-- Tests -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
@@ -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();
}
@@ -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;
}
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hawkular.alerts.actions.api.log;
package org.hawkular.alerts.actions.api;

import org.jboss.logging.BasicLogger;
import org.jboss.logging.Logger;
Expand Down
@@ -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();
}
@@ -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();
}

This file was deleted.

0 comments on commit 0719ca3

Please sign in to comment.