jremote jbase5.2.1

com.jbase.jremote.io
Class JConnectionImpl

java.lang.Object
  extended by com.jbase.jremote.io.JConnectionImpl
All Implemented Interfaces:
JConnection, JXAConnection, javax.transaction.xa.XAResource

public class JConnectionImpl
extends java.lang.Object
implements JXAConnection

The connection to a remote jBASE instance implemented using a IO messages over an abstract connection.

Author:
aphethean

Field Summary
 
Fields inherited from interface com.jbase.jremote.JConnection
DEFAULT_CHARSET, DEFAULT_DECODER, DEFAULT_ENCODER, JBASE_DEFAULT_ENCODING
 
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
 
Constructor Summary
JConnectionImpl()
           
JConnectionImpl(AbstractJRemoteConnection connection)
           
JConnectionImpl(AbstractJRemoteConnection connection, java.util.Properties cxProps)
           
 
Method Summary
 void begin()
          Begin a jBASE transaction.
 JSubroutineParameters call(java.lang.String subroutineName, JSubroutineParameters parameters)
          Call a jBASE subroutine.
 void close()
          Close any resources used by this connection.
 void commit()
          Commit all pending jBASE operations performed in transaction and mark as complete.
 void commit(javax.transaction.xa.Xid xid, boolean onePhase)
           
 JSelectList createSelectList(JDynArray jd)
          Create a select list object from an existing dynamic array containing a list of keys separated by attribute markers.
 JStatement createStatement()
          Create a statement object that enables queries to be executed and a JResultSet returned.
 int date()
          Return the jBASE internal date.
 boolean echo(int length)
           Send an echo request and waits for a reply.
 void end(javax.transaction.xa.Xid xid, int flags)
           
 JExecuteResults execute(java.lang.String command)
          Execute a jBASE command.
 JExecuteResults execute(java.lang.String command, JSelectList selectList)
          Execute a jBASE command using an existing select list as a filter.
 void forget(javax.transaction.xa.Xid xid)
           
 java.nio.charset.Charset getCharset()
          Get the Charset for this connection.
 JDynArray getCommon(java.lang.String name)
          Return the value of the named common with the supplied name.
 EISMetaDataRepository getMetaData()
          Return meta data of the connected jBASE instance.
 int getTransactionTimeout()
           
 java.lang.String iconv(java.lang.String data, java.lang.String conversion)
          Converts data in external format to internal format.
protected  void init(AbstractJRemoteConnection connection, boolean allowInput, java.util.Properties cxProps)
           
 boolean isSameRM(javax.transaction.xa.XAResource res)
           
 java.lang.String monitoring(java.lang.String command)
           Send an monitoring request and waits for a reply.
 JDynArray newJDynArray()
          Create a JDynArray with the correct Charset for this connection.
 JDynArray newJDynArray(java.lang.String str)
           
 java.lang.String oconv(java.lang.String data, java.lang.String conversion)
          Converts internal representations of data to their external form.
 JFile open(java.lang.String fileName)
          Attempts to open a jBASE file or returns null if the file does not exist.
 int prepare(javax.transaction.xa.Xid xid)
           
 javax.transaction.xa.Xid[] recover(int flag)
           
 void rollback()
          Rollback all jBASE operations performed in transaction and mark as complete.
 void rollback(javax.transaction.xa.Xid xid)
           
 Response sendWaitForResponse(JRemoteRequest req)
          Uses underlying connection to send a request and wait for the response.
 void setOutputStream(java.io.OutputStream out)
           
 void setTerminalOutputWriter(java.io.Writer writer)
           
 boolean setTransactionTimeout(int timeout)
           
 void start(javax.transaction.xa.Xid xid, int flags)
           
 boolean switchAccount(java.lang.String user, java.lang.String account, java.lang.String password)
          Log into the specified jBASE account.
 int time()
          Return the jBASE internal time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JConnectionImpl

public JConnectionImpl()

JConnectionImpl

public JConnectionImpl(AbstractJRemoteConnection connection)

JConnectionImpl

public JConnectionImpl(AbstractJRemoteConnection connection,
                       java.util.Properties cxProps)
Method Detail

init

protected void init(AbstractJRemoteConnection connection,
                    boolean allowInput,
                    java.util.Properties cxProps)

setOutputStream

public void setOutputStream(java.io.OutputStream out)

setTerminalOutputWriter

public void setTerminalOutputWriter(java.io.Writer writer)
Specified by:
setTerminalOutputWriter in interface JConnection
See Also:
JConnection.setTerminalOutputWriter(java.io.Writer)

newJDynArray

public JDynArray newJDynArray()
Description copied from interface: JConnection

Create a JDynArray with the correct Charset for this connection.

Specified by:
newJDynArray in interface JConnection

newJDynArray

public JDynArray newJDynArray(java.lang.String str)
Specified by:
newJDynArray in interface JConnection

getCharset

public java.nio.charset.Charset getCharset()
Description copied from interface: JConnection

Get the Charset for this connection. This is used on String operations to convert the bytes received from jBASE to a Java UTF-16 String.

Specified by:
getCharset in interface JConnection

switchAccount

public boolean switchAccount(java.lang.String user,
                             java.lang.String account,
                             java.lang.String password)
                      throws JRemoteException
Description copied from interface: JConnection

Log into the specified jBASE account.

Specified by:
switchAccount in interface JConnection
Parameters:
user - username that belongs to the account
account - name of the account to log into
password - password of the account to log into
Returns:
boolean
Throws:
JRemoteException
See Also:
JConnection.switchAccount(java.lang.String user, java.lang.String account, java.lang.String password)

close

public void close()
           throws JRemoteException
Description copied from interface: JConnection

Close any resources used by this connection.

Specified by:
close in interface JConnection
Throws:
JRemoteException
See Also:
JConnection.close()

open

public JFile open(java.lang.String fileName)
           throws JRemoteException
Description copied from interface: JConnection

Attempts to open a jBASE file or returns null if the file does not exist.

Specified by:
open in interface JConnection
Returns:
JFile
Throws:
JRemoteException
See Also:
JConnection.open(java.lang.String fileName)

call

public JSubroutineParameters call(java.lang.String subroutineName,
                                  JSubroutineParameters parameters)
                           throws JSubroutineNotFoundException,
                                  JRemoteException
Description copied from interface: JConnection

Call a jBASE subroutine.

Specified by:
call in interface JConnection
Returns:
the result parameters from subroutine call
Throws:
JSubroutineNotFoundException
JRemoteException
See Also:
JConnection.call(java.lang.String, com.jbase.jremote.JSubroutineParameters)

execute

public JExecuteResults execute(java.lang.String command)
                        throws JRemoteException
Description copied from interface: JConnection

Execute a jBASE command.

Specified by:
execute in interface JConnection
Returns:
the execute results
Throws:
JRemoteException
See Also:
JConnection.execute(java.lang.String)

execute

public JExecuteResults execute(java.lang.String command,
                               JSelectList selectList)
                        throws JRemoteException
Description copied from interface: JConnection

Execute a jBASE command using an existing select list as a filter.

Specified by:
execute in interface JConnection
Returns:
the execute results
Throws:
JRemoteException
See Also:
JConnection.execute(java.lang.String, com.jbase.jremote.JSelectList)

begin

public void begin()
           throws JRemoteException
Description copied from interface: JConnection

Begin a jBASE transaction.

If a transaction already exists then no action will be taken.

Specified by:
begin in interface JConnection
Throws:
JRemoteException
See Also:
JConnection.begin()

commit

public void commit()
            throws JRemoteException
Description copied from interface: JConnection

Commit all pending jBASE operations performed in transaction and mark as complete.

If no transaction exists then no action will be taken.

Specified by:
commit in interface JConnection
Throws:
JRemoteException
See Also:
JConnection.commit()

rollback

public void rollback()
              throws JRemoteException
Description copied from interface: JConnection

Rollback all jBASE operations performed in transaction and mark as complete.

If no transaction exists then no action will be taken.

Specified by:
rollback in interface JConnection
Throws:
JRemoteException
See Also:
JConnection.rollback()

date

public int date()
         throws JRemoteException

Return the jBASE internal date. Epoch Dec 31, 1967.

Specified by:
date in interface JConnection
Returns:
int internal date
Throws:
JRemoteException

time

public int time()
         throws JRemoteException

Return the jBASE internal time. Seconds since midnight.

Specified by:
time in interface JConnection
Returns:
int internal time
Throws:
JRemoteException

getCommon

public JDynArray getCommon(java.lang.String name)
                    throws JRemoteException

Return the value of the named common with the supplied name.

Specified by:
getCommon in interface JConnection
Parameters:
name -
Returns:
JDynArray value
Throws:
JRemoteException

getMetaData

public EISMetaDataRepository getMetaData()
                                  throws JRemoteException
Description copied from interface: JConnection

Return meta data of the connected jBASE instance.

Specified by:
getMetaData in interface JConnection
Returns:
EISMetaDataRepository meta data repository
Throws:
JRemoteException
See Also:
JConnection.getMetaData()

iconv

public java.lang.String iconv(java.lang.String data,
                              java.lang.String conversion)
                       throws JRemoteException
Description copied from interface: JConnection

Converts data in external format to internal format.

Specified by:
iconv in interface JConnection
Returns:
String data to be converted
Throws:
JRemoteException
See Also:
com.jbase.jremote.JConnection#iconv()

oconv

public java.lang.String oconv(java.lang.String data,
                              java.lang.String conversion)
                       throws JRemoteException
Description copied from interface: JConnection

Converts internal representations of data to their external form.

Specified by:
oconv in interface JConnection
Returns:
String numeric data to be converted
Throws:
JRemoteException
See Also:
com.jbase.jremote.JConnection#oconv()

createStatement

public JStatement createStatement()
                           throws JRemoteException
Description copied from interface: JConnection

Create a statement object that enables queries to be executed and a JResultSet returned.

Specified by:
createStatement in interface JConnection
Returns:
JStatement jBase statement object
Throws:
JRemoteException
See Also:
JConnection.createStatement()

createSelectList

public JSelectList createSelectList(JDynArray jd)
                             throws JRemoteException
Description copied from interface: JConnection

Create a select list object from an existing dynamic array containing a list of keys separated by attribute markers.

Specified by:
createSelectList in interface JConnection
Returns:
JSelectList select list
Throws:
JRemoteException
See Also:
com.jbase.jremote.JConnection#createSelectList()

prepare

public int prepare(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Specified by:
prepare in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

commit

public void commit(javax.transaction.xa.Xid xid,
                   boolean onePhase)
            throws javax.transaction.xa.XAException
Specified by:
commit in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

rollback

public void rollback(javax.transaction.xa.Xid xid)
              throws javax.transaction.xa.XAException
Specified by:
rollback in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

start

public void start(javax.transaction.xa.Xid xid,
                  int flags)
           throws javax.transaction.xa.XAException
Specified by:
start in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

end

public void end(javax.transaction.xa.Xid xid,
                int flags)
         throws javax.transaction.xa.XAException
Specified by:
end in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

forget

public void forget(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Specified by:
forget in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

isSameRM

public boolean isSameRM(javax.transaction.xa.XAResource res)
                 throws javax.transaction.xa.XAException
Specified by:
isSameRM in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

recover

public javax.transaction.xa.Xid[] recover(int flag)
                                   throws javax.transaction.xa.XAException
Specified by:
recover in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

getTransactionTimeout

public int getTransactionTimeout()
                          throws javax.transaction.xa.XAException
Specified by:
getTransactionTimeout in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

setTransactionTimeout

public boolean setTransactionTimeout(int timeout)
                              throws javax.transaction.xa.XAException
Specified by:
setTransactionTimeout in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

sendWaitForResponse

public Response sendWaitForResponse(JRemoteRequest req)
                             throws java.lang.Exception
Uses underlying connection to send a request and wait for the response. Required because during testing (ONLY) we may sometimes wish to send an arbitrary packet and see what comes back. Do not handle exceptions the caller is probably interested in them.

Throws:
java.lang.Exception

echo

public boolean echo(int length)
             throws JRemoteException

Send an echo request and waits for a reply.

Specified by:
echo in interface JConnection
Returns:
True = success
Throws:
JRemoteException

monitoring

public java.lang.String monitoring(java.lang.String command)
                            throws JRemoteException

Send an monitoring request and waits for a reply.

Specified by:
monitoring in interface JConnection
Parameters:
command - to send
Returns:
respose string
Throws:
JRemoteException

jremote jbase5.2.1

Copyright © 2010 TEMENOS. All Rights Reserved.