use of org.omg.CORBA.INV_POLICY in project Payara by payara.
the class IORInterceptorImpl method establish_components.
// org.omg.PortableInterceptors.IORInterceptorOperations implementation
public void establish_components(IORInfo info) {
// get the OTSPolicy and InvocationPolicy objects
OTSPolicy otsPolicy = null;
try {
otsPolicy = (OTSPolicy) info.get_effective_policy(OTS_POLICY_TYPE.value);
} catch (INV_POLICY e) {
// ignore. This implies an policy was not explicitly set.
// A default value will be used instead.
}
InvocationPolicy invPolicy = null;
try {
invPolicy = (InvocationPolicy) info.get_effective_policy(INVOCATION_POLICY_TYPE.value);
} catch (INV_POLICY e) {
// ignore. This implies an policy was not explicitly set.
// A default value will be used instead.
}
// get OTSPolicyValue and InvocationPolicyValue from policy objects.
// default value
short otsPolicyValue = FORBIDS.value;
// default value
short invPolicyValue = EITHER.value;
if (otsPolicy != null) {
otsPolicyValue = otsPolicy.value();
}
if (invPolicy != null) {
invPolicyValue = invPolicy.value();
}
// use codec to encode policy value into an CDR encapsulation.
Any otsAny = ORB.init().create_any();
Any invAny = ORB.init().create_any();
otsAny.insert_short(otsPolicyValue);
invAny.insert_short(invPolicyValue);
byte[] otsCompValue = null;
byte[] invCompValue = null;
try {
otsCompValue = this.codec.encode_value(otsAny);
invCompValue = this.codec.encode_value(invAny);
} catch (InvalidTypeForEncoding e) {
throw new INTERNAL();
}
// create IOR TaggedComponents for OTSPolicy and InvocationPolicy.
TaggedComponent otsComp = new TaggedComponent(TAG_OTS_POLICY.value, otsCompValue);
TaggedComponent invComp = new TaggedComponent(TAG_INV_POLICY.value, invCompValue);
// add ior components.
info.add_ior_component(otsComp);
info.add_ior_component(invComp);
}
use of org.omg.CORBA.INV_POLICY in project Payara by payara.
the class TxIORInterceptor method establish_components.
// Note: this is called for all remote refs created from this ORB,
// including EJBs and COSNaming objects.
public void establish_components(IORInfo iorInfo) {
try {
_logger.log(Level.FINE, "TxIORInterceptor.establish_components->:");
// Add OTS tagged components. These are always the same for all EJBs
OTSPolicy otsPolicy = null;
try {
otsPolicy = (OTSPolicy) iorInfo.get_effective_policy(habitat.getService(GlassFishORBHelper.class).getOTSPolicyType());
} catch (INV_POLICY ex) {
_logger.log(Level.FINE, "TxIORInterceptor.establish_components: OTSPolicy not present");
}
addOTSComponents(iorInfo, otsPolicy);
} catch (Exception e) {
_logger.log(Level.WARNING, "Exception in establish_components", e);
} finally {
_logger.log(Level.FINE, "TxIORInterceptor.establish_components<-:");
}
}
use of org.omg.CORBA.INV_POLICY in project Payara by payara.
the class CSIV2TaggedComponentInfo method getEjbDescriptor.
public EjbDescriptor getEjbDescriptor(IORInfo iorInfo) {
CSIv2Policy csiv2Policy = null;
try {
csiv2Policy = (CSIv2Policy) iorInfo.get_effective_policy(orbHelper.getCSIv2PolicyType());
} catch (INV_POLICY ex) {
logger.log(FINE, "CSIV2TaggedComponentInfo.getEjbDescriptor: CSIv2Policy not present");
}
// Add CSIv2 tagged component for this EJB type.
if (logger.isLoggable(FINE)) {
logger.log(FINE, "TxSecIORInterceptor.establish_components: CSIv2Policy: " + csiv2Policy);
}
EjbDescriptor ejbDesc = null;
if (csiv2Policy != null) {
ejbDesc = csiv2Policy.getEjbDescriptor();
}
return ejbDesc;
}
Aggregations