[overlord-commits] Overlord SVN: r683 - sam/trunk/modules/examples/twitter/src/main/java/org/jboss/sam/examples/twitter.
overlord-commits at lists.jboss.org
overlord-commits at lists.jboss.org
Mon Jul 27 10:49:12 EDT 2009
Author: heiko.braun at jboss.com
Date: 2009-07-27 10:49:12 -0400 (Mon, 27 Jul 2009)
New Revision: 683
Removed:
sam/trunk/modules/examples/twitter/src/main/java/org/jboss/sam/examples/twitter/IO.java
Modified:
sam/trunk/modules/examples/twitter/src/main/java/org/jboss/sam/examples/twitter/Main.java
Log:
Cleanup example classes
Deleted: sam/trunk/modules/examples/twitter/src/main/java/org/jboss/sam/examples/twitter/IO.java
===================================================================
--- sam/trunk/modules/examples/twitter/src/main/java/org/jboss/sam/examples/twitter/IO.java 2009-07-27 14:44:27 UTC (rev 682)
+++ sam/trunk/modules/examples/twitter/src/main/java/org/jboss/sam/examples/twitter/IO.java 2009-07-27 14:49:12 UTC (rev 683)
@@ -1,64 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.sam.examples.twitter;
-
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.BufferedReader;
-
-/**
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class IO
-{
- public static String convertStreamToString(InputStream is) {
-
- if(null==is)
- throw new IllegalArgumentException("Input stream cannot be null");
-
- BufferedReader reader = new BufferedReader(new InputStreamReader(is));
- StringBuilder sb = new StringBuilder();
-
- String line = null;
- try {
- while ((line = reader.readLine()) != null) {
- sb.append(line + "\n");
- }
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- try {
- is.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- return sb.toString();
- }
-
- public static InputStream loadDRL(String s)
- {
- return Thread.currentThread().getContextClassLoader().getResourceAsStream(s);
- }
-}
Modified: sam/trunk/modules/examples/twitter/src/main/java/org/jboss/sam/examples/twitter/Main.java
===================================================================
--- sam/trunk/modules/examples/twitter/src/main/java/org/jboss/sam/examples/twitter/Main.java 2009-07-27 14:44:27 UTC (rev 682)
+++ sam/trunk/modules/examples/twitter/src/main/java/org/jboss/sam/examples/twitter/Main.java 2009-07-27 14:49:12 UTC (rev 683)
@@ -21,16 +21,16 @@
*/
package org.jboss.sam.examples.twitter;
-import org.jboss.sam.config.Configuration;
-import org.jboss.sam.config.ConfigFactory;
+import org.jboss.sam.ActivityMonitor;
import org.jboss.sam.ActivityMonitorFactory;
-import org.jboss.sam.ActivityMonitor;
import org.jboss.sam.EventProcessor;
+import org.jboss.sam.config.ConfigFactory;
+import org.jboss.sam.config.Configuration;
import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
import java.util.UUID;
-import java.util.List;
-import java.util.ArrayList;
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
@@ -99,7 +99,7 @@
private void loadDRL(String resource)
{
- InputStream in = IO.loadDRL(resource);
+ InputStream in = resourceStream(resource);
eventProcessor.registerStatement(UUID.randomUUID().toString(), in);
}
@@ -154,4 +154,9 @@
eventProcessor = monitor.getEventProcessor();
}
+
+ public static InputStream resourceStream(String s)
+ {
+ return Thread.currentThread().getContextClassLoader().getResourceAsStream(s);
+ }
}
More information about the overlord-commits
mailing list