From 3770ac7873629c8b548887bae5b4af4aac855d28 Mon Sep 17 00:00:00 2001 From: Patrick Gotthard Date: Sat, 12 Oct 2013 15:04:37 +0200 Subject: [PATCH] Formatted code Added Eclipse formatter and cleanup configuration --- cleanup.xml | 56 ++++ formatter.xml | 291 ++++++++++++++++++ .../certiorem/example/HubServlet.java | 9 +- .../certiorem/example/NotifyTest.java | 15 +- .../certiorem/example/ServerModule.java | 85 +++-- .../certiorem/example/SubServlet.java | 10 +- src/main/resources/.gitignore | 1 + src/test/java/.gitignore | 1 + src/test/resources/.gitignore | 1 + 9 files changed, 408 insertions(+), 61 deletions(-) create mode 100644 cleanup.xml create mode 100644 formatter.xml create mode 100644 src/main/resources/.gitignore create mode 100644 src/test/java/.gitignore create mode 100644 src/test/resources/.gitignore diff --git a/cleanup.xml b/cleanup.xml new file mode 100644 index 0000000..40f9b7a --- /dev/null +++ b/cleanup.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/formatter.xml b/formatter.xml new file mode 100644 index 0000000..e7ba7aa --- /dev/null +++ b/formatter.xml @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/org/rometools/certiorem/example/HubServlet.java b/src/main/java/org/rometools/certiorem/example/HubServlet.java index f41ea86..6ef9d9f 100644 --- a/src/main/java/org/rometools/certiorem/example/HubServlet.java +++ b/src/main/java/org/rometools/certiorem/example/HubServlet.java @@ -5,20 +5,21 @@ package org.rometools.certiorem.example; -import com.google.inject.Inject; -import com.google.inject.Singleton; import org.rometools.certiorem.hub.Hub; import org.rometools.certiorem.web.AbstractHubServlet; +import com.google.inject.Inject; +import com.google.inject.Singleton; + /** - * + * * @author robert.cooper */ @Singleton public class HubServlet extends AbstractHubServlet { @Inject - public HubServlet(final Hub hub){ + public HubServlet(final Hub hub) { super(hub); } } diff --git a/src/main/java/org/rometools/certiorem/example/NotifyTest.java b/src/main/java/org/rometools/certiorem/example/NotifyTest.java index b26eb09..0ccd54e 100644 --- a/src/main/java/org/rometools/certiorem/example/NotifyTest.java +++ b/src/main/java/org/rometools/certiorem/example/NotifyTest.java @@ -5,29 +5,32 @@ package org.rometools.certiorem.example; -import com.google.inject.Singleton; import java.util.logging.Level; import java.util.logging.Logger; + import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import org.rometools.certiorem.pub.NotificationException; import org.rometools.certiorem.pub.Publisher; +import com.google.inject.Singleton; + /** - * + * * @author robert.cooper */ @Singleton -public class NotifyTest extends HttpServlet{ +public class NotifyTest extends HttpServlet { @Override - public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException{ - Publisher pub = new Publisher(); + public void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException { + final Publisher pub = new Publisher(); try { pub.sendUpdateNotification("http://localhost/webapp/hub", "http://localhost/webapp/research-atom.xml"); - } catch (NotificationException ex) { + } catch (final NotificationException ex) { Logger.getLogger(NotifyTest.class.getName()).log(Level.SEVERE, null, ex); throw new ServletException(ex); } diff --git a/src/main/java/org/rometools/certiorem/example/ServerModule.java b/src/main/java/org/rometools/certiorem/example/ServerModule.java index 4cfa3db..6ec8c45 100644 --- a/src/main/java/org/rometools/certiorem/example/ServerModule.java +++ b/src/main/java/org/rometools/certiorem/example/ServerModule.java @@ -4,6 +4,17 @@ */ package org.rometools.certiorem.example; +import org.rometools.certiorem.hub.Hub; +import org.rometools.certiorem.hub.data.ram.InMemoryHubDAO; +import org.rometools.certiorem.hub.notify.standard.UnthreadedNotifier; +import org.rometools.certiorem.hub.verify.standard.UnthreadedVerifier; +import org.rometools.certiorem.sub.Subscriptions; +import org.rometools.certiorem.sub.data.ram.InMemorySubDAO; +import org.rometools.certiorem.sub.request.AsyncRequester; +import org.rometools.fetcher.FeedFetcher; +import org.rometools.fetcher.impl.HashMapFeedInfoCache; +import org.rometools.fetcher.impl.HttpURLFeedFetcher; + import com.google.inject.AbstractModule; import com.google.inject.Guice; import com.google.inject.Injector; @@ -12,62 +23,44 @@ import com.google.inject.Singleton; import com.google.inject.servlet.GuiceServletContextListener; import com.google.inject.servlet.ServletModule; -import org.rometools.certiorem.hub.Hub; -import org.rometools.certiorem.hub.data.ram.InMemoryHubDAO; -import org.rometools.certiorem.hub.notify.standard.UnthreadedNotifier; -import org.rometools.certiorem.hub.verify.standard.UnthreadedVerifier; -import org.rometools.certiorem.sub.Subscriptions; -import org.rometools.certiorem.sub.data.ram.InMemorySubDAO; -import org.rometools.certiorem.sub.request.AsyncRequester; - -import org.rometools.fetcher.FeedFetcher; -import org.rometools.fetcher.impl.HashMapFeedInfoCache; -import org.rometools.fetcher.impl.HttpURLFeedFetcher; - - /** - * + * * @author robert.cooper */ public class ServerModule extends GuiceServletContextListener { @Override protected Injector getInjector() { return Guice.createInjector(new AbstractModule() { - @Override - protected void configure() { - } + @Override + protected void configure() { + } - @Provides - @Singleton - public Hub buildHub() { - FeedFetcher fetcher = new HttpURLFeedFetcher(new HashMapFeedInfoCache()); - Hub hub = new Hub(new InMemoryHubDAO(), new UnthreadedVerifier(), new UnthreadedNotifier(), fetcher); + @Provides + @Singleton + public Hub buildHub() { + final FeedFetcher fetcher = new HttpURLFeedFetcher(new HashMapFeedInfoCache()); + final Hub hub = new Hub(new InMemoryHubDAO(), new UnthreadedVerifier(), new UnthreadedNotifier(), fetcher); - return hub; - } + return hub; + } - @Provides - @Singleton - public Subscriptions buildSubs() { - System.out.println("buildSubs"); - Subscriptions subs = new Subscriptions(new HashMapFeedInfoCache(), new AsyncRequester(), - "http://localhost/webapp/subscriptions/", new InMemorySubDAO()); + @Provides + @Singleton + public Subscriptions buildSubs() { + System.out.println("buildSubs"); + final Subscriptions subs = new Subscriptions(new HashMapFeedInfoCache(), new AsyncRequester(), "http://localhost/webapp/subscriptions/", + new InMemorySubDAO()); - return subs; - } - }, - new ServletModule() { - @Override - protected void configureServlets() { - serve("/hub*") - .with(HubServlet.class); - serve("/subscriptions/*") - .with(SubServlet.class); - serve("/test/sub") - .with(SubTest.class); - serve("/test/pub") - .with(NotifyTest.class); - } - }); + return subs; + } + }, new ServletModule() { + @Override + protected void configureServlets() { + serve("/hub*").with(HubServlet.class); + serve("/subscriptions/*").with(SubServlet.class); + serve("/test/sub").with(SubTest.class); + serve("/test/pub").with(NotifyTest.class); + } + }); } } diff --git a/src/main/java/org/rometools/certiorem/example/SubServlet.java b/src/main/java/org/rometools/certiorem/example/SubServlet.java index 97c6d6b..6114283 100644 --- a/src/main/java/org/rometools/certiorem/example/SubServlet.java +++ b/src/main/java/org/rometools/certiorem/example/SubServlet.java @@ -5,21 +5,21 @@ package org.rometools.certiorem.example; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import com.google.inject.name.Named; import org.rometools.certiorem.sub.Subscriptions; import org.rometools.certiorem.web.AbstractSubServlet; +import com.google.inject.Inject; +import com.google.inject.Singleton; + /** - * + * * @author robert.cooper */ @Singleton public class SubServlet extends AbstractSubServlet { @Inject - public SubServlet(final Subscriptions subscriptions){ + public SubServlet(final Subscriptions subscriptions) { super(subscriptions); } diff --git a/src/main/resources/.gitignore b/src/main/resources/.gitignore new file mode 100644 index 0000000..53b845b --- /dev/null +++ b/src/main/resources/.gitignore @@ -0,0 +1 @@ +# needed to commit empty folder \ No newline at end of file diff --git a/src/test/java/.gitignore b/src/test/java/.gitignore new file mode 100644 index 0000000..53b845b --- /dev/null +++ b/src/test/java/.gitignore @@ -0,0 +1 @@ +# needed to commit empty folder \ No newline at end of file diff --git a/src/test/resources/.gitignore b/src/test/resources/.gitignore new file mode 100644 index 0000000..53b845b --- /dev/null +++ b/src/test/resources/.gitignore @@ -0,0 +1 @@ +# needed to commit empty folder \ No newline at end of file