Alfresco Custom Metadata Extractor
===

I have developed a custom metadata extractor to extract detailed metadata for audio and video files. The extractor extends AbstractMappingMetadataExtracter and it needs to map extracted fields into a custom type. The extractor class is named AudioMetadataExtractor and a corresponding properties file contains the mappings. Following is the code for the class

    public class AudioMetadataExtractor extends AbstractBaseMetadataExtractor {

	public static ArrayList<String> SUPPORTED_MIMETYPES = addMimeTypes(new String[] { MimeTypes.MIMETYPE_MP3, MimeTypes.MIMETYPE_WMA });

	public AudioMetadataExtractor() {
		this(SUPPORTED_MIMETYPES);
	}
	
	public AudioMetadataExtractor(ArrayList<String> supportedMimeTypes) {
		super(supportedMimeTypes);
	}

	
	@Override
	protected Map<String, Serializable> extractRaw(ContentReader reader) throws Throwable {

		Map<String, Serializable> rawProperties = newRawMap();
		
		File file = TempFileProvider.createTempFile("DCM", "MINFO");
		reader.getContent(file);
		
		MediaInfoJNA mediaInfoLib = new MediaInfoJNA();
		mediaInfoLib.Open(file.getAbsolutePath());

		String album = mediaInfoLib.Get(StreamKind.General, 0, "Album", MediaInfoJNA.InfoKind.Text, MediaInfoJNA.InfoKind.Name);
		System.out.println("Album1 " + album);
		String title = mediaInfoLib.Get(StreamKind.General, 0, "Title", MediaInfoJNA.InfoKind.Text, MediaInfoJNA.InfoKind.Name);
		System.out.println("Title " + title);
		String duration = mediaInfoLib.Get(StreamKind.General, 0, "Duration", MediaInfoJNA.InfoKind.Text, MediaInfoJNA.InfoKind.Name);
		System.out.println("Duration " + duration);
		
		putRawValue("album", album, rawProperties);

		mediaInfoLib.Close();
		
		return rawProperties;
	}
    }
    

The configuration for the extractor is as follows
    
	<bean id="metadata.extractor.AudioAsset" class="com.diipl.moviebeam.dcm.alfresco.metadata.AudioMetadataExtractor" parent="baseMetadataExtracter">
		<property name="inheritDefaultMapping">
			<value>true</value>
		</property>
	</bean>


Problem: When uploading a new file the extractor is being called and I can see all the sysouts with correct values. However, the properties are not filled with any values. But if I run the "Extract Common Metadata" action on the file the extractor gets called and the fields get the correct values.