Package org.apache.avalon.framework.context

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


    String failedUserId = "unknown";

    try
    {
      DefaultPersistentFactory dpf = getFactory();
      Context c = dpf.getKeelContext();

      if (c != null)
      {
        UserEnvironment ue = (UserEnvironment) c.get(UserEnvironment.CONTEXT_KEY);

        if (ue == null)
        {
          failedUserName = "(No user logged in)";
        }
View Full Code Here


   */
  public ModelResponse execute(ModelRequest req) throws ModelException
  {
    ModelResponse res = req.createResponse();

    Context c = req.getContext();

    if (c == null)
    {
      throw new ModelException("No context established - request should have established context");
    }

    UserEnvironment userEnv = null;

    try
    {
      userEnv = (UserEnvironment) c.get(UserEnvironment.CONTEXT_KEY);

      if (userEnv != null)
      {
        int uid = userEnv.getUid();

View Full Code Here

    int uid = 0;

    try
    {
      Context ctx = req.getContext();
      UserEnvironment ue = null;

      if (ctx != null)
      {
        try
        {
          ue = (UserEnvironment) ctx.get(UserEnvironment.CONTEXT_KEY);
          uid = ue.getUid();
        }
        catch (ContextException ce)
        {
          log.debug("Unable to acces user environment from context!");
View Full Code Here

  {
    SequenceContext sc = null;

    try
    {
      Context ctx = req.getContext();

      if (ctx instanceof DefaultContext)
      {
        DefaultContext defContext = (DefaultContext) ctx;

        sc = (SequenceContext) defContext.get(CONTEXT_KEY);
      }
      else
      {
        sc = (SequenceContext) ctx.get(CONTEXT_KEY);
      }
    }
    catch (ContextException e)
    { //We get a ContextException if the key isn't found.
      sc = null;
View Full Code Here

        LogKitLoggerManager manager = new LogKitLoggerManager(null, hier, null, null);

        DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
        try {
            Configuration c = builder.buildFromFile(cfg);
            Context ctx = new DefaultContext();
            manager.contextualize(ctx);
            manager.configure(c);
        } catch (IllegalArgumentException e) {
            // This happens if the default log-target id-ref specifies a non-existent target
            System.out.println("Error processing logging config " + cfg);
View Full Code Here

        String area = "authoring";
        String proxyUrl = "http://www.apache-lenya-proxy-test.org";

        createMockPublication(pubId, area, proxyUrl);

        Context context = this.context;
        Map objectModel = (Map) context.get(ContextHelper.CONTEXT_OBJECT_MODEL);

        SourceResolver resolver = null;
        try {
            resolver = (SourceResolver) getManager().lookup(SourceResolver.ROLE);
            transformer.setup(new SourceResolverAdapter(resolver), objectModel, "",
View Full Code Here

        LogKitLoggerManager manager = new LogKitLoggerManager(null, hier, null, null);

        DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
        try {
            Configuration c = builder.buildFromFile(cfg);
            Context ctx = new DefaultContext();
            manager.contextualize(ctx);
            manager.configure(c);
        } catch (IllegalArgumentException e) {
            // This happens if the default log-target id-ref specifies a non-existent target
            System.out.println("Error processing logging config " + cfg);
View Full Code Here

    public static ServiceContainer create(
        ServiceContainerConfiguration serviceManagerConfig)
        throws Exception
    {
        Validate.notNull(serviceManagerConfig,"serviceManagerConfig");
        Context context = serviceManagerConfig.createFinalContext();
        return ServiceContainerFactory.create( serviceManagerConfig, context );
    }
View Full Code Here

        LogKitLoggerManager manager = new LogKitLoggerManager(null, hier, null, null);

        DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
        try {
            Configuration c = builder.buildFromFile(cfg);
            Context ctx = new DefaultContext();
            manager.contextualize(ctx);
            manager.configure(c);
        } catch (IllegalArgumentException e) {
            // This happens if the default log-target id-ref specifies a non-existent target
            System.out.println("Error processing logging config " + cfg);
View Full Code Here

        Map objectModel = new HashMap();
        FlowHelper.setContextObject(objectModel, flowContextObject);
        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/forms/datatype/FlowJXPathSelectionListTestCase.source.xml");
        Document sample = this.parser.parse(sampleSource.getInputStream());
        Element datatypeElement = (Element) sample.getElementsByTagNameNS(FormsConstants.DEFINITION_NS, "datatype").item(0);
        Datatype datatype = this.datatypeManager.createDatatype(datatypeElement, false);
        FlowJXPathSelectionList list = new FlowJXPathSelectionList
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.