This file contains hidden or 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
| package org.ApacheStormTopologyJava.spout; | |
| import org.ApacheStormTopologyJava.util.RandomMessageUtil; | |
| import org.apache.storm.spout.SpoutOutputCollector; | |
| import org.apache.storm.task.TopologyContext; | |
| import org.apache.storm.topology.OutputFieldsDeclarer; | |
| import org.apache.storm.topology.base.BaseRichSpout; | |
| import org.apache.storm.tuple.Fields; | |
| import org.apache.storm.tuple.Values; | |
| import org.apache.storm.utils.Utils; |
This file contains hidden or 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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| <modelVersion>4.0.0</modelVersion> | |
| <groupId>org.example</groupId> | |
| <artifactId>ApacheStormTopologyJava</artifactId> | |
| <version>1.0-SNAPSHOT</version> |
This file contains hidden or 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
| package org.SpringRestfulServiceExceptionHandler; | |
| import org.springframework.boot.SpringApplication; | |
| import org.springframework.boot.autoconfigure.SpringBootApplication; | |
| @SpringBootApplication | |
| public class App { | |
| public static void main(String[] args) { | |
| SpringApplication.run(App.class, args); | |
| } |
This file contains hidden or 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
| package org.SpringRestfulServiceExceptionHandler.controller; | |
| import org.springframework.http.HttpStatus; | |
| import org.springframework.http.ResponseEntity; | |
| import org.springframework.web.bind.annotation.RequestMapping; | |
| import org.springframework.web.bind.annotation.RequestParam; | |
| import org.springframework.web.bind.annotation.RestController; | |
| @RestController | |
| public class CalculatorController { |
This file contains hidden or 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
| package org.SpringRestfulServiceExceptionHandler.controller; | |
| import org.springframework.http.HttpStatus; | |
| import org.springframework.http.ResponseEntity; | |
| import org.springframework.web.bind.annotation.ControllerAdvice; | |
| import org.springframework.web.bind.annotation.ExceptionHandler; | |
| @ControllerAdvice(basePackages = { "org.SpringRestfulServiceExceptionHandler.controller" }) | |
| public class RestfulResponseExceptionHandler { |
This file contains hidden or 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
| import java.util.ArrayList; | |
| import java.util.List; | |
| import strategyPattern.strategy.BubbleSort; | |
| import strategyPattern.strategy.HeapSort; | |
| public class App { |
This file contains hidden or 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
| import java.util.List; | |
| import strategyPattern.strategy.SortAlgorithm; | |
| public class Context { | |
| private SortAlgorithm sortAlgorithm; |
This file contains hidden or 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
| package strategyPattern.strategy; | |
| import java.util.List; | |
| /** | |
| * Implementation of heap sort | |
| * | |
| * http://www.sanfoundry.com/java-program-implement-heap-sort/ | |
| * | |
| */ |
This file contains hidden or 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
| package strategyPattern.strategy; | |
| import java.util.List; | |
| /** | |
| * Implementation of bubble sort | |
| * | |
| * http://www.kriblog.com/j2se/util/various-bubble-sort-example-in-java-using-string-array-arraylist-linked-list-recursive.html | |
| * | |
| */ |
This file contains hidden or 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
| package strategyPattern.strategy; | |
| import java.util.List; | |
| public interface SortAlgorithm { | |
| public void sort(List<Integer> unsorted); | |
| } |