Adding final to the command line variable make the variable
finally initalized and not re-assign value at runtime.
Access the datastore using AaaShiroProvider and delete the
old datastore service.
Change-Id: I8c2f7d39bd5e9be5349a2b922bb8afdbbb0b15a3
Signed-off-by: serngawy <m.elserngawy@gmail.com>
16 files changed:
package org.opendaylight.aaa.cli;
import org.apache.karaf.shell.console.OsgiCommandSupport;
package org.opendaylight.aaa.cli;
import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.aaa.AAAShiroProvider;
import org.opendaylight.aaa.api.IIDMStore;
import org.opendaylight.aaa.api.model.User;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.api.IIDMStore;
import org.opendaylight.aaa.api.model.User;
import org.opendaylight.aaa.cli.utils.CliUtils;
private static volatile String authUser = null;
protected final IIDMStore identityStore;
private static volatile String authUser = null;
protected final IIDMStore identityStore;
- public AaaCliAbstractCommand(final IIDMStore identityStore) {
- this.identityStore = identityStore;
+ public AaaCliAbstractCommand() {
+ this.identityStore = AAAShiroProvider.getIdmStore();
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
-import org.opendaylight.aaa.api.IIDMStore;
import org.opendaylight.aaa.api.model.Domain;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.api.model.Domain;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
"--domainDescription" }, description = "The domain Description", required = true, multiValued = false)
private String domainDesc = "";
"--domainDescription" }, description = "The domain Description", required = true, multiValued = false)
private String domainDesc = "";
- public AddDomain(final IIDMStore identityStore) {
- super(identityStore);
+ public AddDomain() {
+ super();
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
-import org.opendaylight.aaa.api.IIDMStore;
import org.opendaylight.aaa.api.model.Grant;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.api.model.Grant;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
"--roleName" }, description = "The role name", required = false, multiValued = false)
private String roleName = "";
"--roleName" }, description = "The role name", required = false, multiValued = false)
private String roleName = "";
- public AddGrant(final IIDMStore identityStore) {
- super(identityStore);
+ public AddGrant() {
+ super();
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
-import org.opendaylight.aaa.api.IIDMStore;
import org.opendaylight.aaa.api.model.Role;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.api.model.Role;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
"--roleDescription" }, description = "The role Description", required = true, multiValued = false)
private String roleDesc = "";
"--roleDescription" }, description = "The role Description", required = true, multiValued = false)
private String roleDesc = "";
- public AddRole(final IIDMStore identityStore) {
- super(identityStore);
+ public AddRole() {
+ super();
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
-import org.opendaylight.aaa.api.IIDMStore;
import org.opendaylight.aaa.api.model.Grant;
import org.opendaylight.aaa.api.model.User;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.api.model.Grant;
import org.opendaylight.aaa.api.model.User;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
description = "The user name",
required = true,
multiValued = false)
description = "The user name",
required = true,
multiValued = false)
- private final String userName = "";
+ private String userName = "";
@Option(name = "-dname",
aliases = { "--domainName" },
description = "The domain name",
required = true,
multiValued = false)
@Option(name = "-dname",
aliases = { "--domainName" },
description = "The domain name",
required = true,
multiValued = false)
- private final String domainName = "";
+ private String domainName = "";
@Option(name = "-rname",
aliases = { "--roleName" },
description = "The role name",
required = false,
multiValued = false)
@Option(name = "-rname",
aliases = { "--roleName" },
description = "The role name",
required = false,
multiValued = false)
- private final String roleName = "";
+ private String roleName = "";
@Option(name = "-desc",
aliases = { "--userDescription" },
description = "The user Description",
required = false,
multiValued = false)
@Option(name = "-desc",
aliases = { "--userDescription" },
description = "The user Description",
required = false,
multiValued = false)
- private final String userDesc = "";
+ private String userDesc = "";
@Option(name = "-email",
aliases = { "--userEmail" },
description = "The user email",
required = false,
multiValued = false)
@Option(name = "-email",
aliases = { "--userEmail" },
description = "The user email",
required = false,
multiValued = false)
- private final String userEmail = "";
+ private String userEmail = "";
- public AddUser(final IIDMStore identityStore) {
- super(identityStore);
+ public AddUser() {
+ super();
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
import org.apache.karaf.shell.console.OsgiCommandSupport;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.aaa.AAAShiroProvider;
import org.opendaylight.aaa.api.IIDMStore;
import org.opendaylight.aaa.api.SHA256Calculator;
import org.opendaylight.aaa.api.model.User;
import org.opendaylight.aaa.api.IIDMStore;
import org.opendaylight.aaa.api.SHA256Calculator;
import org.opendaylight.aaa.api.model.User;
"--userName" }, description = "The user name", required = true, multiValued = false)
private String userName = "";
"--userName" }, description = "The user name", required = true, multiValued = false)
private String userName = "";
- public ChangeUserPassword(final IIDMStore identityStore) {
- this.identityStore = identityStore;
+ public ChangeUserPassword() {
+ this.identityStore = AAAShiroProvider.getIdmStore();
package org.opendaylight.aaa.cli.dmstore;
import org.apache.karaf.shell.commands.Command;
package org.opendaylight.aaa.cli.dmstore;
import org.apache.karaf.shell.commands.Command;
-import org.opendaylight.aaa.api.IIDMStore;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
*/
public class ListODLDomains extends AaaCliAbstractCommand {
*/
public class ListODLDomains extends AaaCliAbstractCommand {
- public ListODLDomains(final IIDMStore identityStore) {
- super(identityStore);
+ public ListODLDomains() {
+ super();
package org.opendaylight.aaa.cli.dmstore;
import org.apache.karaf.shell.commands.Command;
package org.opendaylight.aaa.cli.dmstore;
import org.apache.karaf.shell.commands.Command;
-import org.opendaylight.aaa.api.IIDMStore;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
*/
public class ListODLRoles extends AaaCliAbstractCommand {
*/
public class ListODLRoles extends AaaCliAbstractCommand {
- public ListODLRoles(final IIDMStore identityStore) {
- super(identityStore);
+ public ListODLRoles() {
+ super();
package org.opendaylight.aaa.cli.dmstore;
import org.apache.karaf.shell.commands.Command;
package org.opendaylight.aaa.cli.dmstore;
import org.apache.karaf.shell.commands.Command;
-import org.opendaylight.aaa.api.IIDMStore;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
*/
public class ListODLUsers extends AaaCliAbstractCommand {
*/
public class ListODLUsers extends AaaCliAbstractCommand {
- public ListODLUsers(final IIDMStore identityStore) {
- super(identityStore);
+ public ListODLUsers() {
+ super();
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
-import org.opendaylight.aaa.api.IIDMStore;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.cli.utils.DataStoreUtils;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.cli.utils.DataStoreUtils;
"--domainName" }, description = "The domain name", required = true, multiValued = false)
private String domainName = "";
"--domainName" }, description = "The domain name", required = true, multiValued = false)
private String domainName = "";
- public RemoveDomain(final IIDMStore identityStore) {
- super(identityStore);
+ public RemoveDomain() {
+ super();
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
-import org.opendaylight.aaa.api.IIDMStore;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.cli.utils.DataStoreUtils;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.cli.utils.DataStoreUtils;
"--roleName" }, description = "The role name", required = false, multiValued = false)
private String roleName = "";
"--roleName" }, description = "The role name", required = false, multiValued = false)
private String roleName = "";
- public RemoveGrant(final IIDMStore identityStore) {
- super(identityStore);
+ public RemoveGrant() {
+ super();
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
-import org.opendaylight.aaa.api.IIDMStore;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.cli.utils.DataStoreUtils;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.cli.utils.DataStoreUtils;
@Option(name = "-name", aliases = {
"--roleName" }, description = "The role name", required = true, multiValued = false)
@Option(name = "-name", aliases = {
"--roleName" }, description = "The role name", required = true, multiValued = false)
- private final String roleName = "";
+ private String roleName = "";
- public RemoveRole(final IIDMStore identityStore) {
- super(identityStore);
+ public RemoveRole() {
+ super();
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
-import org.opendaylight.aaa.api.IIDMStore;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.cli.utils.DataStoreUtils;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.cli.utils.DataStoreUtils;
"--userName" }, description = "The user name", required = true, multiValued = false)
private String userName = "";
"--userName" }, description = "The user name", required = true, multiValued = false)
private String userName = "";
- public RemoveUser(final IIDMStore identityStore) {
- super(identityStore);
+ public RemoveUser() {
+ super();
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command>
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command>
- <action class="org.opendaylight.aaa.cli.dmstore.ListODLUsers">
- <argument ref="iIDMStore" />
- </action>
+ <action class="org.opendaylight.aaa.cli.dmstore.ListODLUsers" />
- <action class="org.opendaylight.aaa.cli.dmstore.ListODLDomains">
- <argument ref="iIDMStore" />
- </action>
+ <action class="org.opendaylight.aaa.cli.dmstore.ListODLDomains" />
- <action class="org.opendaylight.aaa.cli.dmstore.ListODLRoles">
- <argument ref="iIDMStore" />
- </action>
+ <action class="org.opendaylight.aaa.cli.dmstore.ListODLRoles" />
- <action class="org.opendaylight.aaa.cli.dmstore.ChangeUserPassword">
- <argument ref="iIDMStore" />
- </action>
+ <action class="org.opendaylight.aaa.cli.dmstore.ChangeUserPassword" />
</command>
<command>
<action class="org.opendaylight.aaa.cli.cert.GetODLSelfSignCert">
</command>
<command>
<action class="org.opendaylight.aaa.cli.cert.GetODLSelfSignCert">
</action>
</command>
<command>
</action>
</command>
<command>
- <action class="org.opendaylight.aaa.cli.dmstore.AddRole">
- <argument ref="iIDMStore" />
- </action>
+ <action class="org.opendaylight.aaa.cli.dmstore.AddRole" />
- <action class="org.opendaylight.aaa.cli.dmstore.AddDomain">
- <argument ref="iIDMStore" />
- </action>
+ <action class="org.opendaylight.aaa.cli.dmstore.AddDomain" />
- <action class="org.opendaylight.aaa.cli.dmstore.AddUser">
- <argument ref="iIDMStore" />
- </action>
+ <action class="org.opendaylight.aaa.cli.dmstore.AddUser" />
- <action class="org.opendaylight.aaa.cli.dmstore.AddGrant">
- <argument ref="iIDMStore" />
- </action>
+ <action class="org.opendaylight.aaa.cli.dmstore.AddGrant" />
- <action class="org.opendaylight.aaa.cli.dmstore.RemoveGrant">
- <argument ref="iIDMStore" />
- </action>
+ <action class="org.opendaylight.aaa.cli.dmstore.RemoveGrant" />
- <action class="org.opendaylight.aaa.cli.dmstore.RemoveUser">
- <argument ref="iIDMStore" />
- </action>
+ <action class="org.opendaylight.aaa.cli.dmstore.RemoveUser" />
- <action class="org.opendaylight.aaa.cli.dmstore.RemoveRole">
- <argument ref="iIDMStore" />
- </action>
+ <action class="org.opendaylight.aaa.cli.dmstore.RemoveRole" />
- <action class="org.opendaylight.aaa.cli.dmstore.RemoveDomain">
- <argument ref="iIDMStore" />
- </action>
+ <action class="org.opendaylight.aaa.cli.dmstore.RemoveDomain" />
</command>
</command-bundle>
</command>
</command-bundle>
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.opendaylight.aaa.api.IIDMStore;
import org.opendaylight.aaa.api.model.User;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.SessionsManager;
import org.opendaylight.aaa.api.model.User;
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.SessionsManager;
class TestAaaCliAbstractCommand extends AaaCliAbstractCommand {
class TestAaaCliAbstractCommand extends AaaCliAbstractCommand {
- TestAaaCliAbstractCommand(IIDMStore identityStore) {
- super(identityStore);
+ TestAaaCliAbstractCommand() {
+ super();
<instructions>
<Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
<Export-Package>
<instructions>
<Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
<Export-Package>
org.opendaylight.aaa.shiro,
org.opendaylight.aaa.shiro.idm,
org.opendaylight.aaa.shiro.tokenauthrealm,
org.opendaylight.aaa.shiro,
org.opendaylight.aaa.shiro.idm,
org.opendaylight.aaa.shiro.tokenauthrealm,