本文整理汇总了Java中org.omg.CORBA.portable.InvokeHandler类的典型用法代码示例。如果您正苦于以下问题:Java InvokeHandler类的具体用法?Java InvokeHandler怎么用?Java InvokeHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InvokeHandler类属于org.omg.CORBA.portable包,在下文中一共展示了InvokeHandler类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: servantToHandler
import org.omg.CORBA.portable.InvokeHandler; //导入依赖的package包/类
/**
* Convert the servant to invocation handler.
*/
public InvokeHandler servantToHandler(Servant a_servant)
{
if (a_servant instanceof InvokeHandler)
{
return (InvokeHandler) a_servant;
}
else if (a_servant instanceof DynamicImplementation)
{
return new DynamicImpHandler((DynamicImplementation) a_servant);
}
else
{
throw new BAD_OPERATION(a_servant +
" must be either InvokeHandler or " + "POA DynamicImplementation"
);
}
}
示例2: setServant
import org.omg.CORBA.portable.InvokeHandler; //导入依赖的package包/类
/**
* Set a servant, if it has not been previously set.
*
* @param a_servant a servant to set, can be null to indicate the necessity
* for the subsequent activation.
*
* @throws BAD_PARAM if the passed servant is not an {@link InvokeHandler} or
* {@link DynamicImplementation} and also not null.
*/
public void setServant(Servant a_servant)
{
if (a_servant != null &&
!(a_servant instanceof InvokeHandler) &&
!(a_servant instanceof DynamicImplementation)
)
{
throw new BAD_PARAM("Must be either InvokeHandler or " +
"DynamicImplementation, but is " + a_servant
);
}
servant = a_servant;
}
示例3: s_invoke
import org.omg.CORBA.portable.InvokeHandler; //导入依赖的package包/类
/**
* Make an invocation and return a stream from where the results can be read
* and throw ApplicationException, where applicable.
*/
org.omg.CORBA.portable.InputStream s_invoke(InvokeHandler handler)
throws ApplicationException
{
try
{
poa.m_orb.currents.put(Thread.currentThread(), this);
org.omg.CORBA.portable.InputStream input = v_invoke(handler);
if (!exceptionReply)
{
return input;
}
else
{
input.mark(500);
String id = input.read_string();
try
{
input.reset();
}
catch (IOException ex)
{
InternalError ierr = new InternalError();
ierr.initCause(ex);
throw ierr;
}
throw new ApplicationException(id, input);
}
}
finally
{
poa.m_orb.currents.remove(Thread.currentThread());
}
}
示例4: getHandler
import org.omg.CORBA.portable.InvokeHandler; //导入依赖的package包/类
/**
* Return the associated invocation handler.
*/
public InvokeHandler getHandler(String operation, CookieHolder cookie,
boolean forwarding_allowed
) throws gnuForwardRequest
{
if (servant != null && !noRetain)
{
return servantToHandler(servant);
}
else
{
// Use servant locator to locate the servant.
if (poa.servant_locator != null)
{
try
{
servant =
poa.servant_locator.preinvoke(Id, poa, operation, cookie);
return servantToHandler(servant);
}
catch (org.omg.PortableServer.ForwardRequest forw_ex)
{
if (forwarding_allowed)
{
throw new gnuForwardRequest(forw_ex.forward_reference);
}
else
{
servant =
ForwardedServant.create(forw_ex.forward_reference);
return servantToHandler(servant);
}
}
}
else
// Use servant activator to locate the servant.
if (poa.applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION) &&
poa.applies(ServantRetentionPolicyValue.RETAIN)
)
{
try
{
poa.activate_object_with_id(Id, servant, forwarding_allowed);
servant = poa.id_to_servant(Id);
return servantToHandler(servant);
}
catch (gnuForwardRequest forwarded)
{
throw forwarded;
}
catch (Exception ex)
{
BAD_OPERATION bad =
new BAD_OPERATION("Unable to activate", Minor.Activation,
CompletionStatus.COMPLETED_NO
);
bad.initCause(ex);
throw bad;
}
}
else if (poa.default_servant != null)
{
servant = poa.default_servant;
return servantToHandler(servant);
}
// No servant and no servant manager - throw exception.
else
{
throw new BAD_OPERATION("Unable to activate", Minor.Activation,
CompletionStatus.COMPLETED_NO
);
}
}
}
示例5: invoke
import org.omg.CORBA.portable.InvokeHandler; //导入依赖的package包/类
/**
* Make an invocation and store the result in the fields of this Request. Used
* with DII only.
*/
public void invoke()
{
InvokeHandler handler = object.getHandler(operation(), cookie, false);
if (handler instanceof DynamicImpHandler)
{
DynamicImplementation dyn = ((DynamicImpHandler) handler).servant;
if (serverRequest == null)
{
serverRequest = new LocalServerRequest(this);
}
try
{
poa.m_orb.currents.put(Thread.currentThread(), this);
dyn.invoke(serverRequest);
}
finally
{
poa.m_orb.currents.remove(Thread.currentThread());
}
}
else
{
org.omg.CORBA.portable.InputStream input = v_invoke(handler);
if (!exceptionReply)
{
NamedValue arg;
// Read return value, if set.
if (m_result != null)
{
m_result.value().read_value(input, m_result.value().type());
}
// Read returned parameters, if set.
if (m_args != null)
{
for (int i = 0; i < m_args.count(); i++)
{
try
{
arg = m_args.item(i);
// Both ARG_INOUT and ARG_OUT have this binary flag set.
if ((arg.flags() & ARG_OUT.value) != 0)
{
arg.value().read_value(input, arg.value().type());
}
}
catch (Bounds ex)
{
Unexpected.error(ex);
}
}
}
}
else// User exception reply
{
// Prepare an Any that will hold the exception.
gnuAny exc = new gnuAny();
exc.insert_Streamable(new StreamHolder(input));
UnknownUserException unuex = new UnknownUserException(exc);
m_environment.exception(unuex);
}
}
}
示例6: getHandler
import org.omg.CORBA.portable.InvokeHandler; //导入依赖的package包/类
/**
* Return the associated invocation handler.
*/
public InvokeHandler getHandler(String method, CookieHolder cookie)
{
return object.getHandler(method, cookie, false);
}