View Javadoc

1   /*
2    * <cvs:source>$Source: /devel/astrogrid/community/client/src/java/org/astrogrid/community/client/policy/manager/PolicyManagerSoapDelegate.java,v $</cvs:source>
3    * <cvs:author>$Author: dave $</cvs:author>
4    * <cvs:date>$Date: 2004/09/16 23:18:08 $</cvs:date>
5    * <cvs:version>$Revision: 1.8 $</cvs:version>
6    *
7    * <cvs:log>
8    *   $Log: PolicyManagerSoapDelegate.java,v $
9    *   Revision 1.8  2004/09/16 23:18:08  dave
10   *   Replaced debug logging in Community.
11   *   Added stream close() to FileStore.
12   *
13   *   Revision 1.7.82.1  2004/09/16 09:58:48  dave
14   *   Replaced debug with commons logging ....
15   *
16   *   Revision 1.7  2004/06/18 13:45:19  dave
17   *   Merged development branch, dave-dev-200406081614, into HEAD
18   *
19   *   Revision 1.6.32.3  2004/06/17 15:10:03  dave
20   *   Removed unused imports (PMD report).
21   *
22   *   Revision 1.6.32.2  2004/06/17 13:38:58  dave
23   *   Tidied up old CVS log entries
24   *
25   * </cvs:log>
26   *
27   */
28  package org.astrogrid.community.client.policy.manager ;
29  
30  import org.apache.commons.logging.Log ;
31  import org.apache.commons.logging.LogFactory ;
32  
33  import java.net.URL ;
34  import java.net.MalformedURLException ;
35  
36  import org.astrogrid.community.common.policy.manager.PolicyManagerService ;
37  import org.astrogrid.community.common.policy.manager.PolicyManagerServiceLocator ;
38  
39  /***
40   * Soap delegate for our PolicyManager service.
41   *
42   */
43  public class PolicyManagerSoapDelegate
44      extends PolicyManagerCoreDelegate
45      implements PolicyManagerDelegate
46      {
47      /***
48       * Our debug logger.
49       *
50       */
51      private static Log log = LogFactory.getLog(PolicyManagerSoapDelegate.class);
52  
53      /***
54       * Our PolicyManager locator.
55       *
56       */
57      private PolicyManagerService locator = new PolicyManagerServiceLocator() ;
58  
59      /***
60       * Our endpoint address.
61       *
62       */
63      private URL endpoint ;
64  
65      /***
66       * Get our endpoint address.
67       *
68       */
69      public URL getEndpoint()
70          {
71          return this.endpoint ;
72          }
73  
74      /***
75       * Public constructor, for a specific endpoint URL.
76       * @param endpoint The service endpoint URL.
77       * @todo Trap null param.
78       * @todo Trap MalformedURLException.
79       *
80       */
81      public PolicyManagerSoapDelegate(String endpoint)
82          throws MalformedURLException
83          {
84          this(new URL(endpoint)) ;
85          }
86  
87      /***
88       * Public constructor, for a specific endpoint URL.
89       * @param endpoint The service endpoint URL.
90       * @todo Better Exception handling.
91       * @todo Trap null param.
92       *
93       */
94      public PolicyManagerSoapDelegate(URL endpoint)
95          {
96          super() ;
97          log.debug("") ;
98          log.debug("----\"----") ;
99          log.debug("PolicyManagerSoapDelegate()") ;
100         log.debug("  URL : " + endpoint) ;
101         //
102         // Check for null param.
103         if (null == endpoint)
104             {
105             throw new IllegalArgumentException(
106                 "Null endpoint"
107                 ) ;
108             }
109         //
110         // Set our endpoint address.
111         this.endpoint = endpoint ;
112         //
113         // Try getting our PolicyManager.
114         try {
115             this.setPolicyManager(
116                 locator.getPolicyManager(
117                     this.endpoint
118                     )
119                 ) ;
120             }
121         //
122         // Catch anything that went BANG.
123         catch (Exception ouch)
124             {
125             // TODO
126             // Log the Exception, and throw a nicer one.
127             // Unwrap RemoteExceptions.
128             //
129             }
130         }
131     }