org.openmuc.openiec61850

## Class ServerSap

- java.lang.Object
- - org.openmuc.openiec61850.ServerSap

    public final class ServerSap
    extends java.lang.Object

The `ServerSap` class represents the IEC 61850 service access point for server applications. It corresponds to the AccessPoint defined in the ICD/SCL file. A server application that is to listen for client connections should first get an instance of `ServerSap` using the static function ServerSap.getSapsFromSclFile(). Next all the necessary configuration parameters can be set. Finally the `startListening` function is called to listen for client associations. Changing properties of a ServerSap after starting to listen is not recommended and has unknown effects.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`int` `getBacklog()`
`java.net.InetAddress` `getBindAddress()`
`int` `getMaxMmsPduSize()` Gets the maximum MMS PDU size.
`ServerModel` `getModelCopy()`
`java.lang.String` `getName()` Returns the name of the ServerSap / AccessPoint as specified in the SCL file.
`int` `getPort()`
`int` `getProposedDataStructureNestingLevel()` Gets the ProposedDataStructureNestingLevel parameter.
`int` `getProposedMaxServOutstandingCalled()` Gets the ProposedMaxServOutstandingCalled parameter.
`int` `getProposedMaxServOutstandingCalling()` Gets the ProposedMaxServOutstandingCalling parameter.
`static java.util.List<ServerSap>` `getSapsFromSclFile(java.io.InputStream sclFileStream)`
`static java.util.List<ServerSap>` `getSapsFromSclFile(java.lang.String sclFilePath)`
`byte[]` `getServicesSupportedCalled()` Gets the ServicesSupportedCalled parameter.
`void` `setBacklog(int backlog)` Sets the maximum queue length for incoming connection indications (a request to connect) is set to the backlog parameter.
`void` `setBindAddress(java.net.InetAddress bindAddr)` Sets the local IP address to bind to, pass null to bind to all
`void` `setMaxAssociations(int maxAssociations)` Set the maximum number of associations that are allowed in parallel by the server.
`void` `setMaxMmsPduSize(int size)` Sets the maximum MMS PDU size in bytes that the server will support.
`void` `setMessageFragmentTimeout(int timeout)` Sets the message fragment timeout.
`void` `setPort(int port)` Sets local port to listen on for new connections.
`void` `setProposedDataStructureNestingLevel(int nestingLevel)` Sets the ProposedDataStructureNestingLevel parameter.
`void` `setProposedMaxServOutstandingCalled(int maxCalled)` Sets the ProposedMaxServOutstandingCalled parameter.The given parameter has no affect on the functionality of this server.
`void` `setProposedMaxServOutstandingCalling(int maxCalling)` Sets the ProposedMaxServOutstandingCalling parameter.
`void` `setServerSocketFactory(javax.net.ServerSocketFactory serverSocketFactory)` Sets the factory class to generate the ServerSocket.
`void` `setServicesSupportedCalled(byte[] services)` Sets the SevicesSupportedCalled parameter.
`void` `setValues(java.util.List<BasicDataAttribute> bdas)`
`void` `startListening(ServerEventListener serverEventListener)` Creates a server socket waiting on the configured port for incoming association requests.
`void` `stop()` Stops listening for new connections and closes all existing connections/associations.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### getSapsFromSclFile

    public static java.util.List<ServerSap> getSapsFromSclFile(java.lang.String sclFilePath)
                                                        throws SclParseException

Throws:
  `SclParseException`

#### getSapsFromSclFile

    public static java.util.List<ServerSap> getSapsFromSclFile(java.io.InputStream sclFileStream)
                                                        throws SclParseException

Throws:
  `SclParseException`

#### setPort

    public void setPort(int port)

Sets local port to listen on for new connections.

Parameters:
  `port` - local port to listen on for new connections

#### getPort

    public int getPort()

#### setBacklog

    public void setBacklog(int backlog)

Sets the maximum queue length for incoming connection indications (a request to connect) is set to the backlog parameter. If a connection indication arrives when the queue is full, the connection is refused. Set to 0 or less for the default value.

Parameters:
  `backlog` - the maximum queue length for incoming connections.

#### getBacklog

    public int getBacklog()

#### setBindAddress

    public void setBindAddress(java.net.InetAddress bindAddr)

Sets the local IP address to bind to, pass null to bind to all

Parameters:
  `bindAddr` - the local IP address to bind to

#### getBindAddress

    public java.net.InetAddress getBindAddress()

#### getName

    public java.lang.String getName()

Returns the name of the ServerSap / AccessPoint as specified in the SCL file.

Returns:
  the name.

#### setServerSocketFactory

    public void setServerSocketFactory(javax.net.ServerSocketFactory serverSocketFactory)

Sets the factory class to generate the ServerSocket. The ServerSocketFactory could be used to create SSLServerSockets. Set to `null` to use `ServerSocketFactory.getDefault()`.

Parameters:
  `serverSocketFactory` - the factory class to generate the ServerSocket.

#### setMaxMmsPduSize

    public void setMaxMmsPduSize(int size)

Sets the maximum MMS PDU size in bytes that the server will support. If the client requires the use of a smaller maximum MMS PDU size, then the smaller size will be accepted by the server. The default size is 65000.

Parameters:
  `size` - cannot be less than 64. The upper limit is 65000 so that segmentation at the lower transport layer is avoided. The Transport Layer's maximum PDU size is 65531.

#### getMaxMmsPduSize

    public int getMaxMmsPduSize()

Gets the maximum MMS PDU size.

Returns:
  the maximum MMS PDU size.

#### setMaxAssociations

    public void setMaxAssociations(int maxAssociations)

Set the maximum number of associations that are allowed in parallel by the server.

Parameters:
  `maxAssociations` - the number of associations allowed (default is 100)

#### setMessageFragmentTimeout

    public void setMessageFragmentTimeout(int timeout)

Sets the message fragment timeout. This is the timeout that the socket timeout is set to after the first byte of a message has been received. If such a timeout is thrown, the association/socket is closed.

Parameters:
  `timeout` - the message fragment timeout in milliseconds. The default is 60000.

#### setProposedMaxServOutstandingCalling

    public void setProposedMaxServOutstandingCalling(int maxCalling)

Sets the ProposedMaxServOutstandingCalling parameter. The given parameter has no affect on the functionality of this server.

Parameters:
  `maxCalling` - the ProposedMaxServOutstandingCalling parameter. The default is 5.

#### getProposedMaxServOutstandingCalling

    public int getProposedMaxServOutstandingCalling()

Gets the ProposedMaxServOutstandingCalling parameter.

Returns:
  the ProposedMaxServOutstandingCalling parameter.

#### setProposedMaxServOutstandingCalled

    public void setProposedMaxServOutstandingCalled(int maxCalled)

Sets the ProposedMaxServOutstandingCalled parameter.The given parameter has no affect on the functionality of this server.

Parameters:
  `maxCalled` - the ProposedMaxServOutstandingCalled parameter. The default is 5.

#### getProposedMaxServOutstandingCalled

    public int getProposedMaxServOutstandingCalled()

Gets the ProposedMaxServOutstandingCalled parameter.

Returns:
  the ProposedMaxServOutstandingCalled parameter.

#### setProposedDataStructureNestingLevel

    public void setProposedDataStructureNestingLevel(int nestingLevel)

Sets the ProposedDataStructureNestingLevel parameter. The given parameter has no affect on the functionality of this server.runServer

Parameters:
  `nestingLevel` - the ProposedDataStructureNestingLevel parameter. The default is 10.

#### getProposedDataStructureNestingLevel

    public int getProposedDataStructureNestingLevel()

Gets the ProposedDataStructureNestingLevel parameter.

Returns:
  the ProposedDataStructureNestingLevel parameter.

#### setServicesSupportedCalled

    public void setServicesSupportedCalled(byte[] services)

Sets the SevicesSupportedCalled parameter. The given parameter has no affect on the functionality of this server.

Parameters:
  `services` - the ServicesSupportedCalled parameter

#### getServicesSupportedCalled

    public byte[] getServicesSupportedCalled()

Gets the ServicesSupportedCalled parameter.

Returns:
  the ServicesSupportedCalled parameter.

#### startListening

    public void startListening(ServerEventListener serverEventListener)
                        throws java.io.IOException

Creates a server socket waiting on the configured port for incoming association requests.

Parameters:
  `serverEventListener` - the listener that is notified of incoming writes and when the server stopped listening for new connections.
Throws:
  `java.io.IOException` - if an error occurs binding to the port.

#### stop

    public void stop()

Stops listening for new connections and closes all existing connections/associations.

#### getModelCopy

    public ServerModel getModelCopy()

#### setValues

    public void setValues(java.util.List<BasicDataAttribute> bdas)