Package etch.bindings.java.msg

Examples of etch.bindings.java.msg.Type


      types.get( ETCH_AUTH_EXCEPTION_TYPE_NAME ), class2type );

    // ------------------ _mt__Etch_AuthException ------------------
   
    {
      final Type t = types.get( ETCH_EXCEPTION_MESSAGE_NAME );
      t.putValidator( _mf_result, Validator_RuntimeException.get() );
      t.putValidator( _mf__messageId, Validator_long.get( 0 ) );
      t.putValidator( _mf__inReplyTo, Validator_long.get( 0 ) );
    }
  }
View Full Code Here


  {
    TagElement te = readNextTagElement();
    if (te == null)
      return false;
   
    Type t = null; // TODO this needs to come from somewhere.
    Integer id = te.getIntAttr( null, KEY_ATTR );
    se.key = t.getField( id );
   
    stack.push( te );
    se.value = intReadValue();
    stack.pop();
   
View Full Code Here

 
  private ValueFactory[] mixins = {};
 
  public final Type getType( Integer id )
  {
    Type type = types.get( id );
    if (type != null)
      return type;
   
    for (ValueFactory vf: mixins)
      if ((type = vf.getType( id )) != null)
View Full Code Here

    }
  }

  public final Type getType( String name )
  {
    Type type = types.get( name );
    if (type != null)
      return type;
   
    for (ValueFactory vf: mixins)
      if ((type = vf.getType( name )) != null)
View Full Code Here

  public final StructValue exportCustomValue( Object value )
  {
    Class<?> clss = value.getClass();
   
    Type type = getCustomStructType( clss );
   
    if (type == null && clss == StructValue.class)
    {
      StructValue struct = (StructValue) value;
      type = struct.type();
    }
   
    if (type == null)
    {
      if (Throwable.class.isAssignableFrom( clss ))
        type = _mt__Etch_RuntimeException;
      else if (List.class.isAssignableFrom( clss ))
        type = _mt__Etch_List;
      else if (Map.class.isAssignableFrom( clss ))
        type = _mt__Etch_Map;
      else if (Set.class.isAssignableFrom( clss ))
        type = _mt__Etch_Set;
      else
        return null;
    }
   
    ImportExportHelper helper = type.getImportExportHelper();
   
    if (helper == null)
      return null;
   
    return helper.exportValue( this, value );
View Full Code Here

    return helper.importValue( struct );
  }

  public final Type getCustomStructType( Class<?> c )
  {
    Type type = class2type.get( c );
    if (type != null)
      return type;
   
    for (ValueFactory vf: mixins)
      if ((type = vf.getCustomStructType( c )) != null)
View Full Code Here

  protected final Pool _free;

  @SuppressWarnings("unchecked")
  public final boolean sessionMessage( Who sender, Message msg ) throws Exception
  {
    Type type = msg.type();
   
    StubHelper<T> helper = (StubHelper<T>) type.getStubHelper();
    if (helper == null)
      return false;
   
    switch (type.getAsyncMode())
    {
      case QUEUED:
        try
        {
          _queued.run( new StubPoolRunnable( sender, msg, helper ) );
        }
        catch ( Exception e )
        {
          sessionNotify( _obj, e );
        }
        break;
      case FREE:
        try
        {
          _free.run( new StubPoolRunnable( sender, msg, helper ) );
        }
        catch ( Exception e )
        {
          sessionNotify( _obj, e );
        }
        break;
      case NONE:
        try
        {
          helper.run( _svc, _obj, sender, msg );
        }
        catch ( Exception e )
        {
          sessionNotify( _obj, e );
        }
        break;
            default:
                throw new IllegalArgumentException("unknown async mode "+type.getAsyncMode());
    }
   
    return true;
  }
View Full Code Here

    vf = (ValueFactory) resources.get( Transport.VALUE_FACTORY );

    mf_delay = new Field( "delay" );
    mf_count = new Field( "count" );
   
    mt_request = new Type( "_Etch_KeepAliveReq" );
    mt_request.putValidator( mf_delay, Validator_int.get( 0 ) );
    mt_request.putValidator( mf_count, Validator_int.get( 0 ) );
    vf.addType( mt_request );

    mt_response = new Type( "_Etch_KeepAliveResp" );
    vf.addType( mt_response );
   
    mt_request.setResult( mt_response );
  }
View Full Code Here

    // now we want the type code for c, and if the type code is custom,
    // we'll also want the struct type code.
   
    byte typeCode = getNativeTypeCode( c );
   
    Type customStructType;
    if (typeCode == TypeCode.CUSTOM || typeCode == TypeCode.STRUCT)
    {
      customStructType = getCustomStructType( c );
     
      if (customStructType == null && c == StructValue.class)
View Full Code Here

    // string
    Assert.assertEquals( TypeCode.EMPTY_STRING, btdo.checkValue( "" ) );
    Assert.assertEquals( TypeCode.STRING, btdo.checkValue( "abc" ) );
   
    // struct
    Assert.assertEquals( TypeCode.CUSTOM, btdo.checkValue( new StructValue( new Type( "foo" ), vf ) ) );
   
    // custom
    Assert.assertEquals( TypeCode.CUSTOM, btdo.checkValue( new Date() ) );
   
    // none
View Full Code Here

TOP

Related Classes of etch.bindings.java.msg.Type

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.