Package org.apache.avalon.framework.context

Examples of org.apache.avalon.framework.context.Context


        request.setAttribute(FlowHelper.CONTEXT_OBJECT, flowContextObject);
        Map objectModel = new HashMap();
        objectModel.put(ObjectModelHelper.REQUEST_OBJECT, request);
        Map contextObjectModel = new HashMap();
        contextObjectModel.put(ContextHelper.CONTEXT_OBJECT_MODEL, objectModel);
        Context context = new DefaultContext(contextObjectModel);
        Source sampleSource = new ResourceSource("resource://org/apache/cocoon/woody/datatype/FlowJXPathSelectionListTestCase.source.xml");
        Document sample = parser.parse(sampleSource.getInputStream());
        Element datatypeElement = (Element) sample.getElementsByTagNameNS(Constants.WD_NS, "datatype").item(0);
        Datatype datatype = datatypeManager.createDatatype(datatypeElement, false);
        FlowJXPathSelectionList list = new FlowJXPathSelectionList
View Full Code Here


    {
      return false;
    }

    Map m = this.getContextData();
    Context oc = (Context) o;
    Object oneKey = null;
    Object oneValue = null;

    for (Iterator i = m.keySet().iterator(); i.hasNext();)
    {
      oneKey = i.next();
      oneValue = m.get(oneKey);

      try
      {
        if (! oc.get(oneKey).equals(oneValue))
        {
          return false;
        }
      }
      catch (ContextException ce)
View Full Code Here

        authMgr.setUsername(user.getName());
        authMgr.setPassword(event.getPlainPassword());
        authMgr.setDomain("default");

        UserEnvironment userEnvironment = new DefaultUserEnvironment();
        Context context = new DefaultContext();

        ((DefaultContext) context).put(UserEnvironment.CONTEXT_KEY, userEnvironment);
        authMgr.login(userEnvironment);
        keelIritgoAuthMap.put(new Long(user.getUniqueId()), context);
      }
      catch (Exception x)
      {
        x.printStackTrace();
      }
      finally
      {
        ModelTools.releaseModelRequest(req);
      }
    }

    if ((event != null) && (event.isLoggedOut()))
    {
      User user = event.getUser();

      ModelRequest req = null;

      try
      {
        req = ModelTools.createModelRequest();

        AuthenticationManager authMgr = (AuthenticationManager) req.getService(AuthenticationManager.ROLE, "*");

        authMgr.setUsername(user.getName());
        authMgr.setPassword("");
        authMgr.setDomain("default");

        Context c = (Context) keelIritgoAuthMap.get(new Long(user.getUniqueId()));
        UserEnvironment userEnv = (UserEnvironment) c.get(UserEnvironment.CONTEXT_KEY);

        authMgr.logout(userEnv);
        keelIritgoAuthMap.remove(user.getUniqueId());
      }
      catch (Exception x)
View Full Code Here

    {
      Model model = null;

      req = ModelTools.createModelRequest();

      Context context = (Context) keelIritgoAuthMap.get(new Long(userUniqueId));

      if (context != null)
      {
        model = (Model) req.getService(Model.ROLE, properties.getProperty("model"), context);
      }
View Full Code Here

    {
      Model model = null;

      req = ModelTools.createModelRequest();

      Context context = (Context) keelIritgoAuthMap.get(new Long(userUniqueId));

      PersistentFactory persistentManager = null;

      if (context != null)
      {
View Full Code Here

    return instrConfig;
  }

  public Context getContext()
  {
    Context returnValue = null;

    if (context == null)
    {
      returnValue = new DefaultContext();
    }
View Full Code Here

   */
  public static Integer getCurrentUserId(ModelRequest req)
  {
    try
    {
      Context context = req.getContext();

      UserEnvironment userEnv = (UserEnvironment) context.get(UserEnvironment.CONTEXT_KEY);

      if (userEnv != null && userEnv.getUid() != UserEnvironment.ANONYMOUS_UID)
      {
        return new Integer(userEnv.getUid());
      }
View Full Code Here

   */
  public static String getCurrentUserName(ModelRequest req)
  {
    try
    {
      Context context = req.getContext();
      UserEnvironment userEnv = (UserEnvironment) context.get(UserEnvironment.CONTEXT_KEY);

      if (userEnv != null && userEnv.getUid() != UserEnvironment.ANONYMOUS_UID)
      {
        return userEnv.getLoginName();
      }
View Full Code Here

   */
  public static Object getUserEnvObject(ModelRequest req, String key)
  {
    try
    {
      Context context = req.getContext();

      UserEnvironment userEnv = (UserEnvironment) context.get(UserEnvironment.CONTEXT_KEY);

      if (userEnv != null)
      {
        return userEnv.getAttribute(key);
      }
View Full Code Here

   */
  public static void setUserEnvObject(ModelRequest req, String key, Object val)
  {
    try
    {
      Context context = req.getContext();
      UserEnvironment userEnv = (UserEnvironment) context.get(UserEnvironment.CONTEXT_KEY);

      if (userEnv != null)
      {
        userEnv.setAttribute(key, val);
      }
View Full Code Here

TOP

Related Classes of org.apache.avalon.framework.context.Context

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.