/** * Try to figure out the remote session that this filter belongs to. * In this case, the remotesession should be the RecordOwner. * @return The remote session that belongs to this filter. */ public Object getRemoteSession() { Object remoteSession = super.getRemoteSession(); if (remoteSession == null) if (this.getMessageSource() instanceof Record) { Record record = (Record)this.getMessageSource(); BaseTable table = record.getTable().getCurrentTable(); if (DBParams.CLIENT.equals(table.getSourceType())) remoteSession = (RemoteSession)table.getRemoteTableType(org.jbundle.model.Remote.class); // Only pass the remoteSession if remoteSession is the client part of the remote session! } return remoteSession; } /**
/** * Try to figure out the remote session that this filter belongs to. * In this case, the remotesession should be the RecordOwner. * @return The remote session that belongs to this filter. */ public Object getRemoteSession() { Object remoteSession = super.getRemoteSession(); if (remoteSession == null) if (this.getMessageSource() instanceof Record) { Record record = (Record)this.getMessageSource(); BaseTable table = record.getTable().getCurrentTable(); if (DBParams.CLIENT.equals(table.getSourceType())) remoteSession = (RemoteSession)table.getRemoteTableType(java.rmi.server.RemoteStub.class); // Only pass the remoteSession if remoteSession is the client part of the remote session! } return remoteSession; } /**
/** * Add this message filter to this receive queue. * Also adds a message filter to the remote queue. * @param The message filter to add. * @return The message filter passed in. */ public void addMessageFilter(MessageFilter messageFilter) { super.addMessageFilter(messageFilter); try { // If at all possible, pass the queue's current session, so the filter is in the proper environment if (((BaseMessageFilter)messageFilter).isCreateRemoteFilter()) // Almost always true { // Create the remote version of this filter. RemoteSession remoteSession = (RemoteSession)((BaseMessageFilter)messageFilter).getRemoteSession(); BaseMessageFilter remoteFilter = m_receiveQueue.addRemoteMessageFilter((BaseMessageFilter)messageFilter, remoteSession); ((BaseMessageFilter)messageFilter).setRemoteFilterInfo(remoteFilter.getQueueName(), remoteFilter.getQueueType(), remoteFilter.getFilterID(), remoteFilter.getRegistryID()); } } catch (RemoteException ex) { ex.printStackTrace(); } } /**