master moved from b14a46bbc232 to 7f41f406f451 6 new revisions: Revision: 8c591a93d763 Author: Andrew Lindesay <apl@xxxxxxxxxxxxxx> Date: Mon Jan 5 10:46:06 2015 UTC Log: export package icons as zip archive https://code.google.com/p/haiku-depot-web-app/source/detail?r=8c591a93d763 Revision: 612c71be3eef Author: Andrew Lindesay <apl@xxxxxxxxxxxxxx> Date: Tue Jan 6 09:27:51 2015 UTCLog: rename the pkg icon archive export classes etc... to fit existing patt...
https://code.google.com/p/haiku-depot-web-app/source/detail?r=612c71be3eef Revision: a9e24866d00b Author: Andrew Lindesay <apl@xxxxxxxxxxxxxx> Date: Tue Jan 6 10:42:08 2015 UTC Log: background optimization of the package screenshots https://code.google.com/p/haiku-depot-web-app/source/detail?r=a9e24866d00b Revision: e612bc94cb8e Author: Andrew Lindesay <apl@xxxxxxxxxxxxxx> Date: Tue Jan 6 10:55:10 2015 UTC Log: all injection member variables to be private https://code.google.com/p/haiku-depot-web-app/source/detail?r=e612bc94cb8e Revision: 02517f6d46d4 Author: Andrew Lindesay <apl@xxxxxxxxxxxxxx> Date: Tue Jan 6 10:56:17 2015 UTC Log: version 1.0.16 https://code.google.com/p/haiku-depot-web-app/source/detail?r=02517f6d46d4 Revision: 7f41f406f451 Author: Andrew Lindesay <apl@xxxxxxxxxxxxxx> Date: Tue Jan 6 10:56:17 2015 UTC Log: version 1.0.17-SNAPSHOT https://code.google.com/p/haiku-depot-web-app/source/detail?r=7f41f406f451 ============================================================================== Revision: 8c591a93d763 Author: Andrew Lindesay <apl@xxxxxxxxxxxxxx> Date: Mon Jan 5 10:46:06 2015 UTC Log: export package icons as zip archive https://code.google.com/p/haiku-depot-web-app/source/detail?r=8c591a93d763 Added:/haikudepotserver-api1/src/main/java/org/haikuos/haikudepotserver/api1/model/pkg/QueuePkgIconArchiveExportJobRequest.java /haikudepotserver-api1/src/main/java/org/haikuos/haikudepotserver/api1/model/pkg/QueuePkgIconArchiveExportJobResult.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/PkgIconArchiveExportJobRunner.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/model/PkgIconArchiveExportJobSpecification.java
Modified:/haikudepotserver-api1/src/main/java/org/haikuos/haikudepotserver/api1/PkgApi.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/PkgApiImpl.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/dataobjects/PkgIcon.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/job/LocalJobOrchestrationServiceImpl.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/security/AuthorizationService.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/security/model/Permission.java
/haikudepotserver-webapp/src/main/resources/messages.properties /haikudepotserver-webapp/src/main/resources/messages_de.properties /haikudepotserver-webapp/src/main/webapp/js/app/controller/reports.html/haikudepotserver-webapp/src/main/webapp/js/app/controller/reportscontroller.js
======================================= --- /dev/null+++ /haikudepotserver-api1/src/main/java/org/haikuos/haikudepotserver/api1/model/pkg/QueuePkgIconArchiveExportJobRequest.java Mon Jan 5 10:46:06 2015 UTC
@@ -0,0 +1,9 @@ +/* + * Copyright 2015, Andrew Lindesay + * Distributed under the terms of the MIT License. + */ + +package org.haikuos.haikudepotserver.api1.model.pkg; + +public class QueuePkgIconArchiveExportJobRequest { +} ======================================= --- /dev/null+++ /haikudepotserver-api1/src/main/java/org/haikuos/haikudepotserver/api1/model/pkg/QueuePkgIconArchiveExportJobResult.java Mon Jan 5 10:46:06 2015 UTC
@@ -0,0 +1,19 @@ +/* + * Copyright 2015, Andrew Lindesay + * Distributed under the terms of the MIT License. + */ + +package org.haikuos.haikudepotserver.api1.model.pkg; + +public class QueuePkgIconArchiveExportJobResult { + + public String guid; + + public QueuePkgIconArchiveExportJobResult() { + } + + public QueuePkgIconArchiveExportJobResult(String guid) { + this.guid = guid; + } + +} ======================================= --- /dev/null+++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/PkgIconArchiveExportJobRunner.java Mon Jan 5 10:46:06 2015 UTC
@@ -0,0 +1,124 @@ +/* + * Copyright 2015, Andrew Lindesay + * Distributed under the terms of the MIT License. + */ + +package org.haikuos.haikudepotserver.pkg; + +import com.google.common.base.Preconditions; +import com.google.common.net.MediaType; +import org.apache.cayenne.ObjectContext; +import org.apache.cayenne.configuration.server.ServerRuntime; +import org.apache.cayenne.query.PrefetchTreeNode; +import org.haikuos.haikudepotserver.dataobjects.Architecture; +import org.haikuos.haikudepotserver.dataobjects.Pkg; +import org.haikuos.haikudepotserver.dataobjects.PkgIcon; +import org.haikuos.haikudepotserver.job.AbstractJobRunner; +import org.haikuos.haikudepotserver.job.JobOrchestrationService; +import org.haikuos.haikudepotserver.job.model.JobDataWithByteSink;+import org.haikuos.haikudepotserver.pkg.model.PkgIconArchiveExportJobSpecification;
+import org.haikuos.haikudepotserver.support.Callback; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Collections; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +/** + * <p>Produce a ZIP file containing all of the icons of the packages.</p> + */ + +@Component+public class PkgIconArchiveExportJobRunner extends AbstractJobRunner<PkgIconArchiveExportJobSpecification> {
++ private static Logger LOGGER = LoggerFactory.getLogger(PkgIconArchiveExportJobRunner.class);
+ + @Resource + private ServerRuntime serverRuntime; + + @Resource + private PkgOrchestrationService pkgOrchestrationService; + + @Override + public void run( + JobOrchestrationService jobOrchestrationService,+ PkgIconArchiveExportJobSpecification specification) throws IOException {
+ + Preconditions.checkArgument(null != jobOrchestrationService); + assert null!=jobOrchestrationService; + Preconditions.checkArgument(null!=specification); + + long count = 0; + long startMs = System.currentTimeMillis(); + + final ObjectContext context = serverRuntime.getContext(); + + // this will register the outbound data against the job.+ JobDataWithByteSink jobDataWithByteSink = jobOrchestrationService.storeGeneratedData(
+ specification.getGuid(), + "download", + MediaType.ZIP.toString()); + + try(+ OutputStream outputStream = jobDataWithByteSink.getByteSink().openBufferedStream(); + final ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream);
+ ) { + + PrefetchTreeNode prefetchTreeNode = new PrefetchTreeNode(); + prefetchTreeNode.addPath(Pkg.PKG_ICONS_PROPERTY); + + count += pkgOrchestrationService.each( + context, + prefetchTreeNode,+ Architecture.getAllExceptByCode(context, Collections.singleton(Architecture.CODE_SOURCE)),
+ new Callback<Pkg>() { + + @Override + public boolean process(Pkg pkg) { + + List<PkgIcon> pkgIcons = pkg.getPkgIcons(); + + if(!pkgIcons.isEmpty()) { + + try { + for (PkgIcon pkgIcon : pkgIcons) { ++ StringBuilder filename = new StringBuilder();
+ filename.append("hds_"); + filename.append(getJobTypeCode()); + filename.append('/'); + filename.append(pkg.getName()); + filename.append('/');+ filename.append(pkgIcon.deriveFilename());
++ zipOutputStream.putNextEntry(new ZipEntry(filename.toString())); + zipOutputStream.write(pkgIcon.getPkgIconImage().get().getData());
+ zipOutputStream.closeEntry(); + } + } + catch(IOException ioe) {+ throw new RuntimeException("unable to write the package " + pkg.getName() + "'s icons to a zip archive");
+ } + } + + return true; + } + + }); + + } + + LOGGER.info( + "did produce icon report for {} packages in {}ms", + count, + System.currentTimeMillis() - startMs); + + } + +} ======================================= --- /dev/null+++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/model/PkgIconArchiveExportJobSpecification.java Mon Jan 5 10:46:06 2015 UTC
@@ -0,0 +1,23 @@ +/* + * Copyright 2015, Andrew Lindesay + * Distributed under the terms of the MIT License. + */ + +package org.haikuos.haikudepotserver.pkg.model; + +import org.haikuos.haikudepotserver.job.model.AbstractJobSpecification; +import org.haikuos.haikudepotserver.job.model.JobSpecification; +import org.springframework.util.ObjectUtils; ++public class PkgIconArchiveExportJobSpecification extends AbstractJobSpecification {
+ + @Override + public boolean isEquivalent(JobSpecification other) {+ if(PkgIconArchiveExportJobSpecification.class.isAssignableFrom(other.getClass())) { + return ObjectUtils.nullSafeEquals(other.getOwnerUserNickname(), getOwnerUserNickname());
+ } + + return false; + } + +} =======================================--- /haikudepotserver-api1/src/main/java/org/haikuos/haikudepotserver/api1/PkgApi.java Fri Jan 2 10:56:12 2015 UTC +++ /haikudepotserver-api1/src/main/java/org/haikuos/haikudepotserver/api1/PkgApi.java Mon Jan 5 10:46:06 2015 UTC
@@ -171,4 +171,10 @@QueuePkgProminenceAndUserRatingSpreadsheetJobResult queuePkgProminenceAndUserRatingSpreadsheetJob(QueuePkgProminenceAndUserRatingSpreadsheetJobRequest request);
+ /**+ * <p>Enqueues a request to produce an archive of all of the icons of the packages.</p>
+ */ ++ QueuePkgIconArchiveExportJobResult queuePkgIconArchiveExportJob(QueuePkgIconArchiveExportJobRequest request);
+ } =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/PkgApiImpl.java Mon Jan 5 09:06:05 2015 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/PkgApiImpl.java Mon Jan 5 10:46:06 2015 UTC
@@ -1252,5 +1252,28 @@jobOrchestrationService.submit(spec,JobOrchestrationService.CoalesceMode.QUEUEDANDSTARTED).orNull());
} + @Override+ public QueuePkgIconArchiveExportJobResult queuePkgIconArchiveExportJob(QueuePkgIconArchiveExportJobRequest request) {
+ Preconditions.checkArgument(null!=request); + + final ObjectContext context = serverRuntime.getContext(); + + Optional<User> user = tryObtainAuthenticatedUser(context); + + if(!authorizationService.check( + context, + user.orNull(), + null, + Permission.BULK_PKGICONARCHIVEEXPORT)) {+ LOGGER.warn("attempt to access a pkg icon archive export without authorization");
+ throw new AuthorizationFailureException(); + } ++ PkgIconArchiveExportJobSpecification spec = new PkgIconArchiveExportJobSpecification();
+ spec.setOwnerUserNickname(user.get().getNickname()); + + return new QueuePkgIconArchiveExportJobResult(+ jobOrchestrationService.submit(spec,JobOrchestrationService.CoalesceMode.QUEUEDANDSTARTED).orNull());
+ } } =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/dataobjects/PkgIcon.java Mon Feb 24 08:20:27 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/dataobjects/PkgIcon.java Mon Jan 5 10:46:06 2015 UTC
@@ -1,13 +1,11 @@ /* - * Copyright 2013-2014, Andrew Lindesay + * Copyright 2013-2015, Andrew Lindesay * Distributed under the terms of the MIT License. */ package org.haikuos.haikudepotserver.dataobjects; import com.google.common.base.Optional; -import com.google.common.net.*; -import com.google.common.net.MediaType; import org.apache.cayenne.validation.BeanValidationFailure; import org.apache.cayenne.validation.ValidationResult; import org.haikuos.haikudepotserver.dataobjects.auto._PkgIcon; @@ -41,7 +39,7 @@// vector artwork should not be stored with a size because it makes no sense.
- if(com.google.common.net.MediaType.PNG.equals(getMediaType().getCode())) { + if(com.google.common.net.MediaType.PNG.toString().equals(getMediaType().getCode())) {
if(null==getSize()) {validationResult.addFailure(new BeanValidationFailure(this,SIZE_PROPERTY,VALIDATION_REQUIREDFORBITMAP));
} @@ -54,5 +52,22 @@ } } + + /**+ * <p>This method will return a string which represents a leafname for the icon.</p>
+ */ + + public String deriveFilename() { ++ if(com.google.common.net.MediaType.PNG.toString().equals(getMediaType().getCode())) {
+ return Integer.toString(getSize()) + ".png"; + } ++ if(org.haikuos.haikudepotserver.dataobjects.MediaType.MEDIATYPE_HAIKUVECTORICONFILE.equals(getMediaType().getCode())) {
+ return "icon.hvif"; + } ++ throw new IllegalStateException("unsupported media type; " + getMediaType().getCode());
+ } } =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/job/LocalJobOrchestrationServiceImpl.java Fri Jan 2 10:56:12 2015 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/job/LocalJobOrchestrationServiceImpl.java Mon Jan 5 10:46:06 2015 UTC
@@ -1,5 +1,5 @@ /* - * Copyright 2014, Andrew Lindesay + * Copyright 2014-2015, Andrew Lindesay * Distributed under the terms of the MIT License. */ @@ -719,6 +719,10 @@if (jobData.getMediaTypeCode().startsWith(MediaType.CSV_UTF_8.withoutParameters().toString())) {
extension = "csv"; } ++ if(jobData.getMediaTypeCode().equals(MediaType.ZIP.withoutParameters().toString())) {
+ extension = "zip"; + } } } =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/security/AuthorizationService.java Wed Dec 31 10:32:57 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/security/AuthorizationService.java Mon Jan 5 10:46:06 2015 UTC
@@ -1,5 +1,5 @@ /* - * Copyright 2014, Andrew Lindesay + * Copyright 2014-2015, Andrew Lindesay * Distributed under the terms of the MIT License. */ @@ -219,6 +219,7 @@ case BULK_PKGPROMINENCEANDUSERRATINGSPREADSHEETREPORT: case BULK_PKGICONSPREADSHEETREPORT: case BULK_PKGCATEGORYCOVERAGEEXPORTSPREADSHEET: + case BULK_PKGICONARCHIVEEXPORT: return null!=authenticatedUser; case BULK_PKGCATEGORYCOVERAGEIMPORTSPREADSHEET: =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/security/model/Permission.java Wed Dec 31 10:32:57 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/security/model/Permission.java Mon Jan 5 10:46:06 2015 UTC
@@ -1,5 +1,5 @@ /* - * Copyright 2014, Andrew Lindesay + * Copyright 2014-2015, Andrew Lindesay * Distributed under the terms of the MIT License. */ @@ -37,6 +37,7 @@ BULK_PKGCATEGORYCOVERAGEIMPORTSPREADSHEET(null), BULK_PKGPROMINENCEANDUSERRATINGSPREADSHEETREPORT(null), BULK_PKGICONSPREADSHEETREPORT(null), + BULK_PKGICONARCHIVEEXPORT(null), BULK_USERRATINGSPREADSHEETREPORT_PKG(TargetType.PKG), BULK_USERRATINGSPREADSHEETREPORT_ALL(null), BULK_USERRATINGSPREADSHEETREPORT_USER(TargetType.USER), =======================================--- /haikudepotserver-webapp/src/main/resources/messages.properties Sat Jan 3 09:24:53 2015 UTC +++ /haikudepotserver-webapp/src/main/resources/messages.properties Mon Jan 5 10:46:06 2015 UTC
@@ -421,6 +421,7 @@reporting.pkgprominenceanduserratingspreadsheetreport.title=Package prominence and user rating report
reporting.pkgiconspreadsheetreport.title=Package icon report reporting.userratingspreadsheetreportall.title=Report of all user ratings +reporting.pkgiconarchiveexport.title=Package icon archive # Multipage (non-AngularJS) Interface multipage.banner.title.suffix=Simple =======================================--- /haikudepotserver-webapp/src/main/resources/messages_de.properties Sat Jan 3 09:24:53 2015 UTC +++ /haikudepotserver-webapp/src/main/resources/messages_de.properties Mon Jan 5 10:46:06 2015 UTC
@@ -412,6 +412,8 @@reporting.pkgprominenceanduserratingspreadsheetreport.title=Empfehlungsstufen und Bewertungen der Pakete
reporting.pkgiconspreadsheetreport.title=Icons der Pakete reporting.userratingspreadsheetreportall.title=Alle Bewertungen +reporting.pkgiconarchiveexport.title=Icons der Pakete als Archiv +reporting.didreject.description=Der Bericht konnte nicht in die Warteschlange aufgenommen werden; vielleicht läuft bereits ein ähnlicher Bericht.
job.jobtype.passwordresetmaintenance.title=Kennwort zurücksetzen =======================================--- /haikudepotserver-webapp/src/main/webapp/js/app/controller/reports.html Wed Dec 31 10:32:57 2014 UTC +++ /haikudepotserver-webapp/src/main/webapp/js/app/controller/reports.html Mon Jan 5 10:46:06 2015 UTC
@@ -26,6 +26,11 @@ <a href="" ng-click="goUserRatingSpreadsheetReportAll()"><message key="reporting.userratingspreadsheetreportall.title"></message>
</a> + </li> + <li show-if-permission="'BULK_PKGICONARCHIVEEXPORT'"> + <a href="" ng-click="goPkgIconArchiveExport()">+ <message key="reporting.pkgiconarchiveexport.title"></message>
+ </a> </li> </ul> =======================================--- /haikudepotserver-webapp/src/main/webapp/js/app/controller/reportscontroller.js Wed Dec 31 10:32:57 2014 UTC +++ /haikudepotserver-webapp/src/main/webapp/js/app/controller/reportscontroller.js Mon Jan 5 10:46:06 2015 UTC
@@ -1,5 +1,5 @@ /* - * Copyright 2014, Andrew Lindesay + * Copyright 2014-2015, Andrew Lindesay * Distributed under the terms of the MIT License. */ @@ -85,6 +85,10 @@ goBasicPkgReport('queuePkgIconSpreadsheetJob'); }; + $scope.goPkgIconArchiveExport = function() { + goBasicPkgReport('queuePkgIconArchiveExportJob'); + }; + $scope.goUserRatingSpreadsheetReportAll = function() { jsonRpc.call( constants.ENDPOINT_API_V1_USERRATING, ============================================================================== Revision: 612c71be3eef Author: Andrew Lindesay <apl@xxxxxxxxxxxxxx> Date: Tue Jan 6 09:27:51 2015 UTCLog: rename the pkg icon archive export classes etc... to fit existing patterns
create integration test for the pkg icon archive export job runner https://code.google.com/p/haiku-depot-web-app/source/detail?r=612c71be3eef Added:/haikudepotserver-api1/src/main/java/org/haikuos/haikudepotserver/api1/model/pkg/QueuePkgIconExportArchiveJobRequest.java /haikudepotserver-api1/src/main/java/org/haikuos/haikudepotserver/api1/model/pkg/QueuePkgIconExportArchiveJobResult.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/PkgIconExportArchiveJobRunner.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/model/PkgIconExportArchiveJobSpecification.java /haikudepotserver-webapp/src/test/java/org/haikuos/haikudepotserver/WrapWithNoCloseInputStream.java /haikudepotserver-webapp/src/test/java/org/haikuos/haikudepotserver/pkg/PkgIconExportArchiveJobRunnerIT.java
Deleted:/haikudepotserver-api1/src/main/java/org/haikuos/haikudepotserver/api1/model/pkg/QueuePkgIconArchiveExportJobRequest.java /haikudepotserver-api1/src/main/java/org/haikuos/haikudepotserver/api1/model/pkg/QueuePkgIconArchiveExportJobResult.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/PkgIconArchiveExportJobRunner.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/model/PkgIconArchiveExportJobSpecification.java
Modified:/haikudepotserver-api1/src/main/java/org/haikuos/haikudepotserver/api1/PkgApi.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/PkgApiImpl.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/security/AuthorizationService.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/security/model/Permission.java
/haikudepotserver-webapp/src/main/resources/messages.properties /haikudepotserver-webapp/src/main/resources/messages_de.properties /haikudepotserver-webapp/src/main/webapp/js/app/controller/reports.html/haikudepotserver-webapp/src/main/webapp/js/app/controller/reportscontroller.js
======================================= --- /dev/null+++ /haikudepotserver-api1/src/main/java/org/haikuos/haikudepotserver/api1/model/pkg/QueuePkgIconExportArchiveJobRequest.java Tue Jan 6 09:27:51 2015 UTC
@@ -0,0 +1,9 @@ +/* + * Copyright 2015, Andrew Lindesay + * Distributed under the terms of the MIT License. + */ + +package org.haikuos.haikudepotserver.api1.model.pkg; + +public class QueuePkgIconExportArchiveJobRequest { +} ======================================= --- /dev/null+++ /haikudepotserver-api1/src/main/java/org/haikuos/haikudepotserver/api1/model/pkg/QueuePkgIconExportArchiveJobResult.java Tue Jan 6 09:27:51 2015 UTC
@@ -0,0 +1,19 @@ +/* + * Copyright 2015, Andrew Lindesay + * Distributed under the terms of the MIT License. + */ + +package org.haikuos.haikudepotserver.api1.model.pkg; + +public class QueuePkgIconExportArchiveJobResult { + + public String guid; + + public QueuePkgIconExportArchiveJobResult() { + } + + public QueuePkgIconExportArchiveJobResult(String guid) { + this.guid = guid; + } + +} ======================================= --- /dev/null+++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/PkgIconExportArchiveJobRunner.java Tue Jan 6 09:27:51 2015 UTC
@@ -0,0 +1,124 @@ +/* + * Copyright 2015, Andrew Lindesay + * Distributed under the terms of the MIT License. + */ + +package org.haikuos.haikudepotserver.pkg; + +import com.google.common.base.Preconditions; +import com.google.common.net.MediaType; +import org.apache.cayenne.ObjectContext; +import org.apache.cayenne.configuration.server.ServerRuntime; +import org.apache.cayenne.query.PrefetchTreeNode; +import org.haikuos.haikudepotserver.dataobjects.Architecture; +import org.haikuos.haikudepotserver.dataobjects.Pkg; +import org.haikuos.haikudepotserver.dataobjects.PkgIcon; +import org.haikuos.haikudepotserver.job.AbstractJobRunner; +import org.haikuos.haikudepotserver.job.JobOrchestrationService; +import org.haikuos.haikudepotserver.job.model.JobDataWithByteSink;+import org.haikuos.haikudepotserver.pkg.model.PkgIconExportArchiveJobSpecification;
+import org.haikuos.haikudepotserver.support.Callback; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Collections; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +/** + * <p>Produce a ZIP file containing all of the icons of the packages.</p> + */ + +@Component+public class PkgIconExportArchiveJobRunner extends AbstractJobRunner<PkgIconExportArchiveJobSpecification> {
++ private static Logger LOGGER = LoggerFactory.getLogger(PkgIconExportArchiveJobRunner.class);
+ + @Resource + private ServerRuntime serverRuntime; + + @Resource + private PkgOrchestrationService pkgOrchestrationService; + + @Override + public void run( + JobOrchestrationService jobOrchestrationService,+ PkgIconExportArchiveJobSpecification specification) throws IOException {
+ + Preconditions.checkArgument(null != jobOrchestrationService); + assert null!=jobOrchestrationService; + Preconditions.checkArgument(null!=specification); + + long count = 0; + long startMs = System.currentTimeMillis(); + + final ObjectContext context = serverRuntime.getContext(); + + // this will register the outbound data against the job.+ JobDataWithByteSink jobDataWithByteSink = jobOrchestrationService.storeGeneratedData(
+ specification.getGuid(), + "download", + MediaType.ZIP.toString()); + + try(+ OutputStream outputStream = jobDataWithByteSink.getByteSink().openBufferedStream(); + final ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream);
+ ) { + + PrefetchTreeNode prefetchTreeNode = new PrefetchTreeNode(); + prefetchTreeNode.addPath(Pkg.PKG_ICONS_PROPERTY); + + count += pkgOrchestrationService.each( + context, + prefetchTreeNode,+ Architecture.getAllExceptByCode(context, Collections.singleton(Architecture.CODE_SOURCE)),
+ new Callback<Pkg>() { + + @Override + public boolean process(Pkg pkg) { + + List<PkgIcon> pkgIcons = pkg.getPkgIcons(); + + if(!pkgIcons.isEmpty()) { + + try { + for (PkgIcon pkgIcon : pkgIcons) { ++ StringBuilder filename = new StringBuilder();
+ filename.append("hds_"); + filename.append(getJobTypeCode()); + filename.append('/'); + filename.append(pkg.getName()); + filename.append('/');+ filename.append(pkgIcon.deriveFilename());
++ zipOutputStream.putNextEntry(new ZipEntry(filename.toString())); + zipOutputStream.write(pkgIcon.getPkgIconImage().get().getData());
+ zipOutputStream.closeEntry(); + } + } + catch(IOException ioe) {+ throw new RuntimeException("unable to write the package " + pkg.getName() + "'s icons to a zip archive");
+ } + } + + return true; + } + + }); + + } + + LOGGER.info( + "did produce icon report for {} packages in {}ms", + count, + System.currentTimeMillis() - startMs); + + } + +} ======================================= --- /dev/null+++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/model/PkgIconExportArchiveJobSpecification.java Tue Jan 6 09:27:51 2015 UTC
@@ -0,0 +1,23 @@ +/* + * Copyright 2015, Andrew Lindesay + * Distributed under the terms of the MIT License. + */ + +package org.haikuos.haikudepotserver.pkg.model; + +import org.haikuos.haikudepotserver.job.model.AbstractJobSpecification; +import org.haikuos.haikudepotserver.job.model.JobSpecification; +import org.springframework.util.ObjectUtils; ++public class PkgIconExportArchiveJobSpecification extends AbstractJobSpecification {
+ + @Override + public boolean isEquivalent(JobSpecification other) {+ if(PkgIconExportArchiveJobSpecification.class.isAssignableFrom(other.getClass())) { + return ObjectUtils.nullSafeEquals(other.getOwnerUserNickname(), getOwnerUserNickname());
+ } + + return false; + } + +} ======================================= --- /dev/null+++ /haikudepotserver-webapp/src/test/java/org/haikuos/haikudepotserver/WrapWithNoCloseInputStream.java Tue Jan 6 09:27:51 2015 UTC
@@ -0,0 +1,27 @@ +/* + * Copyright 2015, Andrew Lindesay + * Distributed under the terms of the MIT License. + */ + +package org.haikuos.haikudepotserver; + +import java.io.IOException; +import java.io.InputStream; + +/** + * <p>This is used in testing.</p> + */ + +public class WrapWithNoCloseInputStream extends InputStream { + + public InputStream inputStream; + + public WrapWithNoCloseInputStream(InputStream inputStream) { + this.inputStream = inputStream; + } + + @Override + public int read() throws IOException { + return inputStream.read(); + } +} ======================================= --- /dev/null+++ /haikudepotserver-webapp/src/test/java/org/haikuos/haikudepotserver/pkg/PkgIconExportArchiveJobRunnerIT.java Tue Jan 6 09:27:51 2015 UTC
@@ -0,0 +1,125 @@ +/* + * Copyright 2015, Andrew Lindesay + * Distributed under the terms of the MIT License. + */ + +package org.haikuos.haikudepotserver.pkg; + +import com.google.common.base.Optional; +import com.google.common.collect.Sets; +import com.google.common.io.ByteSource; +import junit.framework.Assert; +import org.fest.assertions.Assertions; +import org.haikuos.haikudepotserver.AbstractIntegrationTest; +import org.haikuos.haikudepotserver.IntegrationTestSupportService; +import org.haikuos.haikudepotserver.WrapWithNoCloseInputStream; +import org.haikuos.haikudepotserver.job.JobOrchestrationService; +import org.haikuos.haikudepotserver.job.model.JobDataWithByteSource; +import org.haikuos.haikudepotserver.job.model.JobSnapshot;+import org.haikuos.haikudepotserver.pkg.model.PkgIconExportArchiveJobSpecification;
+import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.test.context.ContextConfiguration; + +import javax.annotation.Resource; +import java.io.IOException; +import java.io.InputStream; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +@ContextConfiguration({ + "classpath:/spring/servlet-context.xml", + "classpath:/spring/test-context.xml" +})+public class PkgIconExportArchiveJobRunnerIT extends AbstractIntegrationTest {
++ private static Logger LOGGER = LoggerFactory.getLogger(PkgIconExportArchiveJobRunnerIT.class);
+ + @Resource + private IntegrationTestSupportService integrationTestSupportService; + + @Resource + private JobOrchestrationService jobOrchestrationService; + + + /**+ * <p>Uses the sample data and checks that the output from the report matches a captured, sensible-looking
+ * previous run.</p> + */ + + @Test + public void testRun() throws IOException { ++ integrationTestSupportService.createStandardTestData(); // pkg1 has some icons
+ + // ------------------------------------ + Optional<String> guidOptional = jobOrchestrationService.submit( + new PkgIconExportArchiveJobSpecification(), + JobOrchestrationService.CoalesceMode.NONE); + // ------------------------------------ ++ jobOrchestrationService.awaitJobConcludedUninterruptibly(guidOptional.get(), 10000); + Optional<? extends JobSnapshot> snapshotOptional = jobOrchestrationService.tryGetJob(guidOptional.get()); + Assert.assertEquals(snapshotOptional.get().getStatus(), JobSnapshot.Status.FINISHED);
+ + // pull in the ZIP file now and extract the icons. ++ String dataGuid = snapshotOptional.get().getGeneratedDataGuids().iterator().next(); + JobDataWithByteSource jobSource = jobOrchestrationService.tryObtainData(dataGuid).get();
+ + try (+ InputStream inputStream = jobSource.getByteSource().openBufferedStream(); + final ZipInputStream zipInputStream = new ZipInputStream(inputStream);
+ ) { + + ZipEntry zipEntry;+ Pattern pngPattern = Pattern.compile("hds_pkgiconexportarchive/pkg1/([0-9]+).png");
+ ByteSource zipNoCloseInputStreamByteSource = new ByteSource() { + @Override + public InputStream openStream() throws IOException { + return new WrapWithNoCloseInputStream(zipInputStream); + } + }; + + Set<String> foundPkg1Filenames = Sets.newHashSet(); + + while(null != (zipEntry = zipInputStream.getNextEntry())) { + + if(zipEntry.getName().contains("/pkg1/")) { + if (zipEntry.getName().endsWith("/pkg1/icon.hvif")) {+ getResourceByteSource("/sample.hvif").contentEquals(zipNoCloseInputStreamByteSource);
+ foundPkg1Filenames.add("icon.hvif"); + } + else { ++ Matcher matcher = pngPattern.matcher(zipEntry.getName());
+ + if (matcher.matches()) {+ String expectedPath = "/sample-" + matcher.group(1) + "x" + matcher.group(1) + ".png"; + getResourceByteSource(expectedPath).contentEquals(zipNoCloseInputStreamByteSource); + foundPkg1Filenames.add(matcher.group(1) + ".png");
+ } + else {+ Assert.fail("the zip entry has an unknown file; " + zipEntry.getName());
+ } + } + } + else { + LOGGER.info("ignoring; {}", zipEntry.getName()); + } + } + + Assertions.assertThat(foundPkg1Filenames).contains( + "16.png", + "32.png", + "icon.hvif"); + + } + + } + +} =======================================--- /haikudepotserver-api1/src/main/java/org/haikuos/haikudepotserver/api1/model/pkg/QueuePkgIconArchiveExportJobRequest.java Mon Jan 5 10:46:06 2015 UTC
+++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright 2015, Andrew Lindesay - * Distributed under the terms of the MIT License. - */ - -package org.haikuos.haikudepotserver.api1.model.pkg; - -public class QueuePkgIconArchiveExportJobRequest { -} =======================================--- /haikudepotserver-api1/src/main/java/org/haikuos/haikudepotserver/api1/model/pkg/QueuePkgIconArchiveExportJobResult.java Mon Jan 5 10:46:06 2015 UTC
+++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2015, Andrew Lindesay - * Distributed under the terms of the MIT License. - */ - -package org.haikuos.haikudepotserver.api1.model.pkg; - -public class QueuePkgIconArchiveExportJobResult { - - public String guid; - - public QueuePkgIconArchiveExportJobResult() { - } - - public QueuePkgIconArchiveExportJobResult(String guid) { - this.guid = guid; - } - -} =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/PkgIconArchiveExportJobRunner.java Mon Jan 5 10:46:06 2015 UTC
+++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2015, Andrew Lindesay - * Distributed under the terms of the MIT License. - */ - -package org.haikuos.haikudepotserver.pkg; - -import com.google.common.base.Preconditions; -import com.google.common.net.MediaType; -import org.apache.cayenne.ObjectContext; -import org.apache.cayenne.configuration.server.ServerRuntime; -import org.apache.cayenne.query.PrefetchTreeNode; -import org.haikuos.haikudepotserver.dataobjects.Architecture; -import org.haikuos.haikudepotserver.dataobjects.Pkg; -import org.haikuos.haikudepotserver.dataobjects.PkgIcon; -import org.haikuos.haikudepotserver.job.AbstractJobRunner; -import org.haikuos.haikudepotserver.job.JobOrchestrationService; -import org.haikuos.haikudepotserver.job.model.JobDataWithByteSink;-import org.haikuos.haikudepotserver.pkg.model.PkgIconArchiveExportJobSpecification;
-import org.haikuos.haikudepotserver.support.Callback; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Collections; -import java.util.List; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -/** - * <p>Produce a ZIP file containing all of the icons of the packages.</p> - */ - -@Component-public class PkgIconArchiveExportJobRunner extends AbstractJobRunner<PkgIconArchiveExportJobSpecification> {
-- private static Logger LOGGER = LoggerFactory.getLogger(PkgIconArchiveExportJobRunner.class);
- - @Resource - private ServerRuntime serverRuntime; - - @Resource - private PkgOrchestrationService pkgOrchestrationService; - - @Override - public void run( - JobOrchestrationService jobOrchestrationService,- PkgIconArchiveExportJobSpecification specification) throws IOException {
- - Preconditions.checkArgument(null != jobOrchestrationService); - assert null!=jobOrchestrationService; - Preconditions.checkArgument(null!=specification); - - long count = 0; - long startMs = System.currentTimeMillis(); - - final ObjectContext context = serverRuntime.getContext(); - - // this will register the outbound data against the job.- JobDataWithByteSink jobDataWithByteSink = jobOrchestrationService.storeGeneratedData(
- specification.getGuid(), - "download", - MediaType.ZIP.toString()); - - try(- OutputStream outputStream = jobDataWithByteSink.getByteSink().openBufferedStream(); - final ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream);
- ) { - - PrefetchTreeNode prefetchTreeNode = new PrefetchTreeNode(); - prefetchTreeNode.addPath(Pkg.PKG_ICONS_PROPERTY); - - count += pkgOrchestrationService.each( - context, - prefetchTreeNode,- Architecture.getAllExceptByCode(context, Collections.singleton(Architecture.CODE_SOURCE)),
- new Callback<Pkg>() { - - @Override - public boolean process(Pkg pkg) { - - List<PkgIcon> pkgIcons = pkg.getPkgIcons(); - - if(!pkgIcons.isEmpty()) { - - try { - for (PkgIcon pkgIcon : pkgIcons) { -- StringBuilder filename = new StringBuilder();
- filename.append("hds_"); - filename.append(getJobTypeCode()); - filename.append('/'); - filename.append(pkg.getName()); - filename.append('/');- filename.append(pkgIcon.deriveFilename());
-- zipOutputStream.putNextEntry(new ZipEntry(filename.toString())); - zipOutputStream.write(pkgIcon.getPkgIconImage().get().getData());
- zipOutputStream.closeEntry(); - } - } - catch(IOException ioe) {- throw new RuntimeException("unable to write the package " + pkg.getName() + "'s icons to a zip archive");
- } - } - - return true; - } - - }); - - } - - LOGGER.info( - "did produce icon report for {} packages in {}ms", - count, - System.currentTimeMillis() - startMs); - - } - -} =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/model/PkgIconArchiveExportJobSpecification.java Mon Jan 5 10:46:06 2015 UTC
+++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2015, Andrew Lindesay - * Distributed under the terms of the MIT License. - */ - -package org.haikuos.haikudepotserver.pkg.model; - -import org.haikuos.haikudepotserver.job.model.AbstractJobSpecification; -import org.haikuos.haikudepotserver.job.model.JobSpecification; -import org.springframework.util.ObjectUtils; --public class PkgIconArchiveExportJobSpecification extends AbstractJobSpecification {
- - @Override - public boolean isEquivalent(JobSpecification other) {- if(PkgIconArchiveExportJobSpecification.class.isAssignableFrom(other.getClass())) { - return ObjectUtils.nullSafeEquals(other.getOwnerUserNickname(), getOwnerUserNickname());
- } - - return false; - } - -} =======================================--- /haikudepotserver-api1/src/main/java/org/haikuos/haikudepotserver/api1/PkgApi.java Mon Jan 5 10:46:06 2015 UTC +++ /haikudepotserver-api1/src/main/java/org/haikuos/haikudepotserver/api1/PkgApi.java Tue Jan 6 09:27:51 2015 UTC
@@ -175,6 +175,6 @@* <p>Enqueues a request to produce an archive of all of the icons of the packages.</p>
*/- QueuePkgIconArchiveExportJobResult queuePkgIconArchiveExportJob(QueuePkgIconArchiveExportJobRequest request); + QueuePkgIconExportArchiveJobResult queuePkgIconExportArchiveJob(QueuePkgIconExportArchiveJobRequest request);
} =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/PkgApiImpl.java Mon Jan 5 10:46:06 2015 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/PkgApiImpl.java Tue Jan 6 09:27:51 2015 UTC
@@ -1253,7 +1253,7 @@ } @Override- public QueuePkgIconArchiveExportJobResult queuePkgIconArchiveExportJob(QueuePkgIconArchiveExportJobRequest request) { + public QueuePkgIconExportArchiveJobResult queuePkgIconExportArchiveJob(QueuePkgIconExportArchiveJobRequest request) {
Preconditions.checkArgument(null!=request); final ObjectContext context = serverRuntime.getContext(); @@ -1264,15 +1264,15 @@ context, user.orNull(), null, - Permission.BULK_PKGICONARCHIVEEXPORT)) { + Permission.BULK_PKGICONEXPORTARCHIVE)) {LOGGER.warn("attempt to access a pkg icon archive export without authorization");
throw new AuthorizationFailureException(); }- PkgIconArchiveExportJobSpecification spec = new PkgIconArchiveExportJobSpecification(); + PkgIconExportArchiveJobSpecification spec = new PkgIconExportArchiveJobSpecification();
spec.setOwnerUserNickname(user.get().getNickname()); - return new QueuePkgIconArchiveExportJobResult( + return new QueuePkgIconExportArchiveJobResult(jobOrchestrationService.submit(spec,JobOrchestrationService.CoalesceMode.QUEUEDANDSTARTED).orNull());
} =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/security/AuthorizationService.java Mon Jan 5 10:46:06 2015 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/security/AuthorizationService.java Tue Jan 6 09:27:51 2015 UTC
@@ -219,7 +219,7 @@ case BULK_PKGPROMINENCEANDUSERRATINGSPREADSHEETREPORT: case BULK_PKGICONSPREADSHEETREPORT: case BULK_PKGCATEGORYCOVERAGEEXPORTSPREADSHEET: - case BULK_PKGICONARCHIVEEXPORT: + case BULK_PKGICONEXPORTARCHIVE: return null!=authenticatedUser; case BULK_PKGCATEGORYCOVERAGEIMPORTSPREADSHEET: =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/security/model/Permission.java Mon Jan 5 10:46:06 2015 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/security/model/Permission.java Tue Jan 6 09:27:51 2015 UTC
@@ -37,7 +37,7 @@ BULK_PKGCATEGORYCOVERAGEIMPORTSPREADSHEET(null), BULK_PKGPROMINENCEANDUSERRATINGSPREADSHEETREPORT(null), BULK_PKGICONSPREADSHEETREPORT(null), - BULK_PKGICONARCHIVEEXPORT(null), + BULK_PKGICONEXPORTARCHIVE(null), BULK_USERRATINGSPREADSHEETREPORT_PKG(TargetType.PKG), BULK_USERRATINGSPREADSHEETREPORT_ALL(null), BULK_USERRATINGSPREADSHEETREPORT_USER(TargetType.USER), =======================================--- /haikudepotserver-webapp/src/main/resources/messages.properties Mon Jan 5 10:46:06 2015 UTC +++ /haikudepotserver-webapp/src/main/resources/messages.properties Tue Jan 6 09:27:51 2015 UTC
@@ -421,7 +421,7 @@reporting.pkgprominenceanduserratingspreadsheetreport.title=Package prominence and user rating report
reporting.pkgiconspreadsheetreport.title=Package icon report reporting.userratingspreadsheetreportall.title=Report of all user ratings -reporting.pkgiconarchiveexport.title=Package icon archive +reporting.pkgiconexportarchive.title=Package icon archive # Multipage (non-AngularJS) Interface multipage.banner.title.suffix=Simple =======================================--- /haikudepotserver-webapp/src/main/resources/messages_de.properties Mon Jan 5 10:46:06 2015 UTC +++ /haikudepotserver-webapp/src/main/resources/messages_de.properties Tue Jan 6 09:27:51 2015 UTC
@@ -412,7 +412,7 @@reporting.pkgprominenceanduserratingspreadsheetreport.title=Empfehlungsstufen und Bewertungen der Pakete
reporting.pkgiconspreadsheetreport.title=Icons der Pakete reporting.userratingspreadsheetreportall.title=Alle Bewertungen -reporting.pkgiconarchiveexport.title=Icons der Pakete als Archiv +reporting.pkgiconexportarchive.title=Icons der Pakete als Archivreporting.didreject.description=Der Bericht konnte nicht in die Warteschlange aufgenommen werden; vielleicht läuft bereits ein ähnlicher Bericht.
=======================================--- /haikudepotserver-webapp/src/main/webapp/js/app/controller/reports.html Mon Jan 5 10:46:06 2015 UTC +++ /haikudepotserver-webapp/src/main/webapp/js/app/controller/reports.html Tue Jan 6 09:27:51 2015 UTC
@@ -27,9 +27,9 @@<message key="reporting.userratingspreadsheetreportall.title"></message>
</a> </li> - <li show-if-permission="'BULK_PKGICONARCHIVEEXPORT'"> - <a href="" ng-click="goPkgIconArchiveExport()">- <message key="reporting.pkgiconarchiveexport.title"></message>
+ <li show-if-permission="'BULK_PKGICONEXPORTARCHIVE'"> + <a href="" ng-click="goPkgIconExportArchive()">+ <message key="reporting.pkgiconexportarchive.title"></message>
</a> </li> </ul> =======================================--- /haikudepotserver-webapp/src/main/webapp/js/app/controller/reportscontroller.js Mon Jan 5 10:46:06 2015 UTC +++ /haikudepotserver-webapp/src/main/webapp/js/app/controller/reportscontroller.js Tue Jan 6 09:27:51 2015 UTC
@@ -85,8 +85,8 @@ goBasicPkgReport('queuePkgIconSpreadsheetJob'); }; - $scope.goPkgIconArchiveExport = function() { - goBasicPkgReport('queuePkgIconArchiveExportJob'); + $scope.goPkgIconExportArchive = function() { + goBasicPkgReport('queuePkgIconExportArchiveJob'); }; $scope.goUserRatingSpreadsheetReportAll = function() { ============================================================================== Revision: a9e24866d00b Author: Andrew Lindesay <apl@xxxxxxxxxxxxxx> Date: Tue Jan 6 10:42:08 2015 UTC Log: background optimization of the package screenshots https://code.google.com/p/haiku-depot-web-app/source/detail?r=a9e24866d00b Added:/haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/PkgScreenshotOptimizationJobRunner.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/model/PkgScreenshotOptimizationJobSpecification.java
Modified:/haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/controller/PkgScreenshotController.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/model/PkgIconSpreadsheetJobSpecification.java
======================================= --- /dev/null+++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/PkgScreenshotOptimizationJobRunner.java Tue Jan 6 10:42:08 2015 UTC
@@ -0,0 +1,106 @@ +/* + * Copyright 2015, Andrew Lindesay + * Distributed under the terms of the MIT License. + */ + +package org.haikuos.haikudepotserver.pkg; + +import com.google.common.base.Optional; +import com.google.common.base.Preconditions; +import com.google.common.net.MediaType; +import org.apache.cayenne.ObjectContext; +import org.apache.cayenne.configuration.server.ServerRuntime; +import org.haikuos.haikudepotserver.dataobjects.PkgScreenshot; +import org.haikuos.haikudepotserver.dataobjects.PkgScreenshotImage; +import org.haikuos.haikudepotserver.job.AbstractJobRunner; +import org.haikuos.haikudepotserver.job.JobOrchestrationService; +import org.haikuos.haikudepotserver.job.model.JobRunnerException;+import org.haikuos.haikudepotserver.pkg.model.PkgScreenshotOptimizationJobSpecification;
+import org.haikuos.haikudepotserver.support.PngOptimizationService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.Date; + +/**+ * <p>This job runner is able to optimize the screenshot images by using the PNG optimizer. It is triggered + * from the {@link org.haikuos.haikudepotserver.pkg.controller.PkgScreenshotController} so that the HTTP + * import of the image can happen quickly, but the optimization can take its time in the background.</p>
+ */ + +@Component+public class PkgScreenshotOptimizationJobRunner extends AbstractJobRunner<PkgScreenshotOptimizationJobSpecification> {
++ private static Logger LOGGER = LoggerFactory.getLogger(PkgScreenshotOptimizationJobRunner.class);
+ + @Resource + private ServerRuntime serverRuntime; + + @Resource + private PngOptimizationService pngOptimizationService; + + @Override + public void run( + JobOrchestrationService jobOrchestrationService, + PkgScreenshotOptimizationJobSpecification specification) + throws IOException, JobRunnerException { + + Preconditions.checkArgument(null!=jobOrchestrationService); + Preconditions.checkArgument(null!=specification); + + long startMs = System.currentTimeMillis(); + + if(pngOptimizationService.isConfigured()) {+ LOGGER.info("will optimize {} screenshot images", specification.getPkgScreenshotCodes().size());
++ for (String pkgScreenshotCode : specification.getPkgScreenshotCodes()) {
+ + ObjectContext context = serverRuntime.getContext();+ Optional<PkgScreenshot> pkgScreenshotOptional = PkgScreenshot.getByCode(context, pkgScreenshotCode);
+ + if (pkgScreenshotOptional.isPresent()) { ++ PkgScreenshot pkgScreenshot = pkgScreenshotOptional.get(); + PkgScreenshotImage pkgScreenshotImage = pkgScreenshotOptional.get().getPkgScreenshotImage().get();
++ if (pkgScreenshotImage.getMediaType().getCode().equals(MediaType.PNG.withoutParameters().toString())) {
++ byte[] originalImageData = pkgScreenshotImage.getData(); + byte[] optimizedData = pngOptimizationService.optimize(originalImageData);
++ if(optimizedData.length < originalImageData.length) {
+ pkgScreenshotImage.setData(optimizedData); + pkgScreenshot.setLength(optimizedData.length); + pkgScreenshot.setModifyTimestamp(new Date()); + context.commitChanges();+ LOGGER.debug("did store optimized image for pkg screenshot; {}", pkgScreenshotCode);
+ } + else {+ LOGGER.warn("optimized data is larger than the original data for pkg screenshot; {}", pkgScreenshotCode);
+ } + + } else { + LOGGER.warn(+ "pkg screenshot '{}' in unknown image format '{}'; will ignore",
+ pkgScreenshotCode,+ pkgScreenshotImage.getMediaType().getCode());
+ } + } else {+ LOGGER.warn("attempt to optimize pkg screenshot that does not exist; {}", pkgScreenshotCode);
+ } + } + + LOGGER.info( + "did optimize {} screenshot images in {}ms", + specification.getPkgScreenshotCodes().size(), + System.currentTimeMillis() - startMs); + } + else {+ LOGGER.info("png optimizer is not configured; will not optimize pkg screenshots");
+ } + + } +} ======================================= --- /dev/null+++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/model/PkgScreenshotOptimizationJobSpecification.java Tue Jan 6 10:42:08 2015 UTC
@@ -0,0 +1,50 @@ +/* + * Copyright 2015, Andrew Lindesay + * Distributed under the terms of the MIT License. + */ + +package org.haikuos.haikudepotserver.pkg.model; + +import org.haikuos.haikudepotserver.job.model.AbstractJobSpecification; +import org.haikuos.haikudepotserver.job.model.JobSpecification; + +import java.util.Collections; +import java.util.Objects; +import java.util.Set; ++public class PkgScreenshotOptimizationJobSpecification extends AbstractJobSpecification {
+ + private Set<String> pkgScreenshotCodes; + + public PkgScreenshotOptimizationJobSpecification() { + } ++ public PkgScreenshotOptimizationJobSpecification(String pkgScreenshotCode) {
+ this.pkgScreenshotCodes = Collections.singleton(pkgScreenshotCode); + } ++ public PkgScreenshotOptimizationJobSpecification(Set<String> pkgScreenshotCodes) {
+ this.pkgScreenshotCodes = pkgScreenshotCodes; + } + + public Set<String> getPkgScreenshotCodes() { + return pkgScreenshotCodes; + } + + public void setPkgScreenshotCodes(Set<String> pkgScreenshotCodes) { + this.pkgScreenshotCodes = pkgScreenshotCodes; + } + + @Override + public boolean isEquivalent(JobSpecification other) {+ if(PkgScreenshotOptimizationJobSpecification.class.isAssignableFrom(other.getClass())) { + PkgScreenshotOptimizationJobSpecification spec = (PkgScreenshotOptimizationJobSpecification) other;
+ return+ Objects.equals(spec.getOwnerUserNickname(), getOwnerUserNickname()) && + Objects.equals(spec.getPkgScreenshotCodes(), getPkgScreenshotCodes());
+ } + + return false; + } + +} =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/controller/PkgScreenshotController.java Sun Aug 3 11:11:48 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/controller/PkgScreenshotController.java Tue Jan 6 10:42:08 2015 UTC
@@ -1,5 +1,5 @@ /* - * Copyright 2014, Andrew Lindesay + * Copyright 2014-2015, Andrew Lindesay * Distributed under the terms of the MIT License. */ @@ -14,8 +14,10 @@ import org.haikuos.haikudepotserver.dataobjects.Pkg; import org.haikuos.haikudepotserver.dataobjects.PkgScreenshot; import org.haikuos.haikudepotserver.dataobjects.User; +import org.haikuos.haikudepotserver.job.JobOrchestrationService; import org.haikuos.haikudepotserver.pkg.PkgOrchestrationService; import org.haikuos.haikudepotserver.pkg.model.BadPkgScreenshotException;+import org.haikuos.haikudepotserver.pkg.model.PkgScreenshotOptimizationJobSpecification;
import org.haikuos.haikudepotserver.pkg.model.SizeLimitReachedException; import org.haikuos.haikudepotserver.security.AuthorizationService; import org.haikuos.haikudepotserver.security.model.Permission; @@ -50,10 +52,13 @@ protected static int SCREENSHOT_SIDE_LIMIT = 1500; @Resource - ServerRuntime serverRuntime; + private ServerRuntime serverRuntime; @Resource - PkgOrchestrationService pkgService; + private PkgOrchestrationService pkgService; + + @Resource + private JobOrchestrationService jobOrchestrationService; @Resource AuthorizationService authorizationService; @@ -214,7 +219,7 @@ } /**- * <p>This handler will take-up an HTTP PUT that provides a new screenshot for the package.</p> + * <p>This handler will take-up an HTTP POST that provides a new screenshot for the package.</p>
*/@RequestMapping(value = "/{"+KEY_PKGNAME+"}/add", method = RequestMethod.POST)
@@ -267,6 +272,12 @@ context.commitChanges(); + // trigger optimization of the screenshot image. + + jobOrchestrationService.submit(+ new PkgScreenshotOptimizationJobSpecification(screenshotCode),
+ JobOrchestrationService.CoalesceMode.QUEUEDANDSTARTED); + response.setHeader(HEADER_SCREENSHOTCODE, screenshotCode); response.setStatus(HttpServletResponse.SC_OK); } =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/model/PkgIconSpreadsheetJobSpecification.java Sat Dec 20 09:47:27 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/model/PkgIconSpreadsheetJobSpecification.java Tue Jan 6 10:42:08 2015 UTC
@@ -1,5 +1,5 @@ /* - * Copyright 2014, Andrew Lindesay + * Copyright 2014-2015, Andrew Lindesay * Distributed under the terms of the MIT License. */ @@ -7,14 +7,15 @@ import org.haikuos.haikudepotserver.job.model.AbstractJobSpecification; import org.haikuos.haikudepotserver.job.model.JobSpecification; -import org.springframework.util.ObjectUtils; + +import java.util.Objects;public class PkgIconSpreadsheetJobSpecification extends AbstractJobSpecification {
@Override public boolean isEquivalent(JobSpecification other) {if(PkgIconSpreadsheetJobSpecification.class.isAssignableFrom(other.getClass())) { - return ObjectUtils.nullSafeEquals(other.getOwnerUserNickname(), getOwnerUserNickname()); + return Objects.equals(other.getOwnerUserNickname(), getOwnerUserNickname());
} return false; ============================================================================== Revision: e612bc94cb8e Author: Andrew Lindesay <apl@xxxxxxxxxxxxxx> Date: Tue Jan 6 10:55:10 2015 UTC Log: all injection member variables to be private https://code.google.com/p/haiku-depot-web-app/source/detail?r=e612bc94cb8e Modified:/haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/AuthorizationApiImpl.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/CaptchaApiImpl.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/MiscellaneousApiImpl.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/RepositoryApiImpl.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/UserRatingApiImpl.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/feed/FeedOrchestrationService.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/feed/controller/FeedController.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/job/AbstractJobRunner.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/multipage/controller/HomeController.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/multipage/controller/ViewPkgController.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/naturallanguage/NaturalLanguageOrchestrationService.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/passwordreset/PasswordResetOrchestrationService.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/CreatedPkgVersionSyndEntrySupplier.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/controller/PkgIconController.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/controller/PkgScreenshotController.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/repository/PkgRepositoryImportJobRunner.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/repository/controller/RepositoryImportController.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/security/AuthenticationService.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/security/controller/AuthorizationPkgRuleController.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/user/UserOrchestrationService.java /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/userrating/UserRatingOrchestrationService.java
=======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/AuthorizationApiImpl.java Sun Aug 3 11:11:48 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/AuthorizationApiImpl.java Tue Jan 6 10:55:10 2015 UTC
@@ -38,13 +38,13 @@protected static Logger LOGGER = LoggerFactory.getLogger(AuthorizationApiImpl.class);
@Resource - ServerRuntime serverRuntime; + private ServerRuntime serverRuntime; @Resource - AuthorizationService authorizationService; + private AuthorizationService authorizationService; @Resource- AuthorizationPkgRuleOrchestrationService authorizationRulesOrchestrationService; + private AuthorizationPkgRuleOrchestrationService authorizationRulesOrchestrationService;
// ------------------------------- // HELPERS =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/CaptchaApiImpl.java Fri Nov 15 08:51:45 2013 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/CaptchaApiImpl.java Tue Jan 6 10:55:10 2015 UTC
@@ -19,7 +19,7 @@ public class CaptchaApiImpl implements CaptchaApi { @Resource - CaptchaService captchaService; + private CaptchaService captchaService; @Overridepublic GenerateCaptchaResult generateCaptcha(GenerateCaptchaRequest generateCaptchaRequest) {
=======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/MiscellaneousApiImpl.java Sat Oct 25 20:54:51 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/MiscellaneousApiImpl.java Tue Jan 6 10:55:10 2015 UTC
@@ -40,22 +40,22 @@public final static String RESOURCE_MESSAGES = "/messages%s.properties";
@Resource - ServerRuntime serverRuntime; + private ServerRuntime serverRuntime; @Resource - RuntimeInformationService runtimeInformationService; + private RuntimeInformationService runtimeInformationService; @Resource - FeedOrchestrationService feedOrchestrationService; + private FeedOrchestrationService feedOrchestrationService; @Resource - MessageSource messageSource; + private MessageSource messageSource; @Resource- NaturalLanguageOrchestrationService naturalLanguageOrchestrationService; + private NaturalLanguageOrchestrationService naturalLanguageOrchestrationService;
@Value("${deployment.isproduction:false}") - Boolean isProduction; + private Boolean isProduction; @Overridepublic GetAllPkgCategoriesResult getAllPkgCategories(GetAllPkgCategoriesRequest getAllPkgCategoriesRequest) {
=======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/RepositoryApiImpl.java Sat Dec 20 09:47:27 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/RepositoryApiImpl.java Tue Jan 6 10:55:10 2015 UTC
@@ -40,16 +40,16 @@protected static Logger LOGGER = LoggerFactory.getLogger(RepositoryApiImpl.class);
@Resource - ServerRuntime serverRuntime; + private ServerRuntime serverRuntime; @Resource - AuthorizationService authorizationService; + private AuthorizationService authorizationService; @Resource - RepositoryOrchestrationService repositoryService; + private RepositoryOrchestrationService repositoryService; @Resource - JobOrchestrationService jobOrchestrationService; + private JobOrchestrationService jobOrchestrationService; // note; no integration test for this one. @Override =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/UserRatingApiImpl.java Sat Dec 20 09:47:27 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/api1/UserRatingApiImpl.java Tue Jan 6 10:55:10 2015 UTC
@@ -40,19 +40,19 @@protected static Logger LOGGER = LoggerFactory.getLogger(UserApiImpl.class);
@Resource - ServerRuntime serverRuntime; + private ServerRuntime serverRuntime; @Resource - AuthorizationService authorizationService; + private AuthorizationService authorizationService; @Resource - JobOrchestrationService jobOrchestrationService; + private JobOrchestrationService jobOrchestrationService; @Resource - UserRatingOrchestrationService userRatingOrchestrationService; + private UserRatingOrchestrationService userRatingOrchestrationService; @Resource - PkgOrchestrationService pkgOrchestrationService; + private PkgOrchestrationService pkgOrchestrationService; private AbstractGetUserRatingResult.User createUser(User user) { Preconditions.checkNotNull(user); =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/feed/FeedOrchestrationService.java Thu Aug 14 11:03:33 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/feed/FeedOrchestrationService.java Tue Jan 6 10:55:10 2015 UTC
@@ -19,7 +19,7 @@ public class FeedOrchestrationService { @Value("${baseurl}") - String baseUrl; + private String baseUrl; /*** <p>Given a specification for a feed, this method will generate a URL that external users can query in order
=======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/feed/controller/FeedController.java Thu Aug 14 11:03:33 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/feed/controller/FeedController.java Tue Jan 6 10:55:10 2015 UTC
@@ -65,10 +65,10 @@ public final static String PATH_PKG_LEAF = "/pkg.atom"; @Resource - List<SyndEntrySupplier> syndEntrySuppliers; + private List<SyndEntrySupplier> syndEntrySuppliers; @Value("${baseurl}") - String baseUrl; + private String baseUrl;private LoadingCache<FeedSpecification,SyndFeed> feedCache = CacheBuilder
.newBuilder() =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/job/AbstractJobRunner.java Wed Dec 31 10:32:57 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/job/AbstractJobRunner.java Tue Jan 6 10:55:10 2015 UTC
@@ -21,9 +21,6 @@ private final static String SUFFIX = "JobRunner"; - @Resource - JobOrchestrationService jobOrchestrationService; - @Override public String getJobTypeCode() { String sn = this.getClass().getSimpleName(); =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/multipage/controller/HomeController.java Fri Sep 26 09:53:20 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/multipage/controller/HomeController.java Tue Jan 6 10:55:10 2015 UTC
@@ -68,10 +68,10 @@ public final static int PAGESIZE = 15; @Resource - ServerRuntime serverRuntime; + private ServerRuntime serverRuntime; @Resource - PkgOrchestrationService pkgOrchestrationService; + private PkgOrchestrationService pkgOrchestrationService; /*** <p>This is the entry point for the home page. It will look at the parameters supplied and will
=======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/multipage/controller/ViewPkgController.java Sat Aug 30 10:29:45 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/multipage/controller/ViewPkgController.java Tue Jan 6 10:55:10 2015 UTC
@@ -36,7 +36,7 @@ public class ViewPkgController { @Resource - ServerRuntime serverRuntime; + private ServerRuntime serverRuntime; private String hyphenToNull(String part) { if(null!=part && !part.equals("-")) { =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/naturallanguage/NaturalLanguageOrchestrationService.java Sat Oct 18 09:28:19 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/naturallanguage/NaturalLanguageOrchestrationService.java Tue Jan 6 10:55:10 2015 UTC
@@ -47,7 +47,7 @@private Map<String,Boolean> naturalLanguageCodeHasPkgVersionLocalization = null;
@Resource - ServerRuntime serverRuntime; + private ServerRuntime serverRuntime;private boolean hasLocalizationMessagesPrimative(NaturalLanguage naturalLanguage) {
=======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/passwordreset/PasswordResetOrchestrationService.java Thu Aug 14 11:03:33 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/passwordreset/PasswordResetOrchestrationService.java Tue Jan 6 10:55:10 2015 UTC
@@ -46,25 +46,25 @@ private final static String MAIL_PLAINTEXT = "passwordreset-plaintext"; @Resource - MailSender mailSender; + private MailSender mailSender; @Resource - ServerRuntime serverRuntime; + private ServerRuntime serverRuntime; @Resource - AuthenticationService authenticationService; + private AuthenticationService authenticationService; @Resource - Configuration freemarkerConfiguration; + private Configuration freemarkerConfiguration; @Value("${passwordreset.ttlhours:1}") - Integer timeToLiveHours; + private Integer timeToLiveHours; @Value("${baseurl}") - String baseUrl; + private String baseUrl; @Value("${email.from}") - String from; + private String from; private String fillFreemarkerTemplate( PasswordResetMail mailModel, =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/CreatedPkgVersionSyndEntrySupplier.java Thu Aug 14 11:03:33 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/CreatedPkgVersionSyndEntrySupplier.java Tue Jan 6 10:55:10 2015 UTC
@@ -45,13 +45,13 @@public class CreatedPkgVersionSyndEntrySupplier implements SyndEntrySupplier {
@Resource - ServerRuntime serverRuntime; + private ServerRuntime serverRuntime; @Value("${baseurl}") - String baseUrl; + private String baseUrl; @Resource - MessageSource messageSource; + private MessageSource messageSource; @Overridepublic List<SyndEntry> generate(final FeedSpecification specification) {
=======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/controller/PkgIconController.java Sat Oct 25 20:54:51 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/controller/PkgIconController.java Tue Jan 6 10:55:10 2015 UTC
@@ -52,13 +52,13 @@ public final static String KEY_FALLBACK = "f"; @Resource - ServerRuntime serverRuntime; + private ServerRuntime serverRuntime; @Resource - PkgOrchestrationService pkgService; + private PkgOrchestrationService pkgService; @Resource - AuthorizationService authorizationService; + private AuthorizationService authorizationService; private ServletContext servletContext; =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/controller/PkgScreenshotController.java Tue Jan 6 10:42:08 2015 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/pkg/controller/PkgScreenshotController.java Tue Jan 6 10:55:10 2015 UTC
@@ -61,7 +61,7 @@ private JobOrchestrationService jobOrchestrationService; @Resource - AuthorizationService authorizationService; + private AuthorizationService authorizationService; private void handleHeadOrGet( RequestMethod requestMethod, =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/repository/PkgRepositoryImportJobRunner.java Sat Dec 20 09:47:27 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/repository/PkgRepositoryImportJobRunner.java Tue Jan 6 10:55:10 2015 UTC
@@ -42,10 +42,10 @@protected static Logger LOGGER = LoggerFactory.getLogger(PkgRepositoryImportJobRunner.class);
@Resource - ServerRuntime serverRuntime; + private ServerRuntime serverRuntime; @Resource - PkgOrchestrationService pkgService; + private PkgOrchestrationService pkgService; @Overridepublic void run(JobOrchestrationService jobOrchestrationService, PkgRepositoryImportJobSpecification specification) {
=======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/repository/controller/RepositoryImportController.java Sat Dec 20 09:47:27 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/repository/controller/RepositoryImportController.java Tue Jan 6 10:55:10 2015 UTC
@@ -37,7 +37,7 @@ public final static String KEY_CODE = "code"; @Resource - JobOrchestrationService jobOrchestrationService; + private JobOrchestrationService jobOrchestrationService; @RequestMapping(method = RequestMethod.GET) public void fetch( =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/security/AuthenticationService.java Tue Sep 9 11:49:40 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/security/AuthenticationService.java Tue Jan 6 10:55:10 2015 UTC
@@ -60,16 +60,16 @@ */ @Value("${authentication.jws.sharedkey:}") - String jsonWebTokenSharedKey; + private String jsonWebTokenSharedKey; @Value("${authentication.jws.expiryseconds:300}") - Integer jsonWebTokenExpirySeconds; + private Integer jsonWebTokenExpirySeconds; @Value("${authentication.jws.issuer}") - String jsonWebTokenIssuer; + private String jsonWebTokenIssuer; @Resource - ServerRuntime serverRuntime; + private ServerRuntime serverRuntime; private JWSSigner jsonWebTokenSigner = null; =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/security/controller/AuthorizationPkgRuleController.java Sun Aug 3 11:11:48 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/security/controller/AuthorizationPkgRuleController.java Tue Jan 6 10:55:10 2015 UTC
@@ -30,10 +30,10 @@protected static Logger LOGGER = LoggerFactory.getLogger(AuthorizationPkgRuleController.class);
@Resource - ServerRuntime serverRuntime; + private ServerRuntime serverRuntime; @Resource- AuthorizationPkgRuleOrchestrationService authorizationPkgRuleOrchestrationService; + private AuthorizationPkgRuleOrchestrationService authorizationPkgRuleOrchestrationService;
/*** <p>This method will produce a CSV file containing all of the rules.</p>
=======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/user/UserOrchestrationService.java Tue Sep 9 11:49:40 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/user/UserOrchestrationService.java Tue Jan 6 10:55:10 2015 UTC
@@ -58,10 +58,10 @@private final static String LDAP_ATTRIBUTE_VALUE_OBJECTCLASS_INETORGPERSON = "inetOrgPerson";
@Resource - LdapConnectionPoolHolder ldapConnectionPoolHolder; + private LdapConnectionPoolHolder ldapConnectionPoolHolder; @Value("${ldap.people.dn:}") - String ldapPeopleDn; + private String ldapPeopleDn; @PostConstruct public void init() { =======================================--- /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/userrating/UserRatingOrchestrationService.java Fri Nov 14 06:22:21 2014 UTC +++ /haikudepotserver-webapp/src/main/java/org/haikuos/haikudepotserver/userrating/UserRatingOrchestrationService.java Tue Jan 6 10:55:10 2015 UTC
@@ -42,13 +42,13 @@protected static Logger LOGGER = LoggerFactory.getLogger(UserRatingOrchestrationService.class);
@Value("${userrating.aggregation.pkg.versionsback:2}") - int userRatingDerivationVersionsBack; + private int userRatingDerivationVersionsBack; @Value("${userrating.aggregation.pkg.minratings:3}") - int userRatingsDerivationMinRatings; + private int userRatingsDerivationMinRatings; @Resource - ServerRuntime serverRuntime; + private ServerRuntime serverRuntime; // ------------------------------------- // ITERATION ============================================================================== Revision: 02517f6d46d4 Author: Andrew Lindesay <apl@xxxxxxxxxxxxxx> Date: Tue Jan 6 10:56:17 2015 UTC Log: version 1.0.16 https://code.google.com/p/haiku-depot-web-app/source/detail?r=02517f6d46d4 Modified: /haikudepotserver-api1/pom.xml /haikudepotserver-docs/pom.xml /haikudepotserver-packagefile/pom.xml /haikudepotserver-parent/pom.xml /haikudepotserver-rpm-common/pom.xml /haikudepotserver-rpm-parent/pom.xml /haikudepotserver-rpm-production/pom.xml /haikudepotserver-rpm-test/pom.xml /haikudepotserver-webapp/pom.xml /pom.xml ======================================= --- /haikudepotserver-api1/pom.xml Mon Jan 5 09:18:28 2015 UTC +++ /haikudepotserver-api1/pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <artifactId>haikudepotserver-parent</artifactId> <groupId>org.haikuos</groupId> <relativePath>../haikudepotserver-parent</relativePath> - <version>1.0.16-SNAPSHOT</version> + <version>1.0.16</version> </parent> <modelVersion>4.0.0</modelVersion> ======================================= --- /haikudepotserver-docs/pom.xml Mon Jan 5 09:18:28 2015 UTC +++ /haikudepotserver-docs/pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <artifactId>haikudepotserver-parent</artifactId> <groupId>org.haikuos</groupId> <relativePath>../haikudepotserver-parent</relativePath> - <version>1.0.16-SNAPSHOT</version> + <version>1.0.16</version> </parent> <modelVersion>4.0.0</modelVersion> ======================================= --- /haikudepotserver-packagefile/pom.xml Mon Jan 5 09:18:28 2015 UTC +++ /haikudepotserver-packagefile/pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <artifactId>haikudepotserver-parent</artifactId> <groupId>org.haikuos</groupId> <relativePath>../haikudepotserver-parent</relativePath> - <version>1.0.16-SNAPSHOT</version> + <version>1.0.16</version> </parent> <modelVersion>4.0.0</modelVersion> ======================================= --- /haikudepotserver-parent/pom.xml Mon Jan 5 09:18:28 2015 UTC +++ /haikudepotserver-parent/pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <groupId>org.haikuos</groupId> <artifactId>haikudepotserver-parent</artifactId> <packaging>pom</packaging> - <version>1.0.16-SNAPSHOT</version> + <version>1.0.16</version> <licenses> <license> ======================================= --- /haikudepotserver-rpm-common/pom.xml Mon Jan 5 09:18:28 2015 UTC +++ /haikudepotserver-rpm-common/pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <artifactId>haikudepotserver-parent</artifactId> <groupId>org.haikuos</groupId> <relativePath>../haikudepotserver-parent</relativePath> - <version>1.0.16-SNAPSHOT</version> + <version>1.0.16</version> </parent> <modelVersion>4.0.0</modelVersion> ======================================= --- /haikudepotserver-rpm-parent/pom.xml Mon Jan 5 09:18:28 2015 UTC +++ /haikudepotserver-rpm-parent/pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <artifactId>haikudepotserver-parent</artifactId> <groupId>org.haikuos</groupId> <relativePath>../haikudepotserver-parent</relativePath> - <version>1.0.16-SNAPSHOT</version> + <version>1.0.16</version> </parent> <modelVersion>4.0.0</modelVersion> ======================================= --- /haikudepotserver-rpm-production/pom.xml Mon Jan 5 09:18:28 2015 UTC +++ /haikudepotserver-rpm-production/pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <artifactId>haikudepotserver-rpm-parent</artifactId> <groupId>org.haikuos</groupId> <relativePath>../haikudepotserver-rpm-parent</relativePath> - <version>1.0.16-SNAPSHOT</version> + <version>1.0.16</version> </parent> <modelVersion>4.0.0</modelVersion> ======================================= --- /haikudepotserver-rpm-test/pom.xml Mon Jan 5 09:18:28 2015 UTC +++ /haikudepotserver-rpm-test/pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <artifactId>haikudepotserver-rpm-parent</artifactId> <groupId>org.haikuos</groupId> <relativePath>../haikudepotserver-rpm-parent</relativePath> - <version>1.0.16-SNAPSHOT</version> + <version>1.0.16</version> </parent> <modelVersion>4.0.0</modelVersion> ======================================= --- /haikudepotserver-webapp/pom.xml Mon Jan 5 09:18:28 2015 UTC +++ /haikudepotserver-webapp/pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <artifactId>haikudepotserver-parent</artifactId> <groupId>org.haikuos</groupId> <relativePath>../haikudepotserver-parent</relativePath> - <version>1.0.16-SNAPSHOT</version> + <version>1.0.16</version> </parent> <modelVersion>4.0.0</modelVersion> ======================================= --- /pom.xml Mon Jan 5 09:18:28 2015 UTC +++ /pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <groupId>org.haikuos</groupId> <artifactId>haikudepotserver</artifactId> <packaging>pom</packaging> - <version>1.0.16-SNAPSHOT</version> + <version>1.0.16</version> <modules> <module>haikudepotserver-api1</module> ============================================================================== Revision: 7f41f406f451 Author: Andrew Lindesay <apl@xxxxxxxxxxxxxx> Date: Tue Jan 6 10:56:17 2015 UTC Log: version 1.0.17-SNAPSHOT https://code.google.com/p/haiku-depot-web-app/source/detail?r=7f41f406f451 Modified: /haikudepotserver-api1/pom.xml /haikudepotserver-docs/pom.xml /haikudepotserver-packagefile/pom.xml /haikudepotserver-parent/pom.xml /haikudepotserver-rpm-common/pom.xml /haikudepotserver-rpm-parent/pom.xml /haikudepotserver-rpm-production/pom.xml /haikudepotserver-rpm-test/pom.xml /haikudepotserver-webapp/pom.xml /pom.xml ======================================= --- /haikudepotserver-api1/pom.xml Tue Jan 6 10:56:17 2015 UTC +++ /haikudepotserver-api1/pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <artifactId>haikudepotserver-parent</artifactId> <groupId>org.haikuos</groupId> <relativePath>../haikudepotserver-parent</relativePath> - <version>1.0.16</version> + <version>1.0.17-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> ======================================= --- /haikudepotserver-docs/pom.xml Tue Jan 6 10:56:17 2015 UTC +++ /haikudepotserver-docs/pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <artifactId>haikudepotserver-parent</artifactId> <groupId>org.haikuos</groupId> <relativePath>../haikudepotserver-parent</relativePath> - <version>1.0.16</version> + <version>1.0.17-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> ======================================= --- /haikudepotserver-packagefile/pom.xml Tue Jan 6 10:56:17 2015 UTC +++ /haikudepotserver-packagefile/pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <artifactId>haikudepotserver-parent</artifactId> <groupId>org.haikuos</groupId> <relativePath>../haikudepotserver-parent</relativePath> - <version>1.0.16</version> + <version>1.0.17-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> ======================================= --- /haikudepotserver-parent/pom.xml Tue Jan 6 10:56:17 2015 UTC +++ /haikudepotserver-parent/pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <groupId>org.haikuos</groupId> <artifactId>haikudepotserver-parent</artifactId> <packaging>pom</packaging> - <version>1.0.16</version> + <version>1.0.17-SNAPSHOT</version> <licenses> <license> ======================================= --- /haikudepotserver-rpm-common/pom.xml Tue Jan 6 10:56:17 2015 UTC +++ /haikudepotserver-rpm-common/pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <artifactId>haikudepotserver-parent</artifactId> <groupId>org.haikuos</groupId> <relativePath>../haikudepotserver-parent</relativePath> - <version>1.0.16</version> + <version>1.0.17-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> ======================================= --- /haikudepotserver-rpm-parent/pom.xml Tue Jan 6 10:56:17 2015 UTC +++ /haikudepotserver-rpm-parent/pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <artifactId>haikudepotserver-parent</artifactId> <groupId>org.haikuos</groupId> <relativePath>../haikudepotserver-parent</relativePath> - <version>1.0.16</version> + <version>1.0.17-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> ======================================= --- /haikudepotserver-rpm-production/pom.xml Tue Jan 6 10:56:17 2015 UTC +++ /haikudepotserver-rpm-production/pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <artifactId>haikudepotserver-rpm-parent</artifactId> <groupId>org.haikuos</groupId> <relativePath>../haikudepotserver-rpm-parent</relativePath> - <version>1.0.16</version> + <version>1.0.17-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> ======================================= --- /haikudepotserver-rpm-test/pom.xml Tue Jan 6 10:56:17 2015 UTC +++ /haikudepotserver-rpm-test/pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <artifactId>haikudepotserver-rpm-parent</artifactId> <groupId>org.haikuos</groupId> <relativePath>../haikudepotserver-rpm-parent</relativePath> - <version>1.0.16</version> + <version>1.0.17-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> ======================================= --- /haikudepotserver-webapp/pom.xml Tue Jan 6 10:56:17 2015 UTC +++ /haikudepotserver-webapp/pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <artifactId>haikudepotserver-parent</artifactId> <groupId>org.haikuos</groupId> <relativePath>../haikudepotserver-parent</relativePath> - <version>1.0.16</version> + <version>1.0.17-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> ======================================= --- /pom.xml Tue Jan 6 10:56:17 2015 UTC +++ /pom.xml Tue Jan 6 10:56:17 2015 UTC @@ -5,7 +5,7 @@ <groupId>org.haikuos</groupId> <artifactId>haikudepotserver</artifactId> <packaging>pom</packaging> - <version>1.0.16</version> + <version>1.0.17-SNAPSHOT</version> <modules> <module>haikudepotserver-api1</module>