Package org.purl.sword.base

Examples of org.purl.sword.base.Collection


    SWORDConfiguration swordConfig = swordService.getSwordConfig();
    SWORDUrlManager urlManager = swordService.getUrlManager();
    Context context = swordService.getContext();

    Item item = (Item) dso;
    Collection scol = new Collection();

    // prepare the parameters to be put in the sword collection
    String location = urlManager.getDepositLocation(item);
    scol.setLocation(location);

    // the item title is the sword collection title, or "untitled" otherwise
    String title = "Untitled";
    DCValue[] dcv = item.getMetadata("dc.title");
    if (dcv.length > 0)
    {
      title = dcv[0].value;
    }
    scol.setTitle(title);

    // FIXME: there is no collection policy for items that is obvious to provide.
    // the collection policy is the licence to which the collection adheres
    // String collectionPolicy = col.getLicense();

    // abstract is the short description of the item, if it exists
    String dcAbstract = "";
    DCValue[] dcva = item.getMetadata("dc.description.abstract");
    if (dcva.length > 0)
    {
      dcAbstract = dcva[0].value;
    }
    if (dcAbstract != null && !"".equals(dcAbstract))
    {
      scol.setAbstract(dcAbstract);
    }

    // do we suppot mediated deposit
    scol.setMediation(swordConfig.isMediated());

    // the list of mime types that we accept, which we take from the
    // bitstream format registry
    List<String> acceptFormats = swordConfig.getAccepts(context, item);
    for (String acceptFormat : acceptFormats)
    {
      scol.addAccepts(acceptFormat);
    }

    return scol;
  }
View Full Code Here


    // get the things we need out of the service
    SWORDConfiguration swordConfig = swordService.getSwordConfig();
    SWORDUrlManager urlManager = swordService.getUrlManager();

    Community com = (Community) dso;
    Collection scol = new Collection();

    // prepare the parameters to be put in the sword collection
    String location = urlManager.getDepositLocation(com);
    scol.setLocation(location);

    // collection title is just the community name
    String title = com.getMetadata("name");
    if (title != null && !"".equals(title))
    {
      scol.setTitle(title);
    }

    // FIXME: the community has no obvious licence
    // the collection policy is the licence to which the collection adheres
    // String collectionPolicy = col.getLicense();

    // abstract is the short description of the collection
    String dcAbstract = com.getMetadata("short_description");
    if (dcAbstract != null && !"".equals(dcAbstract))
    {
      scol.setAbstract(dcAbstract);
    }

    // do we support mediated deposit
    scol.setMediation(swordConfig.isMediated());

    // NOTE: for communities, there are no MIME types that it accepts.
    // the list of mime types that we accept

    // offer up the collections from this item as deposit targets
    String subService = urlManager.constructSubServiceUrl(com);
    scol.setService(subService);

    log.debug("Created ATOM Collection for DSpace Community");

    return scol;
  }
View Full Code Here

    SWORDConfiguration swordConfig = swordService.getSwordConfig();
    SWORDUrlManager urlManager = swordService.getUrlManager();

    org.dspace.content.Collection col = (org.dspace.content.Collection) dso;

    Collection scol = new Collection();

    // prepare the parameters to be put in the sword collection
    String location = urlManager.getDepositLocation(col);

    // collection title is just its name
    String title = col.getMetadata("name");

    // the collection policy is the licence to which the collection adheres
    String collectionPolicy = col.getLicense();

    // FIXME: what is the treatment?  Doesn't seem appropriate for DSpace
    // String treatment = " ";

    // abstract is the short description of the collection
    String dcAbstract = col.getMetadata("short_description");

    // we just do support mediation
    boolean mediation = swordConfig.isMediated();

    // the list of mime types that we accept
    // for the time being, we just take a zip, and we have to trust what's in it
    String zip = "application/zip";

    // load up the sword collection
    scol.setLocation(location);

    // add the title if it exists
    if (title != null && !"".equals(title))
    {
      scol.setTitle(title);
    }

    // add the collection policy if it exists
    if (collectionPolicy != null && !"".equals(collectionPolicy))
    {
      scol.setCollectionPolicy(collectionPolicy);
    }

    // FIXME: leave the treatment out for the time being,
    // as there is no analogue
    // scol.setTreatment(treatment);

    // add the abstract if it exists
    if (dcAbstract != null && !"".equals(dcAbstract))
    {
      scol.setAbstract(dcAbstract);
    }

    scol.setMediation(mediation);

        List<String> accepts = swordService.getSwordConfig().getCollectionAccepts();
        for (String accept : accepts)
        {
            scol.addAccepts(accept);
        }

    // add the accept packaging values
    Map<String, Float> aps = swordConfig.getAcceptPackaging(col);
    for (String key : aps.keySet())
    {
      Float q = aps.get(key);
      scol.addAcceptPackaging(key, q);
    }

    // should we offer the items in the collection up as deposit
    // targets?
    boolean itemService = ConfigurationManager.getBooleanProperty("sword.expose-items");
    if (itemService)
    {
      String subService = urlManager.constructSubServiceUrl(col);
      scol.setService(subService);
    }

    log.debug("Created ATOM Collection for DSpace Collection");

    return scol;
View Full Code Here

    log.debug("location is: " + location);
       
      if (sdr.getLocation().contains("?nested=")) {
        Workspace workspace = new Workspace();
        workspace.setTitle("Nested service document workspace");
        Collection collection = new Collection();
        collection.setTitle("Nested collection: " + sdr.getLocation().substring(sdr.getLocation().indexOf('?') + 1));
        collection.setLocation(location + "/deposit/nested");
        collection.addAcceptPackaging("http://purl.org/net/sword-types/METSDSpaceSIP");
        collection.addAcceptPackaging("http://purl.org/net/sword-types/bagit");
        collection.addAccepts("application/zip");
        collection.addAccepts("application/xml");
        collection.setAbstract("A nested collection that users can deposit into");
        collection.setTreatment("This is a dummy server");
        collection.setCollectionPolicy("No guarantee of service, or that deposits will be retained for any length of time.");
        workspace.addCollection(collection);
        service.addWorkspace(workspace);
      } else {
        Workspace workspace = new Workspace();
        workspace.setTitle("Anonymous submitters workspace");
        Collection collection = new Collection();
        collection.setTitle("Anonymous submitters collection");
        collection.setLocation(location + "/deposit/anon");
        collection.addAcceptPackaging("http://purl.org/net/sword-types/METSDSpaceSIP");
        collection.addAcceptPackaging("http://purl.org/net/sword-types/bagit");
        collection.addAccepts("application/zip");
        collection.addAccepts("application/xml");
        collection.setAbstract("A collection that anonymous users can deposit into");
        collection.setTreatment("This is a dummy server");
        collection.setCollectionPolicy("No guarantee of service, or that deposits will be retained for any length of time.");
        collection.setService(location + "/client/servicedocument?nested=anon");
        workspace.addCollection(collection);
        collection = new Collection();
        collection.setTitle("Anonymous submitters other collection");
        collection.setLocation(location + "/deposit/anonymous");
        collection.addAcceptPackaging("http://purl.org/net/sword-types/METSDSpaceSIP");
        collection.addAcceptPackaging("http://purl.org/net/sword-types/bagit");
        collection.addAccepts("application/zip");
        collection.addAccepts("application/xml");
        collection.setAbstract("Another collection that anonymous users can deposit into");
        collection.setTreatment("This is a dummy server");
        collection.setCollectionPolicy("No guarantee of service, or that deposits will be retained for any length of time.");
        workspace.addCollection(collection);
        service.addWorkspace(workspace);
       
        if (sdr.getUsername() != null) {
          workspace = new Workspace();
          workspace.setTitle("Authenticated workspace for " + username);
          collection = new Collection();
          collection.setTitle("Authenticated collection for " + username);
          collection.setLocation(location + "/deposit/" + username);
          collection.addAccepts("application/zip");
          collection.addAccepts("application/xml");
          collection.addAcceptPackaging("http://purl.org/net/sword-types/METSDSpaceSIP");
          collection.addAcceptPackaging("http://purl.org/net/sword-types/bagit", 0.8f);
          collection.setAbstract("A collection that " + username + " can deposit into");
          collection.setTreatment("This is a dummy server");
          collection.setCollectionPolicy("No guarantee of service, or that deposits will be retained for any length of time.");
          collection.setService(location + "/client/servicedocument?nested=authenticated");
          workspace.addCollection(collection);
          collection = new Collection();
          collection.setTitle("Second authenticated collection for " + username);
          collection.setLocation(location + "/deposit/" + username + "-2");
          collection.addAccepts("application/zip");
          collection.addAccepts("application/xml");
          collection.addAcceptPackaging("http://purl.org/net/sword-types/bagit", 0.123f);
          collection.addAcceptPackaging("http://purl.org/net/sword-types/METSDSpaceSIP");
          collection.setAbstract("A collection that " + username + " can deposit into");
          collection.setTreatment("This is a dummy server");
          collection.setCollectionPolicy("No guarantee of service, or that deposits will be retained for any length of time.");
          workspace.addCollection(collection);
        }
        service.addWorkspace(workspace);
      }
     
      String onBehalfOf = sdr.getOnBehalfOf();
      if ((onBehalfOf != null) && (!onBehalfOf.equals(""))) {
        Workspace workspace = new Workspace();
        workspace.setTitle("Personal workspace for " + onBehalfOf);
        Collection collection = new Collection();
        collection.setTitle("Personal collection for " + onBehalfOf);
        collection.setLocation(location + "/deposit?user=" + onBehalfOf);
        collection.addAccepts("application/zip");
        collection.addAccepts("application/xml");
        collection.addAcceptPackaging("http://purl.org/net/sword-types/METSDSpaceSIP");
        collection.addAcceptPackaging("http://purl.org/net/sword-types/bagit", 0.8f);
        collection.setAbstract("An abstract goes in here");
        collection.setCollectionPolicy("A collection policy");
        collection.setMediation(true);
        collection.setTreatment("treatment in here too");
        workspace.addCollection(collection);
        service.addWorkspace(workspace);
      }
     
      return document;
View Full Code Here

        String[] clientFTsArray = FTsString.split(",");
        List<String> clientFTs = Arrays.asList(clientFTsArray);

        List<String> commonFTs = new ArrayList<String>();

        Collection collection = ServiceDocumentHelper.getCollection(serviceDoc, location);
        String[] serverFTs = collection.getAccepts();
        for (String serverFT : serverFTs)
        {
             if (clientFTs.contains(serverFT))
            {
                commonFTs.add(serverFT);
View Full Code Here

        String[] clientPFsArray = PFsString.split(",");
        List<String> clientPFs = Arrays.asList(clientPFsArray);

        List<String> commonPFs = new ArrayList<String>();

        Collection collection = ServiceDocumentHelper.getCollection(serviceDoc, location);
        List<SwordAcceptPackaging> serverPFs = collection.getAcceptPackaging();
        for (SwordAcceptPackaging serverPF : serverPFs)
        {
            if (clientPFs.contains(serverPF.getContent()))
            {
                commonPFs.add(serverPF.getContent());
View Full Code Here

    log.debug("location is: " + location);
       
      if (sdr.getLocation().contains("?nested=")) {
        Workspace workspace = new Workspace();
        workspace.setTitle("Nested service document workspace");
        Collection collection = new Collection();
        collection.setTitle("Nested collection: " + sdr.getLocation().substring(sdr.getLocation().indexOf('?') + 1));
        collection.setLocation(location + "/deposit/nested");
        collection.addAcceptPackaging("http://purl.org/net/sword-types/METSDSpaceSIP");
        collection.addAcceptPackaging("http://purl.org/net/sword-types/bagit");
        collection.addAccepts("application/zip");
        collection.addAccepts("application/xml");
        collection.setAbstract("A nested collection that users can deposit into");
        collection.setTreatment("This is a dummy server");
        collection.setCollectionPolicy("No guarantee of service, or that deposits will be retained for any length of time.");
        workspace.addCollection(collection);
        service.addWorkspace(workspace);
      } else {
        Workspace workspace = new Workspace();
        workspace.setTitle("Anonymous submitters workspace");
        Collection collection = new Collection();
        collection.setTitle("Anonymous submitters collection");
        collection.setLocation(location + "/deposit/anon");
        collection.addAcceptPackaging("http://purl.org/net/sword-types/METSDSpaceSIP");
        collection.addAcceptPackaging("http://purl.org/net/sword-types/bagit");
        collection.addAccepts("application/zip");
        collection.addAccepts("application/xml");
        collection.setAbstract("A collection that anonymous users can deposit into");
        collection.setTreatment("This is a dummy server");
        collection.setCollectionPolicy("No guarantee of service, or that deposits will be retained for any length of time.");
        collection.setService(location + "/client/servicedocument?nested=anon");
        workspace.addCollection(collection);
        collection = new Collection();
        collection.setTitle("Anonymous submitters other collection");
        collection.setLocation(location + "/deposit/anonymous");
        collection.addAcceptPackaging("http://purl.org/net/sword-types/METSDSpaceSIP");
        collection.addAcceptPackaging("http://purl.org/net/sword-types/bagit");
        collection.addAccepts("application/zip");
        collection.addAccepts("application/xml");
        collection.setAbstract("Another collection that anonymous users can deposit into");
        collection.setTreatment("This is a dummy server");
        collection.setCollectionPolicy("No guarantee of service, or that deposits will be retained for any length of time.");
        workspace.addCollection(collection);
        service.addWorkspace(workspace);
       
        if (sdr.getUsername() != null) {
          workspace = new Workspace();
          workspace.setTitle("Authenticated workspace for " + username);
          collection = new Collection();
          collection.setTitle("Authenticated collection for " + username);
          collection.setLocation(location + "/deposit/" + username);
          collection.addAccepts("application/zip");
          collection.addAccepts("application/xml");
          collection.addAcceptPackaging("http://purl.org/net/sword-types/METSDSpaceSIP");
          collection.addAcceptPackaging("http://purl.org/net/sword-types/bagit", 0.8f);
          collection.setAbstract("A collection that " + username + " can deposit into");
          collection.setTreatment("This is a dummy server");
          collection.setCollectionPolicy("No guarantee of service, or that deposits will be retained for any length of time.");
          collection.setService(location + "/client/servicedocument?nested=authenticated");
          workspace.addCollection(collection);
          collection = new Collection();
          collection.setTitle("Second authenticated collection for " + username);
          collection.setLocation(location + "/deposit/" + username + "-2");
          collection.addAccepts("application/zip");
          collection.addAccepts("application/xml");
          collection.addAcceptPackaging("http://purl.org/net/sword-types/bagit", 0.123f);
          collection.addAcceptPackaging("http://purl.org/net/sword-types/METSDSpaceSIP");
          collection.setAbstract("A collection that " + username + " can deposit into");
          collection.setTreatment("This is a dummy server");
          collection.setCollectionPolicy("No guarantee of service, or that deposits will be retained for any length of time.");
          workspace.addCollection(collection);
        }
        service.addWorkspace(workspace);
      }
     
      String onBehalfOf = sdr.getOnBehalfOf();
      if ((onBehalfOf != null) && (!onBehalfOf.equals(""))) {
        Workspace workspace = new Workspace();
        workspace.setTitle("Personal workspace for " + onBehalfOf);
        Collection collection = new Collection();
        collection.setTitle("Personal collection for " + onBehalfOf);
        collection.setLocation(location + "/deposit?user=" + onBehalfOf);
        collection.addAccepts("application/zip");
        collection.addAccepts("application/xml");
        collection.addAcceptPackaging("http://purl.org/net/sword-types/METSDSpaceSIP");
        collection.addAcceptPackaging("http://purl.org/net/sword-types/bagit", 0.8f);
        collection.setAbstract("An abstract goes in here");
        collection.setCollectionPolicy("A collection policy");
        collection.setMediation(true);
        collection.setTreatment("treatment in here too");
        workspace.addCollection(collection);
        service.addWorkspace(workspace);
      }
     
      return document;
View Full Code Here

         DefaultMutableTreeNode collectionNode = null;
         Iterator<Collection> collections = workspace.collectionIterator();
         for (; collections.hasNext();)
         {
            Collection collection = collections.next();
            wrapper = new TreeNodeWrapper(collection.getTitle(), collection);
            collectionNode = new DefaultMutableTreeNode(wrapper);
            treeModel.insertNodeInto(collectionNode, workspaceNode, workspaceNode.getChildCount());
            services.scrollPathToVisible(new TreePath(collectionNode.getPath()));
         }
      } // for
View Full Code Here

                         alertListener(null);
                     }
                  }
                  else if( data instanceof Collection )
                  {
                     Collection c = (Collection)data;
                     showCollection(c);
                     alertListener(c.getLocation());
                  }
                  else if( data instanceof SWORDEntry )
                  {
                     showEntry((SWORDEntry)data);
                     alertListener(null);
View Full Code Here

         {
            TreeNodeWrapper collectionWrapper = (TreeNodeWrapper)o;
            Object data = collectionWrapper.getData();
            if( data instanceof Collection )
            {
               Collection col = (Collection)data;
               String location = col.getLocation();
               if( location != null && location.equals(url))
               {
                  newParentNode = node;
                  break;
               }
View Full Code Here

TOP

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

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.