public Object get(String name) { return get(name, null); }
public Context getEnvironmentFactoryContext() { return getContext(Context.CONTEXTNAME_ENVIRONMENT_FACTORY); }
public <T> T get(Class<T> type, String[] searchOrder) { if (searchOrder == null) { searchOrder = getDefaultSearchOrder(); } for (int i = 0; i < searchOrder.length; i++) { Context context = contexts.get(searchOrder[i]); T o = context.get(type); if (o != null) { return o; } } return null; }
public BasicEnvironment() { contexts = new HashMap<String, Context>(); defaultSearchOrderList = new ArrayList<String>(); defaultSearchOrder = null; pushEnvironment(this); }
@Override public void close() { final Context context = getEnvironmentContext(); if (context instanceof Closable) { ((Closable) context).close(); } super.close(); if (LOG.isLoggable(Level.FINE)) { LOG.fine("closed " + this); } }
public Object get(String name, String[] searchOrder) { if (searchOrder == null) { searchOrder = getDefaultSearchOrder(); } for (int i = 0; i < searchOrder.length; i++) { Context context = contexts.get(searchOrder[i]); if (context.has(name)) { return context.get(name); } } return null; }
public <T> T get(Class<T> type) { return get(type, null); }
public Context getEnvironmentContext() { return getContext(Context.CONTEXTNAME_ENVIRONMENT); }
public String getUserId() { // if the authenticated user was explicitely set if (userId != null) { // return that one return userId; } // if an Authentication was specified Authentication authentication = get(Authentication.class); if (authentication != null) { // let the authentication do the work return authentication.getUserId(); } return null; }