Search in sources :

Example 1 with SystemKey

use of org.cristalise.kernel.common.SystemKey in project kernel by cristal-ise.

the class TraceableLocator method preinvoke.

/**
 ************************************************************************
 *
 *************************************************************************
 */
@Override
public org.omg.PortableServer.Servant preinvoke(byte[] oid, org.omg.PortableServer.POA poa, String operation, org.omg.PortableServer.ServantLocatorPackage.CookieHolder cookie) {
    ByteBuffer bb = ByteBuffer.wrap(oid);
    long msb = bb.getLong();
    long lsb = bb.getLong();
    ItemPath syskey = new ItemPath(new SystemKey(msb, lsb));
    Logger.msg(1, "===========================================================");
    Logger.msg(1, "Item called at " + new Timestamp(System.currentTimeMillis()) + ": " + operation + "(" + syskey + ").");
    try {
        return Gateway.getCorbaServer().getItem(syskey);
    } catch (ObjectNotFoundException ex) {
        Logger.error("ObjectNotFoundException::TraceableLocator::preinvoke() " + ex.toString());
        throw new org.omg.CORBA.OBJECT_NOT_EXIST();
    }
}
Also used : ObjectNotFoundException(org.cristalise.kernel.common.ObjectNotFoundException) ByteBuffer(java.nio.ByteBuffer) Timestamp(java.sql.Timestamp) SystemKey(org.cristalise.kernel.common.SystemKey) ItemPath(org.cristalise.kernel.lookup.ItemPath)

Example 2 with SystemKey

use of org.cristalise.kernel.common.SystemKey in project kernel by cristal-ise.

the class ActiveLocator method preinvoke.

/**
 ************************************************************************
 *
 *************************************************************************
 */
@Override
public org.omg.PortableServer.Servant preinvoke(byte[] oid, org.omg.PortableServer.POA poa, String operation, org.omg.PortableServer.ServantLocatorPackage.CookieHolder cookie) {
    try {
        ByteBuffer bb = ByteBuffer.wrap(oid);
        long msb = bb.getLong();
        long lsb = bb.getLong();
        AgentPath syskey = new AgentPath(new SystemKey(msb, lsb));
        Logger.msg(1, "===========================================================");
        Logger.msg(1, "Agent called at " + new Timestamp(System.currentTimeMillis()) + ": " + operation + "(" + syskey + ").");
        return Gateway.getCorbaServer().getAgent(syskey);
    } catch (ObjectNotFoundException ex) {
        Logger.error("ObjectNotFoundException::ActiveLocator::preinvoke() " + ex.toString());
        throw new org.omg.CORBA.OBJECT_NOT_EXIST();
    } catch (InvalidItemPathException ex) {
        Logger.error("InvalidItemPathException::ActiveLocator::preinvoke() " + ex.toString());
        throw new org.omg.CORBA.INV_OBJREF();
    }
}
Also used : InvalidItemPathException(org.cristalise.kernel.lookup.InvalidItemPathException) AgentPath(org.cristalise.kernel.lookup.AgentPath) ObjectNotFoundException(org.cristalise.kernel.common.ObjectNotFoundException) ByteBuffer(java.nio.ByteBuffer) Timestamp(java.sql.Timestamp) SystemKey(org.cristalise.kernel.common.SystemKey)

Aggregations

ByteBuffer (java.nio.ByteBuffer)2 Timestamp (java.sql.Timestamp)2 ObjectNotFoundException (org.cristalise.kernel.common.ObjectNotFoundException)2 SystemKey (org.cristalise.kernel.common.SystemKey)2 AgentPath (org.cristalise.kernel.lookup.AgentPath)1 InvalidItemPathException (org.cristalise.kernel.lookup.InvalidItemPathException)1 ItemPath (org.cristalise.kernel.lookup.ItemPath)1