Package de.danet.an.util.logging

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


     * {@link de.danet.an.workflow.api.Process <code>Processes</code>}
     * @throws RemoteException if a system-level error occurs.
     */
    public RangeAccess processes (FilterCriterion filter, SortCriterion order)
        throws RemoteException {
        RequestScope scope = RequestLog.enterScope
            (this, "processes", new Object[] { filter, order });
        ProcessDirectoryRangeAccess res = null;
        try {
            Criterion filterCriteria = HibernateUtil.convertFilterCriterion(filter);
            List orderCriteria = new ArrayList();
            while (order != null) {
                String sortProp = order.getSortProperty();
                if (sortProp.equals("key")) {
                    sortProp = "dbId";
                }
                if (order instanceof AscendingOrder) {
                    orderCriteria.add(Order.asc(sortProp));
                } else {
                    orderCriteria.add(Order.desc(sortProp));
                }
                order = order.getSubCriterion();
            }
            // serialize (1) because criteria can only be used once and
            // (2) to avoid hibernate classes on client side
            byte[] filterData = null;
            byte[] orderData = null;
            try {
                ByteArrayOutputStream bos = new ByteArrayOutputStream();
                ObjectOutputStream oos = new ObjectOutputStream(bos);
                oos.writeObject(filterCriteria);
                oos.flush();
                oos.close();
                filterData = bos.toByteArray();
                bos = new ByteArrayOutputStream();
                oos = new ObjectOutputStream(bos);
                oos.writeObject(orderCriteria);
                oos.flush();
                oos.close();
                orderData = bos.toByteArray();
            } catch (IOException e) {
                throw (IllegalStateException)
                    (new IllegalStateException()).initCause(e);
            }
            res = new ProcessDirectoryRangeAccess
                ((ExtProcessDirectory)ctx.getEJBObject(),
                 filterData, orderData);
        } finally {
            scope.leave (res);
        }
        return res;
    }
View Full Code Here


                (new IllegalArgumentException()).initCause(e);
        } catch (ClassNotFoundException e) {
            throw (IllegalArgumentException)
                (new IllegalArgumentException()).initCause(e);
        }
        RequestScope scope = RequestLog.enterScope
            (this, "processCount", new Object[] { filterCriterion });
        Session session = null;
        long result = 0;
        try {
            session = hibernateSessionFactory.openSession();
            Criteria curCrit = session.createCriteria(DAO.class);
            curCrit.setProjection(Projections.rowCount());
            if (filterCriterion != null) {
                curCrit.add(filterCriterion);
            }
            Object res = curCrit.uniqueResult();
            result = ((Number)res).longValue();
        } finally {
            if (session != null) {
                session.close();
            }
            scope.leave(new Long(result));
        }
        return result;
    }
View Full Code Here

     * @param end the index of the last item
     * @return the collection
     */
    public List processes
        (byte[] filterData, byte[] orderData, long start, long end) {
        RequestScope scope = RequestLog.enterScope
            (this, "processes", new Object[]
             { filterData, orderData, new Long(start), new Long(end) });
        List res = null;
        try {
            res = (List)processHome().findRange
                (filterData, orderData, start, end);
        } catch (ResourceNotAvailableException re) {
            throw new EJBException(re);
        } catch (FinderException fe) {
            throw new EJBException(fe);
        } catch (RemoteException re) {
            throw new EJBException(re);
        } finally {
            scope.leave(res);
        }
        return res;
    }
View Full Code Here

     * view-type="remote"
     */
    public de.danet.an.workflow.api.Process lookupProcess
  (String processMgrName, String processKey)
  throws InvalidKeyException {
        RequestScope scope = RequestLog.enterScope
            (this,"lookupProcess",new Object[] { processMgrName, processKey });
        de.danet.an.workflow.api.Process res = null;
  try {
      res = processHome().findByProcessKey(processKey);
  } catch (ObjectNotFoundException onfe) {
      ctx.setRollbackOnly();
            throw new InvalidKeyException
    ("No process of type = " + processMgrName + ", key = "
     + processKey + ": " + onfe.getMessage());
  } catch (ResourceNotAvailableException re) {
      throw new EJBException(re);
  } catch (FinderException fe) {
      throw new EJBException(fe);
  } catch (RemoteException re) {
      throw new EJBException(re);
  } finally {
      scope.leave(res);
  }
  return res;
    }
View Full Code Here

     * because it is still in progress.
     * @ejb.interface-method view-type="remote"
     */
    public void removeProcess(de.danet.an.workflow.omgcore.WfProcess process)
  throws CannotRemoveException {
        RequestScope scope = RequestLog.enterScope
            (this, "remoceProcess", new Object[] { process });
  try {
      ((WfProcess)process).remove();
  } catch (RemoteException re) {
      throw new CannotRemoveException(re.getMessage());
  } catch (RemoveException re) {
      throw new CannotRemoveException(re.getMessage());
  } finally {
      scope.leave();
  }
    }
View Full Code Here

     * @ejb.interface-method
     * view-type="remote"
     */
    public Activity lookupActivity (ActivityUniqueKey key)
  throws InvalidKeyException {
        RequestScope scope = RequestLog.enterScope
            (this, "lookupActivity", new Object[] { key });
        Activity res = null;
  try {
      Long pk = Long.valueOf (key.activityKey());
      res = activityHome().findByPrimaryKey(pk);
  } catch (NumberFormatException nex) {
      ctx.setRollbackOnly();
      throw new InvalidKeyException ("Cause: " + nex.getMessage ());
  } catch (FinderException nex) {
      throw new InvalidKeyException ("Cause: " + nex.getMessage ());
  } catch (RemoteException nex) {
      throw new EJBException (nex);
  } finally {
      scope.leave (res);
  }
  return res;
    }   
View Full Code Here

     * @ejb.interface-method
     * view-type="remote"
     */
    public de.danet.an.workflow.api.Activity.Info lookupActivityInfo
  (ActivityUniqueKey key) throws InvalidKeyException {
        RequestScope scope = RequestLog.enterScope
            (this, "lookupActivityInfo", new Object[] { key });
        de.danet.an.workflow.api.Activity.Info res = null;
  try {
      Long pk = Long.valueOf (key.activityKey());
      res = activityHome().findByPrimaryKey(pk).activityInfo();
  } catch (NumberFormatException nex) {
      ctx.setRollbackOnly();
      throw new InvalidKeyException ("Cause: " + nex.getMessage ());
  } catch (FinderException nex) {
      throw new EJBException (nex);
  } catch (RemoteException nex) {
      throw new EJBException (nex);
  } finally {
      scope.leave (scope);
  }
  return res;
    }   
View Full Code Here

     * @ejb.interface-method view-type="remote"
     * @ejb.transaction type="Supports"
     */
    public de.danet.an.workflow.api.ProcessDefinitionDirectory
  processDefinitionDirectory () {
        RequestScope scope = RequestLog.enterScope
            (this, "processDefinitionDirectory", new Object[] {});
        de.danet.an.workflow.api.ProcessDefinitionDirectory res = null;
        try {
            res = processDefinitionDirectoryHome().create();
  } catch (CreateException ce) {
      throw new EJBException (ce);
  } catch (RemoteException re) {
      throw new EJBException (re);
  } finally {
      scope.leave (res);
  }
  return res;
    }
View Full Code Here

     * @return the process directory.
     * @ejb.interface-method view-type="remote"
     * @ejb.transaction type="Supports"
     */
    public ProcessDirectory processDirectory () {
        RequestScope scope = RequestLog.enterScope
            (this, "processDirectory", new Object[] {});
        ProcessDirectory res = null;
  try {
      res = processDirectoryHome().create();
  } catch (CreateException ce) {
      throw new EJBException (ce);
  } catch (RemoteException re) {
      throw new EJBException (re);
  } finally {
      scope.leave (res);
  }
  return res;
    }
View Full Code Here

     * @return the resource assignment service
     * @ejb.interface-method view-type="local"
     * @ejb.transaction type="Supports"
     */
    public ResourceAssignmentService resourceAssignmentService () {
        RequestScope scope = RequestLog.enterScope
            (this, "resourceAssignmentService", new Object[] {});
        ResourceAssignmentService res = null;
        try {
            res = getRas ();
        } catch (RemoteException e) {
            throw new EJBException (e);
        } 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.