Package org.apache.avalon.framework.context

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


                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


            }
            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

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

        org.apache.cocoon.environment.Context ctx =
                (org.apache.cocoon.environment.Context) context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
        // test if we are running inside a WAR file
        final String dbPath = ctx.getRealPath("/WEB-INF/db");
        if (dbPath == null) {
            throw new ContextException("The hsqldb cannot be used inside a WAR file.");
        }

        try {
            arguments[6] = "-database";
            arguments[7] = new File(dbPath).getCanonicalPath();
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( 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

                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

                (org.apache.cocoon.environment.Context) context.get(
                                    Constants.CONTEXT_ENVIRONMENT_CONTEXT);
        // set up file
        String path = ctx.getRealPath(PERSISTENT_FILE);
        if (path == null) {
            throw new ContextException("The cache event registry cannot be used inside an unexpanded WAR file. " +
                                       "Real path for <" + PERSISTENT_FILE + "> is null.");
        }

        m_persistentFile = new File(path);
    }
View Full Code Here

    public Object get( final Object key )
    throws ContextException {
        if ( ContextHelper.CONTEXT_OBJECT_MODEL.equals(key)) {
            final Environment env = CocoonComponentManager.getCurrentEnvironment();
            if ( env == null ) {
                throw new ContextException("Unable to locate " + key + " (No environment available)");
            }
            return env.getObjectModel();
        } else if ( ContextHelper.CONTEXT_SITEMAP_SERVICE_MANAGER.equals(key)) {
            final ComponentManager manager = CocoonComponentManager.getSitemapComponentManager();
            if ( manager == null ) {
                throw new ContextException("Unable to locate " + key + " (No environment available)");
            }
            return new ComponentManagerWrapper(manager);
        }
        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

            this.aFolder = mctx.getTheFolder(CONTEXT_FOLDER_ENTRY);

            Integer i = (Integer) ctx.get("param-integer:" + CONTEXT_UID_ENTRY);
            if (i == null) {
                String message = "Missing mandatory context entry " + String.valueOf(CONTEXT_UID_ENTRY);
                throw new ContextException(message);
            }
            this.msgUID = i.intValue();
        }
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.