Ejemplo n.º 1
0
 public void writeToLog(String preamble) throws IOException {
   String dirText = " (top down):";
   if (mSearchMethod == JOAConstants.SEARCH_BOTTOM_UP) dirText = " (bottom up):";
   try {
     JOAConstants.LogFileStream.writeBytes(preamble);
     JOAConstants.LogFileStream.writeBytes(
         "\t"
             + "Interpolation "
             + dirText
             + " "
             + mIntVar
             + " WRT "
             + mWRTVar
             + " Int. at Value = "
             + JOAFormulas.formatDouble(mIntAtValue, 3, false)
             + " Use deepest = "
             + Boolean.toString(mUseDeepest)
             + " At Surface = "
             + Boolean.toString(mAtSurface)
             + " Surface Depth Limit = "
             + JOAFormulas.formatDouble(mSurfaceDepthLimit, 3, false)
             + " At Bottom = "
             + Boolean.toString(mAtBottom)
             + " Interpolate Missing = "
             + Boolean.toString(mInterpolateMissing)
             + "\n");
     JOAConstants.LogFileStream.flush();
   } catch (IOException ex) {
     throw ex;
   }
 }
  protected Document generateAntTask() {
    try {
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      Document doc = factory.newDocumentBuilder().newDocument();
      Element root = doc.createElement("project"); // $NON-NLS-1$
      root.setAttribute("name", "build"); // $NON-NLS-1$ //$NON-NLS-2$
      root.setAttribute("default", "feature_export"); // $NON-NLS-1$ //$NON-NLS-2$
      doc.appendChild(root);

      Element target = doc.createElement("target"); // $NON-NLS-1$
      target.setAttribute("name", "feature_export"); // $NON-NLS-1$ //$NON-NLS-2$
      root.appendChild(target);

      Element export = doc.createElement("pde.exportFeatures"); // $NON-NLS-1$
      export.setAttribute("features", getFeatureIDs()); // $NON-NLS-1$
      export.setAttribute("destination", fPage.getDestination()); // $NON-NLS-1$
      String filename = fPage.getFileName();
      if (filename != null) export.setAttribute("filename", filename); // $NON-NLS-1$
      export.setAttribute("exportType", getExportOperation()); // $NON-NLS-1$
      export.setAttribute("useJARFormat", Boolean.toString(fPage.useJARFormat())); // $NON-NLS-1$
      export.setAttribute("exportSource", Boolean.toString(fPage.doExportSource())); // $NON-NLS-1$
      if (fPage.doExportSource()) {
        export.setAttribute(
            "exportSourceBundle", Boolean.toString(fPage.doExportSourceBundles())); // $NON-NLS-1$
      }
      String qualifier = fPage.getQualifier();
      if (qualifier != null) export.setAttribute("qualifier", qualifier); // $NON-NLS-1$
      target.appendChild(export);
      return doc;
    } catch (DOMException e) {
    } catch (FactoryConfigurationError e) {
    } catch (ParserConfigurationException e) {
    }
    return null;
  }
Ejemplo n.º 3
0
  private Element generatePortNode(Document doc, Port port) {
    Element portEl = doc.createElement(EL_PORT);

    portEl.setAttribute(ATR_NAME, port.getName());
    portEl.setAttribute(ATR_TYPE, port.getType());
    portEl.setAttribute(ATR_X, Integer.toString(port.getX()));
    portEl.setAttribute(ATR_Y, Integer.toString(port.getY()));
    portEl.setAttribute(ATR_PORT_CONNECTION, port.isArea() ? "area" : "");
    portEl.setAttribute(ATR_STRICT, Boolean.toString(port.isStrict()));
    portEl.setAttribute(ATR_MULTI, Boolean.toString(port.isMulti()));

    return portEl;
  }
Ejemplo n.º 4
0
  /** @see com.levelonelabs.aim.XMLizable#writeState(Element) */
  public void writeState(Element emptyStateElement) {
    Document doc = emptyStateElement.getOwnerDocument();
    emptyStateElement.setAttribute("name", this.getName());
    emptyStateElement.setAttribute("group", this.getGroup());
    emptyStateElement.setAttribute("isBanned", Boolean.toString(this.isBanned()));

    Iterator roleit = roles.keySet().iterator();
    while (roleit.hasNext()) {
      String role = (String) roleit.next();
      Element roleElem = doc.createElement("role");
      roleElem.setAttribute("name", role);
      emptyStateElement.appendChild(roleElem);
    }

    Iterator prefs = preferences.keySet().iterator();
    while (prefs.hasNext()) {
      String pref = (String) prefs.next();
      Element prefElem = doc.createElement("preference");
      prefElem.setAttribute("name", pref);
      prefElem.setAttribute("value", (String) preferences.get(pref));
      emptyStateElement.appendChild(prefElem);
    }

    for (int i = 0; i < messages.size(); i++) {
      String message = (String) messages.get(i);
      Element messElem = doc.createElement("message");
      CDATASection data = doc.createCDATASection(message);
      messElem.appendChild(data);
      emptyStateElement.appendChild(messElem);
    }
  }
Ejemplo n.º 5
0
  public void marshall(
      Class parentType,
      QName elementType,
      ExtensibilityElement extension,
      PrintWriter pw,
      Definition def,
      ExtensionRegistry extReg)
      throws WSDLException {
    MIMEContent mimeContent = (MIMEContent) extension;

    if (mimeContent != null) {
      String tagName = DOMUtils.getQualifiedValue(MIMEConstants.NS_URI_MIME, "content", def);

      if (parentType != null && MIMEPart.class.isAssignableFrom(parentType)) {
        pw.print("    ");
      }

      pw.print("        <" + tagName);

      DOMUtils.printAttribute(MIMEConstants.ATTR_PART, mimeContent.getPart(), pw);
      DOMUtils.printAttribute(Constants.ATTR_TYPE, mimeContent.getType(), pw);

      Boolean required = mimeContent.getRequired();

      if (required != null) {
        DOMUtils.printQualifiedAttribute(Constants.Q_ATTR_REQUIRED, required.toString(), def, pw);
      }

      pw.println("/>");
    }
  }
Ejemplo n.º 6
0
  private Element generateGraphicsNode(Document doc, ClassGraphics gr) {

    Element graphicsEl = doc.createElement(EL_GRAPHICS);

    Element bounds = doc.createElement(EL_BOUNDS);
    graphicsEl.appendChild(bounds);
    bounds.setAttribute(ATR_X, Integer.toString(gr.getBoundX()));
    bounds.setAttribute(ATR_Y, Integer.toString(gr.getBoundY()));
    bounds.setAttribute(ATR_WIDTH, Integer.toString(gr.getBoundWidth()));
    bounds.setAttribute(ATR_HEIGHT, Integer.toString(gr.getBoundHeight()));

    for (Shape shape : gr.getShapes()) {

      if (shape instanceof Rect) {
        Rect rect = (Rect) shape;
        Element rectEl = doc.createElement(EL_RECT);
        graphicsEl.appendChild(rectEl);
        rectEl.setAttribute(ATR_X, Integer.toString(rect.getX()));
        rectEl.setAttribute(ATR_Y, Integer.toString(rect.getY()));
        rectEl.setAttribute(ATR_WIDTH, Integer.toString(rect.getWidth()));
        rectEl.setAttribute(ATR_HEIGHT, Integer.toString(rect.getHeight()));
        rectEl.setAttribute(ATR_COLOUR, Integer.toString(rect.getColor().getRGB()));
        rectEl.setAttribute(ATR_FILLED, Boolean.toString(rect.isFilled()));
        rectEl.setAttribute(ATR_FIXED, Boolean.toString(rect.isFixed()));
        rectEl.setAttribute(ATR_STROKE, Float.toString(rect.getStroke().getLineWidth()));
        rectEl.setAttribute(ATR_LINETYPE, Float.toString(rect.getLineType()));
        rectEl.setAttribute(ATR_TRANSPARENCY, Integer.toString(rect.getTransparency()));
      } else if (shape instanceof Text) {
        Text text = (Text) shape;
        Element textEl = doc.createElement(EL_TEXT);
        textEl.setAttribute(ATR_STRING, text.getText());
        textEl.setAttribute(ATR_X, Integer.toString(text.getX()));
        textEl.setAttribute(ATR_Y, Integer.toString(text.getY()));
        textEl.setAttribute(ATR_FONTNAME, text.getFont().getName());
        textEl.setAttribute(ATR_FONTSIZE, Integer.toString(text.getFont().getSize()));
        textEl.setAttribute(ATR_FONTSTYLE, Integer.toString(text.getFont().getStyle()));
        textEl.setAttribute(ATR_TRANSPARENCY, Integer.toString(text.getTransparency()));
        textEl.setAttribute(ATR_COLOUR, Integer.toString(text.getColor().getRGB()));
        graphicsEl.appendChild(textEl);
      } // TODO handle the rest of shapes
    }

    return graphicsEl;
  }
  public void marshall(
      Class parentType,
      QName elementType,
      ExtensibilityElement extension,
      PrintWriter pw,
      Definition def,
      ExtensionRegistry extReg)
      throws WSDLException {
    SOAPBody soapBody = (SOAPBody) extension;

    if (soapBody != null) {
      String tagName = DOMUtils.getQualifiedValue(SOAPConstants.NS_URI_SOAP, "body", def);

      if (parentType != null && MIMEPart.class.isAssignableFrom(parentType)) {
        pw.print("    ");
      }

      pw.print("        <" + tagName);

      DOMUtils.printAttribute(
          SOAPConstants.ATTR_PARTS, StringUtils.getNMTokens(soapBody.getParts()), pw);
      DOMUtils.printAttribute(SOAPConstants.ATTR_USE, soapBody.getUse(), pw);
      DOMUtils.printAttribute(
          SOAPConstants.ATTR_ENCODING_STYLE,
          StringUtils.getNMTokens(soapBody.getEncodingStyles()),
          pw);
      DOMUtils.printAttribute(Constants.ATTR_NAMESPACE, soapBody.getNamespaceURI(), pw);

      Boolean required = soapBody.getRequired();

      if (required != null) {
        DOMUtils.printQualifiedAttribute(Constants.Q_ATTR_REQUIRED, required.toString(), def, pw);
      }

      pw.println("/>");
    }
  }
Ejemplo n.º 8
0
  /**
   * Converts the <code>EppXriAuthority</code> object into an XML element
   *
   * @param doc the XML <code>Document</code> object
   * @param tag the tag/element name for the <code>EppXriAuthority</code> object
   * @return an <code>Element</code> object
   */
  public Element toXML(Document doc, String tag) {
    Element elm;
    Element body = EppUtil.createElementNS(doc, "xriAU", tag);
    boolean isCreate = tag.equals("create");

    // the order of the tags for create is:
    //
    // authId/isEscrow/isContact/escrowAgent/contactAgent/socialData/authInfo
    //
    // the order of the tags for info is
    //
    // authId/isEscrow/isContact/escrowAgent/contactAgent/
    // roid/status/socialData/trustee/ref/redirect/equivID/canonicalEquivID/
    // sep/iname/inumber/iservice/extension/
    // clID/crID/crDate/upDate/trDate/authInfo
    //

    if (authId != null) {
      elm = doc.createElement("authId");
      elm.appendChild(doc.createTextNode(authId));
      body.appendChild(elm);
    }

    if (isEscrow != null) {
      elm = doc.createElement("isEscrow");
      elm.appendChild(doc.createTextNode(isEscrow.toString()));
      body.appendChild(elm);
    }

    if (isContact != null) {
      elm = doc.createElement("isContact");
      elm.appendChild(doc.createTextNode(isContact.toString()));
      body.appendChild(elm);
    }

    if (escrowAgent != null) {
      body.appendChild(escrowAgent.toXML(doc, "escrowAgent"));
    }

    if (contactAgent != null) {
      body.appendChild(contactAgent.toXML(doc, "contactAgent"));
    }
    if (contactHands != null) {
      for (int i = 0; i < contactHands.size(); i++) {
        EppXriContactData t = (EppXriContactData) contactHands.elementAt(i);
        body.appendChild(t.toXML(doc, "contactId"));
      }
    }
    if (isCreate) {
      if (socialData != null) {
        body.appendChild(socialData.toXML(doc, "socialData"));
      }
      if (authInfo != null) {
        body.appendChild(authInfo.toXML(doc, "authInfo"));
      }

      return body;
    }
    if (roid != null) {
      elm = doc.createElement("roid");
      elm.appendChild(doc.createTextNode(roid));
      body.appendChild(elm);
    }
    if (status != null) {
      for (int i = 0; i < status.size(); i++) {
        EppStatus s = (EppStatus) status.elementAt(i);
        body.appendChild(s.toXML(doc, "status"));
      }
    }
    if (socialData != null) {
      body.appendChild(socialData.toXML(doc, "socialData"));
    }
    if (trustee != null) {
      for (int i = 0; i < trustee.size(); i++) {
        EppXriTrustee t = (EppXriTrustee) trustee.elementAt(i);
        body.appendChild(t.toXML(doc, "trustee"));
      }
    }
    if (ref != null) {
      for (int i = 0; i < ref.size(); i++) {
        EppXriRef t = (EppXriRef) ref.elementAt(i);
        body.appendChild(t.toXML(doc, "ref"));
      }
    }
    if (redirect != null) {
      for (int i = 0; i < redirect.size(); i++) {
        EppXriURI t = (EppXriURI) redirect.elementAt(i);
        body.appendChild(t.toXML(doc, "redirect"));
      }
    }
    if (equivIDs != null) {
      for (int i = 0; i < equivIDs.size(); i++) {
        EppXriSynonym id = (EppXriSynonym) equivIDs.elementAt(i);
        body.appendChild(id.toXML(doc, "equivID"));
      }
    }
    if (canonicalEquivID != null) {
      elm = doc.createElement("canonicalEquivID");
      elm.appendChild(doc.createTextNode(canonicalEquivID));
      body.appendChild(elm);
    }
    if (sep != null) {
      for (int i = 0; i < sep.size(); i++) {
        EppXriServiceEndpoint t = (EppXriServiceEndpoint) sep.elementAt(i);
        body.appendChild(t.toXML(doc, "sep"));
      }
    }
    if (iname != null) {
      for (int i = 0; i < iname.size(); i++) {
        String s = (String) iname.elementAt(i);
        elm = doc.createElement("iname");
        elm.appendChild(doc.createTextNode(s));
        body.appendChild(elm);
      }
    }
    if (inumber != null) {
      for (int i = 0; i < inumber.size(); i++) {
        EppXriNumberAttribute xin = (EppXriNumberAttribute) inumber.elementAt(i);
        body.appendChild(xin.toXML(doc, "inumber"));
      }
    }
    if (iservice != null) {
      for (int i = 0; i < iservice.size(); i++) {
        String s = (String) iservice.elementAt(i);
        elm = doc.createElement("iservice");
        elm.appendChild(doc.createTextNode(s));
        body.appendChild(elm);
      }
    }
    if (extension != null) {
      elm = doc.createElement("extension");
      elm.appendChild(doc.createTextNode(extension));
      body.appendChild(elm);
    }

    toXMLCommon(doc, body);

    return body;
  }