private void increaseSearchIndexStartTimeDelay() throws Exception {
    FileOutputStream fileOutputStream = null;
    XMLStreamWriter writer = null;
    OMElement documentElement = getRegistryXmlOmElement();
    try {
      AXIOMXPath xpathExpression =
          new AXIOMXPath("/wso2registry/indexingConfiguration/startingDelayInSeconds");
      OMElement indexConfigNode = (OMElement) xpathExpression.selectSingleNode(documentElement);
      indexConfigNode.setText("2");

      AXIOMXPath xpathExpression1 =
          new AXIOMXPath("/wso2registry/indexingConfiguration/indexingFrequencyInSeconds");
      OMElement indexConfigNode1 = (OMElement) xpathExpression1.selectSingleNode(documentElement);
      indexConfigNode1.setText("1");

      fileOutputStream = new FileOutputStream(getRegistryXMLPath());
      writer = XMLOutputFactory.newInstance().createXMLStreamWriter(fileOutputStream);
      documentElement.serialize(writer);
      documentElement.build();
      Thread.sleep(2000);

    } catch (Exception e) {
      log.error("registry.xml edit fails" + e.getMessage());
      throw new Exception("registry.xml edit fails" + e.getMessage());
    } finally {
      assert fileOutputStream != null;
      fileOutputStream.close();
      assert writer != null;
      writer.flush();
    }
  }
예제 #2
0
  protected static void prettify(OMElement wsdlElement, OutputStream out) throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    wsdlElement.serialize(baos);

    Source stylesheetSource =
        new StreamSource(new ByteArrayInputStream(prettyPrintStylesheet.getBytes()));
    Source xmlSource = new StreamSource(new ByteArrayInputStream(baos.toByteArray()));

    TransformerFactory tf = TransformerFactory.newInstance();
    Templates templates = tf.newTemplates(stylesheetSource);
    Transformer transformer = templates.newTransformer();
    transformer.transform(xmlSource, new StreamResult(out));
  }
예제 #3
0
  public void serialize(
      final javax.xml.namespace.QName parentQName,
      javax.xml.stream.XMLStreamWriter xmlWriter,
      boolean serializeType)
      throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException {

    // We can safely assume an element has only one type associated with it

    java.lang.String namespace = "http://x-rd.net/xsd/xroad.xsd";
    java.lang.String _localName = "listMethods";

    writeStartElement(null, namespace, _localName, xmlWriter);

    // add the type details if this is used in a simple type
    if (serializeType) {
      java.lang.String namespacePrefix = registerPrefix(xmlWriter, "http://x-rd.net/xsd/xroad.xsd");
      if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)) {
        writeAttribute(
            "xsi",
            "http://www.w3.org/2001/XMLSchema-instance",
            "type",
            namespacePrefix + ":listMethods",
            xmlWriter);
      } else {
        writeAttribute(
            "xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", "listMethods", xmlWriter);
      }
    }

    if (localListMethods == null) {

      // write the nil attribute
      writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", xmlWriter);

    } else {
      localListMethods.serialize(xmlWriter);
    }

    xmlWriter.writeEndElement();
  }