@Service public class ModelRegistry extends Object
model sources associated to
mappable types and the corresponding logic to
lookup these relationships.| Constructor and Description |
|---|
ModelRegistry() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(String[] types,
OsgiBeanSource<?> source)
Adds the type[] -&t; model relationship to the registry.
|
List<OsgiBeanSource<?>> |
getBeanSources() |
Map<String,Collection<OsgiBeanSource<?>>> |
getTypeMappings() |
Collection<LookupResult> |
lookupAllModels(org.apache.sling.api.resource.Resource resource)
Finds the all models for the given
Resource, i.e. |
Collection<LookupResult> |
lookupMostSpecificModels(org.apache.sling.api.resource.Resource resource)
Finds the most specific models for the given
Resource, i.e. |
Collection<LookupResult> |
lookupMostSpecificModels(org.apache.sling.api.resource.Resource resource,
Class<?> targetType)
Finds the most specific models for the given resource which are
assignable to the target type. |
Collection<LookupResult> |
lookupMostSpecificModels(org.apache.sling.api.resource.Resource resource,
String beanName)
Finds the most specific models for the given
Resource. |
void |
removeInvalidReferences()
|
void |
removeResourceModels(org.osgi.framework.Bundle bundle)
Removes all resource models originating from the given bundle from this registry.
|
void |
shutdown()
Clears the registry upon shutdown.
|
public Collection<LookupResult> lookupMostSpecificModels(org.apache.sling.api.resource.Resource resource, String beanName)
Resource. The model's bean
name must match the provided bean name.resource - must not be null.beanName - must not be null.null if no such models exist.public Collection<LookupResult> lookupMostSpecificModels(org.apache.sling.api.resource.Resource resource)
Resource, i.e. the
first model(s) found when traversing the resource's
mappable hierarchy.resource - must not be null.null if no models exist for the resource.public Collection<LookupResult> lookupAllModels(org.apache.sling.api.resource.Resource resource)
Resource, i.e. the
all model(s) found when traversing the resource's
mappable hierarchy.resource - must not be null.null if no models exist for the resource.public Collection<LookupResult> lookupMostSpecificModels(org.apache.sling.api.resource.Resource resource, Class<?> targetType)
assignable to the target type.resource - must not be null.targetType - must not be null.null if no such model exists.@PreDestroy public void shutdown()
public void removeResourceModels(org.osgi.framework.Bundle bundle)
bundle - must not be null.public List<OsgiBeanSource<?>> getBeanSources()
null but rather an empty list.public void add(String[] types, OsgiBeanSource<?> source)
types - must not be null.source - must not be null.public Map<String,Collection<OsgiBeanSource<?>>> getTypeMappings()
@Scheduled(fixedRate=30000L) public void removeInvalidReferences()
Copyright © 2014–2015. All rights reserved.