package jacorb.orb.domain;
/**
 * PolicyFactoryImpl.java
 * The implementation of the IDL-interface PolicyFactory
 *
 * Created: Mon Mar 27 16:32:08 2000
 *
 * @author Herbert Kiefer
 * @version $Revision: 1.1 $
 */

public class PolicyFactoryImpl extends jacorb.orb.domain.PolicyFactoryPOA 
{
  
  public PolicyFactoryImpl() 
  {
    
  }
  
  public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any initValue)
  {
    switch (type)
      {
      case CONFLICT_RESOLUTION_POLICY_ID.value: return createConflictResolutionPolicy
				      (ConflictResolutionPolicy.SIMPLE);
      default: throw new org.omg.CORBA.BAD_PARAM("PolicyFactory: type "+ type + " not supported.");

      }
  }
  public jacorb.orb.domain.InitialMapPolicy createInitialMapPolicy(short whichOne)
  {
    return null;
  }
  public jacorb.orb.domain.ConflictResolutionPolicy createConflictResolutionPolicy(short whichOne)
  {
    switch (whichOne)
      {
      case ConflictResolutionPolicy.SIMPLE: 
	try 
	  {
	    return ConflictResolutionPolicyHelper.narrow
	      (_poa().servant_to_reference( new ConflictResolutionPolicyPOATie
					    ( new SimpleConflictResolutionPolicy() ) ));
	  }
	catch (org.omg.PortableServer.POAPackage.WrongPolicy wp) 
	  {
	    jacorb.util.Debug.output(1, "the poa of this domain(" + this 
	         +") has the wrong policies for \"servant_to_reference\".");
	  }
	catch (Exception e)
	  {
	    jacorb.util.Debug.output(1, e);
	  }
	finally { return null; }
	// break
      default: throw new org.omg.CORBA.BAD_PARAM("PolicyFactory: value "+ whichOne + " not valid.");
	
      }
  }
} // PolicyFactoryImpl
