]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.init/src/org/argeo/init/prefs/SystemRootPreferences.java
1 package org
.argeo
.init
.prefs
;
3 import java
.util
.concurrent
.CompletableFuture
;
4 import java
.util
.concurrent
.ExecutionException
;
5 import java
.util
.function
.Consumer
;
6 import java
.util
.prefs
.AbstractPreferences
;
7 import java
.util
.prefs
.BackingStoreException
;
9 public class SystemRootPreferences
extends AbstractPreferences
implements Consumer
<AbstractPreferences
> {
10 private CompletableFuture
<AbstractPreferences
> singleChild
;
12 protected SystemRootPreferences() {
17 public void accept(AbstractPreferences t
) {
18 this.singleChild
.complete(t
);
22 * ABSTRACT PREFERENCES
26 protected void putSpi(String key
, String value
) {
27 throw new UnsupportedOperationException();
31 protected String
getSpi(String key
) {
32 throw new UnsupportedOperationException();
36 protected void removeSpi(String key
) {
37 throw new UnsupportedOperationException();
41 protected void removeNodeSpi() throws BackingStoreException
{
42 throw new UnsupportedOperationException();
46 protected String
[] keysSpi() throws BackingStoreException
{
52 protected String
[] childrenNamesSpi() throws BackingStoreException
{
55 childName
= singleChild
.get().name();
56 } catch (InterruptedException
| ExecutionException e
) {
57 throw new IllegalStateException("Cannot get child preferences name", e
);
59 return new String
[] { childName
};
63 protected AbstractPreferences
childSpi(String name
) {
66 childName
= singleChild
.get().name();
67 } catch (InterruptedException
| ExecutionException e
) {
68 throw new IllegalStateException("Cannot get child preferences name", e
);
70 if (!childName
.equals(name
))
71 throw new IllegalArgumentException("Child name is " + childName
+ ", not " + name
);
76 protected void syncSpi() throws BackingStoreException
{
80 protected void flushSpi() throws BackingStoreException
{