Package org.apache.avalon.framework.context

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


                DefaultContext newContext = new DefaultContext(context);
                newContext.put("context-root",projectHome + "/build/webapp");
                currentContext = newContext;
            }
        } catch (Exception e) {
            throw new ContextException("Error getting forrest.home java property.",e);
        }
        super.contextualize( currentContext );
    }
View Full Code Here


                }
            }
            catch( MalformedURLException mue )
            {
                this.getLogger().warn( "Malformed URL for user.dir, and no container.rootDir exists", mue );
                throw new ContextException( "Malformed URL for user.dir, and no container.rootDir exists", mue );
            }
        }
        catch( MalformedURLException mue )
        {
            this.getLogger().warn( "Malformed URL for container.rootDir", mue );
            throw new ContextException( "Malformed URL for container.rootDir", mue );
        }
    }
View Full Code Here

                this.configurationFile = new DelayedRefreshSourceWrapper(urlSource,
                    1000L
                );

            } catch (IOException ioe) {
                throw new ContextException("Could not open configuration file.", ioe);
            } catch (Exception e) {
                throw new ContextException("contextualize(..) Exception", e);
            }
        }
    }
View Full Code Here

        // set up file
        m_persistentFile = new File(
                    ctx.getRealPath("/WEB-INF"),
                        DefaultEventRegistryImpl.PERSISTENT_FILE);
        if (m_persistentFile == null) {
            throw new ContextException("Could not obtain persistent file. " +
                "The cache event registry cannot be " +
                "used inside an unexpanded WAR file.");
        }
  }
View Full Code Here

                DefaultContext newContext = new DefaultContext(context);
                newContext.put("context-root",projectHome + "/build/webapp");
                currentContext = newContext;
            }
        } catch (Exception e) {
            throw new ContextException("Error getting forrest.home java property.",e);
        }
        super.contextualize( currentContext );
    }
View Full Code Here

                }
            }
            catch( MalformedURLException mue )
            {
                getLogger().warn( "Malformed URL for user.dir, and no container.rootDir exists", mue );
                throw new ContextException( "Malformed URL for user.dir, and no container.rootDir exists", mue );
            }
        }
        catch( MalformedURLException mue )
        {
            getLogger().warn( "Malformed URL for container.rootDir", mue );
            throw new ContextException( "Malformed URL for container.rootDir", mue );
        }
    }
View Full Code Here

        // set up file
        m_persistentFile = new File(
                    ctx.getRealPath("/WEB-INF"),
                        DefaultEventRegistryImpl.PERSISTENT_FILE);
        if (m_persistentFile == null) {
            throw new ContextException("Could not obtain persistent file. " +
                "The cache event registry cannot be " +
                "used inside an unexpanded WAR file.");
        }
  }
View Full Code Here

    public void contextualize(Context context) throws ContextException {
        this.contextFactory.contextualize(context);
        try {
            this.contextFactory.service(new SimpleServiceManager(this));
        } catch (ServiceException se) {
            throw new ContextException("Unable to service context factory.", se);
        }

        try {
            // Similar to Excalibur's SourceResolverImpl, and consistent with ContextHelper.CONTEXT_ROOT_URL
            if( context.get("context-root") instanceof URL) {
                contextBase = ((URL)context.get("context-root")).toExternalForm();
            } else {
                contextBase = ((File)context.get("context-root")).toURL().toExternalForm();
            }
        } catch(ContextException ce) {
            // set the base URL to the current directory
            try {
                contextBase = new File(System.getProperty("user.dir")).toURL().toExternalForm();
            } catch( MalformedURLException mue) {
                throw new ContextException( "Malformed URL for user.dir, and no context-root exists", mue);
            }
        } catch( MalformedURLException mue) {
            throw new ContextException("Malformed URL for context-root", mue);
        }

        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Base URL set to " + this.contextBase);
        }
View Full Code Here

                urlSource.init((URL) context.get(Constants.CONTEXT_CONFIG_URL), null);
                this.configurationFile = new DelayedRefreshSourceWrapper(urlSource,
                                                                         1000L);

            } catch (IOException e) {
                throw new ContextException("Could not open configuration file.", e);
            } catch (Exception e) {
                throw new ContextException("contextualize(..) Exception", e);
            }
        }
    }
View Full Code Here

        final SimpleSourceResolver resolver = new SimpleSourceResolver();
        resolver.enableLogging(logger);
        try {
            resolver.contextualize(this.context);
        } catch (ContextException ce) {
            throw new ContextException(
                    "Cannot setup source resolver.", ce);
        }
        return resolver;
    }
View Full Code Here

TOP

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

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.