package org.eclipse.dawnsci.nexus;

import org.eclipse.dawnsci.nexus.builder.AbstractNexusProvider;
import org.eclipse.dawnsci.nexus.builder.DelegateNexusProvider;
import org.eclipse.dawnsci.nexus.builder.NexusObjectProvider;

/**
 * Any device which can write NeXus should implement this method.
 * 
 * This can be done easily by using {@link AbstractNexusProvider} or
 * {@link DelegateNexusProvider}
 * 
 * @author Matthew Gerring
 *
 */
public interface INexusDevice<N extends NXobject> {

	/**
	 * The object provider required for writing correct nexus files.
	 * @return
	 * @throws Exception
	 */
	NexusObjectProvider<N> getNexusProvider(NexusScanInfo info) ;
	
	/**
	 * 
	 * @param nodeFactory
	 * @return
	 */
	N createNexusObject(NexusNodeFactory nodeFactory, NexusScanInfo info);

}

@@ -29,16 +29,78 @@
 nexus;%0A%0A
+import org.eclipse.dawnsci.analysis.dataset.impl.LazyDataset;%0A
 import o
@@ -348,14 +348,17 @@
 his 
-method
+interface
 .%0A *
@@ -389,18 +389,22 @@
 sily by 
-us
+extend
 ing %7B@li
@@ -614,19 +614,19 @@
 correct 
-nex
+NeX
 us files
@@ -744,43 +744,1593 @@
 %09 * 
+%3Cp%3E
 %0A%09 * 
-@param nodeFactory%0A%09 * @return
+In this method you should prepare the %7B@link LazyDataset%7Ds the device%0A%09 * will fill during the scan. You can also write out static device metadata,%0A%09 * which will not change during the scan.%0A%09 * %3C/p%3E%0A%09 * %3Cp%3E%0A%09 * Use the provided %3Ccode%3EnodeFactory%3C/code%3E to create a NeXus object which%0A%09 * matches the device e.g. a %7B@link NXdetector%7D.%0A%09 * %3Ccode%3Efinal NXdetector detector = nodeFactory.createNXdetector();%3C/code%3E%0A%09 * %3C/p%3E%0A%09 * %3Cp%3E%0A%09 * On the detector object you can create %7B@link LazyDataset%7Ds and keep%0A%09 * references which you can later use during the scan to write data. e.g.%0A%09 * %3Ccode%3EimageData = detector.initializeLazyDataset(NXdetector.NX_DATA, info.getRank() + 2, Dataset.FLOAT64);%3C/code%3E%0A%09 * You should also set chunking on the %7B@link LazyDataset%7Ds you create e.g. %3Ccode%3EimageData.setChunking(info.createChunk(detectorXSize, detectorYSize));%3C/code%3E.%0A%09 * %3C/p%3E%0A%09 * In this method you can also write static metadata such as the detector%0A%09 * exposure e.g.%0A%09 * %3Ccode%3Edetector.setField(%22exposure_time%22, model.getExposure());%3C/code%3E. Or%0A%09 * static datasets such as the image axis data%0A%09 * %3Ccode%3Edetector.setDataset(%22image_x_axis%22, DatasetFactory.createLinearSpace(minX, maxX, xPoints, Dataset.FLOAT64));%3C/code%3E%0A%09 * %3Cp%3E%0A%09 * %0A%09 * @param nodeFactory%0A%09 *            Factory you can use to create an appropriate NeXus node%0A%09 * @param info%0A%09 *            Information about the scan which can be useful when creating%0A%09 *            dataset e.g. %3Ccode%3Einfo.getRank()%3C/code%3E%0A%09 * @return The %7B@link NXobject%7D created using the %3Ccode%3EnodeFactory%3C/code%3E%0A%09 *         to represent this device
 %0A%09 *

Add JavaDoc to INexusDevice