2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.aaa.impl.password.service;
10 import static com.google.common.base.Verify.verifyNotNull;
12 import com.google.common.annotations.Beta;
13 import com.google.common.annotations.VisibleForTesting;
14 import com.google.common.collect.ForwardingObject;
15 import java.util.Dictionary;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.aaa.password.service.config.rev170619.PasswordServiceConfig;
18 import org.opendaylight.yangtools.yang.binding.Augmentation;
19 import org.osgi.framework.FrameworkUtil;
20 import org.osgi.service.component.annotations.Activate;
21 import org.osgi.service.component.annotations.Component;
22 import org.osgi.service.component.annotations.Deactivate;
25 @Component(factory = OSGiPasswordServiceConfig.FACTORY_NAME)
26 public final class OSGiPasswordServiceConfig extends ForwardingObject implements PasswordServiceConfig {
27 // OSGi DS Component Factory name
28 static final String FACTORY_NAME = "org.opendaylight.aaa.impl.password.service.OSGiPasswordServiceConfig";
30 // Keys to for activation properties
32 static final String DELEGATE = ".delegate";
34 private PasswordServiceConfig delegate;
37 public Map<Class<? extends Augmentation<PasswordServiceConfig>>, Augmentation<PasswordServiceConfig>>
39 return delegate().augmentations();
43 public String getAlgorithm() {
44 return delegate().getAlgorithm();
48 public Integer getIterations() {
49 return delegate().getIterations();
53 public String getPrivateSalt() {
54 return delegate().getPrivateSalt();
58 public int hashCode() {
59 return delegate().hashCode();
63 public boolean equals(final Object obj) {
64 return delegate().equals(obj);
68 protected PasswordServiceConfig delegate() {
69 return verifyNotNull(delegate);
73 void activate(final Map<String, ?> properties) {
74 delegate = (PasswordServiceConfig) verifyNotNull(properties.get(DELEGATE));
82 static Dictionary<String, ?> props(final PasswordServiceConfig delegate) {
83 return FrameworkUtil.asDictionary(Map.of(DELEGATE, delegate));