org.drombler.commons.context.ContextManager Maven / Gradle / Ivy
/*
* COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Notice
*
* The contents of this file are subject to the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL)
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.opensource.org/licenses/cddl1.txt
*
* The Original Code is Drombler.org. The Initial Developer of the
* Original Code is Florian Brunner (Sourceforge.net user: puce).
* Copyright 2014 Drombler.org. All Rights Reserved.
*
* Contributor(s): .
*/
package org.drombler.commons.context;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This {@link Context} manager allows to register local contexts for objects and manages the Application Context and the current Active Context.
*
* The Active Context provides access to the content of the currently active local Context.
*
* The Application-wide Context provides access to the combined content of all registered local Contexts.
*
* @author puce
*/
public class ContextManager implements ActiveContextProvider, ApplicationContextProvider {
private static final Logger LOG = LoggerFactory.getLogger(ContextManager.class);
private final ProxyContext applicationContext = new ProxyContext();
private final ProxyContext activeContext = new ProxyContext();
private final Context applicationContextWrapper = new ContextWrapper(applicationContext);
private final Context activeContextWrapper = new ContextWrapper(activeContext);
// TODO use Identity or Weak HashMap?
private final Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy