Examples of XmlElement


Examples of br.net.woodstock.rockframework.core.xml.dom.XmlElement

  @Override
  public void read(final InputStream inputStream, final String password) throws IOException {
    try {
      XmlDocument document = XmlDocument.read(inputStream);
      XmlElement root = document.getRoot();

      String encoding = root.getAttribute(XMLStore.ENCODING_ATTRIBUTE);

      XmlElement certificates = root.getElement(XMLStore.CERTIFICATES_ELEMENT);
      XmlElement privateKeys = root.getElement(XMLStore.PRIVATE_KEYS_ELEMENT);
      XmlElement publicKeys = root.getElement(XMLStore.PUBLIC_KEYS_ELEMENT);
      XmlElement secretKeys = root.getElement(XMLStore.SECRET_KEYS_ELEMENT);

      for (XmlElement certificateElement : certificates.getElements()) {
        String alias = certificateElement.getAttribute(XMLStore.ALIAS_ATTRIBUTE);
        Certificate certificate = this.getCertificate(certificateElement, encoding);
        this.getCertificateMap().put(alias, certificate);
      }

      for (XmlElement privateKeyElement : privateKeys.getElements()) {
        String alias = privateKeyElement.getAttribute(XMLStore.ALIAS_ATTRIBUTE);
        Identity holder = this.getPrivateKey(privateKeyElement, encoding);
        this.getPrivateKeyMap().put(alias, holder);
      }

      for (XmlElement publicKeyElement : publicKeys.getElements()) {
        String alias = publicKeyElement.getAttribute(XMLStore.ALIAS_ATTRIBUTE);
        PublicKey publicKey = this.getPublicKey(publicKeyElement, encoding);
        this.getPublicKeyMap().put(alias, publicKey);
      }

      for (XmlElement secretKeyElement : secretKeys.getElements()) {
        String alias = secretKeyElement.getAttribute(XMLStore.ALIAS_ATTRIBUTE);
        SecretKey secretKey = this.getSecretKey(secretKeyElement, encoding);
        this.getSecretKeyMap().put(alias, secretKey);
      }
    } catch (GeneralSecurityException e) {
View Full Code Here

Examples of br.net.woodstock.rockframework.xml.dom.XmlElement

    }

    Tag tag = clazz.getAnnotation(Tag.class);

    XmlDocument document = new XmlDocument("tag");
    XmlElement root = document.getRoot();

    if (ConditionUtils.isNotEmpty(tag.description())) {
      root.addElement("description").setData(tag.description());
    }

    root.addElement("name").setData(tag.name());
    root.addElement("tag-class").setData(clazz.getCanonicalName());
    root.addElement("body-content").setData(tag.content());

    if (tag.dynamicAttributes()) {
      root.addElement("dynamic-attributes").setData(Boolean.valueOf(tag.dynamicAttributes()));
    }

    BeanDescriptor beanDescriptor = new BeanDescriptorBuilder(clazz).getBeanDescriptor();

    for (PropertyDescriptor propertyDescriptor : beanDescriptor.getProperties()) {
      if (!propertyDescriptor.isAnnotationPresent(Attribute.class)) {
        continue;
      }

      Attribute tldAttribute = propertyDescriptor.getAnnotation(Attribute.class);
      XmlElement e = root.addElement("attribute");

      if (ConditionUtils.isNotEmpty(tldAttribute.description())) {
        e.addElement("description").setData(tldAttribute.description());
      }

      e.addElement("name").setData(propertyDescriptor.getName());
      e.addElement("required").setData(Boolean.valueOf(tldAttribute.required()));
      e.addElement("rtexprvalue").setData(Boolean.valueOf(tldAttribute.rtexprvalue()));
      if ((!tldAttribute.rtexprvalue()) && (tldAttribute.type() != String.class)) {
        e.addElement("type").setData(tldAttribute.type().getCanonicalName());
      }
    }

    return document.toString();
  }
View Full Code Here

Examples of com.adito.agent.client.util.XMLElement

          + "classes.zip"; //$NON-NLS-1$

      Enumeration e = element.enumerateChildren();

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

        if (el.getName().equalsIgnoreCase("classpath")) { //$NON-NLS-1$
          buildClassPath(el);
        } else if (el.getName().equalsIgnoreCase("main")) { //$NON-NLS-1$
          mainclass = (String) el.getAttribute("class"); //$NON-NLS-1$
          if (events != null)
            events.debug(MessageFormat.format(Messages.getString("JavaApplicationType.mainClass"), new Object[] { mainclass })); //$NON-NLS-1$
          String dir = (String) el.getAttribute("dir"); //$NON-NLS-1$
          if (events != null)
            events.debug(MessageFormat.format(Messages.getString("JavaApplicationType.directoryIs"), new Object[] { dir })); //$NON-NLS-1$
          if (dir != null) {
            workingDir = new File(launcher.replaceTokens(dir));
          } else {
View Full Code Here

Examples of com.adito.agent.client.util.XMLElement

  protected void buildClassPath(XMLElement element, String app) throws IOException {

    if (events != null)
      events.debug(Messages.getString("JavaApplicationType.buildingClasspath")); //$NON-NLS-1$
    Enumeration en = element.enumerateChildren();
    XMLElement e;

    while (en.hasMoreElements()) {
      e = (XMLElement) en.nextElement();
      if (e.getName().equalsIgnoreCase("jar")) { //$NON-NLS-1$
        if (AbstractApplicationLauncher.checkCondition(this, e, launcher.getDescriptorParams())) {
          addClasspathEntry(e, app);
        }
      } else if (e.getName().equals("if")) { //$NON-NLS-1$
        if (AbstractApplicationLauncher.checkCondition(this, e, launcher.getDescriptorParams())) {
          buildClassPath(e, app);
        }
      } else
        throw new IOException(MessageFormat.format(Messages.getString("JavaApplicationType.invalidElementInClasspath"), new Object[] { e.getName() })); //$NON-NLS-1$
    }

  }
View Full Code Here

Examples of com.adito.agent.client.util.XMLElement

    Enumeration en = element.enumerateChildren();

    while (en.hasMoreElements()) {

      XMLElement e = (XMLElement) en.nextElement();
      if (e.getName().equalsIgnoreCase("arg")) //$NON-NLS-1$
        addArgument(e);
      else if (e.getName().equalsIgnoreCase("jvm")) { //$NON-NLS-1$
        addArgument(e);
      } else if (e.getName().equalsIgnoreCase("env")) { //$NON-NLS-1$
                addArgument(e);
            } else if (e.getName().equalsIgnoreCase("if")) { //$NON-NLS-1$

        String jre = (String) e.getAttribute("jre"); //$NON-NLS-1$
        if (jre == null) {
          String parameter = (String) e.getAttribute("parameter"); //$NON-NLS-1$
          boolean not = "true".equalsIgnoreCase((String) e //$NON-NLS-1$
          .getAttribute("not")); //$NON-NLS-1$

          if (parameter != null) {
            String requiredValue = (String) e.getAttribute("value"); //$NON-NLS-1$

            // 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(Messages.getString("JavaApplicationType.ifElementRequiresJreOrParameterAttribute")); //$NON-NLS-1$
        } else {
          // Check the jre
          if (Utils.isSupportedJRE(jre)) {
            buildProgramArguments(e);
          }

        }

      } else
        throw new IOException(MessageFormat.format(Messages.getString("JavaApplicationType.unexpectedElementFoundInMain"), new Object[] { e.getName() })); //$NON-NLS-1$
    }

  }
View Full Code Here

Examples of com.adito.agent.client.util.XMLElement

        if (extensionClasses != null) {
            addArgument("extensionClasses=" + extensionClasses); //$NON-NLS-1$
        }

        while (e.hasMoreElements()) {
            XMLElement el = (XMLElement) e.nextElement();
            if (el.getName().equalsIgnoreCase("agent")) { //$NON-NLS-1$
                String name = (String) el.getAttribute("name"); //$NON-NLS-1$
                String jre = (String) el.getAttribute("jre"); //$NON-NLS-1$
                if (isJreSupported(jre)) {
                    // Process classpath and/or file elements
                    Enumeration e2 = el.enumerateChildren();
                    while (e2.hasMoreElements()) {
                        XMLElement el2 = (XMLElement) e2.nextElement();
                        processAgentElements(el2, launcher, events, name);
                    }
                } else {
                    String message = Messages.getString("DefaultAgentApplicationType.applicationRequires", new Object[]{name, jre, System.getProperty("java.version")});
                    launcher.processErrorMessage(message);
View Full Code Here

Examples of com.adito.agent.client.util.XMLElement

        Enumeration en = element.enumerateChildren();

        while (en.hasMoreElements()) {

            XMLElement e = (XMLElement) en.nextElement();
            if (e.getName().equalsIgnoreCase("arg")) //$NON-NLS-1$
                addArgument(e);
            else  if (e.getName().equalsIgnoreCase("program")) //$NON-NLS-1$
                continue;
            else if (e.getName().equalsIgnoreCase("if")) { //$NON-NLS-1$
                if (AbstractApplicationLauncher.checkCondition(this, e, launcher.getDescriptorParams())) {
                    buildProgramArguments(e);
                }
            } else
                throw new IOException(MessageFormat.format(Messages.getString("ExecutableApplicationType.unexpectedElementFoundInExecutable"), new Object[] { e.getName() } ) ) ;//$NON-NLS-1$
        }

    }
View Full Code Here

Examples of com.adito.agent.client.util.XMLElement

    private String findProgram(XMLElement element) throws IOException {
        Enumeration en = element.enumerateChildren();

        while (en.hasMoreElements()) {

            XMLElement e = (XMLElement) en.nextElement();
            if (e.getName().equalsIgnoreCase("program")) //$NON-NLS-1$
                return Utils.trimmedBothOrBlank(e.getContent());
            else if (e.getName().equalsIgnoreCase("if")) { //$NON-NLS-1$
                if (AbstractApplicationLauncher.checkCondition(this, e, launcher.getDescriptorParams())) {
                    String program = findProgram(e);
                    if(program != null) {
                      return program;
                    }
View Full Code Here

Examples of com.adito.agent.client.util.XMLElement

        if (element.getName().equalsIgnoreCase("registry")) {
            Enumeration e = element.enumerateChildren();

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

                processRegistryElements(el);
            }
            return true;
        } else
View Full Code Here

Examples of com.adito.agent.client.util.XMLElement

                setReadTimeout(con, timeout);

                con.connect();
                System.out.println(MessageFormat.format(Messages.getString("VPNLauncher.sysout.connectedTo"), new Object[] { url } )); //$NON-NLS-1$

                XMLElement result = new XMLElement();
                result.parseFromReader(new InputStreamReader(con.getInputStream()));

                if (result.getName().equalsIgnoreCase("success")) { //$NON-NLS-1$
                    System.out.println(Messages.getString("VPNLauncher.sysout.syncOk")); //$NON-NLS-1$

                    /*
                     * TODO A nasty hack - If the returnTo points back to
                     * the VPN Client, then make sure the port is correct
                     * (the server would not have known the port for the
                     * client at the point the returnTO link was created).
                     */
                    URL returnToUrl = returnTo.equals("") ? getDocumentBase() : new URL(getDocumentBase(), returnTo); //$NON-NLS-1$
                    if (returnToUrl.getProtocol().equals("http") && returnToUrl.getHost().equals("localhost") //$NON-NLS-1$ //$NON-NLS-2$
                                    && returnToUrl.getPort() == -1) {
                        returnToUrl = new URL(returnToUrl.getProtocol(), returnToUrl.getHost(), Integer.parseInt(result
                                        .getAttribute("clientPort").toString()), returnToUrl.getFile()); //$NON-NLS-1$
                    }
                    returnToUrl = new URL(addRedirectParameter(returnToUrl.toExternalForm(),
                                    "vpnMessage", appName + " launched.")); //$NON-NLS-1$ //$NON-NLS-2$
                    System.out.println(MessageFormat.format(Messages.getString("VPNLauncher.sysout.redirecting"), new Object[] { returnToUrl.toExternalForm() })); //$NON-NLS-1$
                    getAppletContext().showDocument(returnToUrl);
                    setMessage(Messages.getString("VPNLauncher.complete")); //$NON-NLS-1$

                } else {
                    // Show an error message and kill the process
                    System.out.println(Messages.getString("VPNLauncher.sysout.failedSync")); //$NON-NLS-1$
                    System.out.println(result.getContent());
                    ProcessMonitor monitor = launcher.getApplicationType().getProcessMonitor();
                    if (monitor != null) {
                        // We cant kill the process as there may be error
                        // dialogs
                        // monitor.kill();
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.