Package etch.bindings.java.msg

Examples of etch.bindings.java.msg.StructValue


    TagElement te = stack.peek();
    elementList.push( te.getChildren() );
   
    Integer id = te.getIntAttr( null, STRUCT_TYPE_ATTR );
    Type type = vf.getType( id );
    return new StructValue( type, vf );
  }
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

    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

 
  /** */
  @org.junit.Test
  public void test_S1_export()
  {
    StructValue sv = vf.exportCustomValue( new S1( 19, 23, 29 ) );
    sv.checkType( ValueFactoryTest1._mt_etch_tests_Test1_S1 );
    assertEquals( 3, sv.size() );
    assertEquals( 19, sv.get( ValueFactoryTest1._mf_x ) );
    assertEquals( 23, sv.get( ValueFactoryTest1._mf_y ) );
    assertEquals( 29, sv.get( ValueFactoryTest1._mf_z ) );
  }
View Full Code Here

 
  /** */
  @org.junit.Test
  public void test_S1_import()
  {
    StructValue sv = new StructValue( ValueFactoryTest1._mt_etch_tests_Test1_S1, vf );
    sv.put( ValueFactoryTest1._mf_x, 101 );
    sv.put( ValueFactoryTest1._mf_y, 103 );
    sv.put( ValueFactoryTest1._mf_z, 107 );
    S1 s = (S1) vf.importCustomValue( sv );
    assertEquals( 101, s.x );
    assertEquals( 103, s.y );
    assertEquals( 107, s.z );
  }
View Full Code Here

  {
    S1 a = new S1( 21, 22, 23 );
    S1 b = new S1( 31, 32, 33 );
    E1 c = E1.A;
   
    StructValue sv = vf.exportCustomValue( new S2( a, b, c ) );
    sv.checkType( ValueFactoryTest1._mt_etch_tests_Test1_S2 );
    assertEquals( 3, sv.size() );
   
    assertSame( a, sv.get( ValueFactoryTest1._mf_a ) );
    assertSame( b, sv.get( ValueFactoryTest1._mf_b ) );
    assertSame( c, sv.get( ValueFactoryTest1._mf_c ) );
  }
View Full Code Here

 
  /** */
  @org.junit.Test
  public void test_S2_import()
  {
    StructValue sv = new StructValue( ValueFactoryTest1._mt_etch_tests_Test1_S2, vf );
   
    sv.put( ValueFactoryTest1._mf_a, new S1( 21, 22, 23 ) );
    sv.put( ValueFactoryTest1._mf_b, new S1( 31, 32, 33 ) );
    sv.put( ValueFactoryTest1._mf_c, E1.A );
   
    S2 s = (S2) vf.importCustomValue( sv );
    assertEquals( 21, s.a.x );
    assertEquals( 22, s.a.y );
    assertEquals( 23, s.a.z );
View Full Code Here

    Object[] stringObject = new Object []{Test1.STRING1, Test1.STRING2, Test1.STRING3, Test1.STRING4, Test1.STRING5};

    String msg = "Exception";
    int code = 500;
   
    StructValue sv = vf.exportCustomValue( new Excp1( "abc", 23 ) );
    sv.checkType( ValueFactoryTest1._mt_etch_tests_Test1_Excp1 );
    assertEquals( 2, sv.size() );
    assertEquals( "abc", sv.get( ValueFactoryTest1._mf_msg ) );
    assertEquals( 23, sv.get( ValueFactoryTest1._mf_code ) );
   
    sv = vf.exportCustomValue( new Excp2() );
    sv.checkType( ValueFactoryTest1._mt_etch_tests_Test1_Excp2 );
    assertEquals( 0, sv.size() );
   
    sv = vf.exportCustomValue( new Excp3() );
    sv.checkType( ValueFactoryTest1._mt_etch_tests_Test1_Excp3 );
    assertEquals( 0, sv.size() );
   
    sv = vf.exportCustomValue( new Excp4() );
    sv.checkType( ValueFactoryTest1._mt_etch_tests_Test1_Excp4 );
    assertEquals( 0, sv.size() );
   
    // Import exception with object as param
    testExcp5Export(msg, code, Test1.BOOL2);
    testExcp5Export(msg, code, Test1.BYTE5);
    testExcp5Export(msg, code, Test1.SHORT5);
View Full Code Here

TOP

Related Classes of 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.