Importing SVN archives - B6M1

This commit is contained in:
Emmanuel BENOîT 2018-10-23 09:38:02 +02:00
commit fc4c6bd340
1695 changed files with 98617 additions and 0 deletions

View file

@ -0,0 +1,14 @@
package com.deepclone.lw.session;
import java.io.Serializable;
public abstract class Command
implements Serializable
{
private static final long serialVersionUID = 1L;
}

View file

@ -0,0 +1,14 @@
package com.deepclone.lw.session;
import java.io.Serializable;
public abstract class CommandResponse
implements Serializable
{
private static final long serialVersionUID = 1L;
}

View file

@ -0,0 +1,10 @@
package com.deepclone.lw.session;
public final class NullResponse
extends CommandResponse
{
private static final long serialVersionUID = 1L;
}

View file

@ -0,0 +1,25 @@
package com.deepclone.lw.session;
import java.net.InetAddress;
public interface SessionAccessor
{
SessionReference create( String type , String client , InetAddress ip )
throws SessionInternalException;
SessionReference authenticate( String session , String identifier , String sha1Hash , String md5Hash )
throws SessionIdentifierException , SessionStateException , SessionInternalException;
SessionResponse executeCommand( String session , Command command )
throws SessionIdentifierException , SessionStateException , SessionCommandException ,
SessionInternalException;
void terminate( String session )
throws SessionIdentifierException , SessionInternalException;
}

View file

@ -0,0 +1,15 @@
package com.deepclone.lw.session;
public class SessionCommandException
extends SessionException
{
private static final long serialVersionUID = 1L;
public SessionCommandException( String message )
{
super( true , message );
}
}

View file

@ -0,0 +1,44 @@
package com.deepclone.lw.session;
public abstract class SessionException
extends Exception
{
private static final long serialVersionUID = 1L;
private boolean keepSession;
public SessionException( boolean keep )
{
this.keepSession = keep;
}
public SessionException( boolean keep , String message )
{
super( message );
this.keepSession = keep;
}
public SessionException( boolean keep , Throwable cause )
{
super( cause );
this.keepSession = keep;
}
public SessionException( boolean keep , String message , Throwable cause )
{
super( message , cause );
this.keepSession = keep;
}
public final boolean isSessionKept( )
{
return this.keepSession;
}
}

View file

@ -0,0 +1,21 @@
package com.deepclone.lw.session;
/**
* Thrown when a session identifier does not exist on the server.
*
* @author tseeker
*/
public final class SessionIdentifierException
extends SessionException
{
private static final long serialVersionUID = 1L;
public SessionIdentifierException( String identifier )
{
super( false , identifier );
}
}

View file

@ -0,0 +1,21 @@
package com.deepclone.lw.session;
/**
* Thrown when a runtime error occurs while handling a session-related request.
*
* @author tseeker
*/
public final class SessionInternalException
extends SessionException
{
private static final long serialVersionUID = 1L;
public SessionInternalException( boolean keep , Throwable cause )
{
super( keep , cause.getClass( ).getName( ) + " (" + cause.getMessage( ) + ")" );
}
}

View file

@ -0,0 +1,51 @@
package com.deepclone.lw.session;
import java.io.Serializable;
/**
* Session reference.
*
* <p>
* Session references are send from the server to the client for all session-related actions. They
* contain information about the session itself (identifier and type of session) and about its state
* (authentication and sub-type).
*
* @author tseeker
*/
public final class SessionReference
implements Serializable
{
private static final long serialVersionUID = 1L;
/** String identifier of the session */
public final String identifier;
/** Type of the session */
public final String type;
/** Whether the session has been authenticated or not */
public final boolean authenticated;
/**
* Extra state information.
*
* <p>
* If the session needs authentication, this field contains a challenge to use when
* authenticating. If the session has been authenticated, it contains the session's sub-type.
*/
public final String extra;
public SessionReference( String identifier , String type , boolean authenticated , String extra )
{
this.identifier = identifier;
this.type = type;
this.authenticated = authenticated;
this.extra = extra;
}
}

View file

@ -0,0 +1,39 @@
package com.deepclone.lw.session;
import java.io.Serializable;
/**
* Response to a session command.
*
* @author tseeker
*/
public class SessionResponse
implements Serializable
{
private static final long serialVersionUID = 1L;
/** Updated session reference */
public final SessionReference session;
/** Response data, if any */
public final CommandResponse data;
public SessionResponse( SessionReference session )
{
this.session = session;
this.data = null;
}
public SessionResponse( SessionReference session , CommandResponse data )
{
this.session = session;
this.data = data;
}
}

View file

@ -0,0 +1,20 @@
package com.deepclone.lw.session;
/**
* Thrown when an authentication request is issued to an authenticated session or vice-versa.
*
* @author tseeker
*/
public final class SessionStateException
extends SessionException
{
private static final long serialVersionUID = 1L;
public SessionStateException( )
{
super( true );
}
}