http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/PublishSpec.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/PublishSpec.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/PublishSpec.java deleted file mode 100644 index e38ee97..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/PublishSpec.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model; - -import org.apache.eagle.alert.engine.coordinator.Publishment; - -import com.fasterxml.jackson.annotation.JsonIgnore; - -import java.util.ArrayList; -import java.util.List; - -public class PublishSpec { - - private String topologyName; - // actually only publish spec for one topology - private String boltId; - private String version; - - private List<Publishment> publishments = new ArrayList<Publishment>(); - - public PublishSpec() { - } - - public PublishSpec(String topoName, String boltId) { - this.topologyName = topoName; - this.boltId = boltId; - } - - @JsonIgnore - public void addPublishment(Publishment p) { - if (!this.publishments.contains(p)) { - this.publishments.add(p); - } - } - - public String getTopologyName() { - return topologyName; - } - - public String getBoltId() { - return boltId; - } - - public List<Publishment> getPublishments() { - return publishments; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public void setTopologyName(String topologyName) { - this.topologyName = topologyName; - } - - public void setBoltId(String boltId) { - this.boltId = boltId; - } - - public void setPublishments(List<Publishment> publishments) { - this.publishments = publishments; - } - -}
http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/RouterSpec.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/RouterSpec.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/RouterSpec.java deleted file mode 100644 index b3877c3..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/RouterSpec.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import org.apache.eagle.alert.engine.coordinator.StreamPartition; -import org.apache.eagle.alert.engine.coordinator.StreamSortSpec; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - -public class RouterSpec { - private String version; - private String topologyName; - - private List<StreamRouterSpec> routerSpecs; - - public RouterSpec() { - routerSpecs = new ArrayList<StreamRouterSpec>(); - } - - public RouterSpec(String topoName) { - this(); - this.topologyName = topoName; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getTopologyName() { - return topologyName; - } - - public void setTopologyName(String topologyName) { - this.topologyName = topologyName; - } - - @JsonIgnore - public void addRouterSpec(StreamRouterSpec routerSpec) { - routerSpecs.add(routerSpec); - } - - public List<StreamRouterSpec> getRouterSpecs() { - return routerSpecs; - } - - public void setRouterSpecs(List<StreamRouterSpec> routerSpecs) { - this.routerSpecs = routerSpecs; - } - - public Map<StreamPartition, List<StreamRouterSpec>> makeSRS() { - Map<StreamPartition, List<StreamRouterSpec>> newSRS = new HashMap<>(); - this.getRouterSpecs().forEach(t -> { - if (!newSRS.containsKey(t.getPartition())) { - newSRS.put(t.getPartition(), new ArrayList<>()); - } - newSRS.get(t.getPartition()).add(t); - }); - return newSRS; - } - - public Map<StreamPartition, StreamSortSpec> makeSSS() { - Map<StreamPartition, StreamSortSpec> newSSS = new HashMap<>(); - this.getRouterSpecs().forEach(t -> { - if (t.getPartition().getSortSpec() != null) { - newSSS.put(t.getPartition(), t.getPartition().getSortSpec()); - } - }); - return newSSS; - } - - @Override - public String toString() { - return String.format("version:%s-topo:%s, boltSpec:%s", version, topologyName, routerSpecs); - } -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/ScheduleState.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/ScheduleState.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/ScheduleState.java deleted file mode 100644 index 40ac85d..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/ScheduleState.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model; - -import org.apache.eagle.alert.coordination.model.internal.MonitoredStream; -import org.apache.eagle.alert.coordination.model.internal.PolicyAssignment; -import org.apache.eagle.alert.engine.coordinator.PolicyDefinition; -import org.apache.eagle.alert.engine.coordinator.StreamDefinition; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * A global wise of schedule status <br/> - * <br/> - * TODO/FIXME: The persistence simply deserial ScheduleState to Json. One - * concern is that this string might become too big for store. <br/> - * <br/> - * The solution is in metadata resource, have specs/monitoredStreams/policy - * assignments stored in different table/collections with tage version. - * - * @since Apr 26, 2016 - */ -public class ScheduleState { - - // ScheduleSpec - private Map<String, SpoutSpec> spoutSpecs = new HashMap<String, SpoutSpec>(); - private Map<String, AlertBoltSpec> alertSpecs = new HashMap<String, AlertBoltSpec>(); - private Map<String, RouterSpec> groupSpecs = new HashMap<String, RouterSpec>(); - private Map<String, PublishSpec> publishSpecs = new HashMap<String, PublishSpec>(); - - // ScheduleSnapshot - private List<VersionedPolicyDefinition> policySnapshots = new ArrayList<VersionedPolicyDefinition>(); - private List<VersionedStreamDefinition> streamSnapshots = new ArrayList<VersionedStreamDefinition>(); - - // ScheduleResult - private List<MonitoredStream> monitoredStreams = new ArrayList<MonitoredStream>(); - private List<PolicyAssignment> assignments = new ArrayList<PolicyAssignment>(); - - private String version; - // FIXME : should be date, can not make it simple in mongo.. - private String generateTime; - private int code = 200; - private String message = "OK"; - private int scheduleTimeMillis; - - public ScheduleState() { - this.generateTime = String.valueOf(new Date().getTime()); - } - - public ScheduleState(String version, - Map<String, SpoutSpec> topoSpoutSpecsMap, - Map<String, RouterSpec> groupSpecsMap, - Map<String, AlertBoltSpec> alertSpecsMap, - Map<String, PublishSpec> pubMap, - Collection<PolicyAssignment> assignments, - Collection<MonitoredStream> monitoredStreams, - Collection<PolicyDefinition> definitions, - Collection<StreamDefinition> streams) { - this.spoutSpecs = topoSpoutSpecsMap; - this.groupSpecs = groupSpecsMap; - this.alertSpecs = alertSpecsMap; - this.publishSpecs = pubMap; - this.version = version; - this.generateTime = String.valueOf(new Date().getTime()); - this.assignments = new ArrayList<PolicyAssignment>(assignments); - this.monitoredStreams = new ArrayList<MonitoredStream>(monitoredStreams); - this.policySnapshots = new ArrayList<VersionedPolicyDefinition>(); - this.streamSnapshots = new ArrayList<VersionedStreamDefinition>(); - - for (SpoutSpec ss : this.spoutSpecs.values()) { - ss.setVersion(version); - } - - for (RouterSpec ss : this.groupSpecs.values()) { - ss.setVersion(version); - } - - for (AlertBoltSpec ss : this.alertSpecs.values()) { - ss.setVersion(version); - } - - for (PublishSpec ps : this.publishSpecs.values()) { - ps.setVersion(version); - } - - for (MonitoredStream ms : this.monitoredStreams) { - ms.setVersion(version); - } - for (PolicyAssignment ps : this.assignments) { - ps.setVersion(version); - } - for (PolicyDefinition def : definitions) { - this.policySnapshots.add(new VersionedPolicyDefinition(version, def)); - } - for (StreamDefinition sd : streams) { - this.streamSnapshots.add(new VersionedStreamDefinition(version, sd)); - } - } - - public Map<String, SpoutSpec> getSpoutSpecs() { - return spoutSpecs; - } - - public void setSpoutSpecs(Map<String, SpoutSpec> spoutSpecs) { - this.spoutSpecs = spoutSpecs; - } - - public Map<String, AlertBoltSpec> getAlertSpecs() { - return alertSpecs; - } - - public void setAlertSpecs(Map<String, AlertBoltSpec> alertSpecs) { - this.alertSpecs = alertSpecs; - } - - public Map<String, RouterSpec> getGroupSpecs() { - return groupSpecs; - } - - public void setGroupSpecs(Map<String, RouterSpec> groupSpecs) { - this.groupSpecs = groupSpecs; - } - - public Map<String, PublishSpec> getPublishSpecs() { - return publishSpecs; - } - - public void setPublishSpecs(Map<String, PublishSpec> publishSpecs) { - this.publishSpecs = publishSpecs; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public String getGenerateTime() { - return generateTime; - } - - public void setGenerateTime(String generateTime) { - this.generateTime = generateTime; - } - - public List<MonitoredStream> getMonitoredStreams() { - return monitoredStreams; - } - - public List<PolicyAssignment> getAssignments() { - return assignments; - } - - public List<VersionedPolicyDefinition> getPolicySnapshots() { - return policySnapshots; - } - - public void setPolicySnapshots(List<VersionedPolicyDefinition> policySnapshots) { - this.policySnapshots = policySnapshots; - } - - public void setMonitoredStreams(List<MonitoredStream> monitoredStreams) { - this.monitoredStreams = monitoredStreams; - } - - public void setAssignments(List<PolicyAssignment> assignments) { - this.assignments = assignments; - } - - public List<VersionedStreamDefinition> getStreamSnapshots() { - return streamSnapshots; - } - - public void setStreamSnapshots(List<VersionedStreamDefinition> streamSnapshots) { - this.streamSnapshots = streamSnapshots; - } - - public int getScheduleTimeMillis() { - return scheduleTimeMillis; - } - - public void setScheduleTimeMillis(int scheduleTimeMillis) { - this.scheduleTimeMillis = scheduleTimeMillis; - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/SpoutSpec.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/SpoutSpec.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/SpoutSpec.java deleted file mode 100644 index f5c7399..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/SpoutSpec.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model; - -import com.fasterxml.jackson.annotation.JsonIgnore; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -/** - * SpoutSpec metadata control 3 phases for data transformation for one specific topic - * phase 1: kafka topic to tuple, controlled by Kafka2TupleMetadata, i.e. Scheme - * phase 2: tuple to stream, controlled by Tuple2StreamMetadata, i.e. stream name selector etc. - * phase 3: stream repartition, controlled by StreamRepartitionMetadata, i.e. groupby spec - * - * @since Apr 18, 2016 - */ -public class SpoutSpec { - private String version; - - // private String spoutId; - private String topologyId; - - // topicName -> kafka2TupleMetadata - private Map<String, Kafka2TupleMetadata> kafka2TupleMetadataMap = new HashMap<String, Kafka2TupleMetadata>(); - // topicName -> Tuple2StreamMetadata - private Map<String, Tuple2StreamMetadata> tuple2StreamMetadataMap = new HashMap<String, Tuple2StreamMetadata>(); - // topicName -> list of StreamRepartitionMetadata, here it is list because one topic(data source) may spawn multiple streams. - private Map<String, List<StreamRepartitionMetadata>> streamRepartitionMetadataMap = new HashMap<String, List<StreamRepartitionMetadata>>(); - - public SpoutSpec() { - } - - public SpoutSpec( - String topologyId, - // String spoutId, - Map<String, List<StreamRepartitionMetadata>> streamRepartitionMetadataMap, - Map<String, Tuple2StreamMetadata> tuple2StreamMetadataMap, - Map<String, Kafka2TupleMetadata> kafka2TupleMetadataMap) { - this.topologyId = topologyId; - // this.spoutId = spoutId; - this.streamRepartitionMetadataMap = streamRepartitionMetadataMap; - this.tuple2StreamMetadataMap = tuple2StreamMetadataMap; - this.kafka2TupleMetadataMap = kafka2TupleMetadataMap; - } - - // public String getSpoutId() { - // return spoutId; - // } - // public void setSpoutId(String spoutId) { - // this.spoutId = spoutId; - // } - - public String getTopologyId() { - return topologyId; - } - - public Map<String, List<StreamRepartitionMetadata>> getStreamRepartitionMetadataMap() { - return streamRepartitionMetadataMap; - } - - public Map<String, Tuple2StreamMetadata> getTuple2StreamMetadataMap() { - return this.tuple2StreamMetadataMap; - } - - public Map<String, Kafka2TupleMetadata> getKafka2TupleMetadataMap() { - return kafka2TupleMetadataMap; - } - - @JsonIgnore - public StreamRepartitionMetadata getStream(String streamName) { - for (List<StreamRepartitionMetadata> meta : this.streamRepartitionMetadataMap.values()) { - Optional<StreamRepartitionMetadata> m = meta.stream().filter((t) -> t.getStreamId().equalsIgnoreCase(streamName)).findFirst(); - if (m.isPresent()) { - return m.get(); - } - } - return null; - } - - public void setTopologyId(String topologyId) { - this.topologyId = topologyId; - } - - public void setKafka2TupleMetadataMap(Map<String, Kafka2TupleMetadata> kafka2TupleMetadataMap) { - this.kafka2TupleMetadataMap = kafka2TupleMetadataMap; - } - - public void setTuple2StreamMetadataMap(Map<String, Tuple2StreamMetadata> tuple2StreamMetadataMap) { - this.tuple2StreamMetadataMap = tuple2StreamMetadataMap; - } - - public void setStreamRepartitionMetadataMap(Map<String, List<StreamRepartitionMetadata>> streamRepartitionMetadataMap) { - this.streamRepartitionMetadataMap = streamRepartitionMetadataMap; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - @Override - public String toString() { - return String.format("version:%s-topo:%s ", version, this.topologyId); - } - -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/StreamNameSelector.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/StreamNameSelector.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/StreamNameSelector.java deleted file mode 100644 index f613b11..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/StreamNameSelector.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model; - -import java.util.Map; - -/** - * This metadata controls how to figure out stream name from incoming tuple. - */ -public interface StreamNameSelector { - /** - * field name to value mapping. - */ - String getStreamName(Map<String, Object> tuple); -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/StreamRepartitionMetadata.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/StreamRepartitionMetadata.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/StreamRepartitionMetadata.java deleted file mode 100644 index d1ce9da..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/StreamRepartitionMetadata.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model; - -import com.fasterxml.jackson.annotation.JsonIgnore; - -import java.util.ArrayList; -import java.util.List; - -/** - * This meta-data controls how tuple streamId is repartitioned. - * @since Apr 25, 2016 - */ -public class StreamRepartitionMetadata { - private String topicName; - private String streamId; - /** - * each stream may have multiple different grouping strategies,for example groupby some fields or even shuffling. - */ - public List<StreamRepartitionStrategy> groupingStrategies = new ArrayList<StreamRepartitionStrategy>(); - - public StreamRepartitionMetadata() { - } - - public StreamRepartitionMetadata(String topicName, String stream) { - this.topicName = topicName; - this.streamId = stream; - } - - public String getStreamId() { - return streamId; - } - - public void setStreamId(String streamId) { - this.streamId = streamId; - } - - public String getTopicName() { - return topicName; - } - - public void setTopicName(String topicName) { - this.topicName = topicName; - } - - public List<StreamRepartitionStrategy> getGroupingStrategies() { - return groupingStrategies; - } - - @JsonIgnore - public void addGroupStrategy(StreamRepartitionStrategy gs) { - this.groupingStrategies.add(gs); - } - - public void setGroupingStrategies(List<StreamRepartitionStrategy> groupingStrategies) { - this.groupingStrategies = groupingStrategies; - } -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/StreamRepartitionStrategy.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/StreamRepartitionStrategy.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/StreamRepartitionStrategy.java deleted file mode 100644 index 118347f..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/StreamRepartitionStrategy.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model; - -import org.apache.eagle.alert.engine.coordinator.StreamPartition; - -import org.apache.commons.collections.CollectionUtils; -import java.util.ArrayList; -import java.util.List; - -public class StreamRepartitionStrategy { - public StreamPartition partition; - - public int numTotalParticipatingRouterBolts = 0; // how many group-by bolts participate policy evaluation - public int startSequence = 0; // what is the sequence for the first bolt in this topology among all bolts - public List<String> totalTargetBoltIds = new ArrayList<String>(); - - public int hashCode() { - int hashcode = 1 * 31; - hashcode += partition.hashCode(); - for (String str : totalTargetBoltIds) { - hashcode += str.hashCode(); - } - return hashcode; - } - - public boolean equals(Object obj) { - if (!(obj instanceof StreamRepartitionStrategy)) { - return false; - } - StreamRepartitionStrategy o = (StreamRepartitionStrategy) obj; - return partition.equals(o.partition) - && CollectionUtils.isEqualCollection(totalTargetBoltIds, o.totalTargetBoltIds); - } - - public StreamPartition getPartition() { - return partition; - } - - public void setPartition(StreamPartition partition) { - this.partition = partition; - } - - public int getNumTotalParticipatingRouterBolts() { - return numTotalParticipatingRouterBolts; - } - - public void setNumTotalParticipatingRouterBolts(int numTotalParticipatingRouterBolts) { - this.numTotalParticipatingRouterBolts = numTotalParticipatingRouterBolts; - } - - public int getStartSequence() { - return startSequence; - } - - public void setStartSequence(int startSequence) { - this.startSequence = startSequence; - } - - public List<String> getTotalTargetBoltIds() { - return totalTargetBoltIds; - } - - public void setTotalTargetBoltIds(List<String> totalTargetBoltIds) { - this.totalTargetBoltIds = totalTargetBoltIds; - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/StreamRouterSpec.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/StreamRouterSpec.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/StreamRouterSpec.java deleted file mode 100644 index 96dfc59..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/StreamRouterSpec.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model; - -import org.apache.eagle.alert.engine.coordinator.StreamPartition; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * One RouteSpec means one rule mapping [streamId -> StreamPartition -> - * PolicyExecutionQueue] - * - * <p>Key is StreamPartition. - */ -public class StreamRouterSpec { - private String streamId; - private StreamPartition partition; // The meta-data to build - // StreamPartitioner - private List<PolicyWorkerQueue> targetQueue = new ArrayList<PolicyWorkerQueue>(); - - public StreamPartition getPartition() { - return partition; - } - - public void setPartition(StreamPartition partition) { - this.partition = partition; - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(this.streamId).append(this.partition).append(targetQueue).build(); - } - - public List<PolicyWorkerQueue> getTargetQueue() { - return targetQueue; - } - - public void addQueue(PolicyWorkerQueue queue) { - this.targetQueue.add(queue); - } - - public String getStreamId() { - return streamId; - } - - public void setStreamId(String streamId) { - this.streamId = streamId; - } - - public void setTargetQueue(List<PolicyWorkerQueue> targetQueue) { - this.targetQueue = targetQueue; - } - - @Override - public String toString() { - return String.format("StreamRouterSpec[streamId=%s,partition=%s, queue=[%s]]", this.getStreamId(), - this.getPartition(), this.getTargetQueue()); - } - - @Override - public boolean equals(Object other) { - if (this == other) { - return true; - } - if (!(other instanceof StreamRouterSpec)) { - return false; - } - StreamRouterSpec that = (StreamRouterSpec) other; - return Objects.equals(streamId, that.streamId) - && Objects.equals(partition, that.partition) - && CollectionUtils.isEqualCollection(targetQueue, that.targetQueue); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/Tuple2StreamConverter.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/Tuple2StreamConverter.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/Tuple2StreamConverter.java deleted file mode 100644 index 4627bef..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/Tuple2StreamConverter.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model; - -import com.google.common.base.Strings; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -/** - * Convert incoming tuple to stream - * incoming tuple consists of 2 fields, topic and map of key/value - * output stream consists of 3 fields, stream name, timestamp, and map of key/value. - */ -public class Tuple2StreamConverter { - private static final Logger LOG = LoggerFactory.getLogger(Tuple2StreamConverter.class); - private Tuple2StreamMetadata metadata; - private StreamNameSelector cachedSelector; - - public Tuple2StreamConverter(Tuple2StreamMetadata metadata) { - this.metadata = metadata; - try { - cachedSelector = (StreamNameSelector) Class.forName(metadata.getStreamNameSelectorCls()) - .getConstructor(Properties.class) - .newInstance(metadata.getStreamNameSelectorProp()); - } catch (Exception ex) { - LOG.error("error initializing StreamNameSelector object", ex); - throw new IllegalStateException(ex); - } - } - - /** - * Assume tuple is composed of topic + map of key/value. - */ - @SuppressWarnings( {"unchecked"}) - public List<Object> convert(List<Object> tuple) { - Map<String, Object> m = (Map<String, Object>) tuple.get(1); - String streamName = cachedSelector.getStreamName(m); - if (!metadata.getActiveStreamNames().contains(streamName)) { - if (LOG.isDebugEnabled()) { - LOG.debug("streamName {} is not within activeStreamNames {}", streamName, metadata.getActiveStreamNames()); - } - return null; - } - - Object timeObject = m.get(metadata.getTimestampColumn()); - long timestamp = 0L; - if (timeObject == null) { - if (LOG.isDebugEnabled()) { - LOG.debug("continue with current timestamp since no timestamp column specified! Metadata : {} ", metadata); - } - timestamp = System.currentTimeMillis(); - } else if (timeObject instanceof Number) { - timestamp = ((Number) timeObject).longValue(); - } else { - String timestampFieldValue = (String) m.get(metadata.getTimestampColumn()); - String dateFormat = metadata.getTimestampFormat(); - if (Strings.isNullOrEmpty(dateFormat)) { - if (LOG.isDebugEnabled()) { - LOG.debug("continue with current timestamp becuase no data format sepcified! Metadata : {} ", metadata); - } - timestamp = System.currentTimeMillis(); - } else { - try { - SimpleDateFormat sdf = new SimpleDateFormat(metadata.getTimestampFormat()); - timestamp = sdf.parse(timestampFieldValue).getTime(); - } catch (Exception ex) { - LOG.error("continue with current timestamp because error happens while parsing timestamp column " - + metadata.getTimestampColumn() + " with format " + metadata.getTimestampFormat()); - timestamp = System.currentTimeMillis(); - } - } - } - return Arrays.asList(tuple.get(0), streamName, timestamp, tuple.get(1)); - } -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/Tuple2StreamMetadata.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/Tuple2StreamMetadata.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/Tuple2StreamMetadata.java deleted file mode 100644 index 788547d..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/Tuple2StreamMetadata.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model; - -import java.util.HashSet; -import java.util.Properties; -import java.util.Set; - -/** - * This metadata controls how tuple is transformed to stream for - * example raw data consists of {"metric" : "cpuUsage", "host" : - * "xyz.com", "timestamp" : 1346846400, "value" : "0.9"} field "metric" - * is used for creating stream name, here "cpuUsage" is stream name - * - * <p>metric could be "cpuUsage", "diskUsage", "memUsage" etc, so - * activeStreamNames are subset of all metric names</p> - * - * <p>All other messages which are not one of activeStreamNames will be - * filtered out.</p> - * - * @since 4/25/16 - */ -public class Tuple2StreamMetadata { - /** - * only messages belonging to activeStreamNames will be kept while - * transforming tuple into stream. - */ - private Set<String> activeStreamNames = new HashSet<String>(); - // the specific stream name selector - private Properties streamNameSelectorProp; - private String streamNameSelectorCls; - private String timestampColumn; - private String timestampFormat; - - public Set<String> getActiveStreamNames() { - return activeStreamNames; - } - - public void setActiveStreamNames(Set<String> activeStreamNames) { - this.activeStreamNames = activeStreamNames; - } - - public Properties getStreamNameSelectorProp() { - return streamNameSelectorProp; - } - - public void setStreamNameSelectorProp(Properties streamNameSelectorProp) { - this.streamNameSelectorProp = streamNameSelectorProp; - } - - public String getStreamNameSelectorCls() { - return streamNameSelectorCls; - } - - public void setStreamNameSelectorCls(String streamNameSelectorCls) { - this.streamNameSelectorCls = streamNameSelectorCls; - } - - public String getTimestampColumn() { - return timestampColumn; - } - - public void setTimestampColumn(String timestampColumn) { - this.timestampColumn = timestampColumn; - } - - public String getTimestampFormat() { - return timestampFormat; - } - - public void setTimestampFormat(String timestampFormat) { - this.timestampFormat = timestampFormat; - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/VersionedPolicyDefinition.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/VersionedPolicyDefinition.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/VersionedPolicyDefinition.java deleted file mode 100644 index bbd4178..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/VersionedPolicyDefinition.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model; - -import org.apache.eagle.alert.engine.coordinator.PolicyDefinition; - -public class VersionedPolicyDefinition { - private String version; - private PolicyDefinition definition; - - public VersionedPolicyDefinition() { - } - - public VersionedPolicyDefinition(String version, PolicyDefinition def) { - this.version = version; - this.definition = def; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public PolicyDefinition getDefinition() { - return definition; - } - - public void setDefinition(PolicyDefinition definition) { - this.definition = definition; - } - -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/VersionedStreamDefinition.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/VersionedStreamDefinition.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/VersionedStreamDefinition.java deleted file mode 100644 index c9f830b..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/VersionedStreamDefinition.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model; - -import org.apache.eagle.alert.engine.coordinator.StreamDefinition; - -public class VersionedStreamDefinition { - private String version; - private StreamDefinition definition; - - public VersionedStreamDefinition() { - } - - public VersionedStreamDefinition(String version, StreamDefinition def) { - this.version = version; - this.definition = def; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public StreamDefinition getDefinition() { - return definition; - } - - public void setDefinition(StreamDefinition definition) { - this.definition = definition; - } - -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/WorkSlot.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/WorkSlot.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/WorkSlot.java deleted file mode 100644 index 9353dbd..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/WorkSlot.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model; - - -import org.apache.commons.lang3.builder.HashCodeBuilder; - -import java.util.Objects; - -/** - * A slot is simply a bolt. - */ -public class WorkSlot { - public String topologyName; - public String boltId; - - public String getTopologyName() { - return topologyName; - } - - public void setTopologyName(String topologyName) { - this.topologyName = topologyName; - } - - public String getBoltId() { - return boltId; - } - - public void setBoltId(String boltId) { - this.boltId = boltId; - } - - public WorkSlot() { - - } - - - public WorkSlot(String topo, String boltId) { - this.topologyName = topo; - this.boltId = boltId; - } - - @Override - public boolean equals(Object other) { - if (this == other) { - return true; - } - if (!(other instanceof WorkSlot)) { - return false; - } - WorkSlot workSlot = (WorkSlot) other; - return Objects.equals(topologyName, workSlot.topologyName) - && Objects.equals(boltId, workSlot.boltId); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(topologyName).append(boltId).build(); - } - - public String toString() { - return "(" + topologyName + ":" + boltId + ")"; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/MonitoredStream.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/MonitoredStream.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/MonitoredStream.java deleted file mode 100644 index e72836e..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/MonitoredStream.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model.internal; - -import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * A monitored stream is the unique data set in the system. - * - * <p>It's a combination of stream and the specific grp-by on it. - * - * <p>For correlation stream, it means multiple stream for a given monitored stream. - * - * @since Apr 27, 2016 - */ -public class MonitoredStream { - - private String version; - - // the stream group that this monitored stream stands for - private StreamGroup streamGroup = new StreamGroup(); - private List<StreamWorkSlotQueue> queues = new ArrayList<StreamWorkSlotQueue>(); - - public MonitoredStream() { - } - - public MonitoredStream(StreamGroup par) { - this.streamGroup = par; - } - - public StreamGroup getStreamGroup() { - return streamGroup; - } - - public List<StreamWorkSlotQueue> getQueues() { - return queues; - } - - public synchronized void addQueues(StreamWorkSlotQueue queue) { - queues.add(queue); - } - - public synchronized boolean removeQueue(StreamWorkSlotQueue queue) { - return this.queues.remove(queue); - } - - public int hashCode() { - return new HashCodeBuilder().append(streamGroup).build(); - } - - public boolean equals(Object other) { - if (!(other instanceof MonitoredStream)) { - return false; - } - MonitoredStream o = (MonitoredStream) other; - return Objects.equals(streamGroup, o.streamGroup); - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public void setQueues(List<StreamWorkSlotQueue> queues) { - this.queues = queues; - } - -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/PolicyAssignment.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/PolicyAssignment.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/PolicyAssignment.java deleted file mode 100644 index 7747d58..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/PolicyAssignment.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model.internal; - -/** - * monitor metadata. - * - * @since Apr 27, 2016 - */ -public class PolicyAssignment { - - private String version; - - private String policyName; - private String queueId; - - public PolicyAssignment() { - } - - public PolicyAssignment(String policyName, String queueId) { - this.policyName = policyName; - this.queueId = queueId; - } - - public String getPolicyName() { - return policyName; - } - - public String getQueueId() { - return queueId; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public void setQueueId(String queueId) { - this.queueId = queueId; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - @Override - public String toString() { - return String.format("PolicyAssignment of policy %s, queueId %s, version %s !", policyName, queueId, version); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/ScheduleStateBase.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/ScheduleStateBase.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/ScheduleStateBase.java deleted file mode 100644 index 2462119..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/ScheduleStateBase.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model.internal; - -/** - * This is the Base part of ScheduleState, only contains version/generateTime/code/message/scheduleTimeMillis. - * - * @since Aug 10, 2016 - */ -public class ScheduleStateBase { - private String version; - // FIXME : should be date, can not make it simple in mongo.. - private String generateTime; - private int code = 200; - private String message = "OK"; - private int scheduleTimeMillis; - - public ScheduleStateBase(String version, String generateTime, int code, String message, int scheduleTimeMillis) { - this.version = version; - this.generateTime = generateTime; - this.code = code; - this.message = message; - this.scheduleTimeMillis = scheduleTimeMillis; - } - - public int getScheduleTimeMillis() { - return scheduleTimeMillis; - } - - public void setScheduleTimeMillis(int scheduleTimeMillis) { - this.scheduleTimeMillis = scheduleTimeMillis; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getGenerateTime() { - return generateTime; - } - - public void setGenerateTime(String generateTime) { - this.generateTime = generateTime; - } - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/StreamGroup.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/StreamGroup.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/StreamGroup.java deleted file mode 100644 index 9ceb7c8..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/StreamGroup.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model.internal; - - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.google.common.base.Objects; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.eagle.alert.engine.coordinator.StreamPartition; - -import java.util.ArrayList; -import java.util.List; - -public class StreamGroup { - - private boolean dedicated; - private List<StreamPartition> streamPartitions = new ArrayList<StreamPartition>(); - - public StreamGroup() { - } - - public List<StreamPartition> getStreamPartitions() { - return streamPartitions; - } - - public void addStreamPartition(StreamPartition sp) { - this.streamPartitions.add(sp); - } - - public void addStreamPartition(StreamPartition sp, boolean dedicated) { - this.dedicated = dedicated; - this.streamPartitions.add(sp); - } - - public void addStreamPartitions(List<StreamPartition> sps) { - this.streamPartitions.addAll(sps); - } - - public void addStreamPartitions(List<StreamPartition> sps, boolean dedicated) { - this.dedicated = dedicated; - this.streamPartitions.addAll(sps); - } - - @JsonIgnore - public boolean isDedicated() { - return dedicated; - } - - @JsonIgnore - public String getStreamId() { - StringBuilder sb = new StringBuilder("SG["); - for (StreamPartition sp : streamPartitions) { - sb.append(sp.getStreamId()).append("-"); - } - sb.append("]"); - return sb.toString(); - } - - @Override - public int hashCode() { - // implicitly all groups in stream groups will be built for hash code - return new HashCodeBuilder().append(streamPartitions).append(dedicated).build(); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof StreamGroup)) { - return false; - } - StreamGroup o = (StreamGroup) obj; - return Objects.equal(this.streamPartitions, o.streamPartitions) && Objects.equal(this.dedicated, o.dedicated); - } - - @Override - public String toString() { - return String.format("StreamGroup dedicated=: %s partitions=: %s ", dedicated, streamPartitions); - } - -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/StreamWorkSlotQueue.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/StreamWorkSlotQueue.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/StreamWorkSlotQueue.java deleted file mode 100644 index 6c526cb..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/StreamWorkSlotQueue.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model.internal; - -import org.apache.eagle.alert.coordination.model.WorkSlot; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -/** - * A work queue for given one monitored stream. - * - * <p>Analog to storm's "tasks for given bolt". - * - * @since Apr 27, 2016 - */ -public class StreamWorkSlotQueue { - private String queueId; - - private final List<WorkSlot> workingSlots = new LinkedList<WorkSlot>(); - private boolean dedicated; - // some dedicated option, like dedicated userId/tenantId/policyId. - private Map<String, Object> dedicateOption; - - private int numberOfGroupBolts; - private Map<String, Integer> topoGroupStartIndex = new HashMap<String, Integer>(); - - public StreamWorkSlotQueue() { - } - - public StreamWorkSlotQueue(StreamGroup par, boolean isDedicated, Map<String, Object> options, - List<WorkSlot> slots) { - this.queueId = par.getStreamId() + System.currentTimeMillis();// simply generate a queue - this.dedicated = isDedicated; - dedicateOption = new HashMap<String, Object>(); - dedicateOption.putAll(options); - this.workingSlots.addAll(slots); - } - - public Map<String, Object> getDedicateOption() { - return dedicateOption; - } - - public void setDedicateOption(Map<String, Object> dedicateOption) { - this.dedicateOption = dedicateOption; - } - - public List<WorkSlot> getWorkingSlots() { - return workingSlots; - } - - public boolean isDedicated() { - return dedicated; - } - - public void setDedicated(boolean dedicated) { - this.dedicated = dedicated; - } - - @JsonIgnore - public int getQueueSize() { - return workingSlots.size(); - } - - public int getNumberOfGroupBolts() { - return numberOfGroupBolts; - } - - public void setNumberOfGroupBolts(int numberOfGroupBolts) { - this.numberOfGroupBolts = numberOfGroupBolts; - } - - public Map<String, Integer> getTopoGroupStartIndex() { - return topoGroupStartIndex; - } - - public void setTopoGroupStartIndex(Map<String, Integer> topoGroupStartIndex) { - this.topoGroupStartIndex = topoGroupStartIndex; - } - - @JsonIgnore - public int getTopologyGroupStartIndex(String topo) { - if (topoGroupStartIndex.containsKey(topo)) { - return this.topoGroupStartIndex.get(topo); - } - return -1; - } - - public String getQueueId() { - return queueId; - } - - public void setQueueId(String queueId) { - this.queueId = queueId; - } - -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/Topology.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/Topology.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/Topology.java deleted file mode 100644 index c41c867..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/internal/Topology.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * 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.apache.eagle.alert.coordination.model.internal; - -import java.util.HashSet; -import java.util.Set; - -/** - * Logically one unit topology consists of S spouts, G - * groupby bolts, A alertBolts normally S=1 Physically each spout is - * composed of s spout nodes, each groupby bolt is composed of g groupby - * nodes, and each alert bolt is composed of a alert nodes. - * - * @since Mar 24, 2016 - */ -public class Topology { - - private String name; - // number of logical nodes - private int numOfSpout; - private int numOfAlertBolt; - private int numOfGroupBolt; - private int numOfPublishBolt; - private String spoutId; - private String pubBoltId; - @Deprecated - private Set<String> groupNodeIds; - @Deprecated - private Set<String> alertBoltIds; - - // number of physical nodes for each logic bolt - private int spoutParallelism = 1; - private int groupParallelism = 1; - private int alertParallelism = 1; - - private String clusterName; - - public Topology() { - } - - public Topology(String name, int group, int alert) { - this.name = name; - this.numOfSpout = 1; - this.numOfGroupBolt = group; - this.numOfAlertBolt = alert; - groupNodeIds = new HashSet<String>(group); - alertBoltIds = new HashSet<String>(alert); - - spoutParallelism = 1; - groupParallelism = 1; - alertParallelism = 1; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getNumOfSpout() { - return numOfSpout; - } - - public void setNumOfSpout(int numOfSpout) { - this.numOfSpout = numOfSpout; - } - - public int getNumOfAlertBolt() { - return numOfAlertBolt; - } - - public void setNumOfAlertBolt(int numOfAlertBolt) { - this.numOfAlertBolt = numOfAlertBolt; - } - - public int getNumOfGroupBolt() { - return numOfGroupBolt; - } - - public void setNumOfGroupBolt(int numOfGroupBolt) { - this.numOfGroupBolt = numOfGroupBolt; - } - - public String getSpoutId() { - return spoutId; - } - - public void setSpoutId(String spoutId) { - this.spoutId = spoutId; - } - - public String getPubBoltId() { - return pubBoltId; - } - - public void setPubBoltId(String pubBoltId) { - this.pubBoltId = pubBoltId; - } - - public Set<String> getGroupNodeIds() { - return groupNodeIds; - } - - public void setGroupNodeIds(Set<String> groupNodeIds) { - this.groupNodeIds = groupNodeIds; - } - - public Set<String> getAlertBoltIds() { - return alertBoltIds; - } - - public void setAlertBoltIds(Set<String> alertBoltIds) { - this.alertBoltIds = alertBoltIds; - } - - public int getNumOfPublishBolt() { - return numOfPublishBolt; - } - - public void setNumOfPublishBolt(int numOfPublishBolt) { - this.numOfPublishBolt = numOfPublishBolt; - } - - public int getSpoutParallelism() { - return spoutParallelism; - } - - public void setSpoutParallelism(int spoutParallelism) { - this.spoutParallelism = spoutParallelism; - } - - public int getGroupParallelism() { - return groupParallelism; - } - - public void setGroupParallelism(int groupParallelism) { - this.groupParallelism = groupParallelism; - } - - public int getAlertParallelism() { - return alertParallelism; - } - - public void setAlertParallelism(int alertParallelism) { - this.alertParallelism = alertParallelism; - } - - public String getClusterName() { - return clusterName; - } - - public void setClusterName(String clusterName) { - this.clusterName = clusterName; - } - -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/codec/IEventSerializer.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/codec/IEventSerializer.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/codec/IEventSerializer.java deleted file mode 100644 index ac375e1..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/codec/IEventSerializer.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.apache.eagle.alert.engine.codec; - -import org.apache.eagle.alert.engine.model.AlertStreamEvent; - -/** - * @since Jun 3, 2016. - */ -public interface IEventSerializer { - Object serialize(AlertStreamEvent event); -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/AlertDefinition.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/AlertDefinition.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/AlertDefinition.java deleted file mode 100644 index e94d6fa..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/AlertDefinition.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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 - * <p> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p> - * 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.apache.eagle.alert.engine.coordinator; - -import org.apache.commons.lang3.builder.HashCodeBuilder; - -import java.util.Objects; - -public class AlertDefinition { - private TemplateType templateType = TemplateType.TEXT; - private String subject; - private String body; - - private AlertSeverity severity; - private String category; - - public String getBody() { - return body; - } - - public void setBody(String templateResource) { - this.body = templateResource; - } - - public TemplateType getTemplateType() { - return templateType; - } - - public void setTemplateType(TemplateType type) { - this.templateType = type; - } - - public String getSubject() { - return subject; - } - - public void setSubject(String subject) { - this.subject = subject; - } - - public AlertSeverity getSeverity() { - return severity; - } - - public void setSeverity(AlertSeverity severity) { - this.severity = severity; - } - - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public enum TemplateType { - TEXT, - // FILE, - // HTTP - } - - @Override - public int hashCode() { - return new HashCodeBuilder() - .append(templateType) - .append(this.body) - .append(this.category) - .append(this.severity) - .append(this.subject) - .build(); - } - - @Override - public boolean equals(Object that) { - if (that == this) { - return true; - } - if (!(that instanceof AlertDefinition)) { - return false; - } - AlertDefinition another = (AlertDefinition) that; - if (Objects.equals(another.templateType, this.templateType) - && Objects.equals(another.body, this.body) - && Objects.equals(another.category, this.category) - && Objects.equals(another.severity, this.severity) - && Objects.equals(another.subject, this.subject)) { - return true; - } - return false; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/AlertSeverity.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/AlertSeverity.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/AlertSeverity.java deleted file mode 100644 index 0d36231..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/AlertSeverity.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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 - * <p> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p> - * 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.apache.eagle.alert.engine.coordinator; - -public enum AlertSeverity { - UNKNOWN, OK, WARNING, CRITICAL, FATAL -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/OverrideDeduplicatorSpec.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/OverrideDeduplicatorSpec.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/OverrideDeduplicatorSpec.java deleted file mode 100644 index cad41f3..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/OverrideDeduplicatorSpec.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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.apache.eagle.alert.engine.coordinator; - -import java.io.Serializable; -import java.util.Map; - -import org.apache.commons.lang3.builder.HashCodeBuilder; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.google.common.base.Objects; - -@JsonIgnoreProperties(ignoreUnknown = true) -public class OverrideDeduplicatorSpec implements Serializable { - - private static final long serialVersionUID = 6087460266979449001L; - - private String className; - private Map<String, String> properties; - - public String getClassName() { - return className; - } - - public void setClassName(String className) { - this.className = className; - } - - public Map<String, String> getProperties() { - return properties; - } - - public void setProperties(Map<String, String> properties) { - this.properties = properties; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof OverrideDeduplicatorSpec) { - OverrideDeduplicatorSpec spec = (OverrideDeduplicatorSpec) obj; - return Objects.equal(className, spec.getClassName()) - && Objects.equal(properties, spec.getProperties()); - } - return false; - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(className).append(properties).build(); - } - -}
