当前位置: 首页>>代码示例>>Java>>正文


Java XmlBlob.setBlob方法代码示例

本文整理汇总了Java中com.google.gdata.util.XmlBlob.setBlob方法的典型用法代码示例。如果您正苦于以下问题:Java XmlBlob.setBlob方法的具体用法?Java XmlBlob.setBlob怎么用?Java XmlBlob.setBlob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gdata.util.XmlBlob的用法示例。


在下文中一共展示了XmlBlob.setBlob方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: uploadVideo

import com.google.gdata.util.XmlBlob; //导入方法依赖的package包/类
/**
 * Metóda uploadVideo slúži na odovzdanie multimediálneho video a súboru na server YouTube. Taktiež priradzuje k videu aj  detaily o videosúbore a detaily o serveri s kadiaľ je odovzdávaný.
 * @param file - video multimediálny súbor, zapísaný v štruktúre FileImpl
 * @param user - používateľ (majiteľ), ktorý daný video multimediálnych súbor odovzdáva z potálu
 * @param name - názov vytváranej trasy ku ktorej daný súbor patrí
 * @param ID - poradove číslo multimediálneho súboru v danej trase
 * @return Navratová hodnota je ID daného odovzdaneho multimedialneho súboru, pomocou ktoreho sa ten da vyvolať na serveri YouTube
 * @throws YouTubeAgentException je vyhodená ppri problemoch s odovzdaním video multimediálneho súboru
 */
public String uploadVideo (FileImpl file, String user, String name, String ID) throws YouTubeAgentException{
    try {
        VideoEntry newEntry = new VideoEntry();
        
       YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();
            mg.setTitle(new MediaTitle());
            mg.getTitle().setPlainTextContent(user + "=" + name + "=" + ID);
            mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, "Autos"));
            mg.setKeywords(new MediaKeywords());
            mg.getKeywords().addKeyword("GPSWebApp");
            mg.setDescription(new MediaDescription());
            mg.getDescription().setPlainTextContent("This video has been uploaded from GPSWebApp server, and it is property of GPSWebApp server.");
            //mg.setPrivate(true);
            //mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "mydevtag"));
            //mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "anotherdevtag"));
        
        MediaFileSource ms = new MediaFileSource(new File(file.getPath()), "video/quicktime");
        newEntry.setMediaSource(ms);
        String uploadUrl = "http://uploads.gdata.youtube.com/feeds/api/users/default/uploads";
  //      
        XmlBlob xmlBlob = new XmlBlob(); 
        xmlBlob.setBlob("<yt:accessControl action='list' permission='denied'/>"); 
        newEntry.setXmlBlob(xmlBlob); 
  //      
        VideoEntry createdEntry = service.insert(new URL(uploadUrl), newEntry);
        System.out.println("Video has been uploaded to YouTube: " + createdEntry.getMediaGroup().getPlayer().getUrl());
        FileLogger.getInstance().createNewLog("Successfully uploaded video to YouTube with URL " + createdEntry.getMediaGroup().getPlayer().getUrl() + " .");
        
        
        return createdEntry.getMediaGroup().getVideoId();
    } catch (Exception ex) {
        ex.printStackTrace();
        System.out.println("ERROR: Cannot upload video to YouTube server!!!");
        FileLogger.getInstance().createNewLog("ERROR: Cannot upload video to YouTube with ID !!!");
        throw new YouTubeAgentException();
    }
}
 
开发者ID:lp190zn,项目名称:gTraxxx,代码行数:47,代码来源:YouTubeAgent.java

示例2: setContent

import com.google.gdata.util.XmlBlob; //导入方法依赖的package包/类
/**
 * Sets the content of the given entry to the given String.
 */
public static void setContent(BaseContentEntry<?> entry, String content) {
  XmlBlob blob = new XmlBlob();
  blob.setBlob(content);
  TextConstruct textConstruct = new XhtmlTextConstruct(blob);
  entry.setContent(textConstruct);
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:10,代码来源:EntryUtils.java

示例3: testOnePage

import com.google.gdata.util.XmlBlob; //导入方法依赖的package包/类
@Test
public void testOnePage() throws IOException {
  final BasePageEntry<?> page = new WebPageEntry();
  page.setId("1");
  page.setTitle(new PlainTextConstruct("Page 1"));
  page.setPageName(new PageName("Page-1"));
  XmlBlob blob = new XmlBlob();
  blob.setBlob("content");
  page.setContent(new XhtmlTextConstruct(blob));
  entries.add(page);
  final Appendable out = context.mock(Appendable.class);
  
  context.checking(new Expectations() {{
    allowing (entryStoreFactory).newEntryStore(); 
        will(returnValue(entryStore));
    allowing (feedProvider).getEntries(feedUrl, sitesService);
        will(returnValue(entries));
    allowing (entryStore).getEntry("1"); will(returnValue(page));
    allowing (entryStore).getParent("1"); will(returnValue(null));
    allowing (progressListener).setStatus(with(any(String.class)));
    allowing (progressListener).setProgress(with(any(Double.class)));
    oneOf (entryStore).addEntry(page);
    oneOf (appendableFactory).getAppendable(
        new File("path/Page-1/index.html"));
        will(returnValue(out));
    oneOf (linkConverter).convertLinks(page, entryStore, 
        new URL("https://host/a/domain/webspace"), false);
    oneOf (pageExporter).exportPage(page, entryStore, out, true);
    oneOf (revisionsExporter).exportRevisions(page, entryStore, 
        new File("path/Page-1"), sitesService, 
        new URL("https://host/a/domain/webspace"));
  }});
  
  export(true);
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:36,代码来源:SiteExporterImplTest.java

示例4: setContentFromXmlString

import com.google.gdata.util.XmlBlob; //导入方法依赖的package包/类
/**
 * Utility method that given XML source for a feed entry, populates the content of this entry.
 * 
 * @param xmlText XML source for the associated feed entry.
 * @throws FeedServerClientException if any conversion errors occur parsing the XML.
 */
public void setContentFromXmlString(String xmlText) throws FeedServerClientException {
  XmlBlob xmlBlob = new XmlBlob();
  xmlBlob.setBlob(xmlText);
  setXmlBlob(xmlBlob);
  setContent(contentUtil.createXmlContent(xmlText));
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:13,代码来源:FeedServerEntry.java

示例5: createXmlContent

import com.google.gdata.util.XmlBlob; //导入方法依赖的package包/类
/**
 * Converts XML text to a GData {@code  OtherContent} description of the
 * payload
 * @param xmlSource XML source of the payload
 * @return A GData {@code OtherContent} representation of the payload
 */
public OtherContent createXmlContent(String xmlSource) {
  OtherContent xmlContent = new OtherContent();
  XmlBlob xmlBlob = new XmlBlob();
  xmlBlob.setBlob(xmlSource);
  xmlContent.setXml(xmlBlob);
  xmlContent.setMimeType(APPLICATION_XML);
  return xmlContent;
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:15,代码来源:ContentUtil.java

示例6: FeedServerClientTestUtil

import com.google.gdata.util.XmlBlob; //导入方法依赖的package包/类
/**
 * Populates bean with static info to match XML. The XML and the bean should
 * be interchangable using utilities provided by FeedServerClient.
 */
public FeedServerClientTestUtil() {
  // Setup sample bean.
  sampleVehicleBean = new VehicleBean();
  sampleVehicleBean.setName(NAME);
  sampleVehicleBean.setOwner(OWNER);
  sampleVehicleBean.setPrice(PRICE);
  sampleVehicleBean.setPropertyName(PROPERTY_NAMES);
  sampleVehicleBean.setPropertyValue(PROPERTY_VALUES);

  // Setup sample map.
  sampleVehicleMap = new HashMap<String, Object>();
  sampleVehicleMap.put("name", NAME);
  sampleVehicleMap.put("owner", OWNER);
  sampleVehicleMap.put("price", PRICE);
  sampleVehicleMap.put("propertyName", PROPERTY_NAMES);
  sampleVehicleMap.put("propertyValue", PROPERTY_VALUES);

  // Create populated gdata entry.
  XmlBlob xmlBlob = new XmlBlob();
  xmlBlob.setBlob(ENTRY_XML);
  OtherContent xmlContent = new OtherContent();
  xmlContent.setXml(xmlBlob);
  xmlContent.setXml(xmlBlob);
  xmlContent.setMimeType(ContentUtil.APPLICATION_XML);
  vehicleEntry = new FeedServerEntry();
  vehicleEntry.setXmlBlob(xmlBlob);
  vehicleEntry.setContent(xmlContent);
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:33,代码来源:FeedServerClientTestUtil.java

示例7: setContentBlob

import com.google.gdata.util.XmlBlob; //导入方法依赖的package包/类
private void setContentBlob(BaseContentEntry<?> entry) {
  XmlBlob xml = new XmlBlob();
  xml.setBlob(String.format(
      "content for %s", entry.getCategories().iterator().next().getLabel()));
  entry.setContent(new XhtmlTextConstruct(xml));
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:7,代码来源:SitesHelper.java

示例8: convertLinks

import com.google.gdata.util.XmlBlob; //导入方法依赖的package包/类
/**
 * Converts the relative links in the content of the given entry, where a 
 * link is defined by the given prefix and suffix. 
 */
private void convertLinks(BasePageEntry<?> entry, 
    List<BasePageEntry<?>> ancestors, URL siteUrl, boolean isRevision,
    String prefix, String suffix) {
  String content = EntryUtils.getXhtmlContent(entry);
  String url = siteUrl.toExternalForm();
  int index = content.indexOf(prefix + "../");
  while (index != -1) {
    int startIndex = index + prefix.length();
    int endIndex = content.indexOf(suffix, startIndex);
    if (endIndex == -1) {
      break;
    }
    String link = content.substring(startIndex, endIndex);
    if (link.startsWith("../")) {
      if (isRevision) {
        link = link.substring(3);
      }
      int ancestorIndex = ancestors.size();
      while (link.startsWith("../") && ancestorIndex >= 0) {
        link = link.substring(3);
        ancestorIndex--;
      }
      String str = "";
      while (ancestorIndex >= 0 && ancestorIndex < ancestors.size()) {
        str = ancestors.get(ancestorIndex).getPageName().getValue() + "/" + str;
        ancestorIndex--;
      }
      link = str + link;
    }
    if (link.endsWith("/index.html")) {
      link = link.substring(0, link.lastIndexOf("/index.html"));
    }
    String beforeLink = content.substring(0, startIndex);
    String afterLink = content.substring(endIndex);
    content = beforeLink + url + "/" + link + afterLink;
    index = content.indexOf(prefix + "../");
  }
  XmlBlob blob = new XmlBlob();
  blob.setBlob(content);
  TextConstruct textConstruct = new XhtmlTextConstruct(blob);
  entry.setContent(textConstruct);
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:47,代码来源:RelativeLinkConverterImpl.java

示例9: testOnePageWithAttachment

import com.google.gdata.util.XmlBlob; //导入方法依赖的package包/类
@Test
public void testOnePageWithAttachment() throws IOException {
  final BasePageEntry<?> page = new FileCabinetPageEntry();
  page.setId("1");
  page.setTitle(new PlainTextConstruct("Page 1"));
  page.setPageName(new PageName("Page-1"));
  XmlBlob blob = new XmlBlob();
  blob.setBlob("content");
  page.setContent(new XhtmlTextConstruct(blob));
  final BaseContentEntry<?> attachment = new AttachmentEntry();
  attachment.setId("2");
  attachment.setTitle(new PlainTextConstruct("attach this.wow"));
  attachment.addLink(SitesLink.Rel.PARENT, ILink.Type.ATOM, "1");
  entries.add(page);
  entries.add(attachment);
  final Appendable out = context.mock(Appendable.class);
  
  context.checking(new Expectations() {{
    allowing (entryStoreFactory).newEntryStore(); 
        will(returnValue(entryStore));
    allowing (feedProvider).getEntries(feedUrl, sitesService);
        will(returnValue(entries));
    allowing (entryStore).getEntry("1"); will(returnValue(page));
    allowing (entryStore).getParent("1"); will(returnValue(null));
    allowing (entryStore).getEntry("2"); will(returnValue(attachment));
    allowing (entryStore).getParent("2"); will(returnValue(page));
    allowing (progressListener).setStatus(with(any(String.class)));
    allowing (progressListener).setProgress(with(any(Double.class)));
    oneOf (entryStore).addEntry(page);
    oneOf (entryStore).addEntry(attachment);
    oneOf (appendableFactory).getAppendable(
        new File("path/Page-1/index.html"));
        will(returnValue(out));
    oneOf (linkConverter).convertLinks(page, entryStore, 
        new URL("https://host/a/domain/webspace"), false);
    oneOf (pageExporter).exportPage(page, entryStore, out, false);
  }});
  
  export(false);
  assertTrue(downloaded.get(attachment).equals(
      new File("path/Page-1/attach this.wow")));
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:43,代码来源:SiteExporterImplTest.java

示例10: FeedServerEntry

import com.google.gdata.util.XmlBlob; //导入方法依赖的package包/类
/**
 * Creates entry from "entity" XML.  
 * 
 * Example:
 * <pre>
 *   <entity>
 *     <name>vehicle0</name>
 *     <owner>Joe</owner>
 *     <price>23000</price>
 *     <propertyName repeatable='true'>make</propertyName>
 *     <propertyName>model</propertyName>
 *     <propertyName>year</propertyName>
 *     <propertyValue repeatable='true'>Honda</propertyValue>
 *     <propertyValue>Civic Hybrid</propertyValue>
 *     <propertyValue>2007</propertyValue>
 *   </entity>
 * </pre>
 * 
 * @param xmlText XML string representing an entity.
 */
public FeedServerEntry(String xmlText) {
  XmlBlob xmlBlob = new XmlBlob();
  xmlBlob.setBlob(xmlText);
  setXmlBlob(xmlBlob);
  setContent(contentUtil.createXmlContent(xmlText));
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:27,代码来源:FeedServerEntry.java


注:本文中的com.google.gdata.util.XmlBlob.setBlob方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。