Source code: com/dell/wsdm/demos/interop/x2005/x04/IpmiserverResource.java
1 package com.dell.wsdm.demos.interop.x2005.x04;
2
3 import org.apache.ws.muws.v1_0.capability.ConfigurationCapability;
4 import org.apache.ws.muws.v1_0.capability.IdentityCapability;
5 import org.apache.ws.muws.v1_0.capability.OperationalStatusCapability;
6 import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManageabilityCapabilityDocument;
7 import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ResourceIdDocument;
8 import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.CurrentTimeDocument;
9 import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument;
10
11 import java.util.Calendar;
12
13 /**
14 * A Ipmiserver WS-Resource.
15 * <p/>
16 * NOTE: This class is generated but IS meant to be modified.
17 */
18 public class IpmiserverResource extends AbstractIpmiserverResource
19
20 {
21 /**
22 * A NamespaceVerionHolder which maintains the QNames of Spec Wsdls
23 */
24 public static final org.apache.ws.muws.v1_0.impl.WsdmNamespaceVersionHolderImpl SPEC_NAMESPACE_SET = new org.apache.ws.muws.v1_0.impl.WsdmNamespaceVersionHolderImpl();
25
26 /**
27 * Initializes this resource's state (properties, etc.).
28 */
29 public void init()
30 {
31 super.init();
32
33 /**
34 * The ResourcePropertySet which contains all the defined ResourceProperties
35 */
36 org.apache.ws.resource.properties.ResourcePropertySet resourcePropertySet = getResourcePropertySet();
37 org.apache.ws.resource.properties.ResourceProperty resourceProperty = null;
38
39 try
40 {
41
42 /*===== Capabilities =====*/
43 //Management Characteristics
44 resourceProperty = resourcePropertySet.get(IpmiserverPropertyQNames.MANAGEABILITYCAPABILITY);
45
46 //muws:Identity Capability
47 ManageabilityCapabilityDocument manageabilityCapabilityDocument = ManageabilityCapabilityDocument.Factory.newInstance();
48 manageabilityCapabilityDocument.setManageabilityCapability(IdentityCapability.URI);
49 resourceProperty.add(manageabilityCapabilityDocument);
50
51 //muws:OperationalStatus Capability
52 manageabilityCapabilityDocument = ManageabilityCapabilityDocument.Factory.newInstance();
53 manageabilityCapabilityDocument.setManageabilityCapability(OperationalStatusCapability.URI);
54 resourceProperty.add(manageabilityCapabilityDocument);
55
56 //muws:Configuration Capability
57 manageabilityCapabilityDocument = ManageabilityCapabilityDocument.Factory.newInstance();
58 manageabilityCapabilityDocument.setManageabilityCapability(ConfigurationCapability.URI);
59 resourceProperty.add(manageabilityCapabilityDocument);
60
61 //Server Configuration
62 manageabilityCapabilityDocument = ManageabilityCapabilityDocument.Factory.newInstance();
63 manageabilityCapabilityDocument.setManageabilityCapability(IpmiserverPropertyQNames.ATTENTIONLEDON.getNamespaceURI() + "/ServerConfiguration");
64 resourceProperty.add(manageabilityCapabilityDocument);
65
66 //Server Chassis Configuration
67 manageabilityCapabilityDocument = ManageabilityCapabilityDocument.Factory.newInstance();
68 manageabilityCapabilityDocument.setManageabilityCapability(IpmiserverPropertyQNames.ATTENTIONLEDON.getNamespaceURI() + "/ServerChassisConfiguration");
69 resourceProperty.add(manageabilityCapabilityDocument);
70
71 //Server Alert Status
72 manageabilityCapabilityDocument = ManageabilityCapabilityDocument.Factory.newInstance();
73 manageabilityCapabilityDocument.setManageabilityCapability(IpmiserverPropertyQNames.ATTENTIONLEDON.getNamespaceURI() + "/ServerAlertStatus");
74 resourceProperty.add(manageabilityCapabilityDocument);
75
76 /*===== Properties =====*/
77 resourceProperty = resourcePropertySet.get(IpmiserverPropertyQNames.RESOURCEID);
78 ResourceIdDocument resourceIdDocument = ResourceIdDocument.Factory.newInstance();
79 resourceIdDocument.setResourceId("urn:" + (String) getID());
80 resourceProperty.add(resourceIdDocument);
81
82 // CurrentTime is done like in Apollo
83 resourceProperty = resourcePropertySet.get(IpmiserverPropertyQNames.CURRENTTIME);
84 CurrentTimeDocument currentTimeDocument = CurrentTimeDocument.Factory.newInstance();
85 currentTimeDocument.setCurrentTime(Calendar.getInstance());
86 resourceProperty.add(currentTimeDocument);
87 resourceProperty.setCallback(new org.apache.ws.resource.lifetime.callback.CurrentTimeCallback());
88
89 resourceProperty = resourcePropertySet.get(IpmiserverPropertyQNames.OPERATIONALSTATUS);
90 OperationalStatusDocument operationalStatusDocument = OperationalStatusDocument.Factory.newInstance();
91 operationalStatusDocument.setOperationalStatus(OperationalStatusDocument.OperationalStatus.AVAILABLE);
92 resourceProperty.add(operationalStatusDocument);
93
94 /*============= Custom props =============*/
95 resourceProperty = resourcePropertySet.get(IpmiserverPropertyQNames.ATTENTIONLEDON);
96 AttentionLedOnDocument attentionLedOnDoc = AttentionLedOnDocument.Factory.newInstance();
97 attentionLedOnDoc.setAttentionLedOn(false); // NOTE: in an ideal world, we would make an IPMI API call to get the value for this prop
98 resourceProperty.add(attentionLedOnDoc);
99
100 resourceProperty = resourcePropertySet.get(IpmiserverPropertyQNames.COVEROPEN);
101 CoverOpenDocument coverOpenDoc = CoverOpenDocument.Factory.newInstance();
102 coverOpenDoc.setCoverOpen(false); // NOTE: in an ideal world, we would make an IPMI API call to get the value for this prop
103 resourceProperty.add(coverOpenDoc);
104
105 resourceProperty = resourcePropertySet.get(IpmiserverPropertyQNames.IPNAME);
106 IpNameDocument ipNameDoc = IpNameDocument.Factory.newInstance();
107 ipNameDoc.setIpName("MuwsMama");
108 resourceProperty.add(ipNameDoc);
109
110 resourceProperty = resourcePropertySet.get(IpmiserverPropertyQNames.MODELNAME);
111 ModelNameDocument modelNameDoc = ModelNameDocument.Factory.newInstance();
112 modelNameDoc.setModelName("PowerEdge 2850");
113 resourceProperty.add(modelNameDoc);
114
115 resourceProperty = resourcePropertySet.get(IpmiserverPropertyQNames.SERIALNUMBER);
116 SerialNumberDocument serialNumberDoc = SerialNumberDocument.Factory.newInstance();
117 serialNumberDoc.setSerialNumber("Z10007986D");
118 resourceProperty.add(serialNumberDoc);
119
120 resourceProperty = resourcePropertySet.get(IpmiserverPropertyQNames.SYSCONTACT);
121 SysContactDocument sysContactDoc = SysContactDocument.Factory.newInstance();
122 sysContactDoc.setSysContact("Eric Cartman");
123 resourceProperty.add(sysContactDoc);
124
125 }
126 catch (Exception e)
127 {
128 throw new javax.xml.rpc.JAXRPCException("There was a problem in initializing your resource properties. Please check your init() method. Cause: " + e.getLocalizedMessage());
129 }
130 // Resource Property {http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd}FixedTopicSet is implemented by the framework.
131 // Resource Property {http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd}Topic is implemented by the framework.
132 // Resource Property {http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd}TopicExpressionDialects is implemented by the framework.
133
134
135
136 /**
137 * This method call will make all resource properties be exposed
138 * as Topics. If you would like to change that behaviour you can
139 * call TopicUtils.addResourcePropertyValueChangeTopic for each
140 * Topic you'd like to expose property change notifications for.
141 */
142 try
143 {
144 org.apache.ws.notification.topics.util.TopicUtils.addResourcePropertyValueChangeTopics(getResourcePropertySet(), getTopicSpaceSet());
145 }
146 catch (Exception e)
147 {
148 throw new javax.xml.rpc.JAXRPCException("Unable to init the ResourceProperty Changed topics. Cause: " + e.getLocalizedMessage(), e);
149 }
150
151 /**
152 * Initializes the Topic, TopicExpressionDialects and FixedTopicSet resource properties
153 *
154 * </br>
155 * <strong>NOTE this MUST be called last in the Resource.init() method to ensure all topics get registered</strong>
156 * </br>
157 * FixedTopicSet will be set based on the value returned from the {@see TopicSpaceSet#isFixed()} method.
158 * </br>
159 * Topic will have all root topics in the TopicSpaceSet, set to Simple dialect AND all child topics set ot
160 * Concrete dialect.
161 * </br>
162 *
163 * TopicExpressionDialects will be set to the engine's known Topic Dialects acquired from the TopicExpressionEngine
164 *
165 * @param topicSpaceSet
166 * @param propSet
167 */
168 org.apache.ws.notification.topics.util.TopicUtils.initNotificationProducerProperties(getTopicSpaceSet(), getResourcePropertySet());
169 }
170
171 }