Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cargotracker-dev] UploadDirectoryScanner source code change, ArquillianServletRunner

Hi Reza and Cargo Tracker mailing list,

Open Liberty's built in user authentication requires role assignments in order to operate batch jobs. So far I haven't been able to figure out a way around it without modifying the UploadDirectoryScanner class file. My change is simply to add the @PermitAll tag in the class file, which doesn't seem to have any issues with Payara. Do you think that would be a reasonable PR? The updated file would look like this: 

package org.eclipse.cargotracker.interfaces.handling.file;

import javax.annotation.security.PermitAll;
import javax.batch.operations.JobOperator;
import javax.batch.runtime.BatchRuntime;
import javax.ejb.Schedule;
import javax.ejb.Stateless;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;

/**
 * Periodically scans a certain directory for files and attempts to parse handling event
 * registrations from the contents by calling a batch job.
 *
 * <p>Files that fail to parse are moved into a separate directory, successful files are deleted.
 */
@Stateless
@PermitAll
@TransactionManagement(TransactionManagementType.BEAN) // Batch steps manage their own transactions.
public class UploadDirectoryScanner {

  @Schedule(minute = "*/2", hour = "*") // In production, run every fifteen minutes
  public void processFiles() {
    JobOperator jobOperator = BatchRuntime.getJobOperator();
    jobOperator.start("EventFilesProcessorJob", null);
  }
}
Let me know what you think about that. Finally, I've recently encountered an issue running the app on Payara where the BookingServiceTest fails after running "mvn clean package cargo:run" due to an error where the ArquillianServletRunner is not found. Is that something you've experienced before? This is happening for me on a fresh clone of the Payara repository so it's possible that it might be an issue with my machine as well. 

Thanks.

Chanun

Back to the top