public ExternalDatastreamImpl(
     DatastreamProfile datastreamProfile, DigitalObject digitalObject, CentralWebservice api) {
   super(datastreamProfile, digitalObject, api);
   this.api = api;
   url = datastreamProfile.getUrl();
   originalURL = url;
 }
Ejemplo n.º 2
0
  /** Test code :-) */
  @org.junit.Test
  public void testExample() throws Exception {
    CentralWebservice webservice =
        new CentralWebserviceService(
                new URL("http://localhost:7880/centralWebservice-service/central/?wsdl"),
                new QName("http://central.doms.statsbiblioteket.dk/", "CentralWebserviceService"))
            .getCentralWebservicePort();
    Map<String, Object> domsAPILogin = ((BindingProvider) webservice).getRequestContext();
    domsAPILogin.put(BindingProvider.USERNAME_PROPERTY, "fedoraAdmin");
    domsAPILogin.put(BindingProvider.PASSWORD_PROPERTY, "fedoraAdminPass");

    for (dk.statsbiblioteket.doms.central.SearchResult result :
        webservice.findObjects("Valse", 0, 20)) {
      System.out.println(result.getPid() + ": " + result.getTitle());
    }

    List<DatastreamProfile> datastreams =
        webservice.getObjectProfile("uuid:bd64c76a-67c5-4aa3-bc51-acfce17df791").getDatastreams();
    for (DatastreamProfile datastream : datastreams) {
      System.out.println(datastream.getId() + "\t" + datastream.getFormatUri());
    }
    System.out.println();

    webservice.markInProgressObject(
        Arrays.asList(new String[] {"uuid:bd64c76a-67c5-4aa3-bc51-acfce17df791"}), "In progress");
    webservice.addFileFromPermanentURL(
        "uuid:bd64c76a-67c5-4aa3-bc51-acfce17df791",
        "valse1.bwf",
        null,
        "http://stage01/doms/valse1.bwf",
        "info:pronom/fmt/2",
        "Added file");
    webservice.markPublishedObject(
        Arrays.asList(new String[] {"uuid:bd64c76a-67c5-4aa3-bc51-acfce17df791"}), "Ready");

    List<DatastreamProfile> datastreams2 =
        webservice.getObjectProfile("uuid:bd64c76a-67c5-4aa3-bc51-acfce17df791").getDatastreams();
    for (DatastreamProfile datastream : datastreams2) {
      System.out.println(datastream.getId() + "\t" + datastream.getFormatUri());
    }
  }