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

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

Introduction

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

Prototype

public JellyTagException(Throwable cause) 

Source Link

Usage

From source file:org.codehaus.nanning.jelly.TargetTag.java

public void doTag(XMLOutput xmlOutput) throws JellyTagException {
    try {/*from   w  w  w  . jav  a  2s  .  c o m*/
        Class targetClass = Thread.currentThread().getContextClassLoader().loadClass(getBodyText().trim());
        ((AspectTag) getParent()).setTarget(targetClass);
    } catch (ClassNotFoundException e) {
        throw new JellyTagException(e);
    }
}

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 www  . j  av  a  2s.c o 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);
    }
}

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

Document generateDocument(Object modelElement) throws JellyTagException {
    Document doc = DocumentHelper.createDocument();
    Element root = doc.addElement("processes", "werkflow:basic").addNamespace("j", "jelly:core")
            .addNamespace("jelly", "werkflow:jelly").addNamespace("java", "werkflow:java")
            .addNamespace("python", "werkflow:python").addNamespace("ognl", "werkflow:ognl");
    Element process = root.addElement("process");
    ActivityGraph ag = null;//  w ww.j  a  v a 2 s  .  c o m
    try {
        ag = (ActivityGraph) findOneItem(((Namespace) modelElement), ActivityGraph.class);
    } catch (GenerationException e) {
        throw new JellyTagException(e);
    }
    Element seq = process.addElement("sequence");
    Pseudostate startState = findInitialState(((CompositeState) ag.getTop()).getSubvertex());
    if (startState != null) {
        Collection subvertex = ((CompositeState) ag.getTop()).getSubvertex();
        GraphProcessor gp = new GraphProcessor();
        JMIUMLIterator nav = new JMIUMLIterator();
        try {
            gp.validate(subvertex, nav);
        } catch (GraphException e) {
            throw new JellyTagException(e);
        }
        Collection topological = gp.getTopological();
        for (Iterator it = topological.iterator(); it.hasNext();) {
            StateVertex vertex = (StateVertex) it.next();
            if (vertex instanceof SimpleState) {
                String vertexClass = ((ModelElementImpl) modelElement).getFullyQualifiedName();
                seq.addElement("java:action").setText(vertexClass + "Workflow.getInstance()."
                        + ((SimpleState) vertex).getEntry().getName() + "();");
            }
        }
    }
    return doc;
}