Search in sources :

Example 1 with AdapterNonExistent

use of org.omg.PortableServer.POAPackage.AdapterNonExistent in project ACS by ACS-Community.

the class AlarmSystemContainerServices method getPOAForOffshoots.

public POA getPOAForOffshoots(POA componentPOA) throws AcsJContainerEx, AcsJUnexpectedExceptionEx {
    final String offshootPoaName = "offshootPoa";
    POA offshootPoa = null;
    synchronized (componentPOA) {
        try {
            // can we reuse it?
            offshootPoa = componentPOA.find_POA(offshootPoaName, false);
        } catch (AdapterNonExistent e) {
            logger.finest("will have to create offshoot POA");
            if (m_offshootPolicies == null) {
                m_offshootPolicies = new Policy[4];
                m_offshootPolicies[0] = componentPOA.create_id_assignment_policy(IdAssignmentPolicyValue.SYSTEM_ID);
                m_offshootPolicies[1] = componentPOA.create_lifespan_policy(LifespanPolicyValue.TRANSIENT);
                m_offshootPolicies[2] = componentPOA.create_request_processing_policy(RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY);
                m_offshootPolicies[3] = componentPOA.create_servant_retention_policy(ServantRetentionPolicyValue.RETAIN);
            }
            try {
                offshootPoa = componentPOA.create_POA(offshootPoaName, alSysCorbaServer.getRootPOA().the_POAManager(), m_offshootPolicies);
                logger.finest("successfully created offshoot POA");
            } catch (InvalidPolicy ex) {
                AcsJContainerEx ex2 = new AcsJContainerEx(ex);
                ex2.setContextInfo("Attempted to create offshoot POA with invalid policies.");
                throw ex2;
            } catch (AdapterAlreadyExists ex) {
                // we sync on componentPOA, so this should never happen
                throw new AcsJUnexpectedExceptionEx(ex);
            }
        }
    }
    return offshootPoa;
}
Also used : Policy(org.omg.CORBA.Policy) InvalidPolicy(org.omg.PortableServer.POAPackage.InvalidPolicy) AcsJContainerEx(alma.JavaContainerError.wrappers.AcsJContainerEx) POA(org.omg.PortableServer.POA) InvalidPolicy(org.omg.PortableServer.POAPackage.InvalidPolicy) AdapterAlreadyExists(org.omg.PortableServer.POAPackage.AdapterAlreadyExists) AcsJUnexpectedExceptionEx(alma.ACSErrTypeCommon.wrappers.AcsJUnexpectedExceptionEx) AdapterNonExistent(org.omg.PortableServer.POAPackage.AdapterNonExistent)

Example 2 with AdapterNonExistent

use of org.omg.PortableServer.POAPackage.AdapterNonExistent in project ACS by ACS-Community.

the class ManagerContainerServices method checkOffShootPOA.

/**
	 * Creates the shared offshoot poa on demand 
	 */
public void checkOffShootPOA() throws AcsJContainerEx, AcsJUnexpectedExceptionEx {
    final String offshootPoaName = "offshootPoa";
    synchronized (clientPOA) {
        try {
            // can we reuse it?
            offshootPoa = clientPOA.find_POA(offshootPoaName, false);
        } catch (AdapterNonExistent e) {
            logger.finest("will have to create offshoot POA");
            if (offshootPolicies == null) {
                offshootPolicies = new Policy[4];
                offshootPolicies[0] = clientPOA.create_id_assignment_policy(IdAssignmentPolicyValue.SYSTEM_ID);
                offshootPolicies[1] = clientPOA.create_lifespan_policy(LifespanPolicyValue.TRANSIENT);
                offshootPolicies[2] = clientPOA.create_request_processing_policy(RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY);
                offshootPolicies[3] = clientPOA.create_servant_retention_policy(ServantRetentionPolicyValue.RETAIN);
            }
            try {
                offshootPoa = clientPOA.create_POA(offshootPoaName, clientPOA.the_POAManager(), offshootPolicies);
                logger.finest("successfully created offshoot POA");
            } catch (InvalidPolicy ex) {
                AcsJContainerEx ex2 = new AcsJContainerEx(ex);
                ex2.setContextInfo("Attempted to create offshoot POA with invalid policies.");
                throw ex2;
            } catch (AdapterAlreadyExists ex) {
                // we sync on componentPOA, so this should never happen
                throw new AcsJUnexpectedExceptionEx(ex);
            }
        }
    }
}
Also used : Policy(org.omg.CORBA.Policy) InvalidPolicy(org.omg.PortableServer.POAPackage.InvalidPolicy) AcsJContainerEx(alma.JavaContainerError.wrappers.AcsJContainerEx) InvalidPolicy(org.omg.PortableServer.POAPackage.InvalidPolicy) AdapterAlreadyExists(org.omg.PortableServer.POAPackage.AdapterAlreadyExists) AcsJUnexpectedExceptionEx(alma.ACSErrTypeCommon.wrappers.AcsJUnexpectedExceptionEx) AdapterNonExistent(org.omg.PortableServer.POAPackage.AdapterNonExistent)

Example 3 with AdapterNonExistent

use of org.omg.PortableServer.POAPackage.AdapterNonExistent in project ACS by ACS-Community.

the class AcsCorba method getPOAForOffshoots.

/**
	 * Creates (or reuses) the non-persistent POA for offshoot objects as a child of the given POA.
	 * In spite of the suggestive name 'componentPOA', this POA can actually be any kind of POA,
	 * so that also client application can use the offshoot mechanism. 
	 * <p>
	 * This method is synchronized inside to avoid race conditions between several offshoot POA creation/retrievals,
	 * where otherwise the POA would fail to be created even though first it was not found for reuse.
	 * 
	 * @param componentPOA  the POA of the component that owns the offshoot object;
	 * 							 will become the parent of the offshoot POA.
	 * @return POA  non-persistent POA for offshoot objects for the current component.
	 * 
	 * @throws AcsJContainerServicesEx
	 */
public POA getPOAForOffshoots(POA componentPOA) throws AcsJContainerEx, AcsJUnexpectedExceptionEx {
    final String offshootPoaName = "offshootPoa";
    POA offshootPoa = null;
    synchronized (componentPOA) {
        try {
            // can we reuse it? 
            offshootPoa = componentPOA.find_POA(offshootPoaName, false);
        } catch (AdapterNonExistent e) {
            m_logger.finest("will have to create offshoot POA");
            if (m_offshootPolicies == null) {
                m_offshootPolicies = new Policy[4];
                m_offshootPolicies[0] = componentPOA.create_id_assignment_policy(IdAssignmentPolicyValue.SYSTEM_ID);
                m_offshootPolicies[1] = componentPOA.create_lifespan_policy(LifespanPolicyValue.TRANSIENT);
                m_offshootPolicies[2] = componentPOA.create_request_processing_policy(RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY);
                m_offshootPolicies[3] = componentPOA.create_servant_retention_policy(ServantRetentionPolicyValue.RETAIN);
            }
            try {
                offshootPoa = componentPOA.create_POA(offshootPoaName, sharedPoaManager, m_offshootPolicies);
                m_logger.finest("successfully created offshoot POA");
            } catch (InvalidPolicy ex) {
                AcsJContainerEx ex2 = new AcsJContainerEx(ex);
                ex2.setContextInfo("Attempted to create offshoot POA with invalid policies.");
                throw ex2;
            } catch (AdapterAlreadyExists ex) {
                // we sync on componentPOA, so this should never happen
                throw new AcsJUnexpectedExceptionEx(ex);
            }
        }
    }
    return offshootPoa;
}
Also used : Policy(org.omg.CORBA.Policy) InvalidPolicy(org.omg.PortableServer.POAPackage.InvalidPolicy) AcsJContainerEx(alma.JavaContainerError.wrappers.AcsJContainerEx) POA(org.omg.PortableServer.POA) InvalidPolicy(org.omg.PortableServer.POAPackage.InvalidPolicy) AdapterAlreadyExists(org.omg.PortableServer.POAPackage.AdapterAlreadyExists) AcsJUnexpectedExceptionEx(alma.ACSErrTypeCommon.wrappers.AcsJUnexpectedExceptionEx) AdapterNonExistent(org.omg.PortableServer.POAPackage.AdapterNonExistent)

Aggregations

AcsJUnexpectedExceptionEx (alma.ACSErrTypeCommon.wrappers.AcsJUnexpectedExceptionEx)3 AcsJContainerEx (alma.JavaContainerError.wrappers.AcsJContainerEx)3 Policy (org.omg.CORBA.Policy)3 AdapterAlreadyExists (org.omg.PortableServer.POAPackage.AdapterAlreadyExists)3 AdapterNonExistent (org.omg.PortableServer.POAPackage.AdapterNonExistent)3 InvalidPolicy (org.omg.PortableServer.POAPackage.InvalidPolicy)3 POA (org.omg.PortableServer.POA)2