1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.juddi.examples.vsv.valuesetvalidator;
17
18 import org.apache.commons.configuration.ConfigurationException;
19 import org.apache.juddi.api.impl.UDDIValueSetValidationImpl;
20 import org.apache.juddi.v3.client.UDDIConstants;
21 import org.apache.juddi.v3.client.config.UDDIClerk;
22 import org.apache.juddi.v3.client.config.UDDIClient;
23 import org.uddi.api_v3.CategoryBag;
24 import org.uddi.api_v3.KeyedReference;
25 import org.uddi.api_v3.Name;
26 import org.uddi.api_v3.TModel;
27
28
29
30
31
32 public class App {
33
34 public static void main(String[] args) throws ConfigurationException {
35 System.out.println("Notice! before running this, build this project and copy the jar file into juddi-tomcat/target/tomcat/apache-tomcat.../juddiv3.war/WEB-INF/lib and restart!");
36
37 System.out.println(UDDIValueSetValidationImpl.convertKeyToClass("uddi:www.bob.com:verified-tmodel"));
38
39
40
41
42
43
44
45 UDDIClient client = new UDDIClient("META-INF/uddi.xml");
46 UDDIClerk clerk = client.getClerk("default");
47 TModel keygen = UDDIClerk.createKeyGenator("www.bob.com", "Bob's Key Generator", "This key generator is used for the jUDDI example Value Set Validator example");
48
49 keygen = clerk.register(keygen).getTModel().get(0);
50
51 TModel verifiedTmodel = new TModel();
52 verifiedTmodel.setTModelKey(keygen.getTModelKey().replace("keygenerator", "verified-tmodel"));
53 verifiedTmodel.setCategoryBag(new CategoryBag());
54
55 verifiedTmodel.getCategoryBag().getKeyedReference().add(new KeyedReference(UDDIConstants.IS_VALIDATED_BY, UDDIConstants.IS_VALIDATED_BY_KEY_NAME, "uddi:juddi.apache.org:servicebindings-valueset-cp"));
56 verifiedTmodel.setName(new Name("Bob's tModel with validation", "en"));
57 verifiedTmodel = clerk.register(verifiedTmodel).getTModel().get(0);
58
59
60
61
62
63 }
64 }