Download | Plain Text | No Line Numbers


  1. /*
  2.  * Copyright (c) 2010, Manuel Mausz. All rights reserved.
  3.  *
  4.  * Redistribution and use in source and binary forms, with or without
  5.  * modification, are permitted provided that the following conditions
  6.  * are met:
  7.  *
  8.  * - Redistributions of source code must retain the above copyright
  9.  * notice, this list of conditions and the following disclaimer.
  10.  *
  11.  * - Redistributions in binary form must reproduce the above copyright
  12.  * notice, this list of conditions and the following disclaimer in the
  13.  * documentation and/or other materials provided with the distribution.
  14.  *
  15.  * - The names of the authors may not be used to endorse or promote products
  16.  * derived from this software without specific prior written permission.
  17.  *
  18.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  19.  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  20.  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  21.  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  22.  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  23.  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  24.  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  25.  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  26.  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  27.  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28.  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29.  */
  30.  
  31. import java.rmi.server.UnicastRemoteObject;
  32. import java.rmi.RemoteException;
  33. import java.util.Date;
  34.  
  35. /*
  36.  * server --> server interface implementation
  37.  *
  38.  * @author Manuel Mausz (0728348)
  39.  */
  40. public class S2SInterfaceImpl
  41. extends UnicastRemoteObject
  42. implements S2SInterface
  43. {
  44. private Server server;
  45.  
  46. /*--------------------------------------------------------------------------*/
  47.  
  48. S2SInterfaceImpl(Server server)
  49. throws RemoteException
  50. {
  51. this.server = server;
  52. }
  53.  
  54. /*--------------------------------------------------------------------------*/
  55.  
  56. public boolean registerPrepare(String user, String servername)
  57. throws RemoteException
  58. {
  59. return server.users.registerPrepare(user, servername);
  60. }
  61.  
  62. /*--------------------------------------------------------------------------*/
  63.  
  64. public boolean registerCommit(String user)
  65. throws RemoteException
  66. {
  67. return server.users.registerCommit(user);
  68. }
  69.  
  70. /*--------------------------------------------------------------------------*/
  71.  
  72. public boolean registerRollback(String user)
  73. throws RemoteException
  74. {
  75. return server.users.registerRollback(user);
  76. }
  77.  
  78. /*--------------------------------------------------------------------------*/
  79.  
  80. public boolean createPrepare(String event, String servername)
  81. throws RemoteException
  82. {
  83. return server.events.createPrepare(event, servername);
  84. }
  85.  
  86. /*--------------------------------------------------------------------------*/
  87.  
  88. public boolean createCommit(String event)
  89. throws RemoteException
  90. {
  91. return server.events.createCommit(event);
  92. }
  93.  
  94. /*--------------------------------------------------------------------------*/
  95.  
  96. public boolean createRollback(String event)
  97. throws RemoteException
  98. {
  99. return server.events.createRollback(event);
  100. }
  101.  
  102. /*--------------------------------------------------------------------------*/
  103.  
  104. public void notifyUser(String user, String msg)
  105. throws RemoteException
  106. {
  107. server.users.notify(user, msg);
  108. }
  109.  
  110. /*--------------------------------------------------------------------------*/
  111.  
  112. public String eventToString(String event)
  113. throws RemoteException
  114. {
  115. return server.events.toString(event);
  116. }
  117.  
  118. /*--------------------------------------------------------------------------*/
  119.  
  120. public void vote(String event, String user, Date[] dates)
  121. throws RemoteException
  122. {
  123. server.events.vote(event, user, dates);
  124. }
  125. }
  126.