forked from UbuntuEvangelist/sakai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request UbuntuEvangelist#461 from buckett/LSNBLDR-485
LSNBLDR-485 Have content served through lessons wrapped.
- Loading branch information
Showing
6 changed files
with
88 additions
and
30 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
kernel/api/src/main/java/org/sakaiproject/content/api/ContentFilterService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.sakaiproject.content.api; | ||
|
||
/** | ||
* This is a service that holds all the ContentFilters and allows streams to be filtered. | ||
* It's exposed as a service so that tools serving up thier own content can do it in the | ||
* same way as the kernel. | ||
* @see ContentFilter | ||
*/ | ||
public interface ContentFilterService { | ||
|
||
/** | ||
* This applies all the filters defined to the supplied content resource. | ||
* @param resource The content resource to wrap cannot be <code>null</code>. | ||
* @return A new content resource wrapped up or if the original resource if no filters apply. | ||
*/ | ||
ContentResource wrap(ContentResource resource); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/ContentFilterServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.sakaiproject.content.impl; | ||
|
||
import org.sakaiproject.content.api.ContentFilter; | ||
import org.sakaiproject.content.api.ContentFilterService; | ||
import org.sakaiproject.content.api.ContentResource; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** | ||
* A simple implementation of the output filtering. | ||
*/ | ||
public class ContentFilterServiceImpl implements ContentFilterService { | ||
|
||
protected List<ContentFilter> m_outputFilters = Collections.emptyList(); | ||
|
||
public void setOutputFilters(List<ContentFilter> outputFilters) | ||
{ | ||
this.m_outputFilters = outputFilters; | ||
} | ||
|
||
@Override | ||
public ContentResource wrap(ContentResource resource) { | ||
// Wrap up the resource if we need to. | ||
for (ContentFilter filter: m_outputFilters) | ||
{ | ||
resource = filter.wrap(resource); | ||
} | ||
return resource; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters