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


Java MetadataExtracter类代码示例

本文整理汇总了Java中org.alfresco.repo.content.metadata.MetadataExtracter的典型用法代码示例。如果您正苦于以下问题:Java MetadataExtracter类的具体用法?Java MetadataExtracter怎么用?Java MetadataExtracter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MetadataExtracter类属于org.alfresco.repo.content.metadata包,在下文中一共展示了MetadataExtracter类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testRootElementNameSelector

import org.alfresco.repo.content.metadata.MetadataExtracter; //导入依赖的package包/类
public void testRootElementNameSelector() throws Exception
{
    // Load the example files
    ContentReader alfrescoModelReader = getReader(FILE_ALFRESCO_MODEL);
    assertTrue(alfrescoModelReader.exists());
    ContentReader eclipseProjectReader = getReader(FILE_ECLIPSE_PROJECT);
    assertTrue(eclipseProjectReader.exists());
    
    // Check with an alfresco model document
    MetadataExtracter alfrescoModelExtracter = rootElementNameMetadataExtracterSelector.getWorker(alfrescoModelReader);
    assertNotNull("Failed to select correct extracter", alfrescoModelExtracter);
    assertTrue("Incorrect extracter instance selected", alfrescoModelMetadataExtracter == alfrescoModelExtracter);
    assertFalse("Read channel not closed", alfrescoModelReader.isChannelOpen());
    
    // Check with an eclipse project document
    MetadataExtracter eclipseProjectExtracter = rootElementNameMetadataExtracterSelector.getWorker(eclipseProjectReader);
    assertNotNull("Failed to select correct extracter", eclipseProjectExtracter);
    assertTrue("Incorrect extracter instance selected", eclipseProjectMetadataExtracter == eclipseProjectExtracter);
    assertFalse("Read channel not closed", eclipseProjectReader.isChannelOpen());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:XmlMetadataExtracterTest.java

示例2: testXpathSelector

import org.alfresco.repo.content.metadata.MetadataExtracter; //导入依赖的package包/类
public void testXpathSelector() throws Exception
{
    // Load the example files
    ContentReader alfrescoModelReader = getReader(FILE_ALFRESCO_MODEL);
    assertTrue(alfrescoModelReader.exists());
    ContentReader eclipseProjectReader = getReader(FILE_ECLIPSE_PROJECT);
    assertTrue(eclipseProjectReader.exists());
    
    // Check with an alfresco model document
    MetadataExtracter alfrescoModelExtracter = xpathMetadataExtracterSelector.getWorker(alfrescoModelReader);
    assertNotNull("Failed to select correct extracter", alfrescoModelExtracter);
    assertTrue("Incorrect extracter instance selected", alfrescoModelMetadataExtracter == alfrescoModelExtracter);
    assertFalse("Read channel not closed", alfrescoModelReader.isChannelOpen());
    
    // Check with an eclipse project document
    MetadataExtracter eclipseProjectExtracter = xpathMetadataExtracterSelector.getWorker(eclipseProjectReader);
    assertNotNull("Failed to select correct extracter", eclipseProjectExtracter);
    assertTrue("Incorrect extracter instance selected", eclipseProjectMetadataExtracter == eclipseProjectExtracter);
    assertFalse("Read channel not closed", eclipseProjectReader.isChannelOpen());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:XmlMetadataExtracterTest.java

示例3: setUp

import org.alfresco.repo.content.metadata.MetadataExtracter; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void setUp() throws Exception
{
    serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
    authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
    alfrescoModelMetadataExtracter = (XPathMetadataExtracter) ctx.getBean("extracter.xml.AlfrescoModelMetadataExtracter");
    eclipseProjectMetadataExtracter = (XPathMetadataExtracter) ctx.getBean("extracter.xml.EclipseProjectMetadataExtracter");
    ditaConceptMetadataExtracter = (XPathMetadataExtracter) ctx.getBean("extracter.xml.DITAConceptMetadataExtracter");
    rootElementNameMetadataExtracterSelector = (RootElementNameContentWorkerSelector<MetadataExtracter>) ctx.getBean("extracter.xml.selector.RootElementSelector");
    xpathMetadataExtracterSelector = (XPathContentWorkerSelector<MetadataExtracter>) ctx.getBean("extracter.xml.selector.XPathSelector");
    xmlMetadataExtracter = (XmlMetadataExtracter) ctx.getBean("extracter.xml.XMLMetadataExtracter");
    
    authenticationComponent.setSystemUserAsCurrentUser();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:16,代码来源:XmlMetadataExtracterTest.java

示例4: getExtractors

import org.alfresco.repo.content.metadata.MetadataExtracter; //导入依赖的package包/类
protected List<String> getExtractors(String mimetype)
{
   List<String> exts = new ArrayList<String>();
   MetadataExtracter extractor = metadataExtracterRegistry.getExtracter(mimetype);
   if(extractor != null) {
      exts.add( extractor.getClass().getName() );
   }
   return exts;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:10,代码来源:MimetypesGet.java

示例5: extractMetadata

import org.alfresco.repo.content.metadata.MetadataExtracter; //导入依赖的package包/类
/**
 * Extracts the metadata of a "raw" piece of content into a map. 
 * 
 * @param context Faces Context
 * @param reader Content reader for the source content to extract from 
 * @param destination Map of metadata to set metadata values into
 * @return True if an extracter was found
 */
public static boolean extractMetadata(FacesContext context, ContentReader reader, Map<QName, Serializable> destination)
{
   // check that source mimetype is available
   String mimetype = reader.getMimetype();
   if (mimetype == null)
   {
      throw new AlfrescoRuntimeException("The content reader mimetype must be set: " + reader);
   }

   // look for a transformer
   MetadataExtracter extracter = getMetadataExtracterRegistry(context).getExtracter(mimetype);
   if (extracter == null)
   {
      // No metadata extracter is not a failure, but we flag it 
      return false;
   }
   
   try
   {
       // we have a transformer, so do it
       extracter.extract(reader, destination);
       return true;
   }
   catch (Throwable e)
   {
       // it failed
       logger.warn("Metadata extraction failed: \n" +
               "   reader: " + reader + "\n" +
               "   extracter: " + extracter);
       return false;
   }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:41,代码来源:Repository.java

示例6: setSelectors

import org.alfresco.repo.content.metadata.MetadataExtracter; //导入依赖的package包/类
/**
 * Sets the list of metadata selectors to use to find the extracter to use,
 * given some content. The evaluations are done in the order that they occur
 * in the list.
 * 
 * @param selectors A list of selectors
 */
public void setSelectors(List<ContentWorkerSelector<MetadataExtracter>> selectors)
{
    this.selectors = selectors;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:XmlMetadataExtracter.java


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