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
10
11
12
13
14
15
16
17
18
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
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 }