本文整理汇总了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());
}
示例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());
}
示例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();
}
示例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;
}
示例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;
}
}
示例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;
}