Package org.apache.commons.jelly

Examples of org.apache.commons.jelly.JellyException


        }
        InputStream in = null;
        if ( uri != null ) {
            in = context.getResourceAsStream( uri );
            if ( in == null ) {
                throw new JellyException( "Could not find resource for uri: " + uri );
            }
        }
        else {
            String text = getBodyText();
            byte[] data = text.getBytes();
            in = new ByteArrayInputStream( text.getBytes() );
        }

        Schema schema = null;
        if (systemId != null) {
            schema = factory.compileSchema(in, systemId);
        }
        else if ( uri != null ) {
            schema = factory.compileSchema(in, uri);
        }
        else{
            schema = factory.compileSchema(in);
        }
        if ( schema == null ) {
            throw new JellyException( "Could not create a valid schema" );
        }
        Verifier verifier = schema.newVerifier();
        context.setVariable(var, verifier);
    }
View Full Code Here


    // Tag interface
    //-------------------------------------------------------------------------
    public void doTag(XMLOutput output) throws Exception {
        ElementTag tag = (ElementTag) findAncestorWithClass( ElementTag.class );
        if ( tag == null ) {
            throw new JellyException( "<attribute> tag must be enclosed inside an <element> tag" );
        }
        tag.setAttributeValue( getName(), getBodyText() );
    }
View Full Code Here

    // Tag interface
    //-------------------------------------------------------------------------
    public void doTag(XMLOutput output) throws Exception {
        ChooseTag tag = (ChooseTag) findAncestorWithClass( ChooseTag.class );
        if ( tag == null ) {
            throw new JellyException( "This tag must be enclosed inside a <choose> tag" );
        }
        if ( ! tag.isBlockEvaluated() && test != null ) {
            if ( test.evaluateAsBoolean( context ) ) {
                tag.setBlockEvaluated(true);
                invokeBody(output);
View Full Code Here

            try {
                XPath xpath = new Dom4jXPath(attributeValue);
                return new XPathExpression(xpath);
            }
            catch (JaxenException e) {
                throw new JellyException( "Could not parse XPath expression: \"" + attributeValue + "\" reason: " + e, e );           
            }           
        }
       
        // will use the default expression instead
        return super.createExpression(factory, tagName, attributeName, attributeValue);
View Full Code Here

                context.setVariable(var, answer);
            }
        }
        else {
            if ( target == null ) {
                throw new JellyException( "Either a 'var' or a 'target' attribute must be defined for this tag" );
            }
            if ( property == null ) {
                throw new JellyException( "You must define a 'property' attribute if you specify a 'target'" );
            }
            setPropertyValue( target, property, answer );
        }
    }
View Full Code Here

    // Tag interface
    //-------------------------------------------------------------------------
    public void doTag(XMLOutput output) throws Exception {
        ChooseTag tag = (ChooseTag) findAncestorWithClass( ChooseTag.class );
        if ( tag == null ) {
            throw new JellyException( "This tag must be enclosed inside a <choose> tag" );
        }
        if ( ! tag.isBlockEvaluated() ) {
            tag.setBlockEvaluated(true);
            invokeBody(output);
        }
View Full Code Here

    public void doTag(XMLOutput output) throws Exception {
        SQLExecutionTag parent =
            (SQLExecutionTag) findAncestorWithClass(this, SQLExecutionTag.class);
        if (parent == null) {
            throw new JellyException(Resources.getMessage("SQL_PARAM_OUTSIDE_PARENT"));
        }

        if (value != null) {
            convertValue();
        }
View Full Code Here

        try {
          theClass = Class.forName(className);
        }
                catch (ClassNotFoundException e3) {
                    log.error( "Could not load class: " + className + " exception: " + e, e );
          throw new JellyException(
            "Could not find class: "
              + className
              + " using ClassLoader: "
              + classLoader);
        }
View Full Code Here

            if (!(value instanceof java.sql.Date)) {
                value = new java.sql.Date(value.getTime());
            }
        }
        else {
            throw new JellyException(
                Resources.getMessage("SQL_DATE_PARAM_INVALID_TYPE", type));
        }
    }
View Full Code Here

        DataSourceWrapper ds = new DataSourceWrapper();
        try {
            ds.setDriverClassName(getDriverClassName());
        }
        catch (Exception e) {
            throw new JellyException("Invalid driver class name: " + e.getMessage());
        }
        ds.setJdbcURL(getJdbcURL());
        ds.setUserName(getUserName());
        ds.setPassword(getPassword());
        context.setVariable(var, ds);
View Full Code Here

TOP

Related Classes of org.apache.commons.jelly.JellyException

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.