EJBTargetKeyInfopublic class EJBTargetKeyInfo extends Object
Fields Summary |
---|
protected static final Logger | _logger | public static final int | EJBID_OFFSET | public static final int | INSTANCEKEYLEN_OFFSET | public static final int | INSTANCEKEY_OFFSET | public static final byte | HOME_KEY | private byte[] | oid | private long | containerId | private int | keyLength | private boolean | local | private Object | instanceKey | private boolean | validOid | private com.sun.ejb.base.sfsb.util.SimpleKeyGenerator | gen |
Constructors Summary |
---|
public EJBTargetKeyInfo(byte[] oid, boolean local)
this.oid = oid;
this.local = local;
this.instanceKey = gen.byteArrayToKey(oid, INSTANCEKEY_OFFSET, 20);
validate();
| public EJBTargetKeyInfo(org.omg.CORBA.Object effective_target)
try {
if (StubAdapter.isStub(effective_target)) {
if (StubAdapter.isLocal(effective_target)) {
this.local = true;
}
IOR ior = ((com.sun.corba.ee.spi.orb.ORB) ORBManager.getORB())
.getIOR(effective_target, false);
java.util.Iterator iter = ior.iterator();
if (iter.hasNext()) {
TaggedProfile profile = (TaggedProfile) iter.next();
ObjectKey objKey = profile.getObjectKey();
this.oid = objKey.getId().getId();
SimpleKeyGenerator gen = new SimpleKeyGenerator();
this.instanceKey = gen.byteArrayToKey(oid, INSTANCEKEY_OFFSET, 20);
validate();
}
}
} catch (Exception ex) {
_logger.log(Level.FINE,
"EJBTargetKeyInfo: Exception during extraction of instance key", ex);
}
|
Methods Summary |
---|
public long | getContainerId()
return this.containerId;
| public java.lang.Object | getInstanceKey()
return instanceKey;
| public static int | getInstanceKeyOffset()
return INSTANCEKEY_OFFSET;
| public int | getKeyLength()
return this.keyLength;
| public byte[] | getOid()
return oid;
| public boolean | isHomeOid()
return isValid() && (keyLength == 1) && (oid[INSTANCEKEY_OFFSET] == HOME_KEY);
| public boolean | isLocal()
return this.local;
| public boolean | isValid()
return this.validOid;
| public java.lang.String | toString()
StringBuilder bldr = new StringBuilder(validOid ? "valid" : "invalid");
bldr.append(" {").append(containerId).append(" : ")
.append(isHomeOid() ? "HOME" : "EJBO").append(" ==> ")
.append(instanceKey).append("}");
return bldr.toString();
| private void | validate()
if ((oid != null) && (oid.length > INSTANCEKEY_OFFSET)) {
this.containerId = Utility.bytesToLong(oid, EJBID_OFFSET);
this.keyLength = Utility.bytesToInt(oid, INSTANCEKEYLEN_OFFSET);
if (oid.length == keyLength + INSTANCEKEY_OFFSET) {
validOid = true;
} else {
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "[Invalid.1] oid.length: " + oid.length
+ "; keyLength: " + keyLength);
}
}
} else {
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "[Invalid.2] oid: " + oid + "; "
+ "oid.length: " + ((oid == null) ? -1 : oid.length));
}
}
|
|