public function __wakeup()
 {
     $args = array($this->__serialID, java_get_lifetime());
     $this->__client = __javaproxy_Client_getClient();
     if ($this->__tempGlobalRef) {
         $this->__client->globalRef = $this->__tempGlobalRef;
     }
     $this->__tempGlobalRef = null;
     $this->__java = $this->__client->invokeMethod(0, "deserialize", $args);
 }
 public function __construct()
 {
     $this->__client = __javaproxy_Client_getClient();
     $args = func_get_args();
     $name = array_shift($args);
     if (is_array($name)) {
         $args = $name;
         $name = array_shift($args);
     }
     if (count($args) == 0) {
         parent::__construct($name);
     } else {
         parent::__construct($args[0]);
     }
     $delegate = $this->__delegate = $this->__client->createObject($name, $args);
     $this->__java = $delegate->__java;
     $this->__signature = $delegate->__signature;
     $this->__hasDeclaredExceptions = 'T';
 }
function java_closure_array($args)
{
    if (isset($args[2]) && (!$args[2] instanceof JavaType && !is_array($args[2]))) {
        throw new Exception\IllegalArgumentException($args[2]);
    }
    $client = __javaproxy_Client_getClient();
    $args[0] = isset($args[0]) ? $client->globalRef->add($args[0]) : 0;
    $client->protocol->invokeBegin(0, "makeClosure");
    $n = count($args);
    $client->protocol->writeULong($args[0]);
    for ($i = 1; $i < $n; $i++) {
        $client->writeArg($args[$i]);
    }
    $client->protocol->invokeEnd();
    $val = $client->getResult();
    return $val;
}
Example #4
0
 function java_exception()
 {
     $this->__client = __javaproxy_Client_getClient();
     $args = func_get_args();
     $name = array_shift($args);
     if (is_array($name)) {
         $args = $name;
         $name = array_shift($args);
     }
     $delegate = $this->__delegate = $this->__client->createObject($name, $args);
     $this->__java = $delegate->__java;
     $this->__signature = $delegate->__signature;
 }
Example #5
0
 public function __construct()
 {
     $client = $this->__client = __javaproxy_Client_getClient();
     $args = func_get_args();
     $name = array_shift($args);
     if (is_array($name)) {
         $args = $name;
         $name = array_shift($args);
     }
     $sig = "&{$this->__signature}@{$name}";
     $len = count($args);
     $args2 = array();
     for ($i = 0; $i < $len; $i++) {
         $val = $args[$i];
         switch (gettype($val)) {
             case 'boolean':
                 array_push($args2, $val);
                 $sig .= '@b';
                 break;
             case 'integer':
                 array_push($args2, $val);
                 $sig .= '@i';
                 break;
             case 'double':
                 array_push($args2, $val);
                 $sig .= '@d';
                 break;
             case 'string':
                 array_push($args2, htmlspecialchars($val, ENT_COMPAT));
                 $sig .= '@s';
                 break;
             case 'array':
                 $sig = "~INVALID";
                 break;
             case 'object':
                 if ($val instanceof JavaType) {
                     array_push($args2, $val->get__java());
                     $sig .= "@o{$val->get__signature()}";
                 } else {
                     $sig = "~INVALID";
                 }
                 break;
             case 'resource':
                 array_push($args2, $val);
                 $sig .= '@r';
                 break;
             case 'NULL':
                 array_push($args2, $val);
                 $sig .= '@N';
                 break;
             case 'unknown type':
                 array_push($args2, $val);
                 $sig .= '@u';
                 break;
             default:
                 throw new Exception\IllegalArgumentException($val);
         }
     }
     if (array_key_exists($sig, $client->methodCache)) {
         $cacheEntry =& $client->methodCache[$sig];
         $client->sendBuffer .= $client->preparedToSendBuffer;
         if (strlen($client->sendBuffer) >= JAVA_SEND_SIZE) {
             if ($client->protocol->handler->write($client->sendBuffer) <= 0) {
                 throw new Exception\IllegalStateException("Connection out of sync,check backend log for details.");
             }
             $client->sendBuffer = null;
         }
         $client->preparedToSendBuffer = vsprintf($cacheEntry->fmt, $args2);
         $this->__java = ++$client->asyncCtx;
         $this->__factory = $cacheEntry->factory;
         $this->__signature = $cacheEntry->signature;
         $this->__cancelProxyCreationTag = ++$client->cancelProxyCreationTag;
     } else {
         $client->currentCacheKey = $sig;
         $this->__delegate = $client->createObject($name, $args);
         $delegate = $this->__delegate;
         $this->__java = $delegate->__java;
         $this->__signature = $delegate->__signature;
     }
 }