1. /*
  2. * @(#)POAPolicyMediatorFactory.java 1.21 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.corba.se.impl.oa.poa ;
  8. abstract class POAPolicyMediatorFactory {
  9. // create an appropriate policy mediator based on the policies.
  10. // Note that the policies object has already been validated before
  11. // this call, so it can only contain valid combinations of POA policies.
  12. static POAPolicyMediator create( Policies policies, POAImpl poa )
  13. {
  14. if (policies.retainServants()) {
  15. if (policies.useActiveMapOnly())
  16. return new POAPolicyMediatorImpl_R_AOM( policies, poa ) ;
  17. else if (policies.useDefaultServant())
  18. return new POAPolicyMediatorImpl_R_UDS( policies, poa ) ;
  19. else if (policies.useServantManager())
  20. return new POAPolicyMediatorImpl_R_USM( policies, poa ) ;
  21. else
  22. throw poa.invocationWrapper().pmfCreateRetain() ;
  23. } else {
  24. if (policies.useDefaultServant())
  25. return new POAPolicyMediatorImpl_NR_UDS( policies, poa ) ;
  26. else if (policies.useServantManager())
  27. return new POAPolicyMediatorImpl_NR_USM( policies, poa ) ;
  28. else
  29. throw poa.invocationWrapper().pmfCreateNonRetain() ;
  30. }
  31. }
  32. }