use of com.sun.corba.ee.spi.ior.IOR in project Payara by payara.
the class POAProtocolMgr method getObjectID.
@Override
public byte[] getObjectID(org.omg.CORBA.Object obj) {
IOR ior = ((com.sun.corba.ee.spi.orb.ORB) orb).getIOR(obj, false);
java.util.Iterator iter = ior.iterator();
byte[] oid = null;
if (iter.hasNext()) {
TaggedProfile profile = (TaggedProfile) iter.next();
ObjectKey objKey = profile.getObjectKey();
oid = objKey.getId().getId();
}
return oid;
}
use of com.sun.corba.ee.spi.ior.IOR in project Payara by payara.
the class POARemoteReferenceFactory method hasSameContainerID.
@Override
public boolean hasSameContainerID(org.omg.CORBA.Object obj) throws Exception {
boolean result = false;
try {
IOR ior = (orb).getIOR(obj, false);
java.util.Iterator iter = ior.iterator();
byte[] oid = null;
if (iter.hasNext()) {
TaggedProfile profile = (TaggedProfile) iter.next();
ObjectKey objKey = profile.getObjectKey();
oid = objKey.getId().getId();
}
if ((oid != null) && (oid.length > INSTANCEKEY_OFFSET)) {
long cid = Utility.bytesToLong(oid, EJBID_OFFSET);
// To be really sure that is indeed a ref generated
// by our container we do the following checks
int keyLen = Utility.bytesToInt(oid, INSTANCEKEYLEN_OFFSET);
if (oid.length == keyLen + INSTANCEKEY_OFFSET) {
result = (cid == ejbDescriptor.getUniqueId());
}
if (logger.isLoggable(Level.FINE)) {
StringBuilder sbuf = new StringBuilder();
sbuf.append("hasSameContainerID() result: ").append(result).append("; because ==> oid.length: ").append(oid.length).append("; instance-key-length: ").append(keyLen).append("; expected oid.length: ").append(keyLen).append("+").append(INSTANCEKEY_OFFSET).append("; myContainrID: ").append(ejbDescriptor.getUniqueId()).append("; obj.containerID: ").append(cid);
logger.log(Level.FINE, sbuf.toString());
}
} else {
if (logger.isLoggable(Level.FINE)) {
if (oid == null) {
logger.log(Level.FINE, "hasSameContainerID() failed because oid=null");
} else {
logger.log(Level.FINE, "hasSameContainerID() failed because oid.length= " + "{0}; but INSTANCE_KEY_OFFSET= {1}", new Object[] { oid.length, INSTANCEKEY_OFFSET });
}
}
}
} catch (Exception ex) {
logger.log(Level.FINE, "Exception while checking for same containerID", ex);
throw ex;
}
return result;
}
use of com.sun.corba.ee.spi.ior.IOR in project Payara by payara.
the class SecurityContextUtil method getSecurityContext.
/**
* This is called by the CSIv2 interceptor on the client before sending the IIOP message.
*
* @param the effective_target field of the PortableInterceptor ClientRequestInfo object.
* @return a SecurityContext which is marshalled into the IIOP msg by the CSIv2 interceptor.
*/
public SecurityContext getSecurityContext(org.omg.CORBA.Object effective_target) throws InvalidMechanismException, InvalidIdentityTokenException {
SecurityContext context = null;
assert (orbHelper != null);
IOR ior = ((com.sun.corba.ee.spi.orb.ORB) orbHelper.getORB()).getIOR(effective_target, false);
if (StubAdapter.isStub(effective_target)) {
if (StubAdapter.isLocal(effective_target)) {
// XXX: Workaround for non-null connection object ri for local invocation.
ConnectionExecutionContext.setClientThreadID(Thread.currentThread().getId());
return null;
}
}
try {
context = sms.selectSecurityContext(ior);
} catch (InvalidMechanismException ime) {
// let this pass ahead
_logger.log(Level.SEVERE, "iiop.invalidmechanism_exception", ime);
throw new InvalidMechanismException(ime.getMessage());
} catch (InvalidIdentityTokenException iite) {
_logger.log(Level.SEVERE, "iiop.invalididtoken_exception", iite);
throw new InvalidIdentityTokenException(iite.getMessage());
// let this pass ahead
} catch (SecurityMechanismException sme) {
_logger.log(Level.SEVERE, "iiop.secmechanism_exception", sme);
throw new RuntimeException(sme.getMessage());
}
return context;
}
Aggregations