Example usage for org.apache.commons.jelly MissingAttributeException MissingAttributeException

List of usage examples for org.apache.commons.jelly MissingAttributeException MissingAttributeException

Introduction

In this page you can find the example usage for org.apache.commons.jelly MissingAttributeException MissingAttributeException.

Prototype

public MissingAttributeException(String missingAttribute) 

Source Link

Usage

From source file:com.cyclopsgroup.waterview.utils.TagSupport.java

/**
 * Throw MissingAttributeException if an attribute is missing
 *
 * @param name Attribute name/*from w  w w. jav a 2  s  . com*/
 * @throws JellyTagException Throw it out
 */
protected final void requireAttribute(String name) throws JellyTagException {
    Object value = null;
    try {
        value = PropertyUtils.getProperty(this, name);
    } catch (Exception e) {
        throw new JellyTagException("Attribute [" + name + "] is not defined in tag");
    }
    if (value == null) {
        throw new MissingAttributeException(name);
    }
}

From source file:com.cyclopsgroup.waterview.utils.DynaTagSupport.java

/**
 * Check attribute/* w  w  w. j  a v  a2 s.  c om*/
 *
 * @param attributeName Attribute name
 * @throws MissingAttributeException Missing attribute
 */
protected void requireAttribute(String attributeName) throws MissingAttributeException {
    if (!attributeMap.containsKey(attributeName)) {
        throw new MissingAttributeException(attributeName);
    }
}

From source file:org.apache.cactus.integration.maven.CactusScannerTag.java

/**
 * @param theXmlOutput the xml to hold the tag being made
 * @see TagSupport#doTag(XMLOutput)//from   w  ww  . ja v  a2s  . c  om
 * @throws JellyTagException when proccess fails
 */
public void doTag(XMLOutput theXmlOutput) throws JellyTagException {
    this.cactusScanner.setProject(AntTagLibrary.getProject(context));
    this.cactusScanner.clear();

    // run the body first to configure the task via nested tags
    invokeBody(theXmlOutput);

    // Process the fileset to extract Cactus test cases. We need to pass
    // the project dependency classpath as the CactusScanner will need
    // to load the cactus test classes to decide whether they are Cactus
    // test case or not and that needs the dependent jars to be in the
    // classpath.
    Path cp = this.classpath;
    if (this.classpathref != null) {
        cp = (Path) AntTagLibrary.getProject(context).getReference(this.classpathref);
    }

    this.cactusScanner.processFileSet(this.fileset, cp);

    // output the cactusScanner
    if (var == null) {
        throw new MissingAttributeException("var");
    }
    context.setVariable(var, cactusScanner);
}

From source file:org.dentaku.gentaku.cartridge.event.WerkflowTag.java

public void doTag(XMLOutput xmlOutput) throws MissingAttributeException, JellyTagException {
    if (metadataClass == null) {
        throw new MissingAttributeException("missing metadata attribute");
    }//from   w w w. j  av a 2  s  .  co  m
    try {
        Document doc = generateDocument(metadataClass);
        SAXWriter writer = new SAXWriter();
        ContentHandler ctxHandler = new WerkflowContentHandler(xmlOutput);
        writer.setContentHandler(ctxHandler);
        writer.write(doc);

    } catch (Exception e) {
        throw new JellyTagException(e);
    }
}