use of org.slf4j.Logger in project openhab1-addons by openhab.
the class MStepperPositionImpl method setLogger.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public void setLogger(Logger newLogger) {
Logger oldLogger = logger;
logger = newLogger;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MSTEPPER_POSITION__LOGGER, oldLogger, logger));
}
}
use of org.slf4j.Logger in project openhab1-addons by openhab.
the class MStepperVelocityImpl method setLogger.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public void setLogger(Logger newLogger) {
Logger oldLogger = logger;
logger = newLogger;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MSTEPPER_VELOCITY__LOGGER, oldLogger, logger));
}
}
use of org.slf4j.Logger in project openhab1-addons by openhab.
the class MaxCubeDiscover method discoverIp.
/**
* Automatic UDP discovery of a MAX!Cube
*
* @return if the cube is found, returns the IP address as a string. Otherwise returns null
*/
public static final String discoverIp() {
String maxCubeIP = null;
String maxCubeName = null;
String rfAddress = null;
Logger logger = LoggerFactory.getLogger(MaxCubeDiscover.class);
DatagramSocket bcReceipt = null;
DatagramSocket bcSend = null;
// Find the MaxCube using UDP broadcast
try {
bcSend = new DatagramSocket();
bcSend.setBroadcast(true);
byte[] sendData = "eQ3Max*\0**********I".getBytes();
// Broadcast the message over all the network interfaces
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
NetworkInterface networkInterface = interfaces.nextElement();
if (networkInterface.isLoopback() || !networkInterface.isUp()) {
continue;
}
for (InterfaceAddress interfaceAddress : networkInterface.getInterfaceAddresses()) {
InetAddress[] broadcast = new InetAddress[2];
broadcast[0] = InetAddress.getByName("224.0.0.1");
broadcast[1] = interfaceAddress.getBroadcast();
for (InetAddress bc : broadcast) {
// Send the broadcast package!
if (bc != null) {
try {
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, bc, 23272);
bcSend.send(sendPacket);
} catch (IOException e) {
logger.debug("IO error during MAX! Cube discovery: {}", e.getMessage());
} catch (Exception e) {
logger.debug(e.getMessage());
logger.debug(Utils.getStackTrace(e));
}
logger.trace("Request packet sent to: {} Interface: {}", bc.getHostAddress(), networkInterface.getDisplayName());
}
}
}
}
logger.trace("Done looping over all network interfaces. Now waiting for a reply!");
bcSend.close();
bcReceipt = new DatagramSocket(23272);
bcReceipt.setReuseAddress(true);
// Wait for a response
byte[] recvBuf = new byte[15000];
DatagramPacket receivePacket = new DatagramPacket(recvBuf, recvBuf.length);
bcReceipt.receive(receivePacket);
// We have a response
logger.trace("Broadcast response from server: {}", receivePacket.getAddress());
// Check if the message is correct
String message = new String(receivePacket.getData()).trim();
if (message.startsWith("eQ3Max")) {
maxCubeIP = receivePacket.getAddress().getHostAddress();
maxCubeName = message.substring(0, 8);
rfAddress = message.substring(8, 18);
logger.debug("Found at: {}", maxCubeIP);
logger.debug("Name : {}", maxCubeName);
logger.debug("Serial : {}", rfAddress);
logger.trace("Message : {}", message);
} else {
logger.info("No Max!Cube gateway found on network");
}
} catch (IOException e) {
logger.debug("IO error during MAX! Cube discovery: {}", e.getMessage());
} catch (Exception e) {
logger.debug(e.getMessage());
logger.debug(Utils.getStackTrace(e));
} finally {
try {
if (bcReceipt != null) {
bcReceipt.close();
}
} catch (Exception e) {
logger.debug(e.toString());
}
try {
if (bcSend != null) {
bcSend.close();
}
} catch (Exception e) {
logger.debug(e.toString());
}
}
return maxCubeIP;
}
use of org.slf4j.Logger in project OpenAM by OpenRock.
the class ScriptConfigurationServiceTest method setUp.
@BeforeMethod
public void setUp() throws ResourceException {
Logger logger = mock(Logger.class);
Subject subject = new Subject();
subject.getPrincipals().add(testUserPrinciple);
dataStore = mock(ScriptingDataStore.class);
ScriptingDataStoreFactory dataStoreFactory = mock(ScriptingDataStoreFactory.class);
when(dataStoreFactory.create(any(Subject.class), anyString())).thenReturn(dataStore);
service = new ScriptConfigurationService(logger, subject, "/", dataStoreFactory);
}
use of org.slf4j.Logger in project OpenAM by OpenRock.
the class TokenDelegationHandlersProviderTest method testDefaultDelegationHandler.
@Test
public void testDefaultDelegationHandler() throws UnsupportedEncodingException {
Logger mockLogger = mock(Logger.class);
ThreadLocalAMTokenCache mockTokenCache = mock(ThreadLocalAMTokenCache.class);
SoapSTSInstanceConfig instanceConfig = createInstanceConfig(DELEGATION_VALIDATORS_SPECIFIED, !CUSTOM_DELEGATION_HANDLER);
assertTrue(new TokenDelegationHandlersProvider(instanceConfig, mockTokenCache, mockLogger).get().get(0) instanceof DefaultTokenDelegationHandler);
}
Aggregations