Esempio n. 1
0
  @Override
  public void start(StartContext context) throws StartException {
    JacORBLogger.ROOT_LOGGER.debugServiceStartup(
        context.getController().getName().getCanonicalName());

    ORB orb = this.orbInjector.getOptionalValue();
    POA parentPOA = this.parentPOAInjector.getOptionalValue();

    // if an ORB has been injected, we will use the ORB.resolve_initial_references method to
    // instantiate the POA.
    if (orb != null) {
      try {
        this.poa = POAHelper.narrow(orb.resolve_initial_references(this.poaName));
      } catch (Exception e) {
        throw JacORBMessages.MESSAGES.errorResolvingInitRef(this.poaName, e);
      }
    }
    // if a parent POA has been injected, we use it to create the policies and then the POA itself.
    else if (parentPOA != null) {
      try {
        Policy[] poaPolicies = this.createPolicies(parentPOA);
        this.poa = parentPOA.create_POA(this.poaName, null, poaPolicies);
      } catch (Exception e) {
        throw JacORBMessages.MESSAGES.errorCreatingPOAFromParent(e);
      }
    } else {
      throw JacORBMessages.MESSAGES.invalidPOACreationArgs();
    }

    // check if the POA should be bound to JNDI under java:/jboss.
    if (this.bindingName != null) {
      CorbaServiceUtil.bindObject(context.getChildTarget(), this.bindingName, this.poa);
    }

    // activate the created POA.
    try {
      this.poa.the_POAManager().activate();
    } catch (Exception e) {
      throw JacORBMessages.MESSAGES.errorActivatingPOA(e);
    }
  }
Esempio n. 2
0
 @Override
 public void stop(StopContext context) {
   JacORBLogger.ROOT_LOGGER.debugServiceStop(context.getController().getName().getCanonicalName());
   // destroy the created POA.
   this.poa.destroy(false, false);
 }