Ejemplo n.º 1
0
  public Object readObject(AbstractHessianInput in, Object obj, String[] fieldNames)
      throws IOException {
    try {
      int ref = in.addRef(obj);

      for (int i = 0; i < fieldNames.length; i++) {
        String name = fieldNames[i];

        FieldDeserializer deser = (FieldDeserializer) _fieldMap.get(name);

        if (deser != null) deser.deserialize(in, obj);
        else in.readObject();
      }

      Object resolve = resolve(obj);

      if (obj != resolve) in.setRef(ref, resolve);

      return resolve;
    } catch (IOException e) {
      throw e;
    } catch (Exception e) {
      throw new IOExceptionWrapper(obj.getClass().getName() + ":" + e, e);
    }
  }
Ejemplo n.º 2
0
  public Object readLengthList(AbstractHessianInput in, int length) throws IOException {
    Collection list = createList();

    in.addRef(list);

    for (; length > 0; length--) list.add(in.readObject());

    return list;
  }
Ejemplo n.º 3
0
  public Object readList(AbstractHessianInput in, int length) throws IOException {
    Collection list = createList();

    in.addRef(list);

    while (!in.isEnd()) list.add(in.readObject());

    in.readEnd();

    return list;
  }
Ejemplo n.º 4
0
  public AbstractHessianInput getHessianInput(InputStream is) {
    AbstractHessianInput in;

    if (_isDebug) is = new HessianDebugInputStream(is, new PrintWriter(System.out));

    in = new Hessian2Input(is);

    in.setRemoteResolver(getRemoteResolver());

    in.setSerializerFactory(getSerializerFactory());

    return in;
  }
Ejemplo n.º 5
0
  public Object readObject(AbstractHessianInput in, String[] fieldNames) throws IOException {
    String name = null;

    for (int i = 0; i < fieldNames.length; i++) {
      if ("name".equals(fieldNames[i])) name = in.readString();
      else in.readObject();
    }

    Object obj = create(name);

    in.addRef(obj);

    return obj;
  }
Ejemplo n.º 6
0
 private Object readObject(AbstractHessianInput in, Object obj, FieldDeserializer[] fields)
     throws IOException {
   try {
     int ref = in.addRef(obj);
     for (FieldDeserializer reader : fields) {
       reader.deserialize(in, obj);
     }
     Object resolve = resolve(in, obj);
     if (obj != resolve) in.setRef(ref, resolve);
     return resolve;
   } catch (IOException e) {
     throw e;
   } catch (Exception e) {
     throw new IOExceptionWrapper(obj.getClass().getName() + ":" + e, e);
   }
 }
Ejemplo n.º 7
0
 void deserialize(AbstractHessianInput in, Object obj) throws IOException {
   int value = 0;
   try {
     value = in.readInt();
     _field.setShort(obj, (short) value);
   } catch (Exception e) {
     logDeserializeError(_field, obj, value, e);
   }
 }
Ejemplo n.º 8
0
 void deserialize(AbstractHessianInput in, Object obj) throws IOException {
   boolean value = false;
   try {
     value = in.readBoolean();
     _field.setBoolean(obj, value);
   } catch (Exception e) {
     logDeserializeError(_field, obj, value, e);
   }
 }
Ejemplo n.º 9
0
 void deserialize(AbstractHessianInput in, Object obj) throws IOException {
   double value = 0;
   try {
     value = in.readDouble();
     _field.setDouble(obj, value);
   } catch (Exception e) {
     logDeserializeError(_field, obj, value, e);
   }
 }
Ejemplo n.º 10
0
 public Object readObject(AbstractHessianInput in, Object obj, String[] fieldNames)
     throws IOException {
   try {
     int ref = in.addRef(obj);
     for (String fieldName : fieldNames) {
       FieldDeserializer reader = _fieldMap.get(fieldName);
       if (reader != null) reader.deserialize(in, obj);
       else in.readObject();
     }
     Object resolve = resolve(in, obj);
     if (obj != resolve) in.setRef(ref, resolve);
     return resolve;
   } catch (IOException e) {
     throw e;
   } catch (Exception e) {
     throw new IOExceptionWrapper(obj.getClass().getName() + ":" + e, e);
   }
 }
Ejemplo n.º 11
0
 void deserialize(AbstractHessianInput in, Object obj) throws IOException {
   String value = null;
   try {
     value = in.readString();
     _field.set(obj, value);
   } catch (Exception e) {
     logDeserializeError(_field, obj, value, e);
   }
 }
Ejemplo n.º 12
0
  public Object readObject(AbstractHessianInput in, Object[] fields) throws IOException {
    String[] fieldNames = (String[]) fields;

    int ref = in.addRef(null);

    long initValue = Long.MIN_VALUE;

    for (int i = 0; i < fieldNames.length; i++) {
      String key = fieldNames[i];

      if (key.equals("value")) initValue = in.readUTCDate();
      else in.readObject();
    }

    Object value = create(initValue);

    in.setRef(ref, value);

    return value;
  }
Ejemplo n.º 13
0
    void deserialize(AbstractHessianInput in, Object obj) throws IOException {
      java.sql.Time value = null;

      try {
        java.util.Date date = (java.util.Date) in.readObject();
        value = new java.sql.Time(date.getTime());

        _field.set(obj, value);
      } catch (Exception e) {
        logDeserializeError(_field, obj, value, e);
      }
    }
Ejemplo n.º 14
0
  public Object readMap(AbstractHessianInput in, Object obj) throws IOException {
    try {
      int ref = in.addRef(obj);

      while (!in.isEnd()) {
        Object key = in.readObject();

        FieldDeserializer deser = (FieldDeserializer) _fieldMap.get(key);

        if (deser != null) deser.deserialize(in, obj);
        else in.readObject();
      }

      in.readMapEnd();

      Object resolve = resolve(obj);

      if (obj != resolve) in.setRef(ref, resolve);

      return resolve;
    } catch (IOException e) {
      throw e;
    } catch (Exception e) {
      throw new IOExceptionWrapper(e);
    }
  }
Ejemplo n.º 15
0
  public Object readMap(AbstractHessianInput in) throws IOException {
    int ref = in.addRef(null);

    long initValue = Long.MIN_VALUE;

    while (!in.isEnd()) {
      String key = in.readString();

      if (key.equals("value")) initValue = in.readUTCDate();
      else in.readString();
    }

    in.readMapEnd();

    Object value = create(initValue);

    in.setRef(ref, value);

    return value;
  }
Ejemplo n.º 16
0
  public Object readMap(AbstractHessianInput in) throws IOException {
    String name = null;

    while (!in.isEnd()) {
      String key = in.readString();

      if (key.equals("name")) name = in.readString();
      else in.readObject();
    }

    in.readMapEnd();

    Object obj = create(name);

    in.addRef(obj);

    return obj;
  }
Ejemplo n.º 17
0
 @Override
 void deserialize(AbstractHessianInput in, Object obj) throws IOException {
   in.readObject();
 }