Skip to content

Commit 79107c6

Browse files
committed
Start using hostboot attribute_types.xml and attribute_types_hb.xml
directly in build
1 parent 2595b33 commit 79107c6

File tree

7 files changed

+6
-17389
lines changed

7 files changed

+6
-17389
lines changed

.settings/org.eclipse.jdt.core.prefs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
eclipse.preferences.version=1
22
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
33
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
4-
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
4+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
55
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6-
org.eclipse.jdt.core.compiler.compliance=1.5
6+
org.eclipse.jdt.core.compiler.compliance=1.7
77
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
88
org.eclipse.jdt.core.compiler.debug.localVariable=generate
99
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
1010
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
1111
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12-
org.eclipse.jdt.core.compiler.source=1.5
12+
org.eclipse.jdt.core.compiler.source=1.7

build.xml

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<project>
33
<property name="one-jar.dist.dir" value="c:/one-jar-ant"/>
44
<property name="plugin.dir" value="C:\eclipse\plugins"/>
5+
<property name="hbxml.dir" value="C:\Users\IBM_ADMIN\git\hostboot\src\usr\targeting\common\xmltohb"/>
56
<import file="${one-jar.dist.dir}/one-jar-ant-task.xml" optional="true" />
67
<path id="classpath">
78
<fileset dir="lib" includes="**/*.jar"/>
@@ -68,8 +69,8 @@
6869
</lib>
6970
</one-jar>
7071
<zip destfile="build/serverwiz2_lib.zip">
71-
<zipfileset dir="xml/" includes="attribute_types.xml" fullpath="xml/attribute_types.xml"/>
72-
<zipfileset dir="xml/" includes="attribute_types_hb.xml" fullpath="xml/attribute_types_hb.xml"/>
72+
<zipfileset dir="${hbxml.dir}/" includes="attribute_types.xml" fullpath="xml/attribute_types.xml"/>
73+
<zipfileset dir="${hbxml.dir}/" includes="attribute_types_hb.xml" fullpath="xml/attribute_types_hb.xml"/>
7374
<zipfileset dir="xml/" includes="attribute_types_mrw.xml" fullpath="xml/attribute_types_mrw.xml"/>
7475
<zipfileset dir="xml/" includes="target_types_mrw.xml" fullpath="xml/target_types_mrw.xml"/>
7576
<zipfileset dir="xml/" includes="target_instances_v3.xml" fullpath="xml/target_instances_v3.xml"/>

src/com/ibm/ServerWizard2/MainDialog.java

-20
Original file line numberDiff line numberDiff line change
@@ -425,26 +425,6 @@ public void widgetSelected(SelectionEvent e) {
425425
btnSaveAs.setFont(SWTResourceManager.getFont("Arial", 9, SWT.NORMAL));
426426
btnSaveAs.setEnabled(true);
427427

428-
Button btnImportSDR = createButton(parent, IDialogConstants.NO_ID, "Import SDR", false);
429-
btnImportSDR.addSelectionListener(new SelectionAdapter() {
430-
@Override
431-
public void widgetSelected(SelectionEvent e) {
432-
Button b = (Button) e.getSource();
433-
FileDialog fdlg = new FileDialog(b.getShell(), SWT.OPEN);
434-
String ext[] = { "*.xml" };
435-
fdlg.setFilterExtensions(ext);
436-
String filename = fdlg.open();
437-
if (filename == null) {
438-
return;
439-
}
440-
controller.importSDR(filename);
441-
setDirtyState(true);
442-
}
443-
});
444-
445-
btnImportSDR.setFont(SWTResourceManager.getFont("Arial", 9, SWT.NORMAL));
446-
btnImportSDR.setEnabled(true);
447-
448428
btnRunChecks = createButton(parent, IDialogConstants.NO_ID, "Run Checks", false);
449429
btnRunChecks.addSelectionListener(new SelectionAdapter() {
450430
@Override

src/com/ibm/ServerWizard2/SystemModel.java

-104
Original file line numberDiff line numberDiff line change
@@ -75,110 +75,6 @@ public Vector<Target> getTargetList() {
7575
public Collection<Target> getTargetInstances() {
7676
return targetInstances.values();
7777
}
78-
public void updateIpmiTarget(Target target,int l_entityInst,HashMap<Integer, HashMap<Integer, Vector<SdrRecord>>> sdrLookup,
79-
String path) throws Exception {
80-
for (String child : target.getAllChildren()) {
81-
int entityInst=l_entityInst;
82-
Target childTarget = this.getTarget(child);
83-
if (childTarget.getAttribute("MRW_TYPE").equals("IPMI_SENSOR") ||
84-
childTarget.getAttribute("MRW_TYPE").equals("APSS_SENSOR")) {
85-
if (!childTarget.getAttribute("IPMI_INSTANCE").isEmpty()) {
86-
entityInst=Integer.decode(childTarget.getAttribute("IPMI_INSTANCE"));
87-
}
88-
if (childTarget.getAttribute("MRW_TYPE").equals("APSS_SENSOR")) {
89-
String id=childTarget.getAttribute("ADC_CHANNEL_ASSIGNMENT");
90-
if (!id.isEmpty()) {
91-
entityInst=Integer.decode(id)+1;
92-
}
93-
}
94-
String instPath=path+"/"+childTarget.getName();
95-
String entityIdStr = childTarget.getAttribute("IPMI_ENTITY_ID");
96-
String sensorTypeStr = childTarget.getAttribute("IPMI_SENSOR_TYPE");
97-
int entityId = Integer.decode(entityIdStr);
98-
int sensorType = Integer.decode(sensorTypeStr);
99-
HashMap<Integer,Vector<SdrRecord>> sdrMap= sdrLookup.get(entityId);
100-
if (sdrMap!=null) {
101-
Vector<SdrRecord> sdrs = sdrMap.get(entityInst);
102-
if (sdrs!=null) {
103-
for (SdrRecord sdr:sdrs ) {
104-
if (sdr.getSensorType()==sensorType) {
105-
String msg = "MATCH: "+childTarget.getName()+"; "+sdr.toString();
106-
this.logData=this.logData+msg+"\n";
107-
this.setGlobalSetting(instPath, "IPMI_SENSOR_ID", String.format("0x%02X", sdr.getSensorId()));
108-
}
109-
}
110-
} else {
111-
if (entityInst!=-1) {
112-
String msg = ">> WARNING: "+childTarget.getName()+"; Entity ID: "+entityId+"; Entity Inst: "+entityInst+" not found in SDR";
113-
this.logData=this.logData+msg+"\n";
114-
this.setGlobalSetting(instPath, "IPMI_SENSOR_ID", "");
115-
}
116-
}
117-
}
118-
}
119-
}
120-
}
121-
public void importSdr2(Target target, HashMap<Integer, HashMap<Integer, Vector<SdrRecord>>> sdrLookup,HashMap<String,Integer>instCheck,String path) throws Exception {
122-
if (target==null) {
123-
for (Target t : this.rootTargets) {
124-
this.importSdr2(t,sdrLookup,instCheck,"/");
125-
}
126-
} else {
127-
String instPath = path+target.getName();
128-
String type = target.getAttribute("TYPE");
129-
if (type.equals("APSS")) {
130-
String msg="\n========================================================\n";
131-
msg=msg+"IPMI TARGET: "+instPath+" (APSS)";
132-
this.logData=this.logData+msg+"\n";
133-
this.updateIpmiTarget(target,-1,sdrLookup,instPath);
134-
} else {
135-
if (target.isAttribute("FRU_NAME")) {
136-
Integer entityInst = instCheck.get(type);
137-
if (entityInst == null) {
138-
entityInst=-1;
139-
}
140-
entityInst++;
141-
instCheck.put(type,entityInst);
142-
this.setGlobalSetting(instPath, "IPMI_INSTANCE", entityInst.toString());
143-
if (this.getGlobalSetting(instPath, "FRU_NAME").value.isEmpty()) {
144-
this.setGlobalSetting(instPath,"FRU_NAME", type+entityInst);
145-
}
146-
String msg="\n========================================================\n";
147-
msg=msg+"IPMI TARGET: "+instPath+"; IPMI_INSTANCE="+entityInst+"; FRU_NAME="+this.getGlobalSetting(instPath, "FRU_NAME").value;
148-
this.logData=this.logData+msg+"\n";
149-
this.updateIpmiTarget(target,entityInst,sdrLookup,instPath);
150-
}
151-
}
152-
/*
153-
HashMap<String,Field> inst = this.globalSettings.get(instPath);
154-
int entityInst=0;
155-
if (inst!=null) {
156-
Field instStr=inst.get("IPMI_INSTANCE");
157-
if (instStr!=null && instStr.value!=null) {
158-
if (!instStr.value.isEmpty()) {
159-
entityInst = Integer.parseInt(instStr.value);
160-
//String key = target.getName()+":"+entityInst;
161-
Boolean = instCheck.get(target.getAttribute("TYPE"));
162-
if (instFound!=null) {
163-
throw new Exception("Duplicate instance id for instance type: \n"+instPath+
164-
"\n. Make sure each instance has a unique IPMI_INSTANCE attribute.");
165-
} else {
166-
instCheck.put(key,true);
167-
}
168-
this.updateIpmiTarget(target,entityInst,sdrLookup,instPath);
169-
}
170-
}
171-
} else if(target.getAttribute("TYPE").equals("APSS")) {
172-
this.updateIpmiTarget(target,-1,sdrLookup,instPath);
173-
}*/
174-
175-
path=path+target.getName()+"/";
176-
for (String child : target.getChildren()) {
177-
Target childTarget = this.getTarget(child);
178-
this.importSdr2(childTarget, sdrLookup,instCheck,path);
179-
}
180-
}
181-
}
18278

18379
public Vector<Target> getConnectionCapableTargets() {
18480
Vector<Target> cards = new Vector<Target>();

src/com/ibm/ServerWizard2/TargetWizardController.java

-49
Original file line numberDiff line numberDiff line change
@@ -60,55 +60,6 @@ public void initModel() throws Exception {
6060
//model.addTarget(null, sys);
6161
}
6262

63-
public void importSDR(String filename) {
64-
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
65-
66-
Vector<SdrRecord> sdrs = new Vector<SdrRecord>();
67-
HashMap<Integer,HashMap<Integer,Vector<SdrRecord>>> sdrLookup = new HashMap<Integer,HashMap<Integer,Vector<SdrRecord>>>();
68-
69-
try {
70-
DocumentBuilder builder = factory.newDocumentBuilder();
71-
builder.setErrorHandler(new XmlHandler());
72-
73-
Document document = builder.parse(filename);
74-
75-
NodeList deviceList = document
76-
.getElementsByTagName("device");
77-
78-
model.logData="Importing SDR's...\n";
79-
for (int i = 0; i < deviceList.getLength(); ++i) {
80-
Element deviceElement = (Element) deviceList.item(i);
81-
SdrRecord s = new SdrRecord();
82-
s.readXML(deviceElement);
83-
84-
HashMap<Integer,Vector<SdrRecord>> idLookup = sdrLookup.get(s.getEntityId());
85-
if (idLookup==null) {
86-
idLookup = new HashMap<Integer,Vector<SdrRecord>>();
87-
sdrLookup.put(s.getEntityId(), idLookup);
88-
}
89-
Vector<SdrRecord> sdrRecords = idLookup.get(s.getEntityInstance());
90-
if (sdrRecords==null) {
91-
sdrRecords = new Vector<SdrRecord>();
92-
idLookup.put(s.getEntityInstance(), sdrRecords);
93-
}
94-
sdrRecords.add(s);
95-
sdrs.add(s);
96-
model.logData=model.logData+s.toString()+"\n";
97-
}
98-
HashMap<String,Integer> instCheck = new HashMap<String,Integer>();
99-
model.logData=model.logData+"Matching SDR's to targets...\n";
100-
model.importSdr2(null,sdrLookup,instCheck,"");
101-
LogViewerDialog dlg = new LogViewerDialog(null);
102-
ServerWizard2.LOGGER.info(model.logData);
103-
dlg.setData(model.logData);
104-
dlg.open();
105-
} catch (Exception e) {
106-
MessageDialog.openError(null, "SDR Import Error", e.getMessage());
107-
ServerWizard2.LOGGER.info(model.logData);
108-
e.printStackTrace();
109-
}
110-
}
111-
11263
public Target getTargetModel(String type) {
11364
return model.getTargetModel(type);
11465
}

0 commit comments

Comments
 (0)