Commit d009d1f1 authored by claes's avatar claes

nameToAttrRef, attrRefToName, getAttrRefTid and GetSuperClass added

parent 15a05038
/* /*
* Proview $Id: jpwr_rt_gdh.c,v 1.9 2005-11-02 14:04:56 claes Exp $ * Proview $Id: jpwr_rt_gdh.c,v 1.10 2005-11-04 11:51:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -240,7 +240,7 @@ JNIEXPORT jint JNICALL Java_jpwr_rt_Gdh_getObjectRefInfoInt ...@@ -240,7 +240,7 @@ JNIEXPORT jint JNICALL Java_jpwr_rt_Gdh_getObjectRefInfoInt
(JNIEnv *env, jclass obj, jint id) (JNIEnv *env, jclass obj, jint id)
{ {
pwr_tInt32 value; pwr_tInt32 value;
value = *(pwr_tInt32 *)id; value = *(pwr_tInt32 *)id;
return (jint) value; return (jint) value;
} }
......
/* /*
* Proview $Id: GdhServer.java,v 1.10 2005-11-02 14:02:20 claes Exp $ * Proview $Id: GdhServer.java,v 1.11 2005-11-04 11:50:17 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -87,6 +87,10 @@ public class GdhServer ...@@ -87,6 +87,10 @@ public class GdhServer
public final static int GET_OBJECT_REF_INFO_STRING_ARRAY = 49; public final static int GET_OBJECT_REF_INFO_STRING_ARRAY = 49;
public final static int GET_MSG = 50; public final static int GET_MSG = 50;
public final static int GET_MSG_TEXT = 51; public final static int GET_MSG_TEXT = 51;
public final static int NAME_TO_ATTRREF = 52;
public final static int ATTRREF_TO_NAME = 53;
public final static int GET_ATTRREF_TID = 54;
public final static int GET_SUPER_CLASS = 55;
public final static int PORT = 4445; public final static int PORT = 4445;
...@@ -564,13 +568,12 @@ public class GdhServer ...@@ -564,13 +568,12 @@ public class GdhServer
try try
{ {
String attrName = in.readUTF(); String attrName = in.readUTF();
Sub ret = this.refObjectInfo(attrName, threadNumber); Sub ret = this.refObjectInfo(attrName, threadNumber);
thSub.add(ret);
out.writeInt(ret.sts); out.writeInt(ret.sts);
if(ret.oddSts()) if(ret.oddSts())
{ {
thSub.add(ret);
out.writeInt(ret.refid.rix); out.writeInt(ret.refid.rix);
out.writeInt(ret.refid.nid); out.writeInt(ret.refid.nid);
out.writeInt(thSub.size() - 1); out.writeInt(thSub.size() - 1);
...@@ -963,6 +966,29 @@ public class GdhServer ...@@ -963,6 +966,29 @@ public class GdhServer
System.out.println("nameToObjid: IO exception"); System.out.println("nameToObjid: IO exception");
} }
break; break;
case NAME_TO_ATTRREF:
try
{
String name = in.readUTF();
CdhrAttrRef ret = gdh.nameToAttrRef(name);
out.writeInt(ret.getSts());
out.flush();
if(ret.oddSts())
{
out.writeInt(ret.aref.objid.oix);
out.writeInt(ret.aref.objid.vid);
out.writeInt(ret.aref.body);
out.writeInt(ret.aref.offset);
out.writeInt(ret.aref.size);
out.writeInt(ret.aref.flags);
out.flush();
}
}
catch(IOException e)
{
System.out.println("nameToAttrRef: IO exception");
}
break;
case OBJID_TO_NAME: case OBJID_TO_NAME:
try try
{ {
...@@ -983,6 +1009,31 @@ public class GdhServer ...@@ -983,6 +1009,31 @@ public class GdhServer
System.out.println("objidToName: IO exception"); System.out.println("objidToName: IO exception");
} }
break; break;
case ATTRREF_TO_NAME:
try
{
int oix = in.readInt();
int vid = in.readInt();
int body = in.readInt();
int offset = in.readInt();
int size = in.readInt();
int flags = in.readInt();
int nameType = in.readInt();
PwrtObjid objid = new PwrtObjid(oix, vid);
PwrtAttrRef aref = new PwrtAttrRef( objid, body, offset, size, flags);
CdhrString ret = gdh.attrRefToName(aref, nameType);
out.writeInt(ret.getSts());
if(ret.oddSts())
{
out.writeUTF(ret.str);
}
out.flush();
}
catch(IOException e)
{
System.out.println("attrRefToName: IO exception");
}
break;
case GET_ROOT_LIST: case GET_ROOT_LIST:
try try
{ {
...@@ -1106,6 +1157,50 @@ public class GdhServer ...@@ -1106,6 +1157,50 @@ public class GdhServer
System.out.println("getObjectClass: IO exception"); System.out.println("getObjectClass: IO exception");
} }
break; break;
case GET_SUPER_CLASS:
try
{
int cid = in.readInt();
int oix = in.readInt();
int vid = in.readInt();
PwrtObjid objid = new PwrtObjid(oix, vid);
CdhrClassId ret = gdh.getSuperClass(cid, objid);
out.writeInt(ret.getSts());
if(ret.oddSts())
{
out.writeInt(ret.classId);
}
out.flush();
}
catch(IOException e)
{
System.out.println("getSuperClass: IO exception");
}
break;
case GET_ATTRREF_TID:
try
{
int oix = in.readInt();
int vid = in.readInt();
int body = in.readInt();
int offset = in.readInt();
int size = in.readInt();
int flags = in.readInt();
PwrtObjid objid = new PwrtObjid(oix, vid);
PwrtAttrRef aref = new PwrtAttrRef(objid, body, offset, size, flags);
CdhrTypeId ret = gdh.getAttrRefTid(aref);
out.writeInt(ret.getSts());
if(ret.oddSts())
{
out.writeInt(ret.typeId);
}
out.flush();
}
catch(IOException e)
{
System.out.println("getAttrRefTid: IO exception");
}
break;
case GET_CLASS_LIST: case GET_CLASS_LIST:
try try
{ {
......
/* /*
* Proview $Id: Gdh.java,v 1.7 2005-09-01 14:57:52 claes Exp $ * Proview $Id: Gdh.java,v 1.8 2005-11-04 11:50:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -76,6 +76,10 @@ public class Gdh ...@@ -76,6 +76,10 @@ public class Gdh
public final static int GET_OBJECT_REF_INFO_STRING_ARRAY = 49; public final static int GET_OBJECT_REF_INFO_STRING_ARRAY = 49;
public final static int GET_MSG = 50; public final static int GET_MSG = 50;
public final static int GET_MSG_TEXT = 51; public final static int GET_MSG_TEXT = 51;
public final static int NAME_TO_ATTRREF = 52;
public final static int ATTRREF_TO_NAME = 53;
public final static int GET_ATTRREF_TID = 54;
public final static int GET_SUPER_CLASS = 55;
...@@ -953,6 +957,36 @@ public class Gdh ...@@ -953,6 +957,36 @@ public class Gdh
} }
public CdhrAttrRef nameToAttrRef(String objectName)
{
try
{
out.writeInt(NAME_TO_ATTRREF);
out.writeUTF(objectName);
out.flush();
int sts = in.readInt();
if(sts % 2 == 0)
{
return new CdhrAttrRef(null, sts);
}
int oix = in.readInt();
int vid = in.readInt();
int body = in.readInt();
int offset = in.readInt();
int size = in.readInt();
int flags = in.readInt();
PwrtAttrRef aref = new PwrtAttrRef( new PwrtObjid(oix, vid), body,
offset, size, flags);
return new CdhrAttrRef(aref, sts);
}
catch(IOException e)
{
return new CdhrAttrRef(null, __IO_EXCEPTION);
}
}
public CdhrString objidToName(PwrtObjid objid, int nameType) public CdhrString objidToName(PwrtObjid objid, int nameType)
{ {
try try
...@@ -978,6 +1012,35 @@ public class Gdh ...@@ -978,6 +1012,35 @@ public class Gdh
} }
public CdhrString attrRefToName(PwrtAttrRef aref, int nameType)
{
try
{
out.writeInt(ATTRREF_TO_NAME);
out.writeInt(aref.objid.oix);
out.writeInt(aref.objid.vid);
out.writeInt(aref.body);
out.writeInt(aref.offset);
out.writeInt(aref.size);
out.writeInt(aref.flags);
out.writeInt(nameType);
out.flush();
int sts = in.readInt();
if(sts % 2 == 0)
{
return new CdhrString(null, sts);
}
String name = in.readUTF();
return new CdhrString(name, sts);
}
catch(IOException e)
{
return new CdhrString("", __IO_EXCEPTION);
}
}
public CdhrObjid getRootList() public CdhrObjid getRootList()
{ {
try try
...@@ -1129,6 +1192,65 @@ public class Gdh ...@@ -1129,6 +1192,65 @@ public class Gdh
} }
public CdhrClassId getSuperClass(int cid, PwrtObjid objid)
{
try
{
out.writeInt(GET_SUPER_CLASS);
out.writeInt(cid);
if ( objid == null) {
out.writeInt(0);
out.writeInt(0);
}
else {
out.writeInt(objid.oix);
out.writeInt(objid.vid);
}
out.flush();
int sts = in.readInt();
if(sts % 2 == 0)
{
return new CdhrClassId(0, sts);
}
int classId = in.readInt();
return new CdhrClassId(classId, sts);
}
catch(IOException e)
{
return new CdhrClassId(0, __IO_EXCEPTION);
}
}
public CdhrTypeId getAttrRefTid(PwrtAttrRef aref)
{
try
{
out.writeInt(GET_ATTRREF_TID);
out.writeInt(aref.objid.oix);
out.writeInt(aref.objid.vid);
out.writeInt(aref.body);
out.writeInt(aref.offset);
out.writeInt(aref.size);
out.writeInt(aref.flags);
out.flush();
int sts = in.readInt();
if(sts % 2 == 0)
{
return new CdhrTypeId(0, sts);
}
int typeId = in.readInt();
return new CdhrTypeId(typeId, sts);
}
catch(IOException e)
{
return new CdhrTypeId(0, __IO_EXCEPTION);
}
}
public CdhrObjid getClassList(int classid) public CdhrObjid getClassList(int classid)
{ {
try try
...@@ -1730,6 +1852,14 @@ public class Gdh ...@@ -1730,6 +1852,14 @@ public class Gdh
{ {
return Pwr.eType_AttrRef; return Pwr.eType_AttrRef;
} }
if(suffix.compareTo("STATUS") == 0)
{
return Pwr.eType_Status;
}
if(suffix.compareTo("NETSTATUS") == 0)
{
return Pwr.eType_NetStatus;
}
if(suffix.substring(0, 6).compareTo("STRING") == 0) if(suffix.substring(0, 6).compareTo("STRING") == 0)
{ {
return Pwr.eType_String; return Pwr.eType_String;
......
/* /*
* Proview $Id: GdhServer.java,v 1.10 2005-11-02 14:02:20 claes Exp $ * Proview $Id: GdhServer.java,v 1.11 2005-11-04 11:50:17 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -87,6 +87,10 @@ public class GdhServer ...@@ -87,6 +87,10 @@ public class GdhServer
public final static int GET_OBJECT_REF_INFO_STRING_ARRAY = 49; public final static int GET_OBJECT_REF_INFO_STRING_ARRAY = 49;
public final static int GET_MSG = 50; public final static int GET_MSG = 50;
public final static int GET_MSG_TEXT = 51; public final static int GET_MSG_TEXT = 51;
public final static int NAME_TO_ATTRREF = 52;
public final static int ATTRREF_TO_NAME = 53;
public final static int GET_ATTRREF_TID = 54;
public final static int GET_SUPER_CLASS = 55;
public final static int PORT = 4445; public final static int PORT = 4445;
...@@ -564,13 +568,12 @@ public class GdhServer ...@@ -564,13 +568,12 @@ public class GdhServer
try try
{ {
String attrName = in.readUTF(); String attrName = in.readUTF();
Sub ret = this.refObjectInfo(attrName, threadNumber); Sub ret = this.refObjectInfo(attrName, threadNumber);
thSub.add(ret);
out.writeInt(ret.sts); out.writeInt(ret.sts);
if(ret.oddSts()) if(ret.oddSts())
{ {
thSub.add(ret);
out.writeInt(ret.refid.rix); out.writeInt(ret.refid.rix);
out.writeInt(ret.refid.nid); out.writeInt(ret.refid.nid);
out.writeInt(thSub.size() - 1); out.writeInt(thSub.size() - 1);
...@@ -963,6 +966,29 @@ public class GdhServer ...@@ -963,6 +966,29 @@ public class GdhServer
System.out.println("nameToObjid: IO exception"); System.out.println("nameToObjid: IO exception");
} }
break; break;
case NAME_TO_ATTRREF:
try
{
String name = in.readUTF();
CdhrAttrRef ret = gdh.nameToAttrRef(name);
out.writeInt(ret.getSts());
out.flush();
if(ret.oddSts())
{
out.writeInt(ret.aref.objid.oix);
out.writeInt(ret.aref.objid.vid);
out.writeInt(ret.aref.body);
out.writeInt(ret.aref.offset);
out.writeInt(ret.aref.size);
out.writeInt(ret.aref.flags);
out.flush();
}
}
catch(IOException e)
{
System.out.println("nameToAttrRef: IO exception");
}
break;
case OBJID_TO_NAME: case OBJID_TO_NAME:
try try
{ {
...@@ -983,6 +1009,31 @@ public class GdhServer ...@@ -983,6 +1009,31 @@ public class GdhServer
System.out.println("objidToName: IO exception"); System.out.println("objidToName: IO exception");
} }
break; break;
case ATTRREF_TO_NAME:
try
{
int oix = in.readInt();
int vid = in.readInt();
int body = in.readInt();
int offset = in.readInt();
int size = in.readInt();
int flags = in.readInt();
int nameType = in.readInt();
PwrtObjid objid = new PwrtObjid(oix, vid);
PwrtAttrRef aref = new PwrtAttrRef( objid, body, offset, size, flags);
CdhrString ret = gdh.attrRefToName(aref, nameType);
out.writeInt(ret.getSts());
if(ret.oddSts())
{
out.writeUTF(ret.str);
}
out.flush();
}
catch(IOException e)
{
System.out.println("attrRefToName: IO exception");
}
break;
case GET_ROOT_LIST: case GET_ROOT_LIST:
try try
{ {
...@@ -1106,6 +1157,50 @@ public class GdhServer ...@@ -1106,6 +1157,50 @@ public class GdhServer
System.out.println("getObjectClass: IO exception"); System.out.println("getObjectClass: IO exception");
} }
break; break;
case GET_SUPER_CLASS:
try
{
int cid = in.readInt();
int oix = in.readInt();
int vid = in.readInt();
PwrtObjid objid = new PwrtObjid(oix, vid);
CdhrClassId ret = gdh.getSuperClass(cid, objid);
out.writeInt(ret.getSts());
if(ret.oddSts())
{
out.writeInt(ret.classId);
}
out.flush();
}
catch(IOException e)
{
System.out.println("getSuperClass: IO exception");
}
break;
case GET_ATTRREF_TID:
try
{
int oix = in.readInt();
int vid = in.readInt();
int body = in.readInt();
int offset = in.readInt();
int size = in.readInt();
int flags = in.readInt();
PwrtObjid objid = new PwrtObjid(oix, vid);
PwrtAttrRef aref = new PwrtAttrRef(objid, body, offset, size, flags);
CdhrTypeId ret = gdh.getAttrRefTid(aref);
out.writeInt(ret.getSts());
if(ret.oddSts())
{
out.writeInt(ret.typeId);
}
out.flush();
}
catch(IOException e)
{
System.out.println("getAttrRefTid: IO exception");
}
break;
case GET_CLASS_LIST: case GET_CLASS_LIST:
try try
{ {
......
/* /*
* Proview $Id: Gdh.java,v 1.7 2005-09-01 14:57:52 claes Exp $ * Proview $Id: Gdh.java,v 1.8 2005-11-04 11:50:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -76,6 +76,10 @@ public class Gdh ...@@ -76,6 +76,10 @@ public class Gdh
public final static int GET_OBJECT_REF_INFO_STRING_ARRAY = 49; public final static int GET_OBJECT_REF_INFO_STRING_ARRAY = 49;
public final static int GET_MSG = 50; public final static int GET_MSG = 50;
public final static int GET_MSG_TEXT = 51; public final static int GET_MSG_TEXT = 51;
public final static int NAME_TO_ATTRREF = 52;
public final static int ATTRREF_TO_NAME = 53;
public final static int GET_ATTRREF_TID = 54;
public final static int GET_SUPER_CLASS = 55;
...@@ -953,6 +957,36 @@ public class Gdh ...@@ -953,6 +957,36 @@ public class Gdh
} }
public CdhrAttrRef nameToAttrRef(String objectName)
{
try
{
out.writeInt(NAME_TO_ATTRREF);
out.writeUTF(objectName);
out.flush();
int sts = in.readInt();
if(sts % 2 == 0)
{
return new CdhrAttrRef(null, sts);
}
int oix = in.readInt();
int vid = in.readInt();
int body = in.readInt();
int offset = in.readInt();
int size = in.readInt();
int flags = in.readInt();
PwrtAttrRef aref = new PwrtAttrRef( new PwrtObjid(oix, vid), body,
offset, size, flags);
return new CdhrAttrRef(aref, sts);
}
catch(IOException e)
{
return new CdhrAttrRef(null, __IO_EXCEPTION);
}
}
public CdhrString objidToName(PwrtObjid objid, int nameType) public CdhrString objidToName(PwrtObjid objid, int nameType)
{ {
try try
...@@ -978,6 +1012,35 @@ public class Gdh ...@@ -978,6 +1012,35 @@ public class Gdh
} }
public CdhrString attrRefToName(PwrtAttrRef aref, int nameType)
{
try
{
out.writeInt(ATTRREF_TO_NAME);
out.writeInt(aref.objid.oix);
out.writeInt(aref.objid.vid);
out.writeInt(aref.body);
out.writeInt(aref.offset);
out.writeInt(aref.size);
out.writeInt(aref.flags);
out.writeInt(nameType);
out.flush();
int sts = in.readInt();
if(sts % 2 == 0)
{
return new CdhrString(null, sts);
}
String name = in.readUTF();
return new CdhrString(name, sts);
}
catch(IOException e)
{
return new CdhrString("", __IO_EXCEPTION);
}
}
public CdhrObjid getRootList() public CdhrObjid getRootList()
{ {
try try
...@@ -1129,6 +1192,65 @@ public class Gdh ...@@ -1129,6 +1192,65 @@ public class Gdh
} }
public CdhrClassId getSuperClass(int cid, PwrtObjid objid)
{
try
{
out.writeInt(GET_SUPER_CLASS);
out.writeInt(cid);
if ( objid == null) {
out.writeInt(0);
out.writeInt(0);
}
else {
out.writeInt(objid.oix);
out.writeInt(objid.vid);
}
out.flush();
int sts = in.readInt();
if(sts % 2 == 0)
{
return new CdhrClassId(0, sts);
}
int classId = in.readInt();
return new CdhrClassId(classId, sts);
}
catch(IOException e)
{
return new CdhrClassId(0, __IO_EXCEPTION);
}
}
public CdhrTypeId getAttrRefTid(PwrtAttrRef aref)
{
try
{
out.writeInt(GET_ATTRREF_TID);
out.writeInt(aref.objid.oix);
out.writeInt(aref.objid.vid);
out.writeInt(aref.body);
out.writeInt(aref.offset);
out.writeInt(aref.size);
out.writeInt(aref.flags);
out.flush();
int sts = in.readInt();
if(sts % 2 == 0)
{
return new CdhrTypeId(0, sts);
}
int typeId = in.readInt();
return new CdhrTypeId(typeId, sts);
}
catch(IOException e)
{
return new CdhrTypeId(0, __IO_EXCEPTION);
}
}
public CdhrObjid getClassList(int classid) public CdhrObjid getClassList(int classid)
{ {
try try
...@@ -1730,6 +1852,14 @@ public class Gdh ...@@ -1730,6 +1852,14 @@ public class Gdh
{ {
return Pwr.eType_AttrRef; return Pwr.eType_AttrRef;
} }
if(suffix.compareTo("STATUS") == 0)
{
return Pwr.eType_Status;
}
if(suffix.compareTo("NETSTATUS") == 0)
{
return Pwr.eType_NetStatus;
}
if(suffix.substring(0, 6).compareTo("STRING") == 0) if(suffix.substring(0, 6).compareTo("STRING") == 0)
{ {
return Pwr.eType_String; return Pwr.eType_String;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment