Package org.purl.sword.base

Examples of org.purl.sword.base.Workspace


    {
      // we are dealing with the default service document

      // set the title of the workspace as per the name of the DSpace installation
      String ws = ConfigurationManager.getProperty("dspace.name");
      Workspace workspace = new Workspace();
      workspace.setTitle(ws);

      // next thing to do is determine whether the default is communities or collections
      boolean swordCommunities = ConfigurationManager.getBooleanProperty("sword.expose-communities");

      if (swordCommunities)
      {
        List<Community> comms = swordAuth.getAllowedCommunities(swordContext);
        for (Community comm : comms)
        {
          org.purl.sword.base.Collection scol = comGen.buildCollection(comm);
          workspace.addCollection(scol);
        }
      }
      else
      {
        List<Collection> cols = swordAuth.getAllowedCollections(swordContext);
        for (Collection col : cols)
        {
          org.purl.sword.base.Collection scol = colGen.buildCollection(col);
          workspace.addCollection(scol);
        }
      }

      service.addWorkspace(workspace);
    }
    else
    {
      // we are dealing with a partial or sub-service document
      DSpaceObject dso = urlManager.extractDSpaceObject(url);

      if (dso instanceof Collection)
      {
        Collection collection = (Collection) dso;
        Workspace workspace = new Workspace();
        workspace.setTitle(collection.getMetadata("name"));

        List<Item> items = swordAuth.getAllowedItems(swordContext, collection);
        for (Item item : items)
        {
          org.purl.sword.base.Collection scol = itemGen.buildCollection(item);
          workspace.addCollection(scol);
        }

        service.addWorkspace(workspace);
      }
      else if (dso instanceof Community)
      {
        Community community = (Community) dso;
        Workspace workspace = new Workspace();
        workspace.setTitle(community.getMetadata("name"));

        List<Collection> collections = swordAuth.getAllowedCollections(swordContext, community);
        for (Collection collection : collections)
        {
          org.purl.sword.base.Collection scol = colGen.buildCollection(collection);
          workspace.addCollection(scol);
        }

        List<Community> communities = swordAuth.getCommunities(swordContext, community);
        for (Community comm : communities)
        {
          org.purl.sword.base.Collection scol = comGen.buildCollection(comm);
          workspace.addCollection(scol);
        }

        service.addWorkspace(workspace);
      }
    }
View Full Code Here


        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=")) {
        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 workspaceNode = null;

      Iterator<Workspace> workspaces = service.getWorkspaces();
      for (; workspaces.hasNext();)
      {
         Workspace workspace = workspaces.next();
         wrapper = new TreeNodeWrapper(workspace.getTitle(), workspace);
         workspaceNode = new DefaultMutableTreeNode(wrapper);
         treeModel.insertNodeInto(workspaceNode, serviceNode, serviceNode.getChildCount());
         services.scrollPathToVisible(new TreePath(workspaceNode.getPath()));

         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);
View Full Code Here

    {
      // we are dealing with the default service document

      // set the title of the workspace as per the name of the DSpace installation
      String ws = ConfigurationManager.getProperty("dspace.name");
      Workspace workspace = new Workspace();
      workspace.setTitle(ws);

      // next thing to do is determine whether the default is communities or collections
      boolean swordCommunities = ConfigurationManager.getBooleanProperty("sword-server", "expose-communities");

      if (swordCommunities)
      {
        List<Community> comms = swordAuth.getAllowedCommunities(swordContext);
        for (Community comm : comms)
        {
          org.purl.sword.base.Collection scol = comGen.buildCollection(comm);
          workspace.addCollection(scol);
        }
      }
      else
      {
        List<Collection> cols = swordAuth.getAllowedCollections(swordContext);
        for (Collection col : cols)
        {
          org.purl.sword.base.Collection scol = colGen.buildCollection(col);
          workspace.addCollection(scol);
        }
      }

      service.addWorkspace(workspace);
    }
    else
    {
      // we are dealing with a partial or sub-service document
      DSpaceObject dso = urlManager.extractDSpaceObject(url);

      if (dso instanceof Collection)
      {
        Collection collection = (Collection) dso;
        Workspace workspace = new Workspace();
        workspace.setTitle(collection.getMetadata("name"));

        List<Item> items = swordAuth.getAllowedItems(swordContext, collection);
        for (Item item : items)
        {
          org.purl.sword.base.Collection scol = itemGen.buildCollection(item);
          workspace.addCollection(scol);
        }

        service.addWorkspace(workspace);
      }
      else if (dso instanceof Community)
      {
        Community community = (Community) dso;
        Workspace workspace = new Workspace();
        workspace.setTitle(community.getMetadata("name"));

        List<Collection> collections = swordAuth.getAllowedCollections(swordContext, community);
        for (Collection collection : collections)
        {
          org.purl.sword.base.Collection scol = colGen.buildCollection(collection);
          workspace.addCollection(scol);
        }

        List<Community> communities = swordAuth.getCommunities(swordContext, community);
        for (Community comm : communities)
        {
          org.purl.sword.base.Collection scol = comGen.buildCollection(comm);
          workspace.addCollection(scol);
        }

        service.addWorkspace(workspace);
      }
    }
View Full Code Here

        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=")) {
        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

          + document.getService().getMaxUploadSize() +" kB");

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

        System.out.println("\n+ Collections ---");
        // process the collections
        Iterator<Collection> collections = workspace
        .collectionIterator();
        for (; collections.hasNext();)
        {
          Collection collection = collections.next();
          System.out.println("\nCollection location: "
View Full Code Here

TOP

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

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.