1 package org.astrogrid.scripting;
2
3 import org.astrogrid.community.User;
4 import org.astrogrid.config.Config;
5 import org.astrogrid.config.SimpleConfig;
6 import org.astrogrid.portal.workflow.intf.WorkflowInterfaceException;
7 import org.astrogrid.portal.workflow.intf.WorkflowManager;
8 import org.astrogrid.portal.workflow.intf.WorkflowManagerFactory;
9 import org.astrogrid.registry.client.RegistryDelegateFactory;
10 import org.astrogrid.registry.client.query.RegistryService;
11 import org.astrogrid.store.VoSpaceClient;
12
13 import org.apache.commons.logging.Log;
14 import org.apache.commons.logging.LogFactory;
15 import org.xml.sax.SAXException;
16
17 import java.io.IOException;
18 import java.net.MalformedURLException;
19 import java.net.URL;
20
21 /***
22 * Top level object of the astrogrid scripting model<p />
23 *
24 * Create an instance of this class within your scripting language<p/>
25 *
26 * <h2>Features</h2>
27 * <h3>Service Discovery</h3>
28 * This class extends {@link Services}, which maintains lists of the different kinds of astrogrid services, and create delegates as needed.
29 * <h3>Configured Registry Delegate and Store Client</h3>
30 * This class provides simple access to the default registy and store services.
31 * <h3>Workflow Manager</h3>
32 * This class provides helper methods to build workflow documents, submit them to jes servers, and view results
33 * <h3>XML Utilities</h3>
34 * Provides helper methods to parse strings and inputStreams into {@link org.w3c.dom.Document}, and convert Documents and Elements back into
35 * String.
36 * <h3>Datacenter Query Utilities</h3>
37 * Provides methods to convert sql strings and ADQL queries into the correct format.
38 * <h3>Object creation utilties</h3>
39 * Provides helper methods to create some of the kinds of objects used in the astrogrid system.
40 *
41 * @see Services
42 * @see Service
43 * @deprecated. Use Toolbox
44 * @author Noel Winstanley nw@jb.man.ac.uk 27-Jan-2004
45 *
46 */
47 public class Astrogrid extends Services {
48 /***
49 * Commons Logger for this class
50 */
51 private static final Log logger = LogFactory.getLog(Astrogrid.class);
52
53
54 /*** construct a new astrogrid object, using the default service document
55 * <p>
56 * Use {@link #getInstance()} instead if your scripting language supports this.
57 * @throws IOException
58 * @throws SAXException
59 */
60 public Astrogrid() throws IOException, SAXException {
61 super();
62 }
63 /*** construct a new astrogrid object, using the service document at the specified url
64 * <p>
65 * Use {@link #getInstance(java.net.URL)} instead if your scripting language supports static methods
66 * @param url location of service document
67 * @throws IOException
68 * @throws SAXException
69 */
70 public Astrogrid(URL url) throws IOException, SAXException {
71 super(url);
72 }
73 public Astrogrid(String url) throws MalformedURLException, IOException, SAXException {
74 super(url);
75 }
76 /*** access the singleton astrogrid object, initializaing if necessary
77 * */
78 public synchronized static Astrogrid getInstance() {
79 if (theInstance == null) {
80 try {
81 theInstance = new Astrogrid();
82 } catch (Exception e) {
83 logger.error("Could not initialize Astrogrid object",e);
84 }
85 }
86 return theInstance;
87 }
88 /*** create the singleton astorgrid object, using service document at the given url */
89 public synchronized static Astrogrid getInstance(URL url) {
90 try {
91 theInstance = new Astrogrid(url);
92 } catch (Exception e) {
93 logger.error("Could not inizitalize Astrogrid object from url:" + url.toString(),e);
94 }
95 return theInstance;
96 }
97 /*** create the singleton astorgrid object, using service document at the given url */
98 public synchronized static Astrogrid getInstance(String url) {
99 try {
100 theInstance = new Astrogrid(url);
101 } catch (Exception e) {
102 logger.error("Could not inizitalize Astrogrid object from url:" + url.toString(),e);
103 }
104 return theInstance;
105 }
106
107 private static Astrogrid theInstance;
108
109
110
111 public String toString() {
112 return "Astrogrid root object:\n"+ super.toString();
113 }
114
115
116 }