/** * Receive the next remote message. * pend(don) Need to keep retrying if timeout as some firewalls won't wait forever. * @param strCommand Command to perform remotely. * @return boolean success. */ public BaseMessage receiveRemoteMessage() throws RemoteException { BaseTransport transport = this.createProxyTransport(RECEIVE_REMOTE_MESSAGE); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); return (BaseMessage)objReturn; } /**
/** * Commit the transactions since the last commit. * Override this for SQL implementations. * @exception DBException An exception. */ public void commit() throws DBException, RemoteException { BaseTransport transport = this.createProxyTransport(COMMIT); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); this.checkDBException(objReturn); } /**
/** * Get the database properties (opt). */ public Map<String, Object> getDBProperties() throws DBException, RemoteException { BaseTransport transport = this.createProxyTransport(GET_DB_PROPERTIES); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); return (Map)this.checkDBException(objReturn); } /**
/** * Make a thin FieldList for this table. * Usually used for special queries that don't have a field list available. * @return The new serialized fieldlist. */ public org.jbundle.thin.base.db.FieldList makeFieldList(String strFieldsToInclude) throws RemoteException { BaseTransport transport = this.createProxyTransport(MAKE_FIELD_LIST); transport.addParam(FIELDS, strFieldsToInclude); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); return (org.jbundle.thin.base.db.FieldList)objReturn; } /**
/** * Rollback the transactions since the last commit. * Override this for SQL implementations. * @exception DBException An exception. */ public void rollback() throws DBException, RemoteException { BaseTransport transport = this.createProxyTransport(ROLLBACK); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); this.checkDBException(objReturn); } /**
/** Link the filter to this remote session. * This is a special method that is needed because the remote link is passed a remote reference to the session * even though it is in the same JVM. What you need to do in your implementation is lookup the message filter * and call messageFilter.linkRemoteSession(this); See RemoteSession Object for the Only implementation. * @param messageFilter A serialized copy of the messageFilter to link this session to. */ public org.jbundle.thin.base.message.BaseMessageFilter setupRemoteSessionFilter(org.jbundle.thin.base.message.BaseMessageFilter messageFilter) throws RemoteException { BaseTransport transport = this.createProxyTransport(SETUP_REMOTE_SESSION_FILTER); transport.addParam(FILTER, messageFilter); // Don't use COMMAND Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); return (org.jbundle.thin.base.message.BaseMessageFilter)objReturn; } }
/** * Remove this remote message filter. * @param messageFilter The message filter to remove. * @param bFreeFilter If true, free the remote filter. */ public boolean removeRemoteMessageFilter(BaseMessageFilter messageFilter, boolean bFreeFilter) throws RemoteException { BaseTransport transport = this.createProxyTransport(REMOVE_REMOTE_MESSAGE_FILTER); transport.addParam(FILTER, messageFilter); // Don't use COMMAND transport.addParam(FREE, bFreeFilter); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); if (objReturn instanceof Boolean) return ((Boolean)objReturn).booleanValue(); return true; } /**
/** * Get the database properties. * @return The database properties object (Always non-null). */ public void setDBProperties(Map<String, Object> properties) throws DBException, RemoteException { BaseTransport transport = this.createProxyTransport(SET_DB_PROPERTIES); transport.addParam(PROPERTIES, properties); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); this.checkDBException(objReturn); } }
/** * Get the DATA_SOURCE_HANDLE to the last modified or added record. * @param iHandleType The type of handle to use. * @return The handle of the last modified record. */ public Object getLastModified(int iHandleType) throws DBException, RemoteException { BaseTransport transport = this.createProxyTransport(GET_LAST_MODIFIED); transport.addParam(TYPE, iHandleType); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); return this.checkDBException(objReturn); } /**
/** * Set a table property. * @param strProperty The key to set. * @param strValue The value to set it to. */ public void setRemoteProperty(String strProperty, String strValue) throws RemoteException { BaseTransport transport = this.createProxyTransport(SET_REMOTE_PROPERTY); transport.addParam(KEY, strProperty); transport.addParam(VALUE, strValue); Object strReturn = transport.sendMessageAndGetReply(); /*Object objReturn = */transport.convertReturnObject(strReturn); //x this.checkException(objReturn); } /**
/** * Update the current record. * @param The data to update. * @exception Exception File exception. */ public void set(Object data, int iOpenMode) throws DBException, RemoteException { BaseTransport transport = this.createProxyTransport(SET); transport.addParam(DATA, data); transport.addParam(OPEN_MODE, iOpenMode); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); this.checkDBException(objReturn); } /**
/** * Delete the current record. * @param - This is a dummy param, because this call conflicts with a call in EJBHome. * @exception Exception File exception. */ public void remove(Object data, int iOpenMode) throws DBException, RemoteException { BaseTransport transport = this.createProxyTransport(REMOVE); transport.addParam(DATA, data); transport.addParam(OPEN_MODE, iOpenMode); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); this.checkDBException(objReturn); } /**
/** * Add add this data to the file. * @param data A vector object containing the raw data for the record. * @return A bookmark if there is no penalty (otherwise returns null). * @exception DBException File exception. */ public Object add(Object data, int iOpenMode) throws DBException, RemoteException { BaseTransport transport = this.createProxyTransport(ADD); transport.addParam(DATA, data); transport.addParam(OPEN_MODE, iOpenMode); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); return this.checkDBException(objReturn); } /**
/** * Log this task in under this (new) user. * @param strUserName The user to log this task in under * @param strPassword The password (NOTE: this is encrypted - do not send clear text). * @exception Throw an exception if logon is not successful. * @return The security map for this user */ @SuppressWarnings("unchecked") public Map<String,Object> login(String strUserName, String strPassword, String strDomain) throws RemoteException { BaseTransport transport = this.createProxyTransport(LOGIN); transport.addParam(Params.USER_NAME, strUserName); transport.addParam(Params.PASSWORD, strPassword); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); return (Map)this.checkRemoteException(objReturn); } /**
/** * Receive this relative record in the table. * <p>Note: This is usually used only by thin clients, as thick clients have the code to * fake absolute access. * @param iRowIndex The row to retrieve. * @param iRowCount The number of rows to retrieve (Used only by CachedRemoteTable). * @return The record(s) or an error code as an Integer. * @exception Exception File exception. */ public Object get(int iRowIndex, int iRowCount) throws DBException, RemoteException { BaseTransport transport = this.createProxyTransport(GET); transport.addParam(INDEX, iRowIndex); transport.addParam(COUNT, iRowCount); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); return this.checkDBException(objReturn); } /**
/** * Move the current position and read the record (optionally read several records). * @param iRelPosition relative Position to read the next record. * @param iRecordCount Records to read. * @return If I read 1 record, this is the record's data. * @return If I read several records, this is a vector of the returned records. * @return If at EOF, or error, returns the error code as a Integer. * @exception Exception File exception. */ public Object doMove(int iRelPosition, int iRecordCount) throws DBException, RemoteException { BaseTransport transport = this.createProxyTransport(DO_MOVE); transport.addParam(POSITION, iRelPosition); transport.addParam(COUNT, iRecordCount); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); return this.checkDBException(objReturn); } /**
/** * Add a message filter to this remote receive queue. * @param messageFilter The message filter to add. * @param remoteSession The remote session. * @return The filter ID. */ public BaseMessageFilter addRemoteMessageFilter(BaseMessageFilter messageFilter, RemoteSession remoteSession) throws RemoteException { BaseTransport transport = this.createProxyTransport(ADD_REMOTE_MESSAGE_FILTER); transport.addParam(FILTER, messageFilter); // Don't use COMMAND String strSessionPathID = null; if (remoteSession instanceof BaseProxy) { // Always a SessionProxy strSessionPathID = ((BaseProxy)remoteSession).getIDPath(); } transport.addParam(SESSION, strSessionPathID); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); return (BaseMessageFilter)objReturn; } /**
/** * Do a remote action. * @param strCommand Command to perform remotely. * @return boolean success. */ public Object doRemoteAction(String strCommand, Map<String, Object> properties) throws DBException, RemoteException { BaseTransport transport = this.createProxyTransport(DO_REMOTE_ACTION); transport.addParam(NAME, strCommand); // Don't use COMMAND transport.addParam(PROPERTIES, properties); Object strReturn = transport.sendMessageAndGetReply(); if (strReturn instanceof String) { // Could be returning a session BaseSessionProxy session = this.checkForSession((String)strReturn); if (session != null) return session; } Object objReturn = transport.convertReturnObject(strReturn); return this.checkDBException(objReturn); } /**
/** * Reposition to this record using this bookmark. * <p />JiniTables can't access the datasource on the server, so they must use the bookmark. * @param bookmark The handle of the record to retrieve. * @param iHandleType The type of handle to use. * @return The record or the return code as an Boolean. */ public Object doSetHandle(Object bookmark, int iOpenMode, String strFields, int iHandleType) throws DBException, RemoteException { BaseTransport transport = this.createProxyTransport(DO_SET_HANDLE); transport.addParam(BOOKMARK, bookmark); transport.addParam(OPEN_MODE, iOpenMode); transport.addParam(FIELDS, strFields); transport.addParam(TYPE, iHandleType); transport.sendMessageAndGetReply(); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); return this.checkDBException(objReturn); } /**
/** * Open - Receive to this server and send the response. * @exception Exception File exception. */ public void open(String strKeyArea, int iOpenMode, boolean bDirection, String strFields, Object objInitialKey, Object objEndKey, byte[] byBehaviorData) throws DBException, RemoteException { BaseTransport transport = this.createProxyTransport(OPEN); transport.addParam(KEY, strKeyArea); transport.addParam(OPEN_MODE, iOpenMode); transport.addParam(DIRECTION, bDirection); transport.addParam(FIELDS, strFields); transport.addParam(INITIAL_KEY, objInitialKey); transport.addParam(END_KEY, objEndKey); transport.addParam(BEHAVIOR_DATA, byBehaviorData); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); this.checkDBException(objReturn); } /**