jukebox4-cvs Mailing List for Jukebox (Page 14)
Brought to you by:
vtt
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
(48) |
Apr
(33) |
May
(23) |
Jun
(55) |
Jul
(79) |
Aug
(48) |
Sep
(12) |
Oct
(23) |
Nov
(23) |
Dec
(4) |
---|
From: CVS B. <vt...@fr...> - 2000-03-14 05:11:26
|
User: vt Date: 00/03/13 22:06:18 Modified: . configure.in Log: Added the test script for the telnet and adjusted the makefiles accordingly. Revision Changes Path 1.45 +2 -0 J4/configure.in CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/configure.in?annotate=1.45&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/configure.in?rev=1.45&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/configure.in.diff?r1=1.45&r2=1.44&cvsroot=jukebox4 ----------------------------------- Index: configure.in =================================================================== RCS file: /usr/local/cvs/J4/configure.in,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- configure.in 2000/03/10 04:49:34 1.44 +++ configure.in 2000/03/14 05:06:17 1.45 @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_REVISION($Id: configure.in,v 1.44 2000/03/10 04:49:34 vt Exp $)dnl +AC_REVISION($Id: configure.in,v 1.45 2000/03/14 05:06:17 vt Exp $)dnl dnl I'd like it to read the ./configure-options to allow both the basic set dnl of options, as well as the local set. @@ -349,6 +349,7 @@ examples/exampleResourcePoolTest examples/exampleSemaphoreGroupTest examples/exampleSimpleServiceTest + examples/exampleTelnetTest src/java/gnu/j4/cache/Makefile src/java/gnu/j4/config/Makefile src/java/gnu/j4/core/Makefile @@ -375,6 +376,7 @@ src/java/gnu/j4/io/uu/Makefile src/java/gnu/j4/io/Makefile src/java/gnu/j4/net/Makefile + src/java/gnu/j4/net/telnet/Makefile src/java/gnu/j4/Makefile src/java/gnu/j4/LocalConfig.java src/java/gnu/Makefile |
From: CVS B. <vt...@fr...> - 2000-03-14 05:11:26
|
User: vt Date: 00/03/13 22:06:18 Modified: examples Makefile.am Added: examples exampleTelnetTest.in Log: Added the test script for the telnet and adjusted the makefiles accordingly. Revision Changes Path 1.5 +7 -2 J4/examples/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/Makefile.am?annotate=1.5&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/Makefile.am?rev=1.5&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/Makefile.am.diff?r1=1.5&r2=1.4&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/examples/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Makefile.am 1999/09/15 21:57:00 1.4 +++ Makefile.am 2000/03/14 05:06:18 1.5 @@ -1,11 +1,13 @@ -# $Id: Makefile.am,v 1.4 1999/09/15 21:57:00 vt Exp $ +# $Id: Makefile.am,v 1.5 2000/03/14 05:06:18 vt Exp $ bin_PROGRAMS = exampleLogTest \ exampleLruCacheTest \ exampleResourcePoolTest \ exampleSemaphoreGroupTest \ exampleConfigTest \ - exampleSimpleServiceTest + exampleSimpleServiceTest \ + exampleTelnetTest + bin_DATA = index.html bindir = ${prefix}/examples @@ -16,6 +18,7 @@ exampleSemaphoreGroupTest_SOURCES = exampleSemaphoreGroupTest exampleConfigTest_SOURCES = exampleConfigTest exampleSimpleServiceTest_SOURCES = exampleSimpleServiceTest +exampleTelnetTest_SOURCES = exampleTelnetTest clean-generic: @@ -32,3 +35,5 @@ exampleSimpleServiceTest: exampleResourcePoolTest: + +exampleTelnetTest: 1.1 J4/examples/exampleTelnetTest.in CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/exampleTelnetTest.in?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/exampleTelnetTest.in?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: exampleTelnetTest.in =================================================================== #! /bin/sh # This test runs the gnu.j4.examples.TelnetTest class. # # The output you get depends on the default settings, so please read the # configuration files in @prefix@/etc carefully so you understand what's # going on. @prefix@/bin/j4wrapper gnu.j4.examples.TelnetTest |
From: CVS B. <vt...@fr...> - 2000-03-14 05:10:48
|
User: vt Date: 00/03/13 22:04:47 Modified: src/java/gnu/j4/examples Makefile.am Added: src/java/gnu/j4/examples TelnetTest.java Log: Added the telnet test and adjusted the makefile accordingly. Revision Changes Path 1.15 +2 -1 J4/src/java/gnu/j4/examples/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/Makefile.am?annotate=1.15&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/Makefile.am?rev=1.15&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/Makefile.am.diff?r1=1.15&r2=1.14&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/examples/Makefile.am,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- Makefile.am 1999/09/15 21:57:00 1.14 +++ Makefile.am 2000/03/14 05:04:47 1.15 @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.14 1999/09/15 21:57:00 vt Exp $ +# $Id: Makefile.am,v 1.15 2000/03/14 05:04:47 vt Exp $ noinst_PROGRAMS = package @@ -15,6 +15,7 @@ SimpleService.java \ StreamClientTest.java \ StreamServerTest.java \ + TelnetTest.java \ ThreadTest.java \ VvsStest.java 1.1 J4/src/java/gnu/j4/examples/TelnetTest.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/TelnetTest.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/TelnetTest.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: TelnetTest.java =================================================================== package gnu.j4.examples; import gnu.j4.service.ActiveService; import gnu.j4.net.telnet.*; /** * {@link Telnet Telnet} protocol test. * * Connects to the <code>localhost</code> port 23 (telnet protocol port), * waits (currently 10 seconds, when finished - until the "*ogin:" prompt * appears), and bails out. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995, 2000 * @version $Id: TelnetTest.java,v 1.1 2000/03/14 05:04:47 vt Exp $ */ public class TelnetTest extends ActiveService { protected Telnet telnet; protected void startup() throws Throwable { telnet = new Telnet("localhost", 23); telnet.start().waitFor(); } protected void execute() throws Throwable { // Read the input line by line until the timeout expires. // ... Thread.sleep(10000); } protected void shutdown() throws Throwable { } } |
From: CVS B. <vt...@fr...> - 2000-03-13 06:17:28
|
User: vt Date: 00/03/12 23:12:29 Added: src/java/gnu/j4/net/telnet .cvsignore Makefile.am Telnet.java TelnetAck.java TelnetConstants.java TelnetOption.java TelnetOptionConstants.java TelnetOptionSB.java TelnetStatus.java package.html topt05.java topt24.java topt31.java topt32.java topt33.java topt34.java toptSR.java Log: A second life of the tt.telnet package, dormant since 1997. Changes: the classes now conform to the current (2.x) services model, the names look more up-to-date with the Java naming convention, also, Telnet doesn't implement the stream interfaces any more, instead, use getInputStream()/getOutputStream(). Revision Changes Path 1.1 J4/src/java/gnu/j4/net/telnet/.cvsignore CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/.cvsignore?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/.cvsignore?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: .cvsignore =================================================================== Makefile Makefile.in *.class .deps 1.1 J4/src/java/gnu/j4/net/telnet/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/Makefile.am?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/Makefile.am?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== # $Id: Makefile.am,v 1.1 2000/03/13 06:12:28 vt Exp $ EXTRA_DIST = package.html noinst_PROGRAMS = package package_SOURCES = toptSR.java \ topt05.java \ topt24.java \ topt31.java \ topt32.java \ topt33.java \ topt34.java \ TelnetConstants.java \ TelnetOptionConstants.java \ TelnetOption.java \ TelnetStatus.java \ Telnet.java \ TelnetAck.java JAVACX = @JAVACX@ SUFFIXES = .java .class .java.class: - @ ${ECHO} "Making $<" @ ${JAVACX} $< package: $(package_OBJECTS) $(package_DEPENDENCIES) clean-compile: rm -f *.class clean-generic: rm -f *~ 1.1 J4/src/java/gnu/j4/net/telnet/Telnet.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/Telnet.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/Telnet.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: Telnet.java =================================================================== package gnu.j4.net.telnet; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.DataOutputStream; import java.io.EOFException; import java.io.IOException; import java.net.InetAddress; import java.net.Socket; import java.net.UnknownHostException; import java.util.Vector; import java.util.Hashtable; import gnu.j4.service.net.SocketService; import gnu.j4.util.RingBuffer; /** * Implements just plain vanilla telnet <emph>protocol</emph> that does NOT * support ANY options and just says WON'T to any DO and DON'T to any WILL * by default. * * <p> * * To use this class, you should create the new instance and start it * explicitly. To support any of the {@link telnetOption options}, you need * to explicitly add ("support") them before or, optionally, after, starting * the service. * * <p> * * See RFC-854 for details. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995, 2000 * @version $Id: Telnet.java,v 1.1 2000/03/13 06:12:28 vt Exp $ */ public class Telnet extends SocketService implements TelnetConstants, TelnetOptionConstants { /** * Log facility to use. */ public static final String CH_TELNET = "Telnet"; protected TelnetStatus localStatus = new TelnetStatus(true); protected TelnetStatus remoteStatus = new TelnetStatus(false); protected boolean alive = true; /** * Socket input stream. */ protected BufferedInputStream in; /** * Socket output stream. ??? */ protected DataOutputStream dataOut; protected BufferedOutputStream out; /** * The internal buffer to store the data on the fly. */ private RingBuffer inBuffer = new RingBuffer(); /** * I've requested this and waiting for their WILL. */ protected Hashtable ackIWant = new Hashtable(); /** * They requested this and I'm waiting for them to acknowledge my response. */ protected Hashtable ackTheyWant = new Hashtable(); /** * Escape action code names for parser. */ protected static Hashtable escapeName; /** * Number of telnet instances. * * VT: FIXME: what's this for? */ protected static int instanceCount = 0; /** * Standalone active service constructor. * * Use this constructor if it has to establish connection on its own. * * @param targetName Target host name. * @param targerPort Target host port. */ public Telnet(String targetName, int targetPort) throws UnknownHostException { super(targetName, targetPort); } /** * Standalone active service constructor. * * Use this constructor if it has to establish connection on its own. * * @param targetAddress Target host address. * @param targerPort Target host port. */ public Telnet(InetAddress targetAddress, int targetPort) { super(targetAddress, targetPort); } /** * Standalone passive service constructor. * * Use this constructor if the socket connection has already been * established. * * @param clientSocket Socket to use. * @see AcceptService#createClient */ public Telnet(Socket clientSocket) { super(clientSocket); } protected void startup() throws InterruptedException, Throwable { super.startup(); if ( instanceCount++ == 0 ) { escapeName = new Hashtable(); escapeName.put(new Integer(SE), "SE"); escapeName.put(new Integer(NOP), "NOP"); escapeName.put(new Integer(DataMark), "DataMark"); escapeName.put(new Integer(InterruptProcess), "InterruptProcess"); escapeName.put(new Integer(AbortOutput), "AbortOutput"); escapeName.put(new Integer(AreYouThere), "AreYouThere"); escapeName.put(new Integer(EraseCharacter), "EraseCharacter"); escapeName.put(new Integer(EraseLine), "EraseLine"); escapeName.put(new Integer(GoAhead), "GoAhead"); escapeName.put(new Integer(SB), "SB"); escapeName.put(new Integer(WILL), "WILL"); escapeName.put(new Integer(WONT), "WONT"); escapeName.put(new Integer(DO), "DO"); escapeName.put(new Integer(DONT), "DONT"); escapeName.put(new Integer(IAC), "IAC"); } complain(LOG_DEBUG, CH_TELNET, in.getClass().getName()); complain(LOG_DEBUG, CH_TELNET, out.getClass().getName()); // bin = new BufferedInputStream(in); dataOut = new DataOutputStream(out); support(TOPT_SuppressGoAhead); support(TOPT_ECHO); support(new topt05(this)); support(new topt24("Java:xterm:UNKNOWN")); support(new topt31(80,25)); support(new topt32("115200,57600,38400,9600,1200")); support(new topt33()); } /** * Don't kill the sockets, as the parent does, in case when this service * is a dependant. */ protected void shutdown() throws InterruptedException, Throwable { // VT: FIXME: the architecture has changed, and dependsOn is no // more. Find a way to clone the behavior. // if ( dependsOn == null && alive ) { super.shutdown(); // } } public void finalize() throws Throwable { // complain(LOG_DEBUG, CH_TELNET, "finalize"); { // shutdown(); } inBuffer = null; ackIWant = null; ackTheyWant = null; localStatus = null; remoteStatus = null; if ( --instanceCount == 0 ) { // complain(LOG_DEBUG, CH_TELNET, "finalize - last instance"); escapeName = null; } super.finalize(); } /** * How many bytes available to read. * @return How many bytes available to read. * @exception IOException when the I/O error occurs */ public synchronized int available() { return inBuffer.available(); } /** * Reads a byte of data. This method will block if no input is available. * @return the byte read, or -1 if the end of the stream is reached. * @exception IOException if an I/O error has occured. */ public synchronized int read() throws IOException { while ( available() == 0 ) { complain(LOG_DEBUG, CH_TELNET, "read:wait"); try { // wait(100); wait(); } catch ( InterruptedException e ) { complain(LOG_DEBUG, CH_TELNET, "read: " + e.toString()); } if ( !isEnabled() ) return -1; } // complain(LOG_DEBUG, CH_TELNET, "read:ok"); int result = inBuffer.get(); complain(LOG_DEBUG, CH_TELNET, "buf: " + result + "/" + (char)result); return result; } /** * Handle protocol escape. * @exception IOException when the I/O error occurs */ protected final void handleEscape() throws IOException { int actionCode = in.read(); if ( actionCode == IAC ) { complain(LOG_DEBUG, CH_TELNET, "IAC escaped"); inBuffer.put(IAC); return; } complain(LOG_DEBUG, CH_TELNET, "remote: "+lookupEscape(actionCode)); int option = in.read(); complain(LOG_DEBUG, CH_TELNET, "remote: "+TelnetOption.getName(option)); switch( actionCode ) { case WILL: remoteWill(option); break; case DO: remoteDo(option); break; case WONT: remoteWont(option); break; case DONT: remoteDont(option); break; case SB: // Start negotiations for the option TelnetOptionSB opt = localStatus.getSB(option); opt.negotiate(in,dataOut); return; default: complain(LOG_DEBUG, CH_TELNET, "Got unknown action code " + lookupEscape(actionCode) + "("+TelnetOption.getName(option) + ")"); break; } } /** * Enable support for the given non-negotiable option. */ protected void support(int option) { localStatus.support(option); } /** * Enable support for the given negotiable option. */ protected void support(TelnetOptionSB option) { localStatus.support(option); } protected boolean isSupported(int option) { try { return localStatus.isSupported(option); } catch ( IllegalAccessException e ) { // Since this exception is thrown when I'm trying to get the remote // status, it's safe to assume that I don't support this option. complain(LOG_DEBUG, CH_TELNET, "isSupported: SHOULDN'T HAPPEN: "+e); return false; } } protected boolean isEnabled(int option) { return localStatus.isEnabled(option); } /** * WILL. * * This method handles received WILL escape sequence by simple rejecting * the service. Any derived class that wants to change the default * behaviour must override this method and call it at the end unless the * escape sequence gets processed. * * <pre> * * Indicates the desire to begin performing, or confirmation that you * are now performing, the indicated option. * * </pre> * * @param Option that I want to perform. * @see TelnetOption * @see WILL */ protected void remoteWill(int option) throws IOException { complain(LOG_DEBUG, CH_TELNET, "THEY WILL(" + TelnetOption.getName(option) + ")"); remoteStatus.enable(option); // I need to respond in some way if ( option == TOPT_STATUS ) { dataOut.write(IAC); dataOut.write(DO); dataOut.write(TOPT_STATUS); dataOut.write(IAC); dataOut.write(SB); dataOut.write(TOPT_STATUS); dataOut.write(1); dataOut.write(IAC); dataOut.write(SE); out.flush(); } } /** * WONT. * * This method handles received WON'T escape sequence. Any derived class * that wants to change the default behaviour must override this method * and call it at the end unless the escape sequence gets processed. * <pre> * Indicates the refusal to perform, or continue performing, the indicated option. * </pre> * @param Option that I do not want to perform. * @see TelnetOption * @see WONT */ public void remoteWont(int option) throws IOException { remoteStatus.disable(option); } /** * DO. * * This method handles received DO escape sequence. Any derived class * that wants to change the default behaviour must override this method * and call it at the end unless the escape sequence gets processed. * <pre> * Indicates the request that the * other party perform, or confirmation that you are expecting the other * party to perform, the indicated option. * </pre> * @param Option that I want them to perform. * @see TelnetOption * @see DO */ public void remoteDo(int option) throws IOException { complain(LOG_DEBUG, CH_TELNET, "THEY WANT ME TO ("+TelnetOption.getName(option)+")"); if ( isSupported(option) ) { I_Will(option); } else { I_Wont(option); } } /** * DONT. * * This method handles received DON'T escape sequence. Any derived class * that wants to change the default behaviour must override this method * and call it at the end unless the escape sequence gets processed. * <pre> * Indicates the demand that the other party stop performing, or confirmation * that you are no longer expecting the other party to perform, the indicated option. * </pre> * @param Option that I do not want them to perform. * @see TelnetOption * @see DONT */ public void remoteDont(int option) throws IOException { complain(LOG_DEBUG, CH_TELNET, "THEY DON'T WANT ME TO ("+TelnetOption.getName(option)+")"); I_Wont(option); } public synchronized void I_Will(int option) throws IOException { if ( isEnabled(option) ) { complain(LOG_DEBUG, CH_TELNET, "Already "+TelnetOption.getName(option)); return; } localStatus.enable(option); complain(LOG_DEBUG, CH_TELNET, "I WILL("+TelnetOption.getName(option)+")"); out.write(IAC); out.write(WILL); out.write(option); out.flush(); } public synchronized void I_Wont(int option) throws IOException { localStatus.disable(option); complain(LOG_DEBUG, CH_TELNET, "I WONT("+TelnetOption.getName(option)+")"); out.write(IAC); out.write(WONT); out.write(option); out.flush(); } public synchronized void I_Do(int option) throws IOException { if ( isEnabled(option) ) { complain(LOG_DEBUG, CH_TELNET, "Already doing "+TelnetOption.getName(option)); } else { complain(LOG_DEBUG, CH_TELNET, "I DO("+TelnetOption.getName(option)+")"); } out.write(IAC); out.write(DO); out.write(option); out.flush(); } public synchronized void I_Dont(int option) throws IOException { complain(LOG_DEBUG, CH_TELNET, "I DONT("+TelnetOption.getName(option)+")"); out.write(IAC); out.write(DONT); out.write(option); out.flush(); } /** * Blocking-read bytes from the socket, and handle incoming/outbound escapes. */ protected void execute() { complain(LOG_DEBUG, CH_TELNET, "started"); while ( isEnabled() && alive ) { int aByte = -1; try { aByte = in.read(); } catch ( IOException e ) { complain(LOG_DEBUG, CH_TELNET, e.toString()); stop(); } try { if ( aByte == IAC ) { complain(LOG_DEBUG, CH_TELNET, "Escape"); handleEscape(); } else { // complain(LOG_DEBUG, CH_TELNET, aByte+":"+(char)aByte); if ( aByte == -1 ) { alive = false; throw new IOException("EOF?"); } else { if ( localStatus.isEnabled(TOPT_ECHO) ) { out.write(aByte); } inBuffer.put(aByte); notify_fake(); } } } catch ( IOException e ) { complain(LOG_DEBUG, CH_TELNET, e.toString()); stop(); } } complain(LOG_DEBUG, CH_TELNET, "finished"); } protected synchronized void notify_fake() { notify(); } /** * Get the action code name. * @return Action code name. */ public static String lookupEscape(int actionCode) { Integer ac = new Integer(actionCode); String result = (String)escapeName.get(ac); ac = null; return result; } /** * Deny the socket access. * * If you need to use the socket, it's still accessible (because it's * <code>protected</code>, not <code>private</code>, if you need the * streams, use the {@link #getInputStream getInputStream} or {@link * #getOutputStream getOutputStream} instead. * * @throws Error because you're not supposed to request the socket * directly, only the input and output streams. */ public Socket getSocket() { throw new Error("Use getInputStream() or getOutputStream() instead"); } } 1.1 J4/src/java/gnu/j4/net/telnet/TelnetAck.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/TelnetAck.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/TelnetAck.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: TelnetAck.java =================================================================== package gnu.j4.net.telnet; public class TelnetAck extends TelnetOption { public int ackFor; public TelnetAck(int opt, int ack) { super(opt); ackFor = ack; } public String toString() { return Telnet.lookupEscape(ackFor) + ":" + getName(); } } 1.1 J4/src/java/gnu/j4/net/telnet/TelnetConstants.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/TelnetConstants.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/TelnetConstants.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: TelnetConstants.java =================================================================== package gnu.j4.net.telnet; /** * All the constants relevant to the implementation of telnet protocol per RFC-854. * * <p> * * Note that the constants relevant to telnet options are listed in {@link * TelnetOptionConstants TelnetOptionConstants}, to avoid a confusion. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995, 2000 * @version $Id: TelnetConstants.java,v 1.1 2000/03/13 06:12:28 vt Exp $ */ public interface TelnetConstants { /** * SE action code. * * End of subnegotiation parameters. */ public final static int SE = 240; /** * NOP action code. * * No operation. */ public final static int NOP = 241; /** * DataMark action code. * * The data stream portion of Synch. */ public final static int DataMark = 242; /** * BRK action code. * * NVT character BRK. */ public final static int Break = 243; /** * IP action code. * * The IP function. */ public final static int InterruptProcess = 244; /** * AO action code. * * The AO function. */ public final static int AbortOutput = 245; /** * AYT action code. * * The function AYT. */ public final static int AreYouThere = 246; /** * EC action code. * * The EC function. */ public final static int EraseCharacter = 247; /** * EL action code. * * The EL function. */ public final static int EraseLine = 248; /** * GA action code. * * The GA signal. */ public final static int GoAhead = 249; /** * SB action code. * * Indicates that what follows is subnegotiation of the indicated * option. */ public final static int SB = 250; /** * WILL action code. * * Indicates the desire to begin performing, or confirmation that you * are now performing, the indicated option. */ public final static int WILL = 251; /** * WONT action code. * * Indicates the refusal to perform, or continue performing, the * indicated option. */ public final static int WONT = 252; /** * DO action code. * * Indicates the request that the other party perform, or confirmation * that you are expecting the other party to perform, the indicated * option. */ public final static int DO = 253; /** * DONT action code. * * Indicates the demand that the other party stop performing, or * confirmation that you are no longer expecting the other party to * perform, the indicated option. */ public final static int DONT = 254; /** * IAC action code. * * Data Byte 255. */ public final static int IAC = 255; } 1.1 J4/src/java/gnu/j4/net/telnet/TelnetOption.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/TelnetOption.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/TelnetOption.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: TelnetOption.java =================================================================== package gnu.j4.net.telnet; import java.util.Hashtable; import gnu.j4.core.LogAware; /** * {@link #Telnet Telnet} options. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995, 2000 * @version $Id: TelnetOption.java,v 1.1 2000/03/13 06:12:28 vt Exp $ */ public class TelnetOption extends LogAware implements TelnetOptionConstants { /** * Option names for parser. */ protected static Hashtable optionName = new Hashtable(); /** * The action code. */ protected int optionCode; public TelnetOption( int optionCode ) { this.optionCode = optionCode; } public String toString() { return "(+)"; } protected static void init() { if ( optionName.size() == 0 ) { // complain( "constructor" ); optionName.put( new Integer( TOPT_TransmitBinary ), "TRANSMIT-BINARY" ); optionName.put( new Integer( TOPT_ECHO ),"ECHO" ); optionName.put( new Integer( TOPT_SuppressGoAhead ), "SUPPRESS-GO-AHEAD" ); optionName.put( new Integer( TOPT_STATUS ), "STATUS" ); optionName.put( new Integer( TOPT_TimingMark ), "TIMING-MARK" ); optionName.put( new Integer( TOPT_RCTE ), "RCTE" ); optionName.put( new Integer( TOPT_NAOCRD ), "NAOCRD" ); optionName.put( new Integer( TOPT_NAOHTS ), "NAOHTS" ); optionName.put( new Integer( TOPT_NAOHTD ), "NAOHTD" ); optionName.put( new Integer( TOPT_NAOFFD ), "NAOFFD" ); optionName.put( new Integer( TOPT_NAOVTS ), "NAOVTS" ); optionName.put( new Integer( TOPT_NAOVID ), "NAOVID" ); optionName.put( new Integer( TOPT_ExtendASCII ), "EXTEND-ASCII" ); optionName.put( new Integer( TOPT_LOGOUT ), "LOGOUT" ); optionName.put( new Integer( TOPT_DET ), "DET" ); optionName.put( new Integer( TOPT_TerminalType ), "TERMINAL-TYPE" ); optionName.put( new Integer( TOPT_EndOfRecord ), "END-OF-RECORD" ); optionName.put( new Integer( TOPT_TUID ), "TUID" ); optionName.put( new Integer( TOPT_OUTMRK ), "OUTMRK" ); optionName.put( new Integer( TOPT_TTYLOC ), "TTYLOC" ); optionName.put( new Integer( TOPT_t3270reg ), "3270-REGIME" ); optionName.put( new Integer( TOPT_X3PAD ), "X.3-PAD" ); optionName.put( new Integer( TOPT_NAWS ), "NAWS" ); optionName.put( new Integer( TOPT_TerminalSpeed ), "TERMINAL-SPEED" ); optionName.put( new Integer( TOPT_ToggleFlowControl ), "TOGGLE-FLOW-CONTROL" ); optionName.put( new Integer( TOPT_LINEMODE ), "LINEMODE" ); optionName.put( new Integer( TOPT_XDisplayLocation ), "X-DISPLAY-LOCATION" ); optionName.put( new Integer( TOPT_ENVIRON ), "ENVIRON" ); optionName.put( new Integer( TOPT_AUTHENTICATION ), "AUTHENTICATION" ); optionName.put( new Integer( TOPT_NewENVIRON ), "NEW-ENVIRON" ); optionName.put( new Integer( TOPT_EXOPL ), "EXOPL" ); optionName.put( new Integer( TOPT_SubliminalMessage ), "SUBLIMINAL-MESSAGE" ); } } /** * Get the string representation of the given option. */ public static String getName( int option ) { init(); Integer opt = new Integer( option ); String result = (String)optionName.get( opt ); if ( result == null ) { result = new String( "UNKNOWN OPTION" ); } opt = null; return result; } public String getName() { return getName( optionCode ); } /** * Is the option is a subject to negotiations? * @param option Telnet option code. * @return true if yes. */ public static boolean isSB( int option ) { switch ( option ) { case 5: case 10: case 11: case 12: case 13: case 14: case 15: case 20: case 24: case 26: case 27: case 28: case 29: case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: case 39: case 255: case 257: return true; default: return false; } } /** * Is the option is a subject to negotiations? * @param option Telnet option code. * @return true if yes. */ public static boolean isSB( TelnetOption option ) { return isSB( option.optionCode ); } } 1.1 J4/src/java/gnu/j4/net/telnet/TelnetOptionConstants.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/TelnetOptionConstants.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/TelnetOptionConstants.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: TelnetOptionConstants.java =================================================================== package gnu.j4.net.telnet; public interface TelnetOptionConstants { /** * TRANSMIT-BINARY. * * Described in RFC 856. */ public final static int TOPT_TransmitBinary = 0; /** * ECHO. * * Described in RFC 857. */ public final static int TOPT_ECHO = 1; /** * SUPPRESS-GO-AHEAD. * * Described in RFC 858. */ public final static int TOPT_SuppressGoAhead = 3; /** * STATUS. * * Subject to subnegotiations, described in RFC 859. * @see topt5 */ public final static int TOPT_STATUS = 5; /** * TIMING-MARK. * * Described in RFC 860. */ public final static int TOPT_TimingMark = 6; /** * RCTE. * * Described in RFC 726. */ public final static int TOPT_RCTE = 7; /** * NAOCRD. * * Subject to subnegotiations, described in RFC 652. * @see topt10 */ public final static int TOPT_NAOCRD = 10; /** * NAOHTS. * * Subject to subnegotiations, described in RFC 653. * @see topt11 */ public final static int TOPT_NAOHTS = 11; /** * NAOHTD. * * Subject to subnegotiations, described in RFC 654. * @see topt12 */ public final static int TOPT_NAOHTD = 12; /** * NAOFFD. * * Subject to subnegotiations, described in RFC 655. * @see topt13 */ public final static int TOPT_NAOFFD = 13; /** * NAOVTS. * * Subject to subnegotiations, described in RFC 656. * @see topt14 */ public final static int TOPT_NAOVTS = 14; /** * NAOVID. * * Subject to subnegotiations, described in RFC 657. * @see topt15 */ public final static int TOPT_NAOVID = 15; /** * EXTEND-ASCII. * * Described in RFC 698. */ public final static int TOPT_ExtendASCII = 17; /** * LOGOUT. * * Described in RFC 727. */ public final static int TOPT_LOGOUT = 18; /** * DET. * * Subject to subnegotiations, described in RFC 1043. * @see topt20 */ public final static int TOPT_DET = 20; /** * TERMINAL-TYPE. * * Subject to subnegotiations, described in RFC 1091. * @see topt24 */ public final static int TOPT_TerminalType = 24; /** * END-OF-RECORD. * * Described in RFC 885. */ public final static int TOPT_EndOfRecord = 25; /** * TUID. * * Subject to subnegotiations, described in RFC 927. * @see topt26 */ public final static int TOPT_TUID = 26; /** * OUTMRK. * * Subject to subnegotiations, described in RFC 933. * @see topt27 */ public final static int TOPT_OUTMRK = 27; /** * TTYLOC. * * Subject to subnegotiations, described in RFC 946. * @see topt28 */ public final static int TOPT_TTYLOC = 28; /** * 3270-REGIME. * * Subject to subnegotiations, described in RFC 1041. * @see topt29 */ public final static int TOPT_t3270reg = 29; /** * X.3-PAD. * * Subject to subnegotiations, described in RFC 1053. * @see topt30 */ public final static int TOPT_X3PAD = 30; /** * NAWS. * * Subject to subnegotiations, described in RFC 1073. * @see topt31 */ public final static int TOPT_NAWS = 31; /** * TERMINAL-SPEED. * * Subject to subnegotiations, described in RFC 1079. * @see topt32 */ public final static int TOPT_TerminalSpeed = 32; /** * TOGGLE-FLOW-CONTROL. * * Subject to subnegotiations, described in RFC 1372. * @see topt33 */ public final static int TOPT_ToggleFlowControl = 33; /** * LINEMODE. * * Subject to subnegotiations, described in RFC 1184. * @see topt34 */ public final static int TOPT_LINEMODE = 34; /** * X-DISPLAY-LOCATION. * * Subject to subnegotiations, described in RFC 1096. * @see topt35 */ public final static int TOPT_XDisplayLocation = 35; /** * ENVIRON. * * Subject to subnegotiations, described in RFC 1408. * @see topt36 */ public final static int TOPT_ENVIRON = 36; /** * AUTHENTICATION. * * Subject to subnegotiations, described in RFC 1416. * @see topt37 */ public final static int TOPT_AUTHENTICATION = 37; /** * NEW-ENVIRON. * * Subject to subnegotiations, described in RFC 1572. * @see topt39 */ public final static int TOPT_NewENVIRON = 39; /** * EXOPL. * * Subject to subnegotiations, described in RFC 861. * @see topt255 */ public final static int TOPT_EXOPL = 255; /** * SUBLIMINAL-MESSAGE. * * Subject to subnegotiations, described in RFC 1097. * @see topt257 */ public final static int TOPT_SubliminalMessage = 257; } 1.1 J4/src/java/gnu/j4/net/telnet/TelnetOptionSB.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/TelnetOptionSB.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/TelnetOptionSB.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: TelnetOptionSB.java =================================================================== package gnu.j4.net.telnet; import java.io.InputStream; import java.io.IOException; import java.io.DataOutputStream; /* * Negotiable telnet option. This class ensures that the option will be * able to negotiate. */ abstract public class TelnetOptionSB extends TelnetOption implements TelnetConstants { public TelnetOptionSB(int option) { super(option); } /** * Perform the negotiations. This is a wrapper. * * @exception IOException when I/O error occurs. */ final protected void negotiate(InputStream in, DataOutputStream out) throws IOException { String buffer = ""; // Read the stream until IAC SE while ( true ) { int c = in.read(); if ( c == IAC ) { int cc = in.read(); if ( cc == SE ) { complain(LOG_DEBUG, "TelnetOptionSB", "Negotiate: '" + buffer + "'"); negotiate(buffer, out); return; } } else { // complain( ""+c ); buffer += (char)c; } } } abstract protected void negotiate(String buffer, DataOutputStream out) throws IOException; } 1.1 J4/src/java/gnu/j4/net/telnet/TelnetStatus.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/TelnetStatus.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/TelnetStatus.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: TelnetStatus.java =================================================================== package gnu.j4.net.telnet; import java.util.BitSet; import java.util.Hashtable; import gnu.j4.core.LogAware; /** * {@link Telnet Telnet} session status. * * In other words, a collection of supported {@link TelnetOption options}, * and in case the options are negotiable, the negotiated parameters. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995, 2000 * @version $Id: TelnetStatus.java,v 1.1 2000/03/13 06:12:28 vt Exp $ */ public class TelnetStatus extends LogAware { /** * Log facility to use. */ public static final String CH_TS = "TelnetStatus"; /** * Is this status mine? * * Used later in {@link #isSupported isSupported} which would throw an * exception if someone will try to find out if the remote supports the * particular option. */ boolean mine; /** * Set of currently supported options. * This is relevant and up-to-date only for the local status, because * I would be able to answer if remote supports some option ONLY if it tells * "DO OPTION". */ protected BitSet supported = new BitSet(512); /** * List of supported sub-negotiable options. */ protected Hashtable supportedSB = new Hashtable(); /** * Set of currently enabled options, either simple and sub-negotiable. * * @see #supported * @see #enabledSB */ protected BitSet enabled = new BitSet(512); /** * List of currently enabled sub-negotiable options. */ protected Hashtable enabledSB = new Hashtable(); /** * Create the instance. * * @param isThisMine true if the constructor is called to create the * local telnet status. */ public TelnetStatus(boolean isThisMine) { mine = isThisMine; } /** * Is the option supported? * * @param option Telnet option code to check * * @exception IllegalAccessException if this is called for the remote * status and the option is not set. * * <strong>Note:</strong> * * Information about the remote status will be gathered along as the * remote [possibly] will send <code>WILL</code> <i>OPTION</i> requests. * * @return true if the option is supported. */ public boolean isSupported(int option) throws IllegalAccessException { boolean set = supported.get( option ); if ( !mine && !set ) { throw new IllegalAccessException("No WILL " + TelnetOption.getName(option) + " was received"); } return set; } /** * Is the option enabled? * @param option Telnet option code * @return true if the option is enabled. */ public boolean isEnabled(int option) { return enabled.get( option ); } /** * Enable option. * * Should be called if the remote <code>WILL</code> <i>OPTION</i>. * * Side effect: if this is not my status, the * <code>support(option)</code> will be called too. * * @param option Option to enable. * * @return true if I can enable option (in other words, if I can support * it). */ public boolean enable(int option) { if ( !mine ) { try { support(option); } catch ( IllegalArgumentException iae ) { complain(LOG_WARNING, CH_TS, "!mine/enable/support:", iae); return false; } } else { try { if ( !isSupported(option) ) { complain(LOG_WARNING, CH_TS, "Attempt to enable non-supported " + TelnetOption.getName(option)); return false; } } catch ( IllegalAccessException iae ) { complain(LOG_WARNING, CH_TS, "mine/enable/isSupported: ", iae); return false; } } enabled.set(option); return true; } /** * Disable option. * * @param option Option to disable. */ public void disable(int option) { if ( !mine ) { // Let's suppose that if remote is able to disable the option, // it at least knows about it support(option); } enabled.clear(option); } /** * Support option. Note that you can't discontinue to support the * option, you can only disable it. * * @param option Option to advertise as supported. * @exception IllegalArgumentException if this is called for the negotiable option. */ public void support(int option) throws IllegalArgumentException { // I can't support the remote negotiable option // in the same way as mine, so I'll just set a bit if ( mine && TelnetOption.isSB(option) ) { throw new IllegalArgumentException("Use support(TelnetOption option) for negotiable options (" + TelnetOption.getName(option ) + ")"); } supported.set( option ); } /** * Support option. Note that you can't discontinue to support the * option, you can only disable it. * * @param option Option to advetise as supported. */ public void support(TelnetOptionSB option) { supported.set(option.optionCode); supportedSB.put(new Integer(option.optionCode), option); } /** * Get the negotiable option. * * @param option Telnet option code. * * @return Option found. */ public TelnetOptionSB getSB(int option) { return (TelnetOptionSB)supportedSB.get(new Integer(option)); } } 1.1 J4/src/java/gnu/j4/net/telnet/package.html CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/package.html?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/package.html?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: package.html =================================================================== <body> <h1>Set of classes implementing the <strong>telnet</strong> protocol</h1> The class, member and method names are funny, but it makes sense to keep them that way because there's a strong dependency between the functionality this package provides and the terminology used in RFCs describing the telnet protocol and options. <p> When in doubt, consult the appropriate RFC. </body> 1.1 J4/src/java/gnu/j4/net/telnet/topt05.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/topt05.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/topt05.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: topt05.java =================================================================== package gnu.j4.net.telnet; import java.io.DataOutputStream; import java.io.PrintStream; import java.io.IOException; /** * {@link Telnet Telnet} option 5 - STATUS. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995, 2000 * @version $Id: topt05.java,v 1.1 2000/03/13 06:12:28 vt Exp $ */ public class topt05 extends toptSR implements TelnetConstants { /** * Log facility to use. */ public static final String CH_5 = "Topt5"; Telnet tn; public topt05(Telnet tn) { super(TOPT_STATUS); this.tn = tn; } protected void send( String SB,DataOutputStream out ) throws IOException { throw new Error("SEND: not implemented"); } protected void is(String SB, DataOutputStream out) throws IOException { int i = 0; boolean done = false; while ( !done ) { int ac = SB.charAt( i++ ), opt = SB.charAt( i++ ); if ( ac != Telnet.SB ) { complain(LOG_DEBUG, CH_5, Telnet.lookupEscape( ac ) + ":" + TelnetOption.getName( opt ) ); } else { while ( true ) { if ( i >= SB.length() ) { break; } int ext = SB.charAt( i++ ); if ( ext != Telnet.SE ) { complain(LOG_DEBUG, CH_5, "ext:" + ext); } else { complain(LOG_DEBUG, CH_5, "end"); break; } } } if ( i >= SB.length() ) { break; } } } } 1.1 J4/src/java/gnu/j4/net/telnet/topt24.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/topt24.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/topt24.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: topt24.java =================================================================== package gnu.j4.net.telnet; import java.io.DataOutputStream; import java.io.PrintStream; import java.io.IOException; import java.util.Vector; import java.util.StringTokenizer; /** * Telnet option 24 - TERMINAL-TYPE. * @see Telnet */ public class topt24 extends toptSR { /** * Log facility to use. */ public static final String CH_24 = "Topt24"; /** * All supported terminal types. */ Vector term = new Vector(); /** * Index of the terminal entry to advertise next. * See the corresponding RFC to find out the rule. * @see #term */ int index = 0; /** * Create the option with the given set of terminals. * @param termSet String of semicolon-delimited supported terminal types. */ public topt24( String termSet ) { super( TOPT_TerminalType ); StringTokenizer st = new StringTokenizer( termSet,":" ); while ( st.hasMoreElements() ) { String terminal = (String)st.nextElement(); if ( term.indexOf( terminal ) == -1 ) { term.addElement( terminal ); } } st = null; if ( term.size() == 0 ) { complain(LOG_DEBUG, CH_24, "Terminal set is empty, default to vt100"); term.addElement("vt100"); } } /** * Report the next available terminal type. * @param _SB Empty :-) * @param out Stream to write the results. * @see #index * @see #term */ protected void send( String _SB,DataOutputStream out ) throws IOException { // VT: FIXME: what the hell is that _SB parameter? out.write( IAC ); out.write( SB ); out.write( TOPT_TerminalType ); out.write( IS ); String tty = (String)term.elementAt( index ); complain(LOG_DEBUG, CH_24, "send: " + tty); out.writeBytes( tty ); out.write( IAC ); out.write( SE ); out.flush(); if ( index < term.size()-1 ) index++; } /** * Not implemented yet. * @param SB Empty :-) * @param out Stream to write the results. */ protected void is( String SB,DataOutputStream out ) throws IOException { throw new Error( "IS: not implemented" ); } } 1.1 J4/src/java/gnu/j4/net/telnet/topt31.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/topt31.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/topt31.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: topt31.java =================================================================== package gnu.j4.net.telnet; import java.io.DataOutputStream; import java.io.PrintStream; import java.io.IOException; import java.util.Vector; import java.awt.Dimension; /** * Telnet option 31 - NAWS - Negotiate About Window Size, RFC1073. * @see Telnet * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995, 2000 * @version $Id: topt31.java,v 1.1 2000/03/13 06:12:28 vt Exp $ */ public class topt31 extends toptSR { /** * Screen dimension. */ Dimension winSize; /** * Create the option with the given set of speeds. * * @param dim Window dimension */ public topt31(Dimension dim) { this(dim.width, dim.height); } /** * Create the option with the given set of speeds. * * @param width Window width * @param height Window height */ public topt31(int width, int height) { super(TOPT_NAWS); winSize = new Dimension(width, height); } /** * Report the window size * * @param _SB Empty :-) * @param out Stream to write the results. * @see #winSize */ protected void send(String _SB, DataOutputStream out) throws IOException { out.write(IAC); out.write(SB); out.write(TOPT_NAWS); out.write(IS); int hiW = winSize.width & 0xff00, loW = winSize.width & 0x00ff, hiH = winSize.height & 0xff00, loH = winSize.height & 0x00ff; put(hiW, out); put(loW, out); put(hiH, out); put(loH, out); out.write(IAC); out.write(SE); out.flush(); } /** * Not implemented yet. * * @param SB Empty :-) * @param out Stream to write the results. */ protected void is(String SB, DataOutputStream out) throws IOException { throw new Error( "IS: not implemented" ); } private void put(int value, DataOutputStream out) throws IOException { complain(LOG_DEBUG, "Topt31", "put:" + value); out.write(value); if ( value == IAC ) { out.write( value ); } } } 1.1 J4/src/java/gnu/j4/net/telnet/topt32.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/topt32.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/topt32.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: topt32.java =================================================================== package gnu.j4.net.telnet; import java.io.DataOutputStream; import java.io.PrintStream; import java.io.IOException; import java.util.Vector; import java.util.StringTokenizer; import java.util.Enumeration; /** * Telnet option 32 - TERMINAL-SPEED. * @see Telnet */ public class topt32 extends toptSR { /** * Log facility to use. */ public static final String CH_32 = "Topt32"; /** * All supported terminal speeds. */ Vector speed = new Vector(); /** * Create the option with the given set of speeds. * * @param speedSet String of comma-delimited supported terminal types. */ public topt32(String speedSet) { super(TOPT_TerminalSpeed); StringTokenizer st = new StringTokenizer(speedSet, ","); while ( st.hasMoreElements() ) { String spd = (String)st.nextElement(); if ( speed.indexOf( spd ) == -1 ) { speed.addElement( spd ); } } st = null; if ( speed.size() == 0 ) { complain(LOG_DEBUG, CH_32, "Speed set is empty, default to 38400"); speed.addElement("38400"); } } /** * Report the next available terminal type. * * @param _SB Empty :-) * @param out Stream to write the results. * @see #index * @see #speed */ protected void send(String _SB, DataOutputStream out) throws IOException { out.write(IAC); out.write(SB); out.write(TOPT_TerminalSpeed); out.write(IS); // VT: FIXME: This construct is suspicious. What if there's just one // element? I guess it will get written twice. Possibly, it's no big // deal, but still not elegant... String spd = null; for ( Enumeration e = speed.elements(); e.hasMoreElements(); ) { spd = (String)e.nextElement(); complain(LOG_DEBUG, CH_32, "send: " + spd); out.writeBytes(spd + ","); } out.writeBytes(spd); out.write(IAC); out.write(SE); out.flush(); } /** * Not implemented yet. * * @param SB Empty :-) * @param out Stream to write the results. */ protected void is(String SB, DataOutputStream out) throws IOException { throw new Error( "IS: not implemented" ); } } 1.1 J4/src/java/gnu/j4/net/telnet/topt33.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/topt33.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/telnet/topt33.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: topt33.java =================================================================== package gnu.j4.net.telnet; import java.io.DataOutputStream; import java.io.PrintStream; /** * Telnet option 34 - TOGGLE-FLOW-CONTROL, RFC1372. * @see telnet * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995, 2000 * @version $Id: topt33.java,v 1.1 2000/03/13 06:12:28 vt Exp $ */ public class topt33 extends toptSR { /** * Log facility to use. */ public static final String CH_33 = "Topt33"; public static final int OFF = toptSR.IS; // 0 public static final int ON = toptSR.SEND; // 1 public static final int RESTART_ANY = 2; public static final int RESTART_XON = 3; public topt33() { super(TOPT_ToggleFlowControl); } protected void negotiate( int action,String SB,DataOutputStream out ) { switch ( action ) { case RESTART_ANY: ... [truncated message content] |
From: CVS B. <vt...@fr...> - 2000-03-13 05:22:27
|
User: vt Date: 00/03/12 22:17:37 Modified: src/java/gnu/j4/service/net SocketService.java Log: Fixed the indentation style, added some documentation. Revision Changes Path 1.10 +39 -6 J4/src/java/gnu/j4/service/net/SocketService.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/net/SocketService.java?annotate=1.10&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/net/SocketService.java?rev=1.10&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/net/SocketService.java.diff?r1=1.10&r2=1.9&cvsroot=jukebox4 ----------------------------------- Index: SocketService.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/service/net/SocketService.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- SocketService.java 2000/03/03 04:20:22 1.9 +++ SocketService.java 2000/03/13 05:17:37 1.10 @@ -39,7 +39,7 @@ * </dl> * * @since Jukebox v3 - * @version $Id: SocketService.java,v 1.9 2000/03/03 04:20:22 vt Exp $ + * @version $Id: SocketService.java,v 1.10 2000/03/13 05:17:37 vt Exp $ * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1998 */ public class SocketService extends ActiveService { @@ -107,10 +107,10 @@ * @param targetName Target host name * @param targerPort Target host port */ - public SocketService( String targetName,int targetPort ) throws UnknownHostException { + public SocketService(String targetName, int targetPort) throws UnknownHostException { // Converting to the (InetAddr,port) constructor - this( InetAddress.getByName( targetName ),targetPort ); + this(InetAddress.getByName(targetName), targetPort); // complain( "constructor: targetName("+targetName // +"), targetPort("+targetPort+")" ); @@ -129,7 +129,7 @@ * @param targetHost Target host address * @param targerPort Target host port */ - public SocketService( InetAddress targetHost,int targetPort ) { + public SocketService(InetAddress targetHost, int targetPort) { this.targetHost = targetHost; this.targetPort = targetPort; // complain( "constructor: targetHost("+targetHost.toString() @@ -148,7 +148,7 @@ * * @param clientSocket Socket to use. */ - public SocketService( Socket clientSocket ) { + public SocketService(Socket clientSocket) { dataSocket = clientSocket; // complain( "constructor: "+clientSocket.toString() ); } @@ -183,11 +183,18 @@ throw new Error("startup: socket and address are NULL???"); } + /** + * Initialize the service when starting up on the existing socket. + */ private void initSocket() { - complain( LOG_DEBUG,LOG_SS,"initSocket" ); + complain(LOG_DEBUG, LOG_SS, "initSocket"); targetHost = dataSocket.getInetAddress(); } + /** + * Initialize the service when starting up on knowing just the host + * name. + */ private void initHost() throws Throwable { complain( LOG_DEBUG,LOG_SS,"initHost: "+targetHost.toString()+":"+targetPort ); @@ -267,10 +274,22 @@ shouldCloseSocket = shouldI; } + /** + * @deprecated Use {@link #getRemoteAddress getRemoteAddress{ instead. + */ public InetAddress remoteAddress() { return targetHost; } + /** + * Get the remote host address. + * + * @return The remote host address. + */ + public InetAddress getRemoteAddress() { + return targetHost; + } + public String toString() { StringBuffer result = new StringBuffer( getClass().getName() ); result.append("@"); @@ -303,7 +322,21 @@ return result.toString(); } + /** + * Get the data socket. + * + * @return data socket. + * + * @throws IllegalStateException if the attempt to get the socket was + * made before the service has started up. + */ public Socket getSocket() { + + if ( !isReady() ) { + + throw new IllegalStateException("Not ready yet"); + } + return dataSocket; } } |
From: CVS B. <vt...@fr...> - 2000-03-13 05:21:54
|
User: vt Date: 00/03/12 22:17:02 Modified: src/java/gnu/j4/service/net Makefile.am Log: Changed the order to make the compilation process obvious. Little slower this way, but it'll go away soon anyway. Revision Changes Path 1.8 +4 -4 J4/src/java/gnu/j4/service/net/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/net/Makefile.am?annotate=1.8&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/net/Makefile.am?rev=1.8&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/net/Makefile.am.diff?r1=1.8&r2=1.7&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/service/net/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Makefile.am 1999/09/14 17:36:02 1.7 +++ Makefile.am 2000/03/13 05:17:02 1.8 @@ -1,10 +1,10 @@ -# $Id: Makefile.am,v 1.7 1999/09/14 17:36:02 vt Exp $ +# $Id: Makefile.am,v 1.8 2000/03/13 05:17:02 vt Exp $ EXTRA_DIST = package.html noinst_PROGRAMS = package -package_SOURCES = ident.java \ - identInfo.java \ - SocketService.java +package_SOURCES = SocketService.java \ + ident.java \ + identInfo.java JAVACX = @JAVACX@ |
From: CVS B. <vt...@fr...> - 2000-03-10 05:37:28
|
User: vt Date: 00/03/09 22:32:59 J4/src/java/gnu/j4/net/telnet - New directory |
From: CVS B. <vt...@fr...> - 2000-03-10 04:54:21
|
User: vt Date: 00/03/09 21:49:34 Modified: . configure.in Log: Better handling of the -green java option (--enable-green). Actually, I don't know what I was smoking when I wrote that code originally. Or, it must've been a late night. Revision Changes Path 1.44 +40 -14 J4/configure.in CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/configure.in?annotate=1.44&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/configure.in?rev=1.44&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/configure.in.diff?r1=1.44&r2=1.43&cvsroot=jukebox4 ----------------------------------- Index: configure.in =================================================================== RCS file: /usr/local/cvs/J4/configure.in,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- configure.in 2000/03/07 00:18:31 1.43 +++ configure.in 2000/03/10 04:49:34 1.44 @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_REVISION($Id: configure.in,v 1.43 2000/03/07 00:18:31 vt Exp $)dnl +AC_REVISION($Id: configure.in,v 1.44 2000/03/10 04:49:34 vt Exp $)dnl dnl I'd like it to read the ./configure-options to allow both the basic set dnl of options, as well as the local set. @@ -101,26 +101,52 @@ GREEN="" fi +AC_MSG_CHECKING(if we're using green threads) + AC_ARG_ENABLE(green, [ --enable-green use the green threads (as opposed to native)], [ - if test "${OS_NAME}" != "Linux"; then - AC_MSG_RESULT(--enable-green is not implemented on anything except Linux - ignored) - else - AC_MSG_RESULT(Using green threads) - fi + case $enableval in + + y|yes) + + if test "${OS_NAME}" != "Linux"; then + AC_MSG_WARN([--enable-green is not checked on this platform - beware]) + else + AC_MSG_RESULT(yes) + fi + GREEN="-green" + ;; + + n|no) + + GREEN="" + AC_MSG_RESULT(no) + ;; + + *) + + AC_MSG_ERROR([argument for --enable-green should be either yes or no]) + ;; + + esac + ], [ - if test "${OS_NAME}" = "Linux"; then - if test -z "$GREEN"; then - AC_MSG_RESULT([OS is Linux, native threads??? You're asking for trouble, but oh well]) - GREEN="" - fi + if test -z "$GREEN" ; then + AC_MSG_RESULT(no) else - GREEN="" + AC_MSG_RESULT(yes) fi -] -) +]) + +dnl Sanity check. Tell the user about the consequences + +if test "${OS_NAME}" = "Linux" ; then + if test -z "$GREEN" ; then + AC_MSG_RESULT([OS is Linux, native threads??? You're asking for trouble, but oh well]) + fi +fi JAVA_OPT="${GREEN} ${JAVA_OPT}" |
From: CVS B. <vt...@fr...> - 2000-03-10 02:45:58
|
User: vt Date: 00/03/09 19:41:30 J4/src/java/gnu/j4/net/ftp - New directory |
From: CVS B. <vt...@fr...> - 2000-03-10 02:39:00
|
User: vt Date: 00/03/09 19:34:22 Modified: src/java/gnu/j4/core ANSI.java AnsiSyslog.java Log: Documentation update and a minor optimization, thanks to the Grace Software's JavaLog source code. Actually, the guys have quite a few good ideas ;) Revision Changes Path 1.4 +2 -10 J4/src/java/gnu/j4/core/ANSI.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/ANSI.java?annotate=1.4&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/ANSI.java?rev=1.4&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/ANSI.java.diff?r1=1.4&r2=1.3&cvsroot=jukebox4 ----------------------------------- Index: ANSI.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/ANSI.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ANSI.java 1999/06/29 04:35:34 1.3 +++ ANSI.java 2000/03/10 02:34:22 1.4 @@ -13,13 +13,13 @@ * </dl> * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1998 - * @version $Id: ANSI.java,v 1.3 1999/06/29 04:35:34 vt Exp $ + * @version $Id: ANSI.java,v 1.4 2000/03/10 02:34:22 vt Exp $ */ public class ANSI { /** * Esc code (0x1b). */ - private static StringBuffer esc; + private static String esc = "\u001b"; /** * Color sequence. @@ -27,14 +27,6 @@ * Responsible for rendering a required color. */ protected String seq; - - /** - * Initialize the {@link #esc esc} buffer with an Escape character. - */ - static { - esc = new StringBuffer( "*" ); - esc.setCharAt( 0,(char)27 ); - } /** * Create the ANSI sequence. 1.5 +41 -1 J4/src/java/gnu/j4/core/AnsiSyslog.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/AnsiSyslog.java?annotate=1.5&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/AnsiSyslog.java?rev=1.5&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/AnsiSyslog.java.diff?r1=1.5&r2=1.4&cvsroot=jukebox4 ----------------------------------- Index: AnsiSyslog.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/AnsiSyslog.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- AnsiSyslog.java 1999/06/29 04:35:34 1.4 +++ AnsiSyslog.java 2000/03/10 02:34:22 1.5 @@ -4,8 +4,46 @@ /** * ANSI colored syslog. + * + * <p> + * + * (after analyzing the color implementation of <a + * href="http://javalog.homestead.com/">Grace Software's Javalog</a>, which + * is amazingly similar to the logging subset of Jukebox in some details + * <i>--vt</i>) + * + * <p> + * + * Well, the color scheme here is fixed. + * + * <ul> + * + * <li> <code>DEBUG</code> facility is lightgray on black, + * + * <li> <code>info</code> is dark cyan on black, + * + * <li> <code>notice</code> is bright white on black, + * + * <li> <code>WARNING</code> is bright yellow on black, + * + * <li> <code>ERR</code> is bright red on black, + * + * <li> <code>CRIT</code> is black on bright white, + * + * <li> <code>ALERT</code> is black on bright yellow, + * + * <li> <code>EMERG</code> is black on bright red. + * + * <ul> + * + * This is not the most flexible solution, and it will look ugly for the + * people who use the translucent xterm backgrounds, but it's the "worse is + * better" option. It's simple, doesn't involve extra code, and functionally + * complete. If I get flooded with the feature requests to make it more + * configurable, I will, but until then - it stays as it is. + * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1998 - * @version $Id: AnsiSyslog.java,v 1.4 1999/06/29 04:35:34 vt Exp $ + * @version $Id: AnsiSyslog.java,v 1.5 2000/03/10 02:34:22 vt Exp $ */ public class AnsiSyslog extends BasicSyslog implements LogLevels, LogConfigKeywords { protected static Hashtable level2color = new Hashtable(); @@ -39,6 +77,7 @@ /** * Wrap the message composed by superclass into the ANSI color escape * sequences. + * * <p> * * Unless: @@ -48,6 +87,7 @@ * <li>{@link BasicSyslog#conf Configuration forbids the ANSI colors} * (doesn't by default). * </ul> + * * @param lr Log record to wrap */ public void composeMessage( StringBuffer buffer,LogRecord lr ) { |
From: CVS B. <vt...@fr...> - 2000-03-08 09:06:32
|
User: vt Date: 00/03/08 02:02:15 Modified: . Makefile.am Removed: . aclocal.m4 Log: Bugfixes Revision Changes Path 1.2 +1 -0 w2gi-stats/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/w2gi-stats/Makefile.am?annotate=1.2&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/w2gi-stats/Makefile.am?rev=1.2&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/w2gi-stats/Makefile.am.diff?r1=1.2&r2=1.1&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/w2gi-stats/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Makefile.am 1999/12/01 15:08:38 1.1 +++ Makefile.am 2000/03/08 09:02:15 1.2 @@ -1 +1,2 @@ SUBDIRS = src +EXTRA_DIST = conf/* |
From: CVS B. <vt...@fr...> - 2000-03-08 07:25:56
|
User: vt Date: 00/03/08 00:21:32 Modified: src/java/gnu/j4/config Configuration.java Log: Fixed the platform dependency, except for the one derived from gnu.j4.LocalConfig. Revision Changes Path 1.24 +74 -70 J4/src/java/gnu/j4/config/Configuration.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Configuration.java?annotate=1.24&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Configuration.java?rev=1.24&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Configuration.java.diff?r1=1.24&r2=1.23&cvsroot=jukebox4 ----------------------------------- Index: Configuration.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/config/Configuration.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- Configuration.java 1999/09/29 04:31:59 1.23 +++ Configuration.java 2000/03/08 07:21:32 1.24 @@ -31,7 +31,7 @@ * target=_top>Java-Apache Project</a> in general and code written by <a * href="mailto:st...@ap...">Stefano Mazzocchi</a> in particular. * - * @version $Id: Configuration.java,v 1.23 1999/09/29 04:31:59 vt Exp $ + * @version $Id: Configuration.java,v 1.24 2000/03/08 07:21:32 vt Exp $ */ public class Configuration extends Hashtable { @@ -100,35 +100,39 @@ * (previous is used as {@link #defaultCfg default configuration} for * it). */ - public static Configuration createChain( String confName,Configuration defaultCfg ) { - File target = new File( confName ), - base = new File( target.getName() ); + public static Configuration createChain(String confName, Configuration defaultCfg) { + + File target = new File(confName), + base = new File(target.getName()); Vector path = new Vector(); String jukebox = "jukebox"; // Read @prefix@/etc/ ... first - path.addElement( new File( gnu.j4.LocalConfig.prefix+"/etc",base.toString() ) ); + path.addElement(new File(gnu.j4.LocalConfig.prefix + + File.separatorChar + + "etc", + base.toString())); // Read $HOME/.jukebox/... second - File home = new File( System.getProperty( "user.home" ),"."+jukebox ); + File home = new File(System.getProperty("user.home"), "."+jukebox); - path.addElement( new File( home,base.toString() ) ); + path.addElement(new File(home, base.toString())); // If the configuration name is absolute, use it as is, otherwise // prepend "./etc/" and make it absolute. if ( !target.isAbsolute() ) { - target = new File( System.getProperty( "user.dir" ),"etc/"+base.toString() ); + target = new File(System.getProperty("user.dir"), "." + base.toString()); } - path.addElement( target ); + path.addElement(target); - return createChain( path,defaultCfg ); + return createChain(path, defaultCfg); } - public static Configuration createChain( Vector path,Configuration defaultCfg ) { + public static Configuration createChain(Vector path, Configuration defaultCfg) { Configuration last = null; for ( Enumeration e = path.elements(); e.hasMoreElements(); ) { @@ -140,21 +144,21 @@ // default. try { - PropertiesReader pr = new PropertiesReader( nextFile.toString() ); + PropertiesReader pr = new PropertiesReader(nextFile.toString()); Configuration next = (last==null) - ? new Configuration( defaultCfg ) - : new Configuration( last ); + ? new Configuration(defaultCfg) + : new Configuration(last); - pr.load( next ); + pr.load(next); last = next; } catch ( IOException ioex ) { - throw new Error( "Not Implemented: "+ioex.toString() ); + throw new Error("Not Implemented: " + ioex.toString()); } } } if ( last == null ) { - last = new Configuration( defaultCfg ); + last = new Configuration(defaultCfg); } return last; @@ -167,8 +171,8 @@ * @return Value as a <code>String</code>, regardless of intended type, * <code>null</code> if not found. */ - public String getString( String key ) { - return getString( key,null ); + public String getString(String key) { + return getString(key, null); } /** @@ -178,8 +182,8 @@ * @return Value as a <code>boolean</code>, <code>false</code> if not * found. */ - public boolean getBoolean( String key ) { - return getBoolean( key,false ); + public boolean getBoolean(String key) { + return getBoolean(key, false); } /** @@ -188,8 +192,8 @@ * @param Keyword to look up. * @return Value as an <code>int</code>, <code>0</code> if not found. */ - public int getInteger( String key ) { - return getInteger( key,0 ); + public int getInteger(String key) { + return getInteger(key, 0); } /** @@ -198,8 +202,8 @@ * @param Keyword to look up. * @return Value as a <code>long</code>, <code>0</code> if not found. */ - public long getLong( String key ) { - return getLong( key,0 ); + public long getLong(String key) { + return getLong(key, 0); } /** @@ -209,8 +213,8 @@ * @return Value as a <code>Vector</code>, <code>null</code> if not * found. */ - public Vector getVector( String key ) { - return getVector( key,null ); + public Vector getVector(String key) { + return getVector(key, null); } /** @@ -222,11 +226,11 @@ * @exception IllegalArgumentException when the object contained here is * neither String nor Vector. */ - public String getString( String key,String defaultValue ) { - Object found = super.get( key ); + public String getString(String key, String defaultValue) { + Object found = super.get(key); if ( found == null && defaultCfg != null ) { - return defaultCfg.getString( key,defaultValue ); + return defaultCfg.getString(key, defaultValue); } if ( found == null ) { @@ -245,31 +249,31 @@ String next = e.nextElement().toString(); if ( result.length() != 0 ) { - result.append( "," ); + result.append(","); } - result.append( next ); + result.append(next); } return result.toString(); } - throw new IllegalArgumentException( key + throw new IllegalArgumentException(key + " expects to see String or Vector, found " - + found.getClass().getName() ); + + found.getClass().getName()); } - public Vector getVector( String key,Vector defaultValue ) { + public Vector getVector(String key, Vector defaultValue) { if ( defaultValue == null ) { defaultValue = new Vector(); } - Object found = super.get( key ); + Object found = super.get(key); if ( found == null && defaultCfg != null ) { - return defaultCfg.getVector( key,defaultValue ); + return defaultCfg.getVector(key, defaultValue); } if ( found == null ) { @@ -282,7 +286,7 @@ Vector dummy = new Vector(); - dummy.addElement( found ); + dummy.addElement(found); return dummy; } @@ -300,18 +304,18 @@ String found = null; try { - found = (String)super.get( key ); + found = (String)super.get(key); } catch ( ClassCastException ccex ) { duplicateKeyword(key); } if ( found == null && defaultCfg != null ) { - return defaultCfg.getBoolean( key,defaultValue ); + return defaultCfg.getBoolean(key, defaultValue); } if ( found != null ) { - return parseBoolean( found ); + return parseBoolean(found); } return defaultValue; @@ -326,7 +330,7 @@ * @exception IllegalArgumentException when the object contained here is * not Integer. */ - public int getInteger( String key,int defaultValue ) { + public int getInteger(String key, int defaultValue) { String found = null; @@ -338,13 +342,13 @@ if ( found == null && defaultCfg != null ) { - return defaultCfg.getInteger( key,defaultValue ); + return defaultCfg.getInteger(key, defaultValue); } if ( found != null ) { try { - return Integer.parseInt( found ); + return Integer.parseInt(found); } catch ( NumberFormatException nfex ) { return defaultValue; } @@ -362,7 +366,7 @@ * @exception IllegalArgumentException when the object contained here is * not Long. */ - public long getLong( String key,long defaultValue ) { + public long getLong(String key, long defaultValue) { String found = null; @@ -374,13 +378,13 @@ if ( found == null && defaultCfg != null ) { - return defaultCfg.getLong( key,defaultValue ); + return defaultCfg.getLong(key, defaultValue); } if ( found != null ) { try { - return Long.parseLong( found ); + return Long.parseLong(found); } catch ( NumberFormatException nfex ) { return defaultValue; } @@ -397,19 +401,19 @@ * @param key The key. * @param value The value. */ - public void put( String key, String value ) { - Object found = super.get( key ); + public void put(String key, String value) { + Object found = super.get(key); if ( found == null ) { - super.put( key,value ); + super.put(key, value); return; } if ( found instanceof Vector ) { Vector vFound = (Vector)found; - if ( vFound.indexOf( value ) == -1 ) { - vFound.addElement( value ); + if ( vFound.indexOf(value) == -1 ) { + vFound.addElement(value); } return; @@ -417,18 +421,18 @@ if ( found instanceof String ) { String first = (String)found; - super.remove( key ); + super.remove(key); Vector set = new Vector(); - set.addElement( first ); - set.addElement( value ); - super.put( key,set ); + set.addElement(first); + set.addElement(value); + super.put(key, set); return; } - throw new IllegalArgumentException( key + throw new IllegalArgumentException(key + " maps to " + found.getClass().getName() - + ", String/Vector expected" ); + + ", String/Vector expected"); } /** @@ -443,34 +447,34 @@ * @param value Value to parse. * @return Boolean value of the string. */ - public static boolean parseBoolean( String value ) { + public static boolean parseBoolean(String value) { String source = value.toLowerCase(); - if ( source.equals( "on" ) - || source.equals( "true" ) - || source.equals( "1" ) - || source.equals( "yes" ) ) { + if ( source.equals("on") + || source.equals("true") + || source.equals("1") + || source.equals("yes") ) { return true; } - if ( source.equals( "off" ) - || source.equals( "false" ) - || source.equals( "0" ) - || source.equals( "no" ) ) { + if ( source.equals("off") + || source.equals("false") + || source.equals("0") + || source.equals("no") ) { return false; } - throw new IllegalArgumentException( "Not boolean: '"+value+"'" ); + throw new IllegalArgumentException("Not boolean: '" + value + "'"); } public String toString() { - String result = "("+super.toString()+")"; + String result = "(" + super.toString() + ")"; if ( defaultCfg == null ) { return result; } - return "(Default: "+defaultCfg.toString()+result+")"; + return "(Default: " + defaultCfg.toString() + result + ")"; } /** |
From: CVS B. <vt...@fr...> - 2000-03-07 00:23:16
|
User: vt Date: 00/03/06 17:18:33 Added: src/java/gnu/j4/io/storage/jdbc .cvsignore ConnectionFactory.java DriverUtil.java JdbcReadHandler.java JdbcStorageSystemDefs.java JdbcStorageSystemImpl.java JdbcWriteHandler.java Makefile.am MultiConnectionFactory.java PoolableConnection.java SingleConnectionFactory.java TransactionContext.java package.html Log: Rehashed a storage system, implemented a JDBC storage system and introduced a skeleton for LDAP storage system. The code is not tested (has been rewritten according to 2.x services implementation). Moreover, it will not compile with JDK 1.2, and there's no configure option to turn it off at the moment. Bottomline: unless you know how to fix it, DON'T USE IT. For stable code, use 1.0p6, for stable 2.x use 2.0p0. Revision Changes Path 1.1 J4/src/java/gnu/j4/io/storage/jdbc/.cvsignore CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/.cvsignore?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/.cvsignore?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: .cvsignore =================================================================== Makefile Makefile.in *.class .deps 1.1 J4/src/java/gnu/j4/io/storage/jdbc/ConnectionFactory.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/ConnectionFactory.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/ConnectionFactory.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: ConnectionFactory.java =================================================================== package gnu.j4.io.storage.jdbc; import java.sql.Connection; import java.sql.SQLException; import gnu.j4.config.Configuration; import gnu.j4.service.Service; /** * SQL connection factory, or connection pool. * * Every time the connection is needed, it should be obtained using this * class' implementation. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 2000 * @version $Id: ConnectionFactory.java,v 1.1 2000/03/07 00:18:32 vt Exp $ */ public interface ConnectionFactory extends Service { /** * Get the SQL connection. * * The object returned that implements the * <code>java.sql.Connection</code> interface must have its * <code>close()</code> method implemented in such a way that instead of * closing the connection, it returns it to the available connections * pool. * * <p> * * <strong>Note:</strong> the database transactions are connection-wide, * so if you need the transaction support, you will have to have the * reference to the same connection object throughout the transaction * context. Otherwise, using the * <code>ConnectionFactory.getConnection()<code> / * <code>Connection.close()</code> pair is recommended, it will not * incur any overhead. * * @return The pooled instance of the connection. */ public Connection getConnection() throws SQLException; /** * Release the connection so it can be reused again. * * @param conn JDBC connection. */ public void releaseConnection(Connection conn); /** * Set the configuration. * * Since the classes that implement this interface will be instantiated * dynamically, they have to be told how to configure themselves. * * @param conf Configuration to use. */ public void setConfiguration(Configuration conf); } 1.1 J4/src/java/gnu/j4/io/storage/jdbc/DriverUtil.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/DriverUtil.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/DriverUtil.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: DriverUtil.java =================================================================== package gnu.j4.io.storage.jdbc; import java.sql.Connection; import java.sql.Driver; import java.util.Properties; import gnu.j4.config.Configuration; import gnu.j4.core.LogAware; /** * This class provides a set of methods to work with JDBC drivers. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> * @version $Id: DriverUtil.java,v 1.1 2000/03/07 00:18:32 vt Exp $ */ class DriverUtil extends LogAware implements JdbcStorageSystemDefs { public static final String CH_DU = "DriverUtil"; /** * Instantiate the JDBC driver. * * @param target Object to complain on behalf of. * * @param conf Configuration to read * * @return Instance of the JDBC connection, if it was possible, or * <code>null</code>, if not. */ static Connection instantiateConnection(LogAware target, Configuration conf) throws Throwable { String jdbcDriverClass = conf.getString(CF_DRIVER_CLASS), url = conf.getString(CF_JDBC_URL), username = conf.getString(CF_JDBC_USERNAME), password = conf.getString(CF_JDBC_PASSWORD); String missing = "Missing:"; if ( jdbcDriverClass == null ) { missing += " " + CF_DRIVER_CLASS; } if ( url == null ) { missing += " " + CF_JDBC_URL; } if ( username == null ) { missing += " " + CF_JDBC_USERNAME; } if ( password == null ) { missing += " " + CF_JDBC_PASSWORD; } if ( !"Missing:".equals(missing) ) { throw new IllegalArgumentException(missing); } Class driverClass = Class.forName(jdbcDriverClass); target.complain(LOG_INFO, CH_DU, "Class OK: " + jdbcDriverClass); Driver driver = (Driver)driverClass.newInstance(); target.complain(LOG_INFO, CH_DU, "Instance OK: " + driver.getClass().getName()); Properties connectionProps = new Properties(); connectionProps.put("user", username); connectionProps.put("password", password); target.complain(LOG_INFO, CH_DU, "connecting as " + username + "/" + password + " to " + url); return driver.connect(url, connectionProps); } } 1.1 J4/src/java/gnu/j4/io/storage/jdbc/JdbcReadHandler.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/JdbcReadHandler.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/JdbcReadHandler.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: JdbcReadHandler.java =================================================================== package gnu.j4.io.storage; import java.io.IOException; import java.sql.Connection; import gnu.j4.io.storage.ReadHandler; /** * This class provides a wrapper for all the JDBC read handlers. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 2000 * @version $Id: JdbcReadHandler.java,v 1.1 2000/03/07 00:18:32 vt Exp $ */ abstract public class JdbcReadHandler implements ReadHandler { /** * Get the object from the storage, using the given instance of the * connection. * * @param ID Storage ID to select the object[s] by. * @param conn Instance of connection to use to get the object. * * @throws IOException if there's a problem with the back end. */ public Object get(StorageID ID, Object conn) throws IOException { // ID is already checked for null above // Now, let's make sure the conn is a JDBC Connection object. try { return get(ID, (Connection)conn); } catch ( ClassCastException ccex ) { throw new IllegalArgumentException("Expected JDBC Connection, got " + conn.getClass().getName() + " instead"); } } /** * Use this method to implement the database access logic. */ abstract protected Object get(StorageID ID, Connection conn) throws IOException; } 1.1 J4/src/java/gnu/j4/io/storage/jdbc/JdbcStorageSystemDefs.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/JdbcStorageSystemDefs.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/JdbcStorageSystemDefs.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: JdbcStorageSystemDefs.java =================================================================== package gnu.j4.io.storage.jdbc; import gnu.j4.io.storage.StorageSystemPoolDefs; /** * The constants used by the storage system. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 2000 * @version $Id: JdbcStorageSystemDefs.java,v 1.1 2000/03/07 00:18:32 vt Exp $ */ public interface JdbcStorageSystemDefs extends StorageSystemPoolDefs { /** * Configuration keyword for the driver class. */ public static final String CF_DRIVER_CLASS = "jdbc.driver.class"; /** * Default driver class. */ public static final String CF_DEFAULT_DRIVER_CLASS = "weblogic.jdbc.mssqlserver4.Driver"; /** * Configuration keyword for the JDBC data source URL. */ public static final String CF_JDBC_URL = "jdbc.url"; /** * Configuration keyword for the JDBC user name. */ public static final String CF_JDBC_USERNAME = "jdbc.username"; /** * Configuration keyword for the JDBC password. */ public static final String CF_JDBC_PASSWORD = "jdbc.password"; /** * Configuration keyword for the {@link ConnectionFactory * ConnectionFactory} implementation class. */ public static final String CF_FACTORY_CLASS = "jdbc.factory.class"; /** * Default connection factory implementation class. */ public static final String CF_DEFAULT_FACTORY_CLASS = "gnu.j4.io.storage.jdbc.MultiConnectionFactory"; } 1.1 J4/src/java/gnu/j4/io/storage/jdbc/JdbcStorageSystemImpl.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/JdbcStorageSystemImpl.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/JdbcStorageSystemImpl.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: JdbcStorageSystemImpl.java =================================================================== package gnu.j4.io.storage.jdbc; import java.io.IOException; import java.sql.Connection; import java.sql.SQLException; import java.util.Hashtable; import gnu.j4.config.Configuration; import gnu.j4.service.ServiceUnavailableException; import gnu.j4.io.storage.DispatcherStorageSystem; /** * JDBC Storage System implementation, using the resource pooling. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 2000 * @version $Id: JdbcStorageSystemImpl.java,v 1.1 2000/03/07 00:18:32 vt Exp $ */ public class JdbcStorageSystemImpl extends DispatcherStorageSystem implements JdbcStorageSystemDefs { /** * Log facility to use. */ public static final String CH_JSS = "StorageImpl"; /** * The connection factory. */ protected ConnectionFactory cf; /** * Create the instance. * * @param conf Configuration composed by the entity that calls this * constructor. */ public JdbcStorageSystemImpl(Configuration conf) { super(conf); // Provide the defaults if ( conf.getString(CF_FACTORY_CLASS) == null ) { complain(LOG_WARNING, CH_JSS, "missing configuration parameter '" + CF_FACTORY_CLASS + "', using default " + CF_DEFAULT_FACTORY_CLASS); conf.put(CF_FACTORY_CLASS, CF_DEFAULT_FACTORY_CLASS); } } /** * @return true if the connection factory has been successfully * instantiated. */ protected void instantiateConnectionFactory() throws InterruptedException, Throwable { Class factoryClass = Class.forName(conf.getString(CF_FACTORY_CLASS)); complain(LOG_INFO, CH_JSS, "Factory: " + factoryClass.getName()); cf = (ConnectionFactory)factoryClass.newInstance(); cf.setConfiguration(conf); if ( !cf.start().waitFor() ) { throw new ServiceUnavailableException("Connection factory startup failed"); } addDependant(cf); } /** * Start the storage system. * * Check the preconditions. * * @return true if startup's OK. */ protected void startup() throws InterruptedException, Throwable { super.startup(); instantiateConnectionFactory(); } protected Object getConnection() throws Throwable { return cf.getConnection(); } protected void closeConnection(Object conn) throws Throwable { ((Connection)conn).close(); } } 1.1 J4/src/java/gnu/j4/io/storage/jdbc/JdbcWriteHandler.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/JdbcWriteHandler.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/JdbcWriteHandler.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: JdbcWriteHandler.java =================================================================== package gnu.j4.io.storage; import java.io.IOException; import java.sql.Connection; import gnu.j4.io.storage.WriteHandler; /** * This class provides a wrapper for all the JDBC write handlers. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 2000 * @version $Id: JdbcWriteHandler.java,v 1.1 2000/03/07 00:18:32 vt Exp $ */ abstract public class JdbcWriteHandler implements WriteHandler { /** * Put the object into the storage, using the given instance of the * connection. * * @param target Object to store. * @param conn Instance of connection to use to get the object. */ public void put(Storable target, Object conn) throws IOException { // ID is already checked for null above // Now, let's make sure the conn is a JDBC Connection object. try { put(target, (Connection)conn); } catch ( ClassCastException ccex ) { throw new IllegalArgumentException("Expected JDBC Connection, got " + conn.getClass().getName() + " instead"); } } /** * Use this method to implement the database access logic. */ abstract protected void get(StorageID ID, Connection conn) throws IOException; } 1.1 J4/src/java/gnu/j4/io/storage/jdbc/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/Makefile.am?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/Makefile.am?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== noinst_PROGRAMS = package package_SOURCES = ConnectionFactory.java \ DriverUtil.java \ JdbcReadHandler.java \ JdbcStorageSystemDefs.java \ JdbcStorageSystemImpl.java \ JdbcWriteHandler.java \ MultiConnectionFactory.java \ PoolableConnection.java \ SingleConnectionFactory.java \ TransactionContext.java JAVACX = @JAVACX@ SUFFIXES = .java .class .java.class: @ ${ECHO} "Making $<" @ ${JAVACX} $< package: $(package_OBJECTS) $(package_DEPENDENCIES) clean-compile: rm -f *.class clean-generic: rm -f *~ 1.1 J4/src/java/gnu/j4/io/storage/jdbc/MultiConnectionFactory.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/MultiConnectionFactory.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/MultiConnectionFactory.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: MultiConnectionFactory.java =================================================================== package gnu.j4.io.storage.jdbc; import java.sql.Connection; import java.sql.SQLException; import java.util.Properties; import java.util.Hashtable; import gnu.j4.config.Configuration; import gnu.j4.service.PassiveService; import gnu.j4.service.ResourcePool; import gnu.j4.service.Service; import gnu.j4.service.ServiceUnavailableException; /** * Connection factory that provides the {@link PoolableConnection virtual * JDBC connections}. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> * @version $Id: MultiConnectionFactory.java,v 1.1 2000/03/07 00:18:32 vt Exp $ */ public class MultiConnectionFactory extends ResourcePool implements ConnectionFactory, JdbcStorageSystemDefs { /** * Log facility to use. */ public static final String CH_MCF = "ConnectionFactory/multi"; public static final String CH_MCF_STARTUP = CH_MCF + "/startup"; public static final String CH_MCF_SHUTDOWN = CH_MCF + "/shutdown"; /** * Master configuration. */ protected Configuration conf = null; /** * Mapping from the {@link PoolableConnection PoolableConnection} * allocated to the client to its {@link * MultiConnectionFactory.ConnectionService internal counterpart}. */ protected Hashtable connectionPool = new Hashtable(); /** * No-argument constructor. * * Exists so it's possible to instantiate an instance with * <code>Class.newInstance()</code>. * * <p> * * Keep in mind, though, that unless you {@link #setConfiguration set * the configuration}, you would not be able to use this object. */ public MultiConnectionFactory() { } /** * Create a new factory using a given configuration. * * @param conf The configuration to use. */ public MultiConnectionFactory(Configuration conf) { super(conf.getInteger(CF_POOL_MINSTART, 1), conf.getInteger(CF_POOL_MAXKEEP, 5), conf.getInteger(CF_POOL_MINSPARE, 1), conf.getInteger(CF_POOL_MAXSPARE, 2)); this.conf = conf; } /** * Get the connection instance. * * The connection object returned is not a * <code>java.sql.Connection</code>, but the {@link PoolableConnection * PoolableConnection} that tracks the usage and shares the transaction * contexts properly. * * @return The JDBC connection instance. */ public Connection getConnection() throws SQLException { // This method doesn't have to be synchronized because the real // sharing point is ResourcePool.getResource() try { ConnectionService cs = (ConnectionService)getResource(); PoolableConnection pc = new PoolableConnection(cs.getConnection(), this); // This is done so I can find out what cs is responsible for // handling this pc when I release it connectionPool.put(pc, cs); return pc; } catch ( InterruptedException iex ) { complain(LOG_ERR, CH_MCF, "Interrupted:", iex); throw new SQLException("Interrupted, see the earlier log message for details"); } catch ( ServiceUnavailableException suex ) { complain(LOG_ERR, CH_MCF, "Unavailable:", suex); throw new SQLException("Unavailable, see the earlier log message for details"); } } /** * Release the connection. */ public synchronized void releaseConnection(Connection conn) { PoolableConnection pc = (PoolableConnection)conn; releaseResource((Service)connectionPool.get(pc)); } /** * Set the configuration. * * @param conf Configuration to use from now on. * * @throws IllegalStateException if the configuration has already been * set, or the service is running (in other words, set the configuration * first, then start the service). */ public void setConfiguration(Configuration conf) { if ( isEnabled() ) { throw new IllegalStateException("Can't set the configuration when already running"); } if ( this.conf != null ) { throw new IllegalStateException("Configuration is already set to: " + conf.toString()); } if ( conf.getString(CF_DRIVER_CLASS) == null ) { complain(LOG_WARNING, CH_MCF, "missing configuration parameter '" + CF_DRIVER_CLASS + "', using default " + CF_DEFAULT_DRIVER_CLASS); conf.put(CF_DRIVER_CLASS, CF_DEFAULT_DRIVER_CLASS); } this.conf = conf; super.minStart = conf.getInteger(CF_POOL_MINSTART, 1); super.maxKeep = conf.getInteger(CF_POOL_MAXKEEP, 5); super.minSpare = conf.getInteger(CF_POOL_MINSPARE, 1); super.maxSpare = conf.getInteger(CF_POOL_MAXSPARE, 2); } /** * Wait for all the connections to be released (implicitly) and close * the JDBC driver's connection as well. */ protected void shutdown() throws InterruptedException { complain(LOG_INFO, CH_MCF_SHUTDOWN, "shutting down..."); complain(LOG_ALERT, CH_MCF_SHUTDOWN, "Close the JDBC driver!"); super.shutdown(); } /** * Start. * * @throws IllegalStateException if the configuration is missing. */ protected void startup() throws InterruptedException, Throwable { if ( conf == null ) { // This is an exception, not a return, because it means the // programmer's error, not the installation misconfiguration. throw new IllegalStateException("Can't start without configuration set"); } super.startup(); // At this point we're ready to roll } /** * Create a new guarded resource. * * @return a connection wrapper. */ protected Service createResource() throws ServiceUnavailableException { try { Connection conn = DriverUtil.instantiateConnection(this, conf); return new ConnectionService(conn); } catch ( Throwable t ) { throw new ServiceUnavailableException(t); } } /** * Class that wraps the <code>java.sql.Connection</code> so it * implements the {@link gnu.j4.service.Service Service} interface. * * <p> * * This class doesn't have to implement the * <code>java.sql.Connection</code> interface itself, because that is * handled by {@link PoolableConnection PoolableConnection}. */ protected class ConnectionService extends PassiveService { protected Connection conn; ConnectionService(Connection conn) { this.conn = conn; } protected void startup() throws InterruptedException { } protected void shutdown() throws InterruptedException { } protected Connection getConnection() { return conn; } } } 1.1 J4/src/java/gnu/j4/io/storage/jdbc/PoolableConnection.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/PoolableConnection.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/PoolableConnection.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: PoolableConnection.java =================================================================== package gnu.j4.io.storage.jdbc; import java.sql.*; import java.util.*; import gnu.j4.core.LogAware; /** * {@link java.sql.Connection java.sql.Connection} with a modified behavior. * * Since we have to keep track on the connections provided to the * clients, this class keeps in touch with the connection factory and * lets it know when its {@link #close close()} method is called, so the * connection doesn't get wasted, but is returned to the pool instead. * * <p> * * VT: FIXME #1: The JDBC driver currently used throws the * <code>java.lang.AbstractMethodException</code> on attempt to perform the * <code>getTypeMap()</code> when run under JDK 1.2. Reason for that is that * the driver has been implemented for JDBC 2.0, not JDBC 2.1 supplied with * JDK 1.2. * * <p> * * VT: FIXME #2: The {@link ConnectionStatus#pushStatus pushStatus()} and * {@link ConnectionStatus#popStatus popStatus} methods are called at the * start and end of every transaction, and they make a database calls, which * might not be a good idea, depending on the implementation. As a * consequence, this is a possible bottleneck, thus has to be investigated * further. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> * @version $Id: PoolableConnection.java,v 1.1 2000/03/07 00:18:32 vt Exp $ */ class PoolableConnection extends LogAware implements Connection { /** * Log facility to use. */ public static final String CH_PC = "PoolableConn"; /** * Initial connection status. */ protected ConnectionStatus connectionContext; /** * The JDBC connection to work as a bridge for. * * All the methods except {@link #close close} are passed directly to it. */ protected Connection master; /** * The connection factory to notify when this connection is closed. */ protected ConnectionFactory cf; protected class ConnectionStatus { boolean autoCommit; boolean readOnly; String catalog; int transactionIsolation; // Specific to JDK 1.2 // Map typeMap; ConnectionStatus(Connection conn) throws SQLException { autoCommit = conn.getAutoCommit(); readOnly = conn.isReadOnly(); catalog = conn.getCatalog(); transactionIsolation = conn.getTransactionIsolation(); // typeMap = conn.getTypeMap(); } void restore(Connection conn) throws SQLException { if ( !conn.getAutoCommit() ) { conn.commit(); } conn.setAutoCommit(autoCommit); conn.setReadOnly(readOnly); conn.setCatalog(catalog); conn.setTransactionIsolation(transactionIsolation); // conn.setTypeMap(typeMap); } } /** * Create the instance. * * @param master The JDBC connection to work as a bridge for. * * @param cf The connection factory to notify when this connection is * closed. */ PoolableConnection(Connection master, ConnectionFactory cf) throws SQLException { if ( master == null ) { throw new IllegalArgumentException("Master is null, unacceptable"); } if ( cf == null ) { throw new IllegalArgumentException("Factory is null, unacceptable"); } this.master = master; this.cf = cf; pushStatus(); } /** * Check the connection status. * * Used to prevent the API user from getting the mysterious * <code>NullPointerException</code>. This happens when the * <code>close()</code> method has already been called, but the instance * hasn't been released and tried to be used again. * * @exception IllegalStateException when the master connection is * already <code>null</code>. */ protected void checkStatus() { if ( master == null ) { throw new IllegalStateException("Probably you're using the instance you close()d"); } } public void clearWarnings() throws SQLException { checkStatus(); master.clearWarnings(); } /** * Close the connection. * * This is one of the few methods that doesn't directly call the * underlying {@link #master master connection}. Instead, it notifies * the connection factory that this connection may be reused. */ public synchronized void close() throws SQLException { try { checkStatus(); popStatus(); master = null; } finally { // This has to happen regardless of all other problems cf.releaseConnection(this); complain(LOG_DEBUG, CH_PC, "released"); } } public void commit() throws SQLException { checkStatus(); master.commit(); } public Statement createStatement() throws SQLException { checkStatus(); return master.createStatement(); } public void finalize() throws Throwable { if ( master != null ) { close(); } } public boolean getAutoCommit() throws SQLException { checkStatus(); complain(LOG_DEBUG, CH_PC, "dangerous: getAutoCommit()"); return master.getAutoCommit(); } public String getCatalog() throws SQLException { checkStatus(); return master.getCatalog(); } public DatabaseMetaData getMetaData() throws SQLException { checkStatus(); return master.getMetaData(); } public int getTransactionIsolation() throws SQLException { checkStatus(); complain(LOG_DEBUG, CH_PC, "dangerous: getTransactionIsolation()"); return master.getTransactionIsolation(); } public SQLWarning getWarnings() throws SQLException { checkStatus(); return master.getWarnings(); } /** * Is the connection closed. * * Another method that is not telling you a truth. */ public boolean isClosed() throws SQLException { return (master == null); } public boolean isReadOnly() throws SQLException { checkStatus(); complain(LOG_DEBUG, CH_PC, "dangerous: isReadOnly()"); return master.isReadOnly(); } public String nativeSQL(String sql) throws SQLException { checkStatus(); return master.nativeSQL(sql); } protected void popStatus() throws SQLException { connectionContext.restore(master); } public CallableStatement prepareCall(String sql) throws SQLException { checkStatus(); return master.prepareCall(sql); } public PreparedStatement prepareStatement(String sql) throws SQLException { checkStatus(); return master.prepareStatement(sql); } protected void pushStatus() throws SQLException { connectionContext = new ConnectionStatus(master); } public void rollback() throws SQLException { checkStatus(); master.rollback(); } public void setAutoCommit(boolean autoCommit) throws SQLException { checkStatus(); complain(LOG_DEBUG, CH_PC, "dangerous: setAutoCommit(" + autoCommit + ")"); master.setAutoCommit(autoCommit); } public void setCatalog(String catalog) throws SQLException { checkStatus(); master.setCatalog(catalog); } public void setReadOnly(boolean readOnly) throws SQLException { checkStatus(); complain(LOG_DEBUG, CH_PC, "dangerous: setReadOnly(" + readOnly + ")"); master.setReadOnly(readOnly); } public void setTransactionIsolation(int level) throws SQLException { checkStatus(); complain(LOG_DEBUG, CH_PC, "dangerous: setTransactionIsolation(" + level + ")"); master.setTransactionIsolation(level); } } 1.1 J4/src/java/gnu/j4/io/storage/jdbc/SingleConnectionFactory.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/SingleConnectionFactory.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/SingleConnectionFactory.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: SingleConnectionFactory.java =================================================================== package gnu.j4.io.storage.jdbc; import java.sql.Connection; import java.sql.Driver; import java.sql.SQLException; import java.util.Properties; import gnu.j4.config.Configuration; import gnu.j4.service.PassiveService; import gnu.j4.service.ServiceUnavailableException; /** * Connection factory that has only one instance of the connection, but * pretends to be a full-fledged connection pool. * * <p> * * This class should be used for debugging purposes only. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> * @version $Id: SingleConnectionFactory.java,v 1.1 2000/03/07 00:18:32 vt Exp $ */ public class SingleConnectionFactory extends PassiveService implements ConnectionFactory, JdbcStorageSystemDefs { /** * Log facility to use. */ public static final String CH_SCF = "ConnectionFactory/single"; public static final String CH_SCF_STARTUP = CH_SCF + "/startup"; public static final String CH_SCF_SHUTDOWN = CH_SCF + "/shutdown"; protected Configuration conf = null; protected Connection conn = null; /** * Current connection owner thread, if any. */ protected Thread owner = null; /** * Current connection owner's nesting level. */ protected int nesting = 0; /** * JDBC driver. */ protected Driver driver = null; /** * No-argument constructor. * * Exists so it's possible to instantiate an instance with * <code>Class.newInstance()</code>. * * <p> * * Keep in mind, though, that unless you {@link #setConfiguration set * the configuration}, you would not be able to use this object. */ public SingleConnectionFactory() { } /** * Create a new factory using a given configuration. * * @param conf The configuration to use. */ public SingleConnectionFactory(Configuration conf) { this.conf = conf; } /** * Get the connection instance. * * The connection object returned is not a * <code>java.sql.Connection</code>, but the {@link PoolableConnection * PoolableConnection} that tracks the usage and shares the transaction * contexts properly. * * @return The JDBC connection instance. */ public synchronized Connection getConnection() throws SQLException { Thread current = Thread.currentThread(); if ( current == owner ) { // This is a nested request, so just increase the nesting level // and leave nesting++; complain(LOG_DEBUG, CH_SCF, "Nesting connection: " + nesting); return new PoolableConnection(conn, this); } while ( nesting > 0 ) { complain(LOG_DEBUG, CH_SCF, "Waiting for a free connection instance..."); try { wait(); } catch ( InterruptedException iex ) { complain(LOG_WARNING, CH_SCF, "Interrupted, returning null, expect troubles"); return null; } } complain(LOG_DEBUG, CH_SCF, "Got connection"); nesting++; owner = current; return new PoolableConnection(conn, this); } /** * Release the connection. */ public synchronized void releaseConnection(Connection conn) { if ( conn == null ) { throw new IllegalArgumentException("Don't allow null here"); } if ( !(conn instanceof PoolableConnection) ) { throw new IllegalArgumentException("PoolableConnection expected, got " + conn.getClass().getName() + " instead"); } Thread current = Thread.currentThread(); if ( current != owner || owner == null ) { throw new IllegalStateException("Not owner"); } if ( --nesting == 0 ) { complain(LOG_DEBUG, CH_SCF, "Releasing connection"); owner = null; notify(); return; } complain(LOG_DEBUG, CH_SCF, "Un-nesting connection: " + nesting); } /** * Set the configuration. * * @param conf Configuration to use from now on. * * @throws IllegalStateException if the configuration has already been * set. */ public void setConfiguration(Configuration conf) { if ( this.conf != null ) { throw new IllegalStateException("Configuration is already set to: " + conf.toString()); } if ( conf.getString(CF_DRIVER_CLASS) == null ) { complain(LOG_WARNING, CH_SCF, "missing configuration parameter '" + CF_DRIVER_CLASS + "', using default " + CF_DEFAULT_DRIVER_CLASS); conf.put(CF_DRIVER_CLASS, CF_DEFAULT_DRIVER_CLASS); } this.conf = conf; } /** * Start. * * @throws IllegalStateException if the configuration is missing. */ protected void startup() throws InterruptedException, Throwable { if ( conf == null ) { // This is an exception, not a return, because it means the // programmer's error, not the installation misconfiguration. throw new IllegalStateException("Can't start without configuration set"); } conn = DriverUtil.instantiateConnection(this, conf); if ( conn == null ) { // If we ever get to this point (usually, the DriverUtil // should've thrown the exception), we have to complain loudly. throw new ServiceUnavailableException("Wasn't able to instantiate the connection"); } // At this point we're ready to roll } /** * Wait for all the connections to be released and close the JDBC * driver's connection as well. * * @throws InterruptedException if this thread was interrupted by * another thread. * * @throws Throwable In fact, this will be most likely * <code>java.sql.SQLException</code>. Since I can't really do anything * with it, I just throw it up. */ protected void shutdown() throws InterruptedException, Throwable { complain(LOG_INFO, CH_SCF_SHUTDOWN, "shutting down..."); while ( nesting > 0 ) { complain(LOG_INFO, CH_SCF_SHUTDOWN, "waiting for connections to be released..."); Thread.sleep(5000); } conn.close(); conn = null; driver = null; } } 1.1 J4/src/java/gnu/j4/io/storage/jdbc/TransactionContext.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/TransactionContext.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/TransactionContext.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: TransactionContext.java =================================================================== package gnu.j4.io.storage.jdbc; import java.sql.Connection; import java.sql.SQLException; import gnu.j4.core.LogAware; /** * The transaction context. * * The purpose is to allow the nested calls without commiting behind every * corner. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> * @version $Id: TransactionContext.java,v 1.1 2000/03/07 00:18:32 vt Exp $ */ public class TransactionContext extends LogAware { /** * Connection to monitor the transaction status of. */ protected Connection conn = null; /** * Transaction nesting level. */ protected int nestingLevel = 0; /** * Create a new transaction context. * * @param conn The connection to monitor. */ public TransactionContext(Connection conn) { this.conn = conn; } /** * Start the transaction context. */ public void open() { nestingLevel++; } /** * Close the transaction context. * * If the transaction being processed is not a toplevel transaction * within a context, do nothing. Otherwise, commit. * * @throws SQLException if there was a problem commiting the connection. */ public void close() throws SQLException { if ( --nestingLevel == 00 ) { conn.commit(); } } } 1.1 J4/src/java/gnu/j4/io/storage/jdbc/package.html CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/package.html?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/jdbc/package.html?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: package.html =================================================================== <body> <h1>JDBC Storage System implementation. </h1> The classes in this package implement the storage system using the relational database server as a back end. Connection pooling is used to optimize the performance on the high load. </body> |
From: CVS B. <vt...@fr...> - 2000-03-07 00:22:42
|
User: vt Date: 00/03/06 17:18:32 Modified: src/java/gnu/j4/io/storage .cvsignore Makefile.am Added: src/java/gnu/j4/io/storage DispatcherStorageSystem.java ReadHandler.java StorageSystemPoolDefs.java WriteHandler.java Log: Rehashed a storage system, implemented a JDBC storage system and introduced a skeleton for LDAP storage system. The code is not tested (has been rewritten according to 2.x services implementation). Moreover, it will not compile with JDK 1.2, and there's no configure option to turn it off at the moment. Bottomline: unless you know how to fix it, DON'T USE IT. For stable code, use 1.0p6, for stable 2.x use 2.0p0. Revision Changes Path 1.3 +0 -1 J4/src/java/gnu/j4/io/storage/.cvsignore CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/.cvsignore?annotate=1.3&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/.cvsignore?rev=1.3&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/.cvsignore.diff?r1=1.3&r2=1.2&cvsroot=jukebox4 ----------------------------------- Index: .cvsignore =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/io/storage/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- .cvsignore 1999/08/12 22:09:06 1.2 +++ .cvsignore 2000/03/07 00:18:32 1.3 @@ -1,5 +1,4 @@ Makefile Makefile.in -LogAware.java *.class .deps 1.4 +7 -3 J4/src/java/gnu/j4/io/storage/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/Makefile.am?annotate=1.4&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/Makefile.am?rev=1.4&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/Makefile.am.diff?r1=1.4&r2=1.3&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/io/storage/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Makefile.am 2000/03/06 17:35:10 1.3 +++ Makefile.am 2000/03/07 00:18:32 1.4 @@ -1,9 +1,13 @@ -SUBDIRS = fs +SUBDIRS = fs jdbc ldap noinst_PROGRAMS = package -package_SOURCES = Storable.java \ +package_SOURCES = DispatcherStorageSystem.java \ + ReadHandler.java \ + Storable.java \ StorageID.java \ - StorageSystem.java + StorageSystem.java \ + StorageSystemPoolDefs.java \ + WriteHandler.java JAVACX = @JAVACX@ 1.1 J4/src/java/gnu/j4/io/storage/DispatcherStorageSystem.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/DispatcherStorageSystem.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/DispatcherStorageSystem.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: DispatcherStorageSystem.java =================================================================== package gnu.j4.io.storage; import java.io.IOException; import java.util.Hashtable; import gnu.j4.config.Configuration; import gnu.j4.service.PassiveService; /** * Storage system implementation. * * <p> * * This implementation uses the <strong>Dispatcher</strong> pattern. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 2000 * @version $Id: DispatcherStorageSystem.java,v 1.1 2000/03/07 00:18:32 vt Exp $ */ abstract public class DispatcherStorageSystem extends PassiveService implements StorageSystem { /** * Log facility to use. */ public static final String CH_SSI = "StorageImpl"; /** * The configuration. */ protected Configuration conf; /** * The read handler map. * * The key is the class name to store, the value is the handler object. */ protected Hashtable readHandlerMap = new Hashtable(); /** * The write handler map. * * The key is the class name to store, the value is the handler object. */ protected Hashtable writeHandlerMap = new Hashtable(); /** * Create the instance. * * @param conf Configuration composed by the entity that calls this * constructor. */ public DispatcherStorageSystem(Configuration conf) { this.conf = conf; } /** * Get the object from the back end. * * @param id Storage identifier. * * @return Object or collection of objects that matches the given * storage ID. * * @exception IOException Any problem with the back-end results in this. */ public Object get(StorageID id) throws IOException { if ( !isReady() ) { throw new IllegalStateException("Wait until I'm ready or start me"); } if ( id == null ) { throw new IllegalArgumentException("Don't accept null ID"); } Object dummyRH = readHandlerMap.get(id.getClass().getName()); if ( dummyRH == null ) { throw new IOException("Don't have a handler for " + id.getClass().getName()); } ReadHandler rh = null; try { rh = (ReadHandler)dummyRH; } catch ( ClassCastException ccex ) { throw new IOException("Expected ReadHandler, got " + dummyRH.getClass().getName() + " for " + id.getClass().getName()); } complain(LOG_DEBUG, CH_SSI, "Request class: " + id.getClass().getName()); complain(LOG_DEBUG, CH_SSI, "Resolved handler: " + rh.getClass().getName()); // At this point, we're ready to request the back end connection Object conn = null; try { conn = getConnection(); return rh.get(id, conn); } catch ( Throwable t ) { // The only way I can handle something I don't know about is to // throw it up throw new IOException(t.getMessage()); } finally { // This has to happen no matter what else happens. try { closeConnection(conn); } catch ( Throwable t ) { // And again, I can't fix it here, but this time the result // or the failure exception is being already returned, so // the only thing I can do about it is complain. complain(LOG_ERR, CH_SSI, "Unavoidable:", t); } } } /** * Store the given object in the database. * * @param target Object to store. * * @exception IOException Any problem with the back-end results in this. */ public void put(Storable target) throws IOException { if ( !isReady() ) { throw new IllegalStateException("Wait until I'm ready or start me"); } if ( target == null ) { throw new IllegalArgumentException("Don't accept null target"); } WriteHandler wh = (WriteHandler)writeHandlerMap.get(target.getClass().getName()); if ( wh == null ) { throw new IOException("Don't have a handler for " + target.getClass().getName()); } Object conn = null; try { conn = getConnection(); wh.put(target, conn); } catch ( Throwable t ) { // The only way I can handle something I don't know about is to // throw it up throw new IOException(t.getMessage()); } finally { // This has to happen no matter what else happens. try { closeConnection(conn); } catch ( Throwable t ) { // And again, I can't fix it here, but this time the result // or the failure exception is being already returned, so // the only thing I can do about it is complain. complain(LOG_ERR, CH_SSI, "Unavoidable:", t); } } } /** * A placeholder to put the handler registration sequence. * * @see #registerReadHandler * @see #registerWriteHandler */ protected void registerHandlers() { complain(LOG_ERR, CH_SSI, "Template registerHandlers() called, you have to implement it"); } /** * Register a read handler. * * When calling {@link #get get()}, the class of the parameter will be * used as a key to extract the actual handler. Then, the parameter will * be passed to the handler and result of a call returned. * * @param className The class name of the parameter for the {@link #get get()} method. * * @param handler The handler expected to handle that class. */ public void registerReadHandler(String className, Object handler) { complain(LOG_DEBUG, CH_SSI, "read handler (" + className + "," + handler.getClass().getName()); if ( !(handler instanceof ReadHandler) ) { throw new IllegalArgumentException("Expected ReadHandler, instead got " + handler.getClass().getName()); } readHandlerMap.put(className, handler); } /** * Register a write handler. * * When calling {@link #put put()}, the class of the parameter will be * used as a key to extract the actual handler. Then, the parameter will * be passed to the handler. * * @param className The class name of the parameter for the {@link #put put()} method. * * @param handler The handler expected to handle that class. */ public void registerWriteHandler(String className, WriteHandler handler) { complain(LOG_DEBUG, CH_SSI, "write handler (" + className + "," + handler.getClass().getName()); if ( !(handler instanceof WriteHandler) ) { throw new IllegalArgumentException("Expected WriteHandler, instead got " + handler.getClass().getName()); } writeHandlerMap.put(className, handler); } /** * Shut down the system. * * @return true on clean shutdown, false if something went wrong. */ protected void shutdown() throws InterruptedException { complain(LOG_INFO, CH_SSI, "shutting down"); } /** * Start the storage system. * * Checks the preconditions and registers the handlers. */ protected void startup() throws InterruptedException, Throwable { registerHandlers(); } /** * Get the back end connection. * * @return The back end connection, whatever it is. * * @throws Throwable if it wasn't possible to get the back end connection. */ abstract protected Object getConnection() throws Throwable; /** * Close the back end connection, whatever it is. * * @throws Throwable if it wasn't possible to close the back end connection. */ abstract protected void closeConnection(Object conn) throws Throwable; } 1.1 J4/src/java/gnu/j4/io/storage/ReadHandler.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/ReadHandler.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/ReadHandler.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: ReadHandler.java =================================================================== package gnu.j4.io.storage; import java.io.IOException; /** * This interface must be implemented by the object that wants to call the * back end {@link StorageSystem#get get()} method from inside of the {@link * DispatcherStorageSystem DispatcherStorageSystem}. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 2000 * @version $Id: ReadHandler.java,v 1.1 2000/03/07 00:18:32 vt Exp $ */ public interface ReadHandler { /** * Get the object from the storage, using the given instance of the * connection. * * @param ID Storage ID to select the object[s] by. * @param conn Instance of connection to use to get the object. * * @throws IOException if there's a problem with the back end. */ public Object get(StorageID ID, Object conn) throws IOException; } 1.1 J4/src/java/gnu/j4/io/storage/StorageSystemPoolDefs.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/StorageSystemPoolDefs.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/StorageSystemPoolDefs.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: StorageSystemPoolDefs.java =================================================================== package gnu.j4.io.storage; /** * The constants used by the poolable storage system. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 2000 * @version $Id: StorageSystemPoolDefs.java,v 1.1 2000/03/07 00:18:32 vt Exp $ */ public interface StorageSystemPoolDefs { /** * Number of services in the pool to start initially. */ public static final String CF_POOL_MINSTART = "storage.pool.minstart"; /** * Number of services in the pool to never exceed. */ public static final String CF_POOL_MAXKEEP = "storage.pool.maxkeep"; /** * Minimum number of spare resources to keep. */ public static final String CF_POOL_MINSPARE = "storage.pool.minspare"; /** * Maximum number of spare resources to keep (unless it conflicts * with {@link #CF_POOL_MAXKEEP CF_POOL_MAXKEEP}). */ public static final String CF_POOL_MAXSPARE = "storage.pool.maxspare"; } 1.1 J4/src/java/gnu/j4/io/storage/WriteHandler.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/WriteHandler.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/WriteHandler.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: WriteHandler.java =================================================================== package gnu.j4.io.storage; import java.io.IOException; /** * This interface must be implemented by the object that wants to call the * back end {@link StorageSystem#put put()} method from inside of the {@link * DispatcherStorageSystem DispatcherStorageSystem}. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 2000 * @version $Id: WriteHandler.java,v 1.1 2000/03/07 00:18:32 vt Exp $ */ public interface WriteHandler { /** * Put the object into the storage, using the given instance of the * connection. * * @param target Object to store. * @param conn Instance of connection to use to get the object. */ public void put(Storable target, Object conn) throws IOException; } |
From: CVS B. <vt...@fr...> - 2000-03-07 00:22:40
|
User: vt Date: 00/03/06 17:18:33 Added: src/java/gnu/j4/io/storage/ldap .cvsignore LdapStorageSystemImpl.java Makefile.am package.html Log: Rehashed a storage system, implemented a JDBC storage system and introduced a skeleton for LDAP storage system. The code is not tested (has been rewritten according to 2.x services implementation). Moreover, it will not compile with JDK 1.2, and there's no configure option to turn it off at the moment. Bottomline: unless you know how to fix it, DON'T USE IT. For stable code, use 1.0p6, for stable 2.x use 2.0p0. Revision Changes Path 1.1 J4/src/java/gnu/j4/io/storage/ldap/.cvsignore CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/ldap/.cvsignore?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/ldap/.cvsignore?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: .cvsignore =================================================================== Makefile Makefile.in *.class *~ .deps 1.1 J4/src/java/gnu/j4/io/storage/ldap/LdapStorageSystemImpl.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/ldap/LdapStorageSystemImpl.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/ldap/LdapStorageSystemImpl.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: LdapStorageSystemImpl.java =================================================================== package gnu.j4.io.storage.ldap; import gnu.j4.config.Configuration; import gnu.j4.io.storage.DispatcherStorageSystem; /** * LDAP Storage System implementation. * * Not implemented yet. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 2000 * @version $Id: LdapStorageSystemImpl.java,v 1.1 2000/03/07 00:18:33 vt Exp $ */ public class LdapStorageSystemImpl extends DispatcherStorageSystem { public LdapStorageSystemImpl(Configuration conf) { super(conf); } protected Object getConnection() throws Throwable { throw new Error("Not Implemented"); } protected void closeConnection(Object conn) throws Throwable { throw new Error("Not Implemented"); } } 1.1 J4/src/java/gnu/j4/io/storage/ldap/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/ldap/Makefile.am?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/ldap/Makefile.am?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== noinst_PROGRAMS = package package_SOURCES = LdapStorageSystemImpl.java JAVACX = @JAVACX@ SUFFIXES = .java .class .java.class: @ ${ECHO} "Making $<" @ ${JAVACX} $< package: $(package_OBJECTS) $(package_DEPENDENCIES) clean-compile: rm -f *.class clean-generic: rm -f *~ 1.1 J4/src/java/gnu/j4/io/storage/ldap/package.html CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/ldap/package.html?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/ldap/package.html?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: package.html =================================================================== <body> <h1>LDAP Storage System implementation. </h1> The classes in this package implement the storage system using the LDAP server as a back end. </body> |
From: CVS B. <vt...@fr...> - 2000-03-07 00:22:38
|
User: vt Date: 00/03/06 17:18:31 Modified: . ChangeLog Makefile.am configure.in Log: Rehashed a storage system, implemented a JDBC storage system and introduced a skeleton for LDAP storage system. The code is not tested (has been rewritten according to 2.x services implementation). Moreover, it will not compile with JDK 1.2, and there's no configure option to turn it off at the moment. Bottomline: unless you know how to fix it, DON'T USE IT. For stable code, use 1.0p6, for stable 2.x use 2.0p0. Revision Changes Path 1.12 +13 -1 J4/ChangeLog CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/ChangeLog?annotate=1.12&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/ChangeLog?rev=1.12&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/ChangeLog.diff?r1=1.12&r2=1.11&cvsroot=jukebox4 ----------------------------------- Index: ChangeLog =================================================================== RCS file: /usr/local/cvs/J4/ChangeLog,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- ChangeLog 2000/03/03 04:20:14 1.11 +++ ChangeLog 2000/03/07 00:18:31 1.12 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.11 2000/03/03 04:20:14 vt Exp $ +$Id: ChangeLog,v 1.12 2000/03/07 00:18:31 vt Exp $ CURRENT RELEASE NOTES @@ -14,6 +14,18 @@ JVM version and excludes these files from the build process. CHANGE LOG + +--- 2.0p1dev --- + +03/06/00 Rehashed a storage system, implemented a JDBC storage system + and introduced a skeleton for LDAP storage system. The code + is not tested (has been rewritten according to 2.x services + implementation). Moreover, it will not compile with JDK 1.2, + and there's no configure option to turn it off at the + moment. + + Bottomline: unless you know how to fix it, DON'T USE IT. For + stable code, use 1.0p6, for stable 2.x use 2.0p0. === 2.0p0 === 1.18 +4 -2 J4/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/Makefile.am?annotate=1.18&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/Makefile.am?rev=1.18&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/Makefile.am.diff?r1=1.18&r2=1.17&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/Makefile.am,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- Makefile.am 1999/12/27 01:22:28 1.17 +++ Makefile.am 2000/03/07 00:18:31 1.18 @@ -1,11 +1,11 @@ ## Makefile.am: top level automake makefile for Jukebox. ## Process this file with automake to get Makefile.in ## -## $Id: Makefile.am,v 1.17 1999/12/27 01:22:28 vt Exp $ +## $Id: Makefile.am,v 1.18 2000/03/07 00:18:31 vt Exp $ # Makefile.in: top level autoconf makefile for Jukebox. # -# $Id: Makefile.am,v 1.17 1999/12/27 01:22:28 vt Exp $ +# $Id: Makefile.am,v 1.18 2000/03/07 00:18:31 vt Exp $ AUTOMAKE_OPTIONS = gnu @@ -70,6 +70,8 @@ gnu.j4.io.base64 \ gnu.j4.io.storage \ gnu.j4.io.storage.fs \ + gnu.j4.io.storage.jdbc \ + gnu.j4.io.storage.ldap \ gnu.j4.net # 'JAVADOCX' is the javadoc properly wrapped in a classpath definition, 1.43 +4 -2 J4/configure.in CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/configure.in?annotate=1.43&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/configure.in?rev=1.43&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/configure.in.diff?r1=1.43&r2=1.42&cvsroot=jukebox4 ----------------------------------- Index: configure.in =================================================================== RCS file: /usr/local/cvs/J4/configure.in,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- configure.in 2000/03/03 04:20:14 1.42 +++ configure.in 2000/03/07 00:18:31 1.43 @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_REVISION($Id: configure.in,v 1.42 2000/03/03 04:20:14 vt Exp $)dnl +AC_REVISION($Id: configure.in,v 1.43 2000/03/07 00:18:31 vt Exp $)dnl dnl I'd like it to read the ./configure-options to allow both the basic set dnl of options, as well as the local set. @@ -19,7 +19,7 @@ AC_INIT(src/java/gnu/j4/core/Syslog.java) -PATCHLEVEL="0" +PATCHLEVEL="1dev" AC_SUBST(PATCHLEVEL)dnl PACKAGE="jukebox" @@ -344,6 +344,8 @@ src/java/gnu/j4/io/base64/Makefile src/java/gnu/j4/io/storage/Makefile src/java/gnu/j4/io/storage/fs/Makefile + src/java/gnu/j4/io/storage/jdbc/Makefile + src/java/gnu/j4/io/storage/ldap/Makefile src/java/gnu/j4/io/uu/Makefile src/java/gnu/j4/io/Makefile src/java/gnu/j4/net/Makefile |
From: CVS B. <vt...@fr...> - 2000-03-06 22:38:21
|
User: vt Date: 00/03/06 15:33:42 J4/src/java/gnu/j4/io/storage/ldap - New directory |
From: <juk...@li...> - 2000-03-06 17:41:27
|
Your mail to 'Jukebox4-cvs' with the subject: CVS update: J4/src/java/gnu/j4/io/storage/jdbc - New directory Is being held until the list moderator can review it for approval. The reason it is being held: Postings from member addresses only. Either the message will get posted to the list, or you will receive notification of the moderator's decision. |
From: CVS D. <juk...@li...> - 2000-03-06 17:41:26
|
User: vt Date: 00/03/06 10:37:21 J4/src/java/gnu/j4/io/storage/jdbc - New directory |
From: <juk...@li...> - 2000-03-06 17:39:50
|
Your mail to 'Jukebox4-cvs' with the subject: CVS update: J4/src/java/gnu/j4/io/storage/fs FSStorage.java Is being held until the list moderator can review it for approval. The reason it is being held: Postings from member addresses only. Either the message will get posted to the list, or you will receive notification of the moderator's decision. |
From: <juk...@li...> - 2000-03-06 17:39:49
|
Your mail to 'Jukebox4-cvs' with the subject: CVS update: J4/src/java/gnu/j4/io/storage Makefile.am Storable.java StorageSystem.java Persistent.java Is being held until the list moderator can review it for approval. The reason it is being held: Postings from member addresses only. Either the message will get posted to the list, or you will receive notification of the moderator's decision. |
From: CVS D. <juk...@li...> - 2000-03-06 17:39:49
|
User: vt Date: 00/03/06 10:35:15 Modified: src/java/gnu/j4/io/storage/fs FSStorage.java Log: Checkpoint on introducing the JDBC storage system. Revision Changes Path 1.3 +3 -3 J4/src/java/gnu/j4/io/storage/fs/FSStorage.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/fs/FSStorage.java?annotate=1.3&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/fs/FSStorage.java?rev=1.3&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/fs/FSStorage.java.diff?r1=1.3&r2=1.2&cvsroot=jukebox4 ----------------------------------- Index: FSStorage.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/io/storage/fs/FSStorage.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- FSStorage.java 1999/08/12 22:09:06 1.2 +++ FSStorage.java 2000/03/06 17:35:14 1.3 @@ -19,7 +19,7 @@ * * @throws IOException if there was a problem. */ - public void put(Persistent target) throws IOException { + public void put(Storable target) throws IOException { throw new Error("Not Implemented"); } @@ -33,8 +33,8 @@ * * <p> * - * <strong>Note:</strong> This object may not be {@link Persistent - * Persistent} at all, it could be instead a composite object that the + * <strong>Note:</strong> This object may not be {@link Storable + * Storable} at all, it could be instead a composite object that the * storage system creates by itself based on the content of the {@link * StorageID storage ID}. * |
From: CVS D. <juk...@li...> - 2000-03-06 17:39:48
|
User: vt Date: 00/03/06 10:35:11 Modified: src/java/gnu/j4/io/storage Makefile.am Storable.java StorageSystem.java Removed: src/java/gnu/j4/io/storage Persistent.java Log: Checkpoint on introducing the JDBC storage system. Revision Changes Path 1.3 +1 -1 J4/src/java/gnu/j4/io/storage/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/Makefile.am?annotate=1.3&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/Makefile.am?rev=1.3&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/Makefile.am.diff?r1=1.3&r2=1.2&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/io/storage/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Makefile.am 1999/08/12 22:09:06 1.2 +++ Makefile.am 2000/03/06 17:35:10 1.3 @@ -1,7 +1,7 @@ SUBDIRS = fs noinst_PROGRAMS = package -package_SOURCES = Persistent.java \ +package_SOURCES = Storable.java \ StorageID.java \ StorageSystem.java 1.4 +3 -3 J4/src/java/gnu/j4/io/storage/Storable.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/Storable.java?annotate=1.4&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/Storable.java?rev=1.4&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/Storable.java.diff?r1=1.4&r2=1.3&cvsroot=jukebox4 ----------------------------------- Index: Storable.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/io/storage/Storable.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Storable.java 2000/03/03 04:20:19 1.3 +++ Storable.java 2000/03/06 17:35:10 1.4 @@ -1,7 +1,7 @@ package gnu.j4.io.storage; /** - * Persistent object. + * Storable object. * * Any object can be persistent as long as it implements this interface. * @@ -12,9 +12,9 @@ * are. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1999 - * @version $Id: Storable.java,v 1.3 2000/03/03 04:20:19 vt Exp $ + * @version $Id: Storable.java,v 1.4 2000/03/06 17:35:10 vt Exp $ */ -public interface Persistent { +public interface Storable { /** * Get the unique ID. 1.4 +4 -4 J4/src/java/gnu/j4/io/storage/StorageSystem.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/StorageSystem.java?annotate=1.4&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/StorageSystem.java?rev=1.4&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/io/storage/StorageSystem.java.diff?r1=1.4&r2=1.3&cvsroot=jukebox4 ----------------------------------- Index: StorageSystem.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/io/storage/StorageSystem.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- StorageSystem.java 2000/03/03 04:20:19 1.3 +++ StorageSystem.java 2000/03/06 17:35:10 1.4 @@ -37,7 +37,7 @@ * identifiers. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1999 - * @version $Id: StorageSystem.java,v 1.3 2000/03/03 04:20:19 vt Exp $ + * @version $Id: StorageSystem.java,v 1.4 2000/03/06 17:35:10 vt Exp $ */ public interface StorageSystem { @@ -53,7 +53,7 @@ * * @throws IOException if there was a problem. */ - public void put(Persistent target) throws IOException; + public void put(Storable target) throws IOException; /** * Retrieve the object. @@ -64,8 +64,8 @@ * * <p> * - * <strong>Note:</strong> This object may not be {@link Persistent - * Persistent} at all, it could be instead a composite object that the + * <strong>Note:</strong> This object may not be {@link Storable + * Storable} at all, it could be instead a composite object that the * storage system creates by itself based on the content of the {@link * StorageID storage ID}. * |