org.ssonet.examples.catalog.merchant
Class MerchantServer

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--org.ssonet.examples.catalog.merchant.MerchantServer
All Implemented Interfaces:
CertificateListener, ConnectionListener, java.lang.Runnable, SSONETContextFactory

public class MerchantServer
extends java.lang.Thread
implements SSONETContextFactory, CertificateListener, ConnectionListener

A MerchantServer


Field Summary
static java.lang.String CATALOG
           
(package private)  java.lang.ThreadGroup connections
           
static java.lang.String ORDER
           
static java.lang.String REQUEST
           
(package private)  boolean serverRunning
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Fields inherited from interface org.ssonet.net.CertificateListener
INVALID, NOT_TESTED, VALID
 
Fields inherited from interface org.ssonet.net.ConnectionListener
FINISHED_STATE, INIT_STATE, MECHANISMS_NEGOTIATION, NOT_STARTED_STATE, RUNNING_STATE, SECURITY_GOAL_NEGOTIATION
 
Constructor Summary
MerchantServer(org.ssonet.examples.catalog.merchant.Merchant merchant, java.lang.String merchantName, java.lang.String catalogFileName, int portNumber)
          creates a MerchantServer
 
Method Summary
 int checkCertificate(org.ssonet.net.SSONETContext context, java.security.cert.X509Certificate cert)
          Zertifikate auswerten
 void connectionStateChanged(org.ssonet.net.SSONETContext context, int currentState)
          When the connection state has changed, this method reports the current state.
 org.ssonet.net.SSONETContext createContext()
          Create a SSONETContext.
 boolean decideSecurityGoal(int securityGoal, org.ssonet.net.ActionConfiguration ownConfiguration, org.ssonet.net.SSONETContext context)
          This method must decide, wether a user wants to give in in a security goal negotiation conflict, or not.
 java.lang.String getOrder(org.ssonet.examples.catalog.net.Order order)
          returns a message that an order was received and displays messages regarding an order at the state
 void negotiationRequestReceived(org.ssonet.net.SSONETContext context, int negotiationType)
          The method negotiationRequestReceived() is called by SSONETProtocolStream , when a request for a security goal and mechanisms negotiation, or only a mechanisms negotiation was received, but before the negotiation of security parameters starts.
 org.ssonet.examples.catalog.net.CatalogFile requestCatalog()
          returns the actual catalog
 void run()
          accept Connections while server running
 void stopServer()
          stops the MerchantServer, all connections will be closed after 10 seconds
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serverRunning

boolean serverRunning

connections

java.lang.ThreadGroup connections

CATALOG

public static final java.lang.String CATALOG
See Also:
Constant Field Values

ORDER

public static final java.lang.String ORDER
See Also:
Constant Field Values

REQUEST

public static final java.lang.String REQUEST
See Also:
Constant Field Values
Constructor Detail

MerchantServer

public MerchantServer(org.ssonet.examples.catalog.merchant.Merchant merchant,
                      java.lang.String merchantName,
                      java.lang.String catalogFileName,
                      int portNumber)
creates a MerchantServer

Method Detail

run

public void run()
accept Connections while server running

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

stopServer

public void stopServer()
stops the MerchantServer, all connections will be closed after 10 seconds


getOrder

public java.lang.String getOrder(org.ssonet.examples.catalog.net.Order order)
returns a message that an order was received and displays messages regarding an order at the state


requestCatalog

public org.ssonet.examples.catalog.net.CatalogFile requestCatalog()
returns the actual catalog


createContext

public org.ssonet.net.SSONETContext createContext()
Description copied from interface: SSONETContextFactory
Create a SSONETContext.

Specified by:
createContext in interface SSONETContextFactory
Returns:
an initialized SSONETContext object

checkCertificate

public int checkCertificate(org.ssonet.net.SSONETContext context,
                            java.security.cert.X509Certificate cert)
Zertifikate auswerten

Specified by:
checkCertificate in interface CertificateListener
Parameters:
context - The Context in which the Certificate ha to be evaluated.
cert - The Certificate to be evaluated.
Returns:
VALID, INVALID or NOT TESTED.

decideSecurityGoal

public boolean decideSecurityGoal(int securityGoal,
                                  org.ssonet.net.ActionConfiguration ownConfiguration,
                                  org.ssonet.net.SSONETContext context)
Description copied from interface: ConnectionListener
This method must decide, wether a user wants to give in in a security goal negotiation conflict, or not.

Specified by:
decideSecurityGoal in interface ConnectionListener
Parameters:
securityGoal - the security goal to decide on, the security goals are defined in class ssonet.SSONETConstants.
ownConfiguration - the ActionConfiguration object of the user. This holds the actual security goal configuration.
context - informations about the communication partner.
Returns:
true, if he gives in, false otherwise.

negotiationRequestReceived

public void negotiationRequestReceived(org.ssonet.net.SSONETContext context,
                                       int negotiationType)
Description copied from interface: ConnectionListener
The method negotiationRequestReceived() is called by SSONETProtocolStream , when a request for a security goal and mechanisms negotiation, or only a mechanisms negotiation was received, but before the negotiation of security parameters starts.

Specified by:
negotiationRequestReceived in interface ConnectionListener
Parameters:
context - the SSONETContext used by the server for this request.
negotiationType - SECURITY_GOAL_NEGOTIATION if the negotiation requested is a security goal (and mechanisms) negotiation,

MECHANISMS_NEGOTIATION if the negotiation requested is only a mechanisms negotiation.


connectionStateChanged

public void connectionStateChanged(org.ssonet.net.SSONETContext context,
                                   int currentState)
Description copied from interface: ConnectionListener
When the connection state has changed, this method reports the current state.

Specified by:
connectionStateChanged in interface ConnectionListener


Copyright © 2003 DRIM Team. All Rights Reserved.