1 package com.daffodilwoods.rmi; 2 3 import java.rmi.*; 4 import java.util.*; 5 import com.daffodilwoods.daffodildb.server.serversystem.*; 6 import com.daffodilwoods.database.resource.*; 7 import com.daffodilwoods.rmi.interfaces.*; 8 9 public class RmiServer implements _Server { 10 11 _RmiServer rmiServerSystem_interface; 12 13 public RmiServer(_RmiServer rmiServerSystem_interface) { 14 this.rmiServerSystem_interface = rmiServerSystem_interface; 15 } 16 17 public _Connection getConnection(String databaseName, Properties prop) throws DException { 18 try { 19 return new RmiConnection(rmiServerSystem_interface.getConnection(databaseName, prop)); 20 } catch (RemoteException re) { 21 throw new RuntimeException (re.getMessage()); 22 } 23 } 24 25 public _User getUser(String userName, String password) throws DException { 26 try { 27 return new RmiUser(rmiServerSystem_interface.getUser(userName, password)); 28 } catch (RemoteException re) { 29 throw new RuntimeException (re.getMessage()); 30 } 31 } 32 33 public String getHostName() { 34 try { 35 return rmiServerSystem_interface.getHostName(); 36 } catch (RemoteException re) { 37 throw new RuntimeException (re.getMessage()); 38 } 39 } 40 41 public int getPortNumber() { 42 try { 43 return rmiServerSystem_interface.getPortNumber(); 44 } catch (RemoteException re) { 45 throw new RuntimeException (re.getMessage()); 46 } 47 } 48 49 public _DXAResource getDxaResource() throws DException { 50 try { 51 return new RmiDXAResource(rmiServerSystem_interface.getDxaResource()); 52 } catch (RemoteException re) { 53 throw new RuntimeException (re.getMessage()); 54 } 55 } 56 57 public boolean isValidUser(String userName, String password) throws DException { 58 try { 59 return rmiServerSystem_interface.isValidUser(userName, password); 60 } catch (RemoteException re) { 61 throw new RuntimeException (re.getMessage()); 62 } 63 } 64 65 public void changeHome(String home) throws DException{ 66 try { 67 rmiServerSystem_interface.changeHome(home); 68 } catch (RemoteException re) { 69 throw new RuntimeException (re.getMessage()); 70 } 71 } 72 73 public void addSchedule(String databaseName, String scheduleName, 74 String timeIntervalForBackup, String backupType, 75 String backupPath, String databaseNameForBackup, 76 long lastBackupTime) throws DException { 77 try { 78 rmiServerSystem_interface.addSchedule(databaseName, scheduleName, 79 timeIntervalForBackup, backupType, 80 backupPath, databaseNameForBackup, 81 lastBackupTime 82 ); 83 } 84 catch (RemoteException re) { 85 throw new RuntimeException (re.getMessage()); 86 } 87 88 } 89 90 public void getInconsistentOnlineBackup(String destination, 91 String databaseNameSource, 92 String databaseNameDestination, 93 boolean overwrite) throws DException { 94 try { 95 rmiServerSystem_interface.getInconsistentOnlineBackup( destination, 96 databaseNameSource, 97 databaseNameDestination, 98 overwrite); 99 } 100 catch (RemoteException re) { 101 throw new RuntimeException (re.getMessage()); 102 } 103 104 105 } 106 107 public ArrayList getAllDatabases(String userName) throws DException { 108 109 try { 110 return rmiServerSystem_interface.getAllDatabases(userName); 111 } 112 catch (RemoteException re) { 113 throw new RuntimeException (re.getMessage()); 114 } 115 116 } 117 118 119 public void offlineBackup(String userName, String password, 120 String destination, String databaseNameSource, 121 String databaseNameDestination, boolean overwrite) throws 122 DException { 123 try { 124 rmiServerSystem_interface.offlineBackup(userName, password, 125 destination, databaseNameSource,databaseNameDestination, overwrite); 126 } 127 catch (RemoteException re) { 128 throw new RuntimeException (re.getMessage()); 129 } 130 } 131 132 public ArrayList getScheduleForDatabase(String databaseName) throws 133 DException{ 134 try { 135 return rmiServerSystem_interface.getScheduleForDatabase(databaseName); 136 } 137 catch (RemoteException re) { 138 throw new RuntimeException (re.getMessage()); 139 } 140 141 } 142 143 public void dropSchedule(String scheduleName) throws DException{ 144 try { 145 rmiServerSystem_interface.dropSchedule(scheduleName); 146 } 147 catch (RemoteException re) { 148 throw new RuntimeException (re.getMessage()); 149 } 150 } 151 152 public void restore(String userName, String password,String sourcePath, 153 String databaseNameSource, 154 String databaseNameDestination, boolean overwrite) throws 155 DException { 156 try { 157 rmiServerSystem_interface.restore(userName, password,sourcePath, 158 databaseNameSource,databaseNameDestination, overwrite); 159 } 160 catch (RemoteException re) { 161 throw new RuntimeException (re.getMessage()); 162 } 163 } 164 165 public void restoreSaveMode(String oldDBName, String newdbName) 166 throws DException { 167 try { 168 rmiServerSystem_interface.restoreSaveMode(oldDBName, newdbName); 169 } 170 catch (RemoteException re) { 171 throw new RuntimeException (re.getMessage()); 172 } 173 } 174 175 } 176 | Popular Tags |