List of usage examples for org.apache.commons.scxml.io SCXMLParser parse
public static SCXML parse(final InputSource documentInputSource, final ErrorHandler errHandler) throws IOException, SAXException, ModelException
API for standalone usage where the SCXML document is an InputSource.
From source file:org.wso2.jaggery.scxml.aspects.JaggeryTravellingPermissionLifeCycle.java
private void setSCXMLConfiguration(Registry registry) throws RegistryException, XMLStreamException, IOException, SAXException, ModelException { String xmlContent;//from w w w . j a va2 s . c o m if (isConfigurationFromResource) { if (registry.resourceExists(configurationResourcePath)) { try { Resource configurationResource = registry.get(configurationResourcePath); xmlContent = RegistryUtils.decodeBytes((byte[]) configurationResource.getContent()); configurationElement = AXIOMUtil.stringToOM(xmlContent); } catch (Exception e) { String msg = "Invalid lifecycle configuration found at " + configurationResourcePath; log.error(msg); throw new RegistryException(msg); } } else { String msg = "Unable to find the lifecycle configuration from the given path: " + configurationResourcePath; log.error(msg); throw new RegistryException(msg); } } try { // We check if there is an attribute called "audit" and if it exists, what is the value of that attribute if (configurationElement.getAttributeValue(new QName(LifecycleConstants.AUDIT)) != null) { isAuditEnabled = Boolean .parseBoolean(configurationElement.getAttributeValue(new QName(LifecycleConstants.AUDIT))); } // Here we are taking the scxml element from the configuration OMElement scxmlElement = configurationElement.getFirstElement(); scxml = SCXMLParser.parse(new InputSource(new CharArrayReader((scxmlElement.toString()).toCharArray())), null); } catch (Exception e) { String msg = "Invalid SCXML configuration found"; log.error(msg); throw new RegistryException(msg); } }