Package de.danet.an.util.logging

Examples of de.danet.an.util.logging.RequestScope


     * Called by the portlet container to allow the portlet to process an
     * action request.
     */
    public void processAction(ActionRequest request, ActionResponse response)
            throws PortletException, IOException {
        RequestScope scope = RequestLog.enterScope
            (this, "processAction", new Object[] { request, response });
        try {
            doProcessAction(request, response);
        } finally {
            scope.leave();
        }
    }
View Full Code Here


     * Helper method to serve up the view mode.
     */
    protected void doView(RenderRequest request, RenderResponse response)
            throws PortletException, IOException
    {
        RequestScope scope = RequestLog.enterScope
            (this, "doView", new Object[] { request, response });
        try {
            facesRender(request, response);
        } finally {
            scope.leave();
        }
    }
View Full Code Here

     * the edit mode concept to a JSF application.
     */
    protected void doEdit(RenderRequest request, RenderResponse response)
            throws PortletException, IOException
    {
        RequestScope scope = RequestLog.enterScope
            (this, "doEdit", new Object[] { request, response });
        try {
            facesRender(request, response);
        } finally {
            scope.leave();
        }
    }
View Full Code Here

     * the help mode concept to a JSF application.
     */
    protected void doHelp(RenderRequest request, RenderResponse response)
            throws PortletException, IOException
    {
        RequestScope scope = RequestLog.enterScope
            (this, "doHelp", new Object[] { request, response } );
        try {
            facesRender(request, response);
        } finally {
            scope.leave();
        }
    }
View Full Code Here

     * @see javax.servlet.http.HttpServlet#doGet
     */
    protected void doPost
        (HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
        RequestScope scope = RequestLog.enterScope
            (this, "doPost", new Object[] { request, response });
        try {
            if (logger.isDebugEnabled()) {
                logger.debug("Ajax request: " + request.getRequestURL());
            }
            if (request.getSession(false) == null) {
                response.sendError(HttpServletResponse.SC_GONE);
                return;
            }

            // make external context
            AjaxExternalContext externalContext
            = AjaxExternalContext.makeContext(request, response);
            // use session map to access portlet session
            Map sessionMap = externalContext.getSessionMap();
            // restore faces context
            String lifecycleId = (String)
            sessionMap.get(MyFacesAdaptedPortlet.LIFECYCLE_ID);
            if (lifecycleId == null) {
                response.sendError(HttpServletResponse.SC_NOT_FOUND);
                return;
            }
            Lifecycle lifecycle = lifecycleFactory.getLifecycle(lifecycleId);
            ServletFacesContextImpl facesContext = (ServletFacesContextImpl)
            facesContextFactory.getFacesContext
            (getServletContext(), request, response, lifecycle);
            facesContext.setExternalContext(externalContext);
            lifecycle.execute(facesContext);
            facesContext.getApplication()
            .getStateManager().saveSerializedView(facesContext);
        } finally {
            scope.leave();
        }
    }
View Full Code Here

    /**
     * Called by container when a new message is to be processed.
     * @param message the message.
     */
    public void onMessage(Message message) {
        RequestScope scope = RequestLog.enterScope
            (this, "onMessage", new Object[] { message });
  try {
      if (logger.isDebugEnabled() && message.getJMSRedelivered()) {
    String msgId = "(unkown)";
    try {
        msgId = message.getJMSMessageID();
    } catch (JMSException ee) {
        logger.debug
      ("Cannot obtain message id: " + ee.getMessage ());
    }
    logger.debug ("Handling redelivered message " + msgId);
      }
      Map args = new HashMap((Map)((ObjectMessage)message).getObject());
            Activity act = ActivityProxy.wrap
                ((ActivityUniqueKey)args.get("activityUniqueKey"));
      args.put ("activity", act);
      args.remove("activityUniqueKey");
      ExtApplication appl = (ExtApplication)args.get("appl");
      Map params = (Map)args.get("params");
      doInvoke (null, invocationHelper(), act, appl, params, true);
  } catch (RemoteException e) {
      // a RemoteException should be a temporary condition,
      // i.e. message may be redelivered.
      String msgId = "(unkown)";
      try {
    msgId = message.getJMSMessageID();
      } catch (JMSException ee) {
    logger.debug ("Cannot obtain message id: " + ee.getMessage ());
      }
      logger.debug
    ("Temporary problem invoking application for message "
     + msgId + " (retrying): " + e.getMessage (), e);
            // WLS seems to have problems with invoking setRollbackOnly twice
            if (!ctx.getRollbackOnly()) {
                ctx.setRollbackOnly();
            }
  } catch (Throwable t) {
      // avoid redelivery of message.
      logger.error (t.getMessage(), t);
  } finally {
      scope.leave();
 
    }
View Full Code Here

    public static void doInvoke
  (WorkflowEngine wfe, InvocationHelperLocal invHlp, Activity act,
   ExtApplication appl, Map params, boolean useNew)
  throws RemoteException {
  ExtApplication.InvocationResult res = null;
  RequestScope scope = RequestLog.enterScope
      (ApplInvokerEJB.class, "doInvoke",
       new Object[] { wfe,invHlp,act,appl,params,new Boolean(useNew) });
  if (RequestLog.isEnabled()) {
      scope.logMessage
          ("Invoking " + appl.toString() + "from " + act.toString()
           + " with parameters " + params.toString());
  }
  try {
      // Invoke in separate transaction. Else all exceptions
      // thrown by EJB methods invoked from the application
      // cause a roll back of this transaction and no
      // ToolInvocationFailedAuditEvent will be recorded and
      // the invocation will be repeated (maybe endlessly)
      res = invHlp.doInvoke(wfe, appl, act, params);
      if (res != null) {
          Object resVal = res.result();
          if (useNew) {
        while (true) {
      try {
          if (resVal instanceof ExceptionResult) {
        invHlp.doAbandon
            (wfe, act, (ExceptionResult)resVal);
        break;
          }
          invHlp.doFinish (wfe, act, (Map)resVal);
          break;
                        } catch (EJBException e) {
                            // Probably deadlock
                            logger.warn ("Error while finishing, repeating: "
                                         + e.getMessage());
      }
        }
    } else {
        if (resVal instanceof ExceptionResult) {
      ((ExtActivity)act).abandon((ExceptionResult)resVal);
        } else {
            if (act instanceof ActivityProxy) {
                Activity aun = ((ActivityProxy)act).unwrap();
                aun.setResult(new DefaultProcessData ((Map)resVal));
                aun.complete ();
            }
        }
    }
      }
           if (RequestLog.isEnabled()) {
               scope.logMessage
                   ("Result is: " + (res == null ? "null" : res.toString()));
           }
        } catch (RemoteException e) {
            // Indicates that the invocation should be retried,
            // simply re-throw.
            logger.warn (appl + " has requested re-invocation: "
                         + e.getMessage());
            logger.debug ("Stack trace:", e);
            throw e;
        } catch (EJBException e) {
            // Indicates that the invocation should be retried,
            // simply re-throw.
            logger.warn (appl + " has requested re-invocation: "
                         + e.getMessage());
            logger.debug ("Stack trace:", e);
            throw (RemoteException)
                (new RemoteException (e.getMessage(), e));
  } catch (Throwable e) {
      if ((e instanceof ToolInvocationException)
          && e.getCause() != null
          && (e.getCause() instanceof CannotExecuteException)) {
          Throwable t = e.getCause();
          if (t.getCause() != null) {
              t = t.getCause();
          }
          logger.warn(appl + " reports " + t.getClass().getName()
                + " during invocation (" + act + " will be terminated): "
                + t.getMessage(), t);
      } else {
          logger.error
          ("Problem invoking " + appl
                  + " (" + act + " will be terminated): "
                  + e.getClass().getName() + ": " + e.getMessage(), e);
      }
      invHlp.handleToolInvocationFailed(wfe, act.uniqueKey());
      return;
  } finally {
      scope.leave();
  }
    }
View Full Code Here

     * or an empty collection if no processes are found.
     * @ejb.interface-method
     * view-type="remote"
     */
    public Collection processMgrNames() {
        RequestScope scope = RequestLog.enterScope
            (this, "processMgrNames", (Object[])null);
        Collection definitionTypes = null;
        try {
            definitionTypes = new ArrayList();
            Connection con = null;
            Statement stmt = null;
            ResultSet rs = null;
            try {
                try {
                    con = ds.getConnection();
                    String selectStatement
                        = "SELECT distinct processMgr FROM process";
                    stmt = con.createStatement();
                    rs = stmt.executeQuery(selectStatement);
                    while (rs.next()) {
                        String type = rs.getString(1);
                        definitionTypes.add(type);
                    }
                } finally {
                    JDBCUtil.closeAll (rs, stmt, con);
                }
            } catch (SQLException se) {
                throw new EJBException(se);
            }
        } finally {
            scope.leave(definitionTypes);
        }
        return definitionTypes;
    }
View Full Code Here

     * @ejb.interface-method
     * view-type="remote"
     */
    public Collection processNames() {
        Collection processNames = new ArrayList();
        RequestScope scope = RequestLog.enterScope
            (this, "processNames", (Object[])null);
        try {
            Connection con = null;
            Statement stmt = null;
            ResultSet rs = null;
            try {
                con = ds.getConnection();
                String selectStatement
                    = "SELECT DISTINCT NAME FROM PROCESS ORDER BY NAME";
                stmt = con.createStatement();
                rs = stmt.executeQuery(selectStatement);
                while (rs.next()) {
                    String name = rs.getString(1);
                    processNames.add(name);
                }
            } finally {
                JDBCUtil.closeAll (rs, stmt, con);
            }
        } catch (SQLException se) {
            throw new EJBException(se);
        } finally {
            scope.leave (processNames);
        }
        return processNames;
    }
View Full Code Here

     * @return a Collection object
     * @ejb.interface-method
     * view-type="remote"
     */
    public Collection processes() {
        RequestScope scope = RequestLog.enterScope
            (this, "processes", (Object[])null);
        Collection res = null;
  try {
      res = processHome().findAll();
  } catch (ResourceNotAvailableException re) {
      throw new EJBException(re);
  } catch (FinderException ne) {
      throw new EJBException(ne);
  } catch (RemoteException re) {
      throw new EJBException(re);
  } finally {
      scope.leave (res);
  }
  return res;
    }
View Full Code Here

TOP

Related Classes of de.danet.an.util.logging.RequestScope

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.