001/** 002 * Copyright (C) 2014 Universidade de Aveiro, DETI/IEETA, Bioinformatics Group - http://bioinformatics.ua.pt/ 003 * 004 * This file is part of Dicoogle/dicoogle. 005 * 006 * Dicoogle/dicoogle is free software: you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation, either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * Dicoogle/dicoogle is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with Dicoogle. If not, see <http://www.gnu.org/licenses/>. 018 */ 019package pt.ua.dicoogle.rGUI.client.UIHelper; 020 021import java.rmi.RemoteException; 022import java.rmi.server.RMISocketFactory; 023import java.rmi.server.UnicastRemoteObject; 024import java.util.concurrent.Semaphore; 025import org.slf4j.Logger; 026import org.slf4j.LoggerFactory; 027import org.slf4j.Logger; 028import org.slf4j.LoggerFactory; 029import pt.ua.dicoogle.rGUI.MultihomeRMIClientSocketFactory; 030import pt.ua.dicoogle.rGUI.client.AdminRefs; 031import pt.ua.dicoogle.rGUI.client.signals.PendingMessagesSignal; 032import pt.ua.dicoogle.rGUI.client.windows.FileAlreadyIndexed; 033import pt.ua.dicoogle.rGUI.interfaces.signals.IPendingMessagesSignal; 034 035/** 036 * This class deals with the server messages to the administrator 037 * For now it deals only with file Already Indexed message 038 * 039 * @author Samuel Campos <samuelcampos@ua.pt> 040 */ 041@Deprecated 042public class ServerMessagesManager { 043 044 private static PendingMessagesSignal pendingMessagesSignal; 045 046 private static ServerMessagesManager instance; 047 048 public static synchronized ServerMessagesManager getInstance() { 049 if (instance == null) { 050 instance = new ServerMessagesManager(); 051 } 052 053 return instance; 054 } 055 056 private ServerMessagesManager(){ 057 try { 058 059 pendingMessagesSignal = new PendingMessagesSignal(this); 060 IPendingMessagesSignal pendingMessagesSignalStub = (IPendingMessagesSignal) UnicastRemoteObject.exportObject(pendingMessagesSignal, 0, new MultihomeRMIClientSocketFactory(), RMISocketFactory.getDefaultSocketFactory()); 061 062 AdminRefs.getInstance().getPendingMessages().RegisterSignalBack(pendingMessagesSignalStub); 063 064 } catch (RemoteException ex) { 065 LoggerFactory.getLogger(ServerMessagesManager.class).error(ex.getMessage(), ex); 066 } 067 } 068 069 public void newFileAlreadyIndexedMessage(){ 070 FileAlreadyIndexed.getInstance().getList(); 071 } 072}