01: /*
02: * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.desktop.mfwk;
06:
07: import com.sun.cmm.cim.OperationalStatus;
08: import com.sun.mfwk.instrum.me.CIM_ManagedElementInstrum;
09: import com.sun.mfwk.instrum.me.CMM_LogicalComponentInstrum;
10: import com.sun.mfwk.instrum.me.MfManagedElementInstrumException;
11: import com.sun.mfwk.instrum.relations.MfRelationInstrumException;
12: import com.sun.mfwk.instrum.server.MfManagedElementInfo;
13: import com.sun.mfwk.instrum.server.MfManagedElementServer;
14: import com.sun.mfwk.instrum.server.MfManagedElementServerException;
15: import com.sun.mfwk.instrum.server.MfManagedElementType;
16: import com.sun.mfwk.instrum.server.MfRelationType;
17: import java.util.Arrays;
18: import java.util.HashSet;
19:
20: public class MfwkPSLogicalComponentAdaptor {
21: private String name;
22:
23: public MfwkPSLogicalComponentAdaptor(String name) {
24: setName(name);
25: }
26:
27: private MfManagedElementInfo info;
28: private MfwkPSRelationAdaptor relation;
29:
30: public String getName() {
31: return name;
32: }
33:
34: public void setName(String name) {
35: this .name = name;
36: }
37:
38: public MfManagedElementInfo getInfo() {
39: return info;
40: }
41:
42: public void setInfo(MfManagedElementInfo info) {
43: this .info = info;
44: }
45:
46: public MfwkPSRelationAdaptor getRelation() {
47: return relation;
48: }
49:
50: public void setRelation(MfwkPSRelationAdaptor relation) {
51: this .relation = relation;
52: }
53:
54: public void gearUp(MfManagedElementServer mfmeServer,
55: MfRelationType relationType,
56: CIM_ManagedElementInstrum sourceManagedElementInstrum)
57: throws MfManagedElementInstrumException,
58: MfManagedElementServerException, MfRelationInstrumException {
59: setInfo(mfmeServer.makeManagedElementInfo());
60: getInfo().setName(getName());
61: getInfo().setType(MfManagedElementType.CMM_LOGICAL_COMPONENT);
62: setRelation(new MfwkPSRelationAdaptor(relationType,
63: sourceManagedElementInstrum));
64: getRelation().gearUp(mfmeServer, getInfo());
65: OperationalStatus[] operationalStatus = new OperationalStatus[] { OperationalStatus.OK };
66: getInstrum().setOperationalStatus(
67: new HashSet(Arrays.asList(operationalStatus)));
68: }
69:
70: public CMM_LogicalComponentInstrum getInstrum()
71: throws MfRelationInstrumException {
72: return (CMM_LogicalComponentInstrum) getRelation().getInstrum()
73: .getDestination();
74: }
75: }
|