001: /**
002: * Copyright 2002 Sun Microsystems, Inc. All
003: * rights reserved. Use of this product is subject
004: * to license terms. Federal Acquisitions:
005: * Commercial Software -- Government Users
006: * Subject to Standard License Terms and
007: * Conditions.
008: *
009: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
010: * are trademarks or registered trademarks of Sun Microsystems,
011: * Inc. in the United States and other countries.
012: *
013: * @ Author Bhavanishankar
014: */package com.sun.portal.netlet.admin.model;
015:
016: // JDK classes
017:
018: import com.iplanet.am.console.service.model.SMDataModelImpl;
019: import com.sun.portal.log.common.PortalLogger;
020: import com.iplanet.sso.SSOException;
021: import com.sun.identity.sm.SMSException;
022: import com.sun.identity.sm.ServiceSchemaManager;
023: import com.sun.portal.netlet.admin.NetletAdminModelManager;
024:
025: import javax.servlet.http.HttpServletRequest;
026: import java.util.Map;
027: import java.util.Set;
028: import java.util.HashSet;
029:
030: public class NetletAdminServiceModelImpl extends SMDataModelImpl
031: implements NetletAdminServiceModel {
032:
033: private String propsURL = "";
034:
035: public NetletAdminServiceModelImpl(HttpServletRequest req,
036: String rbName, Map map, String svcName,
037: boolean processTemplate) {
038: super (req, rbName, map, svcName, processTemplate);
039: try {
040: ServiceSchemaManager svcSchemaMgr = new ServiceSchemaManager(
041: svcName, ssoToken);
042: if (svcSchemaMgr != null)
043: propsURL = svcSchemaMgr.getPropertiesViewBeanURL();
044: NetletAdminModelManager
045: .debugMessage("NetletAdminServiceModelImpl: Properties view bean URL -> "
046: + propsURL);
047: } catch (SSOException ssoe) {
048: NetletAdminModelManager
049: .debugError(
050: "NetletAdminServiceModelImpl: Error retrieving view bean URL",
051: ssoe);
052: } catch (SMSException smse) {
053: NetletAdminModelManager
054: .debugError(
055: "NetletAdminServiceModelImpl: Error retrieving view bean URL",
056: smse);
057: }
058: }
059:
060: public int getNetletAttrIndex(String attributeName) {
061: String aName = "";
062: int rulesIndex = -1;
063: int dynSize = getSize(DYNAMIC_TYPE);
064: for (int i = 0; i < dynSize; i++) {
065: setCurrentRow(DYNAMIC_TYPE, i);
066: aName = getAttrName();
067: if (aName.equals(attributeName)) {
068: rulesIndex = i;
069: break;
070: }
071: }
072: return rulesIndex;
073: }
074:
075: public Set getNetletAttrValue(String attributeName) {
076: Set value = new HashSet();
077: int attributeIndex = getNetletAttrIndex(attributeName);
078: if (attributeIndex != -1) {
079: setCurrentRow(DYNAMIC_TYPE, attributeIndex);
080: value = getAttrValues();
081: }
082: return value;
083: }
084:
085: public int getNetletRulesIndex() {
086: return getNetletAttrIndex("sunPortalNetletRules");
087: }
088:
089: public Set getNetletRules() {
090: return getNetletAttrValue("sunPortalNetletRules");
091: }
092:
093: public int getNetletCipherListIndex() {
094: return getNetletAttrIndex("sunPortalNetletCipherList");
095: }
096:
097: public Set getNetletCipherList() {
098: return getNetletAttrValue("sunPortalNetletCipherList");
099: }
100:
101: public int getNetletRulesCount() {
102: Set s = getNetletRules();
103: return s == null ? 0 : s.size();
104: }
105:
106: public String getNetletRulesI18NKey() {
107: int index = getNetletRulesIndex();
108: setCurrentRow(DYNAMIC_TYPE, index);
109: return getDynamicGUI().getLabel();
110: }
111:
112: public String getPropsUrl() {
113: return propsURL;
114: }
115:
116: public void process() {
117: try {
118: super .process();
119: } catch (Exception ex) {
120: }
121: }
122:
123: public void store(int viewType, Map newMap) {
124: try {
125: super .store(viewType, newMap);
126: } catch (Exception ex) {
127: }
128: }
129:
130: public String getHelpUrl(String docName) {
131: return getHelpURL(docName);
132: }
133:
134: public String getHelpAnchorTag(String key) {
135: return super .getHelpAnchorTag(key);
136: }
137:
138: public String getHelpDocURL() {
139: return super.getHelpDocURL(resBundle);
140: }
141:
142: }
|