com.bea.campaign.servlets
Class CampaignCleanupServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.bea.campaign.servlets.CampaignCleanupServlet
All Implemented Interfaces
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class CampaignCleanupServlet
extends javax.servlet.http.HttpServlet

A servlet which can handle cleaning up campaigns.

This supports the following servlet parameters:

It alse expects the following ejb-refs:

If all the request cleanups succeed, a OK (200) status code will be returned. If one or more failed, a INTERNAL_ERROR (500) status code will be returned, plus the header 'BEA-CAMPAIGN-Cleanup-Failures' will be set to the comma-separate list of cleanUp values that failed.

See Also
Serialized Form

Field Summary
protected static int CLEANUP_AD_BUCKETS
          Mask signifying ad bucket cleanup.
protected static int CLEANUP_AD_COUNTS
          Mask signifying ad count cleanup.
protected static int CLEANUP_ALL
          Mask signifying all cleanup.
protected static int CLEANUP_END_STATES
          Mask signifying end state cleanup.
protected static int CLEANUP_MAIL_BATCHES
          Mask signifying mail batches cleanup.
static String FAILED_REFRESH
           
static String REFRESH_STATUS
           
static String SUCCESSFUL_REFRESH
           
 
Constructor Summary
CampaignCleanupServlet()
           
 
Method Summary
protected  void cleanupAdBuckets(String campaignId)
          Cleanup a campaign's ad buckets.
protected  void cleanupAdCounts(String campaignId)
          Cleanup a campaign's ad count.
protected  void cleanupEndStates(String campaignId)
          Cleanup a campaign's end states.
protected  void cleanupMailBatches(String campaignId)
          Cleanup a campaign's mail batches.
 void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Service a request.
 void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Service a request.
protected  AdBucketService getAdBucketService()
          Get our java:comp/env/ejb/AdBucketService.
protected  AdService getAdService()
          Get our java:comp/env/ejb/AdService.
protected  CampaignService getCampaignService()
          Get our java:comp/env/ejb/CampaignService.
protected  MailService getMailService()
          Get our java:comp/env/ejb/MailService.
protected  int handleCleanup(String campaignId, int options)
          Handle the request cleanup options.
 void init()
          Initialize this servlet.
protected  void resetCampaign(String campaignId)
          Reset a campaign's internal state.
protected  void sendError(javax.servlet.http.HttpServletResponse resp, int status, String mesg)
          Send an error message.
protected static String toHTML(String in)
          Convert a string to html.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLEANUP_END_STATES

protected static final int CLEANUP_END_STATES
Mask signifying end state cleanup.

See Also
Constants Summary

CLEANUP_AD_BUCKETS

protected static final int CLEANUP_AD_BUCKETS
Mask signifying ad bucket cleanup.

See Also
Constants Summary

CLEANUP_AD_COUNTS

protected static final int CLEANUP_AD_COUNTS
Mask signifying ad count cleanup.

See Also
Constants Summary

CLEANUP_MAIL_BATCHES

protected static final int CLEANUP_MAIL_BATCHES
Mask signifying mail batches cleanup.

See Also
Constants Summary

CLEANUP_ALL

protected static final int CLEANUP_ALL
Mask signifying all cleanup.

See Also
Constants Summary

SUCCESSFUL_REFRESH

public static final String SUCCESSFUL_REFRESH
See Also
Constants Summary

FAILED_REFRESH

public static final String FAILED_REFRESH
See Also
Constants Summary

REFRESH_STATUS

public static final String REFRESH_STATUS
See Also
Constants Summary
Constructor Detail

CampaignCleanupServlet

public CampaignCleanupServlet()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Initialize this servlet.

This will initialize the various services.

Overrides:
init in class javax.servlet.GenericServlet
Throws
javax.servlet.ServletException
See Also
getCampaignService(), getAdBucketService(), getAdService(), getMailService()

doGet

public void doGet(javax.servlet.http.HttpServletRequest req,
                  javax.servlet.http.HttpServletResponse resp)
           throws javax.servlet.ServletException,
                  IOException
Service a request.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws
javax.servlet.ServletException
IOException

doPost

public void doPost(javax.servlet.http.HttpServletRequest req,
                   javax.servlet.http.HttpServletResponse resp)
            throws javax.servlet.ServletException,
                   IOException
Service a request.

Overrides:
doPost in class javax.servlet.http.HttpServlet
Throws
javax.servlet.ServletException
IOException
See Also
doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

handleCleanup

protected int handleCleanup(String campaignId,
                            int options)
Handle the request cleanup options.

Returns
the bit-ORed list of options that failed.

resetCampaign

protected void resetCampaign(String campaignId)
                      throws javax.ejb.CreateException,
                             javax.ejb.EJBException,
                             RemoteException
Reset a campaign's internal state.

Throws
javax.ejb.CreateException
javax.ejb.EJBException
RemoteException
See Also
CampaignService.resetCampaign(java.lang.String)

cleanupEndStates

protected void cleanupEndStates(String campaignId)
                         throws javax.ejb.CreateException,
                                javax.ejb.EJBException,
                                RemoteException
Cleanup a campaign's end states.

Throws
javax.ejb.CreateException
javax.ejb.EJBException
RemoteException
See Also
CampaignService.clearEndStates(java.lang.String)

cleanupAdBuckets

protected void cleanupAdBuckets(String campaignId)
                         throws javax.ejb.CreateException,
                                javax.ejb.EJBException,
                                RemoteException,
                                ContentException
Cleanup a campaign's ad buckets.

Throws
javax.ejb.CreateException
javax.ejb.EJBException
RemoteException
ContentException
See Also
AdBucketService.cleanupAdBucket(java.lang.String)

cleanupAdCounts

protected void cleanupAdCounts(String campaignId)
                        throws javax.ejb.CreateException,
                               javax.ejb.EJBException,
                               RemoteException,
                               ContentException
Cleanup a campaign's ad count.

Throws
javax.ejb.CreateException
javax.ejb.EJBException
RemoteException
ContentException
See Also
AdService.cleanupAdService(java.lang.String)

cleanupMailBatches

protected void cleanupMailBatches(String campaignId)
                           throws javax.ejb.CreateException,
                                  javax.ejb.EJBException,
                                  RemoteException,
                                  MailServiceException
Cleanup a campaign's mail batches.

Throws
javax.ejb.CreateException
javax.ejb.EJBException
RemoteException
MailServiceException
See Also
MailService.deleteBatch(java.lang.String)

sendError

protected void sendError(javax.servlet.http.HttpServletResponse resp,
                         int status,
                         String mesg)
                  throws javax.servlet.ServletException,
                         IOException
Send an error message.

Throws
javax.servlet.ServletException
IOException

getAdService

protected AdService getAdService()
                          throws javax.ejb.CreateException,
                                 RemoteException
Get our java:comp/env/ejb/AdService.

This will use the ejb-ref if getCampaignService().getAdService() fails.

Throws
javax.ejb.CreateException
RemoteException

getAdBucketService

protected AdBucketService getAdBucketService()
                                      throws javax.ejb.CreateException,
                                             RemoteException
Get our java:comp/env/ejb/AdBucketService.

This will use the ejb-ref if getCampaignService().getAdBucketService() fails.

Throws
javax.ejb.CreateException
RemoteException

getCampaignService

protected CampaignService getCampaignService()
                                      throws javax.ejb.CreateException,
                                             RemoteException
Get our java:comp/env/ejb/CampaignService.

Throws
javax.ejb.CreateException
RemoteException

getMailService

protected MailService getMailService()
                              throws javax.ejb.CreateException,
                                     RemoteException
Get our java:comp/env/ejb/MailService.

This will use the ejb-ref if getCampaignService().getMailService() fails.

Throws
javax.ejb.CreateException
RemoteException

toHTML

protected static String toHTML(String in)
Convert a string to html.

See Also
AdHelper.toHTML(java.lang.String)


Copyright © 2011, Oracle. All rights reserved.