public class Mapping extends Object implements Comparable<Mapping>
Mapping class defines the mapping of a service's name and
optional service information to a user name and optionally to a set of principal names.| Modifier and Type | Field and Description |
|---|---|
static String |
SERVICENAME
The name of the osgi property holding the service name.
|
| Constructor and Description |
|---|
Mapping(String spec)
Creates a mapping entry for the entry specification of the form:
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Mapping o) |
static Set<String> |
extractPrincipalNames(String s) |
String |
getServiceName() |
String |
getSubServiceName() |
String |
map(String serviceName,
String subServiceName)
Returns the user name if the
serviceName and the
serviceInfo match and a single user name is configured (in contrast
to a set of principal names). |
Iterable<String> |
mapPrincipals(String serviceName,
String subServiceName)
Returns the principal names if the
serviceName and the
serviceInfo match and principal names have been configured. |
String |
toString() |
public static String SERVICENAME
public Mapping(String spec)
spec = serviceName [ ":" subServiceName ] "=" userName | "[" principalNames "]" principalNames = principalName ["," principalNames]
spec - The mapping specification.NullPointerException - if spec is null.IllegalArgumentException - if spec does not match the
expected pattern.public String map(String serviceName, String subServiceName)
serviceName and the
serviceInfo match and a single user name is configured (in contrast
to a set of principal names). Otherwise null is returned.serviceName - The name of the service to match. If this is
null this mapping will not match.subServiceName - The Subservice Name to match. This may be
null.null otherwise.public Iterable<String> mapPrincipals(String serviceName, String subServiceName)
serviceName and the
serviceInfo match and principal names have been configured.
Otherwise null is returned. If no principal names are configured
map(String, String) needs to be used instead.serviceName - The name of the service to match. If this is
null this mapping will not match.subServiceName - The Subservice Name to match. This may be
null.null
otherwise.public String getServiceName()
public String getSubServiceName()
public int compareTo(Mapping o)
compareTo in interface Comparable<Mapping>Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.