• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Module类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.rometools.rome.feed.module.Module的典型用法代码示例。如果您正苦于以下问题:Java Module类的具体用法?Java Module怎么用?Java Module使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Module类属于com.rometools.rome.feed.module包,在下文中一共展示了Module类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parse

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
@Override
@SuppressWarnings("nls")
public Module parse(Element element, Locale locale)
{
	MerlotModule merlot = new MerlotModuleImpl();
	boolean foundSomething = false;

	final String title = getNodeValue(element, "title");
	if( title != null )
	{
		foundSomething = true;
		merlot.setTitle(title);
	}
	final String url = getNodeValue(element, "URL");
	if( url != null )
	{
		foundSomething = true;
		merlot.setUrl(url);
	}

	if( !foundSomething )
	{
		return null;
	}
	return merlot;
}
 
开发者ID:equella,项目名称:Equella,代码行数:27,代码来源:MerlotModuleParser.java


示例2: generate

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
@Override
public void generate(Module module, Element element) {

    if (!(module instanceof InspireDlsModule)) {
        return;
    }

    final InspireDlsModule inspireModule = (InspireDlsModule) module;

    if (inspireModule.getSpatialDatasetIdentifier() != null) {

        if (inspireModule.getSpatialDatasetIdentifier().getCode() != null) {
            element.addContent(generateSimpleElement("spatial_dataset_identifier_code", inspireModule.getSpatialDatasetIdentifier().getCode()));
        }

        if (inspireModule.getSpatialDatasetIdentifier().getNamespace() != null) {
            element.addContent(generateSimpleElement("spatial_dataset_identifier_namespace", inspireModule.getSpatialDatasetIdentifier().getNamespace()));
        }
    }
}
 
开发者ID:JuergenWeichand,项目名称:inspire_dls-rome,代码行数:21,代码来源:InspireDlsModuleGenerator.java


示例3: parse

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
public Module parse(Element element, Locale locale) {

        final InspireDlsModuleImpl inspireDlsModuleImpl = new InspireDlsModuleImpl();
        final SpatialDatasetIdentifier spatialDatasetIdentifier = new SpatialDatasetIdentifier();

        Element code = element.getChild("spatial_dataset_identifier_code", NS);
        Element namespace = element.getChild("spatial_dataset_identifier_namespace", NS);

        if (code != null && namespace != null) {
            spatialDatasetIdentifier.setCode(code.getText().trim());
            spatialDatasetIdentifier.setNamespace(namespace.getText().trim());
            inspireDlsModuleImpl.setSpatialDatasetIdentifier(spatialDatasetIdentifier);
            return inspireDlsModuleImpl;
        } else {
            return null;
        }
    }
 
开发者ID:JuergenWeichand,项目名称:inspire_dls-rome,代码行数:18,代码来源:InspireDlsModuleParser.java


示例4: parseLocations

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
/**
 * @param e element to parse
 * @param md metadata to fill in
 * @param locale locale for parser
 */
private void parseLocations(final Element e, final Metadata md, final Locale locale) {
    final List<Element> locationElements = e.getChildren("location", getNS());
    final Location[] locations = new Location[locationElements.size()];
    final SimpleParser geoRssParser = new SimpleParser();
    for (int i = 0; i < locationElements.size(); i++) {
        locations[i] = new Location();
        locations[i].setDescription(locationElements.get(i).getAttributeValue("description"));
        if (locationElements.get(i).getAttributeValue("start") != null) {
            locations[i].setStart(new Time(locationElements.get(i).getAttributeValue("start")));
        }
        if (locationElements.get(i).getAttributeValue("end") != null) {
            locations[i].setEnd(new Time(locationElements.get(i).getAttributeValue("end")));
        }
        final Module geoRssModule = geoRssParser.parse(locationElements.get(i), locale);
        if (geoRssModule != null && geoRssModule instanceof GeoRSSModule) {
            locations[i].setGeoRss((GeoRSSModule) geoRssModule);
        }
    }
    md.setLocations(locations);
}
 
开发者ID:rometools,项目名称:rome,代码行数:26,代码来源:MediaModuleParser.java


示例5: generate

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
@Override
public void generate(Module module, Element element) {
    if (module != null && module instanceof ThreadingModule) {
        ThreadingModule threadedModule = (ThreadingModule) module;
        Element inReplyTo = new Element("in-reply-to", NAMESPACE);

        if (threadedModule.getHref() != null) {
            inReplyTo.setAttribute("href", threadedModule.getHref());
        }
        if (threadedModule.getRef() != null) {
            inReplyTo.setAttribute("ref", threadedModule.getRef());
        }
        if (threadedModule.getType() != null) {
            inReplyTo.setAttribute("type", threadedModule.getType());
        }
        if (threadedModule.getSource() != null) {
            inReplyTo.setAttribute("source", threadedModule.getSource());
        }

        element.addContent(inReplyTo);
    }
}
 
开发者ID:rometools,项目名称:rome,代码行数:23,代码来源:ThreadingModuleGenerator.java


示例6: generate

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
/** Generate JDOM element for module and add it to parent element */
@Override
public void generate(final Module module, final Element parent) {
    final AppModule m = (AppModule) module;

    if (m.getDraft() != null) {
        final String draft = m.getDraft().booleanValue() ? "yes" : "no";
        final Element control = new Element("control", APP_NS);
        control.addContent(generateSimpleElement("draft", draft));
        parent.addContent(control);
    }
    if (m.getEdited() != null) {
        final Element edited = new Element("edited", APP_NS);
        // Inclulde millis in date/time
        final SimpleDateFormat dateFormater = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US);
        dateFormater.setTimeZone(TimeZone.getTimeZone("GMT"));
        edited.addContent(dateFormater.format(m.getEdited()));
        parent.addContent(edited);
    }
}
 
开发者ID:rometools,项目名称:rome-propono,代码行数:21,代码来源:AppModuleGenerator.java


示例7: generate

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
@Override
public void generate(final Module module, final Element element) {
    if (!(module instanceof SSEModule)) {
        return;
    }

    final SSEModule sseModule = (SSEModule) module;

    if (sseModule instanceof Sharing) {
        final Sharing sharing = (Sharing) sseModule;
        // add sse namespace
        Element root = element;
        while (root.getParent() != null && root.getParent() instanceof Element) {
            root = (Element) root.getParent();
        }
        root.addNamespaceDeclaration(SSEModule.SSE_NS);

        generateSharing(sharing, root);
    } else if (sseModule instanceof Sync) {
        generateSync((Sync) sseModule, element);
    }
}
 
开发者ID:rometools,项目名称:rome,代码行数:23,代码来源:SSE091Generator.java


示例8: generate

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
@Override
public void generate(final Module module, final Element element) {
    if (!(module instanceof PhotocastModule)) {
        return;
    }
    final PhotocastModule pm = (PhotocastModule) module;
    if (element.getName().equals("channel") || element.getName().equals("feed")) {
        element.addContent(generateSimpleElement("feedVersion", FEED_VERSION));
        return;
    }
    element.addContent(generateSimpleElement("photoDate", Parser.PHOTO_DATE_FORMAT.format(pm.getPhotoDate())));
    element.addContent(generateSimpleElement("cropDate", Parser.CROP_DATE_FORMAT.format(pm.getCropDate())));
    element.addContent(generateSimpleElement("thumbnail", pm.getThumbnailUrl().toString()));
    element.addContent(generateSimpleElement("image", pm.getImageUrl().toString()));
    final Element e = new Element("metadata", NS);
    final Element pd = new Element("PhotoDate", "");
    pd.addContent(pm.getMetadata().getPhotoDate().toString());
    e.addContent(pd);
    final Element com = new Element("Comments", "");
    com.addContent(pm.getMetadata().getComments());
    e.addContent(com);
    element.addContent(e);
}
 
开发者ID:rometools,项目名称:rome,代码行数:24,代码来源:Generator.java


示例9: generate

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
@Override
public void generate(final Module module, final Element element) {
    if (!(module instanceof FeedBurner)) {
        return;
    }

    final FeedBurner feedBurner = (FeedBurner) module;

    if (feedBurner.getAwareness() != null) {
        element.addContent(generateSimpleElement("awareness", feedBurner.getAwareness()));
    }

    if (feedBurner.getOrigLink() != null) {
        element.addContent(generateSimpleElement("origLink", feedBurner.getOrigLink()));
    }

    if (feedBurner.getOrigEnclosureLink() != null) {
        element.addContent(generateSimpleElement("origEnclosureLink", feedBurner.getOrigEnclosureLink()));
    }
}
 
开发者ID:rometools,项目名称:rome,代码行数:21,代码来源:FeedBurnerModuleGenerator.java


示例10: testEndToEnd

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
public void testEndToEnd() throws Exception {
    final SyndFeedInput input = new SyndFeedInput();
    final File test = new File(super.getTestFile("os"));
    final File[] files = test.listFiles();
    for (int j = 0; j < files.length; j++) {
        if (!files[j].getName().endsWith(".xml")) {
            continue;
        }
        final SyndFeed feed = input.build(files[j]);
        final Module m = feed.getModule(OpenSearchModule.URI);
        final SyndFeedOutput output = new SyndFeedOutput();
        final File outfile = new File("target/" + files[j].getName());
        output.output(feed, outfile);
        final SyndFeed feed2 = input.build(outfile);
        assertEquals(m, feed2.getModule(OpenSearchModule.URI));
    }
}
 
开发者ID:rometools,项目名称:rome,代码行数:18,代码来源:OpenSearchModuleTest.java


示例11: testReadMainSpec

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
public void testReadMainSpec() throws IOException, FeedException {
    final SyndFeed feed = getSyndFeed("thr/threading-main.xml");
    List<SyndEntry> entries = feed.getEntries();
    SyndEntry parentEntry = entries.get(0);
    assertEquals("should be the parent entry", "My original entry", parentEntry.getTitle());
    assertNull(parentEntry.getModule(ThreadingModule.URI));

    SyndEntry replyEntry = entries.get(1);
    assertEquals("should be the reply entry", "A response to the original", replyEntry.getTitle());
    Module module = replyEntry.getModule(ThreadingModule.URI);
    assertNotNull(module);
    ThreadingModule threadingModule = (ThreadingModule) module;
    assertEquals("tag:example.org,2005:1", threadingModule.getRef());
    assertEquals("application/xhtml+xml", threadingModule.getType());
    assertEquals("http://www.example.org/entries/1", threadingModule.getHref());
    assertNull(threadingModule.getSource());
}
 
开发者ID:rometools,项目名称:rome,代码行数:18,代码来源:ThreadingModuleTest.java


示例12: parseModules

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
public List<Module> parseModules(final Element root, final Locale locale) {
    final List<ModuleParser> parsers = getPlugins();
    List<Module> modules = null;
    for (final ModuleParser parser : parsers) {
        final String namespaceUri = parser.getNamespaceUri();
        final Namespace namespace = Namespace.getNamespace(namespaceUri);
        if (hasElementsFrom(root, namespace)) {
            final Module module = parser.parse(root, locale);
            if (module != null) {
                modules = Lists.createWhenNull(modules);
                modules.add(module);
            }
        }
    }
    return modules;
}
 
开发者ID:rometools,项目名称:rome,代码行数:17,代码来源:ModuleParsers.java


示例13: parse

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
/** Parse JDOM element into module */
@Override
public Module parse(final Element elem, final Locale locale) {
    final AppModule m = new AppModuleImpl();
    final Element control = elem.getChild("control", getContentNamespace());
    if (control != null) {
        final Element draftElem = control.getChild("draft", getContentNamespace());
        if (draftElem != null) {
            if ("yes".equals(draftElem.getText())) {
                m.setDraft(Boolean.TRUE);
            }
            if ("no".equals(draftElem.getText())) {
                m.setDraft(Boolean.FALSE);
            }
        }
    }
    final Element edited = elem.getChild("edited", getContentNamespace());
    if (edited != null) {
        try {
            m.setEdited(DateParser.parseW3CDateTime(edited.getTextTrim(), locale));
        } catch (final Exception ignored) {
        }
    }
    return m;
}
 
开发者ID:rometools,项目名称:rome,代码行数:26,代码来源:AppModuleParser.java


示例14: parse

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
@Override
@SuppressWarnings("nls")
public Module parse(Element element, Locale locale)
{
	MerlotTopLevelModule merlot = new MerlotTopLevelModuleImpl();
	boolean foundSomething = false;

	String totalCount = getNodeValue(element, "totalCount");
	if( totalCount != null )
	{
		foundSomething = true;
		merlot.setTotalCount(Utils.parseInt(totalCount, 0));
	}
	final String resultCount = getNodeValue(element, "resultCount");
	if( resultCount != null )
	{
		foundSomething = true;
		merlot.setResultCount(Utils.parseInt(resultCount, 0));
	}
	final String lastRecNumber = getNodeValue(element, "lastRecNumber");
	if( lastRecNumber != null )
	{
		foundSomething = true;
		merlot.setLastRecNumber(Utils.parseInt(lastRecNumber, 0));
	}
	/*
	 * Element queryElem = element.getChild("query",
	 * MerlotTopLevelModule.NAMESPACE); if( queryElem != null ) { String
	 * query = queryElem.getAttributeValue("searchTerms"); if( query != null
	 * ) { foundSomething = true; open.setQuery(query); } }
	 */

	if( !foundSomething )
	{
		return null;
	}
	return merlot;
}
 
开发者ID:equella,项目名称:Equella,代码行数:39,代码来源:MerlotTopLevelModuleParser.java


示例15: testGenerator

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
/**
 * Generator-Test (Simplified INSPIRE Service Feed)
 * @throws com.rometools.rome.io.FeedException
 * @throws java.io.IOException
 */
public void testGenerator() throws FeedException, IOException {

    // Atom Container-Element
    Feed atomFeed = new Feed(); 
    atomFeed.setEncoding("utf-8");
    
    atomFeed.setTitle("Digitales Geländemodell 200m Bayern - INSPIRE Atom Example");                       
    atomFeed.setUpdated(new Date());
    
    // Atom Entry-Element
    Entry atomEntry = new Entry();
    atomEntry.setTitle("Digitales Geländemodell 200m Bayern - INSPIRE Atom Example");       
    atomEntry.setUpdated(new Date());
    
    // GeoRSS-Extension (Bounding-Box)        
    GeoRSSModule geoRssModule = new SimpleModuleImpl();
    geoRssModule.setGeometry(new Envelope(47.2279397510939845, 8.8934968721451053, 50.5798028875686470, 13.9247471058637764));
    
    // INSPIRE_DLS-Extension
    InspireDlsModule inspireDlsModule = new InspireDlsModuleImpl();
    SpatialDatasetIdentifier identifier = new SpatialDatasetIdentifier();
    identifier.setCode("DEBY_1d4ab890-27e7-3ebb-95ba-2d2ab8071871");
    identifier.setNamespace("http://www.geodaten.bayern.de");
    inspireDlsModule.setSpatialDatasetIdentifier(identifier);
    
    List<Module> modules = new ArrayList<Module>();
    modules.add(geoRssModule);
    modules.add(inspireDlsModule);
    atomEntry.setModules(modules);
          
    atomFeed.setEntries(Arrays.asList(atomEntry));
    
    // build JDOM-Document 
    Document atomXml = new Atom10Generator().generate(atomFeed);
    
    // print JDOM-Document to System.out
    XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
    outputter.output(atomXml, System.out);                
}
 
开发者ID:JuergenWeichand,项目名称:inspire_dls-rome,代码行数:45,代码来源:GeneratorTest.java


示例16: generate

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
@Override
public void generate(final Module module, final Element element) {
    final GoogleBaseImpl mod = (GoogleBaseImpl) module;
    final HashMap<Object, Object> props2tags = new HashMap<Object, Object>(GoogleBaseParser.PROPS2TAGS);
    final List<PropertyDescriptor> pds = GoogleBaseParser.pds;

    for (final PropertyDescriptor pd : pds) {
        final String tagName = (String) props2tags.get(pd.getName());

        if (tagName == null) {
            continue;
        }

        Object[] values = null;

        try {
            if (pd.getPropertyType().isArray()) {
                values = (Object[]) pd.getReadMethod().invoke(mod, (Object[]) null);
            } else {
                values = new Object[] {pd.getReadMethod().invoke(mod, (Object[]) null)};
            }

            for (int j = 0; values != null && j < values.length; j++) {
                if (values[j] != null) {
                    element.addContent(generateTag(values[j], tagName));
                }
            }
        } catch (final Exception e) {
            LOG.error("Error", e);
        }
    }
}
 
开发者ID:rometools,项目名称:rome,代码行数:33,代码来源:GoogleBaseGenerator.java


示例17: generate

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
@Override
public void generate(final Module module, final Element element) {

    final OpenSearchModule osm = (OpenSearchModule) module;

    if (osm.getItemsPerPage() > -1) {
        element.addContent(generateSimpleElement("itemsPerPage", Integer.toString(osm.getItemsPerPage())));
    }

    if (osm.getTotalResults() > -1) {
        element.addContent(generateSimpleElement("totalResults", Integer.toString(osm.getTotalResults())));
    }

    final int startIndex = osm.getStartIndex() > 0 ? osm.getStartIndex() : 1;
    element.addContent(generateSimpleElement("startIndex", Integer.toString(startIndex)));

    if (osm.getQueries() != null) {

        final List<OSQuery> queries = osm.getQueries();

        for (final OSQuery query : queries) {
            if (query != null) {
                element.addContent(generateQueryElement(query));
            }
        }
    }

    if (osm.getLink() != null) {
        element.addContent(generateLinkElement(osm.getLink()));
    }
}
 
开发者ID:rometools,项目名称:rome,代码行数:32,代码来源:OpenSearchModuleGenerator.java


示例18: generate

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
@Override
public void generate(final Module module, final Element element) {
    // this is not necessary, it is done to avoid the namespace definition
    // in every item.
    Element root = element;
    while (root.getParent() != null && root.getParent() instanceof Element) {
        root = (Element) element.getParent();
    }
    root.addNamespaceDeclaration(GeoRSSModule.W3CGEO_NS);

    Element pointElement = element;
    if (!isShort) {
        pointElement = new Element("Point", GeoRSSModule.W3CGEO_NS);
        element.addContent(pointElement);
    }

    final GeoRSSModule geoRSSModule = (GeoRSSModule) module;
    final AbstractGeometry geometry = geoRSSModule.getGeometry();

    if (geometry instanceof Point) {
        final Position pos = ((Point) geometry).getPosition();

        final Element latElement = new Element("lat", GeoRSSModule.W3CGEO_NS);
        latElement.addContent(String.valueOf(pos.getLatitude()));
        pointElement.addContent(latElement);
        final Element lngElement = new Element("long", GeoRSSModule.W3CGEO_NS);
        lngElement.addContent(String.valueOf(pos.getLongitude()));
        pointElement.addContent(lngElement);
    } else {
        System.err.println("W3C Geo format can't handle geometries of type: " + geometry.getClass().getName());
    }
}
 
开发者ID:rometools,项目名称:rome,代码行数:33,代码来源:W3CGeoGenerator.java


示例19: parse

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
@Override
public Module parse(final Element element, final Locale locale) {
    final ThreadingModule tm = new ThreadingModuleImpl();
    Element inReplyTo = element.getChild("in-reply-to", ThreadingModuleParser.NS);

    if (inReplyTo != null) {
        tm.setHref(inReplyTo.getAttributeValue("href"));
        tm.setRef(inReplyTo.getAttributeValue("ref"));
        tm.setSource(inReplyTo.getAttributeValue("source"));
        tm.setType(inReplyTo.getAttributeValue("type"));
        return tm;
    }

    return null;
}
 
开发者ID:rometools,项目名称:rome,代码行数:16,代码来源:ThreadingModuleParser.java


示例20: parse

import com.rometools.rome.feed.module.Module; //导入依赖的package包/类
@Override
public Module parse(Element element, Locale locale) {
    AtomLinkModuleImpl mod = new AtomLinkModuleImpl();
    if (element.getName().equals("channel") || element.getName().equals("item")) {
        List<Element> links = element.getChildren("link", NS);
        List<Link> result = new LinkedList<Link>();
        for (Element link : links) {
            Link l = parseLink(link);
            result.add(l);
        }
        mod.setLinks(result);
        return mod;
    }
    return null;
}
 
开发者ID:rometools,项目名称:rome,代码行数:16,代码来源:AtomModuleParser.java



注:本文中的com.rometools.rome.feed.module.Module类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AnnotationJmxAttributeSource类代码示例发布时间:2022-05-23
下一篇:
Java ObjectSortedSet类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap