Ejemplo n.º 1
0
  public static ServerData createServerData(int x, int y) {
    if (serverData == null) {
      serverData = new ServerData();
      serverData.shipX = x;
      serverData.shipY = y;
    }

    return serverData;
  }
  /** Takes an NBTTagCompound with 'name' and 'ip' keys, returns a ServerData instance. */
  public static ServerData getServerDataFromNBTCompound(NBTTagCompound par0NBTTagCompound) {
    ServerData var1 =
        new ServerData(par0NBTTagCompound.getString("name"), par0NBTTagCompound.getString("ip"));

    if (par0NBTTagCompound.hasKey("acceptTextures")) {
      var1.setAcceptsTextures(par0NBTTagCompound.getBoolean("acceptTextures"));
    }

    return var1;
  }
Ejemplo n.º 3
0
  public String[] retrieveAllAddrByCluster(String cluster) {
    List<String> addrs = new ArrayList<String>();
    if (clusterAddrTable.containsKey(cluster)) {
      Set<String> brokerNames = clusterAddrTable.get(cluster);
      for (String brokerName : brokerNames) {
        ServerData brokerData = brokerAddrTable.get(brokerName);
        if (null != brokerData) {
          addrs.addAll(brokerData.getBrokerAddrs().values());
        }
      }
    }

    return addrs.toArray(new String[] {});
  }
Ejemplo n.º 4
0
  /*
   * Server data
   */
  public static void saveServerData(String key, String subKey, Object data) {
    // Remove the data if it exists already
    ServerData.Util.remove(key, subKey);

    // Create and save the timed data
    ServerData serverData = new ServerData();
    serverData.generateId();
    serverData.setKey(key);
    serverData.setSubKey(subKey);
    serverData.setData(data.toString());
    DataManager.serverData.put(serverData.getId(), serverData);
  }
Ejemplo n.º 5
0
  public static void adaptPipeline() {
    if (ServerData.clientCommand.contains("play")) {
      StateChangeReturn ret = ServerData.pipe.setState(State.PLAYING);
      ServerData.setRate(ServerData.pipe, 1);
      System.out.println(ret.toString());
    } else if (ServerData.clientCommand.contains("pause")) {
      StateChangeReturn ret = ServerData.pipe.setState(State.PAUSED);
      System.out.println(ret.toString());
    } else if (ServerData.clientCommand.contains("fastforward")) {
      if (ServerData.Rate > 0) {
        ServerData.setRate(ServerData.pipe, 2 * ServerData.Rate);
      } else {
        ServerData.setRate(ServerData.pipe, 1);
      }
    } else if (ServerData.clientCommand.contains("rewind")) {

      if (ServerData.Rate < 0) ServerData.setRate(ServerData.pipe, 2 * ServerData.Rate);
      else if (ServerData.Rate == 1) ServerData.setRate(ServerData.pipe, -2);
      else if (ServerData.Rate > 1) ServerData.setRate(ServerData.pipe, 1);
    }
  }
Ejemplo n.º 6
0
 public synchronized boolean equals(java.lang.Object obj) {
   if (!(obj instanceof ServerData)) return false;
   ServerData other = (ServerData) obj;
   if (obj == null) return false;
   if (this == obj) return true;
   if (__equalsCalc != null) {
     return (__equalsCalc == obj);
   }
   __equalsCalc = obj;
   boolean _equals;
   _equals =
       true
           && ((this.ID == null && other.getID() == null)
               || (this.ID != null && this.ID.equals(other.getID())))
           && ((this.name == null && other.getName() == null)
               || (this.name != null && this.name.equals(other.getName())))
           && ((this.controlPort == null && other.getControlPort() == null)
               || (this.controlPort != null && this.controlPort.equals(other.getControlPort())))
           && ((this.firewallCompatibility == null && other.getFirewallCompatibility() == null)
               || (this.firewallCompatibility != null
                   && this.firewallCompatibility.equals(other.getFirewallCompatibility())))
           && ((this.multicast == null && other.getMulticast() == null)
               || (this.multicast != null && this.multicast.equals(other.getMulticast())))
           && ((this.loadBalancerScore == null && other.getLoadBalancerScore() == null)
               || (this.loadBalancerScore != null
                   && this.loadBalancerScore.equals(other.getLoadBalancerScore())))
           && ((this.replicationUN == null && other.getReplicationUN() == null)
               || (this.replicationUN != null
                   && this.replicationUN.equals(other.getReplicationUN())))
           && ((this.replicationPW == null && other.getReplicationPW() == null)
               || (this.replicationPW != null
                   && this.replicationPW.equals(other.getReplicationPW())))
           && ((this.createdDate == null && other.getCreatedDate() == null)
               || (this.createdDate != null && this.createdDate.equals(other.getCreatedDate())));
   __equalsCalc = null;
   return _equals;
 }
Ejemplo n.º 7
0
    /**
     * static method to create the object Precondition: If this object is an element, the current or
     * next start element starts this object and any intervening reader events are ignorable If this
     * object is not an element, it is a complex type and the reader is at the event just after the
     * outer start element Postcondition: If this object is an element, the reader is positioned at
     * its end element If this object is a complex type, the reader is positioned at the end element
     * of its outer element
     */
    public static ServerData parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      ServerData object = new ServerData();

      int event;
      java.lang.String nillableValue = null;
      java.lang.String prefix = "";
      java.lang.String namespaceuri = "";
      try {

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
          java.lang.String fullTypeName =
              reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
          if (fullTypeName != null) {
            java.lang.String nsPrefix = null;
            if (fullTypeName.indexOf(":") > -1) {
              nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":"));
            }
            nsPrefix = nsPrefix == null ? "" : nsPrefix;

            java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1);

            if (!"serverData".equals(type)) {
              // find namespace for the prefix
              java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
              return (ServerData)
                  org.wso2.carbon.bam.ExtensionMapper.getTypeObject(nsUri, type, reader);
            }
          }
        }

        // Note all attributes that were handled. Used to differ normal attributes
        // from anyAttributes.
        java.util.Vector handledAttributes = new java.util.Vector();

        reader.next();

        java.util.ArrayList list1 = new java.util.ArrayList();

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        if (reader.isStartElement()
            && new javax.xml.namespace.QName("http://bam.carbon.wso2.org", "data")
                .equals(reader.getName())) {

          // Process the array and step past its final element's end.
          list1.add(org.wso2.carbon.bam.Data3.Factory.parse(reader));

          // loop until we find a start element that is not part of this array
          boolean loopDone1 = false;
          while (!loopDone1) {
            // We should be at the end element, but make sure
            while (!reader.isEndElement()) reader.next();
            // Step out of this element
            reader.next();
            // Step to next element event.
            while (!reader.isStartElement() && !reader.isEndElement()) reader.next();
            if (reader.isEndElement()) {
              // two continuous end elements means we are exiting the xml structure
              loopDone1 = true;
            } else {
              if (new javax.xml.namespace.QName("http://bam.carbon.wso2.org", "data")
                  .equals(reader.getName())) {
                list1.add(org.wso2.carbon.bam.Data3.Factory.parse(reader));

              } else {
                loopDone1 = true;
              }
            }
          }
          // call the converter utility  to convert and set the array

          object.setData(
              (org.wso2.carbon.bam.Data3[])
                  org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
                      org.wso2.carbon.bam.Data3.class, list1));

        } // End of if for expected property start element
        else {

        }

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        if (reader.isStartElement())
          // A start element we are not expecting indicates a trailing invalid property
          throw new org.apache.axis2.databinding.ADBException(
              "Unexpected subelement " + reader.getName());

      } catch (javax.xml.stream.XMLStreamException e) {
        throw new java.lang.Exception(e);
      }

      return object;
    }