View Javadoc

1   /*
2    *
3    * <cvs:source>$Source: /devel/astrogrid/filestore/client/src/java/org/astrogrid/filestore/client/FileStoreSoapDelegate.java,v $</cvs:source>
4    * <cvs:author>$Author: dave $</cvs:author>
5    * <cvs:date>$Date: 2004/09/17 06:57:10 $</cvs:date>
6    * <cvs:version>$Revision: 1.5 $</cvs:version>
7    * <cvs:log>
8    *   $Log: FileStoreSoapDelegate.java,v $
9    *   Revision 1.5  2004/09/17 06:57:10  dave
10   *   Added commons logging to FileStore.
11   *   Updated logging properties in Community.
12   *   Fixed bug in AGINAB deployment.
13   *   Removed MySpace tests with hard coded grendel address.
14   *
15   *   Revision 1.4.56.1  2004/09/17 01:08:36  dave
16   *   Updated debug to use commons logging API ....
17   *
18   *   Revision 1.4  2004/07/23 15:17:30  dave
19   *   Merged development branch, dave-dev-200407231013, into HEAD
20   *
21   *   Revision 1.3.10.1  2004/07/23 15:04:46  dave
22   *   Added delegate resolver and tests
23   *
24   *   Revision 1.3  2004/07/19 23:42:07  dave
25   *   Merged development branch, dave-dev-200407151443, into HEAD
26   *
27   *   Revision 1.2.4.1  2004/07/19 19:40:28  dave
28   *   Debugged and worked around Axis Exception handling
29   *
30   *   Revision 1.2  2004/07/14 13:50:29  dave
31   *   Merged development branch, dave-dev-200406301228, into HEAD
32   *
33   *   Revision 1.1.2.1  2004/07/06 10:49:45  dave
34   *   Added SOAP delegate
35   *
36   *   Revision 1.1.2.1  2004/07/06 09:16:12  dave
37   *   Added delegate interface and mock implementation
38   * </cvs:log>
39   *
40   */
41  package org.astrogrid.filestore.client ;
42  
43  import org.apache.commons.logging.Log ;
44  import org.apache.commons.logging.LogFactory ;
45  
46  import java.net.URL ;
47  import java.net.MalformedURLException ;
48  
49  import org.astrogrid.filestore.common.FileStore ;
50  import org.astrogrid.filestore.common.FileStoreMock ;
51  import org.astrogrid.filestore.common.FileStoreService ;
52  import org.astrogrid.filestore.common.FileStoreServiceLocator ;
53  
54  /***
55   * A SOAP client implementation of the delegate interface.
56   *
57   */
58  public class FileStoreSoapDelegate
59  	extends FileStoreCoreDelegate
60  	{
61      /***
62       * Our debug logger.
63       *
64       */
65      private static Log log = LogFactory.getLog(FileStoreSoapDelegate.class);
66  
67      /***
68       * Our FileStore service locator.
69       *
70       */
71      private FileStoreService locator = new FileStoreServiceLocator() ;
72  
73      /***
74       * Our endpoint address.
75       *
76       */
77      private URL endpoint ;
78  
79      /***
80       * Get our endpoint address.
81       *
82       */
83      public URL getEndpoint()
84          {
85          return this.endpoint ;
86          }
87  
88      /***
89       * Public constructor, for a specific endpoint URL.
90       * @param endpoint The service endpoint URL.
91       * @todo Trap null param.
92       * @todo Trap MalformedURLException.
93       *
94       */
95      public FileStoreSoapDelegate(String endpoint)
96          throws MalformedURLException
97          {
98          this(new URL(endpoint)) ;
99          }
100 
101     /***
102      * Public constructor, for a specific endpoint URL.
103      * @param endpoint The service endpoint URL.
104      * @todo Better Exception handling.
105      * @todo Trap null param.
106      *
107      */
108     public FileStoreSoapDelegate(URL endpoint)
109         {
110         super() ;
111         log.debug("") ;
112         log.debug("----\"----") ;
113         log.debug("FileStoreSoapDelegate()") ;
114         log.debug("  URL : '" + endpoint + "'") ;
115         //
116         // Check for null param.
117         if (null == endpoint)
118             {
119             throw new IllegalArgumentException(
120                 "Null endpoint"
121                 ) ;
122             }
123         //
124         // Set our endpoint address.
125         this.endpoint = endpoint ;
126         //
127         // Try locate our service instance.
128         try {
129             this.service = locator.getFileStore(
130 	            this.endpoint
131 	            ) ;
132             }
133         //
134         // Catch anything that went BANG.
135         catch (Exception ouch)
136             {
137             // TODO
138             // Log the Exception, and throw a nicer one.
139             // Unwrap RemoteExceptions.
140             //
141             }
142         }
143 	}
144