mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-02-04 03:14:07 +01:00
[googlestt] Dispose oAuth2 service (#14936)
* [googlestt] Dispose oAuth2 service Related to #14818 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
parent
7bcf2e7faf
commit
5d65507584
@ -48,6 +48,7 @@ import org.osgi.framework.Constants;
|
|||||||
import org.osgi.service.cm.ConfigurationAdmin;
|
import org.osgi.service.cm.ConfigurationAdmin;
|
||||||
import org.osgi.service.component.annotations.Activate;
|
import org.osgi.service.component.annotations.Activate;
|
||||||
import org.osgi.service.component.annotations.Component;
|
import org.osgi.service.component.annotations.Component;
|
||||||
|
import org.osgi.service.component.annotations.Deactivate;
|
||||||
import org.osgi.service.component.annotations.Modified;
|
import org.osgi.service.component.annotations.Modified;
|
||||||
import org.osgi.service.component.annotations.Reference;
|
import org.osgi.service.component.annotations.Reference;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -117,6 +118,14 @@ public class GoogleSTTService implements STTService {
|
|||||||
updateConfig();
|
updateConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deactivate
|
||||||
|
protected void dispose() {
|
||||||
|
if (oAuthService != null) {
|
||||||
|
oAuthFactory.ungetOAuthService(SERVICE_PID);
|
||||||
|
oAuthService = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return SERVICE_ID;
|
return SERVICE_ID;
|
||||||
@ -157,6 +166,10 @@ public class GoogleSTTService implements STTService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateConfig() {
|
private void updateConfig() {
|
||||||
|
if (oAuthService != null) {
|
||||||
|
oAuthFactory.ungetOAuthService(SERVICE_PID);
|
||||||
|
oAuthService = null;
|
||||||
|
}
|
||||||
String clientId = this.config.clientId;
|
String clientId = this.config.clientId;
|
||||||
String clientSecret = this.config.clientSecret;
|
String clientSecret = this.config.clientSecret;
|
||||||
if (!clientId.isBlank() && !clientSecret.isBlank()) {
|
if (!clientId.isBlank() && !clientSecret.isBlank()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user