com.sun.jini.example.hello
Class Server

java.lang.Object
  extended by com.sun.jini.example.hello.Server
All Implemented Interfaces:
Hello, Remote, net.jini.export.ProxyAccessor, net.jini.security.proxytrust.ServerProxyTrust
Direct Known Subclasses:
ActivatableServer

public class Server
extends Object
implements Hello, net.jini.security.proxytrust.ServerProxyTrust, net.jini.export.ProxyAccessor

Defines an application server that provides an implementation of the Hello interface. The application uses the following arguments: [all] - All arguments are used as options when getting the configuration The application uses the following configuration entries, with component com.sun.jini.example.hello.Server: discoveryManager type: DiscoveryManagement default: new LookupDiscovery(new String[] { "" }, config) Object used to discover lookup services to join. exporter type: Exporter default: none The object to use for exporting the server loginContext type: LoginContext default: null If non-null, specifies the JAAS login context to use for performing a JAAS login and supplying the Subject to use when running the server. If null, no JAAS login is performed.

Author:
Sun Microsystems, Inc.

Field Summary
protected  net.jini.config.Configuration config
           
protected  Hello serverProxy
          The server proxy, for use by getProxyVerifier
 
Constructor Summary
protected Server(String[] configOptions)
          Creates the server.
 
Method Summary
protected static net.jini.core.lookup.ServiceID createServiceID()
          Creates a new service ID.
protected  net.jini.export.Exporter getExporter()
          Returns the exporter for exporting the server.
 Object getProxy()
          Returns a proxy object for this remote object.
 net.jini.security.TrustVerifier getProxyVerifier()
          Implement the ServerProxyTrust interface to provide a verifier for secure smart proxies.
protected  net.jini.core.lookup.ServiceID getServiceID()
          Returns the service ID for this server.
protected  void init()
          Initializes the server, including exporting it and storing its proxy in the registry.
protected  void initAsSubject()
          Initializes the server, assuming that the appropriate subject is in effect.
static void main(String[] args)
          Starts and registers a server that implements the Hello interface.
 String sayHello()
          Implement the Hello interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

protected final net.jini.config.Configuration config

serverProxy

protected Hello serverProxy
The server proxy, for use by getProxyVerifier

Constructor Detail

Server

protected Server(String[] configOptions)
          throws net.jini.config.ConfigurationException
Creates the server.

Parameters:
configOptions - options to use when getting the Configuration
Throws:
net.jini.config.ConfigurationException - if a problem occurs creating the configuration
Method Detail

main

public static void main(String[] args)
                 throws Exception
Starts and registers a server that implements the Hello interface.

Parameters:
args - options to use when getting the Configuration
Throws:
net.jini.config.ConfigurationException - if a problem occurs with the configuration
RemoteException - if a remote communication problem occurs
Exception

init

protected void init()
             throws Exception
Initializes the server, including exporting it and storing its proxy in the registry.

Throws:
Exception - if a problem occurs

initAsSubject

protected void initAsSubject()
                      throws Exception
Initializes the server, assuming that the appropriate subject is in effect.

Throws:
Exception

getExporter

protected net.jini.export.Exporter getExporter()
                                        throws net.jini.config.ConfigurationException,
                                               RemoteException
Returns the exporter for exporting the server.

Throws:
net.jini.config.ConfigurationException - if a problem occurs getting the exporter from the configuration
RemoteException - if a remote communication problem occurs

getServiceID

protected net.jini.core.lookup.ServiceID getServiceID()
Returns the service ID for this server.


createServiceID

protected static net.jini.core.lookup.ServiceID createServiceID()
Creates a new service ID.


sayHello

public String sayHello()
Implement the Hello interface.

Specified by:
sayHello in interface Hello
Returns:
message string

getProxyVerifier

public net.jini.security.TrustVerifier getProxyVerifier()
Implement the ServerProxyTrust interface to provide a verifier for secure smart proxies.

Specified by:
getProxyVerifier in interface net.jini.security.proxytrust.ServerProxyTrust

getProxy

public Object getProxy()
Returns a proxy object for this remote object.

Specified by:
getProxy in interface net.jini.export.ProxyAccessor
Returns:
our proxy


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.