本文整理汇总了PHP中Proxy::newProxyInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Proxy::newProxyInstance方法的具体用法?PHP Proxy::newProxyInstance怎么用?PHP Proxy::newProxyInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Proxy
的用法示例。
在下文中一共展示了Proxy::newProxyInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deployBean
/**
* Deploy
*
* @param remote.server.deploy.Deployable deployment
*/
public function deployBean($deployment)
{
if ($deployment instanceof IncompleteDeployment) {
throw new DeployException('Incomplete deployment originating from ' . $deployment->origin, $deployment->cause);
}
$this->cat && $this->cat->info($this->getClassName(), 'Begin deployment of', $deployment);
// Register beans classloader. This classloader must be put at the beginning
// to prevent loading of the home interface not implmenenting BeanInterface
$cl = $deployment->getClassLoader();
ClassLoader::getDefault()->registerLoader($cl, TRUE);
$impl = $cl->loadClass($deployment->getImplementation());
$interface = $cl->loadClass($deployment->getInterface());
$directoryName = $deployment->getDirectoryName();
// Fetch naming directory
$directory = NamingDirectory::getInstance();
// Create beanContainer
// TBI: Check which kind of bean container has to be created
$beanContainer = StatelessSessionBeanContainer::forClass($impl);
$this->cat && $beanContainer->setTrace($this->cat);
// Create invocation handler
$invocationHandler = new ContainerInvocationHandler();
$invocationHandler->setContainer($beanContainer);
// Now bind into directory
$directory->bind($directoryName, Proxy::newProxyInstance($cl, array($interface), $invocationHandler));
$this->cat && $this->cat->info($this->getClassName(), 'End deployment of', $impl->getName(), 'with ND entry', $directoryName);
return $beanContainer;
}
示例2: valueOf
/**
* Returns a value for the given serialized string
*
* @param server.protocol.Serializer serializer
* @param remote.protocol.SerializedData serialized
* @param [:var] context default array()
* @return var
*/
public function valueOf($serializer, $serialized, $context = array())
{
$oid = $serialized->consumeSize();
$serialized->consume('{');
$interface = $serializer->valueOf($serialized, $context);
$serialized->consume('}');
return Proxy::newProxyInstance(ClassLoader::getDefault(), array(XPClass::forName($serializer->packageMapping($interface))), RemoteInvocationHandler::newInstance((int) $oid, $context['handler']));
}
示例3: run
/**
* Runs the server. Loads the listener using XPClass::forName()
* so that the class is loaded within the thread's process space
* and will be recompiled whenever the thread is restarted.
*
* @throws lang.XPException in case initializing the server fails
* @throws lang.SystemException in case setuid fails
*/
public function run()
{
try {
with($class = XPClass::forName('peer.ftp.server.FtpProtocol'), $cl = ClassLoader::getDefault());
// Add listener
$this->server->setProtocol($proto = $class->newInstance($storage = Proxy::newProxyInstance($cl, array(XPClass::forName('peer.ftp.server.storage.Storage')), $this->storageHandler), Proxy::newProxyInstance($cl, array(XPClass::forName('security.auth.Authenticator')), $this->authenticatorHandler)));
// Copy interceptors to connection listener
$proto->interceptors = $this->interceptors;
// Enable debugging
if ($this->cat) {
$proto->setTrace($this->cat);
$this->server instanceof Traceable && $this->server->setTrace($this->cat);
}
// Try to start the server
$this->server->init();
} catch (Throwable $e) {
$this->server->shutdown();
throw $e;
}
// Check if we should run child processes
// with another uid/pid
if (isset($this->processGroup)) {
$group = posix_getgrnam($this->processGroup);
$this->cat && $this->cat->debugf('Setting group to: %s (GID: %d)', $group['name'], $group['uid']);
if (!posix_setgid($group['gid'])) {
throw new SystemException('Could not set GID');
}
}
if (isset($this->processOwner)) {
$user = posix_getpwnam($this->processOwner);
$this->cat && $this->cat->debugf('Setting user to: %s (UID: %d)', $user['name'], $user['uid']);
if (!posix_setuid($user['uid'])) {
throw new SystemException('Could not set UID');
}
}
$this->server->service();
}
示例4: proxyInstanceFor
/**
* Helper method which returns a proxy instance for a given list of
* interfaces, using the default classloader and the handler defined
* in setUp()
*
* @param lang.XPClass[] interfaces
* @return lang.reflect.Proxy
*/
protected function proxyInstanceFor($interfaces)
{
return Proxy::newProxyInstance(ClassLoader::getDefault(), $interfaces, $this->handler);
}
示例5: getNonOwnerProxy
protected function getNonOwnerProxy(PersonBean $person)
{
return Proxy::newProxyInstance(new NonOwnerInvocationHandler($person));
}