summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authornjames <njames@us.ibm.com>2015-02-19 21:45:37 -0600
committernjames <njames@us.ibm.com>2015-02-19 21:45:37 -0600
commitf54f749ec615ab083e38589d64dbfddd420c7ad4 (patch)
tree1473636f06b727a03ed6bef218673e68504e7ad0 /src
parent6e0e23b9406c748c05fd469387b490efb219df09 (diff)
downloadserverwiz-f54f749ec615ab083e38589d64dbfddd420c7ad4.tar.gz
serverwiz-f54f749ec615ab083e38589d64dbfddd420c7ad4.zip
fix sdr import for apss
Diffstat (limited to 'src')
-rw-r--r--src/com/ibm/ServerWizard2/AttributeEditingSupport.java16
-rw-r--r--src/com/ibm/ServerWizard2/AttributeValueSimple.java2
-rw-r--r--src/com/ibm/ServerWizard2/MainDialog.java6
-rw-r--r--src/com/ibm/ServerWizard2/SdrRecord.java6
-rw-r--r--src/com/ibm/ServerWizard2/SystemModel.java208
-rw-r--r--src/com/ibm/ServerWizard2/Target.java55
-rw-r--r--src/com/ibm/ServerWizard2/TargetWizardController.java70
7 files changed, 173 insertions, 190 deletions
diff --git a/src/com/ibm/ServerWizard2/AttributeEditingSupport.java b/src/com/ibm/ServerWizard2/AttributeEditingSupport.java
index f15e101..99f7234 100644
--- a/src/com/ibm/ServerWizard2/AttributeEditingSupport.java
+++ b/src/com/ibm/ServerWizard2/AttributeEditingSupport.java
@@ -2,10 +2,6 @@ package com.ibm.ServerWizard2;
import java.util.Vector;
-import javax.swing.InputVerifier;
-import javax.swing.event.CellEditorListener;
-import javax.swing.event.ChangeEvent;
-
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.CellEditor;
@@ -19,7 +15,7 @@ import org.eclipse.swt.SWT;
public class AttributeEditingSupport extends EditingSupport {
private CellEditor editor;
private TableViewer viewer;
-
+
public AttributeEditingSupport(TableViewer viewer) {
super(viewer);
this.viewer=viewer;
@@ -57,12 +53,12 @@ public class AttributeEditingSupport extends EditingSupport {
public void applyEditorValue() {
// TODO Auto-generated method stub
-
+
}
public void cancelEditor() {
// TODO Auto-generated method stub
-
+
}
public void editorValueChanged(boolean arg0, boolean arg1) {
@@ -70,15 +66,13 @@ public class AttributeEditingSupport extends EditingSupport {
if (!arg1) {
MessageDialog.openError(null, "Invalid format", editor.getErrorMessage());
}
- System.out.println(arg0+":"+arg1);
-
}
-
+
});
}
return editor;
}
-
+
@Override
protected Object getValue(Object obj) {
Field f = (Field) obj;
diff --git a/src/com/ibm/ServerWizard2/AttributeValueSimple.java b/src/com/ibm/ServerWizard2/AttributeValueSimple.java
index d661ac4..be17a41 100644
--- a/src/com/ibm/ServerWizard2/AttributeValueSimple.java
+++ b/src/com/ibm/ServerWizard2/AttributeValueSimple.java
@@ -8,7 +8,7 @@ public class AttributeValueSimple extends AttributeValue {
private String array = "";
private Field field;
-
+
public AttributeValueSimple(Attribute a) {
super(a);
field = new Field();
diff --git a/src/com/ibm/ServerWizard2/MainDialog.java b/src/com/ibm/ServerWizard2/MainDialog.java
index b83842f..7234b20 100644
--- a/src/com/ibm/ServerWizard2/MainDialog.java
+++ b/src/com/ibm/ServerWizard2/MainDialog.java
@@ -766,7 +766,11 @@ public class MainDialog extends Dialog {
controller.setGlobalSetting(path, attribute.name, "");
controller.setGlobalSetting(path, "INSTANCE_ID", ep.getTargetName());
}
- attributes.add(controller.getGlobalSetting(path, attribute.name));
+ Field field = controller.getGlobalSetting(path, attribute.name);
+ if (field==null) {
+ ServerWizard2.LOGGER.severe("Field Null: "+path+"; "+attribute.name);
+ }
+ attributes.add(field);
}
} else {
for (Field field : attribute.getValue().getFields())
diff --git a/src/com/ibm/ServerWizard2/SdrRecord.java b/src/com/ibm/ServerWizard2/SdrRecord.java
index fe6370e..bb593d8 100644
--- a/src/com/ibm/ServerWizard2/SdrRecord.java
+++ b/src/com/ibm/ServerWizard2/SdrRecord.java
@@ -13,7 +13,7 @@ public class SdrRecord {
private String entityName = "";
public String getAttributeValue() {
- return String.format("0x%02x%02x,0x%02x", sensorType,entityId,sensorId);
+ return String.format("0x%02X%02X,0x%02X", sensorType,entityId,sensorId);
}
public void setTarget(Target target) {
this.target=target;
@@ -30,6 +30,10 @@ public class SdrRecord {
public Integer getSensorId() {
return sensorId;
}
+ public Integer getSensorType() {
+ return sensorType;
+ }
+
public Integer getEntityId() {
return entityId;
}
diff --git a/src/com/ibm/ServerWizard2/SystemModel.java b/src/com/ibm/ServerWizard2/SystemModel.java
index 46fba20..5d4d64e 100644
--- a/src/com/ibm/ServerWizard2/SystemModel.java
+++ b/src/com/ibm/ServerWizard2/SystemModel.java
@@ -76,118 +76,86 @@ public class SystemModel {
public Collection<Target> getTargetInstances() {
return targetInstances.values();
}
- public void importSdr(Target target, HashMap<Integer, HashMap<Integer, Vector<SdrRecord>>> sdrLookup,HashMap<String,Boolean>instCheck,String path) throws Exception {
- if (target==null) {
- for (Target t : this.rootTargets) {
- this.importSdr(t,sdrLookup,instCheck,"/");
- }
- } else {
- String strEntityId = target.getAttribute("ENTITY_ID_LOOKUP");
- if (!strEntityId.isEmpty()) {
- int entityInst = target.getPosition();
- if (entityInst==-1) { entityInst=0; } //units have special position of -1 to maintain assigned name
- String instPath = path+target.getName();
- HashMap<String,Field> inst = this.globalSettings.get(instPath);
-
- if (inst!=null) {
- Field instStr=inst.get("IPMI_INSTANCE");
- if (instStr!=null && instStr.value!=null) {
- if (!instStr.value.isEmpty()) {
- entityInst = Integer.parseInt(instStr.value);
- }
- }
- }
- String key = target.getName()+":"+entityInst;
- Boolean instFound = instCheck.get(key);
- if (instFound!=null) {
- throw new Exception("Duplicate instance id for instance type: \n"+instPath+
- "\n. Make sure each instance has a unique IPMI_INSTANCE attribute.");
- } else {
- instCheck.put(key,true);
+ public void updateIpmiTarget(Target target,int l_entityInst,HashMap<Integer, HashMap<Integer, Vector<SdrRecord>>> sdrLookup,
+ String path) throws Exception {
+ for (String child : target.getAllChildren()) {
+ int entityInst=l_entityInst;
+ Target childTarget = this.getTarget(child);
+ if (childTarget.getAttribute("MRW_TYPE").equals("IPMI_SENSOR") ||
+ childTarget.getAttribute("MRW_TYPE").equals("APSS_SENSOR")) {
+ if (!childTarget.getAttribute("IPMI_INSTANCE").isEmpty()) {
+ entityInst=Integer.decode(childTarget.getAttribute("IPMI_INSTANCE"));
}
- String ids[] = strEntityId.split(",");
-
- String ipmiAttr[] = new String[16];
- for (int i=0;i<16;i++) {
- ipmiAttr[i]="0xFFFF,0xFF";
+ if (childTarget.getAttribute("MRW_TYPE").equals("APSS_SENSOR")) {
+ String id=childTarget.getAttribute("ADC_CHANNEL_ASSIGNMENT");
+ if (!id.isEmpty()) {
+ entityInst=Integer.decode(id)+1;
+ }
}
- //int i=0;
- String nameStr="";
- for (String id : ids) {
- Integer entityId = Integer.decode(id);
- if (entityId>0) {
- HashMap<Integer,Vector<SdrRecord>> sdrMap= sdrLookup.get(entityId);
- if (sdrMap!=null) {
- if (entityId==215) { //APSS is special case
- Integer apss[] = new Integer[16];
- for (int x=0;x<16;x++) {
- Vector<SdrRecord> sdrs = sdrMap.get(x);
- if (sdrs!=null) {
- SdrRecord sdr = sdrs.get(0);
- if (sdr!=null) {
- apss[x]=sdr.getSensorId();
- } else {
- apss[x]=255;
- }
- } else {
- apss[x]=255;
- }
- }
- String apssStr="";
- String sep=",";
- for (int i=0;i<16;i++) {
- if (i==15) { sep=""; }
- apssStr=apssStr+String.format("0x%02X", apss[i])+sep;
- }
- this.setGlobalSetting(instPath, "ADC_CHANNEL_SENSOR_NUMBERS",apssStr);
- } else {
- Vector<SdrRecord> sdrs = sdrMap.get(entityInst);
- if (sdrs!=null) {
- int i=0;
- for (SdrRecord sdr:sdrs ) {
- String msg = "IMPORT MATCH: "+target.getName()+"; "+sdr.toString();
- nameStr=nameStr+sdr.getName()+",";
- ServerWizard2.LOGGER.info(msg);
- this.logData=this.logData+msg+"\n";
- if (i>15) {
- msg="ERROR: There are more than 16 sensors defined for: "+target.getName()+":"+entityInst;
- ServerWizard2.LOGGER.severe(msg);
- throw new Exception(msg);
- }
- ipmiAttr[i]=sdr.getAttributeValue();
- i++;
- }
- } else {
- String msg = ">>IMPORT ERROR: "+target.getName()+"; Entity ID: "+entityId+"; Entity Inst: "+entityInst+" not found in SDR";
- ServerWizard2.LOGGER.warning(msg);
- this.logData=this.logData+msg+"\n";
- }
+ String instPath=path+"/"+childTarget.getName();
+ String entityIdStr = childTarget.getAttribute("IPMI_ENTITY_ID");
+ String sensorTypeStr = childTarget.getAttribute("IPMI_SENSOR_TYPE");
+ int entityId = Integer.decode(entityIdStr);
+ int sensorType = Integer.decode(sensorTypeStr);
+ HashMap<Integer,Vector<SdrRecord>> sdrMap= sdrLookup.get(entityId);
+ if (sdrMap!=null) {
+ Vector<SdrRecord> sdrs = sdrMap.get(entityInst);
+ if (sdrs!=null) {
+ for (SdrRecord sdr:sdrs ) {
+ if (sdr.getSensorType()==sensorType) {
+ String msg = "IMPORT MATCH: "+instPath+"; "+sdr.toString();
+ ServerWizard2.LOGGER.info(msg);
+ this.logData=this.logData+msg+"\n";
+ this.setGlobalSetting(instPath, "IPMI_SENSOR_ID", String.format("0x%02X", sdr.getSensorId()));
}
- } else {
- String msg = ">>IMPORT ERROR: "+target.getName()+"; Entity ID: "+entityId+ " not found in SDR";
+ }
+ } else {
+ if (childTarget.getAttribute("MRW_TYPE").equals("IPMI_SENSOR")) {
+ String msg = ">>IMPORT WARNING: "+instPath+"; Entity ID: "+entityId+"; Entity Inst: "+entityInst+" not found in SDR";
ServerWizard2.LOGGER.warning(msg);
this.logData=this.logData+msg+"\n";
}
}
- //i++;
}
- String ipmiStr="";
- String sep=",";
- Arrays.sort(ipmiAttr);
- for (int i=0;i<16;i++) {
- if (i==15) { sep=""; }
- ipmiStr=ipmiStr+ipmiAttr[i]+sep;
+ }
+ }
+ }
+ public void importSdr2(Target target, HashMap<Integer, HashMap<Integer, Vector<SdrRecord>>> sdrLookup,HashMap<String,Boolean>instCheck,String path) throws Exception {
+ if (target==null) {
+ for (Target t : this.rootTargets) {
+ this.importSdr2(t,sdrLookup,instCheck,"/");
+ }
+ } else {
+ String instPath = path+target.getName();
+ HashMap<String,Field> inst = this.globalSettings.get(instPath);
+ int entityInst=0;
+ if (inst!=null) {
+ Field instStr=inst.get("IPMI_INSTANCE");
+ if (instStr!=null && instStr.value!=null) {
+ if (!instStr.value.isEmpty()) {
+ entityInst = Integer.parseInt(instStr.value);
+ String key = target.getName()+":"+entityInst;
+ Boolean instFound = instCheck.get(key);
+ if (instFound!=null) {
+ throw new Exception("Duplicate instance id for instance type: \n"+instPath+
+ "\n. Make sure each instance has a unique IPMI_INSTANCE attribute.");
+ } else {
+ instCheck.put(key,true);
+ }
+ this.updateIpmiTarget(target,entityInst,sdrLookup,instPath);
+ }
}
- this.setGlobalSetting(instPath, "IPMI_SENSORS",ipmiStr);
- this.setGlobalSetting(instPath, "IPMI_NAME",nameStr);
+ } else if(target.getAttribute("TYPE").equals("APSS")) {
+ this.updateIpmiTarget(target,-1,sdrLookup,instPath);
}
path=path+target.getName()+"/";
for (String child : target.getChildren()) {
Target childTarget = this.getTarget(child);
- this.importSdr(childTarget, sdrLookup,instCheck,path);
+ this.importSdr2(childTarget, sdrLookup,instCheck,path);
}
}
}
+
public Vector<Target> getConnectionCapableTargets() {
Vector<Target> cards = new Vector<Target>();
for (Target target : targetList) {
@@ -304,17 +272,45 @@ public class SystemModel {
} else {
Target target = new Target(targetModel);
target.initBusses(busTypes);
-
target.readInstanceXML(t, targetModels);
- if (this.targetLookup.containsKey(target.getName())) {
+ //if (this.targetLookup.containsKey(target.getName())) {
// ServerWizard2.LOGGER.warning("Duplicate Target: "+target.getName());
- } else {
+ //} else {
this.targetLookup.put(target.getName(), target);
this.targetList.add(target);
- }
+ //}
if (target.getAttribute("CLASS").equals("SYS")) {
this.rootTargets.add(target);
}
+ ///////
+ // Check to see if new children defined in model
+ Target targetInst = this.targetInstances.get(target.getType());
+ if (targetInst != null) {
+ HashMap <String,Boolean> childTest = new HashMap<String,Boolean>();
+ for (String child : target.getAllChildren()) {
+ childTest.put(child, true);
+ }
+ for (String child : targetInst.getChildren()) {
+ if (childTest.get(child)==null) {
+ target.addChild(child, false);
+ if (!this.targetLookup.containsKey(child)) {
+ this.targetLookup.put(child, target);
+ this.targetList.add(target);
+ }
+ childTest.put(child, true);
+ }
+ }
+ for (String child : targetInst.getHiddenChildren()) {
+ if (childTest.get(child)==null) {
+ target.addChild(child, true);
+ if (!this.targetLookup.containsKey(child)) {
+ this.targetLookup.put(child,target);
+ this.targetList.add(target);
+ }
+ childTest.put(child, true);
+ }
+ }
+ }
}
} else {
throw new Exception("Empty Target Type");
@@ -337,7 +333,7 @@ public class SystemModel {
}
}
- public void setGlobalSetting(String path, String attribute, String value) {
+ public Field setGlobalSetting(String path, String attribute, String value) {
HashMap<String, Field> s = globalSettings.get(path);
if (s == null) {
s = new HashMap<String, Field>();
@@ -350,14 +346,20 @@ public class SystemModel {
s.put(attribute, f);
}
f.value = value;
+ return f;
}
public Field getGlobalSetting(String path, String attribute) {
HashMap<String, Field> s = globalSettings.get(path);
if (s == null) {
- return null;
+ Field f=this.setGlobalSetting(path, attribute, "");
+ return f;
+ }
+ Field f=s.get(attribute);
+ if (f==null) {
+ f=this.setGlobalSetting(path, attribute, "");
}
- return s.get(attribute);
+ return f;
}
public HashMap<String, Field> getGlobalSettings(String path) {
diff --git a/src/com/ibm/ServerWizard2/Target.java b/src/com/ibm/ServerWizard2/Target.java
index 01e8135..bd17995 100644
--- a/src/com/ibm/ServerWizard2/Target.java
+++ b/src/com/ibm/ServerWizard2/Target.java
@@ -11,7 +11,7 @@ import org.w3c.dom.NodeList;
public class Target implements Comparable<Target>, java.io.Serializable {
private static final long serialVersionUID = 1L;
-
+
private String name = "";
private String type = "";
private int position = -1;
@@ -28,7 +28,7 @@ public class Target implements Comparable<Target>, java.io.Serializable {
private Boolean busInited=false;
private Boolean hidden = false;
private HashMap<String,Boolean> childrenBusTypes = new HashMap<String,Boolean>();
-
+
public Target() {
}
@@ -40,7 +40,7 @@ public class Target implements Comparable<Target>, java.io.Serializable {
this.hidden = s.hidden;
this.parentType.addAll(s.parentType);
this.isLibraryTarget=s.isLibraryTarget;
-
+
for (Map.Entry<String, Attribute> entry : s.getAttributes().entrySet()) {
String key = new String(entry.getKey());
Attribute value = new Attribute(entry.getValue());
@@ -50,7 +50,7 @@ public class Target implements Comparable<Target>, java.io.Serializable {
public TreeMap<Target,Vector<Connection>> getBusses() {
return busses;
}
-
+
public void hide(Boolean h) {
this.hidden=h;
}
@@ -78,12 +78,21 @@ public class Target implements Comparable<Target>, java.io.Serializable {
public void setName(String name) {
this.name = name;
}
-
+
////////////////////////////////////////////
// Target children handling
public Vector<String> getChildren() {
return this.children;
}
+ public Vector<String> getHiddenChildren() {
+ return this.childrenHidden;
+ }
+ public Vector<String> getAllChildren() {
+ Vector<String> all = new Vector<String>();
+ all.addAll(this.children);
+ all.addAll(this.childrenHidden);
+ return all;
+ }
public void copyChildren(Target t) {
for (String c : t.children) {
this.children.add(c);
@@ -95,7 +104,7 @@ public class Target implements Comparable<Target>, java.io.Serializable {
public void removeChildren(String child) {
children.remove(child);
childrenHidden.remove(child);
- }
+ }
public void addChild(String child,boolean hidden) {
if (hidden) {
childrenHidden.add(child);
@@ -214,7 +223,7 @@ public class Target implements Comparable<Target>, java.io.Serializable {
attribute.getValue().setValue(value);
}
public Boolean isInput() {
- String dir = this.getAttribute("DIRECTION");
+ String dir = this.getAttribute("DIRECTION");
if (dir.equals("IN") || dir.equals("INOUT")) {
return true;
}
@@ -268,8 +277,8 @@ public class Target implements Comparable<Target>, java.io.Serializable {
Target t = (Target)arg0;
return this.getType().compareTo(t.getType());
}
-
-
+
+
///////////////////////////////////////////////////
// connection/bus handling
public Boolean isBusHidden(String busType) {
@@ -297,7 +306,7 @@ public class Target implements Comparable<Target>, java.io.Serializable {
}
}
return this.childrenBusTypes;
- }
+ }
public Connection addConnection(Target busTarget,ConnectionEndpoint source,ConnectionEndpoint dest, boolean cabled) {
if (busTarget==null || source==null || dest==null) {
//TODO: error message
@@ -324,13 +333,13 @@ public class Target implements Comparable<Target>, java.io.Serializable {
public void initBusses(Vector<Target> v) {
if (busInited) { return; }
this.busInited=true;
-
+
for (Target s : v) {
Vector<Connection> connections = new Vector<Connection>();
this.busses.put(s, connections);
}
}
-
+
////////////////////////////////////////////////////
// XML file handling
public void readModelXML(Element target, HashMap<String, Attribute> attrMap) {
@@ -376,26 +385,26 @@ public class Target implements Comparable<Target>, java.io.Serializable {
setPosition(tmpPos);
}
}
-
+
NodeList childList = t.getElementsByTagName("child_id");
for (int j = 0; j < childList.getLength(); ++j) {
Element attr = (Element) childList.item(j);
//TargetName targetName = new TargetName(attr.getFirstChild().getNodeValue(),false);
children.add(attr.getFirstChild().getNodeValue());
- }
+ }
childList = t.getElementsByTagName("hidden_child_id");
for (int j = 0; j < childList.getLength(); ++j) {
Element attr = (Element) childList.item(j);
//argetName targetName = new TargetName(attr.getFirstChild().getNodeValue(),true);
childrenHidden.add(attr.getFirstChild().getNodeValue());
- }
+ }
NodeList attrList = t.getElementsByTagName("attribute");
for (int j = 0; j < attrList.getLength(); ++j) {
Element attr = (Element) attrList.item(j);
String id = SystemModel.getElement(attr, "id");
Attribute a = attributes.get(id);
- if (a==null) {
+ if (a==null) {
ServerWizard2.LOGGER.info("Attribute dropped: "+id+" from "+this.getName());
} else {
a.value.readInstanceXML(attr);
@@ -431,7 +440,7 @@ public class Target implements Comparable<Target>, java.io.Serializable {
} else {
out.write("\t<instance_name>" + this.getIdPrefix() + "</instance_name>\n");
}
-
+
out.write("\t<position>" + getPosition() + "</position>\n");
//write children
for (String childStr : this.children) {
@@ -439,12 +448,12 @@ public class Target implements Comparable<Target>, java.io.Serializable {
}
for (String childStr : this.childrenHidden) {
out.write("\t<hidden_child_id>"+childStr+"</hidden_child_id>\n");
- }
+ }
//write attributes
for (Map.Entry<String, Attribute> entry : getAttributes().entrySet()) {
Attribute attr = new Attribute(entry.getValue());
attr.writeInstanceXML(out);
-
+
}
//write busses
for (Map.Entry<Target, Vector<Connection>> entry : busses.entrySet()) {
@@ -453,15 +462,11 @@ public class Target implements Comparable<Target>, java.io.Serializable {
}
}
out.write("</targetInstance>\n");
-
+
//recursively write children
- for (String childStr : this.children) {
+ for (String childStr : this.getAllChildren()) {
Target child = targetLookup.get(childStr);
child.writeInstanceXML(out, targetLookup, targetWritten);
}
- for (String childStr : this.childrenHidden) {
- Target child = targetLookup.get(childStr);
- child.writeInstanceXML(out, targetLookup, targetWritten);
- }
}
}
diff --git a/src/com/ibm/ServerWizard2/TargetWizardController.java b/src/com/ibm/ServerWizard2/TargetWizardController.java
index e103d76..3695265 100644
--- a/src/com/ibm/ServerWizard2/TargetWizardController.java
+++ b/src/com/ibm/ServerWizard2/TargetWizardController.java
@@ -39,7 +39,7 @@ public class TargetWizardController implements PropertyChangeListener {
try {
xmlLib.loadModel(model);
this.initModel();
-
+
} catch (Exception e) {
String btns[] = { "Close" };
ServerWizard2.LOGGER.severe(e.getMessage());
@@ -49,12 +49,12 @@ public class TargetWizardController implements PropertyChangeListener {
e.printStackTrace();
System.exit(4);
}
-
+
}
public void initModel() throws Exception {
model.deleteAllInstances();
model.addUnitInstances();
-
+
String parentTargetName = "sys-sys-power8";
Target parentTarget = model.getTargetModels().get(parentTargetName);
if (parentTarget == null) {
@@ -64,15 +64,16 @@ public class TargetWizardController implements PropertyChangeListener {
// Create root instance
Target sys = new Target(parentTarget);
sys.setPosition(0);
- model.addTarget(null, sys);
+ this.addTargetInstance(sys, null, null, "");
+ //model.addTarget(null, sys);
}
-
+
public void importSDR(String filename) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-
+
Vector<SdrRecord> sdrs = new Vector<SdrRecord>();
HashMap<Integer,HashMap<Integer,Vector<SdrRecord>>> sdrLookup = new HashMap<Integer,HashMap<Integer,Vector<SdrRecord>>>();
-
+
try {
DocumentBuilder builder = factory.newDocumentBuilder();
builder.setErrorHandler(new XmlHandler());
@@ -108,7 +109,7 @@ public class TargetWizardController implements PropertyChangeListener {
try {
HashMap<String,Boolean> instCheck = new HashMap<String,Boolean>();
model.logData="";
- model.importSdr(null,sdrLookup,instCheck,"");
+ model.importSdr2(null,sdrLookup,instCheck,"");
LogViewerDialog dlg = new LogViewerDialog(null);
dlg.setData(model.logData);
dlg.open();
@@ -117,35 +118,8 @@ public class TargetWizardController implements PropertyChangeListener {
MessageDialog.openError(null, "SDR Import Error", e.getMessage());
e.printStackTrace();
}
- /*
- HashMap<Target,Vector<String>> ipmiAttr = new HashMap<Target,Vector<String>>();
- for (SdrRecord sdr : sdrs){
- Target t = sdr.getTarget();
- Vector<String> ipmiSensors = ipmiAttr.get(t);
- if (ipmiSensors==null) {
- ipmiSensors = new Vector<String>();
- ipmiAttr.put(t, ipmiSensors);
- }
- ipmiSensors.add(String.format("0x%02x", sdr.getEntityId())+","+
- String.format("0x%02x", sdr.getSensorId()));
+ }
- //System.out.println(t.getName()+","+ipmiSensors);
- }
- for (Map.Entry<Target, Vector<String>> entry : ipmiAttr.entrySet()) {
- Target t=entry.getKey();
- String ipmiStr = "";
- Vector<String> attrs = entry.getValue();
- for (String a : attrs) {
- ipmiStr = ipmiStr+a+",";
- }
- for (int i=attrs.size();i<16;i++) {
- ipmiStr = ipmiStr+"0xFF,0xFF,";
- }
- //t.setAttributeValue("IPMI_SENSORS", ipmiStr);
-
- }*/
- }
-
public Target getTargetModel(String type) {
return model.getTargetModel(type);
}
@@ -171,7 +145,7 @@ public class TargetWizardController implements PropertyChangeListener {
return true;
}
-
+
public void deleteTarget(Target target) {
//model.deleteTarget(target, model.rootTarget);
model.deleteTarget(target);
@@ -179,9 +153,9 @@ public class TargetWizardController implements PropertyChangeListener {
public void addTargetInstance(Target targetModel, Target parentTarget,
TreeItem parentItem,String nameOverride) {
-
+
Target targetInstance;
- Target instanceCheck = model.getTargetInstance(targetModel.getType());
+ Target instanceCheck = model.getTargetInstance(targetModel.getType());
if (instanceCheck!=null) {
//target instance found of this model type
targetInstance = new Target(instanceCheck);
@@ -200,7 +174,7 @@ public class TargetWizardController implements PropertyChangeListener {
}
public Target copyTargetInstance(Target target, Target parentTarget,Boolean incrementPosition) {
Target newTarget = new Target(target);
- if (incrementPosition) {
+ if (incrementPosition) {
newTarget.setPosition(newTarget.getPosition()+1);
newTarget.setSpecialAttributes();
}
@@ -254,14 +228,14 @@ public class TargetWizardController implements PropertyChangeListener {
}
public HashMap<String,Field> getGlobalSettings(String path) {
return model.getGlobalSettings(path);
- }
+ }
public Vector<Target> getChildTargets(Target target) {
//if (target.instanceModel) {
// return model.getChildTargetTypes("");
//}
return model.getChildTargetTypes(target.getType());
}
-
+
public void hideBusses(Target target) {
target.hideBusses(model.getTargetLookup());
}
@@ -287,7 +261,7 @@ public class TargetWizardController implements PropertyChangeListener {
public void runChecks(String filename) {
String includePath = LibraryManager.getWorkingDir()+"scripts";
String script = LibraryManager.getWorkingDir()+"scripts"+System.getProperty("file.separator")+"processMrw.pl";
-
+
String commandLine[] = {
"perl",
"-I",
@@ -306,16 +280,16 @@ public class TargetWizardController implements PropertyChangeListener {
String msg="";
try {
final ProcessBuilder builder = new ProcessBuilder(commandLine).redirectErrorStream(true);
-
+
final Process process = builder.start();
final StringWriter writer = new StringWriter();
-
+
new Thread(new Runnable() {
public void run() {
char[] buffer = new char[1024];
int len;
InputStreamReader in = new InputStreamReader(process.getInputStream());
-
+
try {
while ((len = in.read(buffer)) != -1) {
writer.write(buffer, 0, len);
@@ -326,7 +300,7 @@ public class TargetWizardController implements PropertyChangeListener {
}
}
}).start();
-
+
final int exitValue = process.waitFor();
final String processOutput = writer.toString();
ServerWizard2.LOGGER.info(processOutput);
@@ -340,6 +314,6 @@ public class TargetWizardController implements PropertyChangeListener {
}
public void propertyChange(PropertyChangeEvent arg0) {
- //view.setDirtyState(true);
+ //view.setDirtyState(true);
}
} \ No newline at end of file
OpenPOWER on IntegriCloud