本文整理汇总了Java中org.omg.PortableServer.ImplicitActivationPolicyValue类的典型用法代码示例。如果您正苦于以下问题:Java ImplicitActivationPolicyValue类的具体用法?Java ImplicitActivationPolicyValue怎么用?Java ImplicitActivationPolicyValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImplicitActivationPolicyValue类属于org.omg.PortableServer包,在下文中一共展示了ImplicitActivationPolicyValue类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: gnuImplicitActivationPolicy
import org.omg.PortableServer.ImplicitActivationPolicyValue; //导入依赖的package包/类
/**
* Create the policy.
*
* @param v a value for the policy.
*/
public gnuImplicitActivationPolicy(ImplicitActivationPolicyValue v)
{
super(IMPLICIT_ACTIVATION_POLICY_ID.value, v, v.value(),
"IDL:org.omg/PortableServer/ImplicitActivationPolicy:1.0"
);
}
示例2: servant_to_id
import org.omg.PortableServer.ImplicitActivationPolicyValue; //导入依赖的package包/类
/**
* Returns the id of the object, served by the given servant (assuming that
* the servant serves only one object). The id is found in one of the
* following ways.
* <ul>
* <li>If the POA has both the RETAIN and the UNIQUE_ID policy and the
* specified servant is active, the method return the Object Id associated
* with that servant. </li>
* <li> If the POA has both the RETAIN and the IMPLICIT_ACTIVATION policy and
* either the POA has the MULTIPLE_ID policy or the specified servant is
* inactive, the method activates the servant using a POA-generated Object Id
* and the Interface Id associated with the servant, and returns that Object
* Id. </li>
* <li>If the POA has the USE_DEFAULT_SERVANT policy, the servant specified
* is the default servant, and the method is being invoked in the context of
* executing a request on the default servant, the method returns the ObjectId
* associated with the current invocation. </li>
* </ul>
*
* @throws ServantNotActive in all cases, not listed in the list above.
* @throws WrongPolicy The method requres USE_DEFAULT_SERVANT policy or a
* combination of the RETAIN policy and either the UNIQUE_ID or
* IMPLICIT_ACTIVATION policies and throws the WrongPolicy if these conditions
* are not satisfied.
*/
public byte[] servant_to_id(Servant the_Servant)
throws ServantNotActive, WrongPolicy
{
if (applies(RequestProcessingPolicyValue.USE_DEFAULT_SERVANT) ||
applies(ServantRetentionPolicyValue.RETAIN) &&
(
applies(IdUniquenessPolicyValue.UNIQUE_ID) ||
applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION)
)
)
{
AOM.Obj ref = null;
if (!applies(IdUniquenessPolicyValue.MULTIPLE_ID))
ref = aom.findServant(the_Servant);
if (ref == null &&
applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION)
)
{
// Try to activate.
try
{
return activate_object(the_Servant);
}
catch (ServantAlreadyActive ex)
{
// Either it shuld not be or the policy allows multiple ids.
throw new InternalError();
}
}
if (ref == null)
throw new ServantNotActive();
else
return ref.key;
}
else
throw new WrongPolicy("(RETAIN and UNIQUE ID) " +
"or USE_DEFAULT_SERVANT required."
);
}
示例3: servant_to_id
import org.omg.PortableServer.ImplicitActivationPolicyValue; //导入依赖的package包/类
/**
* Returns the id of the object, served by the given servant (assuming that
* the servant serves only one object). The id is found in one of the
* following ways.
* <ul>
* <li>If the POA has both the RETAIN and the UNIQUE_ID policy and the
* specified servant is active, the method return the Object Id associated
* with that servant. </li>
* <li> If the POA has both the RETAIN and the IMPLICIT_ACTIVATION policy and
* either the POA has the MULTIPLE_ID policy or the specified servant is
* inactive, the method activates the servant using a POA-generated Object Id
* and the Interface Id associated with the servant, and returns that Object
* Id. </li>
* <li>If the POA has the USE_DEFAULT_SERVANT policy, the servant specified
* is the default servant, and the method is being invoked in the context of
* executing a request on the default servant, the method returns the ObjectId
* associated with the current invocation. </li>
* </ul>
*
* @throws ServantNotActive in all cases, not listed in the list above.
* @throws WrongPolicy The method requres USE_DEFAULT_SERVANT policy or a
* combination of the RETAIN policy and either the UNIQUE_ID or
* IMPLICIT_ACTIVATION policies and throws the WrongPolicy if these conditions
* are not satisfied.
*/
public byte[] servant_to_id(Servant the_Servant)
throws ServantNotActive, WrongPolicy
{
if (applies(RequestProcessingPolicyValue.USE_DEFAULT_SERVANT) ||
applies(ServantRetentionPolicyValue.RETAIN) &&
(
applies(IdUniquenessPolicyValue.UNIQUE_ID) ||
applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION)
)
)
{
AOM.Obj ref = null;
if (!applies(IdUniquenessPolicyValue.MULTIPLE_ID))
ref = aom.findServant(the_Servant);
if (ref == null &&
applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION)
)
{
// Try to activate.
try
{
return activate_object(the_Servant);
}
catch (ServantAlreadyActive ex)
{
// Either it shuld not be or the policy allows multiple ids.
throw new InternalError();
}
}
if (ref == null)
throw new ServantNotActive();
else
return ref.key;
}
else
throw new WrongPolicy("(RETAIN and UNIQUE ID) " +
"or USE_DEFAULT_SERVANT required."
);
}
示例4: CorbaExporter
import org.omg.PortableServer.ImplicitActivationPolicyValue; //导入依赖的package包/类
public CorbaExporter()
throws Exception
{
Properties p = System.getProperties();
// add runtime properties here
p.put("org.omg.CORBA.ORBClass",
"com.sun.corba.se.internal.POA.POAORB");
p.put("org.omg.CORBA.ORBSingletonClass",
"com.sun.corba.se.internal.corba.ORBSingleton");
p.put("java.naming.factory.initial",
"com.sun.jndi.cosnaming.CNCtxFactory");
p.put("java.naming.provider.url",
"iiop://localhost:1060");
_orb = ORB.init( new String[0], p );
POA rootPOA = (POA)_orb.resolve_initial_references("RootPOA");
// STEP 1: Create a POA with the appropriate policies
Policy[] tpolicy = new Policy[4];
tpolicy[0] = rootPOA.create_lifespan_policy(
LifespanPolicyValue.TRANSIENT );
tpolicy[1] = rootPOA.create_request_processing_policy(
RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY );
tpolicy[2] = rootPOA.create_servant_retention_policy(
ServantRetentionPolicyValue.RETAIN);
tpolicy[3] = rootPOA.create_implicit_activation_policy(
ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION);
_poa = rootPOA.create_POA("MyTransientPOA", null, tpolicy);
// STEP 2: Activate the POA Manager, otherwise all calls to the
// servant hang because, by default, POAManager will be in the
// HOLD state.
_poa.the_POAManager().activate();
}
示例5: createPolicy
import org.omg.PortableServer.ImplicitActivationPolicyValue; //导入依赖的package包/类
public static ImplicitActivationPolicyImpl createPolicy(Any val)
throws org.omg.CORBA.PolicyError
{
try {
ImplicitActivationPolicyValue value =
ImplicitActivationPolicyValueHelper.extract(val);
return new ImplicitActivationPolicyImpl(value);
}
catch (BAD_PARAM bp) {
throw new PolicyError(BAD_POLICY_VALUE.value);
}
}
示例6: create_implicit_activation_policy
import org.omg.PortableServer.ImplicitActivationPolicyValue; //导入依赖的package包/类
/**
* <code>create_implicit_activation_policy</code>
* <b>Section 3.3.8.5</b>
*/
public ImplicitActivationPolicy create_implicit_activation_policy(
ImplicitActivationPolicyValue value)
{
return new ImplicitActivationPolicyImpl(value);
}
示例7: value
import org.omg.PortableServer.ImplicitActivationPolicyValue; //导入依赖的package包/类
/**
* Get the value for the policy that was passed in a constructor.
*/
public ImplicitActivationPolicyValue value()
{
return (ImplicitActivationPolicyValue) getValue();
}
示例8: servant_to_reference
import org.omg.PortableServer.ImplicitActivationPolicyValue; //导入依赖的package包/类
/**
* <p>
* Converts the given servant to the object reference. The servant will serve
* all methods, invoked on the returned object. The returned object reference
* can be passed to the remote client, enabling remote invocations.
* </p>
* <p>
* If the specified servant is active, it is returned. Otherwise, if the POA
* has the IMPLICIT_ACTIVATION policy the method activates the servant. In
* this case, if the servant activator is set, the
* {@link ServantActivatorOperations#incarnate} method will be called.
* </p>
*
* @throws ServantNotActive if the servant is inactive and no
* IMPLICIT_ACTIVATION policy applies.
* @throws WrongPolicy This method needs the RETAIN policy and either the
* UNIQUE_ID or IMPLICIT_ACTIVATION policies.
*
* @return the object, exposing the given servant in the context of this POA.
*/
public org.omg.CORBA.Object servant_to_reference(Servant the_Servant)
throws ServantNotActive, WrongPolicy
{
required(ServantRetentionPolicyValue.RETAIN);
AOM.Obj exists = null;
if (!applies(IdUniquenessPolicyValue.MULTIPLE_ID))
exists = aom.findServant(the_Servant);
if (exists != null)
{
if (exists.isDeactiveted())
{
if (applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION))
{
checkDiscarding();
exists.setDeactivated(false);
incarnate(exists, exists.key, the_Servant, false);
}
else
throw new ServantNotActive();
}
else
return exists.object;
}
if (exists == null
&& applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION))
{
checkDiscarding();
byte[] object_key = AOM.getFreeId();
ServantDelegateImpl delegate = new ServantDelegateImpl(the_Servant,
this, object_key);
create_and_connect(object_key, the_Servant._all_interfaces(this,
object_key)[0], delegate);
return delegate.object;
}
else
throw new ServantNotActive();
}
示例9: create_implicit_activation_policy
import org.omg.PortableServer.ImplicitActivationPolicyValue; //导入依赖的package包/类
/** {@inheritDoc} */
public ImplicitActivationPolicy create_implicit_activation_policy(ImplicitActivationPolicyValue a_value)
{
return new gnuImplicitActivationPolicy(a_value);
}
示例10: getHandler
import org.omg.PortableServer.ImplicitActivationPolicyValue; //导入依赖的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
);
}
}
}
示例11: servant_to_reference
import org.omg.PortableServer.ImplicitActivationPolicyValue; //导入依赖的package包/类
/**
* <p>
* Converts the given servant to the object reference. The servant will serve
* all methods, invoked on the returned object. The returned object reference
* can be passed to the remote client, enabling remote invocations.
* </p>
* <p>
* If the specified servant is active, it is returned. Otherwise, if the POA
* has the IMPLICIT_ACTIVATION policy the method activates the servant. In
* this case, if the servant activator is set, the
* {@link ServantActivatorOperations#incarnate} method will be called.
* </p>
*
* @throws ServantNotActive if the servant is inactive and no
* IMPLICIT_ACTIVATION policy applies.
* @throws WrongPolicy This method needs the RETAIN policy and either the
* UNIQUE_ID or IMPLICIT_ACTIVATION policies.
*
* @return the object, exposing the given servant in the context of this POA.
*/
public org.omg.CORBA.Object servant_to_reference(Servant the_Servant)
throws ServantNotActive, WrongPolicy
{
required(ServantRetentionPolicyValue.RETAIN);
AOM.Obj exists = null;
if (!applies(IdUniquenessPolicyValue.MULTIPLE_ID))
exists = aom.findServant(the_Servant);
if (exists != null)
{
if (exists.isDeactiveted())
{
if (applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION))
{
checkDiscarding();
exists.setDeactivated(false);
incarnate(exists, exists.key, the_Servant, false);
}
else
throw new ServantNotActive();
}
else
return exists.object;
}
if (exists == null
&& applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION))
{
checkDiscarding();
byte[] object_key = AOM.getFreeId();
ServantDelegateImpl delegate = new ServantDelegateImpl(the_Servant,
this, object_key);
create_and_connect(object_key, the_Servant._all_interfaces(this,
object_key)[0], delegate);
return delegate.object;
}
else
throw new ServantNotActive();
}
示例12: ImplicitActivationPolicyImpl
import org.omg.PortableServer.ImplicitActivationPolicyValue; //导入依赖的package包/类
public ImplicitActivationPolicyImpl(ImplicitActivationPolicyValue value)
{
m_value = value;
}
示例13: value
import org.omg.PortableServer.ImplicitActivationPolicyValue; //导入依赖的package包/类
public org.omg.PortableServer.ImplicitActivationPolicyValue value()
{
return m_value;
}