001: /**
002: * $Id: ProviderServiceImpl.java,v 1.3 2007/01/26 03:50:15 portalbld Exp $
003: * Copyright 2005 Sun Microsystems, Inc. All
004: * rights reserved. Use of this product is subject
005: * to license terms. Federal Acquisitions:
006: * Commercial Software -- Government Users
007: * Subject to Standard License Terms and
008: * Conditions.
009: *
010: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011: * are trademarks or registered trademarks of Sun Microsystems,
012: * Inc. in the United States and other countries.
013: */package com.sun.portal.service.provider.impl;
014:
015: import com.sun.portal.service.Service;
016: import com.sun.portal.service.ServiceType;
017: import com.sun.portal.service.ServiceException;
018: import com.sun.portal.service.ProvisionRequest;
019: import com.sun.portal.service.ProvisionResponse;
020: import com.sun.portal.service.MembershipRequest;
021: import com.sun.portal.service.MembershipResponse;
022:
023: import com.sun.portal.service.provider.impl.TasksDispatcher;
024: import com.sun.portal.service.provider.ProviderService;
025:
026: import javax.servlet.http.HttpServletRequest;
027:
028: import com.sun.portal.service.ServiceInitData;
029:
030: /**
031: *
032: * @author mjain
033: */
034: public class ProviderServiceImpl implements ProviderService {
035:
036: private final static String ATTR_PROVIDER_NAME = "providerName";
037: private final static String ATTR_DISPLAY_NAME = "displayName";
038: private final static String ATTR_UNIQUE_SERVICE_ID = "uniqueServiceID";
039:
040: private String _providerName;
041: private String _displayName;
042: private String _uniqueServiceID;
043:
044: public void init(String providerName, String displayName) {
045: _providerName = providerName;
046: _displayName = displayName;
047: if (_displayName == null) {
048: _displayName = _providerName;
049: }
050: _uniqueServiceID = _providerName;
051: }
052:
053: public void init(ServiceInitData data) {
054: _providerName = (String) data.get(ATTR_PROVIDER_NAME);
055: _displayName = (String) data.get(ATTR_DISPLAY_NAME);
056: _uniqueServiceID = (String) data.get(ATTR_UNIQUE_SERVICE_ID);
057: }
058:
059: public ServiceInitData getServiceInitData() {
060: ServiceInitData data = new ServiceInitData();
061: data.put(ATTR_PROVIDER_NAME, _providerName);
062: data.put(ATTR_DISPLAY_NAME, _displayName);
063: data.put(ATTR_UNIQUE_SERVICE_ID, _uniqueServiceID);
064: return data;
065: }
066:
067: public String getProviderName() {
068: return _providerName;
069: }
070:
071: public String getDisplayName() {
072: return _displayName;
073: }
074:
075: public String getUniqueServiceID() {
076: return _uniqueServiceID;
077: }
078:
079: public ServiceType getServiceType() {
080: return ServiceType.SERVICETYPE_PROVIDER;
081: }
082:
083: public TasksDispatcher getTasksDispatcher() {
084: return TasksDispatcher.getInstance();
085: }
086:
087: public void handleProvisionEvent(ProvisionRequest request,
088: ProvisionResponse response) throws ServiceException {
089: getTasksDispatcher().handleProvisionEvent(getProviderName(),
090: request, response);
091:
092: }
093:
094: public void memberAdded(MembershipRequest request,
095: MembershipResponse response) throws ServiceException {
096: getTasksDispatcher().memberAdded(getProviderName(), request,
097: response);
098: }
099:
100: public void memberRemoved(MembershipRequest request,
101: MembershipResponse response) throws ServiceException {
102: getTasksDispatcher().memberRemoved(getProviderName(), request,
103: response);
104: }
105:
106: public void destroy() throws ServiceException {
107: }
108:
109: }
|