Package org.araneaframework.framework

Examples of org.araneaframework.framework.ThreadContext


 
  /**
   * @see org.araneaframework.servlet.PopupWindowContext#open(java.lang.String, org.araneaframework.servlet.support.PopupWindowProperties, org.araneaframework.Message)
   */
  public String open(String id, PopupWindowProperties properties, Message startMessage) throws Exception {
    ThreadContext currentThreadCtx = ((ThreadContext)getEnvironment().getEntry(ThreadContext.class));
   
    // append random suffix for requested service id
    String rndString = RandomStringUtils.random(8, false, true);
    id = (id != null) ? new StringBuffer(id).append(rndString).toString() : rndString;
   
    BeanFactory factory = (BeanFactory) getEnvironment().getEntry(BeanFactory.class);
    // TODO:: some better way in framework?
    Service service = (Service) factory.getBean("servletServiceAdapterComponent");
   
    currentThreadCtx.addService(id, service);
   
    if (startMessage != null)
      startMessage.send(null, service);
   
    //add new, not yet opened popup to popup and popup properties maps
View Full Code Here


    log.debug("popup with id = '" + id + "' was opened");
    return id;
  }
 
  public void close(String id) throws Exception {
    ThreadContext currentThreadCtx = ((ThreadContext)getEnvironment().getEntry(ThreadContext.class));
   
    if (!popupProperties.containsKey(id) || popupProperties.get(id) == null) {
      //XXX throw some exception - or better not?
      log.warn("Attempt to close non-owned, unopened or already closed popup +'" + id + "'.");
    } else {
      currentThreadCtx.close(id);
      popups.remove(id);
     
      popupProperties.remove(id);
      if (log.isDebugEnabled())
        log.debug("popup with id = '" + id + "' was closed");
View Full Code Here

  protected void action(Path path, InputData input, OutputData output) throws Exception {
    super.action(path, input, output);
  }
 
  protected void event(Path path, InputData input) throws Exception {
    ThreadContext currentThreadCtx = ((ThreadContext)getEnvironment().getEntry(ThreadContext.class));
    HttpServletRequest request = ((ServletInputData) input).getRequest();
   
    if (request.getParameter(POPUPS_CLOSE_KEY) != null) {
      if (log.isDebugEnabled())
        log.debug("Should be closing myself now, threadId  = '" + currentThreadCtx.getCurrentId() + "'" );
      currentThreadCtx.close(currentThreadCtx.getCurrentId());
    }
    else {
      super.event(path, input);
    }
  }
View Full Code Here

    service.setDefaultServiceId("child1");
  }
 
  public void testCloseRemoves() throws Exception {
    service._getService().action(MockUtil.getPath(), input, output);
    ThreadContext sess =
      (ThreadContext)child1.getTheEnvironment().getEntry(ThreadContext.class);
    sess.close("child1");
    assertTrue(child1.getDestroyCalled());
  }
View Full Code Here

TOP

Related Classes of org.araneaframework.framework.ThreadContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.