You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(233) |
Sep
(199) |
Oct
(206) |
Nov
(185) |
Dec
(270) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(232) |
Feb
(426) |
Mar
(623) |
Apr
(592) |
May
(506) |
Jun
(389) |
Jul
(160) |
Aug
(3) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
(5) |
2007 |
Jan
(1) |
Feb
(1) |
Mar
(2) |
Apr
(2) |
May
(4) |
Jun
(2) |
Jul
|
Aug
(3) |
Sep
(5) |
Oct
(9) |
Nov
(6) |
Dec
(6) |
2008 |
Jan
(3) |
Feb
|
Mar
(1) |
Apr
(3) |
May
(3) |
Jun
(5) |
Jul
(10) |
Aug
(2) |
Sep
(12) |
Oct
(10) |
Nov
(54) |
Dec
(49) |
2009 |
Jan
(19) |
Feb
(13) |
Mar
(20) |
Apr
(24) |
May
(44) |
Jun
(29) |
Jul
(32) |
Aug
(10) |
Sep
(7) |
Oct
(10) |
Nov
(4) |
Dec
(17) |
2010 |
Jan
(14) |
Feb
(5) |
Mar
(23) |
Apr
(50) |
May
(31) |
Jun
(9) |
Jul
(5) |
Aug
(4) |
Sep
(7) |
Oct
(5) |
Nov
(2) |
Dec
(3) |
2011 |
Jan
(12) |
Feb
(5) |
Mar
(5) |
Apr
(3) |
May
(4) |
Jun
(3) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2012 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(4) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2015 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <jbo...@li...> - 2005-11-03 21:38:37
|
Author: adamw Date: 2005-11-03 16:38:27 -0500 (Thu, 03 Nov 2005) New Revision: 1499 Added: trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/InformaBasedFeed.java Modified: trunk/forge/portal-extensions/forge-feeds/project.xml trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/Feed.java trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedFactory.java trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsDescriptor.java trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsNodeWatcher.java trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsPortlet.java trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsServlet.java trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FileBasedFeed.java trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/RdfFeed.java trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/RomeBasedFeed.java Log: http://jira.jboss.com/jira/browse/JBLAB-408 : "beta" version of feeds Modified: trunk/forge/portal-extensions/forge-feeds/project.xml =================================================================== --- trunk/forge/portal-extensions/forge-feeds/project.xml 2005-11-03 21:37:25 UTC (rev 1498) +++ trunk/forge/portal-extensions/forge-feeds/project.xml 2005-11-03 21:38:27 UTC (rev 1499) @@ -45,8 +45,18 @@ <war.bundle>true</war.bundle> </properties> </dependency> - + <dependency> + <groupId>informa</groupId> + <artifactId>informa</artifactId> + <version>0.6.5</version> + <jar>informa.jar</jar> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + + <dependency> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <version>2.6.2</version> Modified: trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/Feed.java =================================================================== --- trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/Feed.java 2005-11-03 21:37:25 UTC (rev 1498) +++ trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/Feed.java 2005-11-03 21:38:27 UTC (rev 1499) @@ -22,14 +22,12 @@ package org.jboss.forge.feeds; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; import java.net.URL; import javax.servlet.http.HttpServletResponse; -import com.sun.syndication.io.FeedException; -import com.sun.syndication.io.XmlReader; - /** * An interface that should be implemented by classes representing data feeds. * @author adamw @@ -58,11 +56,12 @@ * @param feeds Feeds which should be aggregated into a single * feed. */ - public void generateFromFeeds(Feed[] feeds) - throws IllegalArgumentException, FeedException, IOException; + public void generateFromFeeds(Feed[] feeds, String title, + String description, String author, String link) + throws IllegalArgumentException, IOException; /** - * Gets a xml reader for the given feed. - * @return A xml read for the given feed. + * Gets an input stream of this feed. + * @return Input stream of this feed. */ - public XmlReader getXmlReader() throws IOException; + public InputStream getInputStream(); } Modified: trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedFactory.java =================================================================== --- trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedFactory.java 2005-11-03 21:37:25 UTC (rev 1498) +++ trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedFactory.java 2005-11-03 21:38:27 UTC (rev 1499) @@ -41,7 +41,7 @@ feedClasses = new HashMap<String, Class>(); feedClasses.put("rss2", Rss2Feed.class); feedClasses.put("atom", AtomFeed.class); - //feedClasses.put("rdf", RdfFeed.class); + feedClasses.put("rdf", RdfFeed.class); random = new Random(); } Modified: trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsDescriptor.java 2005-11-03 21:37:25 UTC (rev 1498) +++ trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsDescriptor.java 2005-11-03 21:38:27 UTC (rev 1499) @@ -74,7 +74,8 @@ protected final static String FEEDS_FILE_PREFIX = "forge-feeds"; - static synchronized FeedsDescriptor getInstance(final String portalName) { + static synchronized FeedsDescriptor getInstance(final String portalName, + final String baseServerAddress) { FeedsDescriptor desc = (FeedsDescriptor) ForgeHelper .getForgeManagement().getFromCache(portalName, FeedsDescriptor.class.getName()); @@ -83,7 +84,7 @@ desc = (FeedsDescriptor) ForgeHelper.getForgeManagement() .addNodeWatcher(portalName, FeedsDescriptor.class.getName(), - new FeedsNodeWatcher()); + new FeedsNodeWatcher(baseServerAddress)); return desc; } @@ -108,7 +109,11 @@ private DelegateContext context; - public FeedsDescriptor(String portalName) { + private String baseServerAddress; + + public FeedsDescriptor(String portalName, String baseServerAddress) { + this.baseServerAddress = baseServerAddress; + ContentManager cm = ContentManager.getContentManager(portalName + "/" + FEEDS_DIRECTORY); @@ -210,7 +215,6 @@ } catch (Exception e) { log.warn("Can't add feeed " + address + " : " + type + ".", e); - e.printStackTrace(); } } @@ -224,6 +228,7 @@ // First building requirements of each feed - that is, whit which // feeds each aggregated feed is built. Map<String, Set<String>> requirements = new HashMap<String, Set<String>>(); + Map<String, String[]> parameters = new HashMap<String, String[]>(); for (String feedName : feedDefs.keySet()) { Node n; @@ -232,6 +237,11 @@ Set<String> feedRequirements = new HashSet<String>(); requirements.put(feedName, feedRequirements); + parameters.put(feedName, new String[] { + XmlTools.getAttributeValue(feedNode, "title"), + XmlTools.getAttributeValue(feedNode, "description"), + XmlTools.getAttributeValue(feedNode, "author") + }); feedDisplayNames.put(feedName, XmlTools.getAttributeValue(feedNode, "display-name")); @@ -257,6 +267,7 @@ iter.hasNext();) { String feedName = iter.next(); Set<String> feedRequirements = requirements.get(feedName); + String[] feedParameters = parameters.get(feedName); Set<String> types = null; // Checking if the all of this feed's requirements are met @@ -293,11 +304,12 @@ Feed newFeed = FeedFactory.getNewFeed(type); try { - newFeed.generateFromFeeds(requiredFeeds.toArray(new Feed[0])); + newFeed.generateFromFeeds(requiredFeeds.toArray(new Feed[0]), + feedParameters[0], feedParameters[1], + feedParameters[2], generateFeedLink(true, feedName, type)); } catch (Exception e) { log.warn("Can't add aggregated feed " + feedName + " : " + type + ".", e); - e.printStackTrace(); } addFeed(feedName, type, newFeed); @@ -314,8 +326,8 @@ } } - private String generateFeedLink(String feedName, String feedType) { - return "/feeds/" + feedName + "/" + feedType; + private String generateFeedLink(boolean full, String feedName, String feedType) { + return (full ? baseServerAddress : "") + "/feeds/" + feedName + "/" + feedType; } private void fillContext() { @@ -337,7 +349,7 @@ for (String feedType : feedTypes.keySet()) { DelegateContext typeContext = feedContext.next("types"); typeContext.put("name", feedType); - typeContext.put("link", generateFeedLink(feedName, feedType)); + typeContext.put("link", generateFeedLink(false, feedName, feedType)); } } } Modified: trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsNodeWatcher.java =================================================================== --- trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsNodeWatcher.java 2005-11-03 21:37:25 UTC (rev 1498) +++ trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsNodeWatcher.java 2005-11-03 21:38:27 UTC (rev 1499) @@ -24,8 +24,14 @@ import org.jboss.forge.common.service.NodeWatcher; public class FeedsNodeWatcher implements NodeWatcher { + private String baseServerAddress; + + public FeedsNodeWatcher(String baseServerAddress) { + this.baseServerAddress = baseServerAddress; + } + private FeedsDescriptor getDesc(String portalName) { - return new FeedsDescriptor(portalName); + return new FeedsDescriptor(portalName, baseServerAddress); } public Object init(String portalName) { Modified: trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsPortlet.java =================================================================== --- trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsPortlet.java 2005-11-03 21:37:25 UTC (rev 1498) +++ trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsPortlet.java 2005-11-03 21:38:27 UTC (rev 1499) @@ -47,7 +47,8 @@ ProjectsHelper.prepareRequest(request); // Getting the feeds context. - DelegateContext feedsContext = FeedsDescriptor.getInstance(portalName) + DelegateContext feedsContext = FeedsDescriptor.getInstance(portalName, + ForgeHelper.getBaseServerAddress(request)) .getContext(); // Displaying. Modified: trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsServlet.java =================================================================== --- trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsServlet.java 2005-11-03 21:37:25 UTC (rev 1498) +++ trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsServlet.java 2005-11-03 21:38:27 UTC (rev 1499) @@ -59,7 +59,8 @@ String type = requestURI.substring(lastSlash+1); String name = requestURI.substring(0, lastSlash); - Feed feed = FeedsDescriptor.getInstance(ForgeHelper.LABS_PORTAL).getFeed(name, type); + Feed feed = FeedsDescriptor.getInstance(ForgeHelper.LABS_PORTAL, + ForgeHelper.getBaseServerAddress(request)).getFeed(name, type); if (feed == null) { invalidRequest(response); Modified: trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FileBasedFeed.java =================================================================== --- trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FileBasedFeed.java 2005-11-03 21:37:25 UTC (rev 1498) +++ trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FileBasedFeed.java 2005-11-03 21:38:27 UTC (rev 1499) @@ -25,6 +25,7 @@ import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; @@ -33,8 +34,6 @@ import javax.servlet.http.HttpServletResponse; -import com.sun.syndication.io.XmlReader; - public abstract class FileBasedFeed implements Feed { private final static int BUF_SIZE = 32768; @@ -77,10 +76,6 @@ write(response.getOutputStream()); } - public XmlReader getXmlReader() throws IOException { - return new XmlReader(file); - } - protected File getFile() { return file; } @@ -88,4 +83,12 @@ public void finalize() { file.delete(); } + + public InputStream getInputStream() { + try { + return new FileInputStream(file); + } catch (FileNotFoundException e) { + return null; + } + } } Added: trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/InformaBasedFeed.java =================================================================== --- trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/InformaBasedFeed.java 2005-11-03 21:37:25 UTC (rev 1498) +++ trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/InformaBasedFeed.java 2005-11-03 21:38:27 UTC (rev 1499) @@ -0,0 +1,51 @@ +package org.jboss.forge.feeds; + +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.util.Calendar; +import java.util.Iterator; + +import de.nava.informa.core.ChannelExporterIF; +import de.nava.informa.core.ChannelIF; +import de.nava.informa.core.ItemIF; +import de.nava.informa.core.ParseException; +import de.nava.informa.impl.basic.ChannelBuilder; +import de.nava.informa.parsers.FeedParser; + +public abstract class InformaBasedFeed extends FileBasedFeed { + public InformaBasedFeed(File file) { + super(file); + } + + protected abstract ChannelExporterIF getExporter() throws IOException; + + @SuppressWarnings("unchecked") + public void generateFromFeeds(Feed[] feeds, String title, String description, + String author, String link) throws IllegalArgumentException, + IOException { + ChannelBuilder builder = new ChannelBuilder(); + ChannelIF newChannel = builder.createChannel(title); + newChannel.setTitle(title); + newChannel.setDescription(description); + newChannel.setCreator(author); + newChannel.setPublisher(author); + newChannel.setLocation(new URL(link)); + newChannel.setPubDate(Calendar.getInstance().getTime()); + + for (Feed feed : feeds) { + ChannelIF childChannel; + try { + childChannel = FeedParser.parse(builder, feed.getInputStream()); + } catch (ParseException e) { + throw new IOException(e.getMessage()); + } + + for (Iterator iter = childChannel.getItems().iterator(); iter.hasNext();) { + newChannel.addItem((ItemIF) iter.next()); + } + } + + getExporter().write(newChannel); + } +} Modified: trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/RdfFeed.java =================================================================== --- trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/RdfFeed.java 2005-11-03 21:37:25 UTC (rev 1498) +++ trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/RdfFeed.java 2005-11-03 21:38:27 UTC (rev 1499) @@ -24,16 +24,16 @@ import java.io.File; import java.io.IOException; -import com.sun.syndication.feed.synd.SyndFeed; +import de.nava.informa.core.ChannelExporterIF; +import de.nava.informa.exporters.RSS_1_0_Exporter; -public class RdfFeed extends RomeBasedFeed { +public class RdfFeed extends InformaBasedFeed { public RdfFeed(File file) throws IOException { super(file); } - @Override - protected void setFeedType(SyndFeed feed) { - feed.setFeedType("rss_2.0"); + protected ChannelExporterIF getExporter() throws IOException { + return new RSS_1_0_Exporter(getFile()); } @Override Modified: trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/RomeBasedFeed.java =================================================================== --- trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/RomeBasedFeed.java 2005-11-03 21:37:25 UTC (rev 1498) +++ trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/RomeBasedFeed.java 2005-11-03 21:38:27 UTC (rev 1499) @@ -24,13 +24,19 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.Iterator; import java.util.List; +import com.sun.syndication.feed.synd.SyndEntry; import com.sun.syndication.feed.synd.SyndFeed; import com.sun.syndication.feed.synd.SyndFeedImpl; import com.sun.syndication.io.FeedException; import com.sun.syndication.io.SyndFeedInput; import com.sun.syndication.io.SyndFeedOutput; +import com.sun.syndication.io.XmlReader; public abstract class RomeBasedFeed extends FileBasedFeed { public RomeBasedFeed(File file) { @@ -40,27 +46,60 @@ protected abstract void setFeedType(SyndFeed feed); @SuppressWarnings("unchecked") - public void generateFromFeeds(Feed[] feeds) throws IllegalArgumentException, FeedException, IOException { + public void generateFromFeeds(Feed[] feeds, String title, String description, + String author, String link) throws IllegalArgumentException, + IOException { SyndFeed syndFeed = new SyndFeedImpl(); setFeedType(syndFeed); - syndFeed.setTitle("Labs feed"); - syndFeed.setDescription("Labs aggregated feed"); - syndFeed.setAuthor("Labs team"); - syndFeed.setLink("http://labs.jboss.com"); + syndFeed.setTitle(title); + syndFeed.setDescription(description); + syndFeed.setAuthor(author); + syndFeed.setLink(link); List entries = new ArrayList(); syndFeed.setEntries(entries); - + for (Feed feed : feeds) { SyndFeedInput input = new SyndFeedInput(); - SyndFeed inFeed = input.build(feed.getXmlReader()); + SyndFeed inFeed; + try { + inFeed = input.build(new XmlReader(feed.getInputStream())); + } catch (FeedException e) { + throw new IOException(e.getMessage()); + } - entries.addAll(inFeed.getEntries()); + if (inFeed.getAuthor() == null) + entries.addAll(inFeed.getEntries()); + else { + for (Iterator iter = inFeed.getEntries().iterator(); + iter.hasNext();) { + SyndEntry entry = (SyndEntry) iter.next(); + entry.setAuthor(inFeed.getAuthor()); + entries.add(entry); + } + + inFeed.setAuthor(null); + } } + + Collections.sort(entries, new Comparator<SyndEntry>() { + public int compare(SyndEntry o1, SyndEntry o2) { + Date date1 = o1.getPublishedDate(); + Date date2 = o2.getPublishedDate(); + if ((date1 == null) && (date2 == null)) return 0; + if (date1 == null) return 1; + if (date2 == null) return -1; + return date2.compareTo(date1); + } + }); SyndFeedOutput output = new SyndFeedOutput(); - output.output(syndFeed, getFile()); + try { + output.output(syndFeed, getFile()); + } catch (FeedException e) { + throw new IOException(e.getMessage()); + } } } |
From: <jbo...@li...> - 2005-11-03 21:37:38
|
Author: adamw Date: 2005-11-03 16:37:25 -0500 (Thu, 03 Nov 2005) New Revision: 1498 Added: trunk/forge/portal-extensions/shotoku/shotoku-base/src/etc/velocity.properties trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/velocity/ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/velocity/ShotokuResourceLoader.java Modified: trunk/forge/portal-extensions/shotoku/shotoku-base/project.xml trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/NodeList.java trunk/forge/portal-extensions/shotoku/shotoku-svn-service/maven.xml trunk/forge/portal-extensions/shotoku/shotoku-svn-service/project.xml trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnContentManager.java trunk/forge/portal-extensions/shotoku/shotoku-test/project.xml trunk/forge/portal-extensions/shotoku/shotoku-test/src/java/org/jboss/shotoku/test/servlet/ShotokuServlet.java Log: http://jira.jboss.com/jira/browse/JBSHOTOKU-15 : a velocit resource loader reading from shotoku, velocity engine access functions Modified: trunk/forge/portal-extensions/shotoku/shotoku-base/project.xml =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/project.xml 2005-11-03 20:53:19 UTC (rev 1497) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/project.xml 2005-11-03 21:37:25 UTC (rev 1498) @@ -17,6 +17,21 @@ <description></description> <dependencies> + <dependency> + <groupId>velocity</groupId> + <artifactId>velocity</artifactId> + <version>1.4</version> + </dependency> + <dependency> + <groupId>velocity</groupId> + <artifactId>velocity-dep</artifactId> + <version>1.4</version> + </dependency> + <dependency> + <groupId>velocity</groupId> + <artifactId>velocity</artifactId> + <version>1.4-dev</version> + </dependency> </dependencies> <build> Added: trunk/forge/portal-extensions/shotoku/shotoku-base/src/etc/velocity.properties =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/etc/velocity.properties 2005-11-03 20:53:19 UTC (rev 1497) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/etc/velocity.properties 2005-11-03 21:37:25 UTC (rev 1498) @@ -0,0 +1,5 @@ +resource.loader=shotoku +shotoku.resource.loader.description=Shotoku Resource Loader +shotoku.resource.loader.class=org.jboss.shotoku.velocity.ShotokuResourceLoader +shotoku.resource.loader.cache=true +shotoku.resource.loader.modificationCheckInterval=2 Modified: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java 2005-11-03 20:53:19 UTC (rev 1497) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java 2005-11-03 21:37:25 UTC (rev 1498) @@ -24,8 +24,10 @@ import java.lang.reflect.Constructor; import java.util.HashMap; import java.util.Map; +import java.util.Properties; import org.apache.log4j.Logger; +import org.apache.velocity.app.VelocityEngine; import org.apache.xerces.parsers.DOMParser; import org.jboss.shotoku.exceptions.ResourceDoesNotExist; import org.jboss.shotoku.exceptions.RepositoryException; @@ -39,6 +41,15 @@ */ public abstract class ContentManager { /** + * <code>prefix</code> - prefix of this content manager. + */ + protected String prefix; + /** + * <code>id</code> - id of a corresponding repository. + */ + protected String id; + + /** * Gets a root directory that is represented by this content manager. * * @return A directory that is the root directory of this content manager. @@ -80,10 +91,73 @@ */ public abstract NodeList search(SearchParameters parameters) throws RepositoryException; + + /** + * Gets a velocity engine, initialized with default properties, as defined + * in velocity.properties in shotoku-base jar. Additionaly, the shotoku + * resource loader will be set to read templates from this content manager + * (if shotoku resource loader is defined to be used). + * + * @return A velocity engine initialized with default properties. + * @throws Exception + * In case of a velocity exception/ properties reading + * exception. + */ + public VelocityEngine getVelocityEngine() throws Exception { + return getVelocityEngine(true); + } - protected ContentManager(String id, String prefix) { + /** + * Gets a velocity engine, initialized with default properties, as defined + * in velocity.properties in shotoku-base jar. + * + * @param addIdPrefix + * true iff id/ prefix properties should be added to the + * properties. + * @return A velocity engine initialized with default properties. + * @throws Exception + * In case of a velocity exception/ properties reading + * exception. + */ + public VelocityEngine getVelocityEngine(boolean addIdPrefix) + throws Exception { + return getVelocityEngine(new HashMap<Object, Object>(), addIdPrefix); + } + /** + * Gets a velocity engine, initialized with default properties, possibly + * overwritten by the given propeties. + * + * @param overProps + * Properties which will be added to velocity configuration. + * @return An initialized velocity engine. + * @throws Exception + * In case of a velocity exception/ properties reading + * exception. + */ + public VelocityEngine getVelocityEngine( + Map<? extends Object, ? extends Object> overProps, + boolean addIdPrefix) throws Exception { + VelocityEngine ve = new VelocityEngine(); + Properties props = new Properties(); + props.load(ContentManager.class + .getResourceAsStream("/velocity.properties")); + props.putAll(overProps); + + if (addIdPrefix) { + props.put("shotoku.resource.loader." + "prefix", prefix); + props.put("shotoku.resource.loader." + "id", id); + } + + ve.init(props); + + return ve; } + + protected ContentManager(String id, String prefix) { + this.id = id; + this.prefix = prefix; + } /* * Content manager loading. @@ -183,6 +257,9 @@ * content manager with the given id registers. */ public static ContentManager getContentManager(String id, String prefix) { + if (id == null) id = defaultId; + if (prefix == null) prefix = ""; + Constructor constructor = contentManagers.get(id); if (constructor == null) Modified: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/NodeList.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/NodeList.java 2005-11-03 20:53:19 UTC (rev 1497) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/NodeList.java 2005-11-03 21:37:25 UTC (rev 1498) @@ -59,8 +59,4 @@ public List<Node> toList() { return nodeList; } - - /*public InputStream getFeed(String velocityTemplate) { - throw new RuntimeException("Operation not yet implemented"); - }*/ } Added: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/velocity/ShotokuResourceLoader.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/velocity/ShotokuResourceLoader.java 2005-11-03 20:53:19 UTC (rev 1497) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/velocity/ShotokuResourceLoader.java 2005-11-03 21:37:25 UTC (rev 1498) @@ -0,0 +1,48 @@ +package org.jboss.shotoku.velocity; + +import java.io.InputStream; + +import org.apache.commons.collections.ExtendedProperties; +import org.apache.velocity.exception.ResourceNotFoundException; +import org.apache.velocity.runtime.resource.Resource; +import org.apache.velocity.runtime.resource.loader.ResourceLoader; +import org.jboss.shotoku.ContentManager; + +public class ShotokuResourceLoader extends ResourceLoader { + private ContentManager cm; + + private boolean isStringEmpty(String s) { + return (s == null) || ("".equals(s)); + } + + @Override + public void init(ExtendedProperties properties) { + String prefix = properties.getString("prefix"); + String id = properties.getString("id"); + + if ((isStringEmpty(prefix)) && (isStringEmpty(id))) { + cm = ContentManager.getContentManager(); + } else if (isStringEmpty(id)) { + cm = ContentManager.getContentManager(prefix); + } else { + cm = ContentManager.getContentManager(id, prefix); + } + } + + @Override + public InputStream getResourceStream(String resource) throws ResourceNotFoundException { + return cm.getNode(resource).getContentInputStream(); + } + + @Override + public boolean isSourceModified(Resource resource) { + return resource.getLastModified() != cm.getNode(resource.getName()).getLastModfication(); + } + + @Override + public long getLastModified(Resource resource) { + return cm.getNode(resource.getName()).getLastModfication(); + } + +} + Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnContentManager.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnContentManager.java 2005-11-03 20:53:19 UTC (rev 1497) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnContentManager.java 2005-11-03 21:37:25 UTC (rev 1498) @@ -37,23 +37,12 @@ */ public class SvnContentManager extends ContentManager { /** - * <code>prefix</code> - prefix of this content manager. - */ - private String prefix; - /** - * <code>id</code> - id of a corresponding repository. - */ - private String id; - /** * <code>service</code> - service interface binding. */ private SvnService service; public SvnContentManager(String id, String prefix) { super(id, prefix); - - this.prefix = prefix; - this.id = id; service = Tools.getService(); } Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn-service/maven.xml =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn-service/maven.xml 2005-11-03 20:53:19 UTC (rev 1497) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/maven.xml 2005-11-03 21:37:25 UTC (rev 1498) @@ -29,6 +29,12 @@ <ant:filename name="*.jar" /> </ant:fileset> </ant:copy> + <ant:copy + todir="target/${shotoku.ear.dir}" overwrite="true"> + <ant:fileset dir="${maven.repo.local}/velocity/jars"> + <ant:filename name="velocity*-1.4*.jar" /> + </ant:fileset> + </ant:copy> <ant:copy todir="target/${shotoku.ear.dir}"> <ant:fileset dir="src/app" flatten="true" overwrite="true"> <ant:filename name="**" /> Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn-service/project.xml =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn-service/project.xml 2005-11-03 20:53:19 UTC (rev 1497) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/project.xml 2005-11-03 21:37:25 UTC (rev 1498) @@ -55,6 +55,32 @@ </properties> </dependency> + <dependency> + <groupId>velocity</groupId> + <artifactId>velocity</artifactId> + <version>1.4</version> + <properties> + <ejb.manifest.classpath>true</ejb.manifest.classpath> + </properties> + </dependency> + <dependency> + <groupId>velocity</groupId> + <artifactId>velocity-dep</artifactId> + <version>1.4</version> + <properties> + <ejb.manifest.classpath>true</ejb.manifest.classpath> + </properties> + </dependency> + <dependency> + <groupId>velocity</groupId> + <artifactId>velocity</artifactId> + <version>1.4-dev</version> + <properties> + <ejb.manifest.classpath>true</ejb.manifest.classpath> + </properties> + </dependency> + + <dependency> <groupId>jboss</groupId> <artifactId>jboss-ejb3</artifactId> Modified: trunk/forge/portal-extensions/shotoku/shotoku-test/project.xml =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-test/project.xml 2005-11-03 20:53:19 UTC (rev 1497) +++ trunk/forge/portal-extensions/shotoku/shotoku-test/project.xml 2005-11-03 21:37:25 UTC (rev 1498) @@ -41,7 +41,13 @@ <version>1.0</version> <jar>javax.servlet.jar</jar> </dependency> - + + <dependency> + <groupId>velocity</groupId> + <artifactId>velocity</artifactId> + <version>1.4</version> + </dependency> + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> Modified: trunk/forge/portal-extensions/shotoku/shotoku-test/src/java/org/jboss/shotoku/test/servlet/ShotokuServlet.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-test/src/java/org/jboss/shotoku/test/servlet/ShotokuServlet.java 2005-11-03 20:53:19 UTC (rev 1497) +++ trunk/forge/portal-extensions/shotoku/shotoku-test/src/java/org/jboss/shotoku/test/servlet/ShotokuServlet.java 2005-11-03 21:37:25 UTC (rev 1498) @@ -9,20 +9,12 @@ import javax.servlet.http.HttpServletResponse; import org.jboss.shotoku.ContentManager; -import org.jboss.shotoku.Node; import org.jboss.shotoku.aop.Inject; -import org.jboss.shotoku.aop.NodeInject; public class ShotokuServlet extends HttpServlet { @Inject(prefix="shotoku-test") ContentManager test; - - @NodeInject("shotoku-test/test") - Node injectedNode; - - @NodeInject("shotoku-test/test") - String injectedString; - + @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { @@ -30,15 +22,12 @@ PrintWriter pw = response.getWriter(); pw.write("Depends test: " + test + "<br />"); pw.write("<br />"); + + pw.write("Velocity test:"); + pw.write("<br />"); - Node newNode = test.getRootDirectory().newNode("test"); - - newNode.setContent("zzz"); - newNode.save("Z"); - - pw.write("Content 1:" + newNode.getContent() + "<br />"); - pw.write("Content 2:" + injectedNode.getContent() + "<br />"); - pw.write("Content 3:" + injectedString + "<br />"); + //NodeList nl = new NodeList(); + //pw.write(nl.getFeed("default/feeds/templates/hello-world.vm", null, new HashMap<String, Object>()).toString()); } } |
From: <jbo...@li...> - 2005-11-03 20:53:29
|
Author: dam...@jb... Date: 2005-11-03 15:53:19 -0500 (Thu, 03 Nov 2005) New Revision: 1497 Modified: qa/forge/portal-extensions/forge-kosmos/to-copy/kosmos-portlet.war qa/forge/portal-extensions/forge-kosmos/to-copy/kosmos-server.war Log: MERGED: 1491:1496 https://svn.labs.jboss.com/trunk/forge into qa forge. Downgraded kosmos as it sux in 4.0.3. Modified: qa/forge/portal-extensions/forge-kosmos/to-copy/kosmos-portlet.war =================================================================== (Binary files differ) Modified: qa/forge/portal-extensions/forge-kosmos/to-copy/kosmos-server.war =================================================================== (Binary files differ) |
From: <jbo...@li...> - 2005-11-03 20:32:49
|
Author: adamw Date: 2005-11-03 15:30:00 -0500 (Thu, 03 Nov 2005) New Revision: 1496 Modified: trunk/forge/portal-extensions/forge-kosmos/to-copy/kosmos-portlet.war trunk/forge/portal-extensions/forge-kosmos/to-copy/kosmos-server.war Log: Downgrading kosmos Modified: trunk/forge/portal-extensions/forge-kosmos/to-copy/kosmos-portlet.war =================================================================== (Binary files differ) Modified: trunk/forge/portal-extensions/forge-kosmos/to-copy/kosmos-server.war =================================================================== (Binary files differ) |
From: <jbo...@li...> - 2005-11-03 20:01:58
|
Author: aron.gombas Date: 2005-11-03 15:01:50 -0500 (Thu, 03 Nov 2005) New Revision: 1495 Added: trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/taglib/ trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/taglib/AgeTag.java Log: Shit, this was missing! Added: trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/taglib/AgeTag.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/taglib/AgeTag.java 2005-11-03 19:43:12 UTC (rev 1494) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/taglib/AgeTag.java 2005-11-03 20:01:50 UTC (rev 1495) @@ -0,0 +1,88 @@ +/* + * Kosmos. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package hu.midori.kosmos.portlet.taglib; + +import java.io.IOException; +import java.text.NumberFormat; +import java.util.Locale; +import java.util.ResourceBundle; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.jstl.core.Config; +import javax.servlet.jsp.tagext.TagSupport; + +/** + * Displays localized "age" information: time difference between + * "now" and the given "birth" value, in the most appropriate unit of + * minutes, hours, days, weeks and such. + * It uses the <code>Locale</code> set for JSTL, so doesn't require + * additional configuration. + * + * @author <a href="mailto:aro...@mi...">Aron Gombas</a> + * @version $Id$ + */ +public class AgeTag extends TagSupport { + /** @see #setTime(String) */ + private String time; + /** Localized string resources. */ + private static ResourceBundle res; + + /** Sets the millisecond of the "birth" value used for computing the age. */ + public void setTime(String time) { + this.time = time; + } + + @Override + public int doStartTag() throws JspException { + res = ResourceBundle.getBundle("kosmos-taglib", new Locale((String)Config.find(pageContext, Config.FMT_LOCALE))); + + long milliseconds = Long.parseLong(time); + long value = 0; + String unit = null; + + long minutes = milliseconds / (60*1000); + if(minutes < 2*60) { + value = minutes; + unit = res.getString("age.minutes"); + } else { + long hours = minutes / 60; + if(hours < 48) { + value = hours; + unit = res.getString("age.hours"); + } else { + long days = hours / 24; + if(days < 3*7) { + value = days; + unit = res.getString("age.days"); + } else { + long weeks = days / 7; + if(weeks < 10) { + value = weeks; + unit = res.getString("age.weeks"); + } else { + long months = days / 30; + if(months < 24) { + value = months; + unit = res.getString("age.months"); + } else { + value = months / 12; + unit = res.getString("age.years"); + } + } + } + } + } + + try { + pageContext.getOut().print(String.format("%s %s", NumberFormat.getIntegerInstance().format(value), unit)); + } catch(IOException ex) { + throw new JspException(ex); + } + + return SKIP_BODY; + } +} |
From: <jbo...@li...> - 2005-11-03 19:43:24
|
Author: aron.gombas Date: 2005-11-03 14:43:12 -0500 (Thu, 03 Nov 2005) New Revision: 1494 Modified: trunk/labs/kosmos/web-portlet/WEB-INF/web.xml trunk/labs/kosmos/web-server/WEB-INF/web.xml Log: Desciptions added to web.xml Modified: trunk/labs/kosmos/web-portlet/WEB-INF/web.xml =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/web.xml 2005-11-03 19:30:57 UTC (rev 1493) +++ trunk/labs/kosmos/web-portlet/WEB-INF/web.xml 2005-11-03 19:43:12 UTC (rev 1494) @@ -5,6 +5,9 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd" version="2.4"> + <display-name>Kosmos Portlets</display-name> + <description>Kosmos is a portlet-based web application. It can run only inside a portlet container.</description> + <!-- JSTL configuration --> <context-param> <param-name>javax.servlet.jsp.jstl.fmt.locale</param-name> Modified: trunk/labs/kosmos/web-server/WEB-INF/web.xml =================================================================== --- trunk/labs/kosmos/web-server/WEB-INF/web.xml 2005-11-03 19:30:57 UTC (rev 1493) +++ trunk/labs/kosmos/web-server/WEB-INF/web.xml 2005-11-03 19:43:12 UTC (rev 1494) @@ -7,7 +7,7 @@ <!-- $Id$ --> <web-app> <display-name>Kosmos Services Servlet</display-name> - <description>Server component of Kosmos.</description> + <description>Server component of Kosmos. Runs as a regular web application.</description> <!-- Both HTTP and HTTPS protocol can be used here. --> <context-param> |
From: <jbo...@li...> - 2005-11-03 19:34:05
|
Author: adamw Date: 2005-11-03 14:30:57 -0500 (Thu, 03 Nov 2005) New Revision: 1493 Modified: trunk/forge/portal-extensions/forge-kosmos/to-copy/kosmos-portlet.war trunk/forge/portal-extensions/forge-kosmos/to-copy/kosmos-server.war Log: New kosmos Modified: trunk/forge/portal-extensions/forge-kosmos/to-copy/kosmos-portlet.war =================================================================== (Binary files differ) Modified: trunk/forge/portal-extensions/forge-kosmos/to-copy/kosmos-server.war =================================================================== (Binary files differ) |
From: <jbo...@li...> - 2005-11-03 15:54:49
|
Author: rem...@jb... Date: 2005-11-03 10:54:43 -0500 (Thu, 03 Nov 2005) New Revision: 1491 Modified: trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteValve.java Log: - Fix control flow flag (they modify the index, so should be done last). - RewriteMap instances may implement Lifecycle to get start/stop calls. Modified: trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteValve.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteValve.java 2005-11-03 09:30:47 UTC (rev 1490) +++ trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteValve.java 2005-11-03 15:54:43 UTC (rev 1491) @@ -25,6 +25,7 @@ import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Hashtable; +import java.util.Iterator; import java.util.Map; import java.util.StringTokenizer; @@ -178,7 +179,12 @@ } else if (result instanceof RewriteCond) { conditions.add(result); } else if (result instanceof Object[]) { - maps.put(((Object[]) result)[0], ((Object[]) result)[1]); + String mapName = (String) ((Object[]) result)[0]; + RewriteMap map = (RewriteMap) ((Object[]) result)[1]; + maps.put(mapName, map); + if (map instanceof Lifecycle) { + ((Lifecycle) map).start(); + } } } catch (IOException e) { container.getLogger().error("Error reading configuration", e); @@ -207,6 +213,14 @@ } public void stop() throws LifecycleException { + Iterator values = maps.values().iterator(); + while (values.hasNext()) { + RewriteMap map = (RewriteMap) values.next(); + if (map instanceof Lifecycle) { + ((Lifecycle) map).stop(); + } + } + maps.clear(); rules = null; } @@ -255,31 +269,8 @@ rewritten = true; } - // Control flow processing - - // - chain (skip remaining chained rules if this one does not match) - if (rules[i].isChain() && newtest == null) { - for (int j = i; j < rules.length; j++) { - if (!rules[j].isChain()) { - i = j; - break; - } - } - } - // - last (stop rewriting here) - if (rules[i].isLast() && newtest != null) { - break; - } - // - next (redo again) - if (rules[i].isNext() && newtest != null) { - i = 0; - } - // - skip (n rules) - if (newtest != null) { - i += rules[i].getSkip(); - } - - // Final reply: + // Final reply + // - forbidden if (rules[i].isForbidden() && newtest != null) { response.sendError(HttpServletResponse.SC_FORBIDDEN); @@ -300,7 +291,8 @@ break; } - // Reply modification: + // Reply modification + // - cookie if (rules[i].isCookie() && newtest != null) { response.addCookie(new Cookie(rules[i].getCookieName(), @@ -321,6 +313,32 @@ // apparently needed, which feels weird (in Servlet API land, the query // string is separate) + // Control flow processing + + // - chain (skip remaining chained rules if this one does not match) + if (rules[i].isChain() && newtest == null) { + for (int j = i; j < rules.length; j++) { + if (!rules[j].isChain()) { + i = j; + break; + } + } + continue; + } + // - last (stop rewriting here) + if (rules[i].isLast() && newtest != null) { + break; + } + // - next (redo again) + if (rules[i].isNext() && newtest != null) { + i = 0; + continue; + } + // - skip (n rules) + if (newtest != null) { + i += rules[i].getSkip(); + } + } if (rewritten) { |
From: <jbo...@li...> - 2005-11-03 09:30:58
|
Author: aron.gombas Date: 2005-11-03 04:30:47 -0500 (Thu, 03 Nov 2005) New Revision: 1490 Modified: trunk/labs/kosmos/build/build.xml trunk/labs/kosmos/src/test/hu/midori/kosmos/server/jira/JiraServiceTest.java trunk/labs/kosmos/src/test/hu/midori/kosmos/server/svn/SvnServiceTest.java Log: Unit test hacking Modified: trunk/labs/kosmos/build/build.xml =================================================================== --- trunk/labs/kosmos/build/build.xml 2005-11-03 09:30:13 UTC (rev 1489) +++ trunk/labs/kosmos/build/build.xml 2005-11-03 09:30:47 UTC (rev 1490) @@ -31,6 +31,19 @@ <property name="dist-bin.bin.dir" location="${dist-bin.dir}/${war.name}-expanded"/> <property name="dist-bin.classes.dir" location="${dist-bin.bin.dir}/WEB-INF/classes"/> + <property name="test-out.dir" location="testout"/> + + <path id="full.classpath"> + <fileset dir="${web.dir}/WEB-INF/lib" includes="**/*.jar"/> + </path> + + <!-- additional tasks --> +<!-- TODO what to do with this? now it doesn't run in Eclipse?! + <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"> + <classpath refid="full.classpath"/> + </taskdef> +--> + <!-- targets --> <target name="init"> <echo message="============================================================"/> @@ -40,15 +53,13 @@ <tstamp> <format pattern="dd/MMM/yy HH:mm:ss" property="build.date"/> </tstamp> - <path id="full.classpath"> - <fileset dir="${web.dir}/WEB-INF/lib" includes="**/*.jar"/> - </path> </target> <target name="clean" depends="init" description="Cleans up temporary files created during previous builds"> <delete dir="${dist.root.dir}"/> <delete dir="${dist-bin.root.dir}"/> <delete dir="${dist-src.root.dir}"/> + <delete dir="${test-out.dir}"/> </target> <target name="compile" depends="init" description="Compiles Java source files"> @@ -100,6 +111,24 @@ <target name="redeploy" depends="undeploy,deploy" description="Redeploys the module to the container"/> + <target name="junit" depends="init,clean,all" description="Runs the unit test suite"> + <mkdir dir="${test-out.dir}"/> + <junit printsummary="yes" haltonerror="yes" fork="yes"> + <classpath> + <path refid="full.classpath"/> + <path location="${dist-bin.classes.dir}"/> + </classpath> + <formatter type="plain"/> + <batchtest todir="${test-out.dir}"> + <fileset dir="${dist-bin.classes.dir}"> + <include name="**/*Test.class"/> + <exclude name="**/Abstract*Test.class"/> + <exclude name="**/CcTest.class"/> + </fileset> + </batchtest> + </junit> + </target> + <target name="dist-bin" depends="init,all" description="Prepares all binary distributables"> <!-- pack to WAR --> <war destfile="${dist-bin.dir}/${war.name}" basedir="${dist-bin.bin.dir}" webxml="web-${module.name}/WEB-INF/web.xml"/> Modified: trunk/labs/kosmos/src/test/hu/midori/kosmos/server/jira/JiraServiceTest.java =================================================================== --- trunk/labs/kosmos/src/test/hu/midori/kosmos/server/jira/JiraServiceTest.java 2005-11-03 09:30:13 UTC (rev 1489) +++ trunk/labs/kosmos/src/test/hu/midori/kosmos/server/jira/JiraServiceTest.java 2005-11-03 09:30:47 UTC (rev 1490) @@ -35,7 +35,7 @@ assertEquals(0, service.getProjects("http://svn.jboss.com/jbossas").size());// TODO specify secured here // test secured with signing in - testDatabase("http://myusername@mypassword:xxx.yyy.zzz/myproject");// TODO + testDatabase("http://myusername:mypassword@xxx.yyy.zzz/myproject");// TODO } public void testApacheInstance() { @@ -55,7 +55,6 @@ } public void testCodeHausInstance() { - testDatabase("http://jira.codehaus.org/browse/ACL"); testDatabase("http://jira.codehaus.org/browse/ACTIVEIO"); testDatabase("http://jira.codehaus.org/browse/AWS"); testDatabase("http://jira.codehaus.org/browse/ASP"); Modified: trunk/labs/kosmos/src/test/hu/midori/kosmos/server/svn/SvnServiceTest.java =================================================================== --- trunk/labs/kosmos/src/test/hu/midori/kosmos/server/svn/SvnServiceTest.java 2005-11-03 09:30:13 UTC (rev 1489) +++ trunk/labs/kosmos/src/test/hu/midori/kosmos/server/svn/SvnServiceTest.java 2005-11-03 09:30:47 UTC (rev 1490) @@ -31,10 +31,10 @@ /** Tests accessing secured repositories. */ public void testAuthentication() { // test secured without signing in - assertEquals(0, service.getRepositories("http://svn.jboss.com/jbossas").size());// TODO specify secured here + assertEquals(0, service.getRepositories("https://svn.labs.jboss.com/trunk/labs/kosmos").size());// TODO specify secured here // test secured with signing in - testRepository("http://myusername@mypassword:xxx.yyy.zzz/myproject");// TODO + testRepository("https://myusername:myp...@sv.../trunk/labs/kosmos");// TODO } public void testApacheRepositories() { |
From: <jbo...@li...> - 2005-11-03 09:30:19
|
Author: aron.gombas Date: 2005-11-03 04:30:13 -0500 (Thu, 03 Nov 2005) New Revision: 1489 Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ScrapingUtils.java Log: UserInfo support for URLs Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ScrapingUtils.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ScrapingUtils.java 2005-11-03 09:28:56 UTC (rev 1488) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ScrapingUtils.java 2005-11-03 09:30:13 UTC (rev 1489) @@ -21,6 +21,7 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.tmatesoft.svn.core.wc.SVNWCUtil; import org.w3c.dom.Document; import org.w3c.tidy.Tidy; @@ -96,6 +97,23 @@ return StringUtils.remove(StringUtils.remove(originalUrl.toString(), originalUrl.getUserInfo()), '@'); } + /** Returns a two-element array with the username and password from the given URL, or <code>null</code> if those are not specified in the URL. */ + public static String[] parseUserInfo(String url) throws MalformedURLException { + String userInfo = new URL(url).getUserInfo(); + if(StringUtils.isBlank(userInfo)) + return null; + + String strings[] = StringUtils.split(userInfo, ':'); + if(strings.length != 2) + throw new IllegalArgumentException(String.format("Invalid user info \"%s\"", userInfo)); + String userName = strings[0]; + String password = strings[1]; + if(StringUtils.isBlank(userName) || StringUtils.isBlank(password)) + throw new IllegalArgumentException(String.format("Invalid username (\"%s\") or password (\"%s\")", userName, password)); + + return strings; + } + /** * Eliminates the empty items from a scraped value string to make * the tokenizer happy. E.g. <code>||xxx|</code> will be transformed to <code> | |xxx| </code>. |
From: <jbo...@li...> - 2005-11-03 09:29:21
|
Author: aron.gombas Date: 2005-11-03 04:28:56 -0500 (Thu, 03 Nov 2005) New Revision: 1488 Modified: trunk/labs/kosmos/web-server/WEB-INF/lib/javasvn.jar Log: Javasvn upgraded to 1.0.0 Modified: trunk/labs/kosmos/web-server/WEB-INF/lib/javasvn.jar =================================================================== (Binary files differ) |
From: <jbo...@li...> - 2005-11-03 09:28:37
|
Author: aron.gombas Date: 2005-11-03 04:28:19 -0500 (Thu, 03 Nov 2005) New Revision: 1487 Added: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcConstants.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraConstants.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/sf/SfConstants.java Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraServiceImpl.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/sf/SfServiceImpl.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java Log: Constants refactored to separate classes Added: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcConstants.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcConstants.java 2005-11-02 14:27:40 UTC (rev 1486) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcConstants.java 2005-11-03 09:28:19 UTC (rev 1487) @@ -0,0 +1,26 @@ +/* + * Kosmos. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package hu.midori.kosmos.server.cc; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; + +/** + * <i>CruiseControl</i>-related constants. + * + * @author <a href="mailto:aro...@mi...">Aron Gombas</a> + * @version $Id$ + */ +public class CcConstants { + /** Dateformat used with the builds. */ + public final static DateFormat CC_BUILD_DATEFORMAT = new SimpleDateFormat("yyyyMMddhhmmss"); + + /** Color code for the test categories. */ + public final static int SUCCESS_COLOR = 0x00FF00; + public final static int FAILURE_COLOR = 0xFF0000; + public final static int ERROR_COLOR = 0xDD0000; +} Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java 2005-11-02 14:27:40 UTC (rev 1486) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java 2005-11-03 09:28:19 UTC (rev 1487) @@ -20,8 +20,6 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FilenameFilter; -import java.text.DateFormat; -import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; @@ -45,13 +43,6 @@ public class CcServiceImpl extends AbstractKosmosService implements CcService { private final static Log log = LogFactory.getLog(CcServiceImpl.class); - /** Dateformat used with the builds. */ - private final static DateFormat CC_BUILD_DATEFORMAT = new SimpleDateFormat("yyyyMMddhhmmss"); - /** Color code for the test categories. */ - private final static int SUCCESS_COLOR = 0x00FF00; - private final static int FAILURE_COLOR = 0xFF0000; - private final static int ERROR_COLOR = 0xDD0000; - /** Service-specific handler. */ private CcDataHandler handler = new CcDataHandler(); @@ -101,7 +92,7 @@ String name = ScrapingUtils.runXQueryString(dom, "<dummy> { data(//property[@name='projectname']/@value) } </dummy>"); String buildLabel = ScrapingUtils.runXQueryString(dom, "<dummy> { data(//property[@name='label']/@value) } </dummy>"); int status = (ScrapingUtils.runXQueryString(dom, "<dummy> { data(//build/@error) } </dummy>").length() == 0) ? CcBuildStatus.SUCCEEDED : CcBuildStatus.FAILED; - Date timestamp = CC_BUILD_DATEFORMAT.parse(ScrapingUtils.runXQueryString(dom, "<dummy> { data(//property[@name='lastbuild']/@value) } </dummy>")); + Date timestamp = CcConstants.CC_BUILD_DATEFORMAT.parse(ScrapingUtils.runXQueryString(dom, "<dummy> { data(//property[@name='lastbuild']/@value) } </dummy>")); int modifications = ScrapingUtils.runXQueryInt(dom, "<dummy> { data(count(//modification)) } </dummy>"); String buildTime = ScrapingUtils.runXQueryString(dom, "<dummy> { data(//build/@time) } </dummy>");// TODO if we keep it as String, that cannot be localized -> should be intelligently parsed (using a Duration class maybe?) and stored as Object int tests = ScrapingUtils.runXQueryInt(dom, "<dummy> { data(count(//testcase)) } </dummy>"); @@ -142,11 +133,11 @@ List<Map.Entry<Integer, Integer>> testsPerCategory = new ArrayList<Map.Entry<Integer, Integer>>(); int success = tests - errors - failures; if(success > 0) - testsPerCategory.addAll(Collections.singletonMap(SUCCESS_COLOR, success).entrySet()); + testsPerCategory.addAll(Collections.singletonMap(CcConstants.SUCCESS_COLOR, success).entrySet()); if(failures > 0) - testsPerCategory.addAll(Collections.singletonMap(FAILURE_COLOR, failures).entrySet()); + testsPerCategory.addAll(Collections.singletonMap(CcConstants.FAILURE_COLOR, failures).entrySet()); if(errors > 0) - testsPerCategory.addAll(Collections.singletonMap(ERROR_COLOR, errors).entrySet()); + testsPerCategory.addAll(Collections.singletonMap(CcConstants.ERROR_COLOR, errors).entrySet()); ByteArrayOutputStream out = new ByteArrayOutputStream(); ChartUtils.writeChartAsPng(ChartUtils.generateColorCodedPieChart(ChartUtils.collectionToPieDataset(testsPerCategory)), out); Added: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraConstants.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraConstants.java 2005-11-02 14:27:40 UTC (rev 1486) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraConstants.java 2005-11-03 09:28:19 UTC (rev 1487) @@ -0,0 +1,30 @@ +/* + * Kosmos. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package hu.midori.kosmos.server.jira; + +/** + * <i>JIRA</i>-related constants. + * + * @author <a href="mailto:aro...@mi...">Aron Gombas</a> + * @version $Id$ + */ +public class JiraConstants { + /** Color codes for the issue statuses. */ + public final static int OPEN_COLOR = 0xFF0000; + public final static int CODING_IN_PROGRESS_COLOR = 0xFFFF00; + public final static int REOPENED_COLOR = 0xDD0000; + public final static int RESOLVED_COLOR = 0x00FF00; + public final static int CLOSED_COLOR = 0xDDDDDD; + + /** Color codes for issue priorities. */ + public final static int BLOCKER_COLOR = 0xFF0000; + public final static int CRITICAL_COLOR = 0xEE0000; + public final static int MAJOR_COLOR = 0xDD0000; + public final static int MINOR_COLOR = 0xFFFF00; + public final static int TRIVIAL_COLOR = 0xEEEE00; + public final static int OPTIONAL_COLOR = 0xDDDDDD; +} Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraServiceImpl.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraServiceImpl.java 2005-11-02 14:27:40 UTC (rev 1486) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraServiceImpl.java 2005-11-03 09:28:19 UTC (rev 1487) @@ -15,6 +15,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; +import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Collections; @@ -39,21 +40,6 @@ public class JiraServiceImpl extends AbstractKosmosService implements JiraService { private final static Log log = LogFactory.getLog(JiraServiceImpl.class); - /** Color codes for the issue statuses. */ - private final static int OPEN_COLOR = 0xFF0000; - private final static int CODING_IN_PROGRESS_COLOR = 0xFFFF00; - private final static int REOPENED_COLOR = 0xDD0000; - private final static int RESOLVED_COLOR = 0x00FF00; - private final static int CLOSED_COLOR = 0xDDDDDD; - - /** Color codes for issue priorities. */ - private final static int BLOCKER_COLOR = 0xFF0000; - private final static int CRITICAL_COLOR = 0xEE0000; - private final static int MAJOR_COLOR = 0xDD0000; - private final static int MINOR_COLOR = 0xFFFF00; - private final static int TRIVIAL_COLOR = 0xEEEE00; - private final static int OPTIONAL_COLOR = 0xDDDDDD; - /** Service-specific handler. */ private JiraDataHandler handler = new JiraDataHandler(); @@ -72,6 +58,7 @@ * </ul> */ private class JiraDataHandler implements CachedDataHandler { + /** There is no quick way to decide if the data is stale. */ public boolean isDataUptodate(Object key) { return false; } @@ -80,10 +67,15 @@ String url = key.toString(); List<JiraProject> projects = new ArrayList<JiraProject>(); - try { - Document dom = ScrapingUtils.downloadHtmlDom(new URL(url)); - + try { + // download database info + connect(url); + Document dom = ScrapingUtils.downloadHtmlDom(new URL(ScrapingUtils.removeUserInfoFromUrl(url))); + disconnect(url); + // TODO review these queries + // TODO restructure all the services code + // run XQueries String queryProject = "for " + @@ -207,6 +199,8 @@ } // scrape issue assignees + String prefix = ScrapingUtils.removeUserInfoFromUrl(url); + Map<String, Integer> openIssuesPerAssigneeMap = new HashMap<String, Integer>(); for(Iterator itIssueAssignee = resultIssueAssignee.iterator(); itIssueAssignee.hasNext();) { String valueIssueAssignee = ((NodeInfo)itIssueAssignee.next()).getStringValue(); @@ -220,47 +214,47 @@ List<Map.Entry<String, Integer>> openIssuesPerAssignee = (List<Map.Entry<String, Integer>>)ChartUtils.intValuedMapToSortedList(openIssuesPerAssigneeMap); ByteArrayOutputStream out = new ByteArrayOutputStream(); - ChartUtils.writeChartAsPng(ChartUtils.generatePieChart(ChartUtils.collectionToPieDataset(openIssuesPerAssignee, ChartUtils.MAX_ITEMS)), out);// TODO fix all generics warnings - String openIssuesPerAssigneeChartUrl = saveCachedFile(url + "_open_issues_per_assignee.png", new ByteArrayInputStream(out.toByteArray())); + ChartUtils.writeChartAsPng(ChartUtils.generatePieChart(ChartUtils.collectionToPieDataset(openIssuesPerAssignee, ChartUtils.MAX_ITEMS)), out); + String openIssuesPerAssigneeChartUrl = saveCachedFile(prefix + "_open_issues_per_assignee.png", new ByteArrayInputStream(out.toByteArray())); // generate issues-per-status chart List<Map.Entry<Integer, Integer>> issuesPerStatusMap = new ArrayList<Map.Entry<Integer, Integer>>(); if(openIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(OPEN_COLOR, openIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(JiraConstants.OPEN_COLOR, openIssues).entrySet()); if(codingInProgressIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(CODING_IN_PROGRESS_COLOR, codingInProgressIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(JiraConstants.CODING_IN_PROGRESS_COLOR, codingInProgressIssues).entrySet()); if(reopenedIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(REOPENED_COLOR, reopenedIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(JiraConstants.REOPENED_COLOR, reopenedIssues).entrySet()); if(resolvedIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(RESOLVED_COLOR, resolvedIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(JiraConstants.RESOLVED_COLOR, resolvedIssues).entrySet()); if(closedIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(CLOSED_COLOR, closedIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(JiraConstants.CLOSED_COLOR, closedIssues).entrySet()); out.reset(); ChartUtils.writeChartAsPng(ChartUtils.generateColorCodedPieChart(ChartUtils.collectionToPieDataset(issuesPerStatusMap)), out); - String issuesPerStatusChartUrl = saveCachedFile(url + "_issues_per_status.png", new ByteArrayInputStream(out.toByteArray())); + String issuesPerStatusChartUrl = saveCachedFile(prefix + "_issues_per_status.png", new ByteArrayInputStream(out.toByteArray())); // generate issues-per-priority chart List<Map.Entry<Integer, Integer>> openIssuesPerPriorityMap = new ArrayList<Map.Entry<Integer, Integer>>(); if(blockerOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(BLOCKER_COLOR, blockerOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(JiraConstants.BLOCKER_COLOR, blockerOpenIssues).entrySet()); if(criticalOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(CRITICAL_COLOR, criticalOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(JiraConstants.CRITICAL_COLOR, criticalOpenIssues).entrySet()); if(majorOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(MAJOR_COLOR, majorOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(JiraConstants.MAJOR_COLOR, majorOpenIssues).entrySet()); if(minorOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(MINOR_COLOR, minorOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(JiraConstants.MINOR_COLOR, minorOpenIssues).entrySet()); if(trivialOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(TRIVIAL_COLOR, trivialOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(JiraConstants.TRIVIAL_COLOR, trivialOpenIssues).entrySet()); if(optionalOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(OPTIONAL_COLOR, optionalOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(JiraConstants.OPTIONAL_COLOR, optionalOpenIssues).entrySet()); out.reset(); ChartUtils.writeChartAsPng(ChartUtils.generateColorCodedPieChart(ChartUtils.collectionToPieDataset(openIssuesPerPriorityMap)), out); - String openIssuesPerPriorityChartUrl = saveCachedFile(url + "_open_issues_per_priority.png", new ByteArrayInputStream(out.toByteArray())); + String openIssuesPerPriorityChartUrl = saveCachedFile(prefix + "_open_issues_per_priority.png", new ByteArrayInputStream(out.toByteArray())); // save - JiraProject project = new JiraProject(name, url, projectKey, projectUrl, description, lead, + JiraProject project = new JiraProject(name, prefix, projectKey, projectUrl, description, lead, openIssues, codingInProgressIssues, reopenedIssues, resolvedIssues, closedIssues, blockerOpenIssues, criticalOpenIssues, majorOpenIssues, minorOpenIssues, trivialOpenIssues, optionalOpenIssues, (List<Map.Entry<String, Integer>>)openIssuesPerAssignee, @@ -274,5 +268,26 @@ return projects; } + + /** + * Connects to the given public or secure JIRA URL. + * @return the repository after a successful connection. + */ + protected void connect(String url) throws MalformedURLException { + // authenticate if project is secured + String userInfo[] = ScrapingUtils.parseUserInfo(url); + if(userInfo != null) { + String userName = userInfo[0]; + String password = userInfo[1]; + + log.debug(String.format("Signing in as \"%s\" \"%s\"...", userName, password)); + // TODO connect here + } + } + + /** Disconnects from the given URL. */ + protected void disconnect(String url) { + // do nothing + } } } Added: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/sf/SfConstants.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/sf/SfConstants.java 2005-11-02 14:27:40 UTC (rev 1486) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/sf/SfConstants.java 2005-11-03 09:28:19 UTC (rev 1487) @@ -0,0 +1,24 @@ +/* + * Kosmos. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package hu.midori.kosmos.server.sf; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; + +/** + * <i>SourceForge</i>-related constants. + * + * @author <a href="mailto:aro...@mi...">Aron Gombas</a> + * @version $Id$ + */ +public class SfConstants { + /** Base URL for SF, used to generate full URLs from the local ones. */ + public final static String SF_BASEURL = "http://www.sourceforge.net"; + + /** Dateformat used in the SF site. */ + public final static DateFormat SF_FILERELEASE_DATEFORMAT = new SimpleDateFormat("MMM d, yyyy"); +} Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/sf/SfServiceImpl.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/sf/SfServiceImpl.java 2005-11-02 14:27:40 UTC (rev 1486) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/sf/SfServiceImpl.java 2005-11-03 09:28:19 UTC (rev 1487) @@ -13,8 +13,6 @@ import hu.midori.kosmos.server.util.ScrapingUtils; import java.net.URL; -import java.text.DateFormat; -import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; @@ -36,11 +34,6 @@ public class SfServiceImpl extends AbstractKosmosService implements SfService { private final static Log log = LogFactory.getLog(SfServiceImpl.class); - /** Base URL for SF, used to generate full URLs from the local ones. */ - private final static String SF_BASEURL = "http://www.sourceforge.net"; - /** Dateformat used in the SF site. */ - private final static DateFormat SF_FILERELEASE_DATEFORMAT = new SimpleDateFormat("MMM d, yyyy"); - /** Service-specific handler. */ private SfDataHandler handler = new SfDataHandler(); @@ -90,10 +83,10 @@ StringTokenizer tokenizer = new StringTokenizer(value, "|"); String packageName = tokenizer.nextToken(); - String packageUrl = SF_BASEURL + tokenizer.nextToken(); + String packageUrl = SfConstants.SF_BASEURL + tokenizer.nextToken(); String version = tokenizer.nextToken(); - String versionUrl = SF_BASEURL + tokenizer.nextToken(); - Date date = SF_FILERELEASE_DATEFORMAT.parse(tokenizer.nextToken()); + String versionUrl = SfConstants.SF_BASEURL + tokenizer.nextToken(); + Date date = SfConstants.SF_FILERELEASE_DATEFORMAT.parse(tokenizer.nextToken()); SfRelease release = new SfRelease(packageName, packageUrl, version, versionUrl, date); log.debug(String.format("Adding %s...", release)); Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java 2005-11-02 14:27:40 UTC (rev 1486) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java 2005-11-03 09:28:19 UTC (rev 1487) @@ -18,6 +18,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.net.MalformedURLException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -29,7 +30,6 @@ import java.util.Set; import java.util.TreeMap; -import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jfree.data.time.TimeSeries; @@ -86,57 +86,30 @@ try { SVNRepository repo = connect(url); - return (repo.getLatestRevision() == previousLatestRevision); - } catch(SVNException ex) { + boolean isUptodate = (repo.getLatestRevision() == previousLatestRevision); + disconnect(repo); + + return isUptodate; + } catch(Exception ex) { log.error("Unable to get the latest revision", ex); return false; } } - - /** - * Connects to the given public or secure SVN URL. - * @return the repository after a successful connection. - */ - protected SVNRepository connect(String url) throws SVNException { - // connect to repository - SVNURL svnUrl = SVNURL.parseURIEncoded(url); - SVNRepository repo = SVNRepositoryFactory.create(svnUrl); - - // authenticate if repository is secured - String userInfo = svnUrl.getUserInfo(); - if(!StringUtils.isBlank(userInfo)) { - String strings[] = StringUtils.split(userInfo, ':'); - if(strings.length != 2) - throw new IllegalArgumentException(String.format("Invalid user info \"%s\"", userInfo)); - String userName = strings[0]; - String password = strings[1]; - if(StringUtils.isBlank(userName) || StringUtils.isBlank(password)) - throw new IllegalArgumentException(String.format("Invalid username (\"%s\") or password (\"%s\")", userName, password)); - log.debug(String.format("Signing in as \"%s\" \"%s\"...", userName, password)); - repo.setAuthenticationManager(SVNWCUtil.createDefaultAuthenticationManager(userName, password)); - } - - return repo; - } - public Object reloadData(Object key) { String url = key.toString(); List<SvnRepository> repositories = new ArrayList<SvnRepository>(); - // setup JavaSVN - DAVRepositoryFactory.setup(); - SVNRepositoryFactoryImpl.setup(); - try { - // connect + // get repository info SVNRepository repo = connect(url); - // get repository info - SvnRepositoryLogStats logStats = analyzeLog(repo); + SvnRepositoryLogStats logStats = analyzeLog(repo); SvnRepositoryContentStats contentStats = analyzeContent(repo); generateCharts(repo, logStats); + disconnect(repo); + // save previousLatestRevision = repo.getLatestRevision(); SvnRepository repository = new SvnRepository(ScrapingUtils.removeUserInfoFromUrl(repo.getLocation().toString()), repo.getLatestRevision(), @@ -154,7 +127,38 @@ return repositories; } + + /** + * Connects to the given public or secure SVN URL. + * @return the repository after a successful connection. + */ + protected SVNRepository connect(String url) throws MalformedURLException, SVNException { + // setup JavaSVN + DAVRepositoryFactory.setup(); + SVNRepositoryFactoryImpl.setup(); + + // connect to repository + SVNURL svnUrl = SVNURL.parseURIEncoded(url); + SVNRepository repo = SVNRepositoryFactory.create(svnUrl); + + // authenticate if repository is secured + String userInfo[] = ScrapingUtils.parseUserInfo(svnUrl.toString()); + if(userInfo != null) { + String userName = userInfo[0]; + String password = userInfo[1]; + log.debug(String.format("Signing in as \"%s\" \"%s\"...", userName, password)); + repo.setAuthenticationManager(SVNWCUtil.createDefaultAuthenticationManager(userName, password)); + } + + return repo; + } + + /** Disconnects from the given repository. */ + protected void disconnect(SVNRepository repo) { + // do nothing + } + /** Wraps the stats retrieved from the content of a SVN repository. */ private class SvnRepositoryLogStats {// TODO rewrite as bean public Date createdDate; @@ -353,24 +357,24 @@ /** Generates and saves the chart images on the server, and sets the URLs to the stats. */ protected void generateCharts(SVNRepository repository, SvnRepositoryLogStats stats) throws IOException { - String location = ScrapingUtils.removeUserInfoFromUrl(repository.getLocation().toString()); + String prefix = ScrapingUtils.removeUserInfoFromUrl(repository.getLocation().toString()); // generate charts ByteArrayOutputStream out = new ByteArrayOutputStream(); ChartUtils.writeChartAsPng(ChartUtils.generatePieChart(ChartUtils.collectionToPieDataset(stats.commitsPerAuthor, ChartUtils.MAX_ITEMS)), out); - stats.commitsPerAuthorChartUrl = saveCachedFile(location + "_commits_per_author.png", new ByteArrayInputStream(out.toByteArray())); + stats.commitsPerAuthorChartUrl = saveCachedFile(prefix + "_commits_per_author.png", new ByteArrayInputStream(out.toByteArray())); out.reset(); ChartUtils.writeChartAsPng(ChartUtils.generatePieChart(ChartUtils.collectionToPieDataset(stats.commitsPerFile, ChartUtils.MAX_ITEMS)), out); - stats.commitsPerFileChartUrl = saveCachedFile(location + "_commits_per_file.png", new ByteArrayInputStream(out.toByteArray())); + stats.commitsPerFileChartUrl = saveCachedFile(prefix + "_commits_per_file.png", new ByteArrayInputStream(out.toByteArray())); out.reset(); ChartUtils.writeChartAsPng(ChartUtils.generateTimeChart(stats.commitsPerWeek), out); - stats.commitsPerWeekChartUrl = saveCachedFile(location + "_commits_per_week.png", new ByteArrayInputStream(out.toByteArray())); + stats.commitsPerWeekChartUrl = saveCachedFile(prefix + "_commits_per_week.png", new ByteArrayInputStream(out.toByteArray())); out.reset(); ChartUtils.writeChartAsPng(ChartUtils.generateTimeChart(stats.repoEntriesPerWeek), out); - stats.repoEntriesPerWeekChartUrl = saveCachedFile(location + "_files_per_week.png", new ByteArrayInputStream(out.toByteArray())); + stats.repoEntriesPerWeekChartUrl = saveCachedFile(prefix + "_files_per_week.png", new ByteArrayInputStream(out.toByteArray())); } } } |
From: <jbo...@li...> - 2005-11-02 14:27:54
|
Author: rem...@jb... Date: 2005-11-02 09:27:40 -0500 (Wed, 02 Nov 2005) New Revision: 1486 Modified: trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/Resolver.java trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteCond.java trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteMap.java trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteRule.java trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteTestCase.java trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteValve.java trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/Substitution.java trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/TomcatResolver.java Log: - Add license. - Add some of the missing features (map parsing, some cookie support, host rewriting), but test cases are not done yet. Modified: trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/Resolver.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/Resolver.java 2005-11-02 14:04:15 UTC (rev 1485) +++ trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/Resolver.java 2005-11-02 14:27:40 UTC (rev 1486) @@ -1,3 +1,20 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package org.jboss.web.rewrite; public abstract class Resolver { @@ -12,4 +29,6 @@ public abstract String resolveHttp(String key); + public abstract boolean resolveResource(int type, String name); + } \ No newline at end of file Modified: trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteCond.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteCond.java 2005-11-02 14:04:15 UTC (rev 1485) +++ trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteCond.java 2005-11-02 14:27:40 UTC (rev 1486) @@ -1,3 +1,20 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package org.jboss.web.rewrite; import java.util.Map; @@ -48,6 +65,28 @@ } } + public class ResourceCondition extends Condition { + /** + * 0: -d (is directory ?) + * 1: -f (is regular file ?) + * 2: -s (is regular file with size ?) + */ + public int type = 0; + public boolean evaluate(String value, Resolver resolver) { + switch (type) { + case 0: + return true; + case 1: + return true; + case 2: + return true; + default: + return false; + } + + } + } + protected String testString = null; protected String condPattern = null; @@ -71,7 +110,6 @@ test = new Substitution(); test.setSub(testString); test.parse(maps); - // FIXME: Support for the other special condition patterns if (condPattern.startsWith("!")) { positive = false; condPattern = condPattern.substring(1); @@ -88,6 +126,15 @@ LexicalCondition condition = new LexicalCondition(); condition.type = 0; condition.condition = condPattern.substring(1); + } else if (condPattern.equals("-d")) { + ResourceCondition ncondition = new ResourceCondition(); + ncondition.type = 0; + } else if (condPattern.equals("-f")) { + ResourceCondition ncondition = new ResourceCondition(); + ncondition.type = 1; + } else if (condPattern.equals("-s")) { + ResourceCondition ncondition = new ResourceCondition(); + ncondition.type = 2; } else { PatternCondition condition = new PatternCondition(); int flags = 0; @@ -147,7 +194,6 @@ } Condition condition = (Condition) this.condition.get(); if (condition == null) { - // FIXME: Support for the other special condition patterns if (condPattern.startsWith("<")) { LexicalCondition ncondition = new LexicalCondition(); ncondition.type = -1; @@ -163,6 +209,18 @@ ncondition.type = 0; ncondition.condition = condPattern.substring(1); condition = ncondition; + } else if (condPattern.equals("-d")) { + ResourceCondition ncondition = new ResourceCondition(); + ncondition.type = 0; + condition = ncondition; + } else if (condPattern.equals("-f")) { + ResourceCondition ncondition = new ResourceCondition(); + ncondition.type = 1; + condition = ncondition; + } else if (condPattern.equals("-s")) { + ResourceCondition ncondition = new ResourceCondition(); + ncondition.type = 2; + condition = ncondition; } else { PatternCondition ncondition = new PatternCondition(); int flags = 0; Modified: trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteMap.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteMap.java 2005-11-02 14:04:15 UTC (rev 1485) +++ trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteMap.java 2005-11-02 14:27:40 UTC (rev 1486) @@ -1,3 +1,20 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package org.jboss.web.rewrite; public interface RewriteMap { @@ -2,2 +19,4 @@ + public String setParameters(String params); + public String lookup(String key); Modified: trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteRule.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteRule.java 2005-11-02 14:04:15 UTC (rev 1485) +++ trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteRule.java 2005-11-02 14:27:40 UTC (rev 1486) @@ -1,3 +1,20 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package org.jboss.web.rewrite; import java.util.Map; @@ -156,8 +173,11 @@ protected boolean gone = false; /** - * FIXME: Content handler ????? + * Host. This means this rule and its associated conditions will apply to + * host, allowing host rewriting (ex: redirecting internally *.foo.com to + * bar.foo.com). */ + protected boolean host = false; /** * Stop the rewriting process here and don't apply any more rewriting @@ -420,5 +440,13 @@ public void setSubstitutionString(String substitutionString) { this.substitutionString = substitutionString; } + + public boolean isHost() { + return host; + } + + public void setHost(boolean host) { + this.host = host; + } } Modified: trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteTestCase.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteTestCase.java 2005-11-02 14:04:15 UTC (rev 1485) +++ trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteTestCase.java 2005-11-02 14:27:40 UTC (rev 1486) @@ -1,3 +1,20 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package org.jboss.web.rewrite; import junit.framework.Test; @@ -20,6 +37,10 @@ return "ssl_property_value[" + key + "]"; } + public boolean resolveResource(int type, String name) { + return true; + } + } /** Modified: trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteValve.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteValve.java 2005-11-02 14:04:15 UTC (rev 1485) +++ trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/RewriteValve.java 2005-11-02 14:27:40 UTC (rev 1486) @@ -1,3 +1,20 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package org.jboss.web.rewrite; import java.io.BufferedReader; @@ -12,6 +29,7 @@ import java.util.StringTokenizer; import javax.servlet.ServletException; +import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; import org.apache.catalina.Container; @@ -21,7 +39,6 @@ import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleListener; -import org.apache.catalina.connector.Connector; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; import org.apache.catalina.util.LifecycleSupport; @@ -219,23 +236,29 @@ // As long as MB isn't a char sequence or affiliated, this has to be // converted to a string String url = context ? request.getRequestPathMB().toString() : request.getDecodedRequestURI(); + String host = request.getServerName(); boolean rewritten = false; boolean done = false; for (int i = 0; i < rules.length; i++) { - CharSequence newurl = rules[i].evaluate(url, resolver); - if (newurl != null && !url.equals(newurl.toString())) { + String test = (rules[i].isHost()) ? host : url; + CharSequence newtest = rules[i].evaluate(test, resolver); + if (newtest != null && !test.equals(newtest.toString())) { if (container.getLogger().isDebugEnabled()) { - container.getLogger().debug("Rewrote " + url + " as " + newurl + container.getLogger().debug("Rewrote " + test + " as " + newtest + " with rule pattern " + rules[i].getPatternString()); } - url = newurl.toString(); + if (rules[i].isHost()) { + host = newtest.toString(); + } else { + url = newtest.toString(); + } rewritten = true; } // Control flow processing // - chain (skip remaining chained rules if this one does not match) - if (rules[i].isChain() && newurl == null) { + if (rules[i].isChain() && newtest == null) { for (int j = i; j < rules.length; j++) { if (!rules[j].isChain()) { i = j; @@ -244,33 +267,33 @@ } } // - last (stop rewriting here) - if (rules[i].isLast() && newurl != null) { + if (rules[i].isLast() && newtest != null) { break; } // - next (redo again) - if (rules[i].isNext() && newurl != null) { + if (rules[i].isNext() && newtest != null) { i = 0; } // - skip (n rules) - if (newurl != null) { + if (newtest != null) { i += rules[i].getSkip(); } // Final reply: // - forbidden - if (rules[i].isForbidden() && newurl != null) { + if (rules[i].isForbidden() && newtest != null) { response.sendError(HttpServletResponse.SC_FORBIDDEN); done = true; break; } // - gone - if (rules[i].isGone() && newurl != null) { + if (rules[i].isGone() && newtest != null) { response.sendError(HttpServletResponse.SC_GONE); done = true; break; } // - redirect (code) - if (rules[i].isRedirect() && newurl != null) { + if (rules[i].isRedirect() && newtest != null) { // Note: No way to specify the status code here response.sendRedirect(url); done = true; @@ -279,20 +302,24 @@ // Reply modification: // - cookie - if (rules[i].isCookie() && newurl != null) { - // FIXME: Cookie impl + if (rules[i].isCookie() && newtest != null) { + response.addCookie(new Cookie(rules[i].getCookieName(), + rules[i].getCookieValue())); + // FIXME: Cookie impl for other parameters } - // - env (note: this sets a request attribute) - if (rules[i].isEnv() && newurl != null) { - request.setAttribute(rules[i].getEnvName(), rules[i].getEnvValue()); + // - env (note: this sets a system property) + if (rules[i].isEnv() && newtest != null) { + System.setProperty(rules[i].getEnvName(), rules[i].getEnvValue()); } // - content type (note: this will not force the content type, use a filter // to do that) - if (rules[i].isType() && newurl != null) { + if (rules[i].isType() && newtest != null) { request.setContentType(rules[i].getTypeValue()); } // - qsappend - // FIXME: Append to query string ? + // FIXME: Append to query string ? In general, some query string handling is + // apparently needed, which feels weird (in Servlet API land, the query + // string is separate) } @@ -306,6 +333,13 @@ } chunk.append(url); request.getCoyoteRequest().requestURI().toChars(); + // Set the new host if it changed + if (!host.equals(request.getServerName())) { + chunk = request.getCoyoteRequest().serverName().getCharChunk(); + chunk.recycle(); + chunk.append(host); + request.getCoyoteRequest().serverName().toChars(); + } // Reinvoke the whole request recursively try { request.getConnector().getProtocolHandler().getAdapter().service @@ -369,21 +403,22 @@ /** * This factory method will parse a line formed like: - * RewriteCond TestString CondPattern [Flags] + * * Example: * RewriteCond %{REMOTE_HOST} ^host1.* [OR] * - * @param rewriteCond + * @param line * @return */ - public static Object parse(String rewriteCond) { - StringTokenizer tokenizer = new StringTokenizer(rewriteCond); + public static Object parse(String line) { + StringTokenizer tokenizer = new StringTokenizer(line); if (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); if (token.equals("RewriteCond")) { + // RewriteCond TestString CondPattern [Flags] RewriteCond condition = new RewriteCond(); if (tokenizer.countTokens() < 2) { - throw new IllegalArgumentException("Ivalid line: " + rewriteCond); + throw new IllegalArgumentException("Ivalid line: " + line); } condition.setTestString(tokenizer.nextToken()); condition.setCondPattern(tokenizer.nextToken()); @@ -394,14 +429,15 @@ } StringTokenizer flagsTokenizer = new StringTokenizer(flags, ","); while (flagsTokenizer.hasMoreElements()) { - parseCondFlag(rewriteCond, condition, flagsTokenizer.nextToken()); + parseCondFlag(line, condition, flagsTokenizer.nextToken()); } } return condition; } else if (token.equals("RewriteRule")) { + // RewriteRule Pattern Substitution [Flags] RewriteRule rule = new RewriteRule(); if (tokenizer.countTokens() < 2) { - throw new IllegalArgumentException("Ivalid line: " + rewriteCond); + throw new IllegalArgumentException("Ivalid line: " + line); } rule.setPatternString(tokenizer.nextToken()); rule.setSubstitutionString(tokenizer.nextToken()); @@ -412,15 +448,32 @@ } StringTokenizer flagsTokenizer = new StringTokenizer(flags, ","); while (flagsTokenizer.hasMoreElements()) { - parseRuleFlag(rewriteCond, rule, flagsTokenizer.nextToken()); + parseRuleFlag(line, rule, flagsTokenizer.nextToken()); } } return rule; } else if (token.equals("RewriteMap")) { - // FIXME: Map parsing: return an Object[2] with 0:name 1:RewriteMap - // RewriteMap name rewriteMapClassName;whateverParameterInWhateverFormat + // RewriteMap name rewriteMapClassName whateverOptionalParameterInWhateverFormat + if (tokenizer.countTokens() < 2) { + throw new IllegalArgumentException("Ivalid line: " + line); + } + String name = tokenizer.nextToken(); + String rewriteMapClassName = tokenizer.nextToken(); + RewriteMap map = null; + try { + map = (RewriteMap) (Class.forName(rewriteMapClassName).newInstance()); + } catch (Exception e) { + throw new IllegalArgumentException("Ivalid map className: " + line); + } + if (tokenizer.hasMoreTokens()) { + map.setParameters(tokenizer.nextToken()); + } + Object[] result = new Object[2]; + result[0] = name; + result[1] = map; + return result; } else { - throw new IllegalArgumentException("Ivalid line: " + rewriteCond); + throw new IllegalArgumentException("Ivalid line: " + line); } } return null; @@ -455,7 +508,17 @@ rule.setChain(true); } else if (flag.startsWith("cookie=") || flag.startsWith("C=")) { rule.setCookie(true); - // FIXME: Parse cookie + if (flag.startsWith("cookie")) { + flag = flag.substring("cookie=".length()); + } else if (flag.startsWith("C=")) { + flag = flag.substring("C=".length()); + } + int pos = flag.indexOf(':'); + if (pos == -1 || (pos + 1) == flag.length()) { + throw new IllegalArgumentException("Ivalid flag in: " + line); + } + rule.setCookieName(flag.substring(0, pos)); + rule.setCookieValue(flag.substring(pos + 1)); } else if (flag.startsWith("env=") || flag.startsWith("E=")) { rule.setEnv(true); if (flag.startsWith("env=")) { @@ -473,6 +536,8 @@ rule.setForbidden(true); } else if (flag.startsWith("gone") || flag.startsWith("G")) { rule.setGone(true); + } else if (flag.startsWith("host") || flag.startsWith("H")) { + rule.setHost(true); } else if (flag.startsWith("last") || flag.startsWith("L")) { rule.setLast(true); } else if (flag.startsWith("next") || flag.startsWith("N")) { Modified: trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/Substitution.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/Substitution.java 2005-11-02 14:04:15 UTC (rev 1485) +++ trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/Substitution.java 2005-11-02 14:27:40 UTC (rev 1486) @@ -1,3 +1,20 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package org.jboss.web.rewrite; import java.util.ArrayList; Modified: trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/TomcatResolver.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/TomcatResolver.java 2005-11-02 14:04:15 UTC (rev 1485) +++ trunk/labs/jbossweb/src/share/classes/org/jboss/web/rewrite/TomcatResolver.java 2005-11-02 14:27:40 UTC (rev 1486) @@ -1,3 +1,20 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package org.jboss.web.rewrite; import org.apache.catalina.connector.Request; @@ -2,2 +19,5 @@ +import org.apache.naming.resources.CacheEntry; +import org.apache.naming.resources.ProxyDirContext; + public class TomcatResolver extends Resolver { @@ -85,6 +105,10 @@ return null; } + public String resolveEnv(String key) { + return System.getProperty(key); + } + public String resolveSsl(String key) { // FIXME: Implement SSL environment variables return null; @@ -94,6 +118,26 @@ return request.getHeader(key); } + public boolean resolveResource(int type, String name) { + ProxyDirContext resources = (ProxyDirContext) request.getContext().getResources(); + CacheEntry cacheEntry = resources.lookupCache(name); + if (!cacheEntry.exists) { + return false; + } else { + switch (type) { + case 0: + return (cacheEntry.resource == null); + case 1: + return (cacheEntry.resource != null); + case 2: + return (cacheEntry.resource != null + && cacheEntry.attributes.getContentLength() > 0); + default: + return false; + } + } + } + private static final String emptyStringIfNull(String value) { if (value == null) { return ""; |
From: <jbo...@li...> - 2005-11-02 14:04:26
|
Author: aron.gombas Date: 2005-11-02 09:04:15 -0500 (Wed, 02 Nov 2005) New Revision: 1485 Modified: trunk/labs/kosmos/build/kosmos-project.properties Log: Project verno inced Modified: trunk/labs/kosmos/build/kosmos-project.properties =================================================================== --- trunk/labs/kosmos/build/kosmos-project.properties 2005-11-02 13:49:50 UTC (rev 1484) +++ trunk/labs/kosmos/build/kosmos-project.properties 2005-11-02 14:04:15 UTC (rev 1485) @@ -1,3 +1,3 @@ project.name=Kosmos project.name.short=kosmos -project.version=0.1.2 +project.version=0.1.3 |
From: <jbo...@li...> - 2005-11-02 13:49:59
|
Author: aron.gombas Date: 2005-11-02 08:49:50 -0500 (Wed, 02 Nov 2005) New Revision: 1484 Modified: trunk/labs/kosmos/xdocs/reference/reference-manual.xml Log: Secure URL documented Modified: trunk/labs/kosmos/xdocs/reference/reference-manual.xml =================================================================== --- trunk/labs/kosmos/xdocs/reference/reference-manual.xml 2005-11-02 13:48:50 UTC (rev 1483) +++ trunk/labs/kosmos/xdocs/reference/reference-manual.xml 2005-11-02 13:49:50 UTC (rev 1484) @@ -608,6 +608,12 @@ <listitem> + <para>It can connect both to secure and public repositories.</para> + + </listitem> + + <listitem> + <para>It reports on the latest touch, developer activity and repository statistics. Additionally, some of stats are visualized in charts if you click to the <literal> @@ -1366,7 +1372,13 @@ <para><literal>SvnMonitoringPortlet</literal>: URLs of the Subversion repositories to monitor. For example: <literal> - http://svn.apache.org/repos/asf/commons,http://svn.apache.org/repos/asf/db</literal>.</para> + http://svn.apache.org/repos/asf/commons,http://svn.apache.org/repos/asf/db</literal>. + If you have secure repositories, you must include the username + and the password in the URL: <literal> + http://myusername:myp...@ww.../svn/mysecurerepo</literal>. + Please note that the security information will not appear in + the user interface, so if you restrict the access to <filename>portlet.xml</filename> + and the serverside log, then it's completely safe.</para> </listitem> |
From: <jbo...@li...> - 2005-11-02 13:48:55
|
Author: aron.gombas Date: 2005-11-02 08:48:50 -0500 (Wed, 02 Nov 2005) New Revision: 1483 Modified: trunk/labs/kosmos/web-portlet/WEB-INF/portlet.xml Log: Obsolete Codehaus project removed Modified: trunk/labs/kosmos/web-portlet/WEB-INF/portlet.xml =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/portlet.xml 2005-11-01 12:26:56 UTC (rev 1482) +++ trunk/labs/kosmos/web-portlet/WEB-INF/portlet.xml 2005-11-02 13:48:50 UTC (rev 1483) @@ -102,7 +102,6 @@ <init-param> <name>monitored.urls</name> <value> - http://jira.codehaus.org/browse/ACL, http://jira.codehaus.org/browse/ACTIVEIO, http://jira.codehaus.org/browse/AWS, http://jira.codehaus.org/browse/ASP, |
From: <jbo...@li...> - 2005-11-01 12:27:10
|
Author: aron.gombas Date: 2005-11-01 07:26:56 -0500 (Tue, 01 Nov 2005) New Revision: 1482 Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java Log: Caching check extended for secure repos, too Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java 2005-11-01 12:11:32 UTC (rev 1481) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java 2005-11-01 12:26:56 UTC (rev 1482) @@ -85,13 +85,41 @@ String url = key.toString(); try { - return (SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url)).getLatestRevision() == previousLatestRevision); + SVNRepository repo = connect(url); + return (repo.getLatestRevision() == previousLatestRevision); } catch(SVNException ex) { log.error("Unable to get the latest revision", ex); return false; } } + + /** + * Connects to the given public or secure SVN URL. + * @return the repository after a successful connection. + */ + protected SVNRepository connect(String url) throws SVNException { + // connect to repository + SVNURL svnUrl = SVNURL.parseURIEncoded(url); + SVNRepository repo = SVNRepositoryFactory.create(svnUrl); + + // authenticate if repository is secured + String userInfo = svnUrl.getUserInfo(); + if(!StringUtils.isBlank(userInfo)) { + String strings[] = StringUtils.split(userInfo, ':'); + if(strings.length != 2) + throw new IllegalArgumentException(String.format("Invalid user info \"%s\"", userInfo)); + String userName = strings[0]; + String password = strings[1]; + if(StringUtils.isBlank(userName) || StringUtils.isBlank(password)) + throw new IllegalArgumentException(String.format("Invalid username (\"%s\") or password (\"%s\")", userName, password)); + log.debug(String.format("Signing in as \"%s\" \"%s\"...", userName, password)); + repo.setAuthenticationManager(SVNWCUtil.createDefaultAuthenticationManager(userName, password)); + } + + return repo; + } + public Object reloadData(Object key) { String url = key.toString(); List<SvnRepository> repositories = new ArrayList<SvnRepository>(); @@ -101,24 +129,8 @@ SVNRepositoryFactoryImpl.setup(); try { - // connect to repository - SVNURL svnUrl = SVNURL.parseURIEncoded(url); - SVNRepository repo = SVNRepositoryFactory.create(svnUrl); - - // authenticate if repository is secured - String userInfo = svnUrl.getUserInfo(); - if(!StringUtils.isBlank(userInfo)) { - String strings[] = StringUtils.split(userInfo, ':'); - if(strings.length != 2) - throw new IllegalArgumentException(String.format("Invalid user info \"%s\"", userInfo)); - String userName = strings[0]; - String password = strings[1]; - if(StringUtils.isBlank(userName) || StringUtils.isBlank(password)) - throw new IllegalArgumentException(String.format("Invalid username (\"%s\") or password (\"%s\")", userName, password)); - log.debug(String.format("Signing in as \"%s\" \"%s\"...", userName, password)); - - repo.setAuthenticationManager(SVNWCUtil.createDefaultAuthenticationManager(userName, password)); - } + // connect + SVNRepository repo = connect(url); // get repository info SvnRepositoryLogStats logStats = analyzeLog(repo); |
From: <jbo...@li...> - 2005-11-01 12:11:40
|
Author: aron.gombas Date: 2005-11-01 07:11:32 -0500 (Tue, 01 Nov 2005) New Revision: 1481 Removed: trunk/labs/kosmos/web-portlet/WEB-INF/lib/commons-lang-2.0.jar trunk/labs/kosmos/web-server/WEB-INF/lib/commons-lang-2.0.jar Log: Old commons-lang removed Deleted: trunk/labs/kosmos/web-portlet/WEB-INF/lib/commons-lang-2.0.jar =================================================================== (Binary files differ) Deleted: trunk/labs/kosmos/web-server/WEB-INF/lib/commons-lang-2.0.jar =================================================================== (Binary files differ) |
From: <jbo...@li...> - 2005-11-01 12:09:36
|
Author: aron.gombas Date: 2005-11-01 07:09:30 -0500 (Tue, 01 Nov 2005) New Revision: 1480 Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ScrapingUtils.java Log: SVN support for secure repos added Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java 2005-11-01 12:00:24 UTC (rev 1479) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java 2005-11-01 12:09:30 UTC (rev 1480) @@ -13,6 +13,7 @@ import hu.midori.kosmos.server.AbstractKosmosService; import hu.midori.kosmos.server.CachedDataHandler; import hu.midori.kosmos.server.util.ChartUtils; +import hu.midori.kosmos.server.util.ScrapingUtils; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -28,6 +29,7 @@ import java.util.Set; import java.util.TreeMap; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jfree.data.time.TimeSeries; @@ -43,6 +45,7 @@ import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl; import org.tmatesoft.svn.core.io.SVNRepository; import org.tmatesoft.svn.core.io.SVNRepositoryFactory; +import org.tmatesoft.svn.core.wc.SVNWCUtil; /** * Implementation of the <i>Subversion</i> service. @@ -98,18 +101,33 @@ SVNRepositoryFactoryImpl.setup(); try { - // get repository info + // connect to repository SVNURL svnUrl = SVNURL.parseURIEncoded(url); SVNRepository repo = SVNRepositoryFactory.create(svnUrl); - // TODO repository.setCredentialsProvider(new SVNSimpleCredentialsProvider("anonymous", "anonymous"));//TODO should be param + + // authenticate if repository is secured + String userInfo = svnUrl.getUserInfo(); + if(!StringUtils.isBlank(userInfo)) { + String strings[] = StringUtils.split(userInfo, ':'); + if(strings.length != 2) + throw new IllegalArgumentException(String.format("Invalid user info \"%s\"", userInfo)); + String userName = strings[0]; + String password = strings[1]; + if(StringUtils.isBlank(userName) || StringUtils.isBlank(password)) + throw new IllegalArgumentException(String.format("Invalid username (\"%s\") or password (\"%s\")", userName, password)); + log.debug(String.format("Signing in as \"%s\" \"%s\"...", userName, password)); + + repo.setAuthenticationManager(SVNWCUtil.createDefaultAuthenticationManager(userName, password)); + } + // get repository info SvnRepositoryLogStats logStats = analyzeLog(repo); SvnRepositoryContentStats contentStats = analyzeContent(repo); generateCharts(repo, logStats); // save previousLatestRevision = repo.getLatestRevision(); - SvnRepository repository = new SvnRepository(repo.getLocation().toString(), repo.getLatestRevision(), + SvnRepository repository = new SvnRepository(ScrapingUtils.removeUserInfoFromUrl(repo.getLocation().toString()), repo.getLatestRevision(), logStats.createdDate, logStats.commits, logStats.commitsTotal, logStats.commitsToday, logStats.commitsLast7Days, logStats.commitsLast31Days, logStats.committersTotal.size(), logStats.committersToday.size(), logStats.committersLast7Days.size(), logStats.committersLast31Days.size(), @@ -323,7 +341,7 @@ /** Generates and saves the chart images on the server, and sets the URLs to the stats. */ protected void generateCharts(SVNRepository repository, SvnRepositoryLogStats stats) throws IOException { - String location = repository.getLocation().toString(); + String location = ScrapingUtils.removeUserInfoFromUrl(repository.getLocation().toString()); // generate charts ByteArrayOutputStream out = new ByteArrayOutputStream(); Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ScrapingUtils.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ScrapingUtils.java 2005-11-01 12:00:24 UTC (rev 1479) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ScrapingUtils.java 2005-11-01 12:09:30 UTC (rev 1480) @@ -6,6 +6,7 @@ */ package hu.midori.kosmos.server.util; +import java.net.MalformedURLException; import java.net.URL; import java.util.List; @@ -17,6 +18,7 @@ import net.sf.saxon.query.XQueryExpression; import net.sf.saxon.trans.XPathException; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; @@ -84,6 +86,17 @@ } /** + * Removes the userinfo part from the given URL. + * @return the truncated URL. + */ + public static String removeUserInfoFromUrl(String url) throws MalformedURLException { + URL originalUrl = new URL(url); + + // remove the userinfo part and the separator '@' + return StringUtils.remove(StringUtils.remove(originalUrl.toString(), originalUrl.getUserInfo()), '@'); + } + + /** * Eliminates the empty items from a scraped value string to make * the tokenizer happy. E.g. <code>||xxx|</code> will be transformed to <code> | |xxx| </code>. */ |
From: <jbo...@li...> - 2005-11-01 12:01:08
|
Author: aron.gombas Date: 2005-11-01 07:00:24 -0500 (Tue, 01 Nov 2005) New Revision: 1479 Added: trunk/labs/kosmos/web-portlet/WEB-INF/lib/commons-lang-2.1.jar trunk/labs/kosmos/web-server/WEB-INF/lib/commons-lang-2.1.jar Log: commons-lang upgraded Added: trunk/labs/kosmos/web-portlet/WEB-INF/lib/commons-lang-2.1.jar =================================================================== (Binary files differ) Property changes on: trunk/labs/kosmos/web-portlet/WEB-INF/lib/commons-lang-2.1.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/labs/kosmos/web-server/WEB-INF/lib/commons-lang-2.1.jar =================================================================== (Binary files differ) Property changes on: trunk/labs/kosmos/web-server/WEB-INF/lib/commons-lang-2.1.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream |
From: <jbo...@li...> - 2005-11-01 10:24:20
|
Author: aron.gombas Date: 2005-11-01 05:24:03 -0500 (Tue, 01 Nov 2005) New Revision: 1478 Modified: trunk/labs/kosmos/src/test/hu/midori/kosmos/server/cc/CcServiceTest.java trunk/labs/kosmos/src/test/hu/midori/kosmos/server/jira/JiraServiceTest.java trunk/labs/kosmos/src/test/hu/midori/kosmos/server/sf/SfServiceTest.java trunk/labs/kosmos/src/test/hu/midori/kosmos/server/svn/SvnServiceTest.java Log: New tests (still not running because of a JTidy problem?!) Modified: trunk/labs/kosmos/src/test/hu/midori/kosmos/server/cc/CcServiceTest.java =================================================================== --- trunk/labs/kosmos/src/test/hu/midori/kosmos/server/cc/CcServiceTest.java 2005-10-31 16:21:45 UTC (rev 1477) +++ trunk/labs/kosmos/src/test/hu/midori/kosmos/server/cc/CcServiceTest.java 2005-11-01 10:24:03 UTC (rev 1478) @@ -6,6 +6,7 @@ */ package hu.midori.kosmos.server.cc; +import hu.midori.kosmos.model.CcBuildStatus; import hu.midori.kosmos.model.CcProject; import hu.midori.kosmos.model.CcTest; import hu.midori.kosmos.protocol.CcService; @@ -35,22 +36,22 @@ } public void testStandardLogs() {// TODO add these files to the repo and the src distro - testLog("/!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/ais"); - testLog("/!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/cargo-m2-trunk"); - testLog("/!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/commons-math"); - testLog("/!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/frifinans"); - testLog("/!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/gridportlets"); - testLog("/!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/gridsphere"); - testLog("/!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/gvlam"); - testLog("/!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/jboss-3.2"); - testLog("/!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/jboss-remoting"); - testLog("/!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/log4rss"); - testLog("/!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/mobicents-dailytckrun"); - testLog("/!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/mock-apis-trunk"); - testLog("/!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/openpacs"); - testLog("/!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/scarab-mysql"); - testLog("/!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/scarab-pgsql"); - testLog("/!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/weta-dfs"); + testLog("/!Usr/Aron/Own/midori/projects/kosmos/src-repo/testdata/cc-log/ais"); + testLog("/!Usr/Aron/Own/midori/projects/kosmos/src-repo/testdata/cc-log/cargo-m2-trunk"); + testLog("/!Usr/Aron/Own/midori/projects/kosmos/src-repo/testdata/cc-log/commons-math"); + testLog("/!Usr/Aron/Own/midori/projects/kosmos/src-repo/testdata/cc-log/frifinans"); + testLog("/!Usr/Aron/Own/midori/projects/kosmos/src-repo/testdata/cc-log/gridportlets"); + testLog("/!Usr/Aron/Own/midori/projects/kosmos/src-repo/testdata/cc-log/gridsphere"); + testLog("/!Usr/Aron/Own/midori/projects/kosmos/src-repo/testdata/cc-log/gvlam"); + testLog("/!Usr/Aron/Own/midori/projects/kosmos/src-repo/testdata/cc-log/jboss-3.2"); + testLog("/!Usr/Aron/Own/midori/projects/kosmos/src-repo/testdata/cc-log/jboss-remoting"); + testLog("/!Usr/Aron/Own/midori/projects/kosmos/src-repo/testdata/cc-log/log4rss"); + testLog("/!Usr/Aron/Own/midori/projects/kosmos/src-repo/testdata/cc-log/mobicents-dailytckrun"); + testLog("/!Usr/Aron/Own/midori/projects/kosmos/src-repo/testdata/cc-log/mock-apis-trunk"); + testLog("/!Usr/Aron/Own/midori/projects/kosmos/src-repo/testdata/cc-log/openpacs"); + testLog("/!Usr/Aron/Own/midori/projects/kosmos/src-repo/testdata/cc-log/scarab-mysql"); + testLog("/!Usr/Aron/Own/midori/projects/kosmos/src-repo/testdata/cc-log/scarab-pgsql"); + testLog("/!Usr/Aron/Own/midori/projects/kosmos/src-repo/testdata/cc-log/weta-dfs"); } // TODO add more logfiles @@ -64,7 +65,7 @@ CcProject project = projects.get(0); assertTrue(project.getName().length() > 0); assertTrue(project.getBuildLabel().length() > 0); - // TODO assert getStatus() { + assertTrue((project.getStatus() == CcBuildStatus.SUCCEEDED) || (project.getStatus() == CcBuildStatus.FAILED)); assertTrue(project.getTimestamp().getTime() > 0); assertTrue(project.getModifications() >= 0); assertTrue(project.getBuildTime().length() > 0); Modified: trunk/labs/kosmos/src/test/hu/midori/kosmos/server/jira/JiraServiceTest.java =================================================================== --- trunk/labs/kosmos/src/test/hu/midori/kosmos/server/jira/JiraServiceTest.java 2005-10-31 16:21:45 UTC (rev 1477) +++ trunk/labs/kosmos/src/test/hu/midori/kosmos/server/jira/JiraServiceTest.java 2005-11-01 10:24:03 UTC (rev 1478) @@ -11,6 +11,7 @@ import hu.midori.kosmos.server.AbstractKosmosServiceTest; import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; @@ -28,13 +29,13 @@ assertEquals(0, service.getProjects("http://www.nosuchdomain.com/jira").size()); } - /** Tests authentication. */ + /** Tests accessing secured databases. */ public void testAuthentication() { - // login with invalid account - // TODO implement after the authentication is implemented - - // login with valid account - // TODO implement after the authentication is implemented + // test secured without signing in + assertEquals(0, service.getProjects("http://svn.jboss.com/jbossas").size());// TODO specify secured here + + // test secured with signing in + testDatabase("http://myusername@mypassword:xxx.yyy.zzz/myproject");// TODO } public void testApacheInstance() { @@ -42,71 +43,71 @@ } public void testAtlassianInstance() { - testPublicInstance("http://jira.atlassian.com/browse/COBJ"); - testPublicInstance("http://jira.atlassian.com/browse/CORE"); - testPublicInstance("http://jira.atlassian.com/browse/MAIL"); - testPublicInstance("http://jira.atlassian.com/browse/PLUG"); - testPublicInstance("http://jira.atlassian.com/browse/CONF"); - testPublicInstance("http://jira.atlassian.com/browse/JRA"); - testPublicInstance("http://jira.atlassian.com/browse/PERF"); - testPublicInstance("http://jira.atlassian.com/browse/SVN"); - testPublicInstance("http://jira.atlassian.com/browse/TST"); + testDatabase("http://jira.atlassian.com/browse/COBJ"); + testDatabase("http://jira.atlassian.com/browse/CORE"); + testDatabase("http://jira.atlassian.com/browse/MAIL"); + testDatabase("http://jira.atlassian.com/browse/PLUG"); + testDatabase("http://jira.atlassian.com/browse/CONF"); + testDatabase("http://jira.atlassian.com/browse/JRA"); + testDatabase("http://jira.atlassian.com/browse/PERF"); + testDatabase("http://jira.atlassian.com/browse/SVN"); + testDatabase("http://jira.atlassian.com/browse/TST"); } public void testCodeHausInstance() { - testPublicInstance("http://jira.codehaus.org/browse/ACL"); - testPublicInstance("http://jira.codehaus.org/browse/ACTIVEIO"); - testPublicInstance("http://jira.codehaus.org/browse/AWS"); - testPublicInstance("http://jira.codehaus.org/browse/ASP"); - testPublicInstance("http://jira.codehaus.org/browse/AJLIB"); - testPublicInstance("http://jira.codehaus.org/browse/ANNOGEN"); - testPublicInstance("http://jira.codehaus.org/browse/ASH"); - testPublicInstance("http://jira.codehaus.org/browse/AWARE"); - testPublicInstance("http://jira.codehaus.org/browse/BERKANO"); - testPublicInstance("http://jira.codehaus.org/browse/BLISSED"); - testPublicInstance("http://jira.codehaus.org/browse/BOO"); - testPublicInstance("http://jira.codehaus.org/browse/CARGO"); + testDatabase("http://jira.codehaus.org/browse/ACL"); + testDatabase("http://jira.codehaus.org/browse/ACTIVEIO"); + testDatabase("http://jira.codehaus.org/browse/AWS"); + testDatabase("http://jira.codehaus.org/browse/ASP"); + testDatabase("http://jira.codehaus.org/browse/AJLIB"); + testDatabase("http://jira.codehaus.org/browse/ANNOGEN"); + testDatabase("http://jira.codehaus.org/browse/ASH"); + testDatabase("http://jira.codehaus.org/browse/AWARE"); + testDatabase("http://jira.codehaus.org/browse/BERKANO"); + testDatabase("http://jira.codehaus.org/browse/BLISSED"); + testDatabase("http://jira.codehaus.org/browse/BOO"); + testDatabase("http://jira.codehaus.org/browse/CARGO"); } public void testJBossInstance() { - testPublicInstance("http://jira.jboss.com/jira/browse/JBQA"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBWIKI"); - testPublicInstance("http://jira.jboss.com/jira/browse/EJBTHREE"); - testPublicInstance("http://jira.jboss.com/jira/browse/HIBERNATE"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBAOP"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBAS"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBIDE"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBMESSAGING"); - testPublicInstance("http://jira.jboss.com/jira/browse/JGRP"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBTPL"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBDOCS"); - testPublicInstance("http://jira.jboss.com/jira/browse/JASSIST"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBADMCON"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBBENCH"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBBUILD"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBCACHE"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBCLUSTER"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBINSTALL"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBPM"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBLAB"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBMAIL"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBMICROCONT"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBPORTAL"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBPROFILER"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBREM"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBSEAM"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBSER"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBSHARP"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBWEB"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBXB"); - testPublicInstance("http://jira.jboss.com/jira/browse/JBWS"); - testPublicInstance("http://jira.jboss.com/jira/browse/KOSMOS"); + testDatabase("http://jira.jboss.com/jira/browse/JBQA"); + testDatabase("http://jira.jboss.com/jira/browse/JBWIKI"); + testDatabase("http://jira.jboss.com/jira/browse/EJBTHREE"); + testDatabase("http://jira.jboss.com/jira/browse/HIBERNATE"); + testDatabase("http://jira.jboss.com/jira/browse/JBAOP"); + testDatabase("http://jira.jboss.com/jira/browse/JBAS"); + testDatabase("http://jira.jboss.com/jira/browse/JBIDE"); + testDatabase("http://jira.jboss.com/jira/browse/JBMESSAGING"); + testDatabase("http://jira.jboss.com/jira/browse/JGRP"); + testDatabase("http://jira.jboss.com/jira/browse/JBTPL"); + testDatabase("http://jira.jboss.com/jira/browse/JBDOCS"); + testDatabase("http://jira.jboss.com/jira/browse/JASSIST"); + testDatabase("http://jira.jboss.com/jira/browse/JBADMCON"); + testDatabase("http://jira.jboss.com/jira/browse/JBBENCH"); + testDatabase("http://jira.jboss.com/jira/browse/JBBUILD"); + testDatabase("http://jira.jboss.com/jira/browse/JBCACHE"); + testDatabase("http://jira.jboss.com/jira/browse/JBCLUSTER"); + testDatabase("http://jira.jboss.com/jira/browse/JBINSTALL"); + testDatabase("http://jira.jboss.com/jira/browse/JBPM"); + testDatabase("http://jira.jboss.com/jira/browse/JBLAB"); + testDatabase("http://jira.jboss.com/jira/browse/JBMAIL"); + testDatabase("http://jira.jboss.com/jira/browse/JBMICROCONT"); + testDatabase("http://jira.jboss.com/jira/browse/JBPORTAL"); + testDatabase("http://jira.jboss.com/jira/browse/JBPROFILER"); + testDatabase("http://jira.jboss.com/jira/browse/JBREM"); + testDatabase("http://jira.jboss.com/jira/browse/JBSEAM"); + testDatabase("http://jira.jboss.com/jira/browse/JBSER"); + testDatabase("http://jira.jboss.com/jira/browse/JBSHARP"); + testDatabase("http://jira.jboss.com/jira/browse/JBWEB"); + testDatabase("http://jira.jboss.com/jira/browse/JBXB"); + testDatabase("http://jira.jboss.com/jira/browse/JBWS"); + testDatabase("http://jira.jboss.com/jira/browse/KOSMOS"); } // TODO add further instances seen in the Atlassian pages - /** Tests a public instance. */ - protected void testPublicInstance(String url) { + /** Tests a database. */ + protected void testDatabase(String url) { List<JiraProject> projects = service.getProjects(url); assertTrue(projects.size() > 0); @@ -132,7 +133,7 @@ assertTrue(project.getTrivialOpenIssues() >= 0); assertTrue(project.getOptionalOpenIssues() >= 0); - // TODO assert getOpenIssuesPerAssignee() + testOpenIssuesPerAssignee(project); assertFalse(StringUtils.isBlank(project.getIssuesPerStatusChartUrl())); assertFalse(StringUtils.isBlank(project.getOpenIssuesPerPriorityChartUrl())); @@ -141,4 +142,15 @@ assertEquals(project.getTotalIssues(), project.getOpenIssues() + project.getCodingInProgressIssues() + project.getReopenedIssues() + project.getResolvedIssues() + project.getClosedIssues()); } } + + /** Tests the open issues per assignee in a project. */ + protected static void testOpenIssuesPerAssignee(JiraProject project) { + int openIssuesCalculated = 0; + for(Map.Entry<String, Integer> openIssuePerAssignee : project.getOpenIssuesPerAssignee()) { + assertFalse(StringUtils.isBlank(openIssuePerAssignee.getKey())); + assertTrue(openIssuePerAssignee.getValue() > 0); + openIssuesCalculated += openIssuePerAssignee.getValue(); + } + assertEquals(project.getOpenIssues(), openIssuesCalculated); + } } Modified: trunk/labs/kosmos/src/test/hu/midori/kosmos/server/sf/SfServiceTest.java =================================================================== --- trunk/labs/kosmos/src/test/hu/midori/kosmos/server/sf/SfServiceTest.java 2005-10-31 16:21:45 UTC (rev 1477) +++ trunk/labs/kosmos/src/test/hu/midori/kosmos/server/sf/SfServiceTest.java 2005-11-01 10:24:03 UTC (rev 1478) @@ -51,7 +51,9 @@ testProjectWithRelease("http://sourceforge.net/projects/junit"); } - // TODO test various projects here with long release list + public void testXxx() { + // TODO test various projects here with long or complicated release list + } /** Tests a release. */ protected void testProjectWithRelease(String url) { Modified: trunk/labs/kosmos/src/test/hu/midori/kosmos/server/svn/SvnServiceTest.java =================================================================== --- trunk/labs/kosmos/src/test/hu/midori/kosmos/server/svn/SvnServiceTest.java 2005-10-31 16:21:45 UTC (rev 1477) +++ trunk/labs/kosmos/src/test/hu/midori/kosmos/server/svn/SvnServiceTest.java 2005-11-01 10:24:03 UTC (rev 1478) @@ -28,31 +28,35 @@ assertEquals(0, service.getRepositories("http://www.nosuchdomain.com/svn").size()); } - /** TODO */ + /** Tests accessing secured repositories. */ public void testAuthentication() { - // TODO implement after the authentication is implemented + // test secured without signing in + assertEquals(0, service.getRepositories("http://svn.jboss.com/jbossas").size());// TODO specify secured here + + // test secured with signing in + testRepository("http://myusername@mypassword:xxx.yyy.zzz/myproject");// TODO } - public void testApacheInstance() { - testPublicInstance("http://svn.apache.org/repos/asf/commons"); - testPublicInstance("http://svn.apache.org/repos/asf/db"); - testPublicInstance("http://svn.apache.org/repos/asf/incubator/agila"); + public void testApacheRepositories() { + testRepository("http://svn.apache.org/repos/asf/commons"); + testRepository("http://svn.apache.org/repos/asf/db"); + testRepository("http://svn.apache.org/repos/asf/incubator/agila"); } - public void testJBossInstance() { - testPublicInstance("http://anonsvn.labs.jboss.com/trunk/labs/demo"); - testPublicInstance("http://anonsvn.labs.jboss.com/trunk/labs/jbossprofiler"); - testPublicInstance("http://anonsvn.labs.jboss.com/trunk/labs/jbossweb"); - testPublicInstance("http://anonsvn.labs.jboss.com/trunk/labs/jrunit"); - testPublicInstance("http://anonsvn.labs.jboss.com/trunk/labs/kosmos"); - testPublicInstance("http://anonsvn.labs.jboss.com/trunk/labs/portletswap"); - testPublicInstance("http://anonsvn.labs.jboss.com/trunk/labs/reportingservices"); + public void testJBossRepositories() { + testRepository("http://anonsvn.labs.jboss.com/trunk/labs/demo"); + testRepository("http://anonsvn.labs.jboss.com/trunk/labs/jbossprofiler"); + testRepository("http://anonsvn.labs.jboss.com/trunk/labs/jbossweb"); + testRepository("http://anonsvn.labs.jboss.com/trunk/labs/jrunit"); + testRepository("http://anonsvn.labs.jboss.com/trunk/labs/kosmos"); + testRepository("http://anonsvn.labs.jboss.com/trunk/labs/portletswap"); + testRepository("http://anonsvn.labs.jboss.com/trunk/labs/reportingservices"); } - // TODO add more instances here + // TODO add more repositories here /** Tests a public instance. */ - protected void testPublicInstance(String url) { + protected void testRepository(String url) { List<SvnRepository> repositories = service.getRepositories(url); assertTrue(repositories.size() > 0); |
From: <jbo...@li...> - 2005-10-31 16:22:03
|
Author: szimano Date: 2005-10-31 11:21:45 -0500 (Mon, 31 Oct 2005) New Revision: 1477 Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/apache/commons/fileupload/PortletDiskFileUpload.java trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUpload.java trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUploadBase.java Log: wrong license notes Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/apache/commons/fileupload/PortletDiskFileUpload.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/apache/commons/fileupload/PortletDiskFileUpload.java 2005-10-31 16:03:01 UTC (rev 1476) +++ trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/apache/commons/fileupload/PortletDiskFileUpload.java 2005-10-31 16:21:45 UTC (rev 1477) @@ -1,24 +1,63 @@ - /* - * 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. - */ +/* + * $Header: /cvsroot/director168/director_standard_portlets/src/org/apache/commons/fileupload/PortletFileUpload.java,v 1.1 2003/10/01 22:21:43 jsackett Exp $ + * $Revision: 1.1 $ + * $Date: 2003/10/01 22:21:43 $ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Commons", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact ap...@ap.... + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ package org.apache.commons.fileupload; Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUpload.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUpload.java 2005-10-31 16:03:01 UTC (rev 1476) +++ trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUpload.java 2005-10-31 16:21:45 UTC (rev 1477) @@ -1,24 +1,63 @@ - /* - * 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. - */ +/* + * $Header: /cvsroot/director168/director_standard_portlets/src/org/apache/commons/fileupload/PortletFileUpload.java,v 1.1 2003/10/01 22:21:43 jsackett Exp $ + * $Revision: 1.1 $ + * $Date: 2003/10/01 22:21:43 $ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Commons", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact ap...@ap.... + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ package org.apache.commons.fileupload; Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUploadBase.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUploadBase.java 2005-10-31 16:03:01 UTC (rev 1476) +++ trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUploadBase.java 2005-10-31 16:21:45 UTC (rev 1477) @@ -1,24 +1,63 @@ - /* - * 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. - */ +/* + * $Header: /cvsroot/director168/director_standard_portlets/src/org/apache/commons/fileupload/PortletFileUpload.java,v 1.1 2003/10/01 22:21:43 jsackett Exp $ + * $Revision: 1.1 $ + * $Date: 2003/10/01 22:21:43 $ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Commons", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact ap...@ap.... + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ package org.apache.commons.fileupload; |
From: <jbo...@li...> - 2005-10-31 15:53:43
|
Author: szimano Date: 2005-10-31 10:53:30 -0500 (Mon, 31 Oct 2005) New Revision: 1475 Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachmentListPlugin.java Log: again Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachmentListPlugin.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachmentListPlugin.java 2005-10-31 15:50:17 UTC (rev 1474) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachmentListPlugin.java 2005-10-31 15:53:30 UTC (rev 1475) @@ -1,7 +1,7 @@ /* * 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 + * 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 |
From: <jbo...@li...> - 2005-10-31 15:50:43
|
Author: szimano Date: 2005-10-31 10:50:17 -0500 (Mon, 31 Oct 2005) New Revision: 1474 Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachmentListPlugin.java Log: licenses ascii bugs Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachmentListPlugin.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachmentListPlugin.java 2005-10-31 15:46:34 UTC (rev 1473) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachmentListPlugin.java 2005-10-31 15:50:17 UTC (rev 1474) @@ -1,24 +1,25 @@ - /* - * 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. - */ +/* + * 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.wiki.plugins; import java.util.Set; @@ -31,14 +32,15 @@ public class AttachmentListPlugin extends WikiPlugin { private String host = ""; - + @Override public WikiPage process(WikiPage wikiPage, WikiSession wikiSession) { - host = (String)wikiSession.getAttribute("hostURL")+"/wiki/"; - String fileEditURL = (String)wikiSession.getAttribute("actionURL")+"&type=fileInfo&page="+wikiPage.getName(); - + host = (String) wikiSession.getAttribute("hostURL") + "/wiki/"; + String fileEditURL = (String) wikiSession.getAttribute("actionURL") + + "&type=fileInfo&page=" + wikiPage.getName(); + WikiPage newPage = null; - + try { newPage = (WikiPage) wikiPage.clone(); } catch (CloneNotSupportedException cl) { @@ -53,22 +55,25 @@ newContent += "\n<hr />\n<h3>Attachments:</h3>\n<table border='0'>"; for (String file : attachements) { - String href = host+newPage.getName() + "/file:" + file; - newContent += "<tr><td><a href=\""+href+"\">"+href + "</a></td>"; - newContent += "<td><a href=\""+fileEditURL+"&var1="+file+"\" ><img border=\"0\" src=\""+host+WikiCommon.wikiButtons+"/historyButton.png\" /></a></td></tr>\n"; + String href = host + newPage.getName() + "/file:" + file; + newContent += "<tr><td><a href=\"" + href + "\">" + href + + "</a></td>"; + newContent += "<td><a href=\"" + fileEditURL + "&var1=" + file + + "\" ><img border=\"0\" src=\"" + host + + WikiCommon.wikiButtons + + "/historyButton.png\" /></a></td></tr>\n"; } newContent += "</table>\n"; - + newPage.setPageContent(newContent); } return newPage; } - @Override public void init() { - + } } |
Author: szimano Date: 2005-10-31 10:46:34 -0500 (Mon, 31 Oct 2005) New Revision: 1473 Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachmentListPlugin.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/DefaultWikiType.java trunk/forge/portal-extensions/jbosswiki/wiki-management/src/java/org/jboss/wiki/management/WikiService.java Log: license notes Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2005-10-29 19:33:52 UTC (rev 1472) +++ trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2005-10-31 15:46:34 UTC (rev 1473) @@ -19,7 +19,6 @@ * 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.wiki.fileaccess; import java.io.IOException; Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachmentListPlugin.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachmentListPlugin.java 2005-10-29 19:33:52 UTC (rev 1472) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachmentListPlugin.java 2005-10-31 15:46:34 UTC (rev 1473) @@ -19,7 +19,6 @@ * 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.wiki.plugins; import java.util.Set; Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/DefaultWikiType.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/DefaultWikiType.java 2005-10-29 19:33:52 UTC (rev 1472) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/DefaultWikiType.java 2005-10-31 15:46:34 UTC (rev 1473) @@ -19,6 +19,7 @@ * 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.wiki.plugins; import org.jboss.wiki.WikiType; Modified: trunk/forge/portal-extensions/jbosswiki/wiki-management/src/java/org/jboss/wiki/management/WikiService.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-management/src/java/org/jboss/wiki/management/WikiService.java 2005-10-29 19:33:52 UTC (rev 1472) +++ trunk/forge/portal-extensions/jbosswiki/wiki-management/src/java/org/jboss/wiki/management/WikiService.java 2005-10-31 15:46:34 UTC (rev 1473) @@ -19,7 +19,6 @@ * 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.wiki.management; import javax.ejb.Local; |