001: /*
002: * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
003: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
004: */
005: package com.sun.portal.desktop.mfwk;
006:
007: import com.sun.mfwk.instrum.me.CIM_ManagedElementInstrum;
008: import com.sun.mfwk.instrum.me.MfManagedElementInstrumException;
009: import com.sun.mfwk.instrum.relations.MfRelationInstrumException;
010: import com.sun.mfwk.instrum.server.MfManagedElementServer;
011: import com.sun.mfwk.instrum.server.MfManagedElementServerException;
012: import com.sun.mfwk.instrum.server.MfRelationInfo;
013: import com.sun.mfwk.instrum.server.MfRelationType;
014:
015: public class MfwkPSServiceLogicalComponentAdaptor {
016: private String logicalComponentName;
017: private String serviceName;
018: private String serviceSettingName;
019: private String serviceStatsName;
020: private int lowerBound;
021: private int upperBound;
022:
023: public MfwkPSServiceLogicalComponentAdaptor(
024: String logicalComponentName, String serviceName,
025: String serviceSettingName, String serviceStatsName,
026: int lowerBound, int upperBound) {
027: setLogicalComponentName(logicalComponentName);
028: setServiceName(serviceName);
029: setServiceSettingName(serviceSettingName);
030: setServiceStatsName(serviceStatsName);
031: setLowerBound(lowerBound);
032: setUpperBound(upperBound);
033: }
034:
035: private boolean gearedUp = false;
036: private MfwkPSLogicalComponentAdaptor logicalComponentAdaptor;
037: private MfwkPSServiceAdaptor serviceAdaptor;
038: private MfwkPSRelationAdaptor serviceLogicalComponentRelationAdaptor;
039:
040: public boolean isGearedUp() {
041: return gearedUp;
042: }
043:
044: public void setGearedUp(boolean gearedUp) {
045: this .gearedUp = gearedUp;
046: }
047:
048: public String getLogicalComponentName() {
049: return logicalComponentName;
050: }
051:
052: public void setLogicalComponentName(String logicalComponentName) {
053: this .logicalComponentName = logicalComponentName;
054: }
055:
056: public String getServiceName() {
057: return serviceName;
058: }
059:
060: public void setServiceName(String serviceName) {
061: this .serviceName = serviceName;
062: }
063:
064: public String getServiceSettingName() {
065: return serviceSettingName;
066: }
067:
068: public void setServiceSettingName(String serviceSettingName) {
069: this .serviceSettingName = serviceSettingName;
070: }
071:
072: public String getServiceStatsName() {
073: return serviceStatsName;
074: }
075:
076: public void setServiceStatsName(String serviceStatsName) {
077: this .serviceStatsName = serviceStatsName;
078: }
079:
080: public int getLowerBound() {
081: return lowerBound;
082: }
083:
084: public void setLowerBound(int lowerBound) {
085: this .lowerBound = lowerBound;
086: }
087:
088: public int getUpperBound() {
089: return upperBound;
090: }
091:
092: public void setUpperBound(int upperBound) {
093: this .upperBound = upperBound;
094: }
095:
096: public MfwkPSLogicalComponentAdaptor getLogicalComponentAdaptor() {
097: return logicalComponentAdaptor;
098: }
099:
100: public void setLogicalComponentAdaptor(
101: MfwkPSLogicalComponentAdaptor logicalComponentAdaptor) {
102: this .logicalComponentAdaptor = logicalComponentAdaptor;
103: }
104:
105: public MfwkPSServiceAdaptor getServiceAdaptor() {
106: return serviceAdaptor;
107: }
108:
109: public void setServiceAdaptor(MfwkPSServiceAdaptor serviceAdaptor) {
110: this .serviceAdaptor = serviceAdaptor;
111: }
112:
113: public MfwkPSRelationAdaptor getServiceLogicalComponentRelationAdaptor() {
114: return serviceLogicalComponentRelationAdaptor;
115: }
116:
117: public void setServiceLogicalComponentRelationAdaptor(
118: MfwkPSRelationAdaptor serviceLogicalComponentRelationAdaptor) {
119: this .serviceLogicalComponentRelationAdaptor = serviceLogicalComponentRelationAdaptor;
120: }
121:
122: public void gearUp(
123: MfManagedElementServer mfmeServer,
124: MfRelationType serviceSourceRelation,
125: CIM_ManagedElementInstrum serviceSourceManagedElementInstrum,
126: MfRelationType logicalComponentSourceRelation,
127: CIM_ManagedElementInstrum logicalComponentSourceManagedElementInstrum,
128: MfRelationType serviceLogicalComponentRelation)
129: throws MfManagedElementInstrumException,
130: MfManagedElementServerException, MfRelationInstrumException {
131: setServiceAdaptor(new MfwkPSServiceAdaptor(getServiceName(),
132: getServiceSettingName(), getServiceStatsName(),
133: getLowerBound(), getUpperBound()));
134: getServiceAdaptor().gearUp(mfmeServer, serviceSourceRelation,
135: serviceSourceManagedElementInstrum);
136:
137: setLogicalComponentAdaptor(new MfwkPSLogicalComponentAdaptor(
138: getLogicalComponentName()));
139: getLogicalComponentAdaptor().gearUp(mfmeServer,
140: logicalComponentSourceRelation,
141: logicalComponentSourceManagedElementInstrum);
142:
143: if (serviceLogicalComponentRelation != null) {
144: MfRelationInfo mfrInfo = mfmeServer.makeRelationInfo();
145: mfrInfo
146: .setType(MfRelationType.CMM_SERVICE_LOGICAL_COMPONENT);
147: mfmeServer.createRelation(getServiceAdaptor().getInstrum(),
148: mfrInfo, getLogicalComponentAdaptor().getInstrum());
149: }
150:
151: setGearedUp(true);
152: }
153: }
|