This project has retired. For details please refer to its Attic page.
App xref
View Javadoc
1   /*
2    * Copyright 2001-2008 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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   * Hello world!
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                  //register joe publisher key generator
44                  //register tmodel that's validated
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                  //now try to use it with a valid value
60                  
61                  //try to use it when an invalid value
62  
63          }
64  }