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.
DEFAULT_CHARSET, JBASE_DEFAULT_ENCODING
Constructor and Description |
---|
JConnectionImpl() |
JConnectionImpl(AbstractJRemoteConnection connection) |
JConnectionImpl(AbstractJRemoteConnection connection,
java.util.Properties cxProps) |
Modifier and Type | Method and Description |
---|---|
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) |
JDynArray |
func(java.lang.String function_name)
Call a jBASE function.
|
JDynArray |
func(java.lang.String function_name,
JSubroutineParameters parameters) |
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.
|
public JConnectionImpl()
public JConnectionImpl(AbstractJRemoteConnection connection)
public JConnectionImpl(AbstractJRemoteConnection connection, java.util.Properties cxProps)
protected void init(AbstractJRemoteConnection connection, boolean allowInput, java.util.Properties cxProps)
public void setOutputStream(java.io.OutputStream out)
public void setTerminalOutputWriter(java.io.Writer writer)
setTerminalOutputWriter
in interface JConnection
JConnection.setTerminalOutputWriter(java.io.Writer)
public JDynArray newJDynArray()
JConnection
Create a JDynArray with the correct Charset for this connection.
newJDynArray
in interface JConnection
public JDynArray newJDynArray(java.lang.String str)
newJDynArray
in interface JConnection
public java.nio.charset.Charset getCharset()
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.
getCharset
in interface JConnection
public boolean switchAccount(java.lang.String user, java.lang.String account, java.lang.String password) throws JRemoteException
JConnection
Log into the specified jBASE account.
switchAccount
in interface JConnection
user
- username that belongs to the accountaccount
- name of the account to log intopassword
- password of the account to log intoJRemoteException
JConnection.switchAccount(java.lang.String user, java.lang.String account, java.lang.String password)
public void close() throws JRemoteException
JConnection
Close any resources used by this connection.
close
in interface JConnection
JRemoteException
JConnection.close()
public JFile open(java.lang.String fileName) throws JRemoteException
JConnection
Attempts to open a jBASE file or returns null if the file does not exist.
open
in interface JConnection
JRemoteException
JConnection.open(java.lang.String fileName)
public JSubroutineParameters call(java.lang.String subroutineName, JSubroutineParameters parameters) throws JSubroutineNotFoundException, JRemoteException
JConnection
Call a jBASE subroutine.
call
in interface JConnection
JSubroutineNotFoundException
JRemoteException
JConnection.call(java.lang.String, com.jbase.jremote.JSubroutineParameters)
public JDynArray func(java.lang.String function_name) throws JSubroutineNotFoundException, JRemoteException
JConnection
Call a jBASE function.
func
in interface JConnection
JSubroutineNotFoundException
JRemoteException
JConnection.func(java.lang.String, com.jbase.jremote.JSubroutineParameters)
public JDynArray func(java.lang.String function_name, JSubroutineParameters parameters) throws JSubroutineNotFoundException, JRemoteException
func
in interface JConnection
JSubroutineNotFoundException
JRemoteException
public JExecuteResults execute(java.lang.String command) throws JRemoteException
JConnection
Execute a jBASE command.
execute
in interface JConnection
JRemoteException
JConnection.execute(java.lang.String)
public JExecuteResults execute(java.lang.String command, JSelectList selectList) throws JRemoteException
JConnection
Execute a jBASE command using an existing select list as a filter.
execute
in interface JConnection
JRemoteException
JConnection.execute(java.lang.String, com.jbase.jremote.JSelectList)
public void begin() throws JRemoteException
JConnection
Begin a jBASE transaction.
If a transaction already exists then no action will be taken.
begin
in interface JConnection
JRemoteException
JConnection.begin()
public void commit() throws JRemoteException
JConnection
Commit all pending jBASE operations performed in transaction and mark as complete.
If no transaction exists then no action will be taken.
commit
in interface JConnection
JRemoteException
JConnection.commit()
public void rollback() throws JRemoteException
JConnection
Rollback all jBASE operations performed in transaction and mark as complete.
If no transaction exists then no action will be taken.
rollback
in interface JConnection
JRemoteException
JConnection.rollback()
public int date() throws JRemoteException
Return the jBASE internal date. Epoch Dec 31, 1967.
date
in interface JConnection
JRemoteException
public int time() throws JRemoteException
Return the jBASE internal time. Seconds since midnight.
time
in interface JConnection
JRemoteException
public JDynArray getCommon(java.lang.String name) throws JRemoteException
Return the value of the named common with the supplied name.
getCommon
in interface JConnection
name
- JRemoteException
public EISMetaDataRepository getMetaData() throws JRemoteException
JConnection
Return meta data of the connected jBASE instance.
getMetaData
in interface JConnection
JRemoteException
JConnection.getMetaData()
public java.lang.String iconv(java.lang.String data, java.lang.String conversion) throws JRemoteException
JConnection
Converts data in external format to internal format.
iconv
in interface JConnection
data
- data to be convertedconversion
- the conversion commandJRemoteException
com.jbase.jremote.JConnection#iconv()
public java.lang.String oconv(java.lang.String data, java.lang.String conversion) throws JRemoteException
JConnection
Converts internal representations of data to their external form.
oconv
in interface JConnection
data
- data to be convertedconversion
- the conversion commandJRemoteException
com.jbase.jremote.JConnection#oconv()
public JStatement createStatement() throws JRemoteException
JConnection
Create a statement object that enables queries to be executed and a JResultSet returned.
createStatement
in interface JConnection
JRemoteException
JConnection.createStatement()
public JSelectList createSelectList(JDynArray jd) throws JRemoteException
JConnection
Create a select list object from an existing dynamic array containing a list of keys separated by attribute markers.
createSelectList
in interface JConnection
jd
- dynamic array containing the keysJRemoteException
com.jbase.jremote.JConnection#createSelectList()
public int prepare(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
prepare
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public void commit(javax.transaction.xa.Xid xid, boolean onePhase) throws javax.transaction.xa.XAException
commit
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public void rollback(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
rollback
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public void start(javax.transaction.xa.Xid xid, int flags) throws javax.transaction.xa.XAException
start
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public void end(javax.transaction.xa.Xid xid, int flags) throws javax.transaction.xa.XAException
end
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public void forget(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
forget
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public boolean isSameRM(javax.transaction.xa.XAResource res) throws javax.transaction.xa.XAException
isSameRM
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public javax.transaction.xa.Xid[] recover(int flag) throws javax.transaction.xa.XAException
recover
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public int getTransactionTimeout() throws javax.transaction.xa.XAException
getTransactionTimeout
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public boolean setTransactionTimeout(int timeout) throws javax.transaction.xa.XAException
setTransactionTimeout
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
public Response sendWaitForResponse(JRemoteRequest req) throws java.lang.Exception
java.lang.Exception
public boolean echo(int length) throws JRemoteException
Send an echo request and waits for a reply.
echo
in interface JConnection
length
- of echo packet to send.JRemoteException
public java.lang.String monitoring(java.lang.String command) throws JRemoteException
Send an monitoring request and waits for a reply.
monitoring
in interface JConnection
command
- to sendJRemoteException