mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-25 19:55:48 +01:00
Removed some ESH leftovers (#1468)
* Removed ESH leftovers Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
parent
ac1f4080e3
commit
178ffdf9c2
@ -63,7 +63,7 @@ import org.osgi.service.component.annotations.ReferenceCardinality;
|
|||||||
import org.osgi.service.component.annotations.ReferencePolicy;
|
import org.osgi.service.component.annotations.ReferencePolicy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a default scope provider for stuff that is of general interest in an ESH-based solution.
|
* This is a default scope provider for stuff that is of general interest in an OH-based solution.
|
||||||
* Nonetheless, solutions are free to remove it and have more specific scope providers for their own purposes.
|
* Nonetheless, solutions are free to remove it and have more specific scope providers for their own purposes.
|
||||||
*
|
*
|
||||||
* @author Kai Kreuzer - Initial contribution
|
* @author Kai Kreuzer - Initial contribution
|
||||||
@ -94,7 +94,7 @@ public class DefaultScriptScopeProvider implements ScriptExtensionProvider {
|
|||||||
elements.put("FilenameUtils", FilenameUtils.class);
|
elements.put("FilenameUtils", FilenameUtils.class);
|
||||||
elements.put("File", File.class);
|
elements.put("File", File.class);
|
||||||
|
|
||||||
// ESH types
|
// types
|
||||||
elements.put("IncreaseDecreaseType", IncreaseDecreaseType.class);
|
elements.put("IncreaseDecreaseType", IncreaseDecreaseType.class);
|
||||||
elements.put("DECREASE", IncreaseDecreaseType.DECREASE);
|
elements.put("DECREASE", IncreaseDecreaseType.DECREASE);
|
||||||
elements.put("INCREASE", IncreaseDecreaseType.INCREASE);
|
elements.put("INCREASE", IncreaseDecreaseType.INCREASE);
|
||||||
|
@ -29,7 +29,7 @@ import org.openhab.core.io.console.ConsoleInterpreter;
|
|||||||
import org.openhab.core.io.console.extensions.ConsoleCommandExtension;
|
import org.openhab.core.io.console.extensions.ConsoleCommandExtension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class wraps ESH ConsoleCommandExtensions to commands for Apache Karaf
|
* This class wraps OH ConsoleCommandExtensions to commands for Apache Karaf
|
||||||
*
|
*
|
||||||
* @author Markus Rathgeb - Initial contribution
|
* @author Markus Rathgeb - Initial contribution
|
||||||
* @author Henning Treu - implement help command
|
* @author Henning Treu - implement help command
|
||||||
|
@ -312,7 +312,7 @@ public class WebClientFactoryImpl implements HttpClientFactory, WebSocketFactory
|
|||||||
private QueuedThreadPool createThreadPool(String consumerName, int minThreads, int maxThreads,
|
private QueuedThreadPool createThreadPool(String consumerName, int minThreads, int maxThreads,
|
||||||
int keepAliveTimeout) {
|
int keepAliveTimeout) {
|
||||||
QueuedThreadPool queuedThreadPool = new QueuedThreadPool(maxThreads, minThreads, keepAliveTimeout * 1000);
|
QueuedThreadPool queuedThreadPool = new QueuedThreadPool(maxThreads, minThreads, keepAliveTimeout * 1000);
|
||||||
queuedThreadPool.setName("ESH-httpClient-" + consumerName);
|
queuedThreadPool.setName("OH-httpClient-" + consumerName);
|
||||||
queuedThreadPool.setDaemon(true);
|
queuedThreadPool.setDaemon(true);
|
||||||
return queuedThreadPool;
|
return queuedThreadPool;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
/**
|
/**
|
||||||
* The user can configure multiple system Mqtt broker connections. This is realized via the OSGI service factory
|
* The user can configure multiple system Mqtt broker connections. This is realized via the OSGI service factory
|
||||||
* pattern.
|
* pattern.
|
||||||
* ESH requires a factory marker service, implemented in {@link MqttBrokerConnectionServiceInstanceMarker}.
|
* The framework requires a factory marker service, implemented in {@link MqttBrokerConnectionServiceInstanceMarker}.
|
||||||
* This service represents an instance of that factory and will initialize one MQTT broker connection with the given
|
* This service represents an instance of that factory and will initialize one MQTT broker connection with the given
|
||||||
* configuration and register it to the {@link MqttService}.
|
* configuration and register it to the {@link MqttService}.
|
||||||
*
|
*
|
||||||
|
@ -39,7 +39,7 @@ public interface QueryablePersistenceService extends PersistenceService {
|
|||||||
* Returns a list of items that are stored in the persistence service
|
* Returns a list of items that are stored in the persistence service
|
||||||
*
|
*
|
||||||
* This is returned as a string to allow the persistence service to return items that are no long available as an
|
* This is returned as a string to allow the persistence service to return items that are no long available as an
|
||||||
* ESH {@link Item}.
|
* {@link Item}.
|
||||||
*
|
*
|
||||||
* @return list of strings of item names contained in the store. Not null.
|
* @return list of strings of item names contained in the store. Not null.
|
||||||
*/
|
*/
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
package org.openhab.core.auth;
|
package org.openhab.core.auth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface defining constants for roles within ESH.
|
* Interface defining constants for roles within the framework.
|
||||||
*
|
*
|
||||||
* @author Kai Kreuzer - Initial contribution
|
* @author Kai Kreuzer - Initial contribution
|
||||||
*/
|
*/
|
||||||
|
@ -54,7 +54,7 @@ import org.eclipse.jdt.annotation.Nullable;
|
|||||||
* <li>Method {@code #refreshToken}
|
* <li>Method {@code #refreshToken}
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* Use case 4 - Client Credentials. This is used to get the AccessToken by purely the client credential (ESH).
|
* Use case 4 - Client Credentials. This is used to get the AccessToken by purely the client credential.
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Method {@code #getAccessTokenByClientCredentials(String)}
|
* <li>Method {@code #getAccessTokenByClientCredentials(String)}
|
||||||
* </ul>
|
* </ul>
|
||||||
@ -156,7 +156,7 @@ public interface OAuthClientService extends AutoCloseable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Use case 2 - Resource Owner Password Credentials
|
* Use case 2 - Resource Owner Password Credentials
|
||||||
* This is for when the username and password of the actual resource owner (user) is known to the client (ESH).
|
* This is for when the username and password of the actual resource owner (user) is known to the client.
|
||||||
*
|
*
|
||||||
* @param username of the user
|
* @param username of the user
|
||||||
* @param password of the user
|
* @param password of the user
|
||||||
|
@ -35,7 +35,7 @@ import org.eclipse.jdt.annotation.Nullable;
|
|||||||
@NonNullByDefault
|
@NonNullByDefault
|
||||||
public class ThreadFactoryBuilder {
|
public class ThreadFactoryBuilder {
|
||||||
|
|
||||||
private static final String DEFAULT_NAME_PREFIX = "ESH";
|
private static final String DEFAULT_NAME_PREFIX = "OH";
|
||||||
|
|
||||||
private @Nullable ThreadFactory wrappedThreadFactory;
|
private @Nullable ThreadFactory wrappedThreadFactory;
|
||||||
private @Nullable String name;
|
private @Nullable String name;
|
||||||
@ -97,7 +97,7 @@ public class ThreadFactoryBuilder {
|
|||||||
* The threads created by the {@link ThreadFactory} are named 'namePrefix-name-i', where i is an integer
|
* The threads created by the {@link ThreadFactory} are named 'namePrefix-name-i', where i is an integer
|
||||||
* incremented with each new thread, initialized to 1. If set to null, threads are named 'name-i'.
|
* incremented with each new thread, initialized to 1. If set to null, threads are named 'name-i'.
|
||||||
* <p>
|
* <p>
|
||||||
* Defaults to the name prefix 'ESH'. Setting a name prefix different than the default one is intended to be used by
|
* Defaults to the name prefix 'OH'. Setting a name prefix different than the default one is intended to be used by
|
||||||
* solutions integrating openHAB.
|
* solutions integrating openHAB.
|
||||||
*
|
*
|
||||||
* @param namePrefix The name prefix (can be null)
|
* @param namePrefix The name prefix (can be null)
|
||||||
|
@ -86,8 +86,7 @@ public class EventHandler implements AutoCloseable {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.error(
|
logger.error(
|
||||||
"The handled OSGi event is invalid. Expect properties as string named 'type', 'payload' and 'topic'. "
|
"The handled OSGi event is invalid. Expect properties as string named 'type', 'payload' and 'topic'. Received event properties are: {}",
|
||||||
+ "Received event properties are: {}",
|
|
||||||
Arrays.toString(osgiEvent.getPropertyNames()));
|
Arrays.toString(osgiEvent.getPropertyNames()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,12 +104,12 @@ public class EventHandler implements AutoCloseable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Event eshEvent = createESHEvent(eventFactory, type, payload, topic, source);
|
final Event event = createEvent(eventFactory, type, payload, topic, source);
|
||||||
if (eshEvent == null) {
|
if (event == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatchESHEvent(eventSubscribers, eshEvent);
|
dispatchEvent(eventSubscribers, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<EventSubscriber> getEventSubscribers(String eventType) {
|
private Set<EventSubscriber> getEventSubscribers(String eventType) {
|
||||||
@ -127,21 +126,20 @@ public class EventHandler implements AutoCloseable {
|
|||||||
return subscribers;
|
return subscribers;
|
||||||
}
|
}
|
||||||
|
|
||||||
private @Nullable Event createESHEvent(final EventFactory eventFactory, final String type, final String payload,
|
private @Nullable Event createEvent(final EventFactory eventFactory, final String type, final String payload,
|
||||||
final String topic, final @Nullable String source) {
|
final String topic, final @Nullable String source) {
|
||||||
Event eshEvent = null;
|
Event event = null;
|
||||||
try {
|
try {
|
||||||
eshEvent = eventFactory.createEvent(type, topic, payload, source);
|
event = eventFactory.createEvent(type, topic, payload, source);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(
|
logger.error(
|
||||||
"Creation of ESH-Event failed, "
|
"Creation of Event failed, because one of the registered event factories has thrown an exception: {}",
|
||||||
+ "because one of the registered event factories has thrown an exception: {}",
|
|
||||||
e.getMessage(), e);
|
e.getMessage(), e);
|
||||||
}
|
}
|
||||||
return eshEvent;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void dispatchESHEvent(final Set<EventSubscriber> eventSubscribers, final Event event) {
|
private synchronized void dispatchEvent(final Set<EventSubscriber> eventSubscribers, final Event event) {
|
||||||
for (final EventSubscriber eventSubscriber : eventSubscribers) {
|
for (final EventSubscriber eventSubscriber : eventSubscribers) {
|
||||||
EventFilter filter = eventSubscriber.getEventFilter();
|
EventFilter filter = eventSubscriber.getEventFilter();
|
||||||
if (filter == null || filter.apply(event)) {
|
if (filter == null || filter.apply(event)) {
|
||||||
|
@ -34,7 +34,7 @@ import org.osgi.service.event.EventHandler;
|
|||||||
* The {@link OSGiEventManager} provides an OSGi based default implementation of the openHAB event bus.
|
* The {@link OSGiEventManager} provides an OSGi based default implementation of the openHAB event bus.
|
||||||
*
|
*
|
||||||
* The OSGiEventHandler tracks {@link EventSubscriber}s and {@link EventFactory}s, receives OSGi events (by
|
* The OSGiEventHandler tracks {@link EventSubscriber}s and {@link EventFactory}s, receives OSGi events (by
|
||||||
* implementing the OSGi {@link EventHandler} interface) and dispatches the received OSGi events as ESH {@link Event}s
|
* implementing the OSGi {@link EventHandler} interface) and dispatches the received OSGi events as OH {@link Event}s
|
||||||
* to the {@link EventSubscriber}s if the provided filter applies.
|
* to the {@link EventSubscriber}s if the provided filter applies.
|
||||||
*
|
*
|
||||||
* @author Stefan Bußweiler - Initial contribution
|
* @author Stefan Bußweiler - Initial contribution
|
||||||
|
@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
public abstract class AbstractWatchService {
|
public abstract class AbstractWatchService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default logger for ESH Watch Services
|
* Default logger for Watch Services
|
||||||
*/
|
*/
|
||||||
protected final Logger logger = LoggerFactory.getLogger(AbstractWatchService.class);
|
protected final Logger logger = LoggerFactory.getLogger(AbstractWatchService.class);
|
||||||
|
|
||||||
|
@ -54,9 +54,9 @@ public class ThreadFactoryBuilderTest {
|
|||||||
public void testWithDefaultNamePrefix() {
|
public void testWithDefaultNamePrefix() {
|
||||||
ThreadFactory threadFactory = ThreadFactoryBuilder.create().withName("hello").build();
|
ThreadFactory threadFactory = ThreadFactoryBuilder.create().withName("hello").build();
|
||||||
|
|
||||||
assertThat(threadFactory.newThread(TEST_RUNNABLE).getName(), is("ESH-hello-1"));
|
assertThat(threadFactory.newThread(TEST_RUNNABLE).getName(), is("OH-hello-1"));
|
||||||
assertThat(threadFactory.newThread(TEST_RUNNABLE).getName(), is("ESH-hello-2"));
|
assertThat(threadFactory.newThread(TEST_RUNNABLE).getName(), is("OH-hello-2"));
|
||||||
assertThat(threadFactory.newThread(TEST_RUNNABLE).getName(), is("ESH-hello-3"));
|
assertThat(threadFactory.newThread(TEST_RUNNABLE).getName(), is("OH-hello-3"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -143,6 +143,6 @@ public class ThreadFactoryBuilderTest {
|
|||||||
.build();
|
.build();
|
||||||
Thread testThread = threadFactory.newThread(TEST_RUNNABLE);
|
Thread testThread = threadFactory.newThread(TEST_RUNNABLE);
|
||||||
|
|
||||||
assertThat(testThread.getName(), is("ESH-" + testThreadName));
|
assertThat(testThread.getName(), is("OH-" + testThreadName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user