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; }
/** * Create an instance of the POA with the given features. * This method is not responsible for duplicate checking * or adding the returned instance to any possible table. * * @param child_name the name of the poa being created. * @param a_manager the poa manager (never null). * @param policies the array of policies. * @param an_orb the ORB for this POA. * * @return the created POA. * * @throws InvalidPolicy for conflicting or otherwise invalid policies.| */ protected POA createPoaInstance(String child_name, POAManager a_manager, Policy[] policies, ORB_1_4 an_orb ) throws InvalidPolicy { POAManager some_manager = a_manager == null ? new gnuPOAManager() : a_manager; if (some_manager instanceof gnuPOAManager) { ((gnuPOAManager) some_manager).addPoa(this); } return new gnuPOA(this, child_name, some_manager, policies, an_orb); }
/** * Check if the policy set is valid. */ protected boolean validatePolicies(Policy[] a) throws InvalidPolicy { if (applies(ServantRetentionPolicyValue.NON_RETAIN)) { if (!applies(RequestProcessingPolicyValue.USE_DEFAULT_SERVANT) && !applies(RequestProcessingPolicyValue.USE_SERVANT_MANAGER) ) { short p = 0; for (short i = 0; i < a.length; i++) { if (a [ i ].policy_type() == SERVANT_RETENTION_POLICY_ID.value) p = i; } throw new InvalidPolicy("NON_RETAIN requires either " + "USE_DEFAULT_SERVANT or USE_SERVANT_MANAGER", p ); } } return true; }
/** * Reads the policies as a pair PolicyType/encapsuled policy data * @param input */ public void partialRead(CDRInputStream input) { int size = input.read_ulong(); Policy policy = null; for (int i = 0; i< size; i++) { policy = PolicyFactory.readPolicy(input); if(policy != null) { try { setPolicy(policy); } catch (PolicyError e) {//unreachable } } } }
public void start(String[] args) throws Exception { Properties p = System.getProperties(); 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"); ORB orb = ORB.init(args, p); POA rootPOA = (POA) orb.resolve_initial_references("RootPOA"); Policy[] tpolicy = new Policy[3]; 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); POA tPOA = rootPOA.create_POA("MyTransientPOA", null, tpolicy); tPOA.the_POAManager().activate(); Tie tie = (Tie) Util.getTie(remoteDatabaseManager); byte[] id = "db".getBytes(); tPOA.activate_object_with_id(id, (Servant) tie); Context initialNamingContext = new InitialContext(); initialNamingContext.rebind("DatabaseService", tPOA.create_reference_with_id(id, ((Servant) tie)._all_interfaces(tPOA, id)[0])); System.out.println("Database Server: Ready..."); orb.run(); }
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 ) ; }