Пример #1
0
  public static ORB getORB() {
    synchronized (ORBFactory.class) {
      if (orb == null) {
        Properties properties;
        try {
          properties =
              (Properties)
                  AccessController.doPrivileged(
                      new PrivilegedAction() {
                        public Object run() {
                          return System.getProperties();
                        }
                      });
        } catch (SecurityException ignored) {
          log.trace("Unable to retrieve system properties", ignored);
          properties = null;
        }

        // Create the singleton ORB
        orb = ORB.init(new String[0], properties);

        // Activate the root POA
        try {
          POA rootPOA = (POA) orb.resolve_initial_references("RootPOA");
          rootPOA.the_POAManager().activate();
        } catch (Throwable t) {
          log.warn("Unable to activate POA", t);
        }
      }
      return orb;
    }
  }
Пример #2
0
  public static void main(String args[]) {
    try {
      // create and initialize the ORB
      ORB orb = ORB.init(args, null);

      System.out.println("ORB initialised\n");

      // get the root naming context
      org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");

      // Use NamingContextExt instead of NamingContext,
      // part of the Interoperable naming Service.
      NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);

      // resolve the Object Reference in Naming
      String name = "Hello1";
      helloImpl = HelloHelper.narrow(ncRef.resolve_str(name));

      System.out.println("Obtained a handle on server object: " + helloImpl);
      System.out.println(helloImpl.sayHello());
      helloImpl.shutdown();

    } catch (Exception e) {
      System.out.println("ERROR : " + e);
      e.printStackTrace(System.out);
    }
  } // end main
Пример #3
0
  public void invoke(
      org.omg.CORBA.ServerRequest request) { // Ensure that the operation name is correct
    System.out.println("invocato metodo " + request.operation() + " in AccounManagerImpl");
    Float balance;
    String name = new String(_object_id());

    if (request.operation().equals("open")) {
      org.omg.CORBA.NVList params = orb.create_list(1);
      org.omg.CORBA.Any any = orb.create_any();
      any.insert_string(new String(""));
      params.add_value("nomeFile", any, org.omg.CORBA.ARG_IN.value);
      request.arguments(params);
      try {
        name = params.item(0).value().extract_string();
      } catch (Exception e) {
        System.out.println("ERRORE:");
        e.printStackTrace();
      }
      // Invoke the actual implementation and fill out the result
      org.omg.CORBA.Object account = open(name);
      org.omg.CORBA.Any result = orb.create_any();
      result.insert_Object(account);
      request.set_result(result);
    } else {
      System.out.println("Errore nell'ivocazione dinamica del metodo open");
      throw new org.omg.CORBA.BAD_PARAM();
    }
  }
  public NotificationTestCaseSetup() throws Exception {
    ifrServerSetup =
        new IFRServerSetup(
            TestUtils.testHome() + "/src/test/idl/TypedNotification.idl", null, null);

    ORBSetUp();

    serverORB = ORB.init(new String[0], orbProps);

    POAHelper.narrow(serverORB.resolve_initial_references("RootPOA")).the_POAManager().activate();

    container_ = PicoContainerFactory.createRootContainer((org.jacorb.orb.ORB) serverORB);
    container_.unregisterComponent(Repository.class);
    container_.registerComponent(
        new AbstractComponentAdapter(Repository.class, Repository.class) {

          public Object getComponentInstance(PicoContainer picocontainer)
              throws PicoInitializationException, PicoIntrospectionException {
            try {
              return getRepository();
            } catch (Exception e) {
              throw new RuntimeException(e);
            }
          }

          public void verify(PicoContainer picocontainer) throws PicoIntrospectionException {}
        });

    testUtils_ = new NotificationTestUtils(getServerORB());

    POAHelper.narrow(orb.resolve_initial_references("RootPOA")).the_POAManager().activate();
  }
  public static void main(String[] args) {
    try {
      String tableID = "Test-Tafel2";
      ORB _orb;
      Properties props = new Properties();

      props.put("org.omg.CORBA.ORBInitialPort", "1050");
      props.put("org.omg.CORBA.ORBInitialHost", "192.168.2.20");

      _orb = ORB.init(new String[0], props);

      org.omg.CORBA.Object objRef = _orb.resolve_initial_references("NameService");
      NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);

      BoardService boardServiceObj =
          (BoardService) BoardServiceHelper.narrow(ncRef.resolve_str(tableID + "/BoardService"));

      User _user1 = new User("Yumo");
      boardServiceObj.sendMessage(
          _user1,
          new Message("Hallo Test-Tafel no. 1", _user1.name, new Date().toString()),
          tableID);

    } catch (InvalidName ex) {
      Logger.getLogger(BoardServiceTestbench.class.getName()).log(Level.SEVERE, null, ex);
    } catch (NotFound ex) {
      Logger.getLogger(BoardServiceTestbench.class.getName()).log(Level.SEVERE, null, ex);
    } catch (CannotProceed ex) {
      Logger.getLogger(BoardServiceTestbench.class.getName()).log(Level.SEVERE, null, ex);
    } catch (org.omg.CosNaming.NamingContextPackage.InvalidName ex) {
      Logger.getLogger(BoardServiceTestbench.class.getName()).log(Level.SEVERE, null, ex);
    } catch (UnknownUser ex) {
      Logger.getLogger(BoardServiceTestbench.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
Пример #6
0
  public void run() {

    try {
      ORB orb = ORB.init(args, null);
      // get reference to rootpoa & activate the POAManager
      POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
      poa.the_POAManager().activate();

      // get the root naming context
      org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
      // Use NamingContextExt which is part of the Interoperable
      // Naming Service (INS) specification.
      NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
      DomainParticipantFactoryImpl impl = new DomainParticipantFactoryImpl(orb, poa);

      // get object reference from the servant (and implicitly register
      // it)
      org.omg.CORBA.Object oref = poa.servant_to_reference(impl);
      DomainParticipantFactory ref = DomainParticipantFactoryHelper.narrow(oref);

      if (ncRef != null) {
        // bind the Object Reference in Naming
        NameComponent path[] = ncRef.to_name("DomainParticipantFactory");
        ncRef.rebind(path, ref);
      }
      System.out.println("Server ready and waiting ...");
      orb.run();
    } catch (Exception e) {
      System.out.println("e" + e);
      e.printStackTrace();
    }
  }
Пример #7
0
  public static void main(String[] args) {
    try {
      // init ORB
      ORB orb = ORB.init(args, null);

      // init POA
      POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));

      poa.the_POAManager().activate();

      // create a Adder object
      AdderImpl adderImpl = new AdderImpl();

      // create the object reference
      org.omg.CORBA.Object adderRef = poa.servant_to_reference(adderImpl);

      org.omg.CORBA.Object nsObject = orb.resolve_initial_references("NameService");
      NamingContextExt nc = NamingContextExtHelper.narrow(nsObject);

      nc.rebind(nc.to_name("Adder"), adderRef);

      // wait for requests
      orb.run();
    } catch (Exception e) {
      System.out.println(e);
    }
  }
Пример #8
0
  public CryoBay reconnectServer(ORB o, ReconnectThread rct) {

    BufferedReader reader;
    File file;
    ORB orb;
    org.omg.CORBA.Object obj;

    orb = o;

    obj = null;
    cryoB = null;

    try {
      // instantiate ModuleAccessor
      file = new File("/vnmr/acqqueue/cryoBay.CORBAref");
      if (file.exists()) {
        reader = new BufferedReader(new FileReader(file));
        obj = orb.string_to_object(reader.readLine());
      }

      if (obj != null) {
        cryoB = CryoBayHelper.narrow(obj);
      }

      if (cryoB != null) {
        if (!(cryoB._non_existent())) {
          // System.out.println("reconnected!!!!");
          rct.reconnected = true;
        }
      }
    } catch (Exception e) {
      // System.out.println("Got error: " + e);
    }
    return cryoB;
  }
Пример #9
0
  public static void main(String[] args) {
    java.util.Properties props = new Properties();
    props.putAll(System.getProperties());
    props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
    props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");

    int status = 0;
    ORB orb = null;

    try {
      orb = ORB.init(args, props);
      status = run(orb, false, args);
    } catch (Exception ex) {
      ex.printStackTrace();
      status = 1;
    }

    if (orb != null) {
      try {
        orb.destroy();
      } catch (Exception ex) {
        ex.printStackTrace();
        status = 1;
      }
    }

    System.exit(status);
  }
Пример #10
0
  public KerberosServer(String[] args) {
    try {
      // initialize the ORB and POA.
      orb = ORB.init(args, null);
      POA rootPOA = (POA) orb.resolve_initial_references("RootPOA");
      org.omg.CORBA.Policy[] policies = new org.omg.CORBA.Policy[3];
      policies[0] = rootPOA.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID);
      policies[1] = rootPOA.create_lifespan_policy(LifespanPolicyValue.PERSISTENT);
      Any sasAny = orb.create_any();
      SASPolicyValuesHelper.insert(
          sasAny,
          new SASPolicyValues(EstablishTrustInClient.value, EstablishTrustInClient.value, true));
      policies[2] = orb.create_policy(SAS_POLICY_TYPE.value, sasAny);
      POA securePOA = rootPOA.create_POA("SecurePOA", rootPOA.the_POAManager(), policies);
      rootPOA.the_POAManager().activate();

      // create object and write out IOR
      securePOA.activate_object_with_id("SecureObject".getBytes(), this);
      org.omg.CORBA.Object demo = securePOA.servant_to_reference(this);
      PrintWriter pw = new PrintWriter(new FileWriter(args[0]));
      pw.println(orb.object_to_string(demo));
      pw.flush();
      pw.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Пример #11
0
  public void init() {
    add(intitule);
    add(texte);
    add(bouton);
    bouton.addActionListener(this);

    try {
      ORB orb = ORB.init(this, null);
      FileReader file = new FileReader(iorfile.value);
      BufferedReader in = new BufferedReader(file);
      String ior = in.readLine();
      file.close();
      org.omg.CORBA.Object obj = orb.string_to_object(ior);
      annuaire = AnnuaireHelper.narrow(obj);

    } catch (org.omg.CORBA.SystemException ex) {
      System.err.println("Error");
      ex.printStackTrace();
    } catch (FileNotFoundException fnfe) {
      System.err.println(fnfe.getMessage());
    } catch (IOException io) {
      System.err.println(io.getMessage());
    } catch (Exception e) {
      System.err.println(e.getMessage());
    }
  }
Пример #12
0
 /*    */ public static synchronized TypeCode type() /*    */ {
   /* 32 */ if (__typeCode == null)
   /*    */ {
     /* 34 */ synchronized (TypeCode.class)
     /*    */ {
       /* 36 */ if (__typeCode == null)
       /*    */ {
         /* 38 */ if (__active)
         /*    */ {
           /* 40 */ return ORB.init().create_recursive_tc(_id);
           /*    */ }
         /* 42 */ __active = true;
         /* 43 */ StructMember[] arrayOfStructMember = new StructMember[1];
         /* 44 */ TypeCode localTypeCode = null;
         /* 45 */ localTypeCode = ORB.init().create_string_tc(0);
         /* 46 */ arrayOfStructMember[0] = new StructMember("name", localTypeCode, null);
         /*    */
         /* 50 */ __typeCode =
             ORB.init().create_exception_tc(id(), "DuplicateName", arrayOfStructMember);
         /* 51 */ __active = false;
         /*    */ }
       /*    */ }
     /*    */ }
   /* 55 */ return __typeCode;
   /*    */ }
 /** Create the ObjectNotActive typecode (empty structure, named "ObjectNotActive"). */
 public static TypeCode type() {
   if (typeCode == null) {
     ORB orb = ORB.init();
     StructMember[] members = new StructMember[0];
     typeCode = orb.create_exception_tc(id(), "ObjectNotActive", members);
   }
   return typeCode;
 }
 /*     */ public static synchronized TypeCode type() /*     */ {
   /*  65 */ if (__typeCode == null)
   /*     */ {
     /*  67 */ __typeCode = ValueMemberHelper.type();
     /*  68 */ __typeCode = ORB.init().create_sequence_tc(0, __typeCode);
     /*  69 */ __typeCode = ORB.init().create_alias_tc(id(), "ValueMemberSeq", __typeCode);
     /*     */ }
   /*  71 */ return __typeCode;
   /*     */ }
Пример #15
0
  /**
   * Create the UnknownUserException typecode (structure, named "UnknownUserException", containing a
   * single field of type {@link Any}, named "except".
   */
  public static TypeCode type() {
    ORB orb = OrbRestricted.Singleton;
    StructMember[] members = new StructMember[1];

    TypeCode field;

    field = orb.get_primitive_tc(TCKind.tk_any);
    members[0] = new StructMember("except", field, null);
    return orb.create_exception_tc(id(), "UnknownUserException", members);
  }
Пример #16
0
  public static void main(String args[]) {
    if (args.length == 0) {
      System.out.println("Koordinator Namen eingeben...");
    } else {

      try {
        // ORB Eigenschaften setzen
        Properties props = new Properties();
        props.put("org.omg.CORBA.ORBInitialPort", "1050");
        props.put("org.omg.CORBA.ORBInitialHost", "localhost");
        orb = ORB.init(args, props);

        // Referenz von rootPOA holen und POA Manager aktivieren
        POA rootPoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
        rootPoa.the_POAManager().activate();

        // NamingContext besorgen
        NamingContextExt nc =
            NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService"));

        // Objektreferenz mit Namen "koordinator" besorgen
        org.omg.CORBA.Object obj = nc.resolve_str(args[1]);

        // Referenz fuer den Servant besorgen
        ggt.Koordinator koord = KoordinatorHelper.narrow(obj);

        // Servant erzeugen
        StarterImpl starter = new StarterImpl(args[0], koord, rootPoa);

        // Referenz fuer den Servant besorgen
        org.omg.CORBA.Object ref = rootPoa.servant_to_reference(starter);

        // Downcast Corba-Objekt -> koordinator
        ggt.Starter href = StarterHelper.narrow(ref);

        // starter bei koordinator anmelden
        koord.activateStarter(href, args[0]);

        // binde die Object Reference an einen Namen
        String name = args[0];
        NameComponent path[] = nc.to_name(name);
        nc.rebind(path, href);
        System.out.println("Koordinator laeuft ...");

        // Orb starten und auf Clients warten
        orb.run();
      } catch (Exception e) {
        System.err.println("Fehler: " + e);
        e.printStackTrace(System.out);
      }
      System.out.println("BankServer Exit");
    }
  }
Пример #17
0
 @Override
 public void contextDestroyed(ServletContextEvent sce) {
   log.info("Shutting down the ORB.");
   ORB orb = (ORB) sce.getServletContext().getAttribute("ORB");
   orb.shutdown(true);
   OrbRunner orbRunner = (OrbRunner) sce.getServletContext().getAttribute("ORBThread");
   try {
     orbRunner.join();
   } catch (InterruptedException ex) {
     log.warn("Interrupted while attempting to join() with the orb.run() thread.");
   }
   log.info("ORB shutdown complete.");
 }
  protected void startService() throws Exception {
    Context ctx;
    ORB orb;
    POA rootPOA;

    try {
      ctx = new InitialContext();
    } catch (NamingException e) {
      throw new RuntimeException("Cannot get intial JNDI context: " + e);
    }
    try {
      orb = (ORB) ctx.lookup("java:/" + CorbaORBService.ORB_NAME);
    } catch (NamingException e) {
      throw new RuntimeException("Cannot lookup java:/" + CorbaORBService.ORB_NAME + ": " + e);
    }
    try {
      rootPOA = (POA) ctx.lookup("java:/" + CorbaORBService.POA_NAME);
    } catch (NamingException e) {
      throw new RuntimeException("Cannot lookup java:/" + CorbaORBService.POA_NAME + ": " + e);
    }

    // Create the naming server POA as a child of the root POA
    Policy[] policies = new Policy[2];
    policies[0] = rootPOA.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID);
    policies[1] = rootPOA.create_lifespan_policy(LifespanPolicyValue.PERSISTENT);
    namingPOA = rootPOA.create_POA("Naming", null, policies);
    namingPOA.the_POAManager().activate();

    // initialize the static naming service variables.
    JBossNamingContextImpl.init(orb, rootPOA);

    // create and initialize the root context instance according to the configuration.
    JBossNamingContextImpl ns = new JBossNamingContextImpl();
    Configuration configuration = ((org.jacorb.orb.ORB) orb).getConfiguration();
    boolean doPurge = configuration.getAttribute("jacorb.naming.purge", "off").equals("on");
    boolean noPing = configuration.getAttribute("jacorb.naming.noping", "off").equals("on");
    ns.init(namingPOA, doPurge, noPing);

    // create and activate the root context.
    byte[] rootContextId = "root".getBytes();
    namingPOA.activate_object_with_id(rootContextId, ns);
    namingService =
        NamingContextExtHelper.narrow(
            namingPOA.create_reference_with_id(
                rootContextId, "IDL:omg.org/CosNaming/NamingContextExt:1.0"));

    // bind the root context to JNDI.
    bind(NAMING_NAME, "org.omg.CosNaming.NamingContextExt");
    getLog().info("CORBA Naming Started");
    getLog().debug("Naming: [" + orb.object_to_string(namingService) + "]");
  }
Пример #19
0
  /**
   * Overrides readObject in Serializable.
   *
   * @param in the {@code InputStream} used to read the objects.
   * @throws Exception if an error occurs while reading the objects from the stream.
   */
  private void readObject(ObjectInputStream in) throws Exception {
    in.defaultReadObject();

    /** Recreate tables. For serialization, object references have been transformed into strings */
    for (Name key : this.contexts.keySet()) {
      String ref = (String) this.contexts.remove(key);
      this.contexts.put(key, orb.string_to_object(ref));
    }

    for (Name key : this.names.keySet()) {
      String ref = (String) this.names.remove(key);
      this.names.put(key, orb.string_to_object(ref));
    }
  }
Пример #20
0
  // Set up the client
  private void onConnectClicked() {
    // Create the arguments array
    String args[] = {
      "-ORBInitialHost", serverAddressField.getText(), "-ORBInitialPort", serverPortField.getText()
    };

    try {
      // create and initialize the ORB
      ORB orb = ORB.init(args, null);

      // get the root naming context
      org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");

      // Use NamingContextExt instead of NamingContext. This is
      // part of the Interoperable naming Service.
      ncRef = NamingContextExtHelper.narrow(objRef);

      // resolve the Object Reference in Naming
      String name = "AuctionFactory";
      auctionFactoryImpl = AuctionFactoryHelper.narrow(ncRef.resolve_str(name));

      appletDisplay("Connected to server");

      // Activate the login functionality
      btnLogIn.setEnabled(true);
      usernameField.setEnabled(true);
      passwordField.setEnabled(true);

    } catch (Exception e) {
      appletDisplay("Unable to connect to server");
      System.out.println("ERROR : " + e);
      e.printStackTrace(System.out);

      // Deactivate functionality
      btnLogIn.setEnabled(false);
      usernameField.setEnabled(false);
      passwordField.setEnabled(false);
      btnRefresh.setEnabled(false);
      sellList.setEnabled(false);
      bidList.setEnabled(false);
      btnCreateNewAuction.setEnabled(false);
      txtDescription.setEnabled(false);
      txtStartingPrice.setEnabled(false);
      btnSellItem.setEnabled(false);
      btnBid.setEnabled(false);
      txtBidPrice.setEnabled(false);
      loggedIn = false;
    }
  }
Пример #21
0
  public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) {
    int serverId = illegalServerId;

    try {
      // determine the server id
      if (cmdArgs.length == 2)
        if (cmdArgs[0].equals("-serverid")) serverId = (Integer.valueOf(cmdArgs[1])).intValue();
        else if (cmdArgs[0].equals("-applicationName"))
          serverId = ServerTool.getServerIdForAlias(orb, cmdArgs[1]);

      if (serverId == illegalServerId) return parseError;

      // startup the server
      Activator activator =
          ActivatorHelper.narrow(
              orb.resolve_initial_references(ORBConstants.SERVER_ACTIVATOR_NAME));
      activator.activate(serverId);

      out.println(CorbaResourceUtil.getText("servertool.startserver2"));
    } catch (ServerNotRegistered ex) {
      out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
    } catch (ServerAlreadyActive ex) {
      out.println(CorbaResourceUtil.getText("servertool.serverup"));
    } catch (ServerHeldDown ex) {
      out.println(CorbaResourceUtil.getText("servertool.helddown"));
    } catch (Exception ex) {
      ex.printStackTrace();
    }
    return commandDone;
  }
Пример #22
0
  public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) {
    if ((cmdArgs.length == 2) && cmdArgs[0].equals("-applicationName")) {
      String str = (String) cmdArgs[1];

      try {
        Repository repository =
            RepositoryHelper.narrow(
                orb.resolve_initial_references(ORBConstants.SERVER_REPOSITORY_NAME));

        try {
          int result = repository.getServerID(str);
          out.println();
          out.println(
              CorbaResourceUtil.getText("servertool.getserverid2", str, Integer.toString(result)));
          out.println();
        } catch (ServerNotRegistered e) {
          out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
        }
      } catch (Exception ex) {
        ex.printStackTrace();
      }

      return commandDone;
    } else return parseError;
  }
Пример #23
0
 public static void connect(Object stub, ORB orb) throws java.rmi.RemoteException {
   if (stub instanceof DynamicStub)
     ((DynamicStub) stub).connect((org.jboss.com.sun.corba.se.spi.orb.ORB) orb);
   else if (stub instanceof javax.rmi.CORBA.Stub) ((javax.rmi.CORBA.Stub) stub).connect(orb);
   else if (stub instanceof ObjectImpl) orb.connect((org.omg.CORBA.Object) stub);
   else throw wrapper.connectRequiresStub();
 }
Пример #24
0
  /**
   * Return a top-level {@code IOP:TaggedComponent} to be stuffed into an IOR, containing a {@code
   * CSIIOP}. {@code CompoundSecMechList}, tagged as {@code TAG_CSI_SEC_MECH_LIST}. Only one such
   * component can exist inside an IOR.
   *
   * <p>Should be called with non-null metadata, in which case we probably don't want to include
   * security info in the IOR.
   *
   * @param metadata the metadata object that contains the CSIv2 security configuration info.
   * @param codec the {@code Codec} used to encode the CSIv2 security component.
   * @param sslPort an {@code int} representing the SSL port.
   * @param orb a reference to the running {@code ORB}.
   * @return a {@code TaggedComponent} representing the encoded CSIv2 security component.
   */
  public static TaggedComponent createSecurityTaggedComponent(
      IORSecurityConfigMetaData metadata, Codec codec, int sslPort, ORB orb) {
    if (metadata == null) {
      JacORBLogger.ROOT_LOGGER.createSecurityTaggedComponentWithNullMetaData();
      return null;
    }

    TaggedComponent tc;

    // get the the supported security mechanisms.
    CompoundSecMech[] mechList = createCompoundSecMechanisms(metadata, codec, sslPort, orb);

    // the above is wrapped into a CSIIOP.CompoundSecMechList structure, which is NOT a
    // CompoundSecMech[].
    // we don't support stateful/reusable security contexts (false).
    CompoundSecMechList csmList = new CompoundSecMechList(false, mechList);
    // finally, the CompoundSecMechList must be encoded as a TaggedComponent
    try {
      Any any = orb.create_any();
      CompoundSecMechListHelper.insert(any, csmList);
      byte[] b = codec.encode_value(any);
      tc = new TaggedComponent(TAG_CSI_SEC_MECH_LIST.value, b);
    } catch (InvalidTypeForEncoding e) {
      throw JacORBLogger.ROOT_LOGGER.unexpectedException(e);
    }
    return tc;
  }
  static {
    orb = ORB.init(new String[0], null);
    System.setProperty(
        "javax.rmi.CORBA.PortableRemoteObjectClass",
        PortableRemoteObjectDelegateImpl.class.getName());
    PortableRemoteObjectDelegateImpl.setORB(orb);

    try {
      POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
      poa.the_POAManager().activate();
    } catch (InvalidName e) {
      initException = e;
    } catch (AdapterInactive e) {
      initException = e;
    }
  }
 /*    */ public static synchronized TypeCode type() /*    */ {
   /* 31 */ if (__typeCode == null)
   /*    */ {
     /* 33 */ __typeCode = ORB.init().create_interface_tc(id(), "ServerManager");
     /*    */ }
   /* 35 */ return __typeCode;
   /*    */ }
Пример #27
0
 public MasterServant(MasterComponent comp) {
   String[] args = new String[1];
   args[0] = "inicio";
   orb = ORB.init(args, null);
   num_partitions = 0;
   myComp = comp;
 }
Пример #28
0
  public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) {

    int serverId = illegalServerId;

    try {
      if (cmdArgs.length == 2) {
        if (cmdArgs[0].equals("-serverid")) serverId = (Integer.valueOf(cmdArgs[1])).intValue();
        else if (cmdArgs[0].equals("-applicationName"))
          serverId = ServerTool.getServerIdForAlias(orb, cmdArgs[1]);
      }

      // the server id has to be specified
      if (serverId == illegalServerId) return parseError;
      // activate the server
      Activator activator =
          ActivatorHelper.narrow(
              orb.resolve_initial_references(ORBConstants.SERVER_ACTIVATOR_NAME));

      String[] orbList = activator.getORBNames(serverId);

      out.println(CorbaResourceUtil.getText("servertool.orbidmap2"));

      for (int i = 0; i < orbList.length; i++) {
        out.println("\t " + orbList[i]);
      }
    } catch (ServerNotRegistered ex) {
      out.println("\tno such server found.");
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    return commandDone;
  }
 /** Create the type code for this exception. */
 public static TypeCode type() {
   if (typeCode == null) {
     if (typeCode == null)
       typeCode = ORB.init().create_struct_tc(id(), "InvalidName", new StructMember[0]);
   }
   return typeCode;
 }
Пример #30
0
  /**
   * Overrides writeObject in Serializable.
   *
   * @param out the {@code OutputStream} where the objects will be written.
   * @throws IOException if an error occurs while writing the objects to the stream.
   */
  private void writeObject(java.io.ObjectOutputStream out) throws IOException {
    /*
     * For serialization, object references are transformed into strings
     */
    for (Name key : this.contexts.keySet()) {
      org.omg.CORBA.Object o = (org.omg.CORBA.Object) this.contexts.remove(key);
      this.contexts.put(key, orb.object_to_string(o));
    }

    for (Name key : this.names.keySet()) {
      org.omg.CORBA.Object o = (org.omg.CORBA.Object) this.names.remove(key);
      this.names.put(key, orb.object_to_string(o));
    }

    out.defaultWriteObject();
  }