View Javadoc

1   package fr.in2p3.jsaga.engine.factories;
2   
3   import fr.in2p3.jsaga.adaptor.security.SecurityAdaptor;
4   import fr.in2p3.jsaga.engine.descriptors.AdaptorDescriptors;
5   import fr.in2p3.jsaga.engine.descriptors.SecurityAdaptorDescriptor;
6   import org.ogf.saga.error.NoSuccessException;
7   
8   /* ***************************************************
9   * *** Centre de Calcul de l'IN2P3 - Lyon (France) ***
10  * ***             http://cc.in2p3.fr/             ***
11  * ***************************************************
12  * File:   SecurityAdaptorFactory
13  * Author: Sylvain Reynaud (sreynaud@in2p3.fr)
14  * Date:   15 juin 2007
15  * ***************************************************
16  * Description:                                      */
17  /**
18   * Create and manage security adaptors
19   */
20  public class SecurityAdaptorFactory {
21      private SecurityAdaptorDescriptor m_descriptor;
22  
23      public SecurityAdaptorFactory(AdaptorDescriptors descriptors) {
24          m_descriptor = descriptors.getSecurityDesc();
25      }
26  
27      public SecurityAdaptor getSecurityAdaptor(String type) throws NoSuccessException {
28          // create instance
29          Class clazz = m_descriptor.getAdaptorClass(type);
30          SecurityAdaptor adaptor;
31          try {
32              adaptor = (SecurityAdaptor) clazz.newInstance();
33          } catch (Exception e) {
34              throw new NoSuccessException(e);
35          }
36          return adaptor;
37      }
38  }