Package freenet.support

Examples of freenet.support.SimpleFieldSet


  /**
   * @param fcpIdentifier FCP-level identifier for pairing requests and responses.
   *                      If null the field is omitted.
   */
  public FCPResponse(String fcpIdentifier) {
    fs = new SimpleFieldSet(true);
    fs.putOverwrite(IDENTIFIER, fcpIdentifier);
  }
View Full Code Here


  }

 
  @Override
  public SimpleFieldSet getFieldSet() {
    SimpleFieldSet fs = new SimpleFieldSet(true);
    if(withCurrent) {
      SimpleFieldSet current = node.config.exportFieldSet(Config.RequestType.CURRENT_SETTINGS, true);
      if(!current.isEmpty()) {
        fs.put("current", current);
      }
    }
    if(withDefaults) {
      SimpleFieldSet defaultSettings = node.config.exportFieldSet(Config.RequestType.DEFAULT_SETTINGS, false);
      if(!defaultSettings.isEmpty()) {
        fs.put("default", defaultSettings);
      }
    }
    if(withSortOrder) {
      SimpleFieldSet sortOrder = node.config.exportFieldSet(Config.RequestType.SORT_ORDER, false);
      if(!sortOrder.isEmpty()) {
        fs.put("sortOrder", sortOrder);
      }
    }
    if(withExpertFlag) {
      SimpleFieldSet expertFlag = node.config.exportFieldSet(Config.RequestType.EXPERT_FLAG, false);
      if(!expertFlag.isEmpty()) {
        fs.put("expertFlag", expertFlag);
      }
    }
    if(withForceWriteFlag) {
      SimpleFieldSet forceWriteFlag = node.config.exportFieldSet(Config.RequestType.FORCE_WRITE_FLAG, false);
      if(!forceWriteFlag.isEmpty()) {
        fs.put("forceWriteFlag", forceWriteFlag);
      }
    }
    if(withShortDescription) {
      SimpleFieldSet shortDescription = node.config.exportFieldSet(Config.RequestType.SHORT_DESCRIPTION, false);
      if(!shortDescription.isEmpty()) {
        fs.put("shortDescription", shortDescription);
      }
    }
    if(withLongDescription) {
      SimpleFieldSet longDescription = node.config.exportFieldSet(Config.RequestType.LONG_DESCRIPTION, false);
      if(!longDescription.isEmpty()) {
        fs.put("longDescription", longDescription);
      }
    }
    if(withDataTypes) {
      SimpleFieldSet type = node.config.exportFieldSet(Config.RequestType.DATA_TYPE, false);
      if(!type.isEmpty()) {
        fs.put("dataType", type);
      }
    }
    if(identifier != null)
      fs.putSingle("Identifier", identifier);
View Full Code Here

    fs.removeValue("Identifier");
  }

  @Override
  public SimpleFieldSet getFieldSet() {
    return new SimpleFieldSet(true);
  }
View Full Code Here

      return "EndMessage";
  }

  @Override
  public SimpleFieldSet getFieldSet() {
    SimpleFieldSet sfs = new SimpleFieldSet(true);
    sfs.putSingle("PluginName", plugname);
    sfs.putSingle("Identifier", identifier);
    if (dataLength() > 0)
      sfs.put("DataLength", dataLength());     
    sfs.put("Replies", plugparams);
    return sfs;
  }
View Full Code Here

    try {
      fis = new FileInputStream(data);
      BufferedInputStream bis = new BufferedInputStream(fis);
      InputStreamReader ir = new InputStreamReader(bis, "UTF-8");
      BufferedReader br = new BufferedReader(ir);
      SimpleFieldSet fs = new SimpleFieldSet(br, false, true);
      return new AddressTracker(fs, lastBootID);
    } catch (IOException e) {
      // Fall through
    } catch (FSParseException e) {
      Logger.warning(AddressTracker.class, "Failed to load from disk for port "+port+": "+e, e);
View Full Code Here

    timeDefinitelyNoPacketsReceivedPeer = System.currentTimeMillis();
    timeDefinitelyNoPacketsReceivedIP = System.currentTimeMillis();
    timeDefinitelyNoPacketsSentPeer = fs.getLong("TimeDefinitelyNoPacketsSentPeer");
    timeDefinitelyNoPacketsSentIP = fs.getLong("TimeDefinitelyNoPacketsSentIP");
    peerTrackers = new HashMap<Peer, PeerAddressTrackerItem>();
    SimpleFieldSet peers = fs.subset("Peers");
    if(peers != null) {
    Iterator<String> i = peers.directSubsetNameIterator();
    if(i != null) {
    while(i.hasNext()) {
      SimpleFieldSet peer = peers.subset(i.next());
      PeerAddressTrackerItem item = new PeerAddressTrackerItem(peer);
      peerTrackers.put(item.peer, item);
    }
    }
    }
    ipTrackers = new HashMap<InetAddress, InetAddressAddressTrackerItem>();
    SimpleFieldSet ips = fs.subset("IPs");
    if(ips != null) {
    Iterator<String> i = ips.directSubsetNameIterator();
    if(i != null) {
    while(i.hasNext()) {
      SimpleFieldSet peer = ips.subset(i.next());
      InetAddressAddressTrackerItem item = new InetAddressAddressTrackerItem(peer);
      ipTrackers.put(item.addr, item);
    }
    }
    }
View Full Code Here

    try {
      fos = new FileOutputStream(dataBak);
      BufferedOutputStream bos = new BufferedOutputStream(fos);
      OutputStreamWriter osw = new OutputStreamWriter(bos, "UTF-8");
      BufferedWriter bw = new BufferedWriter(osw);
      SimpleFieldSet fs = getFieldset(bootID);
      fs.writeTo(bw);
      bw.flush();
      bw.close();
      fos = null;
      FileUtil.renameTo(dataBak, data);
    } catch (IOException e) {
View Full Code Here

        }
    }
  }

  private synchronized SimpleFieldSet getFieldset(long bootID) {
    SimpleFieldSet sfs = new SimpleFieldSet(true);
    sfs.put("Version", 2);
    sfs.put("BootID", bootID);
    sfs.put("TimeDefinitelyNoPacketsReceivedPeer", timeDefinitelyNoPacketsReceivedPeer);
    sfs.put("TimeDefinitelyNoPacketsReceivedIP", timeDefinitelyNoPacketsReceivedIP);
    sfs.put("TimeDefinitelyNoPacketsSentPeer", timeDefinitelyNoPacketsSentPeer);
    sfs.put("TimeDefinitelyNoPacketsSentIP", timeDefinitelyNoPacketsSentIP);
    PeerAddressTrackerItem[] peerItems = getPeerAddressTrackerItems();
    SimpleFieldSet items = new SimpleFieldSet(true);
    if(peerItems.length > 0) {
      for(int i = 0; i < peerItems.length; i++)
        items.put(Integer.toString(i), peerItems[i].toFieldSet());
      sfs.put("Peers", items);
    }
    InetAddressAddressTrackerItem[] inetItems = getInetAddressTrackerItems();
    items = new SimpleFieldSet(true);
    if(inetItems.length > 0) {
        for(int i = 0; i < inetItems.length; i++)
      items.put(Integer.toString(i), inetItems[i].toFieldSet());
        sfs.put("IPs", items);
    }
    return sfs;
  }
View Full Code Here

      }
  }

  @Override
  public SimpleFieldSet getFieldSet() {
    SimpleFieldSet fs = super.getFieldSet();
    fs.putSingle("Header", header);
    fs.putSingle("ShortText", shortText);
    fs.put("PriorityClass", priorityClass);
    fs.put("UpdatedTime", updatedTime);
    return fs;
  }
View Full Code Here

  }

  @Override
  public SimpleFieldSet getFieldSet() {
    SimpleFieldSet fs = super.getFieldSet();
    fs.putSingle("Name", name);
    fs.putSingle("URI", URI.toString());
    fs.put("HasAnActivelink", hasAnActivelink);
    return fs;
  }
View Full Code Here

TOP

Related Classes of freenet.support.SimpleFieldSet

Copyright © 2018 www.massapicom. 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.