Skip to content

Commit

Permalink
Dev version, fix iiif itemresource, processingindex rebuild command line
Browse files Browse the repository at this point in the history
utility
  • Loading branch information
pavel-stastny committed Apr 1, 2024
1 parent 8169b79 commit 8fe81dd
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
group=cz.incad.kramerius
version=7.0.33
version=7.0.34-dev
Original file line number Diff line number Diff line change
Expand Up @@ -1152,14 +1152,41 @@ public Response tile(@PathParam("pid") String pid,
if (size.toLowerCase().trim().contains("max") || size.toLowerCase().trim().contains("pct:")) {
checkUserIsAllowedToReadObject(pid);
}
// max allowed size = 512

String[] split = size.split(",");
/**
* Support all options for size
*
* <ul>
* <li><code>w,</code>
* <li><code>^w,</code>
* <li><code>,h<code>
* <li><code>^,h</code>
* <li><code>^w,h</code>
* <li><code>!w,h</code>
* <li><code>^!w,h</code>
* </code>
*/
if (split.length >= 2) {
int width = Integer.parseInt(split[0]);
int height = Integer.parseInt(split[1]);
if (width > MAX_TIME_SIZE || height > MAX_TIME_SIZE) {
checkUserIsAllowedToReadObject(pid);
}
String firstVal = split[0];
String secondVal = split[1];

if (firstVal.startsWith("^")) {
firstVal = firstVal.substring(1);
}

if (firstVal.startsWith("!")) {
firstVal = firstVal.substring(1);
}
try {
int width = Integer.parseInt(firstVal);
int height = Integer.parseInt(secondVal);
if (width > MAX_TIME_SIZE || height > MAX_TIME_SIZE) {
checkUserIsAllowedToReadObject(pid);
}
} catch(Exception e) {
LOGGER.log(Level.SEVERE,e.getMessage(),e);
}
}
}
InputStream stream = krameriusRepositoryApi.getLowLevelApi().getLatestVersionOfDatastream(pid, "RELS-EXT");
Expand Down
17 changes: 15 additions & 2 deletions shared/common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
description "Common Kramerius library"


sourceSets {
main {
resources {
Expand Down Expand Up @@ -119,7 +118,21 @@ dependencies {

//https://github.com/google/gson
api 'com.google.code.gson:gson:2.8.6'

}

/** processing index rebuild */
if (project.hasProperty('REBUILDPROCESSING')) {

apply plugin: 'application'

tasks.withType(CreateStartScripts).each { task ->
task.doLast {
String text = task.windowsScript.text
text = text.replaceFirst(/(set CLASSPATH=%APP_HOME%\\lib\\).*/, { "${it[1]}*" })
task.windowsScript.write text
}
}

mainClassName = "cz.incad.kramerius.resourceindex.ProcessingIndexRebuild"
}

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import cz.incad.kramerius.fedora.om.RepositoryException;
import cz.incad.kramerius.fedora.om.impl.AkubraObject;
import cz.incad.kramerius.fedora.om.impl.AkubraUtils;
import cz.incad.kramerius.fedora.om.impl.HazelcastServerNode;
import cz.incad.kramerius.fedora.om.impl.RELSEXTSPARQLBuilder;
import cz.incad.kramerius.fedora.om.impl.RELSEXTSPARQLBuilderImpl;
import cz.incad.kramerius.processes.starter.ProcessStarter;
Expand Down Expand Up @@ -60,6 +61,9 @@ public class ProcessingIndexRebuild {
public static void main(String[] args) throws IOException, SolrServerException, RepositoryException {
if (args.length>=1 && "REBUILDPROCESSING".equalsIgnoreCase(args[0])){
LOGGER.info("Přebudování Processing indexu");
if (args.length >= 2 && "RUNHAZELCAST".equalsIgnoreCase(args[1])) {
HazelcastServerNode.ensureHazelcastNode();
}
} else {
ProcessStarter.updateName("Přebudování Processing indexu");
}
Expand Down

0 comments on commit 8fe81dd

Please sign in to comment.