* Only well-known ObjectName in configuration system, under which
* ConfigRegisry is registered.
*/
- public static final ObjectName OBJECT_NAME = ConfigRegistryConstants.OBJECT_NAME;
- public static final ObjectName OBJECT_NAME_NO_NOTIFICATIONS = ConfigRegistryConstants.OBJECT_NAME_NO_NOTIFICATIONS;
+ ObjectName OBJECT_NAME = ConfigRegistryConstants.OBJECT_NAME;
+ ObjectName OBJECT_NAME_NO_NOTIFICATIONS = ConfigRegistryConstants.OBJECT_NAME_NO_NOTIFICATIONS;
/**
* Opens new configuration transaction.
*
* @param rootRuntimeBeanRegistrator
*/
- public void setRuntimeBeanRegistrator(
+ void setRuntimeBeanRegistrator(
RootRuntimeBeanRegistrator rootRuntimeBeanRegistrator);
}
* one SI can extend another one, in which case all annotations in hierarchy
* will be observed.
*/
-public abstract interface AbstractServiceInterface {
+public interface AbstractServiceInterface {
}
}
enum NotificationType {
- COMMIT;
+ COMMIT
}
}
public static <T> WaitingServiceTracker<T> create(@Nonnull Class<T> serviceInterface, @Nonnull BundleContext context) {
ServiceTracker<T, ?> tracker = new ServiceTracker<>(context, serviceInterface, null);
tracker.open();
- return new WaitingServiceTracker<T>(serviceInterface, tracker);
+ return new WaitingServiceTracker<>(serviceInterface, tracker);
}
/**
try {
ServiceTracker<T, ?> tracker = new ServiceTracker<>(context, context.createFilter(newFilter), null);
tracker.open();
- return new WaitingServiceTracker<T>(serviceInterface, tracker);
+ return new WaitingServiceTracker<>(serviceInterface, tracker);
} catch(InvalidSyntaxException e) {
throw new IllegalArgumentException(String.format("Invalid OSGi filter %s", newFilter), e);
}
* @param oldModule old instance of Module
* @return true if the instance produced by oldModule can be reused with current instance as well.
*/
- public boolean canReuse(Module oldModule);
+ boolean canReuse(Module oldModule);
}
*
* @return human-friendly implementation name
*/
- public String getImplementationName();
+ String getImplementationName();
/**
* Create a new Module instance. The returned object is expected to use the
* @return newly created module
*
*/
- public Module createModule(String instanceName,
+ Module createModule(String instanceName,
DependencyResolver dependencyResolver, BundleContext bundleContext);
/**
* leaves server in a running state but no configuration
* transaction can be created.
*/
- public Module createModule(String instanceName, DependencyResolver dependencyResolver,
+ Module createModule(String instanceName, DependencyResolver dependencyResolver,
DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception;
boolean isModuleImplementingServiceInterface(
*
* @return set of default modules. Null is not allowed.
*/
- public Set<? extends Module> getDefaultModules(DependencyResolverFactory dependencyResolverFactory,
+ Set<? extends Module> getDefaultModules(DependencyResolverFactory dependencyResolverFactory,
BundleContext bundleContext);
}
public interface AttributeReadingStrategy {
- public abstract AttributeConfigElement readElement(List<XmlElement> element) throws DocumentedException;
+ AttributeConfigElement readElement(List<XmlElement> element) throws DocumentedException;
}
/**
* Custom writer plugins must implement this interface.
*/
- static interface WriterPlugin {
+ interface WriterPlugin {
String writeObject(Object value);
}
// Rebuild open type. Underlying composite types might have changed
if (innerTypeResolvingStrategy.getOpenType() instanceof CompositeType) {
try {
- final ArrayType<?> openType = new ArrayType<Object>(getOpenType().getDimension(), innerTypeResolvingStrategy.getOpenType());
+ final ArrayType<?> openType =
+ new ArrayType<>(getOpenType().getDimension(), innerTypeResolvingStrategy.getOpenType());
setOpenType(openType);
} catch (OpenDataException e) {
throw new IllegalStateException("An error occurred during restoration of array type " + this
resolverPlugins.put(BigDecimal.class.getCanonicalName(), new BigDecimalResolver());
}
- static interface Resolver {
+ interface Resolver {
Object resolveObject(Class<?> type, String attrName, String value) throws DocumentedException;
}
}
private interface ResolvingStrategy<T> {
- public T resolveElement(ModuleConfig moduleMapping, XmlElement moduleElement, ServiceRegistryWrapper serviceTracker,
- String instanceName, String moduleNamespace, EditStrategyType defaultStrategy) throws DocumentedException;
+ T resolveElement(ModuleConfig moduleMapping, XmlElement moduleElement, ServiceRegistryWrapper serviceTracker,
+ String instanceName, String moduleNamespace, EditStrategyType defaultStrategy) throws DocumentedException;
}
}
yangStoreService.refresh(runtimeContext);
}
- yangStoreServiceServiceRegistration = context.registerService(YangStoreService.class, yangStoreService, new Hashtable<String, Object>());
+ yangStoreServiceServiceRegistration = context.registerService(YangStoreService.class, yangStoreService,
+ new Hashtable<>());
configRegistryLookup = new ConfigRegistryLookupThread(yangStoreService);
configRegistryLookup.start();
return yangStoreService;
final ConfigSubsystemFacadeFactory configSubsystemFacade =
new ConfigSubsystemFacadeFactory(jmxClient, jmxClientNoNotifications, yangStoreService);
- osgiRegistrayion = context.registerService(ConfigSubsystemFacadeFactory.class, configSubsystemFacade, new Hashtable<String, Object>());
+ osgiRegistrayion = context.registerService(ConfigSubsystemFacadeFactory.class, configSubsystemFacade,
+ new Hashtable<>());
}
}
}
* of the listener set.
*/
@GuardedBy("listeners")
- private final Set<ModuleListener> listeners = new HashSet<ModuleListener>();
+ private final Set<ModuleListener> listeners = new HashSet<>();
/**
* This is the latest snapshot. Some of its state is always initialized, but the MXBean maps potentially cause
transactionStatus.checkCommitStarted();
if (maxDependencyDepth == null) {
maxDependencyDepth = getMaxDepth(this, manager,
- new LinkedHashSet<ModuleIdentifier>());
+ new LinkedHashSet<>());
}
}
*/
static <T extends Annotation> List<T> findClassAnnotationInSuperClassesAndIfcs(
final Class<?> clazz, final Class<T> annotationType, final Set<Class<?>> interfaces) {
- List<T> result = new ArrayList<T>();
+ List<T> result = new ArrayList<>();
Class<?> declaringClass = clazz;
do {
T annotation = declaringClass.getAnnotation(annotationType);
.findMethodAnnotationInSuperClassesAndIfcs(setter, RequireInterface.class, inspectedInterfaces);
// make sure the list if not empty contains always annotation with same
// value
- Set<Class<?>> foundValues = new HashSet<Class<?>>();
+ Set<Class<?>> foundValues = new HashSet<>();
for (RequireInterface ri : foundRequireInterfaces) {
foundValues.add(ri.value());
}
public interface ReadOnlyAtomicBoolean {
boolean get();
- public static class ReadOnlyAtomicBooleanImpl implements
+ class ReadOnlyAtomicBooleanImpl implements
ReadOnlyAtomicBoolean {
private final AtomicBoolean atomicBoolean;
public interface ServiceReferenceRegistrator extends AutoCloseable {
- public String getNullableTransactionName();
+ String getNullableTransactionName();
ServiceReferenceJMXRegistration registerMBean(ServiceReferenceMXBeanImpl object,
ObjectName on) throws InstanceAlreadyExistsException;
@Override
void close();
- public static class ServiceReferenceJMXRegistration implements AutoCloseable {
+ class ServiceReferenceJMXRegistration implements AutoCloseable {
private final InternalJMXRegistration registration;
ServiceReferenceJMXRegistration(InternalJMXRegistration registration) {
}
}
- public static interface ServiceReferenceTransactionRegistratorFactory {
- public ServiceReferenceRegistrator create();
+ interface ServiceReferenceTransactionRegistratorFactory {
+ ServiceReferenceRegistrator create();
}
- public static class ServiceReferenceRegistratorImpl implements ServiceReferenceRegistrator {
+ class ServiceReferenceRegistratorImpl implements ServiceReferenceRegistrator {
private final InternalJMXRegistrator currentJMXRegistrator;
private final String nullableTransactionName;
public void close() {
currentJMXRegistrator.close();
}
- public static interface ServiceReferenceTransactionRegistratorFactory {
- public ServiceReferenceRegistrator create();
+ public interface ServiceReferenceTransactionRegistratorFactory {
+ ServiceReferenceRegistrator create();
}
}
- public static class ServiceReferenceTransactionRegistratorFactoryImpl implements ServiceReferenceTransactionRegistratorFactory {
+ class ServiceReferenceTransactionRegistratorFactoryImpl implements ServiceReferenceTransactionRegistratorFactory {
private final NestableJMXRegistrator parentRegistrator;
private final String nullableTransactionName;
}
@VisibleForTesting
- static interface BlankTransaction {
+ interface BlankTransaction {
CommitStatus hit() throws ValidationException, ConflictingVersionException;
}
}
}
}
- private static interface BundleStrategy {
+ private interface BundleStrategy {
void execute(BundleTrackerCustomizer<?> tracker);
}
return mock(BindingRuntimeContext.class);
}
- public static interface BundleContextServiceRegistrationHandler {
+ public interface BundleContextServiceRegistrationHandler {
void handleServiceRegistration(Class<?> clazz, Object serviceInstance, Dictionary<String, ?> props);
}
}
- public static interface SimpleBeanMBean {
+ public interface SimpleBeanMBean {
}
@Override
public Set<Module> getDefaultModules(DependencyResolverFactory dependencyResolverFactory, BundleContext bundleContext) {
- return new HashSet<Module>();
+ return new HashSet<>();
}
@Override
@ServiceInterfaceAnnotation(value = SIMPLE, osgiRegistrationType = Executor.class,
namespace = "ns", revision = "rev", localName = SIMPLE)
- static interface SimpleSI extends AbstractServiceInterface {
+ interface SimpleSI extends AbstractServiceInterface {
}
emptySetOfInterfaces(), "class");
}
- static interface SubSI extends SimpleSI {
+ interface SubSI extends SimpleSI {
}
@ServiceInterfaceAnnotation(value = SUBCLASS2, osgiRegistrationType = ExecutorService.class,
namespace = "ns", revision = "rev", localName = SUBCLASS2)
-
- static interface SubSI2 extends SubSI {
+ interface SubSI2 extends SubSI {
}
}
}
- public static interface HasSomeMethod {
+ public interface HasSomeMethod {
void setSomething(ObjectName objectName);
}
}
@Description("class")
- static interface HasSomeMethodWithAnnotations {
+ interface HasSomeMethodWithAnnotations {
@RequireInterface(SubSI2.class)
@Description("descr")
assertDescriptionOnClass(
HasSomeMethodWithAnnotationsImpl.class,
- new HashSet<Class<?>>(Arrays
+ new HashSet<>(Arrays
.asList(HasSomeMethodWithAnnotations.class)), "class");
}
namespace = "namespace", revision = "rev", localName = TestingParallelAPSPConfigMXBean.NAME)
public interface TestingParallelAPSPConfigMXBean {
- static final String NAME = "apsp";
+ String NAME = "apsp";
ObjectName getThreadPool();
@Override
public Set<Module> getDefaultModules(DependencyResolverFactory dependencyResolverFactory, BundleContext context) {
- return new HashSet<Module>();
+ return new HashSet<>();
}
@Override
mockedThreadPoolConfigFactory));
}
- public static interface MockedTestingThreadPoolConfigMXBean extends
+ public interface MockedTestingThreadPoolConfigMXBean extends
TestingThreadPoolConfigMXBean {
- public void setThreadCount(int threadCount);
+ void setThreadCount(int threadCount);
}
public static class MockedThreadPoolModule implements Module,
public interface TestingScheduledThreadPoolConfigBeanMXBean extends
TestingThreadPoolConfigMXBean {
- public boolean isRecreate();
+ boolean isRecreate();
- public void setRecreate(boolean recreate);
+ void setRecreate(boolean recreate);
- public void setThreadCount(int threadCount);
+ void setThreadCount(int threadCount);
}
@Override
public Set<Module> getDefaultModules(final DependencyResolverFactory dependencyResolverFactory, final BundleContext bundleContext) {
- return new HashSet<Module>();
+ return new HashSet<>();
}
@Override
namespace = "ns", revision = "foo", localName = "testing-threadpool")
public interface TestingThreadPoolServiceInterface extends
AbstractServiceInterface {
- public static final String QNAME = "(ns?revision=foo)testing-threadpool";
+ String QNAME = "(ns?revision=foo)testing-threadpool";
}
public interface TestingFixedThreadPoolConfigMXBean extends
TestingThreadPoolConfigMXBean {
- public void setThreadCount(int threadCount);
+ void setThreadCount(int threadCount);
- public boolean isTriggerNewInstanceCreation();
+ boolean isTriggerNewInstanceCreation();
- public void setTriggerNewInstanceCreation(boolean boolTest);
+ void setTriggerNewInstanceCreation(boolean boolTest);
}
@Override
public Set<Module> getDefaultModules(final DependencyResolverFactory dependencyResolverFactory, final BundleContext bundleContext) {
- return new HashSet<Module>();
+ return new HashSet<>();
}
@Override
public interface TestingThreadPoolConfigMXBean {
- public int getThreadCount();
+ int getThreadCount();
}
* Pushes configs into the config subsystem
*/
- public void pushConfigs(List<? extends ConfigSnapshotHolder> configs) throws InterruptedException;
+ void pushConfigs(List<? extends ConfigSnapshotHolder> configs) throws InterruptedException;
}
public void start(BundleContext context) throws Exception {
bc = context;
cpc = new ConfigPusherCustomizer();
- cpst = new ServiceTracker<ConfigPusher, ConfigPusher>(bc, ConfigPusher.class.getName(), cpc);
+ cpst = new ServiceTracker<>(bc, ConfigPusher.class.getName(), cpc);
cpst.open();
}
*/
public LinkedHashSet <? extends ChildAwareFeatureWrapper> getChildFeatures() throws Exception {
List<Dependency> dependencies = feature.getDependencies();
- LinkedHashSet <ChildAwareFeatureWrapper> childFeatures = new LinkedHashSet<ChildAwareFeatureWrapper>();
+ LinkedHashSet <ChildAwareFeatureWrapper> childFeatures = new LinkedHashSet<>();
if(dependencies != null) {
for(Dependency dependency: dependencies) {
Feature fi = extractFeatureFromDependency(dependency);
@Override
public LinkedHashSet<FeatureConfigSnapshotHolder> getFeatureConfigSnapshotHolders() throws Exception {
- LinkedHashSet <FeatureConfigSnapshotHolder> snapShotHolders = new LinkedHashSet<FeatureConfigSnapshotHolder>();
+ LinkedHashSet <FeatureConfigSnapshotHolder> snapShotHolders = new LinkedHashSet<>();
for(ChildAwareFeatureWrapper c: getChildFeatures()) {
for(FeatureConfigSnapshotHolder h: c.getFeatureConfigSnapshotHolders()) {
final Optional<FeatureConfigSnapshotHolder> featureConfigSnapshotHolder = getFeatureConfigSnapshotHolder(h.getFileInfo());
public class ConfigFeaturesListener implements FeaturesListener, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(ConfigFeaturesListener.class);
private static final int QUEUE_SIZE = 1000;
- private BlockingQueue<FeatureEvent> queue = new LinkedBlockingQueue<FeatureEvent>(QUEUE_SIZE);
+ private BlockingQueue<FeatureEvent> queue = new LinkedBlockingQueue<>(QUEUE_SIZE);
Thread pushingThread = null;
public ConfigFeaturesListener(ConfigPusher p, FeaturesService f) {
BundleContext bc = configPusherServiceReference.getBundle().getBundleContext();
ConfigPusher cpService = bc.getService(configPusherServiceReference);
featureServiceCustomizer = new FeatureServiceCustomizer(cpService);
- fsst = new ServiceTracker<FeaturesService, FeaturesService>(bc, FeaturesService.class.getName(), featureServiceCustomizer);
+ fsst = new ServiceTracker<>(bc, FeaturesService.class.getName(), featureServiceCustomizer);
fsst.open();
return cpService;
}
@Override
public void run() {
- List<Feature> toInstall = new ArrayList<Feature>();
+ List<Feature> toInstall = new ArrayList<>();
FeatureEvent event = null;
boolean interuppted = false;
while(true) {
* chains. Also, preserves the *original* Feature chain for which we pushed the config.
* (which is handy for logging).
*/
- LinkedHashSet<FeatureConfigSnapshotHolder> pushedConfigs = new LinkedHashSet<FeatureConfigSnapshotHolder>();
+ LinkedHashSet<FeatureConfigSnapshotHolder> pushedConfigs = new LinkedHashSet<>();
/*
* LinkedHashMultimap to track which configs we pushed for each Feature installation
* For future use
}
private LinkedHashSet<FeatureConfigSnapshotHolder> pushConfig(final LinkedHashSet<FeatureConfigSnapshotHolder> configs, final Feature feature) throws InterruptedException {
- LinkedHashSet<FeatureConfigSnapshotHolder> configsToPush = new LinkedHashSet<FeatureConfigSnapshotHolder>(configs);
+ LinkedHashSet<FeatureConfigSnapshotHolder> configsToPush = new LinkedHashSet<>(configs);
configsToPush.removeAll(pushedConfigs);
if (!configsToPush.isEmpty()) {
pushedConfigs.addAll(configsToPush);
}
- LinkedHashSet<FeatureConfigSnapshotHolder> configsPushed = new LinkedHashSet<FeatureConfigSnapshotHolder>(pushedConfigs);
+ LinkedHashSet<FeatureConfigSnapshotHolder> configsPushed = new LinkedHashSet<>(pushedConfigs);
configsPushed.retainAll(configs);
return configsPushed;
}
public class FeatureConfigSnapshotHolder implements ConfigSnapshotHolder {
private ConfigSnapshot unmarshalled = null;
private ConfigFileInfo fileInfo = null;
- private List<Feature> featureChain = new ArrayList<Feature>();
+ private List<Feature> featureChain = new ArrayList<>();
/*
* @param holder - FeatureConfigSnapshotHolder that we
public void process(List<AutoCloseable> autoCloseables, MBeanServerConnection platformMBeanServer,
Persister persisterAggregator, boolean propagateExceptions) throws InterruptedException {
while(processSingle(autoCloseables, platformMBeanServer, persisterAggregator, propagateExceptions)) {
- ;
}
}
// TODO this should be placed into API bundle for netconf
public interface Capability {
- public String getCapabilityUri();
+ String getCapabilityUri();
- public Optional<String> getModuleNamespace();
+ Optional<String> getModuleNamespace();
- public Optional<String> getModuleName();
+ Optional<String> getModuleName();
- public Optional<String> getRevision();
+ Optional<String> getRevision();
- public Optional<String> getCapabilitySchema();
+ Optional<String> getCapabilitySchema();
- public Collection<String> getLocation();
+ Collection<String> getLocation();
}
+ ":type=Module," + ObjectNameUtil.MODULE_FACTORY_NAME_KEY
+ "=" + moduleName2 + "," + ObjectNameUtil.INSTANCE_NAME_KEY
+ "=" + instName2);
- mapSub = new HashMap<String, ObjectName>();
- map = new HashMap<String, Map<String,ObjectName>>();
+ mapSub = new HashMap<>();
+ map = new HashMap<>();
}
@Override
*/
public interface ContextSetter {
- public void updateContext(LogbackModule module);
+ void updateContext(LogbackModule module);
}
public interface AutoCloseableEventExecutor extends EventExecutor, AutoCloseable {
- public static class CloseableEventExecutorMixin implements AutoCloseable {
+ class CloseableEventExecutorMixin implements AutoCloseable {
public static final int DEFAULT_SHUTDOWN_SECONDS = 1;
private final EventExecutor eventExecutor;
this.bundleContext = bundleContext;
}
- private static interface AutoCloseableEventLoopGroupInterface extends EventLoopGroup, AutoCloseable {
+ private interface AutoCloseableEventLoopGroupInterface extends EventLoopGroup, AutoCloseable {
}
}
this.bundleContext = bundleContext;
}
- private static interface AutoCloseableTimerInterface extends Timer, AutoCloseable {
+ private interface AutoCloseableTimerInterface extends Timer, AutoCloseable {
}
}
public interface ScheduledThreadPool extends ThreadPool {
@Override
- public ScheduledExecutorService getExecutor();
+ ScheduledExecutorService getExecutor();
}
\ No newline at end of file
*/
public interface ThreadPool {
- public ExecutorService getExecutor();
+ ExecutorService getExecutor();
- public int getMaxThreadCount();
+ int getMaxThreadCount();
}
\ No newline at end of file
* This impl saturates threadpool first, then queue. When both are full caller will get blocked.
*/
private static ForwardingBlockingQueue getQueue(Optional<Integer> capacity) {
- final BlockingQueue<Runnable> delegate = capacity.isPresent() ? new LinkedBlockingQueue<Runnable>(capacity.get()) : new LinkedBlockingQueue<Runnable>();
+ final BlockingQueue<Runnable> delegate = capacity.isPresent() ? new LinkedBlockingQueue<>(capacity.get()) : new LinkedBlockingQueue<>();
return new ForwardingBlockingQueue(delegate);
}
try {
LOG.debug("Testing {}", yangFile);
ModuleMXBeanEntry.create(testedModule,
- new HashMap<QName, ServiceInterfaceEntry>(), context,
+ new HashMap<>(), context,
new TypeProviderWrapper(new TypeProviderImpl(context)),
PACKAGE_NAME);
fail(yangFile.toString()
assertThat(toAttr.getLowerCaseCammelCase(), is("peer"));
assertThat(toAttr.getUpperCaseCammelCase(), is("Peer"));
assertThat(toAttr.getOpenType(), isA(CompositeType.class));
- Set<String> propsExpected = new HashSet<String>(2);
+ Set<String> propsExpected = new HashSet<>(2);
propsExpected.add("port");
propsExpected.add("core-size");
assertThat(toAttr.getYangPropertiesToTypesMap().keySet(),
is(propsExpected));
- propsExpected = new HashSet<String>(2);
+ propsExpected = new HashSet<>(2);
propsExpected.add("Port");
propsExpected.add("CoreSize");
assertThat(
toAttr.getCapitalizedPropertiesToTypesMap().keySet(),
is(propsExpected));
- propsExpected = new HashSet<String>(2);
+ propsExpected = new HashSet<>(2);
propsExpected.add("port");
propsExpected.add("coreSize");
assertThat(toAttr.getJmxPropertiesToTypesMap().keySet(),
assertEquals(THREAD_RUNTIME_BEAN_YANG_NAME, runtimeBeanEntry.getYangName());
// get thread runtime bean rpcs
- List<RuntimeBeanEntry.Rpc> rpcs = new ArrayList<RuntimeBeanEntry.Rpc>(
+ List<RuntimeBeanEntry.Rpc> rpcs = new ArrayList<>(
runtimeBeanEntry.getRpcs());
assertEquals(2, rpcs.size());