@Override
 public void toData(DataOutput out) throws IOException {
   out.writeInt(this.prId);
   out.writeByte(this.scope.ordinal);
   InternalDataSerializer.invokeToData(this.pAttrs, out);
   out.writeBoolean(this.isDestroying);
   out.writeBoolean(this.isColocationComplete);
   InternalDataSerializer.invokeToData(this.nodes, out);
   DataSerializer.writeString(this.partitionResolver, out);
   DataSerializer.writeString(this.colocatedWith, out);
   DataSerializer.writeString(this.fullPath, out);
   InternalDataSerializer.invokeToData(this.ea, out);
   InternalDataSerializer.invokeToData(this.regionIdleTimeout, out);
   InternalDataSerializer.invokeToData(this.regionTimeToLive, out);
   InternalDataSerializer.invokeToData(this.entryIdleTimeout, out);
   InternalDataSerializer.invokeToData(this.entryTimeToLive, out);
   out.writeBoolean(this.firstDataStoreCreated);
   DataSerializer.writeObject(elderFPAs, out);
   DataSerializer.writeArrayList(this.partitionListenerClassNames, out);
   if (this.gatewaySenderIds.isEmpty()) {
     DataSerializer.writeObject(null, out);
   } else {
     DataSerializer.writeObject(this.gatewaySenderIds, out);
   }
 }
示例#2
0
 @Override
 public void toData(DataOutput out) throws IOException {
   DataSerializer.writeObject(key, out);
   DataSerializer.writeObject(originKey, out);
   DataSerializer.writeBoolean(nodeChange, out);
   DataSerializer.writeHashMap(values, out);
   DataSerializer.writeString(operation, out);
 }
示例#3
0
 @Override
 public void fromData(DataInput in) throws IOException, ClassNotFoundException {
   key = DataSerializer.readObject(in);
   originKey = DataSerializer.readObject(in);
   nodeChange = DataSerializer.readBoolean(in);
   values = DataSerializer.readHashMap(in);
   operation = DataSerializer.readString(in);
 }
 @Override
 public void fromData(DataInput din) throws IOException, ClassNotFoundException {
   super.fromData(din);
   processorId = din.readInt();
   channelState = DataSerializer.readHashMap(din);
   requestingMember = (DistributedMember) DataSerializer.readObject(din);
   this.isSingleFlushTo = din.readBoolean();
 }
 @Override
 public void toData(DataOutput dout) throws IOException {
   super.toData(dout);
   dout.writeInt(processorId);
   DataSerializer.writeHashMap(channelState, dout);
   DataSerializer.writeObject(requestingMember, dout);
   dout.writeBoolean(this.isSingleFlushTo);
 }
 @Override
 public void fromData(DataInput in) throws IOException, ClassNotFoundException {
   super.fromData(in);
   this.jmxManager = DataSerializer.readPrimitiveBoolean(in);
   this.host = DataSerializer.readString(in);
   this.port = DataSerializer.readPrimitiveInt(in);
   this.ssl = DataSerializer.readPrimitiveBoolean(in);
   this.started = DataSerializer.readPrimitiveBoolean(in);
 }
 @Override
 public void fromData(DataInput din) throws IOException, ClassNotFoundException {
   super.fromData(din);
   relayRecipient = (DistributedMember) DataSerializer.readObject(din);
   processorId = din.readInt();
   processorType = din.readInt();
   allRegions = din.readBoolean();
   if (!allRegions) {
     regionPath = DataSerializer.readString(din);
   }
 }
 @Override
 public void toData(DataOutput dout) throws IOException {
   super.toData(dout);
   DataSerializer.writeObject(relayRecipient, dout);
   dout.writeInt(processorId);
   dout.writeInt(processorType);
   dout.writeBoolean(allRegions);
   if (!allRegions) {
     DataSerializer.writeString(regionPath, dout);
   }
 }
 public void fromData(DataInput in) throws IOException, ClassNotFoundException {
   boolean hasHost = in.readBoolean();
   if (hasHost) {
     host = DataSerializer.readInetAddress(in);
   }
   boolean hasDirectory = in.readBoolean();
   if (hasDirectory) {
     directory = DataSerializer.readString(in);
   }
   diskStoreID = DataSerializer.readObject(in);
   revokedTime = in.readLong();
 }
 public void fromData(DataInput in) throws IOException, ClassNotFoundException {
   this.redundancy = in.readInt();
   this.totalMaxMemory = in.readLong();
   this.localMaxMemory = in.readInt();
   this.totalNumBuckets = in.readInt();
   this.colocatedRegionName = DataSerializer.readString(in);
   this.localProperties = (Properties) DataSerializer.readObject(in);
   this.globalProperties = (Properties) DataSerializer.readObject(in);
   this.recoveryDelay = in.readLong();
   this.startupRecoveryDelay = in.readLong();
   this.fixedPAttrs = DataSerializer.readObject(in);
 }
 /**
  * Writes an object to a <code>Datautput</code>.
  *
  * @throws IOException If this serializer cannot write an object to <code>out</code>.
  * @see #fromData
  */
 @Override
 public void toData(DataOutput out) throws IOException {
   // Note: does not call super.toData what a HACK
   out.writeByte(_operation.getEventCode());
   int instantiatorCount = this.serializedInstantiators.length;
   out.writeInt(instantiatorCount);
   for (int i = 0; i < instantiatorCount; i++) {
     DataSerializer.writeByteArray(this.serializedInstantiators[i], out);
   }
   DataSerializer.writeObject(_membershipId, out);
   DataSerializer.writeObject(_eventIdentifier, out);
 }
示例#12
0
 /**
  * Reads the state of this object from the given <code>DataInput</code>.
  *
  * @gfcodegen This code is generated by gfcodegen.
  */
 public void fromData(DataInput input) throws IOException, ClassNotFoundException {
   name = DataSerializer.readString(input);
   //		isReal = DataSerializer.readBoolean(input);
   fullPath = DataSerializer.readString(input);
   childList = DataSerializer.readObject(input);
   attrInfo = DataSerializer.readObject(input);
   temporalType = DataSerializer.readObject(input);
   keyTypeName = DataSerializer.readString(input);
   valueTypeName = DataSerializer.readString(input);
   size = DataSerializer.readPrimitiveInt(input);
   primaryBucketInfoList = DataSerializer.readObject(input);
   redundantBucketInfoList = DataSerializer.readObject(input);
 }
  public void toData(DataOutput out) throws IOException {
    out.writeBoolean(host != null);
    if (host != null) {
      DataSerializer.writeInetAddress(host, out);
    }
    out.writeBoolean(directory != null);
    if (directory != null) {
      DataSerializer.writeString(directory, out);
    }

    DataSerializer.writeObject(diskStoreID, out);
    out.writeLong(revokedTime);
  }
示例#14
0
 /**
  * Writes the state of this object to the given <code>DataOutput</code>.
  *
  * @gfcodegen This code is generated by gfcodegen.
  */
 public void toData(DataOutput output) throws IOException {
   DataSerializer.writeString(name, output);
   //		DataSerializer.writeBoolean(isReal, output);
   DataSerializer.writeString(fullPath, output);
   DataSerializer.writeObject(childList, output);
   DataSerializer.writeObject(attrInfo, output);
   DataSerializer.writeObject(temporalType, output);
   DataSerializer.writeString(keyTypeName, output);
   DataSerializer.writeString(valueTypeName, output);
   DataSerializer.writePrimitiveInt(size, output);
   DataSerializer.writeObject(primaryBucketInfoList, output);
   DataSerializer.writeObject(redundantBucketInfoList, output);
 }
 /**
  * @throws IllegalStateException if off-heap and the actual value is not yet known (because the
  *     DistributedSystem has not yet been created)
  */
 public void toData(DataOutput out) throws IOException {
   checkLocalMaxMemoryExists();
   out.writeInt(this.redundancy);
   out.writeLong(this.totalMaxMemory);
   out.writeInt(
       getLocalMaxMemory()); // call the gettor to force it to be computed in the offheap case
   out.writeInt(this.totalNumBuckets);
   DataSerializer.writeString(this.colocatedRegionName, out);
   DataSerializer.writeObject(this.localProperties, out);
   DataSerializer.writeObject(this.globalProperties, out);
   out.writeLong(this.recoveryDelay);
   out.writeLong(this.startupRecoveryDelay);
   DataSerializer.writeObject(this.fixedPAttrs, out);
 }
 /**
  * Post 7.1, if changes are made to this method make sure that it is backwards compatible by
  * creating toDataPreXX methods. Also make sure that the callers to this method are backwards
  * compatible by creating toDataPreXX methods for them even if they are not changed. <br>
  * Callers for this method are: <br>
  * SendQueueMessage.toData(DataOutput) <br>
  */
 public void toData(DataOutput out) throws IOException {
   out.writeByte(this.op.ordinal);
   DataSerializer.writeObject(this.cbArg, out);
   if (this.op.isEntry()) {
     DataSerializer.writeObject(this.key, out);
     if (this.op.isUpdate() || this.op.isCreate()) {
       out.writeByte(this.deserializationPolicy);
       if (this.deserializationPolicy != DistributedCacheOperation.DESERIALIZATION_POLICY_EAGER) {
         DataSerializer.writeByteArray(this.value, out);
       } else {
         DataSerializer.writeObject(this.valueObj, out);
       }
     }
   }
 }
 @Override
 public void fromData(DataInput in) throws IOException, ClassNotFoundException {
   super.fromData(in);
   int i = in.readInt();
   GemFireHealth.Health oHC = (GemFireHealth.Health) DataSerializer.readObject(in);
   init_(i, oHC);
 }
  /* package */ boolean recoverFromFile(File file) throws InternalGemFireException {
    if (!file.exists()) {
      return false;
    }

    logger.info("Peer locator recovering from " + file.getAbsolutePath());
    try (ObjectInput ois = new ObjectInputStream(new FileInputStream(file))) {
      if (ois.readInt() != LOCATOR_FILE_STAMP) {
        return false;
      }

      ObjectInput ois2 = ois;
      int version = ois2.readInt();
      if (version != Version.CURRENT_ORDINAL) {
        Version geodeVersion = Version.fromOrdinalNoThrow((short) version, false);
        logger.info("Peer locator found that persistent view was written with {}", geodeVersion);
        ois2 = new VersionedObjectInput(ois2, geodeVersion);
      }

      Object o = DataSerializer.readObject(ois2);
      this.view = (NetView) o;

      logger.info("Peer locator initial membership is " + view);
      return true;

    } catch (Exception e) {
      String msg = LOCATOR_UNABLE_TO_RECOVER_VIEW.toLocalizedString(file.toString());
      logger.warn(msg, e);
      if (!file.delete() && file.exists()) {
        logger.warn("Peer locator was unable to recover from or delete " + file);
        this.viewFile = null;
      }
      throw new InternalGemFireException(msg, e);
    }
  }
 public void saveView(NetView view) {
   if (viewFile == null) {
     return;
   }
   if (!viewFile.delete() && viewFile.exists()) {
     logger.warn(
         "Peer locator is unable to delete persistent membership information in "
             + viewFile.getAbsolutePath());
   }
   try {
     ObjectOutputStream oos = null;
     try {
       oos = new ObjectOutputStream(new FileOutputStream(viewFile));
       oos.writeInt(LOCATOR_FILE_STAMP);
       oos.writeInt(Version.CURRENT_ORDINAL);
       DataSerializer.writeObject(view, oos);
     } finally {
       oos.flush();
       oos.close();
     }
   } catch (Exception e) {
     logger.warn(
         "Peer locator encountered an error writing current membership to disk.  Disabling persistence.  Care should be taken when bouncing this locator as it will not be able to recover knowledge of the running distributed system",
         e);
     this.viewFile = null;
   }
 }
 @Override
 public void toData(DataOutput out) throws IOException {
   super.toData(out);
   out.writeInt(this.prId);
   out.writeInt(this.processorId);
   DataSerializer.writeObject(this.profiles, out);
 }
 /**
  * Reads an object from a <code>DataInput</code>.
  *
  * @throws IOException If this serializer cannot read an object from <code>in</code>.
  * @throws ClassNotFoundException If the class for an object being restored cannot be found.
  * @see #toData
  */
 @Override
 public void fromData(DataInput in) throws IOException, ClassNotFoundException {
   // Note: does not call super.fromData what a HACK
   _operation = EnumListenerEvent.getEnumListenerEvent(in.readByte());
   int instantiatorCount = in.readInt(); // is byte suficient for this ?
   this.serializedInstantiators = new byte[instantiatorCount][];
   for (int i = 0; i < instantiatorCount; i++) {
     this.serializedInstantiators[i] = DataSerializer.readByteArray(in);
   }
   _membershipId = ClientProxyMembershipID.readCanonicalized(in);
   _eventIdentifier = (EventID) DataSerializer.readObject(in);
   DistributedSystem ds = InternalDistributedSystem.getAnyInstance();
   if (ds != null) {
     _logger = ds.getLogWriter().convertToLogWriterI18n();
   }
 }
  public static byte[] initializeAndGetDSIdentity(DistributedSystem sys) {
    byte[] client_side_identity = null;
    if (sys == null) {
      // DistributedSystem is required now before handshaking -Kirk
      throw new IllegalStateException(
          LocalizedStrings
              .ClientProxyMembershipID_ATTEMPTING_TO_HANDSHAKE_WITH_CACHESERVER_BEFORE_CREATING_DISTRIBUTEDSYSTEM_AND_CACHE
              .toLocalizedString());
    }
    // if (system != sys)
    {
      // DS already exists... make sure it's for current DS connection
      systemMemberId = sys.getDistributedMember();
      try {
        HeapDataOutputStream hdos = new HeapDataOutputStream(256, Version.CURRENT);
        DataSerializer.writeObject(systemMemberId, hdos);
        client_side_identity = hdos.toByteArray();
      } catch (IOException ioe) {
        throw new InternalGemFireException(
            LocalizedStrings.ClientProxyMembershipID_UNABLE_TO_SERIALIZE_IDENTITY
                .toLocalizedString(),
            ioe);
      }

      system = sys;
    }
    return client_side_identity;
  }
 @Override
 public void fromData(DataInput in) throws IOException, ClassNotFoundException {
   super.fromData(in);
   this.prId = in.readInt();
   this.processorId = in.readInt();
   this.profiles = DataSerializer.readObject(in);
 }
 /** call this when the distributed system ID has been modified */
 @edu.umd.cs.findbugs.annotations.SuppressWarnings(
     value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD",
     justification =
         "Only applicable in client DS and in that case too multiple instances do not modify it at the same time.")
 public void updateID(DistributedMember idm) {
   //    this.transientPort = ((InternalDistributedMember)this.memberId).getPort();
   //    if (this.transientPort == 0) {
   //      InternalDistributedSystem.getLoggerI18n().warning(
   //          LocalizedStrings.DEBUG,
   //          "updating client ID when member port is zero: " + this.memberId,
   //          new Exception("stack trace")
   //          );
   //    }
   HeapDataOutputStream hdos = new HeapDataOutputStream(256, Version.CURRENT);
   try {
     DataSerializer.writeObject(idm, hdos);
   } catch (IOException e) {
     throw new InternalGemFireException("Unable to serialize member: " + this.memberId, e);
   }
   this.identity = hdos.toByteArray();
   if (this.memberId != null && this.memberId == systemMemberId) {
     systemMemberId = idm;
     // client_side_identity = this.identity;
   }
   this.memberId = idm;
   this._toString = null; // make sure we don't retain the old ID representation in toString
 }
    public AuthenticateUserOpImpl(Connection con, ExecutablePool pool) {
      super(MessageType.USER_CREDENTIAL_MESSAGE, 1);
      byte[] credentialBytes = null;
      // TODO this is not a valid way to create a member ID
      DistributedMember server =
          new InternalDistributedMember(
              con.getSocket().getInetAddress(), con.getSocket().getPort(), false);
      DistributedSystem sys = InternalDistributedSystem.getConnectedInstance();
      String authInitMethod =
          sys.getProperties().getProperty(DistributionConfig.SECURITY_CLIENT_AUTH_INIT_NAME);
      Properties tmpSecurityProperties = sys.getSecurityProperties();

      // LOG: following passes the DS API LogWriters into the security API
      Properties credentials =
          HandShake.getCredentials(
              authInitMethod,
              tmpSecurityProperties,
              server,
              false,
              (InternalLogWriter) sys.getLogWriter(),
              (InternalLogWriter) sys.getSecurityLogWriter());

      getMessage().setEarlyAck(Message.MESSAGE_HAS_SECURE_PART);
      HeapDataOutputStream heapdos = new HeapDataOutputStream(Version.CURRENT);
      try {
        DataSerializer.writeProperties(credentials, heapdos);
        credentialBytes = ((ConnectionImpl) con).getHandShake().encryptBytes(heapdos.toByteArray());
      } catch (Exception e) {
        throw new ServerOperationException(e);
      } finally {
        heapdos.close();
      }
      getMessage().addBytesPart(credentialBytes);
    }
 public void toData(DataOutput out) throws IOException {
   //    if (this.transientPort == 0) {
   //      InternalDistributedSystem.getLoggerI18n().warning(
   //          LocalizedStrings.DEBUG,
   //          "serializing a client ID with zero port: " + this.toString(),
   //          new Exception("Stack trace"));
   //    }
   DataSerializer.writeByteArray(this.identity, out);
   out.writeInt(this.uniqueId);
 }
  public static ClientProxyMembershipID readCanonicalized(DataInput in)
      throws IOException, ClassNotFoundException {

    ClientProxyMembershipID result = DataSerializer.readObject(in);
    // We can't canonicalize if we have no identity.
    // I only saw this happen in unit tests that serialize "new ClientProxyMembershipID()".
    if (result == null || result.identity == null) {
      return result;
    }
    return result.canonicalReference();
  }
 /** @throws com.gemstone.gemfire.SerializationException if serialization fails */
 public RegisterDataSerializersOpImpl(
     LogWriterI18n lw, DataSerializer[] dataSerializers, EventID eventId) {
   super(lw, MessageType.REGISTER_DATASERIALIZERS, dataSerializers.length * 2 + 1);
   for (int i = 0; i < dataSerializers.length; i++) {
     DataSerializer dataSerializer = dataSerializers[i];
     // strip '.class' off these class names
     String className = dataSerializer.getClass().toString().substring(6);
     try {
       getMessage().addBytesPart(BlobHelper.serializeToBlob(className));
     } catch (IOException ex) {
       throw new SerializationException("failed serializing object", ex);
     }
     getMessage().addIntPart(dataSerializer.getId());
   }
   getMessage().addBytesPart(eventId.calcBytes());
   // // CALLBACK FOR TESTING PURPOSE ONLY ////
   if (PoolImpl.IS_INSTANTIATOR_CALLBACK) {
     BridgeObserver bo = BridgeObserverHolder.getInstance();
     bo.beforeSendingToServer(eventId);
   }
 }
  /**
   * Fill out this instance of the message using the <code>DataInput</code> Required to be a {@link
   * com.gemstone.gemfire.DataSerializable}Note: must be symmetric with {@link
   * #toData(DataOutput)}in what it reads
   */
  @Override
  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
    super.fromData(in);
    this.flags = in.readShort();
    setFlags(this.flags, in);
    this.regionPath = DataSerializer.readString(in);

    // extra field post 9.0
    if (InternalDataSerializer.getVersionForDataStream(in).compareTo(Version.GFE_90) >= 0) {
      this.isTransactionDistributed = in.readBoolean();
    }
  }
 @Override
 public void toData(DataOutput out) throws IOException {
   boolean tmpJmxManager;
   String tmpHost;
   int tmpPort;
   boolean tmpSsl;
   boolean tmpStarted;
   synchronized (this) {
     tmpJmxManager = this.jmxManager;
     tmpHost = this.host;
     tmpPort = this.port;
     tmpSsl = this.ssl;
     tmpStarted = this.started;
   }
   super.toData(out);
   DataSerializer.writePrimitiveBoolean(tmpJmxManager, out);
   DataSerializer.writeString(tmpHost, out);
   DataSerializer.writePrimitiveInt(tmpPort, out);
   DataSerializer.writePrimitiveBoolean(tmpSsl, out);
   DataSerializer.writePrimitiveBoolean(tmpStarted, out);
 }