1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 package org.astrogrid.filemanager.client.delegate ;
33
34 import java.net.URL;
35 import java.net.MalformedURLException;
36
37 import org.apache.commons.logging.Log ;
38 import org.apache.commons.logging.LogFactory ;
39
40 import org.astrogrid.filemanager.common.FileManager;
41 import org.astrogrid.filemanager.common.FileManagerConfig;
42 import org.astrogrid.filemanager.common.ivorn.FileManagerIvornFactory;
43
44 import org.astrogrid.filemanager.common.FileManagerService;
45 import org.astrogrid.filemanager.common.FileManagerServiceLocator;
46
47
48 import org.astrogrid.filestore.resolver.FileStoreDelegateResolver ;
49
50 /***
51 * The core implementation for the FileManager delegate.
52 *
53 */
54 public class FileManagerSoapDelegate
55 extends FileManagerCoreDelegate
56 implements FileManagerDelegate
57 {
58 /***
59 * Our debug logger.
60 *
61 */
62 protected static Log log = LogFactory.getLog(FileManagerSoapDelegate.class);
63
64 /***
65 * Our FileStore service locator.
66 *
67 */
68 private static FileManagerService locator = new FileManagerServiceLocator() ;
69
70 /***
71 * Public constructor, for a specific endpoint URL.
72 * @param endpoint The service endpoint URL.
73 * @todo Trap MalformedURLException.
74 *
75 */
76 public FileManagerSoapDelegate(String endpoint)
77 throws MalformedURLException
78 {
79 this(
80 new URL(
81 endpoint
82 )
83 ) ;
84 }
85
86 /***
87 * Public constructor, for a specific endpoint URL.
88 * @param endpoint The service endpoint URL.
89 * @todo Better Exception handling.
90 *
91 */
92 public FileManagerSoapDelegate(URL endpoint)
93 {
94 super(
95 wrapper(
96 endpoint
97 )
98 ) ;
99 }
100
101 /***
102 * Locate a SOAP client for an endpoint URL.
103 *
104 */
105 private static FileManager wrapper(URL endpoint)
106 {
107 log.debug("") ;
108 log.debug("FileManagerSoapDelegate.wrapper(URL)") ;
109 log.debug(" URL : '" + endpoint + "'") ;
110
111
112 if (null == endpoint)
113 {
114 throw new IllegalArgumentException(
115 "Null endpoint"
116 ) ;
117 }
118
119
120 try {
121 return locator.getFileManager(
122 endpoint
123 ) ;
124 }
125
126
127 catch (Exception ouch)
128 {
129
130
131
132
133 return null ;
134 }
135 }
136 }