Package org.apache.etch.bindings.java.msg

Examples of org.apache.etch.bindings.java.msg.StructValue


 
  private final Field field;
 
  public StructValue exportValue( ValueFactory vf, Object value )
  {
    StructValue sv = new StructValue( type, vf );
    sv.put( field, value.toString() );
    return sv;
  }
View Full Code Here


 
  private final Field field;

  public StructValue exportValue( ValueFactory vf, Object value )
  {
    StructValue sv = new StructValue( type, vf );
    sv.put( field, value.toString() );
    return sv;
  }
View Full Code Here

   
    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 ))
View Full Code Here

    public void dispatch( Who sender, Message msg ) throws Exception
    {
      System.out.println( "msg = "+msg );
      if (msg.isType( MyValueFactoryCuae._mt_etch_examples_cuae_CuaeServer_doit1 ))
      {
        StructValue req = (StructValue) msg.get( MyValueFactoryCuae._mf_req );
        MyValueFactoryCuae._mt_etch_examples_cuae_Cuae_Request.checkIsAssignableFrom( req.type() );
        int code = (Integer) req.get( MyValueFactoryCuae._mf_code );
       
        StructValue resp;
        switch (code)
        {
          case 23:
            resp = new StructValue( MyValueFactoryCuae._mt_etch_examples_cuae_Cuae_Response, vf );
            resp.put( MyValueFactoryCuae._mf_msg, "foo" );
            delayDoit2a( 7 );
            break;
         
          case 19:
            resp = new StructValue( MyValueFactoryCuae._mt_etch_examples_cuae_Cuae_RespWithCode, vf );
            resp.put( MyValueFactoryCuae._mf_msg, "bar" );
            resp.put( MyValueFactoryCuae._mf_code, 54 );
            delayDoit2b( 11, "heaven" );
            break;
         
          case 13:
            resp = new StructValue( MyValueFactoryCuae._mt_etch_examples_cuae_Cuae_Response, vf );
            resp.put( MyValueFactoryCuae._mf_msg, "baz" );
            delayDoit2a( 99 );
            break;
         
          default:
            resp = new StructValue( MyValueFactoryCuae._mt_etch_examples_cuae_Cuae_RespWithCode, vf );
            resp.put( MyValueFactoryCuae._mf_msg, "unknown code " + code );
            resp.put( MyValueFactoryCuae._mf_code, 63 );
            delayDoit2b( 23, "killer bee" );
            break;
        }
       
       
        Message rmsg = msg.reply();
        System.out.println( "rmsg = "+rmsg );
        System.out.println( "resp = "+resp );
        rmsg.put( MyValueFactoryCuae._mf_result, resp );
        svc.transportMessage( sender, rmsg );
        return;
      }
     
      if (msg.isType( MyValueFactoryCuae._mt_etch_examples_cuae_Cuae_doit3 ))
      {
        StructValue[] reqs = (StructValue[]) msg.get( MyValueFactoryCuae._mf_req );
        StructValue req = reqs[0];
        MyValueFactoryCuae._mt_etch_examples_cuae_Cuae_Request.checkIsAssignableFrom( req.type() );
        int code = (Integer) req.get( MyValueFactoryCuae._mf_code );
       
        StructValue resp;
        switch (code)
        {
          case 23:
            resp = new StructValue( MyValueFactoryCuae._mt_etch_examples_cuae_Cuae_Response, vf );
            resp.put( MyValueFactoryCuae._mf_msg, "foo" );
            delayDoit2a( 7 );
            break;
         
          case 19:
            resp = new StructValue( MyValueFactoryCuae._mt_etch_examples_cuae_Cuae_RespWithCode, vf );
            resp.put( MyValueFactoryCuae._mf_msg, "bar" );
            resp.put( MyValueFactoryCuae._mf_code, 54 );
            delayDoit2b( 11, "heaven" );
            break;
         
          case 13:
            resp = new StructValue( MyValueFactoryCuae._mt_etch_examples_cuae_Cuae_Response, vf );
            resp.put( MyValueFactoryCuae._mf_msg, "baz" );
            delayDoit2a( 99 );
            break;
         
          default:
            resp = new StructValue( MyValueFactoryCuae._mt_etch_examples_cuae_Cuae_RespWithCode, vf );
            resp.put( MyValueFactoryCuae._mf_msg, "unknown code " + code );
            resp.put( MyValueFactoryCuae._mf_code, 63 );
            delayDoit2b( 23, "killer bee" );
            break;
        }
       
       
View Full Code Here

      {
        TodoManager.addTodo( new Todo()
        {
          public void doit( TodoManager mgr ) throws Exception
          {
            StructValue req = new StructValue( MyValueFactoryCuae._mt_etch_examples_cuae_Cuae_Request, vf );
            req.put( MyValueFactoryCuae._mf_code, code );
           
            Message msg = new Message( MyValueFactoryCuae._mt_etch_examples_cuae_CuaeClient_doit2, vf );
            msg.put( MyValueFactoryCuae._mf_req, req );
           
            Mailbox mb = svc.begincall( msg );
            Object value = svc.endcall( mb, MyValueFactoryCuae._mt_etch_examples_cuae_CuaeServer__result_doit2 );
           
            if (value instanceof Exception)
            {
              Exception e = (Exception) value;
              e.fillInStackTrace();
              throw e;
            }
           
            StructValue resp = (StructValue) value;
            MyValueFactoryCuae._mt_etch_examples_cuae_Cuae_Response.checkIsAssignableFrom( resp.type() );
            System.out.printf( "**** delayDoit2a: req %d response %s\n", code, resp );
          }

          public void exception( TodoManager mgr, Exception e )
          {
View Full Code Here

      {
        TodoManager.addTodo( new Todo()
        {
          public void doit( TodoManager mgr ) throws Exception
          {
            StructValue req = new StructValue( MyValueFactoryCuae._mt_etch_examples_cuae_Cuae_ReqWithMessage, vf );
            req.put( MyValueFactoryCuae._mf_code, code );
            req.put( MyValueFactoryCuae._mf_msg, message );
           
            Message msg = new Message( MyValueFactoryCuae._mt_etch_examples_cuae_CuaeClient_doit2, vf );
            msg.put( MyValueFactoryCuae._mf_req, req );
           
            Mailbox mb = svc.begincall( msg );
            Object value = svc.endcall( mb, MyValueFactoryCuae._mt_etch_examples_cuae_CuaeServer__result_doit2 );
           
            if (value instanceof Exception)
            {
              Exception e = (Exception) value;
              e.fillInStackTrace();
              throw e;
            }
           
            StructValue resp = (StructValue) value;
            MyValueFactoryCuae._mt_etch_examples_cuae_Cuae_Response.checkIsAssignableFrom( resp.type() );
            System.out.printf( "**** delayDoit2b: req %d response %s\n", code, resp );
          }

          public void exception( TodoManager mgr, Exception e )
          {
View Full Code Here

    }
  }

  private StructValue readStruct() throws IOException
  {
    StructValue sv = startStruct();
    readKeysAndValues( sv );
    endStruct( sv );
    return sv;
  }
View Full Code Here

  private StructValue startStruct() throws IOException
  {
    Type t = readType();
    int length = readLength();
   
    return new StructValue( t, vf, length );
  }
View Full Code Here

        break;
       
      case TypeCode.STRUCT:
      case TypeCode.CUSTOM:
      {
        StructValue struct = vf.exportCustomValue( value );
       
        if (struct == null)
          throw new UnsupportedOperationException( "unsupported type "+value.getClass() );
       
        te.setAttr( null, ELEMENT_TYPE_ATTR, CUSTOM_TYPE );
View Full Code Here

        writeBytes( ((String) value).getBytes( vf.getStringEncoding() ) );
        return;
     
      case TypeCode.CUSTOM:
      {
        StructValue struct = vf.exportCustomValue( value );
       
        if (struct == null)
          throw new UnsupportedOperationException( "unsupported type "+value.getClass() );
       
        writeStruct( struct );
View Full Code Here

TOP

Related Classes of org.apache.etch.bindings.java.msg.StructValue

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.