org.jbundle.thin.base.util.Application.getMessageManager()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(17.8k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中org.jbundle.thin.base.util.Application.getMessageManager()方法的一些代码示例,展示了Application.getMessageManager()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Application.getMessageManager()方法的具体详情如下:
包路径:org.jbundle.thin.base.util.Application
类名称:Application
方法名:getMessageManager

Application.getMessageManager介绍

暂无

代码示例

代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.util

/**
 * StartProcess Method.
 */
public void startProcess(String strProcessName, int iCount)
{
  Map<String,Object> properties = new HashMap<String,Object>();
  properties.put(DBParams.PROCESS, strProcessName);
  properties.put(DBParams.TABLE, this.getProperty(DBParams.TABLE));
  properties.put("count", iCount);
  Application app = (Application)this.getTask().getApplication();
  String strQueueName = MessageConstants.TRX_SEND_QUEUE;
  String strQueueType = MessageConstants.INTRANET_QUEUE;
  BaseMessage message = new MapMessage(new TrxMessageHeader(strQueueName, strQueueType, properties), properties);
  
  app.getMessageManager().sendMessage(message);
}

代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.util

/**
 * RunUpdater Method.
 */
public boolean runUpdater()
{
  Map<String,Object> properties = new HashMap<String,Object>();
  String strTableName = this.getMainRecord().getTableNames(false);
  properties.put(DBParams.PROCESS, HotelAvailProcess.class.getName());
  properties.put(DBParams.TABLE, strTableName);
  
  Application app = (Application)this.getTask().getApplication();
  String strQueueName = MessageConstants.TRX_SEND_QUEUE;
  String strQueueType = MessageConstants.INTRANET_QUEUE;
  BaseMessage message = new MapMessage(new TrxMessageHeader(strQueueName, strQueueType, properties), properties);
  
  app.getMessageManager().sendMessage(message);
  
  return true;
}

代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.util

/**
 * Free Method.
 */
public void free()
{
  super.free();
  MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager(false);
  if (messageManager != null)
    ((BaseMessageManager)messageManager).freeFiltersWithListener(this);  // Free all filters listening for me.
}
/**

代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.util

/**
 * Free this screen's objects.
 */
public void free()
{
  BaseMessageManager messageManager = (BaseMessageManager)this.getBaseApplet().getApplication().getMessageManager();
  messageManager.freeListenersWithSource(this);
  messageManager.freeFiltersWithSource(this);
  super.free();
}
/**

代码示例来源:origin: org.jbundle.base/org.jbundle.base.mixed

public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
  {
    int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption);
    if ((iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_UPDATE_TYPE))
        if (!getField(AnnivMaster.kProperties).isNull())
    {   // This will cause the JobScheduler to reschedule the jobs (now that they have changed)
      BaseMessageManager messageManager = ((Application)getTask().getApplication()).getMessageManager();
      Map<String,Object> properties = new Hashtable<String,Object>();
      properties.put(DBParams.PROCESS, JobSchedulerReference.JOB_PROCESS_NAME);
      if (messageManager != null)
        messageManager.sendMessage(new MapMessage(new BaseMessageHeader(CalendarEntry.JOB_QUEUE_NAME, MessageConstants.INTRANET_QUEUE, this, null), properties));
    }
    return iErrorCode;
  }
});

代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.util

/**
 * A record with this datasource handle changed, notify any behaviors that are checking.
 * NOTE: Be very careful as this code is running in an independent thread
 * (synchronize to the task before calling record calls).
 * NOTE: For now, you are only notified of the main record changes.
 * @param message The message to handle.
 * @return The error code.
 */
public int handleMessage(BaseMessage message)
{
  System.out.println("---------------------------------------------------------- HotelSession/86");
  if (message instanceof BaseMessage)
  {
    Double dblRate = (Double)message.get(BookingDetail.TOTAL_COST);
    if (message.get(HotelRateResponse.PRODUCT_RESPONSE_MESSAGE) instanceof HotelRateResponseMessageData)
    {
      dblRate = new Double(((HotelRateResponseMessageData)message.get(HotelRateResponse.PRODUCT_RESPONSE_MESSAGE)).getRoomCost(PaxCategory.DOUBLE_ID));
    }
  
    MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager();
    BaseMessageHeader messageFilter = message.getMessageHeader();
    BaseMessageHeader messageHeader = new SessionMessageHeader(null, this);
    Map<String,Object> properties = new Hashtable<String,Object>();
    properties.put("hotelCost", dblRate);
    BaseMessage messageTableUpdate = new MapMessage(messageHeader, properties);
    messageManager.sendMessage(messageTableUpdate);
  }
  return super.handleMessage(message);
}

代码示例来源:origin: org.jbundle.base/org.jbundle.base.mixed

/**
 * Remove this listener (called from remote).
 * @param messageFilter The message filter.
 */
public boolean removeRemoteMessageFilter(BaseMessageFilter messageFilter, boolean bFreeFilter) throws RemoteException
{
  Utility.getLogger().info("EJB removeMessageFilter filter: " + messageFilter);
  BaseMessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager();
  BaseMessageReceiver messageReceiver = (BaseMessageReceiver)messageManager.getMessageQueue(messageFilter.getRemoteFilterQueueName(), messageFilter.getRemoteFilterQueueType()).getMessageReceiver();
  boolean bRemoved = false;
  if (messageReceiver != null)
    bRemoved = messageReceiver.removeMessageFilter(messageFilter.getRemoteFilterID(), bFreeFilter);
  return bRemoved;
}
/**

代码示例来源:origin: org.jbundle.base/org.jbundle.base.mixed

public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
  {
    int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption);
    if ((iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_UPDATE_TYPE))
      if (getSharedRecordTypeKey().getValue() == CalendarEntry.APPOINTMENT_ID)
        if (!getField(CalendarEntry.kProperties).isNull())
    {   // This will cause the JobScheduler to reschedule the jobs (now that they have changed)
      BaseMessageManager messageManager = ((Application)getTask().getApplication()).getMessageManager();
      Map<String,Object> properties = new Hashtable<String,Object>();
      properties.put(DBParams.PROCESS, JobSchedulerReference.JOB_PROCESS_NAME);
      if (messageManager != null)
        messageManager.sendMessage(new MapMessage(new BaseMessageHeader(JOB_QUEUE_NAME, MessageConstants.INTRANET_QUEUE, this, null), properties));
    }
    return iErrorCode;
  }
});

代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.util

/**
 * Add all the screen listeners.
 */
public void addListeners()
{
  super.addListeners();
  MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager();
  if (messageManager != null)
  {
    Object source = this;
    BaseMessageFilter filter = new BaseMessageFilter(MessageConstants.TRX_RETURN_QUEUE, MessageConstants.INTERNET_QUEUE, source, null);
    filter.addMessageListener(this);
    messageManager.addMessageFilter(filter);
    m_intRegistryID = filter.getRegistryID();
  }
}
/**

代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.util

/**
 * Add behaviors to this session.
 */
public void addListeners()
{
  super.addListeners();
  
  //        BaseMessageFilter remoteFilter = new ServerSessionMessageFilter(messageFilter.getQueueName(), messageFilter.getQueueType(), null, this);
  //System.out.println("Remote filter " + remoteFilter);
  BaseMessageFilter filterForSession = new BaseMessageFilter(MessageConstants.TRX_RETURN_QUEUE, MessageConstants.INTERNET_QUEUE, null, null);
  MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager();
  messageManager.addMessageFilter(filterForSession);
  filterForSession.addMessageListener(this);
  
  m_intRegistryID = filterForSession.getRegistryID();
}
/**

代码示例来源:origin: org.jbundle.base/org.jbundle.base.mixed

/**
 * Free this session.
 */
public void free()
{
  BaseMessageManager messageManager = null;
  if (this.getTask() != null) // May have been freed already.
    if (this.getTask().getApplication() != null)
      messageManager = ((Application)this.getTask().getApplication()).getMessageManager(false);
  if (messageManager != null)
    messageManager.freeFiltersWithListener(this);
  if (m_messageStack != null)
    m_messageStack.free();
  m_messageStack = null;
  super.free();
}
/**

代码示例来源:origin: com.tourgeek.thin.app/com.tourgeek.thin.app.booking

/**
 * Free the resources held by this object.
 * NOTE NOTE NOTE: This method does not remove this panel from the parent, or free() sub-panels; you have to do that.
 */
public void free()
{
  BaseMessageManager messageManager = (BaseMessageManager)this.getBaseApplet().getApplication().getMessageManager();
  messageManager.freeListenersWithSource(this);
  messageManager.freeFiltersWithSource(this);
  this.saveBooking(false);    // Make sure booking changes are saved
  this.getContextPanel().free();  // This must be freed first, so the context isn't changed again
  m_contextPanel = null;
  super.free();
}
/**

代码示例来源:origin: org.jbundle.base/org.jbundle.base.mixed

/**
 * Update this filter with this new information.
 * @param messageFilter The message filter I am updating.
 * @param properties New filter information (ie, bookmark=345).
 */
public void updateRemoteFilterProperties(BaseMessageFilter messageFilter, Object[][] mxProperties, Map<String,Object> propFilter) throws RemoteException
{
  Utility.getLogger().info("EJB updateRemoteFilter properties: " + mxProperties);
  // Give the filter the remote environment
  BaseMessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager();
  messageFilter = ((BaseMessageReceiver)messageManager.getMessageQueue(messageFilter.getQueueName(), messageFilter.getQueueType()).getMessageReceiver()).getMessageFilter(messageFilter.getRemoteFilterID());  // Must look it up
  if (messageFilter != null)  // Always
  {
    if (mxProperties != null)
      messageFilter.setFilterTree(mxProperties);
    if (propFilter != null)
    {
      propFilter = messageFilter.handleUpdateFilterMap(propFilter);   // Update this object's local filter.
      messageFilter.setFilterMap(propFilter);            // Update any remote copy of this.
    }
  }
}
/**

代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.product.screen

/**
 * AddAvailabilityMessageListeners Method.
 */
public void addAvailabilityMessageListeners(Product recProduct, ProductScreenRecord screenRecord)
{
  // Override this to add the listeners and message queues (remember to call super)
  // Create a private messageReceiver and listen for changes
  MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager();
  Integer intRegistryID = null;
  if (messageManager != null)
  {
    Object source = this;
    BaseMessageFilter messageFilter = new BaseMessageFilter(MessageConstants.TRX_RETURN_QUEUE, MessageConstants.INTERNET_QUEUE, source, null);
    messageManager.addMessageFilter(messageFilter);
    this.addProductAvailabilityMessageFilter(recProduct, messageFilter);
    recProduct.addListener(new FreeOnFreeHandler(messageFilter));
    intRegistryID = messageFilter.getRegistryID();
    recProduct.addListener(this.getProductAvailabilityHandler(screenRecord, intRegistryID));
  }
}
/**

代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.product.screen

/**
 * AddAvailabilityMessageListeners Method.
 */
public void addAvailabilityMessageListeners(Product recProduct, ProductScreenRecord screenRecord)
{
  // Override this to add the listeners and message queues (remember to call super)
  // Create a private messageReceiver and listen for changes
  MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager();
  Integer intRegistryID = null;
  if (messageManager != null)
  {
    Object source = this;
    BaseMessageFilter messageFilter = new BaseMessageFilter(MessageConstants.TRX_RETURN_QUEUE, MessageConstants.INTERNET_QUEUE, source, null);
    messageManager.addMessageFilter(messageFilter);
    this.addProductAvailabilityMessageFilter(recProduct, messageFilter);
    recProduct.addListener(new FreeOnFreeHandler(messageFilter));
    intRegistryID = messageFilter.getRegistryID();
    recProduct.addListener(this.getProductAvailabilityHandler(screenRecord, intRegistryID));
  }
}
/**

代码示例来源:origin: org.jbundle.base.db/org.jbundle.base.db

/**
 * Set the field that owns this listener.
 * @owner The field that this listener is being added to (if null, this listener is being removed).
 */
public void setOwner(ListenerOwner owner)
{
  if (owner == null)
  {
    if (m_messageListener != null)
    {
      m_messageListener.free();
      m_messageListener = null;
    }
  }
  super.setOwner(owner);
  if (owner != null)
  {
    Record record = this.getOwner().getRecord();
    BaseMessageManager messageManager = ((Application)record.getTask().getApplication()).getMessageManager();
    if (messageManager != null)
    {
      BaseMessageFilter messageFilter = new BaseMessageFilter(MessageConstants.TRX_RETURN_QUEUE, MessageConstants.INTERNET_QUEUE, this, null);
      messageManager.addMessageFilter(messageFilter);
      m_messageListener = new  WaitForFieldChangeMessageListener(messageFilter, this);
      record.setupRecordListener(m_messageListener, false, false);   // I need to listen for record changes
    }
  }            
}
/**

代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.product.screen

/**
 * Add the listeners and message queues for rate lookups.
 * (todo - Don't set this up until they are required).
 */
public void addRateMessageListeners(Product recProduct, ProductScreenRecord screenRecord)
{
  // Override this to add the listeners and message queues (remember to call super)
  this.getMainRecord().getField(Product.PRODUCT_COST).setSelected(true);  // Now you can calc the USD amount (since you have this local amount)
  this.getMainRecord().getField(Product.PRODUCT_COST).addListener(new CalcProductAmountHome(this.getMainRecord().getField(Product.PRODUCT_COST_LOCAL)));
  this.getMainRecord().getField(Product.PP_COST).addListener(new CalcProductAmountHome(this.getMainRecord().getField(Product.PP_COST_LOCAL)));
  // Create a private messageReceiver and listen for changes
  MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager();
  Integer intRegistryID = null;
  if (messageManager != null)
  {
    Object source = this;
    BaseMessageFilter messageFilter = new BaseMessageFilter(MessageConstants.TRX_RETURN_QUEUE, MessageConstants.INTERNET_QUEUE, source, null);
    messageManager.addMessageFilter(messageFilter);
    this.addProductRateMessageFilter(recProduct, messageFilter);
    recProduct.addListener(new FreeOnFreeHandler(messageFilter));
    intRegistryID = messageFilter.getRegistryID();
    recProduct.addListener(this.getProductCostHandler(screenRecord, intRegistryID));
  }
}
/**

代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.product.screen

/**
 * Add the listeners and message queues for rate lookups.
 * (todo - Don't set this up until they are required).
 */
public void addRateMessageListeners(Product recProduct, ProductScreenRecord screenRecord)
{
  // Override this to add the listeners and message queues (remember to call super)
  this.getMainRecord().getField(Product.PRODUCT_COST).setSelected(true);  // Now you can calc the USD amount (since you have this local amount)
  this.getMainRecord().getField(Product.PRODUCT_COST).addListener(new CalcProductAmountHome(this.getMainRecord().getField(Product.PRODUCT_COST_LOCAL)));
  this.getMainRecord().getField(Product.PP_COST).addListener(new CalcProductAmountHome(this.getMainRecord().getField(Product.PP_COST_LOCAL)));
  // Create a private messageReceiver and listen for changes
  MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager();
  Integer intRegistryID = null;
  if (messageManager != null)
  {
    Object source = this;
    BaseMessageFilter messageFilter = new BaseMessageFilter(MessageConstants.TRX_RETURN_QUEUE, MessageConstants.INTERNET_QUEUE, source, null);
    messageManager.addMessageFilter(messageFilter);
    this.addProductRateMessageFilter(recProduct, messageFilter);
    recProduct.addListener(new FreeOnFreeHandler(messageFilter));
    intRegistryID = messageFilter.getRegistryID();
    recProduct.addListener(this.getProductCostHandler(screenRecord, intRegistryID));
  }
}
/**

代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.product.screen

/**
 * Add the listeners and message queues for rate lookups.
 */
public void addRateMessageListeners(Product recProduct, ProductScreenRecord screenRecord)
{
  // Override this to add the listeners and message queues (remember to call super)
  this.getMainRecord().getField(Product.PRODUCT_COST).setSelected(true);  // Now you can calc the USD amount (since you have this local amount)
  this.getMainRecord().getField(Product.PRODUCT_COST).addListener(new CalcProductAmountHome(this.getMainRecord().getField(Product.PRODUCT_COST_LOCAL)));
  this.getMainRecord().getField(Product.PP_COST).setSelected(true);  // Now you can calc the USD amount (since you have this local amount)
  this.getMainRecord().getField(Product.PP_COST).addListener(new CalcProductAmountHome(this.getMainRecord().getField(Product.PP_COST_LOCAL)));
  // Create a private messageReceiver and listen for changes
  MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager();
  Integer intRegistryID = null;
  if (messageManager != null)
  {
    Object source = this;
    BaseMessageFilter messageFilter = new BaseMessageFilter(MessageConstants.TRX_RETURN_QUEUE, MessageConstants.INTERNET_QUEUE, source, null);
    messageManager.addMessageFilter(messageFilter);
    this.addProductRateMessageFilter(recProduct, messageFilter);
    recProduct.addListener(new FreeOnFreeHandler(messageFilter));
    intRegistryID = messageFilter.getRegistryID();
    recProduct.addListener(this.getProductCostHandler(screenRecord, intRegistryID));
  }
}
/**

代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.product.screen

/**
 * Add the listeners and message queues for rate lookups.
 */
public void addRateMessageListeners(Product recProduct, ProductScreenRecord screenRecord)
{
  // Override this to add the listeners and message queues (remember to call super)
  this.getMainRecord().getField(Product.PRODUCT_COST).setSelected(true);  // Now you can calc the USD amount (since you have this local amount)
  this.getMainRecord().getField(Product.PRODUCT_COST).addListener(new CalcProductAmountHome(this.getMainRecord().getField(Product.PRODUCT_COST_LOCAL)));
  this.getMainRecord().getField(Product.PP_COST).setSelected(true);  // Now you can calc the USD amount (since you have this local amount)
  this.getMainRecord().getField(Product.PP_COST).addListener(new CalcProductAmountHome(this.getMainRecord().getField(Product.PP_COST_LOCAL)));
  // Create a private messageReceiver and listen for changes
  MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager();
  Integer intRegistryID = null;
  if (messageManager != null)
  {
    Object source = this;
    BaseMessageFilter messageFilter = new BaseMessageFilter(MessageConstants.TRX_RETURN_QUEUE, MessageConstants.INTERNET_QUEUE, source, null);
    messageManager.addMessageFilter(messageFilter);
    this.addProductRateMessageFilter(recProduct, messageFilter);
    recProduct.addListener(new FreeOnFreeHandler(messageFilter));
    intRegistryID = messageFilter.getRegistryID();
    recProduct.addListener(this.getProductCostHandler(screenRecord, intRegistryID));
  }
}
/**

相关文章