Fedora Commons Iformation

103 Views Asked by At

I'm using fedora commons 3.7 and fedora-client 0.7 and I'm really newbie to fedora commons...so pardon me if I do very basic questions As far as I know, in order to use fedora repository I have to use the fedora web application and the best is to deploy with the embedded tomcat; am I right?

Moreover, I was able in uploading a file to the fedora repository; in order to do it I wrote this simple test case:

@Test
public void ingestFile()
{
try
{
    File toUpload = new File("/home/angelo/Scrivania/test.odt");
    FedoraCredentials fc = new FedoraCredentials("http://localhost:8080/fedora", "fedoraAdmin", "fedoraAdmin");
    FedoraClient fcRepoClient = new FedoraClient(fc);
    FedoraRequest.setDefaultClient(fcRepoClient);
    Ingest in = new Ingest();
    IngestResponse ir = in.execute();
    AddDatastream ads = new AddDatastream(ir.getPid(), toUpload.getName());
//Mime type util
    ContentInfoUtil cif = new ContentInfoUtil();
    ContentInfo ci = cif.findMatch(toUpload);
    if( ci != null && ci.getMimeType() != null && !ci.getMimeType().trim().equals("") )
    {
        ads.mimeType(ci.getMimeType());
    }
    ads.controlGroup("M");
    ads.content(toUpload);
    AddDatastreamResponse adsr = ads.execute();
    logger.info(adsr.getDatastreamProfile().getPid());
} catch (Exception e)
{
logger.error(e.getMessage(), e);
}
}

All is pretty working Now...let's suppose I need to add some other properties to the file I want to upload (e.g. copyright stuffs, description, dates and so on....) and let's suppose I have to be able to do search on this properties... is it possible? If so...how can I do it? Should I create a new Datastream and make a relation between the one of my file and the new datastream? Shouls I create my own FOXML and provide it to the datastream? May anybody give me a tip regarding to this problem? Any suggestion would be great

Thank you

Angelo

0

There are 0 best solutions below