01: /**
02: * $Id: ServiceType.java,v 1.2 2005/04/19 22:24:50 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.service;
14:
15: /**
16: * This class represents the types of service implementation supported by the system.
17: * TODO : Container provider ??
18: * @author mjain
19: */
20: public class ServiceType {
21:
22: public static ServiceType SERVICETYPE_PORTLET = new ServiceType(
23: "PORTLET");
24: public static ServiceType SERVICETYPE_PROVIDER = new ServiceType(
25: "PROVIDER");
26: //public static ServiceType SERVICETYPE_WSRP = new ServiceType("WSRP");
27: //public static ServiceType SERVICETYPE_CONTAINER_PROVIDER = new ServiceType("CONTAINER_PROVIDER");
28:
29: private String _type;
30: private static ServiceType[] _allTypes = new ServiceType[] {
31: SERVICETYPE_PORTLET, SERVICETYPE_PROVIDER
32: //SERVICETYPE_WSRP,
33: //SERVICETYPE_CONTAINER_PROVIDER
34: };
35:
36: ServiceType(String type) {
37: _type = type;
38: }
39:
40: public boolean equals(Object s) {
41: if ((s != null) && (s.getClass().equals(this .getClass()))) {
42: ServiceType sObj = (ServiceType) s;
43: if (sObj._type.equals(this ._type)) {
44: return true;
45: }
46: }
47:
48: return false;
49:
50: }
51:
52: public String toString() {
53: return _type;
54: }
55:
56: public static ServiceType getServiceType(String atype) {
57: for (int i = 0; i < _allTypes.length; i++) {
58: if (_allTypes[i]._type.equals(atype)) {
59: return _allTypes[i];
60: }
61: }
62: throw new RuntimeException(
63: "Unsupported or unconfigured service type:" + atype);
64: }
65:
66: }
|