com.addc.commons.slp.DAAdvertEnumeration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of addc-slp Show documentation
Show all versions of addc-slp Show documentation
The addc-slp library supplies client classes for registering objects with a Service Location Protocol Daemon and
for looking theses objects up later.
package com.addc.commons.slp;
import java.io.DataInputStream;
import java.io.IOException;
import java.text.MessageFormat;
import com.addc.commons.slp.configuration.SLPConfig;
import com.addc.commons.slp.messages.SLPMessageHeader;
import com.addc.commons.slp.messages.UAMessage;
/**
* The DAAdvertEnumeration supplies an enumerator for Strings
*/
public class DAAdvertEnumeration extends AbstractSlpEnumeration {
/**
*
* Create a new DAAdvertEnumeration
*
* @param config
* The configuration to use
* @param netManager
* The NetworkManagerImpl
* @param message
* The request message
* @throws ServiceLocationException
* If there is an error sending or receiving data
*/
public DAAdvertEnumeration(SLPConfig config, NetworkManager netManager, UAMessage message)
throws ServiceLocationException {
super(config, netManager, message);
}
@Override
protected void parseResponse(DataInputStream dis, SLPMessageHeader header)
throws IOException, ServiceLocationException {
if (header.getFunctionId() != SLPConstants.DAADVERT) {
String reason= MessageFormat.format("Expected function Id {0} received {1}", SLPConstants.DAADVERT, header.getFunctionId());
throw new ServiceLocationException(reason, SLPConstants.INTERNAL_SYSTEM_ERROR);
}
dis.readInt(); // DA startup date
received.add(dis.readUTF());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy