コード例 #1
0
ファイル: Configuration.java プロジェクト: JordanPryor/MCTC
 public Property get(String category, String key, boolean defaultValue) {
   Property prop = get(category, key, Boolean.toString(defaultValue), BOOLEAN);
   if (!prop.isBooleanValue()) {
     prop.value = Boolean.toString(defaultValue);
   }
   return prop;
 }
コード例 #2
0
ファイル: DrawbotGUI.java プロジェクト: bertbalcaen/DrawBot
 void SaveConfig() {
   String id = Long.toString(robot_uid);
   prefs.put(id + "_limit_top", Double.toString(limit_top));
   prefs.put(id + "_limit_bottom", Double.toString(limit_bottom));
   prefs.put(id + "_limit_right", Double.toString(limit_right));
   prefs.put(id + "_limit_left", Double.toString(limit_left));
   prefs.put(id + "_m1invert", Boolean.toString(m1invert));
   prefs.put(id + "_m2invert", Boolean.toString(m2invert));
 }
コード例 #3
0
 private static void toXml(XmlWriter w, Requirement requirement) throws IOException {
   w.element(RepositoryParser.REQUIRE)
       .attribute(RepositoryParser.NAME, requirement.getName())
       .attribute(RepositoryParser.FILTER, requirement.getFilter())
       .attribute(RepositoryParser.EXTEND, Boolean.toString(requirement.isExtend()))
       .attribute(RepositoryParser.MULTIPLE, Boolean.toString(requirement.isMultiple()))
       .attribute(RepositoryParser.OPTIONAL, Boolean.toString(requirement.isOptional()))
       .text(requirement.getComment().trim())
       .end();
 }
コード例 #4
0
  /** Add entries to the Map for node filter parameters from the nodeset */
  public static void addAPINodeSetParams(
      final HashMap<String, String> params, final NodeSet nodeSet, final Boolean isKeepgoing) {

    if (null == nodeSet) {
      return;
    }
    if (nodeSet.getThreadCount() > 0) {
      params.put("nodeThreadcount", Integer.toString(nodeSet.getThreadCount()));
    }
    if (null != isKeepgoing) {
      params.put("nodeKeepgoing", Boolean.toString(isKeepgoing));
    }
    if (nodeSet.isBlank()) {
      return;
    }
    boolean excludeprecedence = true;
    if (null != nodeSet.getExclude() && nodeSet.getExclude().isDominant()) {
      excludeprecedence = true;
    } else if (null != nodeSet.getInclude() && nodeSet.getInclude().isDominant()) {
      excludeprecedence = false;
    }
    params.put("exclude-precedence", Boolean.toString(excludeprecedence));

    final NodeSet.Include include = nodeSet.getInclude();

    for (final NodeSet.FILTER_ENUM filter : NodeSet.FILTER_ENUM.values()) {
      String value = null;
      if (null != include && !include.isBlank()) {
        value = filter.value(include);
      }

      final String key = filter.getName();
      if (null != value && !"".equals(value)) {
        params.put(key, value);
      } else {
        params.put(key, "");
      }
    }
    final NodeSet.Exclude exclude = nodeSet.getExclude();

    for (final NodeSet.FILTER_ENUM filter : NodeSet.FILTER_ENUM.values()) {
      String value = null;
      if (null != exclude && !exclude.isBlank()) {
        value = filter.value(exclude);
      }
      final String key = filter.getName();
      if (null != value && !"".equals(value)) {
        params.put("exclude-" + key, value);
      } else {
        params.put("exclude-" + key, "");
      }
    }
  }
コード例 #5
0
ファイル: AdminClient.java プロジェクト: kidaa/nimbus
 private static Map<String, String> nodeAllocationToMap(AssociationEntry entry) {
   final HashMap<String, String> map = new HashMap(8);
   map.put(FIELD_HOSTNAME, entry.getHostname());
   map.put(FIELD_IP, entry.getIpAddress());
   map.put(FIELD_MAC, entry.getMac());
   map.put(FIELD_BROADCAST, entry.getBroadcast());
   map.put(FIELD_SUBNET_MASK, entry.getSubnetMask());
   map.put(FIELD_GATEWAY, entry.getGateway());
   map.put(FIELD_IN_USE, Boolean.toString(entry.isInUse()));
   map.put(FIELD_EXPLICIT_MAC, Boolean.toString(entry.isExplicitMac()));
   return map;
 }
コード例 #6
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;
  }
コード例 #7
0
 public void startElement(String uri, String localName, String qName, Attributes attributes)
     throws SAXException {
   if ("tag".equals(qName)) {
     String name = attributes.getValue("name");
     String content = attributes.getValue("content");
     String section = attributes.getValue("section");
     String deprecated = attributes.getValue("deprecated");
     String unique = attributes.getValue("unique");
     String ignorePermitted = attributes.getValue("ignore-permitted");
     tagInfo =
         new TagInfo(
             name,
             "all".equals(content)
                 ? TagInfo.CONTENT_ALL
                 : ("none".equals(content) ? TagInfo.CONTENT_NONE : TagInfo.CONTENT_TEXT),
             "all".equals(section)
                 ? TagInfo.HEAD_AND_BODY
                 : ("head".equals(section) ? TagInfo.HEAD : TagInfo.BODY),
             deprecated != null && "true".equals(deprecated),
             unique != null && "true".equals(unique),
             ignorePermitted != null && "true".equals(ignorePermitted));
     if (generateCode) {
       String s = "tagInfo = new TagInfo(\"#1\", #2, #3, #4, #5, #6);";
       s = s.replaceAll("#1", name);
       s =
           s.replaceAll(
               "#2",
               "all".equals(content)
                   ? "TagInfo.CONTENT_ALL"
                   : ("none".equals(content)
                       ? "TagInfo.CONTENT_NONE"
                       : " TagInfo.CONTENT_TEXT"));
       s =
           s.replaceAll(
               "#3",
               "all".equals(section)
                   ? "TagInfo.HEAD_AND_BODY"
                   : ("head".equals(section) ? "TagInfo.HEAD" : "TagInfo.BODY"));
       s = s.replaceAll("#4", Boolean.toString(deprecated != null && "true".equals(deprecated)));
       s = s.replaceAll("#5", Boolean.toString(unique != null && "true".equals(unique)));
       s =
           s.replaceAll(
               "#6",
               Boolean.toString(ignorePermitted != null && "true".equals(ignorePermitted)));
       System.out.println(s);
     }
   } else if (!"tags".equals(qName)) {
     dependencyName = qName;
   }
 }
コード例 #8
0
  /** Execute the actual stop-domain command. */
  protected int doRemoteCommand() throws CommandException {

    // put the local-password for the instance  in programOpts
    // we don't do this for ALL local-instance commands because if they call
    // DAS with the instance's local-password it will cause BIG trouble...
    setLocalPassword();

    /*
     * If we're using the local password, we don't want to prompt
     * for a new password.  If the local password doesn't work it
     * most likely means we're talking to the wrong server.
     */
    programOpts.setInteractive(false);

    try {
      // run the remote stop-domain command and throw away the output
      RemoteCommand cmd = new RemoteCommand("_stop-instance", programOpts, env);
      cmd.executeAndReturnOutput("_stop-instance", "--force", force.toString());
      waitForDeath();
    } catch (CommandException e) {
      // 1.  We can't access the server at all
      // 2.  We timed-out waiting for it to die
      if (!kill) throw e;
    }

    if (kill) {
      // do NOT make this an error -- user specified a kill
      // if kill throws a CE -- then it WILL get tossed back as an error
      kill();
    }
    return 0;
  }
コード例 #9
0
  private void loadInitialConfigurationValues() {
    logger.debug("");
    setJDigiDocConfigurationValue("DIGIDOC_LOG4J_CONFIG", DEFAULT_LOG4J_CONFIGURATION);
    setJDigiDocConfigurationValue("SIGN_OCSP_REQUESTS", Boolean.toString(mode == Mode.PROD));
    setJDigiDocConfigurationValue("DIGIDOC_SECURITY_PROVIDER", DEFAULT_SECURITY_PROVIDER);
    setJDigiDocConfigurationValue("DIGIDOC_SECURITY_PROVIDER_NAME", DEFAULT_SECURITY_PROVIDER_NAME);
    setJDigiDocConfigurationValue("KEY_USAGE_CHECK", DEFAULT_KEY_USAGE_CHECK);
    setJDigiDocConfigurationValue("DIGIDOC_OCSP_SIGN_CERT_SERIAL", "");
    setJDigiDocConfigurationValue("DATAFILE_HASHCODE_MODE", DEFAULT_DATAFILE_HASHCODE_MODE);
    setJDigiDocConfigurationValue(
        "CANONICALIZATION_FACTORY_IMPL", DEFAULT_CANONICALIZATION_FACTORY_IMPLEMENTATION);
    setJDigiDocConfigurationValue("DIGIDOC_MAX_DATAFILE_CACHED", DEFAULT_MAX_DATAFILE_CACHED);
    setJDigiDocConfigurationValue("DIGIDOC_USE_LOCAL_TSL", DEFAULT_USE_LOCAL_TSL);
    setJDigiDocConfigurationValue("DIGIDOC_NOTARY_IMPL", DEFAULT_NOTARY_IMPLEMENTATION);
    setJDigiDocConfigurationValue("DIGIDOC_TSLFAC_IMPL", DEFAULT_TSL_FACTORY_IMPLEMENTATION);
    setJDigiDocConfigurationValue("DIGIDOC_OCSP_RESPONDER_URL", getOcspSource());
    setJDigiDocConfigurationValue("DIGIDOC_FACTORY_IMPL", DEFAULT_FACTORY_IMPLEMENTATION);
    setJDigiDocConfigurationValue("DIGIDOC_DF_CACHE_DIR", null);

    setConfigurationValue("TSL_LOCATION", "tslLocation");
    setConfigurationValue("TSP_SOURCE", "tspSource");
    setConfigurationValue("VALIDATION_POLICY", "validationPolicy");
    setConfigurationValue("PKCS11_MODULE", "pkcs11Module");
    setConfigurationValue("OCSP_SOURCE", "ocspSource");
    setConfigurationValue("DIGIDOC_PKCS12_CONTAINER", "OCSPAccessCertificateFile");
    setConfigurationValue("DIGIDOC_PKCS12_PASSWD", "OCSPAccessCertificatePassword");
    setConfigurationValue("CONNECTION_TIMEOUT", "connectionTimeout");
  }
コード例 #10
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("/>");
    }
  }
コード例 #11
0
 /**
  * Write out the moblog configuration
  *
  * @param userID User ID
  * @param moblogConfiguration Moblog configuration file
  * @param mailbox {@link Mailbox} information
  * @throws IOException If there is an error writing the configuration
  */
 private void writeMoblogConfiguration(String userID, String moblogConfiguration, Mailbox mailbox)
     throws IOException {
   File moblogConfigurationFile =
       new File(
           _blojsomConfiguration.getInstallationDirectory()
               + _blojsomConfiguration.getBaseConfigurationDirectory()
               + userID
               + "/"
               + moblogConfiguration);
   BufferedWriter bw =
       new BufferedWriter(
           new OutputStreamWriter(new FileOutputStream(moblogConfigurationFile), UTF8));
   bw.write(MoblogPlugin.PROPERTY_HOSTNAME);
   bw.write("=");
   bw.write(BlojsomUtils.nullToBlank(mailbox.getHostName()));
   bw.write(BlojsomUtils.LINE_SEPARATOR);
   bw.write(MoblogPlugin.PROPERTY_USERID);
   bw.write("=");
   bw.write(BlojsomUtils.nullToBlank(mailbox.getUserId()));
   bw.write(BlojsomUtils.LINE_SEPARATOR);
   bw.write(MoblogPlugin.PROPERTY_PASSWORD);
   bw.write("=");
   bw.write(BlojsomUtils.nullToBlank(mailbox.getPassword()));
   bw.write(BlojsomUtils.LINE_SEPARATOR);
   bw.write(MoblogPlugin.PROPERTY_CATEGORY);
   bw.write("=");
   bw.write(BlojsomUtils.nullToBlank(mailbox.getCategoryName()));
   bw.write(BlojsomUtils.LINE_SEPARATOR);
   bw.write(MoblogPlugin.PROPERTY_ENABLED);
   bw.write("=");
   bw.write(Boolean.toString(mailbox.isEnabled()));
   bw.write(BlojsomUtils.LINE_SEPARATOR);
   bw.write(MoblogPlugin.PROPERTY_AUTHORIZATION);
   bw.write("=");
   bw.write(MoblogPlugin.DEFAULT_MOBLOG_AUTHORIZATION_FILE);
   bw.write(BlojsomUtils.LINE_SEPARATOR);
   bw.write(MoblogPlugin.PLUGIN_MOBLOG_TEXT_MIME_TYPES);
   bw.write("=");
   bw.write(mailbox.getTextMimeTypesAsStringList());
   bw.write(BlojsomUtils.LINE_SEPARATOR);
   bw.write(MoblogPlugin.PLUGIN_MOBLOG_ATTACHMENT_MIME_TYPES);
   bw.write("=");
   bw.write(mailbox.getAttachmentMimeTypesAsStringList());
   bw.write(BlojsomUtils.LINE_SEPARATOR);
   bw.write(MoblogPlugin.PLUGIN_MOBLOG_IMAGE_MIME_TYPES);
   bw.write("=");
   bw.write(mailbox.getImageMimeTypesAsStringList());
   bw.write(BlojsomUtils.LINE_SEPARATOR);
   bw.write(MoblogPlugin.PLUGIN_MOBLOG_SECRET_WORD);
   bw.write("=");
   bw.write(BlojsomUtils.nullToBlank(mailbox.getSecretWord()));
   bw.write(BlojsomUtils.LINE_SEPARATOR);
   bw.write(MoblogPlugin.PLUGIN_MOBLOG_IGNORE_EXPRESSION);
   bw.write("=");
   bw.write(BlojsomUtils.nullToBlank(mailbox.getIgnoreExpression()));
   bw.write(BlojsomUtils.LINE_SEPARATOR);
   bw.close();
 }
コード例 #12
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;
  }
  private synchronized void writeOutput(
      @NotNull final CommonProblemDescriptor[] descriptions, @NotNull RefEntity refElement) {
    final Element parentNode = new Element(InspectionsBundle.message("inspection.problems"));
    exportResults(descriptions, refElement, parentNode);
    final List list = parentNode.getChildren();

    @NonNls final String ext = ".xml";
    final String fileName = ourOutputPath + File.separator + myToolWrapper.getShortName() + ext;
    final PathMacroManager pathMacroManager =
        PathMacroManager.getInstance(getContext().getProject());
    PrintWriter printWriter = null;
    try {
      new File(ourOutputPath).mkdirs();
      final File file = new File(fileName);
      final CharArrayWriter writer = new CharArrayWriter();
      if (!file.exists()) {
        writer
            .append("<")
            .append(InspectionsBundle.message("inspection.problems"))
            .append(" " + GlobalInspectionContextBase.LOCAL_TOOL_ATTRIBUTE + "=\"")
            .append(Boolean.toString(myToolWrapper instanceof LocalInspectionToolWrapper))
            .append("\">\n");
      }
      for (Object o : list) {
        final Element element = (Element) o;
        pathMacroManager.collapsePaths(element);
        JDOMUtil.writeElement(element, writer, "\n");
      }
      printWriter =
          new PrintWriter(
              new BufferedWriter(
                  new OutputStreamWriter(
                      new FileOutputStream(fileName, true), CharsetToolkit.UTF8_CHARSET)));
      printWriter.append("\n");
      printWriter.append(writer.toString());
    } catch (IOException e) {
      LOG.error(e);
    } finally {
      if (printWriter != null) {
        printWriter.close();
      }
    }
  }
コード例 #14
0
  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("/>");
    }
  }
コード例 #15
0
ファイル: Client.java プロジェクト: BinitaShakya/DSpace
  /**
   * Post a file to the server. The different elements of the post are encoded in the specified
   * message.
   *
   * @param message The message that contains the post information.
   * @throws SWORDClientException if there is an error during the post operation.
   */
  public DepositResponse postFile(PostMessage message) throws SWORDClientException {
    if (message == null) {
      throw new SWORDClientException("Message cannot be null.");
    }

    PostMethod httppost = new PostMethod(message.getDestination());

    if (doAuthentication) {
      setBasicCredentials(username, password);
      httppost.setDoAuthentication(true);
    }

    DepositResponse response = null;

    String messageBody = "";

    try {
      if (message.isUseMD5()) {
        String md5 = ChecksumUtils.generateMD5(message.getFilepath());
        if (message.getChecksumError()) {
          md5 = "1234567890";
        }
        log.debug("checksum error is: " + md5);
        if (md5 != null) {
          httppost.addRequestHeader(new Header(HttpHeaders.CONTENT_MD5, md5));
        }
      }

      String filename = message.getFilename();
      if (!"".equals(filename)) {
        httppost.addRequestHeader(
            new Header(HttpHeaders.CONTENT_DISPOSITION, " filename=" + filename));
      }

      if (containsValue(message.getSlug())) {
        httppost.addRequestHeader(new Header(HttpHeaders.SLUG, message.getSlug()));
      }

      if (message.getCorruptRequest()) {
        // insert a header with an invalid boolean value
        httppost.addRequestHeader(new Header(HttpHeaders.X_NO_OP, "Wibble"));
      } else {
        httppost.addRequestHeader(
            new Header(HttpHeaders.X_NO_OP, Boolean.toString(message.isNoOp())));
      }
      httppost.addRequestHeader(
          new Header(HttpHeaders.X_VERBOSE, Boolean.toString(message.isVerbose())));

      String packaging = message.getPackaging();
      if (packaging != null && packaging.length() > 0) {
        httppost.addRequestHeader(new Header(HttpHeaders.X_PACKAGING, packaging));
      }

      String onBehalfOf = message.getOnBehalfOf();
      if (containsValue(onBehalfOf)) {
        httppost.addRequestHeader(new Header(HttpHeaders.X_ON_BEHALF_OF, onBehalfOf));
      }

      String userAgent = message.getUserAgent();
      if (containsValue(userAgent)) {
        httppost.addRequestHeader(new Header(HttpHeaders.USER_AGENT, userAgent));
      }

      FileRequestEntity requestEntity =
          new FileRequestEntity(new File(message.getFilepath()), message.getFiletype());
      httppost.setRequestEntity(requestEntity);

      client.executeMethod(httppost);
      status = new Status(httppost.getStatusCode(), httppost.getStatusText());

      log.info("Checking the status code: " + status.getCode());

      if (status.getCode() == HttpStatus.SC_ACCEPTED || status.getCode() == HttpStatus.SC_CREATED) {
        messageBody = readResponse(httppost.getResponseBodyAsStream());
        response = new DepositResponse(status.getCode());
        response.setLocation(httppost.getResponseHeader("Location").getValue());
        // added call for the status code.
        lastUnmarshallInfo = response.unmarshall(messageBody, new Properties());
      } else {
        messageBody = readResponse(httppost.getResponseBodyAsStream());
        response = new DepositResponse(status.getCode());
        response.unmarshallErrorDocument(messageBody);
      }
      return response;

    } catch (NoSuchAlgorithmException nex) {
      throw new SWORDClientException("Unable to use MD5. " + nex.getMessage(), nex);
    } catch (HttpException ex) {
      throw new SWORDClientException(ex.getMessage(), ex);
    } catch (IOException ioex) {
      throw new SWORDClientException(ioex.getMessage(), ioex);
    } catch (UnmarshallException uex) {
      throw new SWORDClientException(uex.getMessage() + "(<pre>" + messageBody + "</pre>)", uex);
    } finally {
      httppost.releaseConnection();
    }
  }
コード例 #16
0
 /**
  * Writes the given boolean in XML format.
  *
  * @param b to write
  */
 public void writeBoolean(boolean b) {
   this.writeValue(DTD.TYPE_BOOLEAN, Boolean.toString(b));
 }
コード例 #17
0
 /** Set the value of the given property to the given boolean value. */
 public void setProperty(String prop, boolean val) {
   setProperty(prop, Boolean.toString(val));
 }
コード例 #18
0
  /** Set the default value of the given property to the given boolean value. */
  public void setDefaultProperty(String prop, boolean val) {
    String s = getProperty(prop);

    if (s == null) setProperty(prop, Boolean.toString(val));
  }
コード例 #19
0
  // actually writes claim data to an output stream
  private synchronized void writeClaimData(Claim claim, BufferedWriter outStream)
      throws IOException {
    if (claim.parent != null) {
      if (claim.id < 0 - 1) claim.id = getNextClaimID();
      Long ChildID = claim.getID();
      outStream.write("SUB:" + String.valueOf(ChildID));
      outStream.newLine();
    }
    // UUID tweak: first line is our UUID.
    outStream.write(claim.getUUID().toString());
    outStream.newLine();

    // first line is lesser boundary corner location
    outStream.write(this.locationToString(claim.getLesserBoundaryCorner()));
    outStream.newLine();

    // second line is greater boundary corner location
    outStream.write(this.locationToString(claim.getGreaterBoundaryCorner()));
    outStream.newLine();

    // third line is owner name
    outStream.write(claim.claimOwnerName);
    outStream.newLine();

    ArrayList<String> builders = new ArrayList<String>();
    ArrayList<String> containers = new ArrayList<String>();
    ArrayList<String> accessors = new ArrayList<String>();
    ArrayList<String> managers = new ArrayList<String>();

    claim.getPermissions(builders, containers, accessors, managers);

    // fourth line is list of players with build permission
    for (int i = 0; i < builders.size(); i++) {
      outStream.write(builders.get(i) + ";");
    }
    outStream.newLine();

    // fifth line is list of players with container permission
    for (int i = 0; i < containers.size(); i++) {
      outStream.write(containers.get(i) + ";");
    }
    outStream.newLine();

    // sixth line is list of players with access permission
    for (int i = 0; i < accessors.size(); i++) {
      outStream.write(accessors.get(i) + ";");
    }
    outStream.newLine();

    // seventh line is list of players who may grant permissions for others
    for (int i = 0; i < managers.size(); i++) {
      outStream.write(managers.get(i) + ";");
    }
    outStream.newLine();

    // eighth line has the never delete variable
    outStream.write(Boolean.toString(claim.neverdelete));
    outStream.newLine();

    // cap each claim with "=========="
    outStream.write("==========");
    outStream.newLine();
  }
コード例 #20
0
ファイル: OCSSWRuntimeConfig.java プロジェクト: mg1989/seadas
 private void initDebug() {
   debug = Boolean.valueOf(System.getProperty(debugKey, Boolean.toString(debug)));
 }
コード例 #21
0
 public void writeExternal(Element element) throws WriteExternalException {
   element.setAttribute(ATTRIBUTE_SHOW_RECYCLED, Boolean.toString(myShowRecycled));
   ShelvedChangeList.writeChanges(myShelvedChangeLists, myRecycledShelvedChangeLists, element);
 }
コード例 #22
0
 /** Appends a Boolean value as true/false instead of 0/1 */
 protected void appendBoolean(Boolean bool, Writer writer) throws IOException {
   writer.write(bool.toString());
 }
コード例 #23
0
ファイル: MainJVM.java プロジェクト: jonathansharman/drjava
 /** Calls replReturnedResult() */
 public Void forBooleanValue(Boolean b) {
   _interactionsModel.replReturnedResult(b.toString(), InteractionsDocument.OBJECT_RETURN_STYLE);
   return null;
 }
コード例 #24
0
ファイル: OlsDataHelper.java プロジェクト: swegener/ols
  /**
   * Writes the data to the given writer.
   *
   * @param aDataSet the project to write the settings for, cannot be <code>null</code> ;
   * @param aWriter the writer to write the data to, cannot be <code>null</code>.
   * @throws IOException in case of I/O problems.
   */
  public static void write(final StubDataSet aDataSet, final Writer aWriter) throws IOException {
    final BufferedWriter bw = new BufferedWriter(aWriter);

    final AcquisitionResult capturedData = aDataSet.getCapturedData();

    final Cursor[] cursors = aDataSet.getCursors();
    final boolean cursorsEnabled = aDataSet.isCursorsEnabled();

    try {
      final int[] values = capturedData.getValues();
      final long[] timestamps = capturedData.getTimestamps();

      bw.write(";Size: ");
      bw.write(Integer.toString(values.length));
      bw.newLine();

      bw.write(";Rate: ");
      bw.write(Integer.toString(capturedData.getSampleRate()));
      bw.newLine();

      bw.write(";Channels: ");
      bw.write(Integer.toString(capturedData.getChannels()));
      bw.newLine();

      bw.write(";EnabledChannels: ");
      bw.write(Integer.toString(capturedData.getEnabledChannels()));
      bw.newLine();

      if (capturedData.hasTriggerData()) {
        bw.write(";TriggerPosition: ");
        bw.write(Long.toString(capturedData.getTriggerPosition()));
        bw.newLine();
      }

      bw.write(";Compressed: ");
      bw.write(Boolean.toString(true));
      bw.newLine();

      bw.write(";AbsoluteLength: ");
      bw.write(Long.toString(capturedData.getAbsoluteLength()));
      bw.newLine();

      bw.write(";CursorEnabled: ");
      bw.write(Boolean.toString(cursorsEnabled));
      bw.newLine();

      for (int i = 0; cursorsEnabled && (i < cursors.length); i++) {
        if (cursors[i].isDefined()) {
          bw.write(String.format(";Cursor%d: ", Integer.valueOf(i)));
          bw.write(Long.toString(cursors[i].getTimestamp()));
          bw.newLine();
        }
      }
      for (int i = 0; i < values.length; i++) {
        bw.write(formatSample(values[i], timestamps[i]));
        bw.newLine();
      }
    } finally {
      bw.flush();
    }
  }