Author: simonetripodi
Date: Thu Jun 2 20:38:39 2011
New Revision: 1130794
URL: http://svn.apache.org/viewvc?rev=1130794&view=rev
Log:
code formatted
Modified:
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/Channel.java
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/Image.java
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/Item.java
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/RSSDigester.java
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/TextInput.java
Modified:
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/Channel.java
URL:
http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/Channel.java?rev=1130794&r1=1130793&r2=1130794&view=diff
==============================================================================
---
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/Channel.java
(original)
+++
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/Channel.java
Thu Jun 2 20:38:39 2011
@@ -25,14 +25,14 @@ import java.io.UnsupportedEncodingExcept
import java.io.Writer;
import java.util.ArrayList;
-
/**
* <p>Implementation object representing a <strong>channel</strong> in the
* <em>Rich Site Summary</em> DTD, version 0.91. This class may be subclassed
* to further specialize its behavior.</p>
*/
-
-public class Channel implements Serializable {
+public class Channel
+ implements Serializable
+{
/**
*
@@ -41,356 +41,373 @@ public class Channel implements Serializ
// ----------------------------------------------------- Instance Variables
-
/**
* The set of items associated with this Channel.
*/
protected ArrayList<Item> items = new ArrayList<Item>();
-
/**
* The set of skip days for this channel.
*/
protected ArrayList<String> skipDays = new ArrayList<String>();
-
/**
* The set of skip hours for this channel.
*/
protected ArrayList<String> skipHours = new ArrayList<String>();
-
// ------------------------------------------------------------- Properties
-
/**
* The channel copyright (1-100 characters).
*/
protected String copyright = null;
- public String getCopyright() {
- return (this.copyright);
+ public String getCopyright()
+ {
+ return ( this.copyright );
}
- public void setCopyright(String copyright) {
+ public void setCopyright( String copyright )
+ {
this.copyright = copyright;
}
-
/**
* The channel description (1-500 characters).
*/
protected String description = null;
- public String getDescription() {
- return (this.description);
+ public String getDescription()
+ {
+ return ( this.description );
}
- public void setDescription(String description) {
+ public void setDescription( String description )
+ {
this.description = description;
}
-
/**
* The channel description file URL (1-500 characters).
*/
protected String docs = null;
- public String getDocs() {
- return (this.docs);
+ public String getDocs()
+ {
+ return ( this.docs );
}
- public void setDocs(String docs) {
+ public void setDocs( String docs )
+ {
this.docs = docs;
}
-
/**
* The image describing this channel.
*/
protected Image image = null;
- public Image getImage() {
- return (this.image);
+ public Image getImage()
+ {
+ return ( this.image );
}
- public void setImage(Image image) {
+ public void setImage( Image image )
+ {
this.image = image;
}
-
/**
* The channel language (2-5 characters).
*/
protected String language = null;
- public String getLanguage() {
- return (this.language);
+ public String getLanguage()
+ {
+ return ( this.language );
}
- public void setLanguage(String language) {
+ public void setLanguage( String language )
+ {
this.language = language;
}
-
/**
* The channel last build date (1-100 characters).
*/
protected String lastBuildDate = null;
- public String getLastBuildDate() {
- return (this.lastBuildDate);
+ public String getLastBuildDate()
+ {
+ return ( this.lastBuildDate );
}
- public void setLastBuildDate(String lastBuildDate) {
+ public void setLastBuildDate( String lastBuildDate )
+ {
this.lastBuildDate = lastBuildDate;
}
-
/**
* The channel link (1-500 characters).
*/
protected String link = null;
- public String getLink() {
- return (this.link);
+ public String getLink()
+ {
+ return ( this.link );
}
- public void setLink(String link) {
+ public void setLink( String link )
+ {
this.link = link;
}
-
/**
* The managing editor (1-100 characters).
*/
protected String managingEditor = null;
- public String getManagingEditor() {
- return (this.managingEditor);
+ public String getManagingEditor()
+ {
+ return ( this.managingEditor );
}
- public void setManagingEditor(String managingEditor) {
+ public void setManagingEditor( String managingEditor )
+ {
this.managingEditor = managingEditor;
}
-
/**
* The channel publication date (1-100 characters).
*/
protected String pubDate = null;
- public String getPubDate() {
- return (this.pubDate);
+ public String getPubDate()
+ {
+ return ( this.pubDate );
}
- public void setPubDate(String pubDate) {
+ public void setPubDate( String pubDate )
+ {
this.pubDate = pubDate;
}
-
/**
* The channel rating (20-500 characters).
*/
protected String rating = null;
- public String getRating() {
- return (this.rating);
+ public String getRating()
+ {
+ return ( this.rating );
}
- public void setRating(String rating) {
+ public void setRating( String rating )
+ {
this.rating = rating;
}
-
/**
* The text input description for this channel.
*/
protected TextInput textInput = null;
- public TextInput getTextInput() {
- return (this.textInput);
+ public TextInput getTextInput()
+ {
+ return ( this.textInput );
}
- public void setTextInput(TextInput textInput) {
+ public void setTextInput( TextInput textInput )
+ {
this.textInput = textInput;
}
-
/**
* The channel title (1-100 characters).
*/
protected String title = null;
- public String getTitle() {
- return (this.title);
+ public String getTitle()
+ {
+ return ( this.title );
}
- public void setTitle(String title) {
+ public void setTitle( String title )
+ {
this.title = title;
}
-
/**
* The RSS specification version number used to create this Channel.
*/
protected double version = 0.91;
- public double getVersion() {
- return (this.version);
+ public double getVersion()
+ {
+ return ( this.version );
}
- public void setVersion(double version) {
+ public void setVersion( double version )
+ {
this.version = version;
}
-
/**
* The webmaster email address (1-100 characters).
*/
protected String webMaster = null;
- public String getWebMaster() {
- return (this.webMaster);
+ public String getWebMaster()
+ {
+ return ( this.webMaster );
}
- public void setWebMaster(String webMaster) {
+ public void setWebMaster( String webMaster )
+ {
this.webMaster = webMaster;
}
-
// --------------------------------------------------------- Public Methods
-
/**
* Add an additional item.
*
* @param item The item to be added
*/
- public void addItem(Item item) {
- synchronized (items) {
- items.add(item);
+ public void addItem( Item item )
+ {
+ synchronized ( items )
+ {
+ items.add( item );
}
}
-
/**
* Add an additional skip day name.
*
* @param skipDay The skip day to be added
*/
- public void addSkipDay(String skipDay) {
- synchronized (skipDays) {
- skipDays.add(skipDay);
+ public void addSkipDay( String skipDay )
+ {
+ synchronized ( skipDays )
+ {
+ skipDays.add( skipDay );
}
}
-
/**
* Add an additional skip hour name.
*
* @param skipHour The skip hour to be added
*/
- public void addSkipHour(String skipHour) {
- synchronized (skipHours) {
- skipHours.add(skipHour);
+ public void addSkipHour( String skipHour )
+ {
+ synchronized ( skipHours )
+ {
+ skipHours.add( skipHour );
}
}
-
/**
* Return the items for this channel.
*/
- public Item[] findItems() {
- synchronized (items) {
+ public Item[] findItems()
+ {
+ synchronized ( items )
+ {
Item items[] = new Item[this.items.size()];
- return this.items.toArray(items);
+ return this.items.toArray( items );
}
}
-
/**
* Return the items for this channel.
*/
- public Item[] getItems() {
+ public Item[] getItems()
+ {
return findItems();
}
-
/**
* Return the skip days for this channel.
*/
- public String[] findSkipDays() {
- synchronized (skipDays) {
+ public String[] findSkipDays()
+ {
+ synchronized ( skipDays )
+ {
String skipDays[] = new String[this.skipDays.size()];
- return this.skipDays.toArray(skipDays);
+ return this.skipDays.toArray( skipDays );
}
}
-
/**
* Return the skip hours for this channel.
*/
- public String[] getSkipHours() {
+ public String[] getSkipHours()
+ {
return findSkipHours();
}
-
/**
* Return the skip hours for this channel.
*/
- public String[] findSkipHours() {
- synchronized (skipHours) {
+ public String[] findSkipHours()
+ {
+ synchronized ( skipHours )
+ {
String skipHours[] = new String[this.skipHours.size()];
- return this.skipHours.toArray(skipHours);
+ return this.skipHours.toArray( skipHours );
}
}
-
/**
* Return the skip days for this channel.
*/
- public String[] getSkipDays() {
+ public String[] getSkipDays()
+ {
return findSkipDays();
}
-
/**
* Remove an item for this channel.
*
* @param item The item to be removed
*/
- public void removeItem(Item item) {
- synchronized (items) {
- items.remove(item);
+ public void removeItem( Item item )
+ {
+ synchronized ( items )
+ {
+ items.remove( item );
}
}
-
/**
* Remove a skip day for this channel.
*
* @param skipDay The skip day to be removed
*/
- public void removeSkipDay(String skipDay) {
- synchronized (skipDays) {
- skipDays.remove(skipDay);
+ public void removeSkipDay( String skipDay )
+ {
+ synchronized ( skipDays )
+ {
+ skipDays.remove( skipDay );
}
}
-
/**
* Remove a skip hour for this channel.
*
* @param skipHour The skip hour to be removed
*/
- public void removeSkipHour(String skipHour) {
- synchronized (skipHours) {
- skipHours.remove(skipHour);
+ public void removeSkipHour( String skipHour )
+ {
+ synchronized ( skipHours )
+ {
+ skipHours.remove( skipHour );
}
}
-
/**
* Render this channel as XML conforming to the RSS 0.91 specification,
* to the specified output stream, with no indication of character
@@ -398,17 +415,18 @@ public class Channel implements Serializ
*
* @param stream The output stream to write to
*/
- public void render(OutputStream stream) {
-
- try {
- render(stream, null);
- } catch (UnsupportedEncodingException e) {
+ public void render( OutputStream stream )
+ {
+ try
+ {
+ render( stream, null );
+ }
+ catch ( UnsupportedEncodingException e )
+ {
// Can not happen
}
-
}
-
/**
* Render this channel as XML conforming to the RSS 0.91 specification,
* to the specified output stream, with the specified character encoding.
@@ -420,34 +438,33 @@ public class Channel implements Serializ
* @exception UnsupportedEncodingException if the named encoding
* is not supported
*/
- public void render(OutputStream stream, String encoding)
- throws UnsupportedEncodingException {
-
+ public void render( OutputStream stream, String encoding )
+ throws UnsupportedEncodingException
+ {
PrintWriter pw = null;
- if (encoding == null) {
- pw = new PrintWriter(stream);
- } else {
- pw = new PrintWriter(new OutputStreamWriter(stream, encoding));
+ if ( encoding == null )
+ {
+ pw = new PrintWriter( stream );
+ }
+ else
+ {
+ pw = new PrintWriter( new OutputStreamWriter( stream, encoding ) );
}
- render(pw, encoding);
+ render( pw, encoding );
pw.flush();
-
}
-
/**
* Render this channel as XML conforming to the RSS 0.91 specification,
* to the specified writer, with no indication of character encoding.
*
* @param writer The writer to render output to
*/
- public void render(Writer writer) {
-
- render(writer, null);
-
+ public void render( Writer writer )
+ {
+ render( writer, null );
}
-
/**
* Render this channel as XML conforming to the RSS 0.91 specification,
* to the specified writer, indicating the specified character encoding.
@@ -456,28 +473,24 @@ public class Channel implements Serializ
* @param encoding The character encoding to declare, or <code>null</code>
* for no declaration
*/
- public void render(Writer writer, String encoding) {
-
- PrintWriter pw = new PrintWriter(writer);
- render(pw, encoding);
+ public void render( Writer writer, String encoding )
+ {
+ PrintWriter pw = new PrintWriter( writer );
+ render( pw, encoding );
pw.flush();
-
}
-
/**
* Render this channel as XML conforming to the RSS 0.91 specification,
* to the specified writer, with no indication of character encoding.
*
* @param writer The writer to render output to
*/
- public void render(PrintWriter writer) {
-
- render(writer, null);
-
+ public void render( PrintWriter writer )
+ {
+ render( writer, null );
}
-
/**
* Render this channel as XML conforming to the RSS 0.91 specification,
* to the specified writer, indicating the specified character encoding.
@@ -486,134 +499,146 @@ public class Channel implements Serializ
* @param encoding The character encoding to declare, or <code>null</code>
* for no declaration
*/
- public void render(PrintWriter writer, String encoding) {
-
- writer.print("<?xml version=\"1.0\"");
- if (encoding != null) {
- writer.print(" encoding=\"");
- writer.print(encoding);
- writer.print("\"");
+ public void render( PrintWriter writer, String encoding )
+ {
+ writer.print( "<?xml version=\"1.0\"" );
+ if ( encoding != null )
+ {
+ writer.print( " encoding=\"" );
+ writer.print( encoding );
+ writer.print( "\"" );
}
- writer.println("?>");
+ writer.println( "?>" );
writer.println();
- writer.println("<!DOCTYPE rss PUBLIC");
- writer.println(" \"-//Netscape Communications//DTD RSS 0.91//EN\"");
- writer.println("
\"http://my.netscape.com/publish/formats/rss-0.91.dtd\">");
+ writer.println( "<!DOCTYPE rss PUBLIC" );
+ writer.println( " \"-//Netscape Communications//DTD RSS 0.91//EN\"" );
+ writer.println( "
\"http://my.netscape.com/publish/formats/rss-0.91.dtd\">" );
writer.println();
- writer.println("<rss version=\"0.91\">");
+ writer.println( "<rss version=\"0.91\">" );
writer.println();
- writer.println(" <channel>");
+ writer.println( " <channel>" );
writer.println();
- writer.print(" <title>");
- writer.print(title);
- writer.println("</title>");
+ writer.print( " <title>" );
+ writer.print( title );
+ writer.println( "</title>" );
- writer.print(" <description>");
- writer.print(description);
- writer.println("</description>");
+ writer.print( " <description>" );
+ writer.print( description );
+ writer.println( "</description>" );
- writer.print(" <link>");
- writer.print(link);
- writer.println("</link>");
+ writer.print( " <link>" );
+ writer.print( link );
+ writer.println( "</link>" );
- writer.print(" <language>");
- writer.print(language);
- writer.println("</language>");
+ writer.print( " <language>" );
+ writer.print( language );
+ writer.println( "</language>" );
- if (rating != null) {
- writer.print(" <rating>");
- writer.print(rating);
- writer.println("</rating>");
+ if ( rating != null )
+ {
+ writer.print( " <rating>" );
+ writer.print( rating );
+ writer.println( "</rating>" );
}
- if (copyright != null) {
- writer.print(" <copyright>");
- writer.print(copyright);
- writer.print("</copyright>");
+ if ( copyright != null )
+ {
+ writer.print( " <copyright>" );
+ writer.print( copyright );
+ writer.print( "</copyright>" );
}
-
- if (pubDate != null) {
- writer.print(" <pubDate>");
- writer.print(pubDate);
- writer.println("</pubDate>");
+ if ( pubDate != null )
+ {
+ writer.print( " <pubDate>" );
+ writer.print( pubDate );
+ writer.println( "</pubDate>" );
}
- if (lastBuildDate != null) {
- writer.print(" <lastBuildDate>");
- writer.print(lastBuildDate);
- writer.println("</lastBuildDate>");
+ if ( lastBuildDate != null )
+ {
+ writer.print( " <lastBuildDate>" );
+ writer.print( lastBuildDate );
+ writer.println( "</lastBuildDate>" );
}
- if (docs != null) {
- writer.print(" <docs>");
- writer.print(docs);
- writer.println("</docs>");
+ if ( docs != null )
+ {
+ writer.print( " <docs>" );
+ writer.print( docs );
+ writer.println( "</docs>" );
}
- if (managingEditor != null) {
- writer.print(" <managingEditor>");
- writer.print(managingEditor);
- writer.println("</managingEditor>");
+ if ( managingEditor != null )
+ {
+ writer.print( " <managingEditor>" );
+ writer.print( managingEditor );
+ writer.println( "</managingEditor>" );
}
- if (webMaster != null) {
- writer.print(" <webMaster>");
- writer.print(webMaster);
- writer.println("</webMaster>");
+ if ( webMaster != null )
+ {
+ writer.print( " <webMaster>" );
+ writer.print( webMaster );
+ writer.println( "</webMaster>" );
}
writer.println();
- if (image != null) {
- image.render(writer);
+ if ( image != null )
+ {
+ image.render( writer );
writer.println();
}
- if (textInput != null) {
- textInput.render(writer);
+ if ( textInput != null )
+ {
+ textInput.render( writer );
writer.println();
}
String skipDays[] = findSkipDays();
- if (skipDays.length > 0) {
- writer.println(" <skipDays>");
- for (int i = 0; i < skipDays.length; i++) {
- writer.print(" <skipDay>");
- writer.print(skipDays[i]);
- writer.println("</skipDay>");
+ if ( skipDays.length > 0 )
+ {
+ writer.println( " <skipDays>" );
+ for ( int i = 0; i < skipDays.length; i++ )
+ {
+ writer.print( " <skipDay>" );
+ writer.print( skipDays[i] );
+ writer.println( "</skipDay>" );
}
- writer.println(" </skipDays>");
+ writer.println( " </skipDays>" );
}
String skipHours[] = findSkipHours();
- if (skipHours.length > 0) {
- writer.println(" <skipHours>");
- for (int i = 0; i < skipHours.length; i++) {
- writer.print(" <skipHour>");
- writer.print(skipHours[i]);
- writer.println("</skipHour>");
+ if ( skipHours.length > 0 )
+ {
+ writer.println( " <skipHours>" );
+ for ( int i = 0; i < skipHours.length; i++ )
+ {
+ writer.print( " <skipHour>" );
+ writer.print( skipHours[i] );
+ writer.println( "</skipHour>" );
}
- writer.println(" </skipHours>");
+ writer.println( " </skipHours>" );
writer.println();
}
Item items[] = findItems();
- for (int i = 0; i < items.length; i++) {
- items[i].render(writer);
+ for ( int i = 0; i < items.length; i++ )
+ {
+ items[i].render( writer );
writer.println();
}
- writer.println(" </channel>");
+ writer.println( " </channel>" );
writer.println();
- writer.println("</rss>");
-
+ writer.println( "</rss>" );
}
-
}
Modified:
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/Image.java
URL:
http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/Image.java?rev=1130794&r1=1130793&r2=1130794&view=diff
==============================================================================
---
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/Image.java
(original)
+++
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/Image.java
Thu Jun 2 20:38:39 2011
@@ -20,14 +20,14 @@ package org.apache.commons.digester3.rss
import java.io.PrintWriter;
import java.io.Serializable;
-
/**
* <p>Implementation object representing an <strong>image</strong> in the
* <em>Rich Site Summary</em> DTD, version 0.91. This class may be subclassed
* to further specialize its behavior.</p>
*/
-
-public class Image implements Serializable {
+public class Image
+ implements Serializable
+{
/**
*
@@ -41,129 +41,134 @@ public class Image implements Serializab
*/
protected String description = null;
- public String getDescription() {
- return (this.description);
+ public String getDescription()
+ {
+ return ( this.description );
}
- public void setDescription(String description) {
+ public void setDescription( String description )
+ {
this.description = description;
}
-
/**
* The image height in pixels (1-400).
*/
protected int height = 31;
- public int getHeight() {
- return (this.height);
+ public int getHeight()
+ {
+ return ( this.height );
}
- public void setHeight(int height) {
+ public void setHeight( int height )
+ {
this.height = height;
}
-
/**
* The image link (1-500 characters).
*/
protected String link = null;
- public String getLink() {
- return (this.link);
+ public String getLink()
+ {
+ return ( this.link );
}
- public void setLink(String link) {
+ public void setLink( String link )
+ {
this.link = link;
}
-
/**
* The image alternate text (1-100 characters).
*/
protected String title = null;
- public String getTitle() {
- return (this.title);
+ public String getTitle()
+ {
+ return ( this.title );
}
- public void setTitle(String title) {
+ public void setTitle( String title )
+ {
this.title = title;
}
-
/**
* The image location URL (1-500 characters).
*/
protected String url = null;
- public String getURL() {
- return (this.url);
+ public String getURL()
+ {
+ return ( this.url );
}
- public void setURL(String url) {
+ public void setURL( String url )
+ {
this.url = url;
}
-
/**
* The image width in pixels (1-400).
*/
protected int width = 31;
- public int getWidth() {
- return (this.width);
+ public int getWidth()
+ {
+ return ( this.width );
}
- public void setWidth(int width) {
+ public void setWidth( int width )
+ {
this.width = width;
}
-
// -------------------------------------------------------- Package Methods
-
/**
* Render this channel as XML conforming to the RSS 0.91 specification,
* to the specified writer.
*
* @param writer The writer to render output to
*/
- void render(PrintWriter writer) {
-
- writer.println(" <image>");
-
- writer.print(" <title>");
- writer.print(title);
- writer.println("</title>");
-
- writer.print(" <url>");
- writer.print(url);
- writer.println("</url>");
-
- if (link != null) {
- writer.print(" <link>");
- writer.print(link);
- writer.println("</link>");
+ void render( PrintWriter writer )
+ {
+ writer.println( " <image>" );
+
+ writer.print( " <title>" );
+ writer.print( title );
+ writer.println( "</title>" );
+
+ writer.print( " <url>" );
+ writer.print( url );
+ writer.println( "</url>" );
+
+ if ( link != null )
+ {
+ writer.print( " <link>" );
+ writer.print( link );
+ writer.println( "</link>" );
}
- writer.print(" <width>");
- writer.print(width);
- writer.println("</width>");
-
- writer.print(" <height>");
- writer.print(height);
- writer.println("</height>");
-
- if (description != null) {
- writer.print(" <description>");
- writer.print(description);
- writer.println("</description>");
+ writer.print( " <width>" );
+ writer.print( width );
+ writer.println( "</width>" );
+
+ writer.print( " <height>" );
+ writer.print( height );
+ writer.println( "</height>" );
+
+ if ( description != null )
+ {
+ writer.print( " <description>" );
+ writer.print( description );
+ writer.println( "</description>" );
}
- writer.println(" </image>");
-
+ writer.println( " </image>" );
}
-
}
Modified:
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/Item.java
URL:
http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/Item.java?rev=1130794&r1=1130793&r2=1130794&view=diff
==============================================================================
---
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/Item.java
(original)
+++
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/Item.java
Thu Jun 2 20:38:39 2011
@@ -20,13 +20,11 @@ package org.apache.commons.digester3.rss
import java.io.PrintWriter;
import java.io.Serializable;
-
/**
* <p>Implementation object representing an <strong>item</strong> in the
* <em>Rich Site Summary</em> DTD, version 0.91. This class may be subclassed
* to further specialize its behavior.</p>
*/
-
public class Item implements Serializable {
/**
@@ -41,73 +39,74 @@ public class Item implements Serializabl
*/
protected String description = null;
- public String getDescription() {
- return (this.description);
+ public String getDescription()
+ {
+ return ( this.description );
}
- public void setDescription(String description) {
+ public void setDescription( String description )
+ {
this.description = description;
}
-
/**
* The item link (1-500 characters).
*/
protected String link = null;
- public String getLink() {
- return (this.link);
+ public String getLink()
+ {
+ return ( this.link );
}
- public void setLink(String link) {
+ public void setLink( String link )
+ {
this.link = link;
}
-
/**
* The item title (1-100 characters).
*/
protected String title = null;
- public String getTitle() {
- return (this.title);
+ public String getTitle()
+ {
+ return ( this.title );
}
- public void setTitle(String title) {
+ public void setTitle( String title )
+ {
this.title = title;
}
-
// -------------------------------------------------------- Package Methods
-
/**
* Render this channel as XML conforming to the RSS 0.91 specification,
* to the specified writer.
*
* @param writer The writer to render output to
*/
- void render(PrintWriter writer) {
-
- writer.println(" <item>");
-
- writer.print(" <title>");
- writer.print(title);
- writer.println("</title>");
-
- writer.print(" <link>");
- writer.print(link);
- writer.println("</link>");
-
- if (description != null) {
- writer.print(" <description>");
- writer.print(description);
- writer.println("</description>");
+ void render( PrintWriter writer )
+ {
+ writer.println( " <item>" );
+
+ writer.print( " <title>" );
+ writer.print( title );
+ writer.println( "</title>" );
+
+ writer.print( " <link>" );
+ writer.print( link );
+ writer.println( "</link>" );
+
+ if ( description != null )
+ {
+ writer.print( " <description>" );
+ writer.print( description );
+ writer.println( "</description>" );
}
- writer.println(" </item>");
-
+ writer.println( " </item>" );
}
-
}
Modified:
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/RSSDigester.java
URL:
http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/RSSDigester.java?rev=1130794&r1=1130793&r2=1130794&view=diff
==============================================================================
---
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/RSSDigester.java
(original)
+++
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/RSSDigester.java
Thu Jun 2 20:38:39 2011
@@ -42,16 +42,14 @@ import org.xml.sax.SAXException;
* example of using these classes.</p>
*/
-public class RSSDigester extends Digester {
-
+public class RSSDigester
+ extends Digester
+{
// ----------------------------------------------------------- Constructors
-
-
// ----------------------------------------------------- Instance Variables
-
/**
* Have we been configured yet?
*/
@@ -69,74 +67,74 @@ public class RSSDigester extends Digeste
"/org/apache/commons/digester3/rss/rss-0.91.dtd",
};
-
// ------------------------------------------------------------- Properties
-
/**
* The fully qualified class name of the <code>Channel</code>
* implementation class.
*/
protected String channelClass = "org.apache.commons.digester3.rss.Channel";
- public String getChannelClass() {
- return (this.channelClass);
+ public String getChannelClass()
+ {
+ return ( this.channelClass );
}
- public void setChannelClass(String channelClass) {
+ public void setChannelClass( String channelClass )
+ {
this.channelClass = channelClass;
}
-
/**
* The fully qualified class name of the <code>Image</code>
* implementation class.
*/
protected String imageClass = "org.apache.commons.digester3.rss.Image";
- public String getImageClass() {
- return (this.imageClass);
+ public String getImageClass()
+ {
+ return ( this.imageClass );
}
- public void setImageClass(String imageClass) {
+ public void setImageClass( String imageClass )
+ {
this.imageClass = imageClass;
}
-
/**
* The fully qualified class name of the <code>Item</code>
* implementation class.
*/
protected String itemClass = "org.apache.commons.digester3.rss.Item";
- public String getItemClass() {
- return (this.itemClass);
+ public String getItemClass()
+ {
+ return ( this.itemClass );
}
- public void setItemClass(String itemClass) {
+ public void setItemClass( String itemClass )
+ {
this.itemClass = itemClass;
}
-
/**
* The fully qualified class name of the <code>TextInput</code>
* implementation class.
*/
- protected String textInputClass =
- "org.apache.commons.digester3.rss.TextInput";
+ protected String textInputClass =
"org.apache.commons.digester3.rss.TextInput";
- public String getTextInputClass() {
- return (this.textInputClass);
+ public String getTextInputClass()
+ {
+ return ( this.textInputClass );
}
- public void setTextInputClass(String textInputClass) {
+ public void setTextInputClass( String textInputClass )
+ {
this.textInputClass = textInputClass;
}
-
// --------------------------------------------------------- Public Methods
-
/**
* Parse the content of the specified file using this Digester. Returns
* the root element from the object stack (which will be the Channel).
@@ -147,14 +145,13 @@ public class RSSDigester extends Digeste
* @exception SAXException if a parsing exception occurs
*/
@Override
- public <T> T parse(File file) throws IOException, SAXException {
-
+ public <T> T parse( File file )
+ throws IOException, SAXException
+ {
configure();
- return (super.parse(file));
-
+ return ( super.parse( file ) );
}
-
/**
* Parse the content of the specified input source using this Digester.
* Returns the root element from the object stack (which will be the
@@ -166,11 +163,11 @@ public class RSSDigester extends Digeste
* @exception SAXException if a parsing exception occurs
*/
@Override
- public <T> T parse(InputSource input) throws IOException, SAXException {
-
+ public <T> T parse( InputSource input )
+ throws IOException, SAXException
+ {
configure();
- return (super.parse(input));
-
+ return ( super.parse( input ) );
}
@@ -185,14 +182,13 @@ public class RSSDigester extends Digeste
* @exception SAXException if a parsing exception occurs
*/
@Override
- public <T> T parse(InputStream input) throws IOException, SAXException {
-
+ public <T> T parse( InputStream input )
+ throws IOException, SAXException
+ {
configure();
- return (super.parse(input));
-
+ return ( super.parse( input ) );
}
-
/**
* Parse the content of the specified URI using this Digester.
* Returns the root element from the object stack (which will be
@@ -204,127 +200,119 @@ public class RSSDigester extends Digeste
* @exception SAXException if a parsing exception occurs
*/
@Override
- public <T> T parse(String uri) throws IOException, SAXException {
-
+ public <T> T parse( String uri )
+ throws IOException, SAXException
+ {
configure();
- return (super.parse(uri));
-
+ return ( super.parse( uri ) );
}
-
// -------------------------------------------------------- Package Methods
-
-
// ------------------------------------------------------ Protected Methods
-
/**
* Configure the parsing rules that will be used to process RSS input.
*/
@Override
- protected void configure() {
-
- if (configured) {
+ protected void configure()
+ {
+ if ( configured )
+ {
return;
}
// Register local copies of the DTDs we understand
- for (int i = 0; i < registrations.length; i += 2) {
- URL url = this.getClass().getResource(registrations[i + 1]);
- if (url != null) {
- register(registrations[i], url.toString());
+ for ( int i = 0; i < registrations.length; i += 2 )
+ {
+ URL url = this.getClass().getResource( registrations[i + 1] );
+ if ( url != null )
+ {
+ register( registrations[i], url.toString() );
}
}
// FIXME - validate the "version" attribute of the rss element?
// Add the rules for the Channel object
- addObjectCreate("rss/channel", channelClass);
- addCallMethod("rss/channel/copyright", "setCopyright", 0);
- addCallMethod("rss/channel/description", "setDescription", 0);
- addCallMethod("rss/channel/docs", "setDocs", 0);
- addCallMethod("rss/channel/language", "setLanguage", 0);
- addCallMethod("rss/channel/lastBuildDate", "setLastBuildDate", 0);
- addCallMethod("rss/channel/link", "setLink", 0);
- addCallMethod("rss/channel/managingEditor", "setManagingEditor", 0);
- addCallMethod("rss/channel/pubDate", "setPubDate", 0);
- addCallMethod("rss/channel/rating", "setRating", 0);
- addCallMethod("rss/channel/skipDays/day", "addSkipDay", 0);
- addCallMethod("rss/channel/skipHours/hour", "addSkipHour", 0);
- addCallMethod("rss/channel/title", "setTitle", 0);
- addCallMethod("rss/channel/webMaster", "setWebMaster", 0);
+ addObjectCreate( "rss/channel", channelClass );
+ addCallMethod( "rss/channel/copyright", "setCopyright", 0 );
+ addCallMethod( "rss/channel/description", "setDescription", 0 );
+ addCallMethod( "rss/channel/docs", "setDocs", 0 );
+ addCallMethod( "rss/channel/language", "setLanguage", 0 );
+ addCallMethod( "rss/channel/lastBuildDate", "setLastBuildDate", 0 );
+ addCallMethod( "rss/channel/link", "setLink", 0 );
+ addCallMethod( "rss/channel/managingEditor", "setManagingEditor", 0 );
+ addCallMethod( "rss/channel/pubDate", "setPubDate", 0 );
+ addCallMethod( "rss/channel/rating", "setRating", 0 );
+ addCallMethod( "rss/channel/skipDays/day", "addSkipDay", 0 );
+ addCallMethod( "rss/channel/skipHours/hour", "addSkipHour", 0 );
+ addCallMethod( "rss/channel/title", "setTitle", 0 );
+ addCallMethod( "rss/channel/webMaster", "setWebMaster", 0 );
// Add the rules for the Image object
- addObjectCreate("rss/channel/image", imageClass);
- addSetNext("rss/channel/image", "setImage",
- "org.apache.commons.digester3.rss.Image");
- addCallMethod("rss/channel/image/description", "setDescription", 0);
- addCallMethod("rss/channel/image/height", "setHeight", 0,
- new Class[]{ Integer.TYPE });
- addCallMethod("rss/channel/image/link", "setLink", 0);
- addCallMethod("rss/channel/image/title", "setTitle", 0);
- addCallMethod("rss/channel/image/url", "setURL", 0);
- addCallMethod("rss/channel/image/width", "setWidth", 0,
- new Class[]{ Integer.TYPE });
+ addObjectCreate( "rss/channel/image", imageClass );
+ addSetNext( "rss/channel/image", "setImage",
"org.apache.commons.digester3.rss.Image" );
+ addCallMethod( "rss/channel/image/description", "setDescription", 0 );
+ addCallMethod( "rss/channel/image/height", "setHeight", 0, new Class[]
{ Integer.TYPE } );
+ addCallMethod( "rss/channel/image/link", "setLink", 0 );
+ addCallMethod( "rss/channel/image/title", "setTitle", 0 );
+ addCallMethod( "rss/channel/image/url", "setURL", 0 );
+ addCallMethod( "rss/channel/image/width", "setWidth", 0, new Class[] {
Integer.TYPE } );
// Add the rules for the Item object
- addObjectCreate("rss/channel/item", itemClass);
- addSetNext("rss/channel/item", "addItem",
- "org.apache.commons.digester3.rss.Item");
- addCallMethod("rss/channel/item/description", "setDescription", 0);
- addCallMethod("rss/channel/item/link", "setLink", 0);
- addCallMethod("rss/channel/item/title", "setTitle", 0);
+ addObjectCreate( "rss/channel/item", itemClass );
+ addSetNext( "rss/channel/item", "addItem",
"org.apache.commons.digester3.rss.Item" );
+ addCallMethod( "rss/channel/item/description", "setDescription", 0 );
+ addCallMethod( "rss/channel/item/link", "setLink", 0 );
+ addCallMethod( "rss/channel/item/title", "setTitle", 0 );
// Add the rules for the TextInput object
- addObjectCreate("rss/channel/textinput", textInputClass);
- addSetNext("rss/channel/textinput", "setTextInput",
- "org.apache.commons.digester3.rss.TextInput");
- addCallMethod("rss/channel/textinput/description",
- "setDescription", 0);
- addCallMethod("rss/channel/textinput/link", "setLink", 0);
- addCallMethod("rss/channel/textinput/name", "setName", 0);
- addCallMethod("rss/channel/textinput/title", "setTitle", 0);
+ addObjectCreate( "rss/channel/textinput", textInputClass );
+ addSetNext( "rss/channel/textinput", "setTextInput",
"org.apache.commons.digester3.rss.TextInput" );
+ addCallMethod( "rss/channel/textinput/description", "setDescription",
0 );
+ addCallMethod( "rss/channel/textinput/link", "setLink", 0 );
+ addCallMethod( "rss/channel/textinput/name", "setName", 0 );
+ addCallMethod( "rss/channel/textinput/title", "setTitle", 0 );
// Mark this digester as having been configured
configured = true;
-
}
-
// ------------------------------------------------------ Test Main Program
-
/**
* Test main program that parses the channel description included in this
* package as a static resource.
*
* @param args The command line arguments (ignored)
*/
- public static void main(String args[]) {
-
- try {
- System.out.println("RSSDigester Test Program");
- System.out.println("Opening input stream ...");
- InputStream is = RSSDigester.class.getResourceAsStream
- ("/org/apache/commons/digester3/rss/rss-example.xml");
- System.out.println("Creating new digester ...");
+ public static void main( String args[] )
+ {
+ try
+ {
+ System.out.println( "RSSDigester Test Program" );
+ System.out.println( "Opening input stream ..." );
+ InputStream is =
+ RSSDigester.class.getResourceAsStream(
"/org/apache/commons/digester3/rss/rss-example.xml" );
+ System.out.println( "Creating new digester ..." );
RSSDigester digester = new RSSDigester();
- if ((args.length > 0) && (args[0].equals("-debug"))) {
- digester.setLogger(LogFactory.getLog("RSSDigester"));
+ if ( ( args.length > 0 ) && ( args[0].equals( "-debug" ) ) )
+ {
+ digester.setLogger( LogFactory.getLog( "RSSDigester" ) );
}
- System.out.println("Parsing input stream ...");
- Channel channel = (Channel) digester.parse(is);
- System.out.println("Closing input stream ...");
+ System.out.println( "Parsing input stream ..." );
+ Channel channel = (Channel) digester.parse( is );
+ System.out.println( "Closing input stream ..." );
is.close();
- System.out.println("Dumping channel info ...");
- channel.render(System.out);
- } catch (Exception e) {
- System.out.println("-->Exception");
- e.printStackTrace(System.out);
+ System.out.println( "Dumping channel info ..." );
+ channel.render( System.out );
+ }
+ catch ( Exception e )
+ {
+ System.out.println( "-->Exception" );
+ e.printStackTrace( System.out );
}
-
}
-
}
Modified:
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/TextInput.java
URL:
http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/TextInput.java?rev=1130794&r1=1130793&r2=1130794&view=diff
==============================================================================
---
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/TextInput.java
(original)
+++
commons/sandbox/digester3/trunk/src/examples/rss/src/main/java/org/apache/commons/digester3/rss/TextInput.java
Thu Jun 2 20:38:39 2011
@@ -36,95 +36,95 @@ public class TextInput implements Serial
// ------------------------------------------------------------- Properties
-
/**
* The text input description (1-100 characters).
*/
protected String description = null;
- public String getDescription() {
- return (this.description);
+ public String getDescription()
+ {
+ return ( this.description );
}
- public void setDescription(String description) {
+ public void setDescription( String description )
+ {
this.description = description;
}
-
/**
* The text input link (1-500 characters).
*/
protected String link = null;
- public String getLink() {
- return (this.link);
+ public String getLink()
+ {
+ return ( this.link );
}
- public void setLink(String link) {
+ public void setLink( String link )
+ {
this.link = link;
}
-
/**
* The text input field name (1-100 characters).
*/
protected String name = null;
- public String getName() {
- return (this.name);
+ public String getName()
+ {
+ return ( this.name );
}
- public void setName(String name) {
+ public void setName( String name )
+ {
this.name = name;
}
-
/**
* The text input submit button label (1-100 characters).
*/
protected String title = null;
- public String getTitle() {
- return (this.title);
+ public String getTitle()
+ {
+ return ( this.title );
}
- public void setTitle(String title) {
+ public void setTitle( String title )
+ {
this.title = title;
}
-
// -------------------------------------------------------- Package Methods
-
/**
* Render this channel as XML conforming to the RSS 0.91 specification,
* to the specified writer.
*
* @param writer The writer to render output to
*/
- void render(PrintWriter writer) {
-
- writer.println(" <textinput>");
-
- writer.print(" <title>");
- writer.print(title);
- writer.println("</title>");
-
- writer.print(" <description>");
- writer.print(description);
- writer.println("</description>");
-
- writer.print(" <name>");
- writer.print(name);
- writer.println("</name>");
-
- writer.print(" <link>");
- writer.print(link);
- writer.println("</link>");
-
- writer.println(" </textinput>");
+ void render( PrintWriter writer )
+ {
+ writer.println( " <textinput>" );
+
+ writer.print( " <title>" );
+ writer.print( title );
+ writer.println( "</title>" );
+
+ writer.print( " <description>" );
+ writer.print( description );
+ writer.println( "</description>" );
+
+ writer.print( " <name>" );
+ writer.print( name );
+ writer.println( "</name>" );
+
+ writer.print( " <link>" );
+ writer.print( link );
+ writer.println( "</link>" );
+ writer.println( " </textinput>" );
}
-
}