Some minor changes and the logic for searching rural houses by the name of the town...
[RRRRHHHH_Code] / ruralHouses / src / businessLogic / RemoteServer.java
1 package businessLogic;
2
3 import java.rmi.Naming;
4 import java.rmi.RMISecurityManager;
5
6 import configuration.Config;
7 import dataAccess.DB4oManager;
8
9 public class RemoteServer {
10
11         public static void main(String[] args) {
12                 Config c=Config.getInstance();
13
14                 System.setProperty("java.security.policy", c.getJavaPolicyPath());
15
16                 //System.setSecurityManager(new RMISecurityManager());
17
18                 try {
19                         java.rmi.registry.LocateRegistry.createRegistry(Integer.parseInt(c.getPortRMI()));
20                         // Create RMIREGISTRY
21                 } catch (Exception e) {
22                         System.out.println(e.toString() + "RMIregistry already running.");
23                 }
24
25                 try {
26                         System.setProperty("java.security.policy", c.getJavaPolicyPath());
27
28                         ApplicationFacadeInterface server = new FacadeImplementation();
29
30                         String service= "//"+c.getServerRMI() +":"+ c.getPortRMI()+"/"+c.getServiceRMI();
31
32                         //Register the remote server
33                         Naming.rebind(service, server);
34                         System.out.println("Running service at:\n\t" + service);
35                         //This operation removes the actual database and initializes it with some predefined values
36
37                 } catch (Exception e) {
38                         System.out.println(e.toString());
39                 }
40         }
41         
42 }