01: /**
02: * $Id: GenericProviderProvisionListener.java,v 1.3 2005/06/03 19:34:07 mjain Exp $
03: * Copyright 2005 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.providers.service.provision;
14:
15: import com.sun.portal.providers.service.provision.ProviderProvisionEvent;
16: import com.sun.portal.providers.service.provision.ProviderProvisionListener;
17: import com.sun.portal.providers.service.provision.ProviderProvisionException;
18:
19: import javax.servlet.ServletContext;
20:
21: /**
22: * An abstract class implementing PortletProvisionListener.
23: * Listeners are configured for a portlet in sun-portlet.xml file. Methods on
24: * these listeners are invoked everytime an instance of that portlet is added to a
25: * community. Framework initializes the instance with the right PortletContext in the init() method.
26: */
27: public abstract class GenericProviderProvisionListener implements
28: ProviderProvisionListener {
29:
30: private ServletContext _context;
31:
32: /**
33: * Called by container when an instance is created. When overwritten, super.init(context) must
34: * be called to initialize it correctly.
35: * @param context
36: * @throws com.sun.portal.providers.service.provision.ProviderProvisionException
37: */
38: public void init(ServletContext context)
39: throws ProviderProvisionException {
40: _context = context;
41: }
42:
43: /**
44: * Returns the servlet context of Portal webapp
45: * @return
46: */
47: public ServletContext getServletContext() {
48: return _context;
49: }
50:
51: /**
52: * Method called when instance of the portlet, for which this listener is configured, is added to a community.
53: * @param event provision event
54: * @throws com.sun.portal.providers.service.provision.ProviderProvisionException
55: */
56: abstract public void provision(ProviderProvisionEvent event)
57: throws ProviderProvisionException;
58:
59: /**
60: * Method called when an instance of the portlet, for which this listener is configured, is removed from the community.
61: * @param event provisioning event
62: * @throws com.sun.portal.providers.service.provision.ProviderProvisionException
63: */
64: abstract public void unprovision(ProviderProvisionEvent event)
65: throws ProviderProvisionException;
66:
67: }
|