Examples of RequestScope


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

     * the given ids exists.
     * @ejb.interface-method view-type="remote"
     */
    public ProcessDefinition lookupProcessDefinition
  (String packageId, String processId) throws InvalidKeyException {
        RequestScope scope = RequestLog.enterScope
            (this, "lookupProcessDefinition",
             new Object[] { packageId, processId });
        ProcessDefinition res = null;
        try {
            res = lookupProcessDefinitionInfo
                (packageId, processId).processDefinition;
        } finally {
            scope.leave (res);
        }
        return res;
    }
View Full Code Here

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

     * @ejb.interface-method view-type="local"
     * @ejb.transaction type="RequiresNew"
     */
    public ProcessDefinitionInfo lookupProcessDefinitionInfo
  (String packageId, String processId) throws InvalidKeyException {
        RequestScope scope = RequestLog.enterScope
            (this, "lookupProcessDefinitionInfo",
             new Object[] { packageId, processId });
  ProcessDefinitionInfo processDefinitionInfo = null;
  try {
       Connection con = null;
      PreparedStatement prepStmt = null;
      ResultSet rs = null;
      try {
    String processType = packageId + "/" + processId;
    con = ds.getConnection();
    prepStmt = con.prepareStatement
        ("SELECT DBID, ENABLED, XPDLREF FROM PROCESSDEFINITION "
         + "WHERE PACKAGEID = ? AND PROCESSID = ?");
    prepStmt.setString(1, packageId);
    prepStmt.setString(2, processId);
    rs = prepStmt.executeQuery();
    if(!rs.next()) {
        // cleanup cache as a side effect
        uncacheDefinition (processType);
        throw new InvalidKeyException
      ("No process with packageId/processId = "+ processType);
    }
    long dbid = rs.getLong(1);
    boolean enabled = (rs.getString(2).charAt(0) == 'T');
                Long xpdlRef = JDBCUtil.getLong(rs, 3);
                synchronized (processDefinitionInfoCache) {
                    processDefinitionInfo = (ProcessDefinitionInfo)
                        processDefinitionInfoCache.get(new Long(dbid));
                    if (processDefinitionInfo != null) {
                        if (processDefinitionInfo.dbid != dbid) {
                            uncacheDefinition(processType);
                            processDefinitionInfo = null;
                        }
                    }
                }
    if (processDefinitionInfo != null) {
        processDefinitionInfo.enabled = enabled;
        if (logger.isDebugEnabled ()) {
      logger.debug
          ("found (" + processDefinitionInfo
           .processDefinition.packageId()
           + "/" + processDefinitionInfo
           .processDefinition.processId() + ") "
           + "in cache");
        }
        return processDefinitionInfo;
    }
                rs.close();
                rs = null;
                prepStmt.close();
                prepStmt = null;
                String xpdl = null;
                // For backward compatibility allow xpdlref to be null
                if (xpdlRef != null) {
                    prepStmt = new UniversalPrepStmt
                        (con, "SELECT XPDL FROM XPDLARCHIVE WHERE DBID = ?");
                    prepStmt.setLong(1, xpdlRef.longValue());
                    rs = prepStmt.executeQuery();
                    if (rs.next()) {
                        xpdl = JDBCUtil.getString(ds, rs, 1);
                    }
                } else {
                    prepStmt = new UniversalPrepStmt
                        (con, "SELECT XPDL FROM PROCESSDEFINITION "
                         + "WHERE DBID = ?");
                    prepStmt.setLong(1, dbid);
                    rs = prepStmt.executeQuery();
                    if (rs.next()) {
                        xpdl = JDBCUtil.getString(ds, rs, 1);
                    }
                }
    processDefinitionInfo = new ProcessDefinitionInfo
        (dbid, xpdlRef,
         new DefaultProcessDefinition (xpdl), enabled);
    cacheDefinition(processDefinitionInfo);
    return processDefinitionInfo;
      } finally {
    JDBCUtil.closeAll (rs, prepStmt, con);
      }
  } catch (SQLException se) {
      throw new EJBException(se);
  } catch (IOException ioe) {
      throw new EJBException(ioe);
  } catch (ImportException pe) {
      throw new EJBException(pe);
  } finally {
      scope.leave (processDefinitionInfo);
  }
    }
View Full Code Here

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

     * the given ids exists.
     * @ejb.interface-method view-type="remote"
     */
    public boolean isEnabled(String packageId, String processId)
  throws InvalidKeyException {
        RequestScope scope = RequestLog.enterScope
            (this, "isEnabled", new Object[] { packageId, processId });
  boolean enabled = false;
  Connection con = null;
  ResultSet rs = null;
  PreparedStatement prepStmt = null;
  try {
      con = ds.getConnection();
      prepStmt = con.prepareStatement
    ("SELECT ENABLED FROM PROCESSDEFINITION "
    + "WHERE PACKAGEID = ? AND PROCESSID = ?");
      prepStmt.setString(1, packageId);
      prepStmt.setString(2, processId);
      rs = prepStmt.executeQuery();
      if(!rs.next()) {
    ctx.setRollbackOnly();
                throw new InvalidKeyException
        ("No process with packageId/processId = "
         + packageId + "/" + processId);
      }
      if (rs.getString(1).charAt(0) == 'T') {
    enabled = true;
      }
      return enabled;
  } catch (SQLException se) {
      throw new EJBException(se);
  } finally {
      try {
    JDBCUtil.closeAll (rs, prepStmt, con);
      } catch (SQLException e) {
    throw new EJBException(e);
      }
      scope.leave(new Boolean (enabled));
  }
    }
View Full Code Here

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

     * @ejb.interface-method view-type="remote"
     */
    public void setEnabled
  (String packageId, String processId, boolean enabled)
  throws InvalidKeyException {
        RequestScope scope = RequestLog.enterScope
            (this, "setEnabled",
             new Object[] { packageId, processId, new Boolean (enabled) });
  Connection con = null;
  PreparedStatement prepStmt = null;
  try {
      con = ds.getConnection();
      prepStmt = con.prepareStatement
    ("UPDATE PROCESSDEFINITION SET ENABLED = ? "
     + "WHERE PACKAGEID = ? AND PROCESSID = ?");
      if (enabled) {
    prepStmt.setString(1, "T");
      } else {
    prepStmt.setString(1, "F");
      }
      prepStmt.setString(2, packageId);
      prepStmt.setString(3, processId);
      int rowCount = prepStmt.executeUpdate();
      if (rowCount == 0) {
                ctx.setRollbackOnly();
    throw new InvalidKeyException
        ("No process with packageId/processId = "
         + packageId + "/" + processId);
      }

  } catch (SQLException se) {
      throw new EJBException(se);
  } finally {
      try {
    JDBCUtil.closeAll (null, prepStmt, con);
      } catch (SQLException e) {
    throw new EJBException(e);
      }
      scope.leave();
  }
    } 
View Full Code Here

Examples of jodd.petite.scope.RequestScope

    final PetiteContainer pc = new PetiteContainer();

    SingletonScope singletonScope = pc.resolveScope(SingletonScope.class);
    ProtoScope protoScope = pc.resolveScope(ProtoScope.class);
    SessionScope sessionScope = pc.resolveScope(SessionScope.class);
    RequestScope requestScope = pc.resolveScope(RequestScope.class);

    assertTrue(singletonScope.accept(singletonScope));
    assertFalse(singletonScope.accept(protoScope));
    assertFalse(singletonScope.accept(sessionScope));
    assertFalse(singletonScope.accept(requestScope));

    assertTrue(protoScope.accept(singletonScope));
    assertTrue(protoScope.accept(protoScope));
    assertTrue(protoScope.accept(sessionScope));
    assertTrue(protoScope.accept(requestScope));

    assertTrue(sessionScope.accept(singletonScope));
    assertFalse(sessionScope.accept(protoScope));
    assertTrue(sessionScope.accept(sessionScope));
    assertFalse(sessionScope.accept(requestScope));

    assertTrue(requestScope.accept(singletonScope));
    assertFalse(requestScope.accept(protoScope));
    assertTrue(requestScope.accept(sessionScope));
    assertTrue(requestScope.accept(requestScope));
  }
View Full Code Here

Examples of org.glassfish.jersey.process.internal.RequestScope

    }

    @Override
    public Response invoke() throws ProcessingException, WebApplicationException {
        final ClientRuntime runtime = request().getClientRuntime();
        final RequestScope requestScope = runtime.getRequestScope();
        return requestScope.runInScope(new Producer<Response>() {
            @Override
            public Response call() throws ProcessingException {
                return new InboundJaxrsResponse(runtime.invoke(requestContext), requestScope);
            }
        });
View Full Code Here

Examples of org.springframework.web.context.request.RequestScope

    } else {
      flowContext = new GenericApplicationContext();
    }
    flowContext.setDisplayName("Flow ApplicationContext [" + getContext().getFlowId() + "]");
    flowContext.setParent(parent);
    flowContext.getBeanFactory().registerScope("request", new RequestScope());
    flowContext.getBeanFactory().registerScope("flash", new FlashScope());
    flowContext.getBeanFactory().registerScope("view", new ViewScope());
    flowContext.getBeanFactory().registerScope("flow", new FlowScope());
    flowContext.getBeanFactory().registerScope("conversation", new ConversationScope());
    Resource flowResource = flowModelHolder.getFlowModelResource();
View Full Code Here

Examples of org.springframework.web.context.request.RequestScope

  }

  public void setUpApplicationContextWithScopes(ConfigurableApplicationContext applicationContext) {
    assert applicationContext!=null;
    ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory();
    beanFactory.registerScope("request", new RequestScope());
    beanFactory.registerScope("session", new SessionScope(false));
    beanFactory.registerScope("globalSession", new SessionScope(true));

    beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(getServletContext(),
        getConfig()));
View Full Code Here

Examples of org.springframework.web.context.request.RequestScope

   * with the given BeanFactory, as used by the Portlet ApplicationContext.
   * @param beanFactory the BeanFactory to configure
   * @param pc the PortletContext that we're running within
   */
  static void registerPortletApplicationScopes(ConfigurableListableBeanFactory beanFactory, PortletContext pc) {
    beanFactory.registerScope(WebApplicationContext.SCOPE_REQUEST, new RequestScope());
    beanFactory.registerScope(WebApplicationContext.SCOPE_SESSION, new SessionScope(false));
    beanFactory.registerScope(WebApplicationContext.SCOPE_GLOBAL_SESSION, new SessionScope(true));
    if (pc != null) {
      PortletContextScope appScope = new PortletContextScope(pc);
      beanFactory.registerScope(WebApplicationContext.SCOPE_APPLICATION, appScope);
View Full Code Here

Examples of org.springframework.web.context.request.RequestScope

   * with the given BeanFactory, as used by the WebApplicationContext.
   * @param beanFactory the BeanFactory to configure
   * @param sc the ServletContext that we're running within
   */
  public static void registerWebApplicationScopes(ConfigurableListableBeanFactory beanFactory, ServletContext sc) {
    beanFactory.registerScope(WebApplicationContext.SCOPE_REQUEST, new RequestScope());
    beanFactory.registerScope(WebApplicationContext.SCOPE_SESSION, new SessionScope(false));
    beanFactory.registerScope(WebApplicationContext.SCOPE_GLOBAL_SESSION, new SessionScope(true));
    if (sc != null) {
      ServletContextScope appScope = new ServletContextScope(sc);
      beanFactory.registerScope(WebApplicationContext.SCOPE_APPLICATION, appScope);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.