Javadoc fixes
[jabaws.git] / webservices / compbio / ws / server / SimpleWSPublisher.java
1 /* Copyright (c) 2011 Peter Troshin\r
2  *  \r
3  *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0     \r
4  * \r
5  *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
6  *  Apache License version 2 as published by the Apache Software Foundation\r
7  * \r
8  *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
9  *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
10  *  License for more details.\r
11  * \r
12  *  A copy of the license is in apache_license.txt. It is also available here:\r
13  * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
14  * \r
15  * Any republication or derived work distributed in source code form\r
16  * must include this copyright and license notice.\r
17  */\r
18 \r
19 package compbio.ws.server;\r
20 \r
21 import javax.jws.WebService;\r
22 import javax.xml.ws.Endpoint;\r
23 \r
24 /**\r
25  * This class publish a web service. This is not a production implementation.\r
26  * Should be used only for during development and testing\r
27  * \r
28  * @author pvtroshin\r
29  * @date October 2009\r
30  */\r
31 @Deprecated\r
32 public class SimpleWSPublisher {\r
33 \r
34         public SimpleWSPublisher(Object exec, String context) {\r
35 \r
36         }\r
37 \r
38         public static void main(String[] args) {\r
39                 if (args.length != 2) {\r
40                         System.out.println("Usage: ");\r
41                         System.out.println("SimpleWSPublisher context class");\r
42                         System.out\r
43                                         .println("where context is a context name, the name after the address by "\r
44                                                         + "which web service can be called e.g. Clustal "\r
45                                                         + " and class is a web service implementation class");\r
46 \r
47                 }\r
48                 String context = args[0];\r
49                 String clazzName = args[1];\r
50                 try {\r
51                         Class<?> clazz = Class.forName(clazzName);\r
52                         if (!clazz.isAnnotationPresent(WebService.class)) {\r
53                                 System.out.println("Can only start web services. "\r
54                                                 + "Please check whether the class provided is "\r
55                                                 + "annotated with Webservice annotation");\r
56                                 System.exit(1);\r
57                         }\r
58                         Endpoint.publish("http://127.0.0.1:7979/" + context,\r
59                                         clazz.newInstance());\r
60                 } catch (InstantiationException e) {\r
61                         e.printStackTrace();\r
62                         System.exit(1);\r
63                 } catch (IllegalAccessException e) {\r
64                         e.printStackTrace();\r
65                         System.exit(1);\r
66                 } catch (ClassNotFoundException e) {\r
67                         e.printStackTrace();\r
68                         System.exit(1);\r
69                 } catch (IllegalArgumentException e) {\r
70                         e.printStackTrace();\r
71                         System.exit(1);\r
72                 }\r
73         }\r
74 }\r