edu.nyu.cs.pdsg.disco
Class Disco

java.lang.Object
  extended byedu.nyu.cs.pdsg.disco.Disco

public class Disco
extends java.lang.Object

Disco is implemented as a library of static methods. There is only one Disco per JVM, with only one DiscoListener and only one Authorizer.


Field Summary
private static Credentials currentUserCredentials
          HORRIBLE HACK
private static Role currentUserEntity
           
private static java.security.KeyPair currentUserKeyPair
           
private static Credentials discoHostCredentials
          Credendials of Disco host
private static java.security.KeyPair discoHostKeyPair
          KeyPair of Disco host
private static java.lang.String discoHostName
          Name of Disco host
private static DiscoListener discoListener
          Listener
private static boolean initialized
          For redundant initializations
static int[] LISTEN_PORT
          Listener Port
private static java.util.Properties properties
          Used to parse parameters file
private static ServiceManager serviceManager
          Discovery central logic
private static java.util.HashMap services
          Installed services
private static Credentials userCredentialsDropoff
          THIS IS HORRIBLE
 
Constructor Summary
Disco()
           
 
Method Summary
static java.util.HashSet find(ServiceDescriptor sd, Authorizer auth)
          Causes the Discovery module to find network implementations of the service needed.
static Credentials getCurrentUserCredentials()
          HORRIBLE HACK
static Role getCurrentUserEntity()
           
static java.security.KeyPair getCurrentUserKeyPair()
          HORRIBLE HACK
static void init()
          Base initialization.
static void init(java.lang.String propertiesPath)
          Parameterized initialization.
static void initDiscovery()
          public static void initListener( String _discoListenerName, KeyPair _discoListenerKeyPair, Authorizer _discoListenerAuthorizer, Credentials _discoListenerCredentials ) { InetSocketAddress discoListenerSocketAddr = new InetSocketAddress("0.0.0.0", LISTEN_PORT); if( _discoListenerKeyPair == null) { Debug.println( "DISCO", -1, "The keys for the disco listener are null" ); return; } Switchboard.serve(discoListenerSocketAddr, _discoListenerName, _discoListenerKeyPair, _discoListenerAuthorizer, _discoListenerCredentials, (Serializable)discoListener); }
static void initDiscovery(int _broadcastPort)
           
static SbRpcStack install(Locator _locator, java.security.KeyPair _keyPair, Authorizer _authorizer, Credentials _credentials, SbEventHandler _eventHandler)
          Causes the Activator to download the desired service component, install it a Container, and return some sort of reference to the requestor.
static void publish(Locator loc)
           
static DiscoObject remoteInstall(java.lang.String codebase, java.lang.String className, java.lang.String[] args)
          Downloads the object from a given URL.
static void setCurrentUserCredentials(Credentials _currentUserCredentials)
          HORRIBLE HACK
static void setCurrentUserEntity(Role _currentUserEntity)
           
static void setCurrentUserKeyPair(java.security.KeyPair _currentUserKeyPair)
          HORRIBLE HACK
static void setHostCredentials(Credentials _discoHostCredentials)
           
static void startAdvertising()
           
static void startPublishing()
           
static void stopAdvertising()
           
static void stopPublishing()
           
static void unpublish(Locator loc)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

discoHostName

private static java.lang.String discoHostName
Name of Disco host


discoHostKeyPair

private static java.security.KeyPair discoHostKeyPair
KeyPair of Disco host


discoHostCredentials

private static Credentials discoHostCredentials
Credendials of Disco host


serviceManager

private static ServiceManager serviceManager
Discovery central logic


services

private static java.util.HashMap services
Installed services


properties

private static java.util.Properties properties
Used to parse parameters file


initialized

private static boolean initialized
For redundant initializations


LISTEN_PORT

public static int[] LISTEN_PORT
Listener Port


discoListener

private static DiscoListener discoListener
Listener


userCredentialsDropoff

private static Credentials userCredentialsDropoff
THIS IS HORRIBLE


currentUserCredentials

private static Credentials currentUserCredentials
HORRIBLE HACK


currentUserKeyPair

private static java.security.KeyPair currentUserKeyPair

currentUserEntity

private static Role currentUserEntity
Constructor Detail

Disco

public Disco()
Method Detail

setCurrentUserCredentials

public static void setCurrentUserCredentials(Credentials _currentUserCredentials)
HORRIBLE HACK


getCurrentUserCredentials

public static Credentials getCurrentUserCredentials()
HORRIBLE HACK


setCurrentUserKeyPair

public static void setCurrentUserKeyPair(java.security.KeyPair _currentUserKeyPair)
HORRIBLE HACK


getCurrentUserKeyPair

public static java.security.KeyPair getCurrentUserKeyPair()
HORRIBLE HACK


setCurrentUserEntity

public static void setCurrentUserEntity(Role _currentUserEntity)

getCurrentUserEntity

public static Role getCurrentUserEntity()

init

public static void init()
Base initialization. Must be called before use of any Disco static methods.


init

public static void init(java.lang.String propertiesPath)
Parameterized initialization. Must be called if using a DiscoListener and before use of Disco static methods.


initDiscovery

public static void initDiscovery()
public static void initListener( String _discoListenerName, KeyPair _discoListenerKeyPair, Authorizer _discoListenerAuthorizer, Credentials _discoListenerCredentials ) { InetSocketAddress discoListenerSocketAddr = new InetSocketAddress("0.0.0.0", LISTEN_PORT); if( _discoListenerKeyPair == null) { Debug.println( "DISCO", -1, "The keys for the disco listener are null" ); return; } Switchboard.serve(discoListenerSocketAddr, _discoListenerName, _discoListenerKeyPair, _discoListenerAuthorizer, _discoListenerCredentials, (Serializable)discoListener); }


initDiscovery

public static void initDiscovery(int _broadcastPort)

setHostCredentials

public static void setHostCredentials(Credentials _discoHostCredentials)

find

public static java.util.HashSet find(ServiceDescriptor sd,
                                     Authorizer auth)
Causes the Discovery module to find network implementations of the service needed.

Parameters:
sd - the unambiguous description of the needed service
Returns:
the possible locations, in order of response

publish

public static void publish(Locator loc)

unpublish

public static void unpublish(Locator loc)

startPublishing

public static void startPublishing()

stopPublishing

public static void stopPublishing()

startAdvertising

public static void startAdvertising()

stopAdvertising

public static void stopAdvertising()

install

public static SbRpcStack install(Locator _locator,
                                 java.security.KeyPair _keyPair,
                                 Authorizer _authorizer,
                                 Credentials _credentials,
                                 SbEventHandler _eventHandler)
Causes the Activator to download the desired service component, install it a Container, and return some sort of reference to the requestor. In this first pass, returning a Locator requires a good deal of Switchboard use on the part of the application programmer.

It probably makes a lot more sense for this library call to accept the the requestor's credentials and to create a SwitchboardRPC connection for the requestor and simply to return the Ico.

Returns:
the SbRpcStack that was used to connect to the service provider

remoteInstall

public static DiscoObject remoteInstall(java.lang.String codebase,
                                        java.lang.String className,
                                        java.lang.String[] args)
Downloads the object from a given URL. The URL should be either http://xx.com or disco://xx.com.

Parameters:
codebase - The URL to download the object from.
args - The arguments for the object constructor.
Returns:
The object.


Copyright (c) 2002-2003 New York University RLAB