From 4a773e79cdf94ecc5cf8139e4648b246b3ea40c4 Mon Sep 17 00:00:00 2001 From: KevinGilmore Date: Mon, 13 Mar 2017 08:27:44 -0500 Subject: [PATCH] BAEL-393: renamed guice-intro directory to guice (#1385) * Add files via upload * Update pom.xml * Update RunGuice.java * Update Communication.java * Update CommunicationMode.java * Update DefaultCommunicator.java * Update EmailCommunicationMode.java * Update IMCommunicationMode.java * Update SMSCommunicationMode.java * Update MessageLogger.java * Update MessageSentLoggable.java * Update AOPModule.java * Update BasicModule.java * Update CommunicationModel.java * Update Communicator.java * Update BasicModule.java * Update RunGuice.java * Update MessageLogger.java * Update Communicator.java * Update pom.xml * BAEL-278: Updated README.md * BAEL-554: Add and update README.md files * Update pom.xml * Update pom.xml * Update pom.xml * BAEL-345: fixed assertion * BAEL-109: Updated README.md * BAEL-345: Added README.md * Reinstating reactor-core module in root-level pom * BAEL-393: Adding guide-intro module to root pom * BAEL-9: Updated README.md * BAEL-157: README.md updated * Changed project name * Update RunGuice.java Removed references to message logging and output * Update Communication.java Removed message logging-related code * BAEL-566: Updated README.md * New project name * BAEL-393: removing guice-intro directory * BAEL-393: renamed module guice-intro to guice in root pom.xml --- .../examples/guice/marker/Communicator.java | 11 -------- {guice-intro => guice}/pom.xml | 4 +-- .../java/com/baeldung/examples/RunGuice.java | 6 +---- .../examples/guice/Communication.java | 25 +++---------------- .../examples/guice/CommunicationMode.java | 0 .../examples/guice/DefaultCommunicator.java | 5 +++- .../guice/EmailCommunicationMode.java | 3 ++- .../examples/guice/IMCommunicationMode.java | 2 +- .../examples/guice/SMSCommunicationMode.java | 3 ++- .../examples/guice/aop/MessageLogger.java | 4 ++- .../guice/aop/MessageSentLoggable.java | 3 ++- .../examples/guice/binding/AOPModule.java | 3 ++- .../examples/guice/binding/BasicModule.java | 3 ++- .../guice/constant/CommunicationModel.java | 3 ++- .../examples/guice/marker/Communicator.java | 14 +++++++++++ .../examples/guice/modules/BasicModule.java | 3 ++- pom.xml | 2 +- 17 files changed, 44 insertions(+), 50 deletions(-) delete mode 100644 guice-intro/src/main/java/com/baeldung/examples/guice/marker/Communicator.java rename {guice-intro => guice}/pom.xml (94%) rename {guice-intro => guice}/src/main/java/com/baeldung/examples/RunGuice.java (76%) rename {guice-intro => guice}/src/main/java/com/baeldung/examples/guice/Communication.java (54%) rename {guice-intro => guice}/src/main/java/com/baeldung/examples/guice/CommunicationMode.java (100%) rename {guice-intro => guice}/src/main/java/com/baeldung/examples/guice/DefaultCommunicator.java (93%) rename {guice-intro => guice}/src/main/java/com/baeldung/examples/guice/EmailCommunicationMode.java (92%) rename {guice-intro => guice}/src/main/java/com/baeldung/examples/guice/IMCommunicationMode.java (92%) rename {guice-intro => guice}/src/main/java/com/baeldung/examples/guice/SMSCommunicationMode.java (92%) rename {guice-intro => guice}/src/main/java/com/baeldung/examples/guice/aop/MessageLogger.java (88%) rename {guice-intro => guice}/src/main/java/com/baeldung/examples/guice/aop/MessageSentLoggable.java (89%) rename {guice-intro => guice}/src/main/java/com/baeldung/examples/guice/binding/AOPModule.java (92%) rename {guice-intro => guice}/src/main/java/com/baeldung/examples/guice/binding/BasicModule.java (96%) rename {guice-intro => guice}/src/main/java/com/baeldung/examples/guice/constant/CommunicationModel.java (86%) create mode 100644 guice/src/main/java/com/baeldung/examples/guice/marker/Communicator.java rename {guice-intro => guice}/src/main/java/com/baeldung/examples/guice/modules/BasicModule.java (96%) diff --git a/guice-intro/src/main/java/com/baeldung/examples/guice/marker/Communicator.java b/guice-intro/src/main/java/com/baeldung/examples/guice/marker/Communicator.java deleted file mode 100644 index 239666b6ab..0000000000 --- a/guice-intro/src/main/java/com/baeldung/examples/guice/marker/Communicator.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baeldung.examples.guice.marker; - -/** - * - * @author Baeldung - */ -public interface Communicator { - - public boolean sendMessage(String message); - -} diff --git a/guice-intro/pom.xml b/guice/pom.xml similarity index 94% rename from guice-intro/pom.xml rename to guice/pom.xml index 1f0d7679b7..df87021794 100644 --- a/guice-intro/pom.xml +++ b/guice/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.baeldung.examples.guice - guice-intro + guice 1.0-SNAPSHOT jar @@ -30,5 +30,5 @@ 1.8 4.1.0 - guice-intro + guice diff --git a/guice-intro/src/main/java/com/baeldung/examples/RunGuice.java b/guice/src/main/java/com/baeldung/examples/RunGuice.java similarity index 76% rename from guice-intro/src/main/java/com/baeldung/examples/RunGuice.java rename to guice/src/main/java/com/baeldung/examples/RunGuice.java index b4b3e8571e..a07447cde8 100644 --- a/guice-intro/src/main/java/com/baeldung/examples/RunGuice.java +++ b/guice/src/main/java/com/baeldung/examples/RunGuice.java @@ -10,7 +10,7 @@ import java.util.Scanner; /** * - * @author Baeldung + * @author baeldung */ public class RunGuice { @@ -18,14 +18,10 @@ public class RunGuice { Injector injector = Guice.createInjector(new BasicModule(), new AOPModule()); Communication comms = injector.getInstance(Communication.class); Scanner scanner = new Scanner(System.in); - System.out.println("Enter your message to be sent; press Q to quit and P to print the message log"); while (true) { String input = scanner.nextLine(); if (input.equalsIgnoreCase("q")) { System.exit(0); - } - if (input.equalsIgnoreCase("p")) { - comms.print(); } else { comms.sendMessage(input); } diff --git a/guice-intro/src/main/java/com/baeldung/examples/guice/Communication.java b/guice/src/main/java/com/baeldung/examples/guice/Communication.java similarity index 54% rename from guice-intro/src/main/java/com/baeldung/examples/guice/Communication.java rename to guice/src/main/java/com/baeldung/examples/guice/Communication.java index c4b17b57d2..7f7cb822d8 100644 --- a/guice-intro/src/main/java/com/baeldung/examples/guice/Communication.java +++ b/guice/src/main/java/com/baeldung/examples/guice/Communication.java @@ -10,7 +10,7 @@ import java.util.logging.Logger; /** * - * @author Baeldung + * @author baeldung */ public class Communication { @@ -19,37 +19,20 @@ public class Communication { @Inject private Logger logger; - private Queue messageLog; - - @Named("CommsUUID") - private String commsID; - @Inject private DefaultCommunicator communicator; public Communication(Boolean keepRecords) { if (keepRecords) { - messageLog = new LinkedList(); + System.out.println("keeping records"); } } public boolean sendMessage(String message) { - if (!message.isEmpty() && messageLog != null) { - messageLog.add(message); - } + return communicator.sendMessage(message); } - - public void print() { - if (messageLog != null) { - for (String message : messageLog) { - logger.info(message); - } - } else { - logger.info("Message logging wasn't enabled"); - } - } - + public DefaultCommunicator getCommunicator() { return this.communicator; } diff --git a/guice-intro/src/main/java/com/baeldung/examples/guice/CommunicationMode.java b/guice/src/main/java/com/baeldung/examples/guice/CommunicationMode.java similarity index 100% rename from guice-intro/src/main/java/com/baeldung/examples/guice/CommunicationMode.java rename to guice/src/main/java/com/baeldung/examples/guice/CommunicationMode.java diff --git a/guice-intro/src/main/java/com/baeldung/examples/guice/DefaultCommunicator.java b/guice/src/main/java/com/baeldung/examples/guice/DefaultCommunicator.java similarity index 93% rename from guice-intro/src/main/java/com/baeldung/examples/guice/DefaultCommunicator.java rename to guice/src/main/java/com/baeldung/examples/guice/DefaultCommunicator.java index 423c24f789..c65644646a 100644 --- a/guice-intro/src/main/java/com/baeldung/examples/guice/DefaultCommunicator.java +++ b/guice/src/main/java/com/baeldung/examples/guice/DefaultCommunicator.java @@ -5,7 +5,10 @@ import com.baeldung.examples.guice.marker.Communicator; import com.google.inject.Inject; import com.google.inject.name.Named; - +/** + * + * @author baeldung + */ public class DefaultCommunicator implements Communicator { private CommunicationMode defaultCommsMode; diff --git a/guice-intro/src/main/java/com/baeldung/examples/guice/EmailCommunicationMode.java b/guice/src/main/java/com/baeldung/examples/guice/EmailCommunicationMode.java similarity index 92% rename from guice-intro/src/main/java/com/baeldung/examples/guice/EmailCommunicationMode.java rename to guice/src/main/java/com/baeldung/examples/guice/EmailCommunicationMode.java index 642ee7ace0..3caca0edcc 100644 --- a/guice-intro/src/main/java/com/baeldung/examples/guice/EmailCommunicationMode.java +++ b/guice/src/main/java/com/baeldung/examples/guice/EmailCommunicationMode.java @@ -1,3 +1,4 @@ + package com.baeldung.examples.guice; import com.baeldung.examples.guice.aop.MessageSentLoggable; @@ -5,7 +6,7 @@ import com.baeldung.examples.guice.constant.CommunicationModel; /** * - * @author Baekdung + * @author baeldung */ public class EmailCommunicationMode implements CommunicationMode { diff --git a/guice-intro/src/main/java/com/baeldung/examples/guice/IMCommunicationMode.java b/guice/src/main/java/com/baeldung/examples/guice/IMCommunicationMode.java similarity index 92% rename from guice-intro/src/main/java/com/baeldung/examples/guice/IMCommunicationMode.java rename to guice/src/main/java/com/baeldung/examples/guice/IMCommunicationMode.java index 9f34e9a241..bc9bd61449 100644 --- a/guice-intro/src/main/java/com/baeldung/examples/guice/IMCommunicationMode.java +++ b/guice/src/main/java/com/baeldung/examples/guice/IMCommunicationMode.java @@ -8,7 +8,7 @@ import java.util.logging.Logger; /** * - * @author Baeldung + * @author baeldung */ public class IMCommunicationMode implements CommunicationMode { diff --git a/guice-intro/src/main/java/com/baeldung/examples/guice/SMSCommunicationMode.java b/guice/src/main/java/com/baeldung/examples/guice/SMSCommunicationMode.java similarity index 92% rename from guice-intro/src/main/java/com/baeldung/examples/guice/SMSCommunicationMode.java rename to guice/src/main/java/com/baeldung/examples/guice/SMSCommunicationMode.java index 251e249971..28475839dd 100644 --- a/guice-intro/src/main/java/com/baeldung/examples/guice/SMSCommunicationMode.java +++ b/guice/src/main/java/com/baeldung/examples/guice/SMSCommunicationMode.java @@ -1,3 +1,4 @@ + package com.baeldung.examples.guice; import com.baeldung.examples.guice.aop.MessageSentLoggable; @@ -7,7 +8,7 @@ import java.util.logging.Logger; /** * - * @author Baeldung + * @author baeldung */ public class SMSCommunicationMode implements CommunicationMode { diff --git a/guice-intro/src/main/java/com/baeldung/examples/guice/aop/MessageLogger.java b/guice/src/main/java/com/baeldung/examples/guice/aop/MessageLogger.java similarity index 88% rename from guice-intro/src/main/java/com/baeldung/examples/guice/aop/MessageLogger.java rename to guice/src/main/java/com/baeldung/examples/guice/aop/MessageLogger.java index 8926dfa714..2ad5f8b92e 100644 --- a/guice-intro/src/main/java/com/baeldung/examples/guice/aop/MessageLogger.java +++ b/guice/src/main/java/com/baeldung/examples/guice/aop/MessageLogger.java @@ -1,12 +1,14 @@ + package com.baeldung.examples.guice.aop; +import com.google.inject.Inject; import java.util.logging.Logger; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; /** * - * @author Baeldung + * @author baeldung */ public class MessageLogger implements MethodInterceptor { diff --git a/guice-intro/src/main/java/com/baeldung/examples/guice/aop/MessageSentLoggable.java b/guice/src/main/java/com/baeldung/examples/guice/aop/MessageSentLoggable.java similarity index 89% rename from guice-intro/src/main/java/com/baeldung/examples/guice/aop/MessageSentLoggable.java rename to guice/src/main/java/com/baeldung/examples/guice/aop/MessageSentLoggable.java index cacf3bde7c..5e5a411d0e 100644 --- a/guice-intro/src/main/java/com/baeldung/examples/guice/aop/MessageSentLoggable.java +++ b/guice/src/main/java/com/baeldung/examples/guice/aop/MessageSentLoggable.java @@ -1,3 +1,4 @@ + package com.baeldung.examples.guice.aop; import java.lang.annotation.ElementType; @@ -7,7 +8,7 @@ import java.lang.annotation.Target; /** * - * @author Baeldung + * @author baeldung */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) diff --git a/guice-intro/src/main/java/com/baeldung/examples/guice/binding/AOPModule.java b/guice/src/main/java/com/baeldung/examples/guice/binding/AOPModule.java similarity index 92% rename from guice-intro/src/main/java/com/baeldung/examples/guice/binding/AOPModule.java rename to guice/src/main/java/com/baeldung/examples/guice/binding/AOPModule.java index dc9d258efa..109d9a6389 100644 --- a/guice-intro/src/main/java/com/baeldung/examples/guice/binding/AOPModule.java +++ b/guice/src/main/java/com/baeldung/examples/guice/binding/AOPModule.java @@ -1,3 +1,4 @@ + package com.baeldung.examples.guice.binding; import com.baeldung.examples.guice.aop.MessageLogger; @@ -7,7 +8,7 @@ import com.google.inject.matcher.Matchers; /** * - * @author Baeldung + * @author baeldung */ public class AOPModule extends AbstractModule { diff --git a/guice-intro/src/main/java/com/baeldung/examples/guice/binding/BasicModule.java b/guice/src/main/java/com/baeldung/examples/guice/binding/BasicModule.java similarity index 96% rename from guice-intro/src/main/java/com/baeldung/examples/guice/binding/BasicModule.java rename to guice/src/main/java/com/baeldung/examples/guice/binding/BasicModule.java index 9168195130..93f0fe54ba 100644 --- a/guice-intro/src/main/java/com/baeldung/examples/guice/binding/BasicModule.java +++ b/guice/src/main/java/com/baeldung/examples/guice/binding/BasicModule.java @@ -1,3 +1,4 @@ + package com.baeldung.examples.guice.binding; import com.baeldung.examples.guice.Communication; @@ -13,7 +14,7 @@ import java.util.logging.Logger; /** * - * @author Baeldung + * @author baeldung */ public class BasicModule extends AbstractModule { diff --git a/guice-intro/src/main/java/com/baeldung/examples/guice/constant/CommunicationModel.java b/guice/src/main/java/com/baeldung/examples/guice/constant/CommunicationModel.java similarity index 86% rename from guice-intro/src/main/java/com/baeldung/examples/guice/constant/CommunicationModel.java rename to guice/src/main/java/com/baeldung/examples/guice/constant/CommunicationModel.java index b9fa604a32..d12420a0db 100644 --- a/guice-intro/src/main/java/com/baeldung/examples/guice/constant/CommunicationModel.java +++ b/guice/src/main/java/com/baeldung/examples/guice/constant/CommunicationModel.java @@ -1,8 +1,9 @@ + package com.baeldung.examples.guice.constant; /** * - * @author Baeldung + * @author baeldung */ public enum CommunicationModel { diff --git a/guice/src/main/java/com/baeldung/examples/guice/marker/Communicator.java b/guice/src/main/java/com/baeldung/examples/guice/marker/Communicator.java new file mode 100644 index 0000000000..7425f1c283 --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/guice/marker/Communicator.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.baeldung.examples.guice.marker; + +/** + * + * @author Tayo + */ +public interface Communicator { + +} diff --git a/guice-intro/src/main/java/com/baeldung/examples/guice/modules/BasicModule.java b/guice/src/main/java/com/baeldung/examples/guice/modules/BasicModule.java similarity index 96% rename from guice-intro/src/main/java/com/baeldung/examples/guice/modules/BasicModule.java rename to guice/src/main/java/com/baeldung/examples/guice/modules/BasicModule.java index 47b3e2e573..ed83cf3649 100644 --- a/guice-intro/src/main/java/com/baeldung/examples/guice/modules/BasicModule.java +++ b/guice/src/main/java/com/baeldung/examples/guice/modules/BasicModule.java @@ -1,3 +1,4 @@ + package com.baeldung.examples.guice.modules; import com.baeldung.examples.guice.Communication; @@ -13,7 +14,7 @@ import java.util.logging.Logger; /** * - * @author Baeldung + * @author baeldung */ public class BasicModule extends AbstractModule { diff --git a/pom.xml b/pom.xml index ee7e75d3cf..c12562551f 100644 --- a/pom.xml +++ b/pom.xml @@ -47,7 +47,7 @@ guava guava18 guava19 - guice-intro + guice disruptor handling-spring-static-resources