Package org.apache.slide.projector.value

Examples of org.apache.slide.projector.value.DocumentValue


  protected ResultDescriptor resultDescriptor = ResultDescriptor.OK;
 
  public void configure(StreamableValue config) throws ConfigurationException {
    steps = new HashMap();
    try {
      DocumentValue documentResource = new DocumentValue(config);
      Document document = documentResource.getDocument();
      Element rootElement = document.getRootElement();
      firstStep = rootElement.getAttributeValue("first-step");
      List inputParamters = XPath.newInstance("/process/description/input/parameter").selectNodes(rootElement);
      List parameterDescriptors = new ArrayList();
      for ( Iterator i = inputParamters.iterator(); i.hasNext(); ) {
View Full Code Here


      if ( content != null ) {
        if ( instructions instanceof MapValue ) {
          if ( includeContent ) {
            content = new MultipleStreamableValue((StreamableValue) content);
          }
          DocumentValue documentValue = new DocumentValue((StreamableValue)content);
          Map instructionMap = ((MapValue)instructions).getMap();
          for ( Iterator j = instructionMap.entrySet().iterator(); j.hasNext(); ) {
            Map.Entry entry = (Map.Entry)j.next();
            String key = (String) entry.getKey();
            XPath xPath = XPath.newInstance(entry.getValue().toString());
            List nodeList = xPath.selectNodes(documentValue.getRootElement());
            resultMap.put(key, XPathQuery.createValueFromNodeList(nodeList));
          }
        }
        if ( includeContent ) {
          resultMap.put(CONTENT_ENTRY, content);
View Full Code Here

    public Value valueOf(Object value, Context context) throws ValueCastException {
      if ( value instanceof XMLValue ) {
        return (XMLValue)value;
      } else if ( value instanceof StreamableValue ) {
        try {
          return new DocumentValue(((StreamableValue)value).getInputStream());
        } catch ( Exception e ) {
          throw new ValueCastException(new ErrorMessage("uncastableXMLValue", new Object[] { value }), e);
        }
      } else if ( value instanceof PrintableValue ) {
        try {
          return new DocumentValue(new ByteArrayInputStream(((PrintableValue)value).toString().getBytes("UTF-8")));
        } catch ( Exception e ) {
          throw new ValueCastException(new ErrorMessage("uncastableXMLValue", new Object[] { value }), e);
        }
      }
      throw new ValueCastException(new ErrorMessage("uncastableXMLValue", new Object[] { value }));
View Full Code Here

    public Value process(Value input, Context context) throws Exception {
      Document document = ((DocumentValue)input).getDocument();
        JDOMResult result = new JDOMResult();
        transformer.transform(new JDOMSource(document), result);
        return new DocumentValue(result.getDocument());
    }
View Full Code Here

      try {
        List applicationJobs = new ArrayList();
        StreamableValue jobsResource = (StreamableValue)Projector.getRepository().getResource(jobsUri, Projector.getCredentials());
        // FIXME: Beautify the code...
        if ( jobsResource != null ) {
          DocumentValue documentResource = new DocumentValue(jobsResource);
          Document document = documentResource.getDocument();
          Element rootElement = document.getRootElement();
          List jobElements = XPath.newInstance("/jobs/job").selectNodes(rootElement);
          List startupJobs = new ArrayList();
          for ( Iterator i = jobElements.iterator(); i.hasNext(); ) {
            Element jobElement = (Element)i.next();
View Full Code Here

TOP

Related Classes of org.apache.slide.projector.value.DocumentValue

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.