/** * Returns an IR object describing the bean's remote interface. */ public org.omg.CORBA.Object _get_interface_def() { if (interfaceDef != null) return interfaceDef; else return super._get_interface_def(); }
public void unbind(final String name) throws Exception { final POA poa = transientPoaMap.remove(name); if (poa != null) { poa.the_POAManager().deactivate(false, true); poa.destroy(false, true); } }
public ReferenceFactory bind(final String name, final Servant servant) throws Exception { final POA poa = rootPOA.getValue().create_POA(name, null, transientPoaPolicies); transientPoaMap.put(name, poa); poa.set_servant(servant); poa.the_POAManager().activate(); return new PoaReferenceFactory(poa); // no servantName: in this case // name is the POA name }
this.poa = POAHelper.narrow(orb.resolve_initial_references(this.poaName)); } catch (Exception e) { throw IIOPLogger.ROOT_LOGGER.errorResolvingInitRef(this.poaName, e); try { Policy[] poaPolicies = this.createPolicies(parentPOA); this.poa = parentPOA.create_POA(this.poaName, null, poaPolicies); } catch (Exception e) { throw IIOPLogger.ROOT_LOGGER.errorCreatingPOAFromParent(e); this.poa.the_POAManager().activate(); } catch (Exception e) { throw IIOPLogger.ROOT_LOGGER.errorActivatingPOA(e);
policies.add(ZeroPortPolicy.getPolicy()); if (this.idAssignmentPolicyValue != null) policies.add(poa.create_id_assignment_policy(this.idAssignmentPolicyValue)); if (this.idUniquenessPolicyValue != null) policies.add(poa.create_id_uniqueness_policy(this.idUniquenessPolicyValue)); if (this.implicitActivationPolicyValue != null) policies.add(poa.create_implicit_activation_policy(this.implicitActivationPolicyValue)); if (this.lifespanPolicyValue != null) policies.add(poa.create_lifespan_policy(this.lifespanPolicyValue)); if (this.requestProcessingPolicyValue != null) policies.add(poa.create_request_processing_policy(this.requestProcessingPolicyValue)); if (this.servantRetentionPolicyValue != null) policies.add(poa.create_servant_retention_policy(this.servantRetentionPolicyValue)); if (this.threadPolicyValue != null) policies.add(poa.create_thread_policy(this.threadPolicyValue));
public synchronized void start(final StartContext startContext) throws StartException { transientPoaMap = Collections.synchronizedMap(new HashMap<String, POA>()); persistentPoaMap = Collections.synchronizedMap(new HashMap<String, POA>()); final POA rootPOA = this.rootPOA.getValue(); // Policies for per-servant transient POAs transientPoaPolicies = new Policy[]{rootPOA.create_lifespan_policy( LifespanPolicyValue.TRANSIENT), rootPOA.create_id_assignment_policy(IdAssignmentPolicyValue.SYSTEM_ID), rootPOA.create_servant_retention_policy(ServantRetentionPolicyValue.NON_RETAIN), rootPOA.create_request_processing_policy(RequestProcessingPolicyValue.USE_DEFAULT_SERVANT), rootPOA.create_id_uniqueness_policy( IdUniquenessPolicyValue.MULTIPLE_ID), }; // Policies for per-servant persistent POAs persistentPoaPolicies = new Policy[]{ rootPOA.create_lifespan_policy( LifespanPolicyValue.PERSISTENT), rootPOA.create_id_assignment_policy( IdAssignmentPolicyValue.USER_ID), rootPOA.create_servant_retention_policy( ServantRetentionPolicyValue.NON_RETAIN), rootPOA.create_request_processing_policy( RequestProcessingPolicyValue.USE_DEFAULT_SERVANT), rootPOA.create_id_uniqueness_policy( IdUniquenessPolicyValue.MULTIPLE_ID), }; // Create this POARegistry's ServantRegistry implementations registryWithTransientPOAPerServant = new ServantRegistryWithTransientPOAPerServant(); registryWithPersistentPOAPerServant = new ServantRegistryWithPersistentPOAPerServant(); }
public NamingContext new_context() { try { // create and initialize a new context. CorbaNamingContext newContextImpl = new CorbaNamingContext(); newContextImpl.init(this.poa, this.doPurge, this.noPing); // create the oid for the new context and activate it with the naming service POA. String oid = new String(this.poa.servant_to_id(this), StandardCharsets.UTF_8) + "/ctx" + (++this.childCount); this.poa.activate_object_with_id(oid.getBytes(StandardCharsets.UTF_8), newContextImpl); // add the newly-created context to the cache. contextImpls.put(oid, newContextImpl); return NamingContextExtHelper.narrow(this.poa.create_reference_with_id(oid.getBytes(StandardCharsets.UTF_8), "IDL:omg.org/CosNaming/NamingContextExt:1.0")); } catch (Exception e) { IIOPLogger.ROOT_LOGGER.failedToCreateNamingContext(e); return null; } }
public void destroy() { bindings = null; try { _poa().deactivate_object(_poa().servant_to_id(this)); } catch (UserException e) { throw IIOPLogger.ROOT_LOGGER.exceptionDestroingIterator(e.getMessage()); } }
/** * Unexport this object. */ public void shutdown() { POA poa = getPOA(); try { poa.deactivate_object(poa.reference_to_id(getReference())); } catch (UserException ex) { IIOPLogger.ROOT_LOGGER.warnCouldNotDeactivateIRObject(ex); } }
/** * Convert a servant to a reference. */ protected org.omg.CORBA.Object servantToReference(Servant servant) { byte[] id = getObjectId(); try { repository.poa.activate_object_with_id(id, servant); org.omg.CORBA.Object ref = repository.poa.id_to_reference(id); return ref; } catch (WrongPolicy ex) { IIOPLogger.ROOT_LOGGER.debug("Exception converting CORBA servant to reference", ex); } catch (ServantAlreadyActive ex) { IIOPLogger.ROOT_LOGGER.debug("Exception converting CORBA servant to reference", ex); } catch (ObjectAlreadyActive ex) { IIOPLogger.ROOT_LOGGER.debug("Exception converting CORBA servant to reference", ex); } catch (ObjectNotActive ex) { IIOPLogger.ROOT_LOGGER.debug("Exception converting CORBA servant to reference", ex); } return null; }
public org.omg.CORBA.Object createReference(final String interfId) throws Exception { final org.omg.CORBA.Object corbaRef = poa.create_reference_with_id(EMPTY_BYTES, interfId); if (policies != null) { return corbaRef._set_policy_override(policies, SetOverrideType.ADD_OVERRIDE); } else { return corbaRef; } }
public void shutdown() { // shutdown all anonymous IR objects in this IR for (long i = 1; i < nextPOAId; i++) { try { getPOA().deactivate_object(getAnonymousObjectId(i)); } catch (org.omg.CORBA.UserException ex) { IIOPLogger.ROOT_LOGGER.warnCouldNotDeactivateAnonIRObject(ex); } } // shutdown this IR's top-level container super.shutdown(); }
@Override public void stop(StopContext context) { if (IIOPLogger.ROOT_LOGGER.isDebugEnabled()) { IIOPLogger.ROOT_LOGGER.debugf("Stopping service %s", context.getController().getName().getCanonicalName()); } // destroy parent POAs, letting they destroy their children POAs in the process. if (this.poa.the_parent() == null) this.poa.destroy(false, true); }
/** * <p> * Obtains the OID of the specified CORBA object. * </p> * * @param object the CORBA object whose OID is to be extracted. * @return a {@code String} representing the object OID or null if the method is unable to obtain the object OID. */ private String getObjectOID(org.omg.CORBA.Object object) { String oid = null; try { byte[] oidBytes = this.poa.reference_to_id(object); if (oidBytes != null) oid = new String(oidBytes, StandardCharsets.UTF_8); } catch (Exception e) { IIOPLogger.ROOT_LOGGER.debug("Unable to obtain id from object", e); } return oid; }
private Object unmarshalIdentifier() throws IOException, ClassNotFoundException { final Object id; try { final byte[] idData = poaCurrent.get_object_id(); final Unmarshaller unmarshaller = factory.createUnmarshaller(configuration); unmarshaller.start(new InputStreamByteInput(new ByteArrayInputStream(idData))); id = unmarshaller.readObject(); unmarshaller.finish(); } catch (NoContext noContext) { throw new RuntimeException(noContext); } return id; }
public ReferenceFactory bind(final String name, final Servant servant) throws Exception { final POA poa = rootPOA.getValue().create_POA(name, null, persistentPoaPolicies); persistentPoaMap.put(name, poa); poa.set_servant(servant); poa.the_POAManager().activate(); return new PoaReferenceFactory(poa); // no servantName: in this case // name is the POA name }
public void unbind(final String name) throws Exception { final POA poa = persistentPoaMap.remove(name); if (poa != null) { poa.the_POAManager().deactivate(false, true); poa.destroy(false, true); } }
public org.omg.CORBA.Object createReferenceWithId(final byte[] id, final String interfId) throws Exception { final org.omg.CORBA.Object corbaRef = poa.create_reference_with_id(id, interfId); if (policies != null) { return corbaRef._set_policy_override(policies, SetOverrideType.ADD_OVERRIDE); } else { return corbaRef; } }
public ReferenceFactory bind(final String name, final Servant servant, final Policy[] policies) throws Exception { final Policy[] poaPolicies = concatPolicies(transientPoaPolicies, policies); final POA poa = rootPOA.getValue().create_POA(name, null, poaPolicies); transientPoaMap.put(name, poa); poa.set_servant(servant); poa.the_POAManager().activate(); return new PoaReferenceFactory(poa); // no servantName: in this case // name is the POA name }
public ReferenceFactory bind(final String name, final Servant servant, final Policy[] policies) throws Exception { final Policy[] poaPolicies = concatPolicies(persistentPoaPolicies, policies); final POA poa = rootPOA.getValue().create_POA(name, null, poaPolicies); persistentPoaMap.put(name, poa); poa.set_servant(servant); poa.the_POAManager().activate(); return new PoaReferenceFactory(poa); // no servantName: in this case // name is the POA name }