public class FeatureRegistry extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
FILE_SCHEME |
static String |
RESOURCE_SCHEME |
| Constructor and Description |
|---|
FeatureRegistry(FeatureResourceLoader resourceLoader,
List<String> features) |
| Modifier and Type | Method and Description |
|---|---|
Set<String> |
getAllFeatureNames()
Helper method, returns all known feature names.
|
List<FeatureResource> |
getAllFeatures()
Returns all known FeatureResources in dependency order, as described in getFeatureResources.
|
List<FeatureResource> |
getFeatureResources(GadgetContext ctx,
Collection<String> needed,
List<String> unsupported)
Helper method retrieving feature resources, including transitive dependencies.
|
List<FeatureResource> |
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.
|
protected void |
loadFeature(Uri parent,
String xml,
Map<String,org.apache.shindig.gadgets.features.FeatureRegistry.FeatureNode> featureMapBuilder)
Method that loads gadget features.
|
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 RESOURCE_SCHEME
public static final String FILE_SCHEME
@Inject public FeatureRegistry(FeatureResourceLoader resourceLoader, List<String> features) throws GadgetException
resourceLoader - featuresoo - GadgetExceptionprotected 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 List<FeatureResource> 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.GadgetExceptionpublic List<FeatureResource> 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 List<FeatureResource> 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 parseGadgetExceptionCopyright © 2007-2012. All Rights Reserved.