org.apache.abdera.factory.Factory类的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中org.apache.abdera.factory.Factory类的一些代码示例,展示了Factory类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Factory类的具体详情如下:
包路径:org.apache.abdera.factory.Factory
类名称:Factory

Factory介绍

[英]The Factory interface is the primary means by which Feed Object Model instances are built. Factories are specific to parser implementations. Users will generally not have to know anything about the Factory implementation, which will be automatically selected based on the Abdera configuration options.
[中]工厂接口是构建提要对象模型实例的主要方法。工厂是特定于解析器实现的。用户通常不必了解工厂实现的任何信息,工厂实现将根据Abdera配置选项自动选择。

代码示例

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera

/**
 * Create a new Feed instance.  This is a convenience shortcut for
 * <code>abdera.getFactory().newFeed()</code>
 * @return A newly created feed element
 */
public Feed newFeed() {
 return getFactory().newFeed();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera

/**
 * Create a new Entry instance.  This is a convenience shortcut for
 * <code>abdera.getFactory().newEntry()</code>
 * @return A newly created entry element
 */
public Entry newEntry() {
 return getFactory().newEntry();
}

代码示例来源:origin: org.apache.abdera/abdera-core

/**
 * Create a new Service instance. This is a convenience shortcut for <code>abdera.getFactory().newService()</code>
 * 
 * @return A newly created service element
 */
public Service newService() {
  return getFactory().newService();
}

代码示例来源:origin: org.apache.abdera/abdera-core

public static Error create(Abdera abdera, int code, String message, Throwable t) {
  Document<Error> doc = abdera.getFactory().newDocument();
  Error error = abdera.getFactory().newElement(ERROR, doc);
  error.setCode(code).setMessage(message);
  return error;
}

代码示例来源:origin: org.apache.ws.commons.axiom/fom-testsuite

@Override
  protected void runTest() throws Throwable {
    Factory factory = abdera.getFactory();
    Control control = factory.newControl();
    factory.newElement(Constants.DRAFT, control).setText("yes");
    assertThat(control.isDraft()).isTrue();
  }
}

代码示例来源:origin: org.xcmis/xcmis-restatom

Feed childFeed = request.getAbdera().getFactory().newFeed(childrenElement);
childFeed.setId("ch:" + entryId);
childFeed.setTitle("Type Children");
Element numItems = request.getAbdera().getFactory().newElement(AtomCMIS.NUM_ITEMS, childrenElement);
numItems.setText(Integer.toString(children.size()));
  Entry ch = entry.getFactory().newEntry(childrenElement);
  addEntryDetails(request, ch, feedIri, typeContainer.getContainer());
  if (typeContainer.getChildren() != null && typeContainer.getChildren().size() > 0)

代码示例来源:origin: org.apache.ws.commons.axiom/fom-testsuite

@Override
  protected void runTest() throws Throwable {
    Document<Categories> document = abdera.getParser().parse(
        TestAddCategoryFromCategories.class.getResourceAsStream("categories.xml"));
    Categories categories = document.getRoot();
    Entry entry = abdera.getFactory().newEntry();
    Category orgCategory = categories.getCategories().get(0);
    entry.addCategory(orgCategory);
    Category category = entry.getCategories().get(0);
    assertThat(category).isNotSameAs(orgCategory);
    // Assert that the original Category has not been removed from the Categories instance
    assertThat(categories.getCategories().get(0)).isSameAs(orgCategory);
    assertThat(category.getTerm()).isEqualTo(orgCategory.getTerm());
    // The scheme is inherited from the app:categories element
    assertThat(category.getScheme()).isEqualTo(categories.getScheme());
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera

public StreamBuilder startElement(String name, String namespace, String prefix) {
 current = abdera.getFactory().newElement(getQName(name, namespace, prefix),current);
 if (root == null) root = current;
 return this;
}

代码示例来源:origin: org.fuzzydb.atom/org.fuzzydb.abdera.util

@SuppressWarnings("unchecked")
public ResponseContext putEntry(RequestContext request) {
  Abdera abdera = request.getAbdera();
  Parser parser = abdera.getParser();
  Factory factory = abdera.getFactory();
  Entry orig_entry = getAbderaEntry(request);
  if (orig_entry != null) {
        entry.getIdElement().setValue(factory.newUuidUri());
        entry.addLink("atom/feed/" + entry.getId().toString(),
            "edit");

代码示例来源:origin: org.apache.ws.commons.axiom/fom-testsuite

@Override
  protected void runTest() throws Throwable {
    Collection collection = abdera.getFactory().newCollection();
    collection.setAccept("image/png", "image/jpeg");
    collection.setAccept();
    assertThat(collection.getFirstChild()).isNull();
  }
}

代码示例来源:origin: org.apache.abdera/abdera-extensions-opensearch

private Feed createFeed(RequestContext searchRequest, Map<String, String> parameters, List<T> searchResults) {
    Factory factory = searchRequest.getAbdera().getFactory();
    Feed feed = factory.newFeed();
    feed.setId(this.getOpenSearchFeedId(searchRequest));
    feed.setTitle(this.getOpenSearchFeedTitle(searchRequest));
    feed.addAuthor(this.getOpenSearchFeedAuthor(searchRequest));
    feed.setUpdated(this.getOpenSearchFeedUpdatedDate(searchRequest));
    feed.addLink(searchRequest.getUri().toString(), "self");
    int totalResults = this.getOpenSearchFeedTotalResults(searchRequest, parameters, searchResults);
    if (totalResults > -1) {
      ((IntegerElement)feed.addExtension(OpenSearchConstants.TOTAL_RESULTS)).setValue(totalResults);
    }
    int itemsPerPage = this.getOpenSearchFeedItemsPerPage(searchRequest, parameters, searchResults);
    if (itemsPerPage > -1) {
      ((IntegerElement)feed.addExtension(OpenSearchConstants.ITEMS_PER_PAGE)).setValue(itemsPerPage);
    }
    int startIndex = this.getOpenSearchFeedStartIndex(searchRequest, parameters, searchResults);
    if (startIndex > -1) {
      ((IntegerElement)feed.addExtension(OpenSearchConstants.START_INDEX)).setValue(startIndex);
    }
    for (T entity : searchResults) {
      Entry entry = factory.newEntry();
      this.fillEntry(entry, entity);
      feed.addEntry(entry);
    }
    this.postProcess(feed, searchRequest, parameters, searchResults);
    return feed;
  }
}

代码示例来源:origin: org.apache.abdera/abdera-parser

public void writeTo(String writer, java.io.Writer out) throws IOException {
  writeTo(getFactory().getAbdera().getWriterFactory().getWriter(writer), out);
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-atom-runtime

Service service = abderaFactory.newService();
Workspace workspace = abderaFactory.newWorkspace();
if ( title != null ) {
  workspace.setTitle(title);
      Abdera abdera = new Abdera();
      WriterFactory wf = abdera.getWriterFactory();
      org.apache.abdera.writer.Writer json = wf.getWriter("json");
      feed.writeTo(json, response.getWriter());
      Abdera abdera = new Abdera();
      WriterFactory wf = abdera.getWriterFactory();
      org.apache.abdera.writer.Writer json = wf.getWriter("json");

代码示例来源:origin: DSpace/DSpace

Abdera abdera = new Abdera();
Link link = abdera.getFactory().newLink();
link.setHref(urlManager.getActionableBitstreamUrl(bitstream));
link.setMimeType(contentType);

代码示例来源:origin: org.apache.abdera/abdera-core

public StreamBuilder writeId() {
  return writeId(abdera.getFactory().newUuidUri());
}

代码示例来源:origin: org.dataconservancy.deposit/dc-deposit-sword-server

Entry entry = request.getAbdera().getFactory().newEntry();
    Link statusDoc = request.getAbdera().getFactory().newLink();
    statusDoc.setHref(url);
    statusDoc.setMimeType(depositInfo.getDepositStatus()

代码示例来源:origin: apache/cxf

protected Feed createFeedFromCollectionWrapper(Factory factory, Object o, Class<?> pojoClass)
  throws Exception {
  Feed feed = factory.newFeed();
  boolean writerUsed = buildFeed(feed, o, pojoClass);
  if (feed.getEntries().size() > 0) {
    return feed;
  }
  String methodName = getCollectionMethod(o.getClass(), true);
  Object collection = null;
  Method m = null;
  try {
    m = o.getClass().getMethod(methodName, new Class[]{});
    collection = m.invoke(o, new Object[]{});
  } catch (Exception ex) {
    reportError("Collection for " + o.getClass().getName() + " can not be retrieved", ex);
  }
  setFeedFromCollection(factory, feed, o, pojoClass, collection, m.getReturnType(),
             m.getGenericReturnType(), writerUsed);
  return feed;
}

代码示例来源:origin: org.apache.ws.commons.axiom/fom-testsuite

@Override
  protected void runTest() throws Throwable {
    Factory factory = abdera.getFactory();
    Element element = factory.newElement(new QName("test"));
    element.setAttributeValue("attr", "value");
    Object xpathResult = abdera.getXPath().selectSingleNode("./@attr", element);
    assertThat(xpathResult).isInstanceOf(Attribute.class);
    assertThat(((Attribute)xpathResult).getFactory()).isSameAs(factory);
  }
}

代码示例来源:origin: org.apache.cxf/cxf-rt-management-web

private Entry createEntry(List<LogRecord> records, int entryIndex) {
  Entry entry = factory.newEntry();
  setDefaultEntryProperties(entry, records, entryIndex);
  
  return entry;
}

代码示例来源:origin: apache/cxf

private Entry createBookEntry(int id, String name) throws Exception {
  Book b = new Book();
  b.setId(id);
  b.setName(name);
  Factory factory = Abdera.getNewFactory();
  JAXBContext jc = JAXBContext.newInstance(Book.class);
  Entry e = factory.getAbdera().newEntry();
  e.setTitle(b.getName());
  e.setId(Long.toString(b.getId()));
  StringWriter writer = new StringWriter();
  jc.createMarshaller().marshal(b, writer);
  Content ct = factory.newContent(Content.Type.XML);
  ct.setValue(writer.toString());
  e.setContentElement(ct);
  return e;
}

相关文章