-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into zip-files-development
- Loading branch information
Showing
103 changed files
with
18,738 additions
and
11,434 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -86,11 +86,11 @@ jobs: | |
restore-keys: v1-npm-deps- | ||
|
||
- run: npm --prefix static/js/vue-cdr-access install | ||
- run: npm --prefix static/js/admin/vue-permissions-editor install | ||
- run: npm --prefix static/js/admin/vue-cdr-admin install | ||
|
||
- run: npm install -g [email protected] | ||
- run: npm --prefix static/js/vue-cdr-access run test | ||
- run: npm --prefix static/js/admin/vue-permissions-editor run test | ||
- run: npm --prefix static/js/admin/vue-cdr-admin run test | ||
|
||
- name: Report to CodeClimate | ||
uses: paambaati/[email protected] | ||
|
@@ -103,7 +103,7 @@ jobs: | |
${{github.workspace}}/**/target/site/jacoco/jacoco.xml:jacoco | ||
${{github.workspace}}/**/target/site/jacoco-it/jacoco.xml:jacoco | ||
${{github.workspace}}/static/js/vue-cdr-access/coverage/lcov.info:lcov | ||
${{github.workspace}}/static/js/admin/vue-permissions-editor/coverage/lcov.info:lcov | ||
${{github.workspace}}/static/js/admin/vue-cdr-admin/coverage/lcov.info:lcov | ||
- name: View fedora service logs | ||
if: always() | ||
|
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
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
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
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
34 changes: 34 additions & 0 deletions
34
search-solr/src/main/java/edu/unc/lib/boxc/search/solr/filters/HasValuesFilter.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,34 @@ | ||
package edu.unc.lib.boxc.search.solr.filters; | ||
|
||
import edu.unc.lib.boxc.search.api.SearchFieldKey; | ||
import edu.unc.lib.boxc.search.api.filters.QueryFilter; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* Filter which restricts results to entries which contain populated values for the given key with | ||
* the specified field search value | ||
* | ||
* @author lfarrell | ||
*/ | ||
public class HasValuesFilter implements QueryFilter { | ||
private final SearchFieldKey fieldKey; | ||
private final List<String> fieldValues; | ||
|
||
protected HasValuesFilter(SearchFieldKey fieldKey, List<String> fieldValues) { | ||
this.fieldKey = fieldKey; | ||
this.fieldValues = fieldValues; | ||
} | ||
|
||
@Override | ||
public String toFilterString() { | ||
return fieldValues.stream().map(v -> getFieldKey().getSolrField() + ":" + v) | ||
.collect(Collectors.joining(" OR ")); | ||
} | ||
|
||
@Override | ||
public SearchFieldKey getFieldKey() { | ||
return fieldKey; | ||
} | ||
} |
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
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
51 changes: 51 additions & 0 deletions
51
...mel-app/src/main/java/edu/unc/lib/boxc/services/camel/audio/AudioDerivativeProcessor.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,51 @@ | ||
package edu.unc.lib.boxc.services.camel.audio; | ||
|
||
import edu.unc.lib.boxc.services.camel.util.CdrFcrepoHeaders; | ||
import org.apache.camel.Exchange; | ||
import org.apache.camel.Message; | ||
import org.apache.camel.Processor; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.util.regex.Pattern; | ||
|
||
/** | ||
* Processor which validates and prepares audio objects for producing derivatives | ||
* @author krwong | ||
*/ | ||
public class AudioDerivativeProcessor implements Processor { | ||
private static final Logger log = LoggerFactory.getLogger(AudioDerivativeProcessor.class); | ||
|
||
private static final Pattern MIMETYPE_PATTERN = | ||
Pattern.compile("^(audio.(basic|mpeg|mp4|x-aiff|x-ms-wma|x-wave|x-wav|wav|wave|3gpp))$"); | ||
|
||
/** | ||
* Returns true if the subject of the exchange is a binary which | ||
* is eligible for having audio derivatives generated from it. | ||
* @param exchange | ||
* @return | ||
*/ | ||
public static boolean allowedAudioType(Exchange exchange) { | ||
Message in = exchange.getIn(); | ||
String mimetype = (String) in.getHeader(CdrFcrepoHeaders.CdrBinaryMimeType); | ||
String binPath = (String) in.getHeader(CdrFcrepoHeaders.CdrBinaryPath); | ||
|
||
if (!MIMETYPE_PATTERN.matcher(mimetype).matches()) { | ||
log.debug("File type {} on object {} is not applicable for audio derivatives", mimetype, binPath); | ||
return false; | ||
} | ||
|
||
log.debug("Object {} with type {} is permitted for audio derivatives", binPath, mimetype); | ||
return true; | ||
} | ||
|
||
@Override | ||
public void process(Exchange exchange) throws Exception { | ||
Message in = exchange.getIn(); | ||
String mimetype = (String) in.getHeader(CdrFcrepoHeaders.CdrBinaryMimeType); | ||
|
||
String binPath = (String) in.getHeader(CdrFcrepoHeaders.CdrBinaryPath); | ||
log.debug("Keeping existing audio path as {} for type {}", binPath, mimetype); | ||
in.setHeader(CdrFcrepoHeaders.CdrAudioPath, binPath); | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
...amel-app/src/main/java/edu/unc/lib/boxc/services/camel/audio/AudioEnhancementsRouter.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,62 @@ | ||
package edu.unc.lib.boxc.services.camel.audio; | ||
|
||
import edu.unc.lib.boxc.model.api.exceptions.RepositoryException; | ||
import edu.unc.lib.boxc.services.camel.images.AddDerivativeProcessor; | ||
import edu.unc.lib.boxc.services.camel.util.CdrFcrepoHeaders; | ||
import org.apache.camel.BeanInject; | ||
import org.apache.camel.LoggingLevel; | ||
import org.apache.camel.builder.RouteBuilder; | ||
import org.apache.camel.spi.UuidGenerator; | ||
import org.apache.camel.support.DefaultUuidGenerator; | ||
import org.slf4j.Logger; | ||
|
||
import static org.slf4j.LoggerFactory.getLogger; | ||
|
||
/** | ||
* Router which triggers the creation of audio derivatives | ||
* @author krwong | ||
*/ | ||
public class AudioEnhancementsRouter extends RouteBuilder { | ||
private static final Logger log = getLogger(AudioEnhancementsRouter.class); | ||
|
||
@BeanInject(value = "addAudioAccessCopyProcessor") | ||
private AddDerivativeProcessor addAudioAccessCopyProcessor; | ||
|
||
private UuidGenerator uuidGenerator; | ||
|
||
/** | ||
* Configure the audio enhancement route workflow. | ||
*/ | ||
@Override | ||
public void configure() throws Exception { | ||
AudioDerivativeProcessor audioDerivProcessor = new AudioDerivativeProcessor(); | ||
|
||
uuidGenerator = new DefaultUuidGenerator(); | ||
|
||
onException(RepositoryException.class) | ||
.redeliveryDelay("{{error.retryDelay}}") | ||
.maximumRedeliveries("{{error.maxRedeliveries}}") | ||
.backOffMultiplier("{{error.backOffMultiplier}}") | ||
.retryAttemptedLogLevel(LoggingLevel.WARN); | ||
|
||
from("direct:process.enhancement.audioAccessCopy") | ||
.routeId("AudioAccessCopy") | ||
.startupOrder(25) | ||
.log(LoggingLevel.DEBUG, log, "Access copy triggered") | ||
.filter().method(addAudioAccessCopyProcessor, "needsRun") | ||
.filter().method(audioDerivProcessor, "allowedAudioType") | ||
.bean(audioDerivProcessor) | ||
.log(LoggingLevel.INFO, log, "Creating/Updating AAC access copy for ${headers[CdrAudioPath]}") | ||
// Generate an random identifier to avoid derivative collisions | ||
.setBody(exchange -> uuidGenerator.generateUuid()) | ||
.setHeader(CdrFcrepoHeaders.CdrTempPath, simple("${properties:services.tempDirectory}/${body}-audio")) | ||
.doTry() | ||
.recipientList(simple("exec:/bin/sh?args=${properties:cdr.enhancement.bin}/convertAudio.sh " | ||
+ "${headers[CdrAudioPath]} ${headers[CdrTempPath]}")) | ||
.bean(addAudioAccessCopyProcessor) | ||
.endDoTry() | ||
.doFinally() | ||
.bean(addAudioAccessCopyProcessor, "cleanupTempFile") | ||
.end(); | ||
} | ||
} |
Oops, something went wrong.