Commit 8ce43440 authored by Michael Ritter's avatar Michael Ritter
Browse files

Add missing EJB annotations to some beans

parent 5eaacb1b
......@@ -5,9 +5,7 @@
package edu.umiacs.ace.ims.system;
import edu.umiacs.util.Check;
import edu.umiacs.util.Strings;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import javax.ejb.Stateless;
import javax.mail.Message;
......@@ -20,6 +18,8 @@ import javax.mail.internet.MimeMessage;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import java.util.ArrayList;
import java.util.List;
/**
*
......@@ -56,7 +56,7 @@ public class MailPublisherBean implements MailPublisherLocal
public List<InternetAddress> listRecipients()
{
List<InternetAddress> recipients = new ArrayList();
List<InternetAddress> recipients = new ArrayList<>();
Query query = em.createNamedQuery("MailRecipient.list");
for (Object o : query.getResultList())
{
......
......@@ -9,21 +9,14 @@ import edu.umiacs.ace.digest.DigestFactory;
import edu.umiacs.ace.digest.DigestProvider;
import edu.umiacs.ace.ims.processor.RoundProcessors;
import edu.umiacs.ace.ims.processor.WitnessPublisher;
import edu.umiacs.ace.server.exception.StartupException;
import edu.umiacs.ace.ims.system.InitializeLocal;
import edu.umiacs.ace.ims.tokenclass.TokenClass;
import edu.umiacs.ace.ims.tokenclass.TokenClassLocal;
import edu.umiacs.ace.server.ServletContextParameters;
import edu.umiacs.ace.server.StartupBanner;
import edu.umiacs.ace.server.exception.StartupException;
import edu.umiacs.util.Parameters;
import edu.umiacs.util.StringListBuilder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.ejb.EJB;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.apache.log4j.Logger;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
......@@ -33,7 +26,27 @@ import org.quartz.Trigger;
import org.quartz.TriggerUtils;
import org.quartz.impl.StdSchedulerFactory;
import static edu.umiacs.ace.ims.IMSParameters.*;
import javax.ejb.EJB;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static edu.umiacs.ace.ims.IMSParameters.DEFAULT_IMMEDIATE_TOKEN_RESPONSE_TIMEOUT;
import static edu.umiacs.ace.ims.IMSParameters.DEFAULT_MAXIMUM_QUEUED_REQUESTS;
import static edu.umiacs.ace.ims.IMSParameters.DEFAULT_MAXIMUM_TOKEN_STORE_AGE;
import static edu.umiacs.ace.ims.IMSParameters.DEFAULT_REQUEST_PERMIT_TIMEOUT;
import static edu.umiacs.ace.ims.IMSParameters.DEFAULT_THREAD_SHUTDOWN_TIMEOUT;
import static edu.umiacs.ace.ims.IMSParameters.DEFAULT_TOKEN_PERSISTENCE_BATCH_SIZE;
import static edu.umiacs.ace.ims.IMSParameters.IMMEDIATE_TOKEN_RESPONSE_TIMEOUT;
import static edu.umiacs.ace.ims.IMSParameters.MAXIMUM_QUEUED_REQUESTS;
import static edu.umiacs.ace.ims.IMSParameters.MAXIMUM_TOKEN_STORE_AGE;
import static edu.umiacs.ace.ims.IMSParameters.PROCESSOR_PREFIX;
import static edu.umiacs.ace.ims.IMSParameters.REQUEST_PERMIT_TIMEOUT;
import static edu.umiacs.ace.ims.IMSParameters.THREAD_SHUTDOWN_TIMEOUT;
import static edu.umiacs.ace.ims.IMSParameters.TOKEN_PERSISTENCE_BATCH_SIZE;
/**
* Web application lifecycle listener.
......@@ -101,7 +114,7 @@ public class ApplicationListener implements ServletContextListener
trigger.setName("cleanTrigger");
trigger.setStartTime(new Date());
try
{
scheduler.scheduleJob(jobDetail, trigger);
......@@ -148,11 +161,10 @@ public class ApplicationListener implements ServletContextListener
scheduler.start();
scheduler.scheduleJob(jobDetail, trigger);
Log.system("Scheduler started");
}
catch ( SchedulerException ex )
{
throw new StartupException("Unexpected exception: " +
throw new StartupException("Unexpected exception starting PublishJob: " +
ex.getMessage(), ex);
}
}
......
......@@ -12,6 +12,8 @@ import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import javax.ejb.EJB;
/**
* Publish job for the quartz scheduler
* @author toaster
......@@ -19,6 +21,7 @@ import org.quartz.JobExecutionException;
public class PublishJob implements Job
{
@EJB(name = "TokenClassBean")
private TokenClassLocal tokenClassBean =
ServiceLocator.getInstance().getLocal(TokenClassLocal.class);
......@@ -26,6 +29,7 @@ public class PublishJob implements Job
{
}
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException
{
Log.system("Running PublishJob");
......
......@@ -9,8 +9,10 @@ import edu.umiacs.ace.ims.system.MailPublisherLocal;
import edu.umiacs.ace.ims.tokenclass.TokenClass;
import edu.umiacs.ace.ims.witness.Witness;
import edu.umiacs.ace.server.ServiceLocator;
import java.util.Date;
import javax.ejb.EJB;
import javax.mail.MessagingException;
import java.util.Date;
/**
*
......@@ -18,13 +20,13 @@ import javax.mail.MessagingException;
*/
public class EmailPublisher extends WitnessPublisher
{
@EJB(name = "MailPublisherBean")
MailPublisherLocal mailBean =
ServiceLocator.getInstance().getLocal(MailPublisherLocal.class);
public void publishWitness(Witness newWitness)
{
MailPublisherLocal mailBean =
ServiceLocator.getInstance().getLocal(MailPublisherLocal.class);
String subject = "IMS Witness for " + newWitness.getTokenClass().getName() + " rounds " + newWitness.getStartRound().getId() + " - " + newWitness.getEndRound().getId();
StringBuilder sb = new StringBuilder();
......
......@@ -13,6 +13,8 @@ import edu.umiacs.ace.ims.witness.Witness;
import edu.umiacs.ace.ims.witness.WitnessLocal;
import edu.umiacs.ace.server.ServiceLocator;
import edu.umiacs.ace.util.HashValue;
import javax.ejb.EJB;
import java.security.MessageDigest;
import java.util.Date;
import java.util.List;
......@@ -28,6 +30,7 @@ import java.util.Random;
public class WitnessPublication
{
@EJB(name = "WitnessBean")
private WitnessLocal witnessBean =
ServiceLocator.getInstance().getLocal(WitnessLocal.class);
private TokenClass tokenClass;
......
......@@ -19,6 +19,7 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import javax.ejb.EJB;
import javax.ejb.EJBException;
import javax.persistence.NoResultException;
import org.apache.log4j.Logger;
......@@ -31,10 +32,14 @@ import org.apache.log4j.Logger;
public class WitnessValidation
{
@EJB(name = "WitnessBean")
private WitnessLocal witnessBean =
ServiceLocator.getInstance().getLocal(WitnessLocal.class);
@EJB(name = "RoundBean")
private RoundLocal roundBean =
ServiceLocator.getInstance().getLocal(RoundLocal.class);
private Map<Long, Witness> witnessMap = new HashMap<Long, Witness>();
private Map<Witness, HashTree> hashMap = new HashMap<Witness, HashTree>();
private static final Logger print = Logger.getLogger(WitnessValidation.class);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment