public class SendGAEventsEngine extends Object implements Runnable
Modifier and Type | Field and Description |
---|---|
private Category |
_category |
protected CategoryProviderExtensionPoint |
_categoryProviderEP
The category provider extension point.
|
protected Context |
_context
The avalon context.
|
private static DateFormat |
_DATE_FORMAT |
protected Context |
_environmentContext
The cocoon environment context.
|
private int |
_eventCount |
protected GAUriBuilder |
_gaUriBuilder
The google analytics URI builder.
|
protected I18nUtils |
_i18nUtils
The i18n utils component.
|
protected boolean |
_initialized
Is the engine initialized ?
|
private static Logger |
_LOGGER |
protected ServiceManager |
_manager
The service manager.
|
private Date |
_newsletterDate |
private long |
_newsletterNumber |
private String |
_newsletterTitle |
private boolean |
_parametrized |
protected SiteConfigurationExtensionPoint |
_siteConf
The site configuration extension point.
|
private String |
_siteName |
Constructor and Description |
---|
SendGAEventsEngine() |
Modifier and Type | Method and Description |
---|---|
private void |
_checkInitialization() |
protected String |
computeEventIdentifier()
Compute the event identifier for the newsletter sending.
|
protected void |
consumeQuietly(InputStream input)
Consume a stream, reading all its data and ignoring errors.
|
void |
initialize(ServiceManager manager,
Context context)
Initialize the engine.
|
void |
parametrize(String siteName,
WebContent newsletterContent,
Category category,
int eventCount)
Parametrize engine
|
void |
run() |
protected void |
sendEvent(String eventUrl)
Send the event request, given the full GIF URL.
|
protected void |
sendEvents(String gaWebId)
Send GA events for a given GA user account.
|
private static final DateFormat _DATE_FORMAT
protected Context _environmentContext
protected ServiceManager _manager
protected boolean _initialized
protected GAUriBuilder _gaUriBuilder
protected CategoryProviderExtensionPoint _categoryProviderEP
protected SiteConfigurationExtensionPoint _siteConf
protected I18nUtils _i18nUtils
private boolean _parametrized
private Date _newsletterDate
private long _newsletterNumber
private String _newsletterTitle
private int _eventCount
public SendGAEventsEngine()
public void initialize(ServiceManager manager, Context context) throws ContextException, ServiceException
manager
- the avalon service manager.context
- the avalon context.ContextException
- if an error occurred during initializationServiceException
- if an error occurred during initializationpublic void parametrize(String siteName, WebContent newsletterContent, Category category, int eventCount)
siteName
- The site namenewsletterContent
- the newsletter contentcategory
- the newsletter categoryeventCount
- the number of eventsprivate void _checkInitialization()
protected void sendEvents(String gaWebId)
gaWebId
- the google web ID.protected void sendEvent(String eventUrl) throws IOException
eventUrl
- the full event GIF URL (with parameters).IOException
- if an error occurs sending the GIF HTTP request.protected String computeEventIdentifier()
protected void consumeQuietly(InputStream input)
input
- the input stream to consume.