Examples of MigrateResult


Examples of eu.planets_project.services.migrate.MigrateResult

        }

        /*
         * Now call the migration service
         */
        MigrateResult migrateResult = this.migrate1.migrate(digO, migrateFromURI, migrateToURI, parameterList);
        ServiceReport report = migrateResult.getReport();

        if(report.getType() == Type.ERROR){
            String s = "Service execution failed: " + report.getMessage();
            log.info(s);
            throw new Exception(s);
        }

        return migrateResult.getDigitalObject();
    }
View Full Code Here

Examples of eu.planets_project.services.migrate.MigrateResult

                "compressionQuality");
        if (pCompressionQuality != null) {
            parameterList.add(pCompressionQuality);
        }

        MigrateResult migrateResult = this.migrate.migrate(digO, migrateFromURI, migrateToURI, parameterList);
       
        DigitalObject dgoOut = migrateResult.getDigitalObject();
       
        //put filename without extenstion if empty
        if(dgoOut.getTitle() == null) {
          String title_ = digO.getTitle().substring(0,digO.getTitle().lastIndexOf('.'));
          if(migrateToURI.toString().toLowerCase().lastIndexOf("siard") > 0) title_ = title_ + ".siard";
          dgoOut = (new DigitalObject.Builder(dgoOut)).title(title_).build();
        }

        ServiceReport report = migrateResult.getReport();

        if (report.getType() == Type.ERROR) {
            String s = "Service execution failed: " + report.getMessage();
            log.debug(s);
            throw new Exception(s);
View Full Code Here

Examples of eu.planets_project.services.migrate.MigrateResult

                "compressionQuality");
        if (pCompressionQuality != null) {
            parameterList.add(pCompressionQuality);
        }

        MigrateResult migrateResult = this.migrate.migrate(digO, migrateFromURI, migrateToURI, parameterList);
        ServiceReport report = migrateResult.getReport();

        if (report.getType() == Type.ERROR) {
            String s = "Service execution failed: " + report.getMessage();
            log.debug(s);
            throw new Exception(s);
        }
        return migrateResult.getDigitalObject();
    }
View Full Code Here

Examples of eu.planets_project.services.migrate.MigrateResult

     * @throws Exception
     */
    @Test
    public void testMigrateUsingTempFiles() throws Exception {

  MigrateResult migrationResult = this.genericWrapper.migrate(
    getDigitalTestObject(), this.sourceFormatURI, this.destinationFormatURI,
    this.testParameters);

  Assert.assertEquals(ServiceReport.Status.SUCCESS, migrationResult
    .getReport().getStatus());
    }
View Full Code Here

Examples of eu.planets_project.services.migrate.MigrateResult

     */
    @Test
    public void testMigrateUsingTempFiles() throws Exception {
  this.testParameters.add(new Parameter("mode", "complete"));

  MigrateResult migrationResult = this.genericWrapper.migrate(
    getDigitalTestObject(), this.sourceFormatURI, this.destinationFormatURI,
    this.testParameters);

  //TODO: Test the contents of the digital object and the metadata.
 
  Assert.assertEquals(ServiceReport.Status.SUCCESS, migrationResult
    .getReport().getStatus());
    }
View Full Code Here

Examples of eu.planets_project.services.migrate.MigrateResult

        if (serviceParams.size() <= 0) {
            serviceParams = null;
        }
       
        // perform migration
        MigrateResult result = m.migrate(dob, sourceFormat, targetFormat, serviceParams);

        MigrationResult migrationResult = new MigrationResult();
        migrationResult.setSuccessful((result != null) && (result.getDigitalObject() != null));

        if (migrationResult.isSuccessful()) {
            migrationResult.setReport(String.format("Service %s successfully migrated object.", wsdlLocation));
        } else {
            migrationResult.setReport(String.format("Service %s failed migrating object. " + ((result==null)? "" : result.getReport()), wsdlLocation));
            lastResult = migrationResult;
            return true;
        }

        InputStream in = result.getDigitalObject().getContent().getInputStream();
        ByteArrayOutputStream out = new ByteArrayOutputStream();

        byte[] b = new byte[1024];

        try {
View Full Code Here

Examples of eu.planets_project.services.migrate.MigrateResult

        /* Result properties are available here: */
        CharacteriseResult characteriseResult = extractorCharacterise.characterise(dob, params);
        List<Property> properties = characteriseResult.getProperties();
        System.out.println(properties);
        /* But the code below wants the XCDL as a DigitalObject, so we use Migrate: */
        MigrateResult migrateResult = extractorMigrate.migrate(dob, null, null, params);
       
        // FIXME Use the properties interface / generally update the invoker as this code is not needed now...
        /*
        for( Property p : characteriseResult.getProperties() ) {
            log.info("Got p = "+p);
        }
        */

        List<MeasurementImpl> list;
        try {
            list = XCDLParser.parseXCDL(migrateResult.getDigitalObject().getContent().getInputStream());
        } catch (Exception e) {
            e.printStackTrace();
            list = null;
        }
        List<Property> mprops = new Vector<Property>();
View Full Code Here

Examples of eu.planets_project.services.migrate.MigrateResult

                                    .toURI().toURL())).permanentUri(
                    URI.create("http://some")).build();
            System.out.println("Input: " + input);

            FormatRegistry format = FormatRegistryFactory.getFormatRegistry();
            MigrateResult mr = dom.migrate(input, format.createExtensionUri("png"),
                    format.createExtensionUri("gif"), null);

            ServiceReport sr = mr.getReport();
            System.out.println("Got Report: " + sr);

            DigitalObject doOut = mr.getDigitalObject();

            assertTrue("Resulting digital object is null.", doOut != null);

            System.out.println("Output: " + doOut);
            System.out.println("Output.content: " + doOut.getContent());
View Full Code Here

Examples of eu.planets_project.services.migrate.MigrateResult

            log.log(Level.SEVERE, "Could not return content by reference. ", e);
        }
        */
        ServiceReport rep = new ServiceReport(Type.INFO, Status.SUCCESS, "OK", sph.getPerformanceProperties() );
        DigitalObject ndo = new DigitalObject.Builder(Content.byReference(outfile)).build();
        return new MigrateResult(ndo, rep);
    }
View Full Code Here

Examples of eu.planets_project.services.migrate.MigrateResult

     * @param message
     * @return
     */
    private MigrateResult returnWithErrorMessage(String message, Exception e ) {
        if( e == null ) {
            return new MigrateResult(null, ServiceUtils.createErrorReport(message));
        } else {
            return new MigrateResult(null, ServiceUtils.createExceptionErrorReport(message, e));
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.