コード例 #1
0
 public static SASCurrent unchecked_narrow(final Object obj) {
   if (obj == null) {
     return null;
   } else if (obj instanceof SASCurrent) {
     return (SASCurrent) obj;
   } else {
     throw JacORBMessages.MESSAGES.sasCurrentNarrowFailed();
   }
 }
コード例 #2
0
ファイル: CorbaPOAService.java プロジェクト: ksreen/jboss-as
  @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);
    }
  }