1 package org.dbe.studio.tools.ssl2sdl.util;
2
3 import java.net.URL;
4 import java.util.Collection;
5
6 import org.sun.dbe.ClientHelper;
7 import org.dbe.kb.service.KBI;
8 import org.dbe.kb.service.SRI;
9
10 public class OntologyDatas
11 {
12
13 public static SRI getSRI(String serventURL) throws Exception
14 {
15 if ( serventURL == null || serventURL.trim().length() == 0 ) throw new Exception("ServentURL is null");
16
17 if ( !serventURL.toLowerCase().startsWith("http://") )
18 serventURL = "http://" + serventURL;
19
20 ClientHelper ch = new ClientHelper (new URL (serventURL));
21 SRI service = (SRI) ch.getProxy (SRI.class, new String [] {"SR"});
22
23 return service;
24 }
25
26 public static String publish(String sm, String serventURL) throws Exception
27 {
28 return getSRI(serventURL).publishSM(sm);
29 }
30
31 public static Collection listSMs(String serventURL) throws Exception
32 {
33 return getSRI(serventURL).listSMs();
34 }
35
36 public static Collection listODMModels(String serventURL) throws Exception
37 {
38 return getSRI(serventURL).listODMmodels();
39 }
40
41 public static KBI getKBI(String serventURL) throws Exception
42 {
43 ClientHelper ch = new ClientHelper(new URL(serventURL));
44 return (KBI) ch.getProxy(KBI.class,new String[]{"KB"});
45 }
46
47 public static Collection listBMLMs(KBI kbi)
48 {
49 return kbi.listBMLmodels();
50 }
51
52 public static Collection listBMLMs(String serventURL) throws Exception
53 {
54 return listBMLMs(getKBI(serventURL));
55 }
56
57 public static String getBML(String serventURL, String bmlId) throws Exception
58 {
59 return getKBI(serventURL).retrieveBML(bmlId);
60 }
61
62 public static Collection listSDLMs(KBI kbi)
63 {
64 return kbi.listSDLmodels();
65 }
66
67 public static Collection listBMLDs(KBI kbi)
68 {
69 return kbi.listIMMmodels();
70 }
71
72 public static Collection listSDLMs(String serventURL) throws Exception
73 {
74 return listSDLMs(getKBI(serventURL));
75 }
76
77 public static String getSDLModel(String serventURL, String sdlModelId) throws Exception
78 {
79 return getKBI(serventURL).retrieveSDLmodel(sdlModelId);
80 }
81
82 public static Collection listBMLDs(String serventURL) throws Exception
83 {
84 return listBMLDs(getKBI(serventURL));
85 }
86
87 public static String getBMLData(String serventURL, String bmlDataId) throws Exception
88 {
89 return getKBI(serventURL).retrieveIMMmodel(bmlDataId);
90 }
91
92 public static String getSM(String serventURL, String smId) throws Exception
93 {
94 return getSRI(serventURL).getSM(smId);
95 }
96
97 public static String getODMModel(String serventURL, String smId) throws Exception
98 {
99 return getKBI(serventURL).retrieveODMmodel(smId);
100 }
101
102
103
104
105
106
107
108
109
110
111
112
113 }