Package org.apache.avalon.framework.context

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


                }
            }
            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


                DefaultContext newContext = new DefaultContext(context);
                newContext.put("context-root", ForrestConfUtils.getProjectWebappHome());
                currentContext = newContext;
            }
        } catch (Exception e) {
            throw new ContextException("Error getting forrest.home java property.",e);
        }
        super.contextualize( currentContext );
    }
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 Object get( final Object key )
    throws ContextException {
        if ( key.equals(ContextHelper.CONTEXT_OBJECT_MODEL)) {
            final Environment env = CocoonComponentManager.getCurrentEnvironment();
            if ( env == null ) {
                throw new ContextException("Unable to locate " + key + " (No environment available)");
            }
            return env.getObjectModel();
        }
        if ( key instanceof String ) {
            String stringKey = (String)key;
            if ( stringKey.startsWith(OBJECT_MODEL_KEY_PREFIX) ) {
                final Environment env = CocoonComponentManager.getCurrentEnvironment();
                if ( env == null ) {
                    throw new ContextException("Unable to locate " + key + " (No environment available)");
                }
                final Map objectModel = env.getObjectModel();
                String objectKey = stringKey.substring(OBJECT_MODEL_KEY_PREFIX.length());
               
                Object o = objectModel.get( objectKey );
                if ( o == null ) {
                    final String message = "Unable to locate " + key;
                    throw new ContextException( message );
                }
                return o;
            }
        }
        return super.get( key );
View Full Code Here

        {
            return m_name;
        }
        else
        {
            throw new ContextException( "Unknown key: " + key );
        }
    }
View Full Code Here

                                                       this.componentManager);


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

            try {
                File applicationHome =
                    (File)context.get(AvalonContextConstants.APPLICATION_HOME);
                baseDirectory = applicationHome.toString();
            } catch (ContextException ce) {
                throw new ContextException("Encountered exception when resolving application home in Avalon context.", ce);
            } catch (ClassCastException cce) {
                throw new ContextException("Application home object stored in Avalon context was not of type java.io.File.", cce);
            }
            StringBuffer fileNameBuffer =
                new StringBuffer(128)
                    .append(baseDirectory)
                    .append(File.separator)
                            .append(fileName);
            fileName = fileNameBuffer.toString();
        }
        try {
            File returnValue = (new File(fileName)).getCanonicalFile();
            return returnValue;
        } catch (IOException ioe) {
            throw new ContextException("Encountered an unexpected exception while retrieving file.", ioe);
        }
    }
View Full Code Here

                    1000L
                );

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

            }
            catch (Throwable t)
            {
                String msg = "Contextualizing the following service failed : " + this.getShorthand();
                this.getParentLogger().error(msg,t);
                throw new ContextException(msg,t);
            }
        }
    }
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

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.