This project has retired. For details please refer to its Attic page.
EntryPoint xref
View Javadoc
1   /*
2    * Copyright 2014 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.samples;
17  
18  import java.io.File;
19  
20  /**
21   *
22   * @author Alex O'Ree
23   */
24  public class EntryPoint {
25  
26          public static void main(String[] args) throws Exception {
27  
28                  if (System.getProperty("javax.net.ssl.trustStore") == null) {
29                          File f = new File("../../juddi-tomcat/truststore.jks");
30                          if (f.exists()) {
31                                  System.setProperty("javax.net.ssl.trustStore", f.getAbsolutePath());
32  
33                          } else {
34                                  f = new File("../juddi-tomcat/truststore.jks");
35                                  if (f.exists()) {
36                                          System.setProperty("javax.net.ssl.trustStore", f.getAbsolutePath());
37  
38                                  } else {
39                                          f = new File("./juddi-tomcat/truststore.jks");
40                                          if (f.exists()) {
41                                                  System.setProperty("javax.net.ssl.trustStore", f.getAbsolutePath());
42  
43                                          }
44                                  }
45                          }
46  
47                          System.setProperty("javax.net.ssl.trustStorePassword", "password");
48                          //System.setProperty("javax.net.ssl.keyStore", "keystore.jks");
49  
50                          //System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
51                  }
52                  //set up trust store
53  
54                  String trustStore = System.getProperty("javax.net.ssl.trustStore");
55                  if (trustStore == null) {
56                          System.out.println("javax.net.ssl.trustStore is not defined");
57                  } else {
58                          System.out.println("javax.net.ssl.trustStore = " + trustStore);
59                  }
60  
61                  if (System.getProperty("javax.net.ssl.keyStore") == null) {
62                          File f = new File("../../juddi-tomcat/keystore.jks");
63                          if (f.exists()) {
64                                  System.setProperty("javax.net.ssl.keyStore", f.getAbsolutePath());
65  
66                          } else {
67                                  f = new File("../juddi-tomcat/keyStore.jks");
68                                  if (f.exists()) {
69                                          System.setProperty("javax.net.ssl.keyStore", f.getAbsolutePath());
70  
71                                  } else {
72                                          f = new File("./juddi-tomcat/keystore.jks");
73                                          if (f.exists()) {
74                                                  System.setProperty("javax.net.ssl.keyStore", f.getAbsolutePath());
75  
76                                          }
77                                  }
78                          }
79  
80                          System.setProperty("javax.net.ssl.keyStorePassword", "password");
81                          //System.setProperty("javax.net.ssl.keyStore", "keystore.jks");
82  
83                          //System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
84                  }
85                  //set up trust store
86  
87                  String keyStore = System.getProperty("javax.net.ssl.trustStore");
88                  if (keyStore == null) {
89                          System.out.println("javax.net.ssl.keyStore is not defined");
90                  } else {
91                          System.out.println("javax.net.ssl.keyStore = " + trustStore);
92                  }
93                  //first menu
94                  //connect to a node and do work on it
95                  //multinode 
96                  String input = null;
97                  do {
98                          System.out.println("____________________________");
99                          System.out.println("jUDDI Interactive Command Line Interface");
100                         System.out.println("____________________________");
101                         System.out.println(" 1) Connect and login to a Node");
102                         System.out.println(" 2) Multinode and Replication commands");
103                         System.out.println(" 3) Offline code examples");
104                         System.out.println(" q) Quit/exit");
105                         System.out.print("jUDDI Main# ");
106                         input = System.console().readLine();
107                         if ("1".equals(input)) {
108                                 goSingleNode();
109                         } else if ("2".equals(input)) {
110                                 goMultiNode();
111                         } else if ("3".equals(input)) {
112                                 goOfflineExamples();
113                         }
114                 } while (!"q".equalsIgnoreCase(input));
115         }
116 
117         static void goMultiNode() throws Exception {
118                 EntryPoitMultiNode.goMultiNode();
119         }
120 
121         static void goSingleNode() throws Exception {
122                 EntryPointSingleNode.goSingleNode();
123 
124         }
125 
126         private static void goOfflineExamples() throws Exception {
127                 String input = null;
128                 do {
129                         System.out.println("____________________________");
130                         System.out.println("Offline/Code Examples (you'll want to look at the source for some of these");
131                         System.out.println("____________________________");
132                         System.out.println(" 1) Compare Two Binding/tModelInstanceInfo - QOS Code Example");
133                         System.out.println("2) Digitally sign a UDDI entity from a file.");
134                         System.out.println(" q) Quit/exit");
135                         System.out.print("#");
136                         input = System.console().readLine();
137                         processOffline(input);
138                 } while (!"q".equalsIgnoreCase(input));
139 
140         }
141 
142         private static void processOffline(String input) throws Exception {
143                 if ("1".equals(input)) {
144                         CompareByTModelInstanceInfoQOS.main(new String[0]);
145                 }
146                 if ("2".equals(input)) {
147                         new UddiDigitalSignatureFile().fire(null, null, null);
148                 }
149         }
150 
151 }