@Override
  public void post_init(ORBInitInfo info) {
    try {
      org.omg.CORBA.Object obj;

      // Use CDR encapsulations with GIOP 1.0 encoding.
      Encoding encoding =
          new Encoding(
              ENCODING_CDR_ENCAPS.value, (byte) 1, /* GIOP version */ (byte) 0 /* GIOP revision*/);
      Codec codec = info.codec_factory().create_codec(encoding);

      // Create and register client interceptor.
      obj = info.resolve_initial_references("SASCurrent");
      SASCurrentImpl sasCurrentImpl = (SASCurrentImpl) obj;
      SASClientInterceptor clientInterceptor = new SASClientInterceptor(codec);
      info.add_client_request_interceptor(clientInterceptor);

      // Create and register server interceptor.
      SASTargetInterceptor serverInterceptor = new SASTargetInterceptor(codec);
      info.add_server_request_interceptor(serverInterceptor);

      // Initialize the SASCurrent implementation.
      sasCurrentImpl.init(serverInterceptor);
    } catch (Exception e) {
      throw new RuntimeException("Unexpected " + e);
    }
  }
Exemplo n.º 2
0
  /**
   * <code>pre_init</code> does nothing..
   *
   * @param info an <code>ORBInitInfo</code> value
   */
  public void pre_init(ORBInitInfo info) {
    try {
      slotID = info.allocate_slot_id();

      info.add_server_request_interceptor(new SInterceptor(((ORBInitInfoImpl) info).getORB()));
    } catch (DuplicateName e) {
      throw new RuntimeException();
    }
  }
Exemplo n.º 3
0
  /**
   * This method registers the interceptors.
   *
   * @param info an <code>ORBInitInfo</code> value
   */
  public void post_init(ORBInitInfo info) {
    try {
      slotID = info.allocate_slot_id();

      info.add_server_request_interceptor(new SInterceptor(((ORBInitInfoImpl) info).getORB()));
    } catch (DuplicateName e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 4
0
 @Override
 public void pre_init(ORBInitInfo info) {
   ORBInitInfoImpl infoImpl = (ORBInitInfoImpl) info;
   Codec codec = createCodec(infoImpl);
   try {
     info.add_client_request_interceptor(
         new DoorClientRequestInterceptorImpl(
             "ClientRequestInterceptor", infoImpl.getORB(), codec));
     info.add_server_request_interceptor(
         new ServerRequestInterceptorImpl("ServerRequestInterceptor", infoImpl.getORB(), codec));
   } catch (DuplicateName e) {
     String message = "Unexpected error registering interceptors";
     throw new INITIALIZE(message);
   }
 }
Exemplo n.º 5
0
 /**
  * This method registers the interceptors.
  *
  * @param info an <code>ORBInitInfo</code> value
  */
 public void post_init(ORBInitInfo info) {
   try {
     info.add_client_request_interceptor(new ClientTestInterceptor());
   } catch (DuplicateName e) {
     e.printStackTrace();
   }
 }
  @Override
  public void pre_init(ORBInitInfo info) {
    try {
      // create and register the SASCurrent.
      SASCurrent sasCurrent = new SASCurrentImpl();
      info.register_initial_reference("SASCurrent", sasCurrent);

      // the SASCurrent still needs to be initialized. Its initialization is deferred to post_init,
      // as it needs
      // to call resolve_initial_references.
    } catch (InvalidName e) {
      throw new RuntimeException("Could not register initial reference for SASCurrent: " + e);
    }
  }
Exemplo n.º 7
0
  /**
   * Cria uma inst�ncia do Codec a ser utilizado pelos interceptadores.
   *
   * @param info informa��o do ORB
   * @return o Codec.
   */
  private Codec createCodec(ORBInitInfo info) {
    CodecFactory codecFactory = info.codec_factory();

    Encoding encoding =
        new Encoding(
            ENCODING_CDR_ENCAPS.value,
            ENCODING_CDR_ENCAPS_MAJOR_VERSION,
            ENCODING_CDR_ENCAPS_MINOR_VERSION);

    try {
      return codecFactory.create_codec(encoding);
    } catch (UnknownEncoding e) {
      String message = "Unexpected error creating codec";
      throw new INITIALIZE(message);
    }
  }