[Cherbot-commit] SF.net SVN: cherbot: [57] trunk/src/net/sf/cherbot/metaserver
Status: Alpha
Brought to you by:
christianhujer
|
From: <chr...@us...> - 2007-06-09 17:47:25
|
Revision: 57
http://svn.sourceforge.net/cherbot/?rev=57&view=rev
Author: christianhujer
Date: 2007-06-09 10:47:23 -0700 (Sat, 09 Jun 2007)
Log Message:
-----------
Improved meta server stuff: Made implementation serializable, improved constructor documentation (JavaBean), added main method.
Modified Paths:
--------------
trunk/src/net/sf/cherbot/metaserver/MetaServerEntry.java
trunk/src/net/sf/cherbot/metaserver/MetaServerInfo.java
Modified: trunk/src/net/sf/cherbot/metaserver/MetaServerEntry.java
===================================================================
--- trunk/src/net/sf/cherbot/metaserver/MetaServerEntry.java 2007-06-09 17:20:42 UTC (rev 56)
+++ trunk/src/net/sf/cherbot/metaserver/MetaServerEntry.java 2007-06-09 17:47:23 UTC (rev 57)
@@ -9,12 +9,13 @@
import org.jetbrains.annotations.NotNull;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
+import java.io.Serializable;
/**
* Created by IntelliJ IDEA.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
-public class MetaServerEntry {
+public class MetaServerEntry implements Serializable {
/** The pattern for parsing an entryString from the metaserver. */
@NotNull private static final Pattern entryPattern = Pattern.compile("(.*?)\\|(.*?)\\|(.*?)\\|(.*?)\\|(.*?)\\|(.*?)\\|(.*?)\\|(.*?)\\|(.*?)");
Modified: trunk/src/net/sf/cherbot/metaserver/MetaServerInfo.java
===================================================================
--- trunk/src/net/sf/cherbot/metaserver/MetaServerInfo.java 2007-06-09 17:20:42 UTC (rev 56)
+++ trunk/src/net/sf/cherbot/metaserver/MetaServerInfo.java 2007-06-09 17:47:23 UTC (rev 57)
@@ -9,6 +9,7 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
@@ -17,11 +18,12 @@
import net.sf.cherbot.Updatable;
import net.sf.japi.io.args.BasicCommand;
import net.sf.japi.io.args.Option;
+import net.sf.japi.io.args.ArgParser;
/** Represents the information stored in a MetaServer.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
-public class MetaServerInfo extends BasicCommand implements Iterable<MetaServerEntry>, Updatable {
+public class MetaServerInfo extends BasicCommand implements Iterable<MetaServerEntry>, Serializable, Updatable {
/** The entries of this MetaServerInfo. */
@NotNull private List<MetaServerEntry> metaServerEntries = new ArrayList<MetaServerEntry>();
@@ -33,11 +35,11 @@
private int port;
/** Creates a MetaServerInfo.
- * This constructor creates a dummy meta server with no functional host and port.
- * It cannot be used for querying and exists for testing purposes only.
+ * This constructor creates an initially empty meta server info with a non functional host and port.
+ * This is useful for testing and for using {@link MetaServerInfo} as a bean.
*/
public MetaServerInfo() {
- this("dummy", 0);
+ this("", 0);
}
/** Creates a MetaServerInfo.
@@ -136,4 +138,11 @@
return 0;
}
+ /** Main program.
+ * @param args Command line arguments (try --help).
+ */
+ public static void main(final String... args) {
+ ArgParser.simpleParseAndRun(new MetaServerInfo(), args);
+ }
+
} // class MetaServerInfo
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|