Package org.purl.sword.base

Examples of org.purl.sword.base.ServiceDocument


      log.info(LogManager.getHeader(context, "sword_service_document_request", "username=" + request.getUsername() + ",on_behalf_of=" + request.getOnBehalfOf()));
     
      // prep the service request, then get the service document out of it
      SWORDService service = new SWORDService(sc);
      ServiceDocumentManager manager = new ServiceDocumentManager(service);
      ServiceDocument doc = manager.getServiceDocument(request.getLocation());
     
      return doc;
    }
    catch (DSpaceSWORDException e)
    {
View Full Code Here


        service.addWorkspace(workspace);
      }
    }

    ServiceDocument sd = new ServiceDocument(service);
    return sd;
  }
View Full Code Here

      // Throw the error exception
      throw new SWORDErrorException(ErrorCodes.MEDIATION_NOT_ALLOWED, "Mediated deposits not allowed");
    }
   
    // Create and return a dummy ServiceDocument
    ServiceDocument document = new ServiceDocument();
    Service service = new Service("1.3", true, true);
    document.setService(service);
        log.debug("sdr.getLocation() is: " + sdr.getLocation());
    String location = sdr.getLocation().substring(0, sdr.getLocation().length() - 16);
    log.debug("location is: " + location);
       
      if (sdr.getLocation().contains("?nested=")) {
View Full Code Here

    // Set the deposit location
    sdr.setLocation(getUrl(request));

    // Get the ServiceDocument
    try {
      ServiceDocument sd = myRepository.doServiceDocument(sdr);
      if ((sd.getService().getMaxUploadSize() == -1) && (maxUploadSize != -1)) {
        sd.getService().setMaxUploadSize(maxUploadSize);
      }
   
      // Print out the Service Document
      response.setContentType("application/atomsvc+xml; charset=UTF-8");
      PrintWriter out = response.getWriter();
      out.write(sd.marshall());
      out.flush();
    } catch (SWORDAuthenticationException sae) {
      if (authN.equals("Basic")) {
        String s = "Basic realm=\"SWORD\"";
        response.setHeader("WWW-Authenticate", s);
View Full Code Here


    public ServiceDocument getServiceDocument() throws HttpException, SWORDClientException
    {
        log.info("Getting Sword Service Document from " + serviceDocUrl);
        ServiceDocument sd = client.getServiceDocument(serviceDocUrl, onBehalfOf);

        Status status = client.getStatus();

        if (status.getCode() == 200)
        {
View Full Code Here

        service.addWorkspace(workspace);
      }
    }

        return new ServiceDocument(service);
  }
View Full Code Here

      // Throw the error exception
      throw new SWORDErrorException(ErrorCodes.MEDIATION_NOT_ALLOWED, "Mediated deposits not allowed");
    }
   
    // Create and return a dummy ServiceDocument
    ServiceDocument document = new ServiceDocument();
    Service service = new Service("1.3", true, true);
    document.setService(service);
        log.debug("sdr.getLocation() is: " + sdr.getLocation());
    String location = sdr.getLocation().substring(0, sdr.getLocation().length() - 16);
    log.debug("location is: " + location);
       
      if (sdr.getLocation().contains("?nested=")) {
View Full Code Here

    // Set the deposit location
    sdr.setLocation(getUrl(request));

    // Get the ServiceDocument
    try {
      ServiceDocument sd = myRepository.doServiceDocument(sdr);
      if ((sd.getService().getMaxUploadSize() == -1) && (maxUploadSize != -1)) {
        sd.getService().setMaxUploadSize(maxUploadSize);
      }
   
      // Print out the Service Document
      response.setContentType("application/atomsvc+xml; charset=UTF-8");
      PrintWriter out = response.getWriter();
      out.write(sd.marshall());
      out.flush();
    } catch (SWORDAuthenticationException sae) {
      if (authN.equals("Basic")) {
        String s = "Basic realm=\"SWORD\"";
        response.setHeader("WWW-Authenticate", s);
View Full Code Here

      log.info(LogManager.getHeader(context, "sword_service_document_request", "username=" + request.getUsername() + ",on_behalf_of=" + request.getOnBehalfOf()));
     
      // prep the service request, then get the service document out of it
      SWORDService service = new SWORDService(sc);
      ServiceDocumentManager manager = new ServiceDocumentManager(service);
      ServiceDocument doc = manager.getServiceDocument(request.getLocation());
     
      return doc;
    }
    catch (DSpaceSWORDException e)
    {
View Full Code Here

  throws SWORDClientException, MalformedURLException
  {
    String href = options.getHref();
    initialiseServer(href, options.getUsername(), options.getPassword());

    ServiceDocument document = client.getServiceDocument(href, options.getOnBehalfOf());
    Status status = client.getStatus();
    System.out.println("The status is: " + status);

    if (status.getCode() == 200)
    {
      log.debug("message is: " + document.marshall());
     
      System.out.println("\nThe following Details were retrieved: ");
      System.out.println("SWORD Version: "
          + document.getService().getVersion());
      System.out.println("Supports NoOp? " + document.getService().isNoOp());
      System.out.println("Supports Verbose? "
          + document.getService().isVerbose());
      System.out.println("Max Upload File Size "
          + document.getService().getMaxUploadSize() +" kB");

      Iterator<Workspace> workspaces = document.getService().getWorkspaces();
      for (; workspaces.hasNext();)
      {
        Workspace workspace = workspaces.next();
        System.out.println("\nWorkspace Title: '"
            + workspace.getTitle() + "'");
View Full Code Here

TOP

Related Classes of org.purl.sword.base.ServiceDocument

Copyright © 2018 www.massapicom. 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.