VersiĆ³n del proyecto de Apuestas tras la iteraciĆ³n 1
[ISBets21MAUBRY] / eclipse-workspace / ISBets21BRYMAUJONUNA / src / main / java / gui / ApplicationLauncher.java
1 package gui;
2
3 import java.net.URL;
4 import java.util.Locale;
5
6 import javax.swing.UIManager;
7 import javax.xml.namespace.QName;
8 import javax.xml.ws.Service;
9
10 import businessLogic.BLFacade;
11 import businessLogic.BLFacadeImplementation;
12 import configuration.ConfigXML;
13 import dataAccess.DataAccess;
14
15 public class ApplicationLauncher {
16
17         public static void main(String[] args) {
18
19                 ConfigXML c = ConfigXML.getInstance();
20
21                 System.out.println(c.getLocale());
22
23                 Locale.setDefault(new Locale(c.getLocale()));
24
25                 System.out.println("Locale: " + Locale.getDefault());
26
27                 LoginGUI a = new LoginGUI();
28                 a.setVisible(true);
29
30                 try {
31
32                         BLFacade appFacadeInterface;
33 //                      UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel");
34 //                      UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
35                         UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
36
37                         if (c.isBusinessLogicLocal()) {
38
39                                 // In this option the DataAccess is created by FacadeImplementationWS
40                                 // appFacadeInterface=new BLFacadeImplementation();
41
42                                 // In this option, you can parameterize the DataAccess (e.g. a Mock DataAccess
43                                 // object)
44
45                                 DataAccess da = new DataAccess(c.getDataBaseOpenMode().equals("initialize"));
46                                 appFacadeInterface = new BLFacadeImplementation(da);
47
48                         }
49
50                         else { // If remote
51
52                                 String serviceName = "http://" + c.getBusinessLogicNode() + ":" + c.getBusinessLogicPort() + "/ws/"
53                                                 + c.getBusinessLogicName() + "?wsdl";
54
55                                 // URL url = new URL("http://localhost:9999/ws/ruralHouses?wsdl");
56                                 URL url = new URL(serviceName);
57
58                                 // 1st argument refers to wsdl document above
59                                 // 2nd argument is service name, refer to wsdl document above
60 //                      QName qname = new QName("http://businessLogic/", "FacadeImplementationWSService");
61                                 QName qname = new QName("http://businessLogic/", "BLFacadeImplementationService");
62
63                                 Service service = Service.create(url, qname);
64
65                                 appFacadeInterface = service.getPort(BLFacade.class);
66                         }
67                         /*
68                          * if (c.getDataBaseOpenMode().equals("initialize"))
69                          * appFacadeInterface.initializeBD();
70                          */
71                         LoginGUI.setBusinessLogic(appFacadeInterface);
72
73                 } catch (Exception e) {
74 //                      a.jLabelSelectOption.setText("Error: " + e.toString());
75 //                      a.jLabelSelectOption.setForeground(Color.RED);
76
77                         System.out.println("Error in ApplicationLauncher: " + e.toString());
78                 }
79                 // a.pack();
80
81         }
82
83 }