public class BasicLocationRegistry extends java.lang.Object implements LocationRegistry
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
log |
Constructor and Description |
---|
BasicLocationRegistry(ManagementContext mgmt) |
Modifier and Type | Method and Description |
---|---|
boolean |
canMaybeResolve(java.lang.String spec)
Deprecated.
|
static java.util.List<java.lang.String> |
expandCommaSeparateLocations(java.lang.String locations)
Splits a comma-separated list of locations (names or specs) into an explicit list.
|
LocationDefinition |
getDefinedLocationById(java.lang.String id)
returns a LocationDefinition given its ID (usually a random string), or null if none
|
LocationDefinition |
getDefinedLocationByName(java.lang.String name)
returns a LocationDefinition given its name (e.g.
|
java.util.Map<java.lang.String,LocationDefinition> |
getDefinedLocations()
map of ID (possibly randomly generated) to the definition (spec, name, id, and props;
where spec is the spec as defined, for instance possibly another named:xxx location)
|
java.util.Map |
getProperties() |
static boolean |
isResolverPrefixForSpec(LocationResolver resolver,
java.lang.String spec,
boolean argumentRequired)
providers default impl for RegistryLocationResolver.accepts
|
boolean |
registerResolver(LocationResolver r)
Registers the given resolver, invoking
LocationResolver.init(ManagementContext) on the argument
and returning true, unless the argument indicates false for LocationResolver.EnableableLocationResolver.isEnabled() |
void |
removeDefinedLocation(java.lang.String id)
removes the defined location from the registry (applications running there are unaffected)
|
java.util.List<Location> |
resolve(java.lang.Iterable<?> spec)
As
LocationRegistry.resolve(String) but takes collections (of strings or locations) |
Location |
resolve(LocationDefinition ld)
As {@link #resolve(LocationDefinition, Boolean, Map), with the location managed, and no additional flags,
unwrapping the result (throwing if not resolvable)
|
Maybe<Location> |
resolve(LocationDefinition ld,
java.lang.Boolean manage,
java.util.Map locationFlags)
Returns a fully populated (config etc) location from the given definition, with optional add'l flags.
|
Location |
resolve(LocationDefinition ld,
java.util.Map<?,?> flags)
Deprecated.
|
Location |
resolve(java.lang.String spec)
See
LocationRegistry.resolve(String, Boolean, Map) ; asks for the location to be managed, and supplies no additional flags,
and unwraps the result (throwing if the spec cannot be resolve) |
Maybe<Location> |
resolve(java.lang.String spec,
boolean manage)
Deprecated.
|
Maybe<Location> |
resolve(java.lang.String spec,
java.lang.Boolean manage,
java.util.Map locationFlags)
Returns a location created from the given spec, which might correspond to a definition, or created on-the-fly.
|
Location |
resolve(java.lang.String spec,
java.util.Map locationFlags)
As
LocationRegistry.resolve(String, Boolean, Map) , but unwrapped |
Location |
resolveForPeeking(LocationDefinition ld)
Deprecated.
|
Location |
resolveIfPossible(java.lang.String spec)
Deprecated.
|
java.util.List<Location> |
resolveList(java.lang.Object l)
Takes a string, interpreted as a comma-separated (or JSON style, when you need internal double quotes or commas) list;
or a list, passed to
LocationRegistry.resolve(Iterable) ; or null/empty (empty list),
and returns a list of resolved (created and managed) locations |
Location |
resolveLocationDefinition(LocationDefinition ld,
java.util.Map locationFlags,
java.lang.String optionalName)
Deprecated.
since 0.7.0 not used (and optionalName was ignored anyway)
|
static void |
setupLocationRegistryForTesting(ManagementContext mgmt) |
void |
updateDefinedLocation(LocationDefinition l)
adds or updates the given defined location
|
void |
updateDefinedLocations() |
public BasicLocationRegistry(ManagementContext mgmt)
public static java.util.List<java.lang.String> expandCommaSeparateLocations(java.lang.String locations)
public boolean registerResolver(LocationResolver r)
LocationResolver.init(ManagementContext)
on the argument
and returning true, unless the argument indicates false for LocationResolver.EnableableLocationResolver.isEnabled()
public java.util.Map<java.lang.String,LocationDefinition> getDefinedLocations()
LocationRegistry
getDefinedLocations
in interface LocationRegistry
public LocationDefinition getDefinedLocationById(java.lang.String id)
LocationRegistry
getDefinedLocationById
in interface LocationRegistry
public LocationDefinition getDefinedLocationByName(java.lang.String name)
LocationRegistry
getDefinedLocationByName
in interface LocationRegistry
public void updateDefinedLocation(LocationDefinition l)
LocationRegistry
updateDefinedLocation
in interface LocationRegistry
public void removeDefinedLocation(java.lang.String id)
LocationRegistry
removeDefinedLocation
in interface LocationRegistry
public void updateDefinedLocations()
@Deprecated public boolean canMaybeResolve(java.lang.String spec)
LocationRegistry
LocationRegistry.resolve(String, Boolean, Map)
which has stronger guaranteescanMaybeResolve
in interface LocationRegistry
public final Location resolve(java.lang.String spec)
LocationRegistry
LocationRegistry.resolve(String, Boolean, Map)
; asks for the location to be managed, and supplies no additional flags,
and unwraps the result (throwing if the spec cannot be resolve)resolve
in interface LocationRegistry
@Deprecated public final Location resolveIfPossible(java.lang.String spec)
LocationRegistry
LocationRegistry.resolve(String)
but returning null (never throwing)resolveIfPossible
in interface LocationRegistry
@Deprecated public final Maybe<Location> resolve(java.lang.String spec, boolean manage)
public Maybe<Location> resolve(java.lang.String spec, java.lang.Boolean manage, java.util.Map locationFlags)
LocationRegistry
resolve
in interface LocationRegistry
public final Location resolve(java.lang.String spec, java.util.Map locationFlags)
LocationRegistry
LocationRegistry.resolve(String, Boolean, Map)
, but unwrappedresolve
in interface LocationRegistry
public static boolean isResolverPrefixForSpec(LocationResolver resolver, java.lang.String spec, boolean argumentRequired)
public java.util.List<Location> resolve(java.lang.Iterable<?> spec)
LocationRegistry
LocationRegistry.resolve(String)
but takes collections (of strings or locations)
Expects a collection of elements being individual location spec strings or locations, and returns a list of resolved (newly created and managed) locations.
From 0.7.0 this no longer flattens lists (nested lists are disallowed) or parses comma-separated elements (they are resolved as-is)
resolve
in interface LocationRegistry
public java.util.List<Location> resolveList(java.lang.Object l)
LocationRegistry
LocationRegistry.resolve(Iterable)
; or null/empty (empty list),
and returns a list of resolved (created and managed) locationsresolveList
in interface LocationRegistry
public Location resolve(LocationDefinition ld)
LocationRegistry
resolve
in interface LocationRegistry
@Deprecated public Location resolveForPeeking(LocationDefinition ld)
LocationRegistry
resolveForPeeking
in interface LocationRegistry
@Deprecated public Location resolve(LocationDefinition ld, java.util.Map<?,?> flags)
LocationRegistry
resolve
in interface LocationRegistry
@Deprecated public Location resolveLocationDefinition(LocationDefinition ld, java.util.Map locationFlags, java.lang.String optionalName)
public Maybe<Location> resolve(LocationDefinition ld, java.lang.Boolean manage, java.util.Map locationFlags)
LocationRegistry
The manage parameter is Boolean
so that null can be used to say rely on anything in the flags.
resolve
in interface LocationRegistry
public java.util.Map getProperties()
getProperties
in interface LocationRegistry
public static void setupLocationRegistryForTesting(ManagementContext mgmt)