Package com.google.inject

Examples of com.google.inject.OutOfScopeException



    private Context getContext() {
        Context context = localContext.get();
        if (context == null) {
            throw new OutOfScopeException("Cannot access scoped object. Either we"
                    + " are not currently inside an HTTP Servlet currentRequest, or you may"
                    + " have forgotten to apply " + DefaultArgoDispatcher.class.getName()
                    + " as a servlet filter for this currentRequest.");
        }
        return context;
View Full Code Here


            public T get()
            {
                LinkedList<ScopeState> stack = values.get();
                if ( stack == null || stack.isEmpty() )
                {
                    throw new OutOfScopeException( "Cannot access " + key + " outside of a scoping block" );
                }

                ScopeState state = stack.getFirst();

                Provider<?> seeded = state.seeded.get( key );
View Full Code Here

    }

    private <T> Map<Key<?>, Object> getScopedObjectMap(Key<T> key) {
        Map<Key<?>, Object> scopedObjects = values.get();
        if (scopedObjects == null) {
            throw new OutOfScopeException("Cannot access " + key + " outside of a scoping block");
        }
        return scopedObjects;
    }
View Full Code Here

    private <T> Map<Key<?>, Object> getScopedObjectMap(Key<T> key) {
        CandlepinSingletonScopeData scopeData = ResteasyProviderFactory.getContextData(
            CandlepinSingletonScopeData.class);
        if (scopeData == null) {
            throw new OutOfScopeException("Cannot access " + key +
                " outside of a scoping block");
        }
        return scopeData.get();
    }
View Full Code Here

        }
        else if (pinsetterSink != null) {
            return pinsetterSink;
        }
        else {
            throw new OutOfScopeException("Not in PinsetterScope or ServletScope!");
        }
    }
View Full Code Here

  @Provides
  Execution execution(ExecControl execControl) {
    try {
      return execControl.getExecution();
    } catch (ExecutionException e) {
      throw new OutOfScopeException("Cannot provide an instance of " + Execution.class.getName() + " as none is bound to the current thread (are you outside of a managed thread?)");
    }
  }
View Full Code Here

      new ThreadLocal<Context>();

  private static Context getContext() {
    final Context ctx = current.get();
    if (ctx == null) {
      throw new OutOfScopeException("Not in command/request");
    }
    return ctx;
  }
View Full Code Here

    return cast(new Provider<Object>() {
      @Override
      public Object get() {
        Map<Key<?>, Object> map = data();
        if (map == null) {
          throw new OutOfScopeException("Not in a PackScope");
        }
        Object toReturn = map.get(key);
        if (toReturn == null) {
          toReturn = unscoped.get();
          map.put(key, toReturn);
View Full Code Here

  }

  private static <T> Callable<T> transferHttpRequest(final Callable<T> callable) {
    final GuiceFilter.Context context = GuiceFilter.localContext.get();
    if (context == null) {
      throw new OutOfScopeException("Not in a request scope");
    }
    return new Callable<T>() {
      public T call() throws Exception {
        return context.call(callable);
      }
View Full Code Here

  }

  private static <T> Callable<T> transferNonHttpRequest(final Callable<T> callable) {
    final Context context = requestScopeContext.get();
    if (context == null) {
      throw new OutOfScopeException("Not in a request scope");
    }
    return new Callable<T>() {
      public T call() throws Exception {
        return context.call(callable);
      }
View Full Code Here

TOP

Related Classes of com.google.inject.OutOfScopeException

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.