mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-10 13:21:53 +01:00
Use "openhab" console scope (#1586)
Fixes #1566 Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
parent
bab473016c
commit
86b02c26be
@ -42,7 +42,7 @@ import org.osgi.service.component.annotations.ReferencePolicy;
|
||||
@Component
|
||||
public class ConsoleSupportEclipse implements CommandProvider {
|
||||
|
||||
private static final String BASE = "smarthome";
|
||||
private static final String BASE = "openhab";
|
||||
|
||||
private final SortedMap<String, ConsoleCommandExtension> consoleCommandExtensions = Collections
|
||||
.synchronizedSortedMap(new TreeMap<>());
|
||||
@ -70,14 +70,14 @@ public class ConsoleSupportEclipse implements CommandProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* Methods staring with "_" will be used as commands. We only define one command "smarthome" to make
|
||||
* Methods staring with "_" will be used as commands. We only define one command "openhab" to make
|
||||
* sure we do not get into conflict with other existing commands. The different functionalities
|
||||
* can then be used by the first argument.
|
||||
*
|
||||
* @param interpreter the equinox command interpreter
|
||||
* @return null, return parameter is not used
|
||||
*/
|
||||
public Object _smarthome(final CommandInterpreter interpreter) {
|
||||
public Object _openhab(final CommandInterpreter interpreter) {
|
||||
final Console console = new OSGiConsole(BASE, interpreter);
|
||||
|
||||
final String cmd = interpreter.nextArgument();
|
||||
|
@ -35,11 +35,11 @@ import org.openhab.core.io.console.extensions.ConsoleCommandExtension;
|
||||
* @author Henning Treu - implement help command
|
||||
*/
|
||||
@Service
|
||||
@org.apache.karaf.shell.api.action.Command(name = "help", scope = "smarthome", description = "Print the full usage information of the 'smarthome' commands.")
|
||||
@org.apache.karaf.shell.api.action.Command(name = "help", scope = "openhab", description = "Print the full usage information of the 'openhab' commands.")
|
||||
public class CommandWrapper implements Command, Action {
|
||||
|
||||
// Define a scope for all commands.
|
||||
public static final String SCOPE = "smarthome";
|
||||
public static final String SCOPE = "openhab";
|
||||
|
||||
private final ConsoleCommandExtension command;
|
||||
|
||||
@ -53,8 +53,8 @@ public class CommandWrapper implements Command, Action {
|
||||
/**
|
||||
* The constructor for the "help" instance of this class. This instance will be created by
|
||||
* org.apache.karaf.shell.impl.action.command.ManagerImpl.instantiate(Class<? extends T>, Registry) and
|
||||
* is used to print all usages from the `smarthome` scope.
|
||||
* The wrapped command is unused here because the karaf ifrastructure will call the {@link #execute()} method.
|
||||
* is used to print all usages from the `openhab` scope.
|
||||
* The wrapped command is unused here because the karaf infrastructure will call the {@link #execute()} method.
|
||||
*/
|
||||
public CommandWrapper() {
|
||||
this(null);
|
||||
|
@ -51,7 +51,7 @@ public class ConsoleSupportRfc147 implements ConsoleCommandsContainer {
|
||||
private static final String KEY_SCOPE = "osgi.command.scope";
|
||||
private static final String KEY_FUNCTION = "osgi.command.function";
|
||||
|
||||
private static final String SCOPE = "smarthome";
|
||||
private static final String SCOPE = "openhab";
|
||||
|
||||
public static final OSGiConsole CONSOLE = new OSGiConsole(SCOPE);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
This is a working bundle for demonstrating/ testing the Oauth2 client.
|
||||
This is a working bundle for demonstrating/ testing the OAuth2 client.
|
||||
Passwords, secrets, etc have to be configured through config admin in order for it to work
|
||||
|
||||
Simply deploy it to the runtime; then smarthome oauth commands will be registered and ready to test.
|
||||
Simply deploy it to the runtime; then openhab:oauth commands will be registered and ready to test.
|
||||
|
||||
|
||||
# Example 1: (Using authorization code)
|
||||
@ -9,10 +9,10 @@ Simply deploy it to the runtime; then smarthome oauth commands will be registere
|
||||
## Try these on the OSGI console:
|
||||
|
||||
```
|
||||
smarthome oauth Code cleanupEverything
|
||||
smarthome oauth Code create
|
||||
smarthome oauth Code getClient <fill in handle from create step>
|
||||
smarthome oauth Code getAuthorizationUrl
|
||||
openhab:oauth Code cleanupEverything
|
||||
openhab:oauth Code create
|
||||
openhab:oauth Code getClient <fill in handle from create step>
|
||||
openhab:oauth Code getAuthorizationUrl
|
||||
```
|
||||
|
||||
```
|
||||
@ -23,10 +23,10 @@ Read the code http parameter from the redirectURL
|
||||
```
|
||||
|
||||
```
|
||||
smarthome oauth Code getAccessTokenByCode <code from redirectURL parameter>
|
||||
smarthome oauth Code getCachedAccessToken
|
||||
smarthome oauth Code refresh
|
||||
smarthome oauth Code close
|
||||
openhab:oauth Code getAccessTokenByCode <code from redirectURL parameter>
|
||||
openhab:oauth Code getCachedAccessToken
|
||||
openhab:oauth Code refresh
|
||||
openhab:oauth Code close
|
||||
```
|
||||
|
||||
# Example 2: (Using ResourceOwner credentials i.e. you have the user's username and password directly)
|
||||
@ -34,36 +34,36 @@ smarthome oauth Code close
|
||||
## Try these on the OSGI console:
|
||||
|
||||
```
|
||||
smarthome oauth ResourceOwner create
|
||||
smarthome oauth ResourceOwner getClient <fill in handle from create step>
|
||||
smarthome oauth ResourceOwner getAccessTokenByResourceOwnerPassword
|
||||
smarthome oauth ResourceOwner getCachedAccessToken
|
||||
smarthome oauth ResourceOwner refresh
|
||||
smarthome oauth ResourceOwner close
|
||||
openhab:oauth ResourceOwner create
|
||||
openhab:oauth ResourceOwner getClient <fill in handle from create step>
|
||||
openhab:oauth ResourceOwner getAccessTokenByResourceOwnerPassword
|
||||
openhab:oauth ResourceOwner getCachedAccessToken
|
||||
openhab:oauth ResourceOwner refresh
|
||||
openhab:oauth ResourceOwner close
|
||||
```
|
||||
|
||||
### load again, similar to reboot/restart
|
||||
|
||||
```
|
||||
smarthome oauth ResourceOwner getClient <fill in handle from create step>
|
||||
smarthome oauth ResourceOwner getCachedAccessToken
|
||||
smarthome oauth ResourceOwner refresh
|
||||
openhab:oauth ResourceOwner getClient <fill in handle from create step>
|
||||
openhab:oauth ResourceOwner getCachedAccessToken
|
||||
openhab:oauth ResourceOwner refresh
|
||||
```
|
||||
|
||||
### Done playing, delete this service permanently
|
||||
|
||||
```
|
||||
smarthome oauth ResourceOwner delete <fill in handle from create step>
|
||||
openhab:oauth ResourceOwner delete <fill in handle from create step>
|
||||
```
|
||||
|
||||
### Verify this is deleted (will throw exception)
|
||||
|
||||
```
|
||||
smarthome oauth ResourceOwner getCachedAccessToken
|
||||
openhab:oauth ResourceOwner getCachedAccessToken
|
||||
```
|
||||
|
||||
### Cannot get the client after delete
|
||||
|
||||
```
|
||||
smarthome oauth ResourceOwner getClient <fill in handle from create step>
|
||||
openhab:oauth ResourceOwner getClient <fill in handle from create step>
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user