[jboss-svn-commits] JBL Code SVN: r13181 - in labs/shotoku/trunk: shotoku-base/src/etc and 12 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Jul 6 14:43:59 EDT 2007
Author: adamw
Date: 2007-07-06 14:43:58 -0400 (Fri, 06 Jul 2007)
New Revision: 13181
Added:
labs/shotoku/trunk/fix-prj.sh
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/DummyFeedsDescriptor.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsDescriptorImpl.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/DummyNormalFeed.java
Modified:
labs/shotoku/trunk/shotoku-base/src/etc/shotoku.properties.sample
labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java
labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/cache/ShotokuCacheItem.java
labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/feeds/FeedsService.java
labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/service/AdministratedService.java
labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/service/AdministratedServiceImpl.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedFactory.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsDescriptor.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/AtomFeed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/FileBasedFeed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/InformaBasedFeed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/NormalFeed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/RdfFeed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/RomeBasedFeed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/Rss2Feed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/service/FeedsServiceImpl.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/AggregatedFeedTagHandler.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/FeedTagHandler.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/FeedTagHandlerManager.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/RemoteFeedTagHandler.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/ShotokuFeedTagHandler.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/TagFeedTagHandler.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedDefAttributes.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedsConstants.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedsTools.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/variables/VariableResolverManager.java
labs/shotoku/trunk/shotoku-tags/src/java/org/jboss/shotoku/tags/service/TagServiceImpl.java
labs/shotoku/trunk/shotoku-tags/src/java/org/jboss/shotoku/tags/test/TagsServiceMultiThreadTest.java
labs/shotoku/trunk/shotoku-tags/src/java/org/jboss/shotoku/tags/test/TagsTestServlet.java
Log:
Timeouts on connections & reads in feeds; first feed update in the BG
Added: labs/shotoku/trunk/fix-prj.sh
===================================================================
--- labs/shotoku/trunk/fix-prj.sh (rev 0)
+++ labs/shotoku/trunk/fix-prj.sh 2007-07-06 18:43:58 UTC (rev 13181)
@@ -0,0 +1,10 @@
+#!/bin/bash
+FILES=`find . -path "*.svn" -prune -o -print | grep project.properties`
+NEW_LINE="maven.repo.remote=http:\/\/repo1.maven.org\/maven"
+OLD_LINE="maven.repo.remote=.*"
+
+for FILE in $FILES
+do
+ sed "s/$OLD_LINE/$NEW_LINE/" < $FILE > $FILE.out
+ mv $FILE.out $FILE
+done
Modified: labs/shotoku/trunk/shotoku-base/src/etc/shotoku.properties.sample
===================================================================
--- labs/shotoku/trunk/shotoku-base/src/etc/shotoku.properties.sample 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-base/src/etc/shotoku.properties.sample 2007-07-06 18:43:58 UTC (rev 13181)
@@ -57,7 +57,9 @@
shotoku.internal.feeds.configdir =
# Interval between feed updates, in milliseconds
-shotoku.internal.feeds.service.interval = 10000
+shotoku.internal.feeds.service.interval = 600000
+shotoku.internal.feeds.service.conn_timeout = 5000
+shotoku.internal.feeds.service.read_timeout = 1000
#
# Tags configuration
@@ -73,8 +75,9 @@
shotoku.internal.tags.cmdir =
# Interval between tag synchronization updates, in milliseconds
-shotoku.internal.tags.service.interval = 10000
+shotoku.internal.tags.service.interval = 600000
+
#
# Tests configuration
# -------------------
@@ -93,4 +96,4 @@
# A debugging property which, when set to 0, will cause repositories not to be
# updated for the first time when being registered.
-shotoku.internal.svn.service.firstupdate = 1
\ No newline at end of file
+shotoku.internal.svn.service.firstupdate = 1
Modified: labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java
===================================================================
--- labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -27,7 +27,6 @@
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
import org.apache.velocity.app.VelocityEngine;
import org.jboss.shotoku.exceptions.DeleteException;
Modified: labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/cache/ShotokuCacheItem.java
===================================================================
--- labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/cache/ShotokuCacheItem.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/cache/ShotokuCacheItem.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -100,7 +100,8 @@
* @param key Key of the object to get.
* @return Value of the object.
*/
- public final T get(K key) {
+ @SuppressWarnings("unchecked")
+ public final T get(K key) {
synchronized(this) {
if (!keys.contains(key)) {
T ret = init(key);
@@ -113,7 +114,6 @@
}
}
- //noinspection unchecked
return (T) ShotokuCache.get(createKey(key));
}
Modified: labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/feeds/FeedsService.java
===================================================================
--- labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/feeds/FeedsService.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/feeds/FeedsService.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -11,4 +11,9 @@
public String getProperty(String id, String name);
public Feed getFeed(String id, String name, String type)
throws FeedDoesNotExistException;
+
+ public int getRemoteConnectionTimeout();
+ public void setRemoteConnectionTimeout(int remoteConnectionTimeout);
+ public int getRemoteReadTimeout();
+ public void setRemoteReadTimeout(int remoteReadTimeout);
}
Modified: labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/service/AdministratedService.java
===================================================================
--- labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/service/AdministratedService.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/service/AdministratedService.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -26,6 +26,8 @@
public AdministratedService getServiceInstance();
+ public long getLastUpdateSecondsAgo();
+
/*
* SERVICE MANAGEMENT METHODS
*/
Modified: labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/service/AdministratedServiceImpl.java
===================================================================
--- labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/service/AdministratedServiceImpl.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/service/AdministratedServiceImpl.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -17,6 +17,7 @@
private long lastUpdate;
private volatile long timerInterval;
private boolean serviceRunnable;
+ private Thread updateThread;
public long getLastUpdate() {
return lastUpdate;
@@ -46,7 +47,15 @@
return timerInterval;
}
- public void create() throws Exception {
+ public synchronized Thread getUpdateThread() {
+ return updateThread;
+ }
+
+ private synchronized void setUpdateThread(Thread updateThread) {
+ this.updateThread = updateThread;
+ }
+
+ public void create() throws Exception {
log.info("Creating " + getServiceName() + "...");
// Enabling administration for this service.
@@ -86,7 +95,7 @@
}
public void startUpdateThread() {
- new Thread() {
+ Thread ut = new Thread() {
{
setDaemon(true);
}
@@ -96,7 +105,8 @@
try {
sleep(getTimerInterval());
} catch (InterruptedException e) {
- log.error("Sleeping of updater thread for " +
+ // Forced update.
+ log.debug("Sleeping of updater thread for " +
getServiceName() + " interrupted.", e);
}
@@ -113,6 +123,13 @@
log.info(getServiceName() + " deaemon thread terminated.");
}
- }.start();
+ };
+
+ ut.start();
+ setUpdateThread(ut);
}
+
+ public long getLastUpdateSecondsAgo() {
+ return (System.currentTimeMillis() - getLastUpdate())/1000;
+ }
}
Added: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/DummyFeedsDescriptor.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/DummyFeedsDescriptor.java (rev 0)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/DummyFeedsDescriptor.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -0,0 +1,74 @@
+package org.jboss.shotoku.feeds;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.shotoku.feeds.data.DummyFeed;
+import org.jboss.shotoku.feeds.data.DummyNormalFeed;
+import org.jboss.shotoku.feeds.data.Feed;
+import org.jboss.shotoku.feeds.data.NormalFeed;
+import org.jboss.shotoku.feeds.data.special.SpecialFeed;
+import org.jboss.shotoku.feeds.exceptions.FeedDoesNotExistException;
+import org.jboss.shotoku.feeds.tag.FeedTagHandler;
+import org.jboss.shotoku.feeds.variables.VariableResolverManager;
+
+public class DummyFeedsDescriptor implements FeedsDescriptor {
+ private String id;
+
+ public DummyFeedsDescriptor(String id) {
+ super();
+ this.id = id;
+ }
+
+ public void addAttributes(String name, Map<String, Object> props) {
+ }
+
+ public void addFeed(String name, String type, NormalFeed feed) {
+ }
+
+ public void addFeedTagHandler(String name, String type, FeedTagHandler fth) {
+ }
+
+ public void addSpecialFeed(String name, String type, SpecialFeed feed) {
+ }
+
+ public boolean generateFeed(String name) {
+ return false;
+ }
+
+ public Map<String, Object> getAttributes(String name) {
+ return new HashMap<String, Object>();
+ }
+
+ public Feed getFeed(String name, String type) throws FeedDoesNotExistException {
+ return new DummyFeed();
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public NormalFeed getNormalFeed(String name, String type) throws FeedDoesNotExistException {
+ return new DummyNormalFeed();
+ }
+
+ public String getProperty(String name) {
+ return null;
+ }
+
+ public VariableResolverManager getVariableResolverManager() {
+ return null;
+ }
+
+ public void release() {
+ }
+
+ public int getConnTimeout() {
+ return 0;
+ }
+
+ public int getReadTimeout() {
+ return 0;
+ }
+
+}
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedFactory.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedFactory.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedFactory.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -66,7 +66,7 @@
*/
public static NormalFeed getNewNormalFeed(String id, String name,
String displayName, String type,
- Map<String, Object> attributes) {
+ Map<String, Object> attributes, int connTimeout, int readTimeout) {
Class feedClass = feedClasses.get(type);
if (feedClass == null) return null;
@@ -79,8 +79,8 @@
File file = File.createTempFile("shotoku-feeds" + nextInt, type);
return (NormalFeed) feedClass.getConstructor(String.class,
String.class, String.class, String.class, File.class,
- Map.class).newInstance(id, name, displayName, type, file,
- attributes);
+ Map.class, Integer.TYPE, Integer.TYPE).newInstance(id, name, displayName, type, file,
+ attributes, connTimeout, readTimeout);
} catch (Exception e) {
return null;
}
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsDescriptor.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsDescriptor.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsDescriptor.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -1,340 +1,94 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.shotoku.feeds;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.HashSet;
import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import org.apache.xerces.parsers.DOMParser;
-import org.apache.log4j.Logger;
-import org.jboss.shotoku.ContentManager;
+import org.jboss.shotoku.feeds.data.Feed;
import org.jboss.shotoku.feeds.data.NormalFeed;
import org.jboss.shotoku.feeds.data.special.SpecialFeed;
-import org.jboss.shotoku.feeds.data.Feed;
-import org.jboss.shotoku.feeds.variables.VariableResolverManager;
-import org.jboss.shotoku.feeds.tag.FeedTagHandler;
-import org.jboss.shotoku.feeds.tag.FeedTagHandlerManager;
-import org.jboss.shotoku.feeds.tools.FeedsConstants;
import org.jboss.shotoku.feeds.exceptions.FeedDoesNotExistException;
-import org.jboss.shotoku.tools.Pair;
-import org.jboss.shotoku.tools.Tools;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
+import org.jboss.shotoku.feeds.tag.FeedTagHandler;
+import org.jboss.shotoku.feeds.variables.VariableResolverManager;
-import static org.jboss.shotoku.tools.Tuples.*;
+public interface FeedsDescriptor {
-/**
- * Class which handles parsing feed descriptions, generates the feeds and
- * provides access to them.
- *
- * @author adamw
- * @author damon at sicore.org
- */
-public class FeedsDescriptor {
- private static final Logger log = Logger.getLogger(FeedsDescriptor.class);
+ public abstract String getProperty(String name);
- private Pair<String, String> confKey;
+ /**
+ * Adds a feed tag handler of the given name and type.
+ * @param name
+ * @param type
+ * @param fth
+ */
+ public abstract void addFeedTagHandler(String name, String type,
+ FeedTagHandler fth);
- /**
- * Ready feeds: feed name -> (feed type -> feed).
- */
- private Map<String, Map<String, NormalFeed>> feeds;
+ /**
+ * Adds a ready feed of the given name and type.
+ * @param name
+ * @param type
+ * @param feed
+ */
+ public abstract void addFeed(String name, String type, NormalFeed feed);
- /**
- * Special feeds: feed name prefix -> (feed type -> feed).
- */
- private Map<String, Map<String, SpecialFeed>> specialFeeds;
+ /**
+ * Adds a ready special feed of the given name and type.
+ * @param name
+ * @param type
+ * @param feed
+ */
+ public abstract void addSpecialFeed(String name, String type,
+ SpecialFeed feed);
- /**
- * Properties: sets of attributes which can be used in
- * feeds.
- */
- private Map<String, Map<String, Object>> attributes;
+ /**
+ * Adds an attributes map with the given name.
+ * @param name
+ * @param props
+ */
+ public abstract void addAttributes(String name, Map<String, Object> props);
- private VariableResolverManager vrm;
+ /**
+ * Tries to generate a feed with the given name. If the feed is absent,
+ * or is being already generated (this case indicates a loop in feed
+ * definitions), no actions are taken.
+ * @param name Feed to be generated.
+ * @return True iff generation was successfull.
+ */
+ public abstract boolean generateFeed(String name);
- /**
- * Feed tag handlers (not yet generated): feed name -> (feed type -> feed
- * tag handler).
- */
- private Map<String, Map<String, FeedTagHandler>> feedTagHandlers;
+ /**
+ * Gets a normal feed of the given type and name.
+ * @param name Name of the feed to get.
+ * @param type Type of the feed to get.
+ * @return Feed with the given name and type.
+ */
+ public abstract NormalFeed getNormalFeed(String name, String type)
+ throws FeedDoesNotExistException;
- /**
- * A set of feed names that are currently generated (used to detect looping
- * feed definitions).
- */
- private Set<String> duringGeneration;
+ /**
+ * Gets a feed (any - special or normal) of the given type and name.
+ * @param name Name of the feed to get.
+ * @param type Type of the feed to get.
+ * @return Feed with the given name and type.
+ */
+ public abstract Feed getFeed(String name, String type)
+ throws FeedDoesNotExistException;
- /**
- * Feeds configuration id.
- */
- private String id;
+ /**
+ * @param name
+ * @return An attributes map with the given name.
+ */
+ public abstract Map<String, Object> getAttributes(String name);
- private FeedsConfigurationWatcher fcw;
+ public abstract VariableResolverManager getVariableResolverManager();
- public FeedsDescriptor(String id, FeedsConfigurationWatcher fcw) {
- this.fcw = fcw;
- this.id = id;
+ /**
+ * Releases all feeds - deletes temporary files which contain them.
+ */
+ public abstract void release();
- confKey = tuple(
- ContentManager.getProperty(FeedsConstants.CONFIGID, ""),
- ContentManager.getProperty(FeedsConstants.CONFIGDIR, ""));
+ public abstract String getId();
- // From attributes read from Shotoku, getting the content manager
- // configuration for this feeds id.
- ContentManager cm = ContentManager.getContentManager(
- getProperty(FeedsConstants.FEEDID),
- getProperty(FeedsConstants.FEEDDIR)
- );
-
- vrm = new VariableResolverManager(id, getProperties());
- feedTagHandlers = new HashMap<String, Map<String, FeedTagHandler>>();
-
- // Creating the maps that will hold the feeds.
- feeds = new HashMap<String, Map<String, NormalFeed>>();
- specialFeeds = new HashMap<String, Map<String, SpecialFeed>>();
- attributes = new HashMap<String, Map<String, Object>>();
-
- // Looking for file containing feed definitons and filling the maps.
- for (org.jboss.shotoku.Node feedNode :
- cm.getRootDirectory().getNodes().toList()) {
- if (feedNode.getName().endsWith(FeedsConstants.NODE_ENDING)) {
- try {
- addFeedDefinitions(feedNode);
- } catch (Exception e) {
- // We just don't add the feeds ... and log a warning.
- log.warn("Can't add feed definitions from node " +
- feedNode.getFullName() + ".", e);
- }
- }
- }
-
- // Generating the feeds.
- duringGeneration = new HashSet<String>();
- while (feedTagHandlers.size() > 0) {
- // Trying to generate any feed found in the feed tag handler map.
- generateFeed(feedTagHandlers.keySet().iterator().next());
- }
- }
-
- private Properties getProperties() {
- return fcw.get(confKey);
- }
-
- public String getProperty(String name) {
- return getProperties().getProperty(id + name);
- }
-
- private void addFeedDefinitions(org.jboss.shotoku.Node node) throws SAXException, IOException {
- DOMParser parser = new DOMParser();
- // Parse the descriptor at the given Shotoku node.
- parser.parse(new InputSource(node.getContentInputStream()));
- // Get the XML document element of the feed descriptor file.
- Node root = parser.getDocument().getDocumentElement();
- String group = Tools.getAttributeValue(root, "display-name");
-
- NodeList nodes = root.getChildNodes();
-
- // Iterate through the rest of the feed descriptor
- // file to load all feeds for a given feed group.
- for (int i = 0; i < nodes.getLength(); i++) {
- Node n = nodes.item(i);
- FeedTagHandlerManager.createHandlers(group, n, vrm, this);
- }
- }
-
- /**
- * Adds a feed tag handler of the given name and type.
- * @param name
- * @param type
- * @param fth
- */
- public void addFeedTagHandler(String name, String type, FeedTagHandler fth) {
- Map<String, FeedTagHandler> typesMap = feedTagHandlers.get(name);
- if (typesMap == null) {
- typesMap = new HashMap<String, FeedTagHandler>();
- feedTagHandlers.put(name, typesMap);
- }
-
- typesMap.put(type, fth);
- }
-
- /**
- * Adds a ready feed of the given name and type.
- * @param name
- * @param type
- * @param feed
- */
- public void addFeed(String name, String type, NormalFeed feed) {
- Map<String, NormalFeed> typesMap = feeds.get(name);
- if (typesMap == null) {
- typesMap = new HashMap<String, NormalFeed>();
- feeds.put(name, typesMap);
- }
-
- typesMap.put(type, feed);
- }
-
- /**
- * Adds a ready special feed of the given name and type.
- * @param name
- * @param type
- * @param feed
- */
- public void addSpecialFeed(String name, String type, SpecialFeed feed) {
- Map<String, SpecialFeed> typesMap = specialFeeds.get(name);
- if (typesMap == null) {
- typesMap = new HashMap<String, SpecialFeed>();
- specialFeeds.put(name, typesMap);
- }
-
- typesMap.put(type, feed);
- }
-
- /**
- * Adds an attributes map with the given name.
- * @param name
- * @param props
- */
- public void addAttributes(String name, Map<String, Object> props) {
- attributes.put(name, props);
- }
-
- /**
- * Tries to generate a feed with the given name. If the feed is absent,
- * or is being already generated (this case indicates a loop in feed
- * definitions), no actions are taken.
- * @param name Feed to be generated.
- * @return True iff generation was successfull.
- */
- public boolean generateFeed(String name) {
- if (duringGeneration.contains(name)) {
- return false;
- }
-
- Map<String, FeedTagHandler> typeMap = feedTagHandlers.get(name);
- if (typeMap != null) {
- feedTagHandlers.remove(name);
-
- duringGeneration.add(name);
- boolean ret = true;
- for (FeedTagHandler fth : typeMap.values()) {
- ret &= fth.generate(this);
- }
- duringGeneration.remove(name);
-
- return ret;
- }
-
- return false;
- }
-
- /**
- * Gets a normal feed of the given type and name.
- * @param name Name of the feed to get.
- * @param type Type of the feed to get.
- * @return Feed with the given name and type.
- */
- public NormalFeed getNormalFeed(String name, String type)
- throws FeedDoesNotExistException {
- Map<String, NormalFeed> feedTypes = feeds.get(name);
- if (feedTypes == null) {
- throw new FeedDoesNotExistException("Feed " + name +
- " does not exist.");
- }
-
- NormalFeed feed = feedTypes.get(type);
-
- if (feed == null) {
- throw new FeedDoesNotExistException("Feed " + name +
- " exists, but not with type " + type + ".");
- }
-
- return feed;
- }
-
- /**
- * Gets a feed (any - special or normal) of the given type and name.
- * @param name Name of the feed to get.
- * @param type Type of the feed to get.
- * @return Feed with the given name and type.
- */
- public Feed getFeed(String name, String type)
- throws FeedDoesNotExistException {
- if (name == null || type == null) {
- throw new FeedDoesNotExistException("Null name and/or type.");
- }
-
- try {
- return getNormalFeed(name, type);
- } catch (FeedDoesNotExistException e) {
- // Checking for a special feed.
- for (String feedNamePrefix : specialFeeds.keySet()) {
- if (name.startsWith(feedNamePrefix)) {
- SpecialFeed unconcreteFeed = specialFeeds.get(feedNamePrefix).get(type);
- if (unconcreteFeed != null) {
- return unconcreteFeed.concretizeFeed(name);
- } else {
- throw new FeedDoesNotExistException("Feed " +
- name + " exists, but not with type " +
- type + ".");
- }
- }
- }
-
- throw e;
- }
- }
-
- /**
- * @param name
- * @return An attributes map with the given name.
- */
- public Map<String, Object> getAttributes(String name) {
- return attributes.get(name);
- }
-
- public VariableResolverManager getVariableResolverManager() {
- return vrm;
- }
-
- /**
- * Releases all feeds - deletes temporary files which contain them.
- */
- public void release() {
- for (Map<String, NormalFeed> feedTypes : feeds.values()) {
- for (NormalFeed feed : feedTypes.values()) {
- feed.release();
- }
- }
- }
-
- public String getId() {
- return id;
- }
-}
+ public int getConnTimeout();
+
+ public int getReadTimeout();
+}
\ No newline at end of file
Added: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsDescriptorImpl.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsDescriptorImpl.java (rev 0)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsDescriptorImpl.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -0,0 +1,341 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.shotoku.feeds;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.xerces.parsers.DOMParser;
+import org.apache.log4j.Logger;
+import org.jboss.shotoku.ContentManager;
+import org.jboss.shotoku.feeds.data.NormalFeed;
+import org.jboss.shotoku.feeds.data.special.SpecialFeed;
+import org.jboss.shotoku.feeds.data.Feed;
+import org.jboss.shotoku.feeds.variables.VariableResolverManager;
+import org.jboss.shotoku.feeds.tag.FeedTagHandler;
+import org.jboss.shotoku.feeds.tag.FeedTagHandlerManager;
+import org.jboss.shotoku.feeds.tools.FeedsConstants;
+import org.jboss.shotoku.feeds.exceptions.FeedDoesNotExistException;
+import org.jboss.shotoku.tools.Pair;
+import org.jboss.shotoku.tools.Tools;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import static org.jboss.shotoku.tools.Tuples.*;
+
+/**
+ * Class which handles parsing feed descriptions, generates the feeds and
+ * provides access to them.
+ *
+ * @author adamw
+ * @author damon at sicore.org
+ */
+public class FeedsDescriptorImpl implements FeedsDescriptor {
+ private static final Logger log = Logger.getLogger(FeedsDescriptorImpl.class);
+
+ private Pair<String, String> confKey;
+
+ /**
+ * Ready feeds: feed name -> (feed type -> feed).
+ */
+ private Map<String, Map<String, NormalFeed>> feeds;
+
+ /**
+ * Special feeds: feed name prefix -> (feed type -> feed).
+ */
+ private Map<String, Map<String, SpecialFeed>> specialFeeds;
+
+ /**
+ * Properties: sets of attributes which can be used in
+ * feeds.
+ */
+ private Map<String, Map<String, Object>> attributes;
+
+ private VariableResolverManager vrm;
+
+ /**
+ * Feed tag handlers (not yet generated): feed name -> (feed type -> feed
+ * tag handler).
+ */
+ private Map<String, Map<String, FeedTagHandler>> feedTagHandlers;
+
+ /**
+ * A set of feed names that are currently generated (used to detect looping
+ * feed definitions).
+ */
+ private Set<String> duringGeneration;
+
+ /**
+ * Feeds configuration id.
+ */
+ private String id;
+
+ private FeedsConfigurationWatcher fcw;
+
+ private int readTimeout;
+ private int connTimeout;
+
+ public FeedsDescriptorImpl(String id, FeedsConfigurationWatcher fcw, int connTimeout, int readTimeout) {
+ this.readTimeout = readTimeout;
+ this.connTimeout = connTimeout;
+
+ this.fcw = fcw;
+ this.id = id;
+
+ confKey = tuple(
+ ContentManager.getProperty(FeedsConstants.CONFIGID, ""),
+ ContentManager.getProperty(FeedsConstants.CONFIGDIR, ""));
+
+ // From attributes read from Shotoku, getting the content manager
+ // configuration for this feeds id.
+ ContentManager cm = ContentManager.getContentManager(
+ getProperty(FeedsConstants.FEEDID),
+ getProperty(FeedsConstants.FEEDDIR)
+ );
+
+ vrm = new VariableResolverManager(id, getProperties());
+ feedTagHandlers = new HashMap<String, Map<String, FeedTagHandler>>();
+
+ // Creating the maps that will hold the feeds.
+ feeds = new HashMap<String, Map<String, NormalFeed>>();
+ specialFeeds = new HashMap<String, Map<String, SpecialFeed>>();
+ attributes = new HashMap<String, Map<String, Object>>();
+
+ // Looking for file containing feed definitons and filling the maps.
+ for (org.jboss.shotoku.Node feedNode :
+ cm.getRootDirectory().getNodes().toList()) {
+ if (feedNode.getName().endsWith(FeedsConstants.NODE_ENDING)) {
+ try {
+ addFeedDefinitions(feedNode);
+ } catch (Exception e) {
+ // We just don't add the feeds ... and log a warning.
+ log.warn("Can't add feed definitions from node " +
+ feedNode.getFullName() + ".", e);
+ }
+ }
+ }
+
+ // Generating the feeds.
+ duringGeneration = new HashSet<String>();
+ while (feedTagHandlers.size() > 0) {
+ // Trying to generate any feed found in the feed tag handler map.
+ generateFeed(feedTagHandlers.keySet().iterator().next());
+ }
+ }
+
+ public int getConnTimeout() {
+ return connTimeout;
+ }
+
+ public int getReadTimeout() {
+ return readTimeout;
+ }
+
+ private Properties getProperties() {
+ return fcw.get(confKey);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.shotoku.feeds.IFeedsDescriptor#getProperty(java.lang.String)
+ */
+ public String getProperty(String name) {
+ return getProperties().getProperty(id + name);
+ }
+
+ private void addFeedDefinitions(org.jboss.shotoku.Node node) throws SAXException, IOException {
+ DOMParser parser = new DOMParser();
+ // Parse the descriptor at the given Shotoku node.
+ parser.parse(new InputSource(node.getContentInputStream()));
+ // Get the XML document element of the feed descriptor file.
+ Node root = parser.getDocument().getDocumentElement();
+ String group = Tools.getAttributeValue(root, "display-name");
+
+ NodeList nodes = root.getChildNodes();
+
+ // Iterate through the rest of the feed descriptor
+ // file to load all feeds for a given feed group.
+ for (int i = 0; i < nodes.getLength(); i++) {
+ Node n = nodes.item(i);
+ FeedTagHandlerManager.createHandlers(group, n, vrm, this);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.shotoku.feeds.IFeedsDescriptor#addFeedTagHandler(java.lang.String, java.lang.String, org.jboss.shotoku.feeds.tag.FeedTagHandler)
+ */
+ public void addFeedTagHandler(String name, String type, FeedTagHandler fth) {
+ Map<String, FeedTagHandler> typesMap = feedTagHandlers.get(name);
+ if (typesMap == null) {
+ typesMap = new HashMap<String, FeedTagHandler>();
+ feedTagHandlers.put(name, typesMap);
+ }
+
+ typesMap.put(type, fth);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.shotoku.feeds.IFeedsDescriptor#addFeed(java.lang.String, java.lang.String, org.jboss.shotoku.feeds.data.NormalFeed)
+ */
+ public void addFeed(String name, String type, NormalFeed feed) {
+ Map<String, NormalFeed> typesMap = feeds.get(name);
+ if (typesMap == null) {
+ typesMap = new HashMap<String, NormalFeed>();
+ feeds.put(name, typesMap);
+ }
+
+ typesMap.put(type, feed);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.shotoku.feeds.IFeedsDescriptor#addSpecialFeed(java.lang.String, java.lang.String, org.jboss.shotoku.feeds.data.special.SpecialFeed)
+ */
+ public void addSpecialFeed(String name, String type, SpecialFeed feed) {
+ Map<String, SpecialFeed> typesMap = specialFeeds.get(name);
+ if (typesMap == null) {
+ typesMap = new HashMap<String, SpecialFeed>();
+ specialFeeds.put(name, typesMap);
+ }
+
+ typesMap.put(type, feed);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.shotoku.feeds.IFeedsDescriptor#addAttributes(java.lang.String, java.util.Map)
+ */
+ public void addAttributes(String name, Map<String, Object> props) {
+ attributes.put(name, props);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.shotoku.feeds.IFeedsDescriptor#generateFeed(java.lang.String)
+ */
+ public boolean generateFeed(String name) {
+ if (duringGeneration.contains(name)) {
+ return false;
+ }
+
+ Map<String, FeedTagHandler> typeMap = feedTagHandlers.get(name);
+ if (typeMap != null) {
+ feedTagHandlers.remove(name);
+
+ duringGeneration.add(name);
+ boolean ret = true;
+ for (FeedTagHandler fth : typeMap.values()) {
+ ret &= fth.generate(this);
+ }
+ duringGeneration.remove(name);
+
+ return ret;
+ }
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.shotoku.feeds.IFeedsDescriptor#getNormalFeed(java.lang.String, java.lang.String)
+ */
+ public NormalFeed getNormalFeed(String name, String type)
+ throws FeedDoesNotExistException {
+ Map<String, NormalFeed> feedTypes = feeds.get(name);
+ if (feedTypes == null) {
+ throw new FeedDoesNotExistException("Feed " + name +
+ " does not exist.");
+ }
+
+ NormalFeed feed = feedTypes.get(type);
+
+ if (feed == null) {
+ throw new FeedDoesNotExistException("Feed " + name +
+ " exists, but not with type " + type + ".");
+ }
+
+ return feed;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.shotoku.feeds.IFeedsDescriptor#getFeed(java.lang.String, java.lang.String)
+ */
+ public Feed getFeed(String name, String type)
+ throws FeedDoesNotExistException {
+ if (name == null || type == null) {
+ throw new FeedDoesNotExistException("Null name and/or type.");
+ }
+
+ try {
+ return getNormalFeed(name, type);
+ } catch (FeedDoesNotExistException e) {
+ // Checking for a special feed.
+ for (String feedNamePrefix : specialFeeds.keySet()) {
+ if (name.startsWith(feedNamePrefix)) {
+ SpecialFeed unconcreteFeed = specialFeeds.get(feedNamePrefix).get(type);
+ if (unconcreteFeed != null) {
+ return unconcreteFeed.concretizeFeed(name);
+ } else {
+ throw new FeedDoesNotExistException("Feed " +
+ name + " exists, but not with type " +
+ type + ".");
+ }
+ }
+ }
+
+ throw e;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.shotoku.feeds.IFeedsDescriptor#getAttributes(java.lang.String)
+ */
+ public Map<String, Object> getAttributes(String name) {
+ return attributes.get(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.shotoku.feeds.IFeedsDescriptor#getVariableResolverManager()
+ */
+ public VariableResolverManager getVariableResolverManager() {
+ return vrm;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.shotoku.feeds.IFeedsDescriptor#release()
+ */
+ public void release() {
+ for (Map<String, NormalFeed> feedTypes : feeds.values()) {
+ for (NormalFeed feed : feedTypes.values()) {
+ feed.release();
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.shotoku.feeds.IFeedsDescriptor#getId()
+ */
+ public String getId() {
+ return id;
+ }
+}
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/AtomFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/AtomFeed.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/AtomFeed.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -30,8 +30,8 @@
public class AtomFeed extends RomeBasedFeed {
public AtomFeed(String id, String name, String displayName, String type,
File file,
- Map<String, Object> attributes) {
- super(id, name, displayName, type, file, attributes);
+ Map<String, Object> attributes, int connTimeout, int readTimeout) {
+ super(id, name, displayName, type, file, attributes, connTimeout, readTimeout);
}
@Override
Added: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/DummyNormalFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/DummyNormalFeed.java (rev 0)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/DummyNormalFeed.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -0,0 +1,25 @@
+package org.jboss.shotoku.feeds.data;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Writer;
+import java.net.URL;
+
+public class DummyNormalFeed extends DummyFeed implements NormalFeed {
+ public void generate(URL url) throws IOException {
+ }
+
+ public void generate(InputStream is) throws IOException {
+ }
+
+ public void generate(NormalFeed[] feeds, String title, String description, String author, String link) throws IllegalArgumentException, IOException {
+ }
+
+ public InputStream getInputStream() {
+ return null;
+ }
+
+ public Writer getWriter() throws IOException {
+ return null;
+ }
+}
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/FileBasedFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/FileBasedFeed.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/FileBasedFeed.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -35,6 +35,7 @@
import java.io.OutputStream;
import java.io.Writer;
import java.net.URL;
+import java.net.URLConnection;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
@@ -43,18 +44,26 @@
public abstract class FileBasedFeed extends AbstractFeed
implements NormalFeed {
private File file;
+ private int connTimeout;
+ private int readTimeout;
public FileBasedFeed(String id, String name, String displayName,
- String type, File file, Map<String, Object> attributes) {
+ String type, File file, Map<String, Object> attributes, int connTimeout, int readTimeout) {
super(id, name, displayName, type, attributes);
this.file = file;
+ this.connTimeout = connTimeout;
+ this.readTimeout = readTimeout;
}
public void generate(URL url) throws IOException {
InputStream is = null;
try {
- is = url.openStream();
+ URLConnection conn = url.openConnection();
+ conn.setReadTimeout(readTimeout);
+ conn.setConnectTimeout(connTimeout);
+ conn.connect();
+ is = conn.getInputStream();
generate(is);
} finally {
if (is != null) {
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/InformaBasedFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/InformaBasedFeed.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/InformaBasedFeed.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -18,8 +18,8 @@
public abstract class InformaBasedFeed extends FileBasedFeed {
public InformaBasedFeed(String id, String name, String displayName,
String type, File file,
- Map<String, Object> attributes) {
- super(id, name, displayName, type, file, attributes);
+ Map<String, Object> attributes, int connTimeout, int readTimeout) {
+ super(id, name, displayName, type, file, attributes, connTimeout, readTimeout);
}
protected abstract ChannelExporterIF getExporter() throws IOException;
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/NormalFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/NormalFeed.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/NormalFeed.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -26,8 +26,6 @@
import java.io.Writer;
import java.net.URL;
-import javax.servlet.http.HttpServletResponse;
-
/**
* An interface that should be implemented by classes representing normal data feeds.
* @author adamw
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/RdfFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/RdfFeed.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/RdfFeed.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -31,8 +31,8 @@
public class RdfFeed extends InformaBasedFeed {
public RdfFeed(String id, String name, String displayName, String type, File file,
- Map<String, Object> attributes) {
- super(id, name, displayName, type, file, attributes);
+ Map<String, Object> attributes, int connTimeout, int readTimeout) {
+ super(id, name, displayName, type, file, attributes, connTimeout, readTimeout);
}
protected ChannelExporterIF getExporter() throws IOException {
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/RomeBasedFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/RomeBasedFeed.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/RomeBasedFeed.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -38,8 +38,8 @@
public abstract class RomeBasedFeed extends FileBasedFeed {
public RomeBasedFeed(String id, String name, String displayName,
String type, File file,
- Map<String, Object> attributes){
- super(id, name, displayName, type, file, attributes);
+ Map<String, Object> attributes, int connTimeout, int readTimeout){
+ super(id, name, displayName, type, file, attributes, connTimeout, readTimeout);
}
protected abstract void setFeedType(SyndFeed feed);
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/Rss2Feed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/Rss2Feed.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/Rss2Feed.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -29,8 +29,8 @@
public class Rss2Feed extends RomeBasedFeed {
public Rss2Feed(String id, String name, String displayName, String type,
- File file, Map<String, Object> attributes) {
- super(id, name, displayName, type, file, attributes);
+ File file, Map<String, Object> attributes, int connTimeout, int readTimeout) {
+ super(id, name, displayName, type, file, attributes, connTimeout, readTimeout);
}
@Override
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/service/FeedsServiceImpl.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/service/FeedsServiceImpl.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/service/FeedsServiceImpl.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -3,9 +3,11 @@
import org.jboss.annotation.ejb.Service;
import org.jboss.annotation.ejb.Management;
import org.jboss.annotation.ejb.Depends;
+import org.jboss.shotoku.feeds.DummyFeedsDescriptor;
import org.jboss.shotoku.feeds.FeedsService;
+import org.jboss.shotoku.feeds.FeedsDescriptorImpl;
+import org.jboss.shotoku.feeds.FeedsConfigurationWatcher;
import org.jboss.shotoku.feeds.FeedsDescriptor;
-import org.jboss.shotoku.feeds.FeedsConfigurationWatcher;
import org.jboss.shotoku.feeds.exceptions.FeedDoesNotExistException;
import org.jboss.shotoku.feeds.data.Feed;
import org.jboss.shotoku.feeds.tools.FeedsConstants;
@@ -17,6 +19,7 @@
import javax.ejb.Local;
import java.util.HashMap;
+import java.util.Map;
/**
* @author Adam Warski (adamw at aster.pl)
@@ -33,14 +36,23 @@
* FeedsService implementation.
*/
- @SuppressWarnings({"UNUSED_SYMBOL"})
private static FeedsConfigurationWatcher conf;
- private HashMap<String, FeedsDescriptor> fds;
+ private Map<String, FeedsDescriptor> fds;
+
+ private int remoteConnectionTimeout;
+ private int remoteReadTimeout;
private synchronized FeedsDescriptor getFeedsDescriptor(String id) {
if (!fds.containsKey(id)) {
- fds.put(id, new FeedsDescriptor(id, conf));
+ // Just marking the feed for renewal on the nearest update.
+ fds.put(id, new DummyFeedsDescriptor(id));
+
+ // And interrupting the update thread to update asap.
+ Thread ut = getUpdateThread();
+ if (ut != null) {
+ ut.interrupt();
+ }
}
return fds.get(id);
@@ -63,7 +75,8 @@
// Updating descriptors.
for (String id : fds.keySet()) {
FeedsDescriptor fd = fds.get(id);
- fds.put(id, new FeedsDescriptor(id, conf));
+ fds.put(id, new FeedsDescriptorImpl(id, conf, getRemoteConnectionTimeout(),
+ getRemoteReadTimeout()));
fd.release();
}
}
@@ -76,8 +89,10 @@
conf = new FeedsConfigurationWatcher();
- setTimerInterval(ContentManager.getProperty(
- FeedsConstants.PROPERTY_INTERVAL, 10000));
+ setTimerInterval(ContentManager.getProperty(FeedsConstants.PROPERTY_INTERVAL, 600000));
+ setRemoteReadTimeout(ContentManager.getProperty(FeedsConstants.PROPERTY_READ_TIMEOUT, 1000));
+ setRemoteConnectionTimeout(ContentManager.getProperty(FeedsConstants.PROPERTY_CONN_TIMEOUT, 5000));
+
fds = new HashMap<String, FeedsDescriptor>();
super.afterCreate();
@@ -118,4 +133,22 @@
public AdministratedService getServiceInstance() {
return FeedsTools.getService();
}
+
+ public int getRemoteConnectionTimeout() {
+ return remoteConnectionTimeout;
+ }
+
+ public void setRemoteConnectionTimeout(int remoteConnectionTimeout) {
+ this.remoteConnectionTimeout = remoteConnectionTimeout;
+ }
+
+ public int getRemoteReadTimeout() {
+ return remoteReadTimeout;
+ }
+
+ public void setRemoteReadTimeout(int remoteReadTimeout) {
+ this.remoteReadTimeout = remoteReadTimeout;
+ }
+
+
}
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/AggregatedFeedTagHandler.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/AggregatedFeedTagHandler.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/AggregatedFeedTagHandler.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -4,6 +4,7 @@
import org.w3c.dom.NodeList;
import org.jboss.shotoku.feeds.data.NormalFeed;
import org.jboss.shotoku.feeds.FeedFactory;
+import org.jboss.shotoku.feeds.FeedsDescriptorImpl;
import org.jboss.shotoku.feeds.FeedsDescriptor;
import org.jboss.shotoku.feeds.exceptions.FeedDoesNotExistException;
import org.jboss.shotoku.feeds.tools.FeedDefAttributes;
@@ -18,7 +19,7 @@
* @author Adam Warski (adamw at aster.pl)
*/
public class AggregatedFeedTagHandler extends FeedTagHandler {
- private static final Logger log = Logger.getLogger(FeedsDescriptor.class);
+ private static final Logger log = Logger.getLogger(FeedsDescriptorImpl.class);
public AggregatedFeedTagHandler(String feedName, String group, Node definition, Substitution s) {
super(feedName, group, definition, s);
@@ -87,7 +88,7 @@
NormalFeed feed = FeedFactory.getNewNormalFeed(fd.getId(), feedName,
Tools.toString(attributes.get(FeedDefAttributes.DISP_NAME)),
- feedType, attributes);
+ feedType, attributes, fd.getConnTimeout(), fd.getReadTimeout());
try {
feed.generate(toAggregate.toArray(new NormalFeed[0]),
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/FeedTagHandler.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/FeedTagHandler.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/FeedTagHandler.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -2,6 +2,7 @@
import org.w3c.dom.Node;
import org.jboss.shotoku.feeds.variables.Substitution;
+import org.jboss.shotoku.feeds.FeedsDescriptorImpl;
import org.jboss.shotoku.feeds.FeedsDescriptor;
import org.jboss.shotoku.feeds.tools.FeedsConstants;
import org.jboss.shotoku.feeds.tools.FeedsTools;
@@ -18,7 +19,7 @@
* @author Adam Warski (adamw at aster.pl)
*/
public abstract class FeedTagHandler {
- private static final Logger log = Logger.getLogger(FeedsDescriptor.class);
+ private static final Logger log = Logger.getLogger(FeedsDescriptorImpl.class);
private String feedName;
private String group;
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/FeedTagHandlerManager.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/FeedTagHandlerManager.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/FeedTagHandlerManager.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -3,6 +3,7 @@
import org.jboss.shotoku.tools.Tools;
import org.jboss.shotoku.feeds.tools.FeedsConstants;
import org.jboss.shotoku.feeds.tools.FeedDefAttributes;
+import org.jboss.shotoku.feeds.FeedsDescriptorImpl;
import org.jboss.shotoku.feeds.FeedsDescriptor;
import org.jboss.shotoku.feeds.variables.VariableResolverManager;
import org.jboss.shotoku.feeds.variables.Substitution;
@@ -22,7 +23,7 @@
* @author Adam Warski (adamw at aster.pl)
*/
public class FeedTagHandlerManager {
- private static final Logger log = Logger.getLogger(FeedsDescriptor.class);
+ private static final Logger log = Logger.getLogger(FeedsDescriptorImpl.class);
/**
* Tag name -> tag handler constructor.
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/RemoteFeedTagHandler.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/RemoteFeedTagHandler.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/RemoteFeedTagHandler.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -4,8 +4,9 @@
import org.jboss.shotoku.feeds.variables.Substitution;
import org.jboss.shotoku.feeds.data.NormalFeed;
import org.jboss.shotoku.feeds.FeedFactory;
+import org.jboss.shotoku.feeds.FeedsDescriptor;
import org.jboss.shotoku.feeds.tools.FeedDefAttributes;
-import org.jboss.shotoku.feeds.FeedsDescriptor;
+import org.jboss.shotoku.feeds.FeedsDescriptorImpl;
import org.jboss.shotoku.tools.Tools;
import org.apache.log4j.Logger;
@@ -15,7 +16,7 @@
* @author Adam Warski (adamw at aster.pl)
*/
public class RemoteFeedTagHandler extends FeedTagHandler {
- private static final Logger log = Logger.getLogger(FeedsDescriptor.class);
+ private static final Logger log = Logger.getLogger(FeedsDescriptorImpl.class);
public RemoteFeedTagHandler(String feedName, String group, Node definition, Substitution s) {
super(feedName, group, definition, s);
@@ -31,7 +32,7 @@
try {
NormalFeed feed = FeedFactory.getNewNormalFeed(fd.getId(),
- feedName, displayName, feedType, getAttributes());
+ feedName, displayName, feedType, getAttributes(), fd.getConnTimeout(), fd.getReadTimeout());
feed.generate(new URL(address));
fd.addFeed(feedName, feedType, feed);
} catch (Exception e) {
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/ShotokuFeedTagHandler.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/ShotokuFeedTagHandler.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/ShotokuFeedTagHandler.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -8,6 +8,7 @@
import org.jboss.shotoku.feeds.tools.FeedsTools;
import org.jboss.shotoku.feeds.data.NormalFeed;
import org.jboss.shotoku.feeds.FeedFactory;
+import org.jboss.shotoku.feeds.FeedsDescriptorImpl;
import org.jboss.shotoku.feeds.FeedsDescriptor;
import org.jboss.shotoku.feeds.tools.VelocityContextAttributes;
import org.jboss.shotoku.feeds.tools.FeedDefAttributes;
@@ -23,7 +24,7 @@
* @author Adam Warski (adamw at aster.pl)
*/
public class ShotokuFeedTagHandler extends FeedTagHandler {
- private static final Logger log = Logger.getLogger(FeedsDescriptor.class);
+ private static final Logger log = Logger.getLogger(FeedsDescriptorImpl.class);
public ShotokuFeedTagHandler(String feedName, String group, Node definition, Substitution s) {
super(feedName, group, definition, s);
@@ -126,7 +127,6 @@
FeedsTools.prepareVelocityContext(attributes, vc);
NodeList feedNodeChildren = getDefinition().getChildNodes();
- org.jboss.shotoku.NodeList nodesNodeList = null;
for (int i = 0; i < feedNodeChildren.getLength(); i++) {
// For each search node, generating and performing the
// search, placing it under the demanded attribute in
@@ -147,11 +147,6 @@
vc.put(searchNameAttr, list);
- if (VelocityContextAttributes.NODES_LIST.equals(
- searchNameAttr)) {
- nodesNodeList = list;
- }
-
// Calculating the age of the youngest node and putting it into the context.
long youngestNode = 0;
if (list.size() > 0) {
@@ -172,7 +167,7 @@
String feedName = getFeedName();
String feedType = getFeedType();
NormalFeed newFeed = FeedFactory.getNewNormalFeed(fd.getId(), feedName,
- displayName, feedType, attributes);
+ displayName, feedType, attributes, fd.getConnTimeout(), fd.getReadTimeout());
try {
vc.put(VelocityContextAttributes.LINK,
generateFeedLink(fd, true, feedName, feedType));
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/TagFeedTagHandler.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/TagFeedTagHandler.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/TagFeedTagHandler.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -1,8 +1,8 @@
package org.jboss.shotoku.feeds.tag;
import org.apache.velocity.VelocityContext;
+import org.jboss.shotoku.feeds.FeedFactory;
import org.jboss.shotoku.feeds.FeedsDescriptor;
-import org.jboss.shotoku.feeds.FeedFactory;
import org.jboss.shotoku.feeds.data.special.SpecialFeed;
import org.jboss.shotoku.feeds.tools.FeedsTools;
import org.jboss.shotoku.feeds.tools.FeedsConstants;
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedDefAttributes.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedDefAttributes.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedDefAttributes.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -1,7 +1,5 @@
package org.jboss.shotoku.feeds.tools;
-import org.jboss.shotoku.tools.Constants;
-
/**
* Names of meaningful xml-node attributes in definitions
* of feeds.
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedsConstants.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedsConstants.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedsConstants.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -53,6 +53,9 @@
* service updates can be found.
*/
public static final String PROPERTY_INTERVAL = Constants.PROPERTIES_INTERNAL + ".feeds.service.interval";
+
+ public static final String PROPERTY_CONN_TIMEOUT = Constants.PROPERTIES_INTERNAL + ".feeds.service.conn_timeout";
+ public static final String PROPERTY_READ_TIMEOUT = Constants.PROPERTIES_INTERNAL + ".feeds.service.read_timeout";
/**
* Property name suffix, under which the fully qualified class name of a
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedsTools.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedsTools.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedsTools.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -2,7 +2,7 @@
import org.apache.velocity.VelocityContext;
import org.apache.log4j.Logger;
-import org.jboss.shotoku.feeds.FeedsDescriptor;
+import org.jboss.shotoku.feeds.FeedsDescriptorImpl;
import org.jboss.shotoku.feeds.FeedsService;
import org.jboss.shotoku.feeds.service.FeedsServiceImpl;
import org.jboss.shotoku.ContentManager;
@@ -19,7 +19,7 @@
* @author Adam Warski (adamw at aster.pl)
*/
public class FeedsTools {
- private static final Logger log = Logger.getLogger(FeedsDescriptor.class);
+ private static final Logger log = Logger.getLogger(FeedsDescriptorImpl.class);
/**
* For each attribute from the given map, if its key denotes a class
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/variables/VariableResolverManager.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/variables/VariableResolverManager.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/variables/VariableResolverManager.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -2,7 +2,7 @@
import org.w3c.dom.Node;
import org.jboss.shotoku.feeds.tools.FeedsConstants;
-import org.jboss.shotoku.feeds.FeedsDescriptor;
+import org.jboss.shotoku.feeds.FeedsDescriptorImpl;
import org.apache.log4j.Logger;
import java.util.HashMap;
@@ -14,7 +14,7 @@
* @author Adam Warski (adamw at aster.pl)
*/
public class VariableResolverManager {
- private static final Logger log = Logger.getLogger(FeedsDescriptor.class);
+ private static final Logger log = Logger.getLogger(FeedsDescriptorImpl.class);
private Map<String, Constructor> varResolversNodeConstructor;
private Map<String, Constructor> varResolversEmptyConstructor;
Modified: labs/shotoku/trunk/shotoku-tags/src/java/org/jboss/shotoku/tags/service/TagServiceImpl.java
===================================================================
--- labs/shotoku/trunk/shotoku-tags/src/java/org/jboss/shotoku/tags/service/TagServiceImpl.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-tags/src/java/org/jboss/shotoku/tags/service/TagServiceImpl.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -68,7 +68,6 @@
private ContentManager cm;
- @SuppressWarnings({ "UNUSED_SYMBOL" })
@PersistenceUnit
private EntityManagerFactory emf;
@@ -110,7 +109,8 @@
* Timer-handling functions.
*/
- public void update() {
+ @SuppressWarnings("unchecked")
+ public void update() {
if (!syncOn) {
// Synchronization is turned off.
return;
@@ -120,7 +120,6 @@
try {
// Performing synchronization (tags -> shotoku).
- // noinspection unchecked
List<TagEntity> result = em.createQuery(
"FROM TagEntity " + "WHERE synced = 0 OR synced IS NULL")
.getResultList();
@@ -253,10 +252,10 @@
});
}
- public List<Tag> getTags(String resourceId) throws TagGetException {
+ @SuppressWarnings("unchecked")
+ public List<Tag> getTags(String resourceId) throws TagGetException {
EntityManager manager = emf.createEntityManager();
try {
- // noinspection unchecked
List<TagEntity> result = manager
.createQuery(
"from TagEntity where resourceId = :resourceId order by dateCreated desc")
@@ -295,7 +294,8 @@
}
}
- public List<Tag> getTags(List<String> tagNames) throws TagGetException {
+ @SuppressWarnings("unchecked")
+ public List<Tag> getTags(List<String> tagNames) throws TagGetException {
EntityManager manager = emf.createEntityManager();
try {
StringBuffer querySb = new StringBuffer("FROM TagEntity WHERE ");
@@ -318,7 +318,6 @@
query.setParameter("name" + i++, tagName);
}
- // noinspection unchecked
List<TagEntity> result = query.getResultList();
List<Tag> ret = new ArrayList<Tag>();
@@ -334,7 +333,8 @@
}
}
- public List<Tag> getUniqueTags(List<String> tagNames)
+ @SuppressWarnings("unchecked")
+ public List<Tag> getUniqueTags(List<String> tagNames)
throws TagGetException {
EntityManager manager = emf.createEntityManager();
try {
@@ -362,7 +362,6 @@
query.setParameter("name" + i++, tagName);
}
- // noinspection unchecked
List<Object[]> result = query.getResultList();
List<Tag> ret = new ArrayList<Tag>();
@@ -444,10 +443,10 @@
return ret / (double) givenTags.size();
}
- public List<Tag> getTagsByAuthor(String author) throws TagGetException {
+ @SuppressWarnings("unchecked")
+ public List<Tag> getTagsByAuthor(String author) throws TagGetException {
EntityManager manager = emf.createEntityManager();
try {
- // noinspection unchecked
List<TagEntity> result = manager
.createQuery(
"from TagEntity where author = :author order by dateCreated desc")
@@ -466,11 +465,11 @@
}
}
- public List<Tag> getUniqueTagsByAuthor(String author)
+ @SuppressWarnings("unchecked")
+ public List<Tag> getUniqueTagsByAuthor(String author)
throws TagGetException {
EntityManager manager = emf.createEntityManager();
try {
- // noinspection unchecked
List<Object[]> result = manager.createQuery(
"SELECT name, min(dateCreated), type FROM TagEntity "
+ "WHERE author = :author " + "GROUP BY name, type") // +
@@ -493,7 +492,8 @@
}
}
- public List<Tag> getTags(String name, String author) throws TagGetException {
+ @SuppressWarnings("unchecked")
+ public List<Tag> getTags(String name, String author) throws TagGetException {
EntityManager manager = emf.createEntityManager();
try {
// noinspection unchecked
@@ -519,10 +519,10 @@
}
}
- public List<Tag> getUniqueTags(String resourceId) throws TagGetException {
+ @SuppressWarnings("unchecked")
+ public List<Tag> getUniqueTags(String resourceId) throws TagGetException {
EntityManager manager = emf.createEntityManager();
try {
- // noinspection unchecked
List<Object[]> result = manager.createQuery(
"SELECT name, min(dateCreated), type FROM TagEntity "
+ "WHERE resourceId = :resourceId "
@@ -566,21 +566,21 @@
+ Tools.encodeURL(sb.toString()) + "/" + type;
}
- public List<String> getAllTagsNames(String resourceId)
+ @SuppressWarnings("unchecked")
+ public List<String> getAllTagsNames(String resourceId)
throws TagGetException {
EntityManager manager = emf.createEntityManager();
- // noinspection unchecked
return (List<String>) manager
.createQuery(
"SELECT DISTINCT name FROM TagEntity WHERE resourceId = :resourceId")
.setParameter("resourceId", resourceId).getResultList();
}
- public List<Tag> getAllTags() throws TagGetException {
+ @SuppressWarnings("unchecked")
+ public List<Tag> getAllTags() throws TagGetException {
EntityManager manager = emf.createEntityManager();
try {
List<Tag> result = new ArrayList<Tag>();
- // noinspection unchecked
List<TagEntity> tagEnitites = manager.createQuery("from TagEntity")
.getResultList();
Modified: labs/shotoku/trunk/shotoku-tags/src/java/org/jboss/shotoku/tags/test/TagsServiceMultiThreadTest.java
===================================================================
--- labs/shotoku/trunk/shotoku-tags/src/java/org/jboss/shotoku/tags/test/TagsServiceMultiThreadTest.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-tags/src/java/org/jboss/shotoku/tags/test/TagsServiceMultiThreadTest.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -26,10 +26,6 @@
private Random random = new Random();
- private int getRandom(int begin, int end) {
- return random.nextInt(end-begin) + begin;
- }
-
private int getRandom(int end) {
return random.nextInt(end);
}
Modified: labs/shotoku/trunk/shotoku-tags/src/java/org/jboss/shotoku/tags/test/TagsTestServlet.java
===================================================================
--- labs/shotoku/trunk/shotoku-tags/src/java/org/jboss/shotoku/tags/test/TagsTestServlet.java 2007-07-06 18:43:31 UTC (rev 13180)
+++ labs/shotoku/trunk/shotoku-tags/src/java/org/jboss/shotoku/tags/test/TagsTestServlet.java 2007-07-06 18:43:58 UTC (rev 13181)
@@ -1,20 +1,14 @@
package org.jboss.shotoku.tags.test;
import org.jboss.shotoku.tags.tools.TagTools;
-import org.jboss.shotoku.tags.tools.FeedType;
import org.jboss.shotoku.tags.ShotokuTag;
import org.jboss.shotoku.tags.Tag;
-import org.jboss.shotoku.tags.exceptions.TagAddException;
-import org.jboss.shotoku.tags.exceptions.TagGetException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.IOException;
-import java.util.Calendar;
-import java.util.List;
-import java.util.ArrayList;
import java.util.Date;
/**
More information about the jboss-svn-commits
mailing list