001/*
002 *  $URL: svn://svn/open/trunk/projects/WebARTS/ca/bc/webarts/tools/portscanner/ObserverNotifier.java $
003 *  $Author: tgutwin $
004 *  $Revision: 596 $
005 *  $Date: 2012-12-31 22:42:09 -0800 (Mon, 31 Dec 2012) $
006 */
007/*
008 *
009 *  Written by Tom Gutwin - WebARTS Design.
010 *  Copyright (C) 2012 WebARTS Design, North Vancouver Canada
011 *  http://www.webarts.bc.ca
012 *
013 *  This program is free software; you can redistribute it and/or modify
014 *  it under the terms of the GNU General Public License as published by
015 *  the Free Software Foundation; either version 2 of the License, or
016 *  (at your option) any later version.
017 *
018 *  This program is distributed in the hope that it will be useful,
019 *  but WITHOUT ANY WARRANTY; without_ even the implied warranty of
020 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
021 *  GNU General Public License for more details.
022 *
023 *  You should have received a copy of the GNU General Public License
024 *  along with this program; if not, write to the Free Software
025 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
026 */
027
028 package ca.bc.webarts.tools.portscanner;
029
030import java.util.Observable;
031import java.util.Observer;
032
033public class ObserverNotifier implements Observer
034{
035    private String respStr;
036    private Integer respInt;
037   private  java.net.InetSocketAddress respAddr;
038
039
040    public void update (Observable obj, Object arg)
041    {
042        if (arg instanceof String)
043        {
044            respStr = (String) arg;
045            System.out.println("Scan ports "+ respStr +" now Complete.");
046        }
047        if (arg instanceof Integer)
048        {
049            respInt = (Integer) arg;
050            System.out.println("   --> Port No "+ respInt +" is accessible.");
051        }
052        if (arg instanceof  java.net.InetSocketAddress)
053        {
054            respAddr= ( java.net.InetSocketAddress) arg;
055            System.out.println("   --> "+respAddr.getHostString()+" Port  "+ respAddr.getPort() +" is accessible.");
056        }
057    }
058}