Examples of XMLElement


Examples of com.adito.boot.XMLElement

        if (log.isDebugEnabled())
            log.debug("Output file will be encoded in " + encoding);

        for (Enumeration e = el.getChildren().elements(); e.hasMoreElements();) {
            XMLElement child = (XMLElement) e.nextElement();

            if (!child.getName().equalsIgnoreCase("replace")) {
                throw new IOException("Error! <" + child.getName() + "> is not a supported element of <replacements>");
            }

            if (child.getAttribute("token") == null || child.getAttribute("value") == null) {
                throw new IOException("Error! <replace> element requires 'token' and 'value' attributes");
            }

            tokens.put(child.getAttribute("token").toString(), child.getAttribute("value").toString());
        }

    }
View Full Code Here

Examples of com.adito.boot.XMLElement

  public void prepare() throws IOException {

    if (log.isDebugEnabled())
      log.debug("Checking parameters");

    XMLElement element = new XMLElement();
    try {
      element.parseFromReader(new InputStreamReader(
          new ByteArrayInputStream(processParameters(
              session,
              descriptor
                  .createProcessedDescriptorElement(session),
              descriptor, shortcut).getBytes())));
    } catch (Exception e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }

    if (log.isDebugEnabled())
      log.debug("Received a response from server");

    if (!element.getName().equals("application")
        && !element.getName().equals("error")
        && !element.getName().equals("extension")) {
      throw new IOException(
          "URL does not point to an application descriptor");
    } else if (element.getName().equals("error")) {
      throw new IOException(element.getContent());
    }

    name = (String) element.getAttribute("extension");
    if (name == null) {
      name = (String) element.getAttribute("application");
    }

    typeName = (String) element.getAttribute("type");

    try {
      type = (ApplicationServerType) Class
          .forName(
              "com.adito.applications.types."
                  + (String.valueOf(typeName.charAt(0))
                      .toUpperCase() + typeName
                      .substring(1)) + "Type")
          .newInstance();
    } catch (Throwable t) {
      throw new IOException(
          "Failed to load the application description extension for application type of "
              + typeName + ".");
    }

    if (log.isDebugEnabled())
      log.debug("Application name is " + name);

    if (log.isDebugEnabled())
      log.debug("Creating install folder");

    installDir = File.createTempFile("server", "tmp");
    installDir.delete();
    installDir = new File(installDir.getParent(), installDir.getName()
        + "dir");
    installDir.mkdirs();

    if (log.isDebugEnabled())
      log.debug("Installing to " + installDir.getAbsolutePath());

    Enumeration e = element.enumerateChildren();

    while (e.hasMoreElements()) {
      XMLElement el = (XMLElement) e.nextElement();

      if (el.getName().equalsIgnoreCase("files")) {
        processFiles(el);
      } else if (el.getName().equalsIgnoreCase("parameter")) {
        addParameter(el);
      } else if (el.getName().equalsIgnoreCase("messages")) {
        // Ignore as its a server side element
      } else if (el.getName().equalsIgnoreCase("description")) {
        // Simply ignore.. should we throw an exception if an element is
        // not known?
      } else if (el.getName().equalsIgnoreCase("replacements")) {
        FileReplacement replacement = new FileReplacement(installDir);
        replacement.processReplacementXML(el, this);
        replacements.put(replacement.getId(), replacement);
      } else if (processLauncherElement(el)) {
        // This allows us to override more element types in extended
        // application launchers (i.e. registry parameters)
        continue;
      } else if (el.getName().equalsIgnoreCase("transform")) {
        ParameterTransformation trans = new ParameterTransformation(el,
            this);
        transformations.addElement(trans);
      } else {
        type.prepare(this, null, el);
View Full Code Here

Examples of com.adito.boot.XMLElement

  }

  public void processFiles(XMLElement element, String app) throws IOException {

    Enumeration en = element.enumerateChildren();
    XMLElement e;

    while (en.hasMoreElements()) {
      e = (XMLElement) en.nextElement();
      if (e.getName().equalsIgnoreCase("file")) {
        File f = descriptor.getFile(e.getContent());
        Util.copy(f, new File(installDir, e.getContent()));
      } else if (e.getName().equalsIgnoreCase("if")) {

        try {
          if (type.checkFileCondition(e)) {
            processFiles(e, app);
          }
        } catch (IllegalArgumentException iae) {
          String parameter = (String) e.getAttribute("parameter");

          if (parameter != null) {
            String requiredValue = (String) e.getAttribute("value");
            boolean not = "true".equalsIgnoreCase(((String) e
                .getAttribute("not")));

            // Check the parameter
            String value = (String) descriptorParams.get(parameter);

            if ((!not && requiredValue.equalsIgnoreCase(value))
                || (not && !requiredValue
                    .equalsIgnoreCase(value))) {
              processFiles(e, app);
            }

          } else
            throw new IOException(
                "<if> element requires type specific attributes or parameter/value attributes");
        }

      } else
        throw new IOException("Invalid element <" + e.getName()
            + "> found in <files>");
    }

  }
View Full Code Here

Examples of com.adito.boot.XMLElement

    Enumeration en = element.enumerateChildren();

    while (en.hasMoreElements()) {

      XMLElement e = (XMLElement) en.nextElement();
      if (e.getName().equalsIgnoreCase("arg"))
        addArgument(e);
      else if (e.getName().equalsIgnoreCase("if")) {

        try {
          if (checkFileCondition(e)) {
            buildProgramArguments(e);
          }
        } catch (IllegalArgumentException iae) {

          String parameter = (String) e.getAttribute("parameter");
          boolean not = "true".equalsIgnoreCase(((String) e
              .getAttribute("not")));

          if (parameter != null) {
            String requiredValue = (String) e.getAttribute("value");

            String value = (String) launcher.getDescriptorParams()
                .get(parameter);

            if ((!not && requiredValue.equalsIgnoreCase(value))
                || (not && !requiredValue
                    .equalsIgnoreCase(value))) {
              buildProgramArguments(e);
            }

          } else
            throw new IOException(
                "<if> element requires parameter attribute");
        }

      } else
        throw new IOException("Unexpected element <" + e.getName()
            + "> found in <executable>");
    }

  }
View Full Code Here

Examples of com.adito.boot.XMLElement

            + "classes.zip";

      Enumeration e = element.enumerateChildren();

      while (e.hasMoreElements()) {
        XMLElement el = (XMLElement) e.nextElement();

        if (el.getName().equalsIgnoreCase("classpath")) {
          buildClassPath(el);
        } else if (el.getName().equalsIgnoreCase("main")) {
          mainclass = (String) el.getAttribute("class");
          if (events != null)
            events.debug("Main class is " + mainclass);
          String dir = (String) el.getAttribute("dir");
          if (events != null)
            events.debug("Dir is " + dir);
          if (dir != null) {
            workingDir = new File(launcher.replaceTokens(dir));
          } else {
View Full Code Here

Examples of com.adito.boot.XMLElement

      throws IOException {

    if (events != null)
      events.debug("Building classpath");
    Enumeration en = element.enumerateChildren();
    XMLElement e;

    while (en.hasMoreElements()) {
      e = (XMLElement) en.nextElement();
      if (e.getName().equalsIgnoreCase("jar")) {
        addClasspathEntry(e, app);
      } else if (e.getName().equals("if")) {

        String jre = (String) e.getAttribute("jre");
        if (jre == null) {
          String parameter = (String) e.getAttribute("parameter");

          if (parameter != null) {
            String requiredValue = (String) e.getAttribute("value");
            boolean not = "true".equalsIgnoreCase(((String) e
                .getAttribute("not")));

            // Check the parameter
            String value = (String) launcher.getDescriptorParams()
                .get(parameter);

            if ((!not && requiredValue.equalsIgnoreCase(value))
                || (not && !requiredValue
                    .equalsIgnoreCase(value))) {
              buildClassPath(e, app);
            }

          } else
            throw new IOException(
                "<if> element requires jre or parameter attribute");
        } else {

          if (isSupportedJRE(jre)) {
            buildClassPath(e, app);
          }
        }
      } else
        throw new IOException("Invalid element <" + e.getName()
            + "> found in <classpath>");
    }

  }
View Full Code Here

Examples of com.adito.boot.XMLElement

    Enumeration en = element.enumerateChildren();

    while (en.hasMoreElements()) {

      XMLElement e = (XMLElement) en.nextElement();
      if (e.getName().equalsIgnoreCase("arg"))
        addArgument(e);
      else if (e.getName().equalsIgnoreCase("jvm")) {
        addArgument(e);
      } else if (e.getName().equalsIgnoreCase("if")) {

        String jre = (String) e.getAttribute("jre");
        if (jre == null) {
          String parameter = (String) e.getAttribute("parameter");
          boolean not = "true".equalsIgnoreCase((String) e
              .getAttribute("not"));

          if (parameter != null) {
            String requiredValue = (String) e.getAttribute("value");

            // Check the parameter
            String value = (String) launcher.getDescriptorParams()
                .get(parameter);

            if ((!not && requiredValue.equalsIgnoreCase(value))
                || (not && !requiredValue
                    .equalsIgnoreCase(value))) {
              buildProgramArguments(e);
            }

          } else
            throw new IOException(
                "<if> element requires jre or parameter attribute");
        } else {
          // Check the jre
          if (isSupportedJRE(jre)) {
            buildProgramArguments(e);
          }

        }

      } else
        throw new IOException("Unexpected element <" + e.getName()
            + "> found in <main>");
    }

  }
View Full Code Here

Examples of com.adobe.epubcheck.xml.XMLElement

    }

    // if the element is <CipherReference>, then the element name
    // is stripped of rootBase, and URLDecoded, and finally put into
    // encryptedItemsSet.
    XMLElement e = parser.getCurrentElement();
    if (e.getName().equals("CipherReference"))
    {
      String algorithm = null;
      XMLElement parent = e.getParent();
      if (parent != null)
      {
        parent = parent.getParent();
        if (parent != null && parent.getName().equals("EncryptedData"))
        {
          algorithm = (String) parent.getPrivateData();
        }
      }
      String entryName = e.getAttribute("URI");
      try
      {
        entryName = URLDecoder.decode(entryName, "UTF-8");
      }
      catch (UnsupportedEncodingException er)
      {
        // UTF-8 is guaranteed to be supported
        throw new InternalError(e.toString());
      }
      if (algorithm == null)
      {
        algorithm = "unknown";
      }
      if (algorithm.equals("http://www.idpf.org/2008/embedding"))
      {
        ocf.setEncryption(entryName, new IDPFFontManglingFilter(null));
      }
      else if (algorithm.equals("http://ns.adobe.com/pdf/enc#RC"))
      {
        ocf.setEncryption(entryName, new AdobeFontManglingFilter(null));
      }
      else
      {
        ocf.setEncryption(entryName, new UnsupportedEncryptionFilter());
      }
    }
    else if (e.getName().equals("EncryptionMethod"))
    {
      String algorithm = e.getAttribute("Algorithm");
      if (algorithm != null)
      {
        XMLElement parent = e.getParent();
        if (parent != null)
        {
          String comp = parent.getAttributeNS(
              "http://ns.adobe.com/digitaleditions/enc",
              "compression");
          if (comp == null)
          {
            parent.setPrivateData(algorithm);
          }
        }
      }
    }
  }
View Full Code Here

Examples of com.google.gwt.uibinder.rebind.XMLElement

      if (translated == null) {
        writer.die(elem, "Invalid value: dockDirection='" + value + "'");
      }

      // And they can only have a single child widget.
      XMLElement widget = child.consumeSingleChildElement();
      String childFieldName = writer.parseElementToField(widget);
      writer.addStatement("%1$s.add(%2$s, %3$s);", fieldName, childFieldName, translated);

      // And they can optionally have a width.
      if (child.hasAttribute("width")) {
View Full Code Here

Examples of com.intellij.psi.xml.XmlElement

  public boolean editNode(final BasicStrutsNode node) {
    if (node == null) { // TODO should not happen
      return false;
    }

    final XmlElement xmlElement = node.getIdentifyingElement().getXmlElement();
    if (xmlElement != null && xmlElement instanceof Navigatable) {
      OpenSourceUtil.navigate((Navigatable) xmlElement);
      return true;
    }
    return super.editNode(node);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.