public class FeatureRegistry extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
FeatureRegistry.FeatureBundle |
static class |
FeatureRegistry.LookupResult |
| Modifier and Type | Field and Description |
|---|---|
static String |
CACHE_NAME |
static com.google.common.base.Splitter |
CRLF_SPLITTER |
static String |
FILE_SCHEME |
static String |
RESOURCE_SCHEME |
| Constructor and Description |
|---|
FeatureRegistry(FeatureResourceLoader resourceLoader,
CacheProvider cacheProvider,
List<String> features,
FeatureFileSystem fileSystem)
Construct a new FeatureRegistry, using resourceLoader to load actual resources,
and loading data from the list of features provided, each of which points to a
directory (whose .xml files will be scanned), file (interpreted as feature.xml),
or resource (interpreted as feature.xml).
|
FeatureRegistry(FeatureResourceLoader resourceLoader,
CacheProvider cacheProvider,
List<String> features,
FeatureFileSystem fileSystem,
String repository) |
| Modifier and Type | Method and Description |
|---|---|
Set<String> |
getAllFeatureNames()
Helper method, returns all known feature names.
|
FeatureRegistry.LookupResult |
getAllFeatures()
Returns all known FeatureResources in dependency order, as described in getFeatureResources.
|
FeatureRegistry.LookupResult |
getFeatureResources(GadgetContext ctx,
Collection<String> needed,
List<String> unsupported)
Helper method retrieving feature resources, including transitive dependencies.
|
FeatureRegistry.LookupResult |
getFeatureResources(GadgetContext ctx,
Collection<String> needed,
List<String> unsupported,
boolean transitive)
For the given list of needed features, retrieves all the FeatureResource objects that
contain their content and, if requested, that of their transitive dependencies.
|
List<String> |
getFeatures(Collection<String> needed)
Calculates and returns a dependency-ordered (as in getFeatureResources) list of features
included directly or transitively from the specified list of needed features.
|
String |
getRepository() |
protected void |
loadFeature(Uri parent,
String xml,
Map<String,org.apache.shindig.gadgets.features.FeatureRegistry.FeatureNode> featureMapBuilder)
Method that loads gadget features.
|
protected String |
makeCacheKey(Collection<String> needed,
GadgetContext ctx,
List<String> unsupported) |
protected com.google.common.collect.ImmutableMap<String,org.apache.shindig.gadgets.features.FeatureRegistry.FeatureNode> |
register(List<String> resourceList)
Reads and registers all of the features in the directory, or the file, specified by
the given resourceKey.
|
public static final String CACHE_NAME
public static final String RESOURCE_SCHEME
public static final String FILE_SCHEME
public static final com.google.common.base.Splitter CRLF_SPLITTER
@Inject public FeatureRegistry(FeatureResourceLoader resourceLoader, CacheProvider cacheProvider, List<String> features, FeatureFileSystem fileSystem) throws GadgetException
resourceLoader - features - GadgetExceptionpublic FeatureRegistry(FeatureResourceLoader resourceLoader, CacheProvider cacheProvider, List<String> features, FeatureFileSystem fileSystem, String repository) throws GadgetException
GadgetExceptionpublic String getRepository()
protected com.google.common.collect.ImmutableMap<String,org.apache.shindig.gadgets.features.FeatureRegistry.FeatureNode> register(List<String> resourceList) throws GadgetException
resourceList - The files or directories to load the feature from. If feature.xml
is passed in directly, it will be loaded as a single feature. If a
directory is passed, any features in that directory (recursively) will
be loaded. If res://*.txt or res:*.txt is passed, we will look for named resources
in the text file. If path is prefixed with res:// or res:, the file
is treated as a resource, and all references are assumed to be
resources as well. Multiple locations may be specified by separating
them with a comma.GadgetException - If any of the files can't be read, are malformed, or invalid.public FeatureRegistry.LookupResult getFeatureResources(GadgetContext ctx, Collection<String> needed, List<String> unsupported, boolean transitive)
ctx - Context for the request.needed - List of all needed features.unsupported - If non-null, a List populated with unknown features from the needed list.public FeatureRegistry.LookupResult getFeatureResources(GadgetContext ctx, Collection<String> needed, List<String> unsupported)
ctx - Context for the request.needed - List of all needed features.unsupported - If non-null, a List populated with unknown features from the needed list.public FeatureRegistry.LookupResult getAllFeatures()
public List<String> getFeatures(Collection<String> needed)
needed - List of features for which to obtain an ordered dep list.public Set<String> getAllFeatureNames()
protected void loadFeature(Uri parent, String xml, Map<String,org.apache.shindig.gadgets.features.FeatureRegistry.FeatureNode> featureMapBuilder) throws GadgetException
parent - uri of parentxml - xml to parseGadgetExceptionprotected String makeCacheKey(Collection<String> needed, GadgetContext ctx, List<String> unsupported)
Copyright © 2007-2014 The Apache Software Foundation. All Rights Reserved.