 |
How to install, use and contribute
|
 |
|
 |
|
|
How to contribute and/or extend (for developers)
|
|
See download, under "SAmgI on Sourceforge", for information on how to compile everything, after you checked out the source from CVS.
[[under construction]]
|
|
How to install (for non-developers)
|
|
We provide possibilities for both running the SAmgI software in standalone and webservice mode.
However, at this very moment, the web services versions are NOT functioning, although we are doing lots of effort on making this work too.
Running in standalone mode:
- STEP 1: Download (some of) the zip-files that are mentioned on our download page.
- STEP 2: Make sure that all help-jars and SAmgI jars are in your classpath. Those files reside in the "all-together"-zip-file under
SamgiAll/implementations/java/jar
and
SamgiAll/implementations/java/supportLibs /li>
- STEP 3: Run client code to do the actual metadata generation. For a piece of example code, see below, in the section on "how to use"
Running as a web service:
under development (not working yet)
EXTRA REMARKs:
- as you will notice, not all supported metadata formats(LOM,
human-readable, DC, ...) are supported/implemented yet. But however,
you can already test the LOM and DC ones... Those should work...
- make sure you are connected when executing the code, because I eg
use the Yahoo web services...
|
|
How to use
|
|
Below you find some example code. To run it, you need to change some things in the example code, namely: change everything that says "MUST_BE_SET_BY_USER" to a valid value. An example of a Linux and Windows path are provided for the fileLocation variable.
Example code:
import org.ariadne.simpleindexing.samgi.standalone.SamgiStandalone; import org.ariadne.simpleindexing.samgi.general.types.metadatasources.FileSystemMetadatasourceIdG; import org.ariadne.simpleindexing.samgi.general.types.metadatasources.MetadatasourceIdG; import org.ariadne.simpleindexing.samgi.general.types.metadatasources.OCWMetadatasourceIdG; import org.ariadne.simpleindexing.samgi.general.types.metadata.AmgMetadataG; import org.ariadne.simpleindexing.samgi.general.util.SamgiConstantsG; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; import javax.xml.bind.JAXBException; import java.io.File; import java.io.StringWriter;
/** * Small sample class for testing SAmgI in standalone mode */ public class TestSamgiStandalone {
public static void main(String[] args) { // This must be the FIRST calls, before calling anything else that's SAmgI related // and they must point to EXISTING directories ! String logOutputDirectory = "MUST_BE_SET_BY_USER"; String luceneIndexLocation = "MUST_BE_SET_BY_USER"; String samgiTempDir = "MUST_BE_SET_BY_USER"; org.ariadne.config.PropertiesManager.saveProperty("samgi.logFileDir", logOutputDirectory); org.ariadne.config.PropertiesManager.saveProperty("lomlucene.LuceneIndexLocation", luceneIndexLocation); org.ariadne.config.PropertiesManager.saveProperty("samgi.tempdir", samgiTempDir);
testSamgiStandalone(); }
public static void testSamgiStandalone() {
SamgiStandalone standAloneImpl = new SamgiStandalone(); try { ///////////////////////////////////////////// // Test some of the methods for configuration ///////////////////////////////////////////// String[] supportedConflictHandlingMethods = standAloneImpl.getSupportedConflictHandlingMethods(); for (int i = 0; i < supportedConflictHandlingMethods.length; i++) { String supportedConflictHandlingMethod = supportedConflictHandlingMethods[i]; System.out.println("supportedConflictHandlingMethod = " + supportedConflictHandlingMethod); } String[] supportedMetadataFormats = standAloneImpl.getSupportedMetadataFormats(); for (int i = 0; i < supportedMetadataFormats.length; i++) { String supportedMetadataFormat = supportedMetadataFormats[i]; System.out.println("supportedMetadataFormat = " + supportedMetadataFormat); }
standAloneImpl.setMetadataFormat(SamgiConstantsG.DCRDF);
///////////////////////////////////////////// // Initialize the MetadatasourceIds /////////////////////////////////////////////
MetadatasourceIdG mdsId; // 1. a FileSystemMetadatasourceId String fileLocation = "MUST_BE_SET_BY_USER"; // Windows example // String fileLocation = "D:\\mydocs\\testdocument.pdf"; // Linux example // String fileLocation = "/home/abc/testdocument.pdf"; mdsId = new FileSystemMetadatasourceIdG(new File(fileLocation)); mdsId.setMetadataElementLanguageRestricted(false); mdsId.setMetadataElementLanguageRestrictions(null);
///////////////////////////////////////////// // Generate & retrieve metadata ///////////////////////////////////////////// // ** With merging information. In the case of our SAmgI ipmlementation, the used metadata format will then always be LOM AmgMetadataG metadataGenResult = standAloneImpl.getMetadataWithMergingInformation(new MetadatasourceIdG[]{mdsId}); System.out.println( "\n--------------------- \n metadataGenResult = \n--------------------- \n" + metadataGenResult.getMetadataString()); System.out.println( "\n------------------------------------- \n metadataGenResult.marshalToString() = \n------------------------------------- \n" + metadataGenResult.marshalToString());
// ** Without merging information, in the metadata format you specified with the setMetadataFormat operation String metadataGenResultInDCRDF = standAloneImpl.getMetadata(new MetadatasourceIdG[]{mdsId}); System.out.println("\n-------------------------- \n metadataGenResultInDCRDF = \n-------------------------- \n" + metadataGenResultInDCRDF);
} catch (Exception e) { e.printStackTrace();
} }
}
|
|
|
|
|
 |
|