Skip to content

Instantly share code, notes, and snippets.

@peterdietz
Created April 13, 2011 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterdietz/918411 to your computer and use it in GitHub Desktop.
Save peterdietz/918411 to your computer and use it in GitHub Desktop.
attempting to disable cocoon cache in dspace xmlui
diff --git a/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/artifactbrowser/CollectionRecentSubmissions.java b/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/artifactbrowser/CollectionRecentSubmissions.java
index 9bf7c43..102eabe 100644
--- a/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/artifactbrowser/CollectionRecentSubmissions.java
+++ b/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/artifactbrowser/CollectionRecentSubmissions.java
@@ -41,7 +41,7 @@ import java.util.ArrayList;
* @author Mark Diggory (markd at atmire dot com)
* @author Ben Bosman (ben at atmire dot com)
*/
-public class CollectionRecentSubmissions extends AbstractDSpaceTransformer implements CacheableProcessingComponent {
+public class CollectionRecentSubmissions extends AbstractDSpaceTransformer{
private static final Logger log = Logger.getLogger(CollectionRecentSubmissions.class);
@@ -54,83 +54,6 @@ public class CollectionRecentSubmissions extends AbstractDSpaceTransformer imple
private static final Message T_head_recent_submissions =
message("xmlui.ArtifactBrowser.CollectionViewer.head_recent_submissions");
- /** Cached validity object */
- private SourceValidity validity;
-
- /**
- * Generate the unique caching key.
- * This key must be unique inside the space of this component.
- */
- public Serializable getKey()
- {
- try
- {
- DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
-
- if (dso == null)
- {
- return "0";
- }
-
- return HashUtil.hash(dso.getHandle());
- }
- catch (SQLException sqle)
- {
- // Ignore all errors and just return that the component is not
- // cachable.
- return "0";
- }
- }
-
- /**
- * Generate the cache validity object.
- *
- * The validity object will include the collection being viewed and
- * all recently submitted items. This does not include the community / collection
- * hierarch, when this changes they will not be reflected in the cache.
- */
- public SourceValidity getValidity()
- {
- if (this.validity == null)
- {
- Collection collection = null;
- try
- {
- DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
-
- if (dso == null)
- {
- return null;
- }
-
- if (!(dso instanceof Collection))
- {
- return null;
- }
-
- collection = (Collection) dso;
-
- DSpaceValidity validity = new DSpaceValidity();
-
- // Add the actual collection;
- validity.add(collection);
-
- // add reciently submitted items
- for(BrowseItem item : getRecientlySubmittedItems(collection))
- {
- validity.add(item);
- }
-
- this.validity = validity.complete();
- }
- catch (Exception e)
- {
- // Just ignore all errors and return an invalid cache.
- }
-
- }
- return this.validity;
- }
@Override
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
@@ -215,13 +138,4 @@ public class CollectionRecentSubmissions extends AbstractDSpaceTransformer imple
return this.recentSubmissionItems;
}
- /**
- * Recycle
- */
- public void recycle()
- {
- // Clear out our item's cache.
- this.recentSubmissionItems = null;
- super.recycle();
- }
}
diff --git a/dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/ArtifactBrowser/sitemap.xmap b/dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/ArtifactBrowser/sitemap.xmap
index 01c88f9..bf41a27 100644
--- a/dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/ArtifactBrowser/sitemap.xmap
+++ b/dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/ArtifactBrowser/sitemap.xmap
@@ -91,7 +91,7 @@ and searching the repository.
</map:components>
<map:pipelines>
- <map:pipeline>
+ <map:pipeline type="noncaching">
<map:generate/>
diff --git a/dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/BrowseArtifacts/sitemap.xmap b/dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/BrowseArtifacts/sitemap.xmap
index bde77cb..e8dd622 100644
--- a/dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/BrowseArtifacts/sitemap.xmap
+++ b/dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/BrowseArtifacts/sitemap.xmap
@@ -64,7 +64,8 @@ collections / items / and bitstreams.
</map:components>
<map:pipelines>
- <map:pipeline>
+ <map:pipeline type="noncaching">
+ <map:parameter name="expires" value="access plus 1 minutes"/>
<map:generate/>
<!--
diff --git a/dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/SearchArtifacts/sitemap.xmap b/dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/SearchArtifacts/sitemap.xmap
index a5a3734..ddf503f 100644
--- a/dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/SearchArtifacts/sitemap.xmap
+++ b/dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/SearchArtifacts/sitemap.xmap
@@ -84,7 +84,7 @@ and searching the repository.
</map:components>
<map:pipelines>
- <map:pipeline>
+ <map:pipeline type="noncaching">
<map:generate/>
diff --git a/dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/ViewArtifacts/sitemap.xmap b/dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/ViewArtifacts/sitemap.xmap
index 959a9dd..49f575b 100644
--- a/dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/ViewArtifacts/sitemap.xmap
+++ b/dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/ViewArtifacts/sitemap.xmap
@@ -84,7 +84,7 @@ and searching the repository.
</map:components>
<map:pipelines>
- <map:pipeline>
+ <map:pipeline type="noncaching">
<map:generate/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment