/*
* Copyright 2004 Sun Microsystems, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.sun.syndication.io.impl;
import com.sun.syndication.feed.module.ModuleI;
import com.sun.syndication.io.ModuleGenerator;
import org.jdom.Element;
import java.util.List;
import java.util.Map;
/**
*/
public class ModuleGenerators extends PluginManager {
public ModuleGenerators(String propertyKey) {
super(propertyKey);
}
public ModuleGenerator getGenerator(String feedType) {
return (ModuleGenerator) getPlugin(feedType);
}
protected String getKey(Object obj) {
return ((ModuleGenerator)obj).getNamespaceUri();
}
public List getModuleNamespaces() {
return getKeys();
}
public void generateModules(List modules, Element element) {
Map generators = getPluginMap();
for (int i = 0; i < modules.size(); i++) {
ModuleI module = (ModuleI) modules.get(i);
String namespaceUri = module.getUri();
ModuleGenerator generator = (ModuleGenerator)generators.get(namespaceUri);
if (generator != null) {
generator.generate(module, element);
}
}
}
}