com.addc.commons.slp.LocatorImpl 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.util.Locale;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.addc.commons.slp.configuration.SLPConfig;
import com.addc.commons.slp.messages.AttributeRequest;
import com.addc.commons.slp.messages.ServiceRequest;
import com.addc.commons.slp.messages.ServiceTypeRequest;
/**
* Implementation of SLP Locator interface.
*/
public class LocatorImpl implements Locator {
private static final Logger LOGGER= LoggerFactory.getLogger(LocatorImpl.class);
private final NetworkManager netManager;
private final SLPConfig config;
/**
*
* Create a new LocatorImpl
*
* @param config
* The configuration to use
* @param netManager
* The {@link NetworkManagerImpl} to use
*/
public LocatorImpl(SLPConfig config, NetworkManager netManager) {
this.config= config;
this.netManager= netManager;
LOGGER.info("Created new locator");
}
@Override
public Locale getLocale() {
return config.getLocale();
}
@Override
public ServiceTypeEnumeration findServiceTypes(String namingAuthority) throws ServiceLocationException {
ServiceTypeRequest str= new ServiceTypeRequest(config, namingAuthority);
return new ServiceTypeEnumeration(config, netManager, str);
}
@Override
public ServiceURLEnumeration findServices(ServiceType type, String searchFilter) throws ServiceLocationException {
ServiceRequest sr= new ServiceRequest(config, type, searchFilter);
return new ServiceURLEnumeration(config, netManager, sr);
}
@Override
public SlpAttributeEnumeration findAttributes(ServiceURL url, String attributeIds) throws ServiceLocationException {
AttributeRequest ar= new AttributeRequest(config, url.toString(), attributeIds);
return new SlpAttributeEnumeration(config, netManager, ar);
}
@Override
public SlpAttributeEnumeration findAttributes(ServiceType type, String attributeIds)
throws ServiceLocationException {
AttributeRequest ar= new AttributeRequest(config, type.toString(), attributeIds);
return new SlpAttributeEnumeration(config, netManager, ar);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy