下面列出了怎么用org.omg.CORBA.Policy的API类实例代码及写法,或者点击链接到github查看源代码。
private synchronized void createbiPOA( ) {
if( biPOA != null ) {
return;
}
try {
POA rootPOA = (POA) orb.resolve_initial_references(
ORBConstants.ROOT_POA_NAME );
rootPOA.the_POAManager().activate( );
int i = 0;
Policy[] poaPolicy = new Policy[3];
poaPolicy[i++] = rootPOA.create_lifespan_policy(
LifespanPolicyValue.TRANSIENT);
poaPolicy[i++] = rootPOA.create_id_assignment_policy(
IdAssignmentPolicyValue.SYSTEM_ID);
poaPolicy[i++] = rootPOA.create_servant_retention_policy(
ServantRetentionPolicyValue.RETAIN);
biPOA = rootPOA.create_POA("BindingIteratorPOA", null, poaPolicy );
biPOA.the_POAManager().activate( );
} catch( Exception e ) {
throw readWrapper.namingCtxBindingIteratorCreate( e ) ;
}
}
private synchronized void createbiPOA( ) {
if( biPOA != null ) {
return;
}
try {
POA rootPOA = (POA) orb.resolve_initial_references(
ORBConstants.ROOT_POA_NAME );
rootPOA.the_POAManager().activate( );
int i = 0;
Policy[] poaPolicy = new Policy[3];
poaPolicy[i++] = rootPOA.create_lifespan_policy(
LifespanPolicyValue.TRANSIENT);
poaPolicy[i++] = rootPOA.create_id_assignment_policy(
IdAssignmentPolicyValue.SYSTEM_ID);
poaPolicy[i++] = rootPOA.create_servant_retention_policy(
ServantRetentionPolicyValue.RETAIN);
biPOA = rootPOA.create_POA("BindingIteratorPOA", null, poaPolicy );
biPOA.the_POAManager().activate( );
} catch( Exception e ) {
throw readWrapper.namingCtxBindingIteratorCreate( e ) ;
}
}
/**
* Returns the policy in effect for this operation for the given policy
* type.
*/
public Policy get_server_policy (int type) {
// access is currently valid for all states:
//checkAccess( MID_GET_SERVER_POLICY );
Policy result = null;
if( objectAdapter != null ) {
result = objectAdapter.getEffectivePolicy( type );
}
// _REVISIT_ RTF Issue: get_server_policy spec not in sync with
// get_effective_policy spec.
return result;
}
private synchronized void createbiPOA( ) {
if( biPOA != null ) {
return;
}
try {
POA rootPOA = (POA) orb.resolve_initial_references(
ORBConstants.ROOT_POA_NAME );
rootPOA.the_POAManager().activate( );
int i = 0;
Policy[] poaPolicy = new Policy[3];
poaPolicy[i++] = rootPOA.create_lifespan_policy(
LifespanPolicyValue.TRANSIENT);
poaPolicy[i++] = rootPOA.create_id_assignment_policy(
IdAssignmentPolicyValue.SYSTEM_ID);
poaPolicy[i++] = rootPOA.create_servant_retention_policy(
ServantRetentionPolicyValue.RETAIN);
biPOA = rootPOA.create_POA("BindingIteratorPOA", null, poaPolicy );
biPOA.the_POAManager().activate( );
} catch( Exception e ) {
throw readWrapper.namingCtxBindingIteratorCreate( e ) ;
}
}
/**
* Returns the policy in effect for this operation for the given policy
* type.
*/
public Policy get_server_policy (int type) {
// access is currently valid for all states:
//checkAccess( MID_GET_SERVER_POLICY );
Policy result = null;
if( objectAdapter != null ) {
result = objectAdapter.getEffectivePolicy( type );
}
// _REVISIT_ RTF Issue: get_server_policy spec not in sync with
// get_effective_policy spec.
return result;
}
/**
* Returns the policy in effect for this operation for the given policy
* type.
*/
public Policy get_server_policy (int type) {
// access is currently valid for all states:
//checkAccess( MID_GET_SERVER_POLICY );
Policy result = null;
if( objectAdapter != null ) {
result = objectAdapter.getEffectivePolicy( type );
}
// _REVISIT_ RTF Issue: get_server_policy spec not in sync with
// get_effective_policy spec.
return result;
}
private synchronized void createbiPOA( ) {
if( biPOA != null ) {
return;
}
try {
POA rootPOA = (POA) orb.resolve_initial_references(
ORBConstants.ROOT_POA_NAME );
rootPOA.the_POAManager().activate( );
int i = 0;
Policy[] poaPolicy = new Policy[3];
poaPolicy[i++] = rootPOA.create_lifespan_policy(
LifespanPolicyValue.TRANSIENT);
poaPolicy[i++] = rootPOA.create_id_assignment_policy(
IdAssignmentPolicyValue.SYSTEM_ID);
poaPolicy[i++] = rootPOA.create_servant_retention_policy(
ServantRetentionPolicyValue.RETAIN);
biPOA = rootPOA.create_POA("BindingIteratorPOA", null, poaPolicy );
biPOA.the_POAManager().activate( );
} catch( Exception e ) {
throw readWrapper.namingCtxBindingIteratorCreate( e ) ;
}
}
/**
* Returns the policy in effect for this operation for the given policy
* type.
*/
public Policy get_server_policy (int type) {
// access is currently valid for all states:
//checkAccess( MID_GET_SERVER_POLICY );
Policy result = null;
if( objectAdapter != null ) {
result = objectAdapter.getEffectivePolicy( type );
}
// _REVISIT_ RTF Issue: get_server_policy spec not in sync with
// get_effective_policy spec.
return result;
}
private synchronized void createbiPOA( ) {
if( biPOA != null ) {
return;
}
try {
POA rootPOA = (POA) orb.resolve_initial_references(
ORBConstants.ROOT_POA_NAME );
rootPOA.the_POAManager().activate( );
int i = 0;
Policy[] poaPolicy = new Policy[3];
poaPolicy[i++] = rootPOA.create_lifespan_policy(
LifespanPolicyValue.TRANSIENT);
poaPolicy[i++] = rootPOA.create_id_assignment_policy(
IdAssignmentPolicyValue.SYSTEM_ID);
poaPolicy[i++] = rootPOA.create_servant_retention_policy(
ServantRetentionPolicyValue.RETAIN);
biPOA = rootPOA.create_POA("BindingIteratorPOA", null, poaPolicy );
biPOA.the_POAManager().activate( );
} catch( Exception e ) {
throw readWrapper.namingCtxBindingIteratorCreate( e ) ;
}
}
/**
* Returns the policy in effect for this operation for the given policy
* type.
*/
public Policy get_server_policy (int type) {
// access is currently valid for all states:
//checkAccess( MID_GET_SERVER_POLICY );
Policy result = null;
if( objectAdapter != null ) {
result = objectAdapter.getEffectivePolicy( type );
}
// _REVISIT_ RTF Issue: get_server_policy spec not in sync with
// get_effective_policy spec.
return result;
}
public void add_ior_interceptor_with_policy (
IORInterceptor interceptor, Policy[] policies )
throws DuplicateName, PolicyError
{
// XXX ignore policies for now
add_ior_interceptor( interceptor ) ;
}
public void add_client_request_interceptor_with_policy (
ClientRequestInterceptor interceptor, Policy[] policies )
throws DuplicateName
{
// XXX ignore policies for now
add_client_request_interceptor( interceptor ) ;
}
public void add_server_request_interceptor_with_policy (
ServerRequestInterceptor interceptor, Policy[] policies )
throws DuplicateName, PolicyError
{
// XXX ignore policies for now
add_server_request_interceptor( interceptor ) ;
}
public void add_ior_interceptor_with_policy (
IORInterceptor interceptor, Policy[] policies )
throws DuplicateName, PolicyError
{
// XXX ignore policies for now
add_ior_interceptor( interceptor ) ;
}
public void add_client_request_interceptor_with_policy (
ClientRequestInterceptor interceptor, Policy[] policies )
throws DuplicateName
{
// XXX ignore policies for now
add_client_request_interceptor( interceptor ) ;
}
public void add_server_request_interceptor_with_policy (
ServerRequestInterceptor interceptor, Policy[] policies )
throws DuplicateName, PolicyError
{
// XXX ignore policies for now
add_server_request_interceptor( interceptor ) ;
}
public void add_ior_interceptor_with_policy (
IORInterceptor interceptor, Policy[] policies )
throws DuplicateName, PolicyError
{
// XXX ignore policies for now
add_ior_interceptor( interceptor ) ;
}
public void add_ior_interceptor_with_policy (
IORInterceptor interceptor, Policy[] policies )
throws DuplicateName, PolicyError
{
// XXX ignore policies for now
add_ior_interceptor( interceptor ) ;
}
public void add_client_request_interceptor_with_policy (
ClientRequestInterceptor interceptor, Policy[] policies )
throws DuplicateName
{
// XXX ignore policies for now
add_client_request_interceptor( interceptor ) ;
}
public void add_ior_interceptor_with_policy (
IORInterceptor interceptor, Policy[] policies )
throws DuplicateName, PolicyError
{
// XXX ignore policies for now
add_ior_interceptor( interceptor ) ;
}
public void add_client_request_interceptor_with_policy (
ClientRequestInterceptor interceptor, Policy[] policies )
throws DuplicateName
{
// XXX ignore policies for now
add_client_request_interceptor( interceptor ) ;
}
public void add_server_request_interceptor_with_policy (
ServerRequestInterceptor interceptor, Policy[] policies )
throws DuplicateName, PolicyError
{
// XXX ignore policies for now
add_server_request_interceptor( interceptor ) ;
}
public org.omg.CORBA.Policy copy ()
{
return this ;
}
public org.omg.CORBA.Policy copy ()
{
return this ;
}
public org.omg.CORBA.Policy copy ()
{
return this ;
}
/**
* Returns the given policy in effect for this operation.
*/
public Policy get_request_policy (int type){
checkAccess( MID_GET_REQUEST_POLICY );
// _REVISIT_ Our ORB is not policy-based at this time.
throw wrapper.piOrbNotPolicyBased() ;
}
public Policy _get_policy(int policy_type)
{
return object._get_policy( policy_type ) ;
}
/**
* <code>create_POA</code>
* <b>Section 3.3.8.2</b>
*/
public POA create_POA(String name, POAManager
theManager, Policy[] policies) throws AdapterAlreadyExists,
InvalidPolicy
{
try {
lock() ;
if (debug) {
ORBUtility.dprint( this, "Calling create_POA(name=" + name +
" theManager=" + theManager + " policies=" + policies +
") on poa " + this ) ;
}
// We cannot create children of a POA that is (being) destroyed.
// This has been added to the CORBA 3.0 spec.
if (state > STATE_RUN)
throw omgLifecycleWrapper().createPoaDestroy() ;
POAImpl poa = (POAImpl)(children.get(name)) ;
if (poa == null) {
poa = new POAImpl( name, this, getORB(), STATE_START ) ;
}
try {
poa.lock() ;
if (debug) {
ORBUtility.dprint( this,
"Calling create_POA: new poa is " + poa ) ;
}
if ((poa.state != STATE_START) && (poa.state != STATE_INIT))
throw new AdapterAlreadyExists();
POAManagerImpl newManager = (POAManagerImpl)theManager ;
if (newManager == null)
newManager = new POAManagerImpl( manager.getFactory(),
manager.getPIHandler() );
int defaultCopierId =
getORB().getCopierManager().getDefaultId() ;
Policies POAPolicies =
new Policies( policies, defaultCopierId ) ;
poa.initialize( newManager, POAPolicies ) ;
return poa;
} finally {
poa.unlock() ;
}
} finally {
unlock() ;
}
}
public Policy getEffectivePolicy( int type )
{
return mediator.getPolicies().get_effective_policy( type ) ;
}
/**
* Returns the given policy in effect for this operation.
*/
public Policy get_request_policy (int type){
checkAccess( MID_GET_REQUEST_POLICY );
// _REVISIT_ Our ORB is not policy-based at this time.
throw wrapper.piOrbNotPolicyBased() ;
}