Menu

Generic Import

GT.M
hanoch
2006-09-14
2012-09-19
  • hanoch

    hanoch - 2006-09-14

    Hi there,

    Is there a way to do a generic import to exported library withou using the windows ESI client.

    I would like to generic import the library using my Java application or directly from the EsiServer(GT.M).
    I used Enviorment.Serialization_StreamGenericImport which took almost 2 hours while in the Esi client it takes 10 minutes.

    Thanks, hanoch

     
    • hanoch

      hanoch - 2006-09-17

      This is my pseudo code (I'm using Java) :

      InputStream stream = new BufferedInputStream(new FileInputStream(fileName));

      environment.Serialization_StreamGenericImport(VariantUtils.toVariant(stream));

      stream.close();


      Some notes:
      1. The file name is the the name of the exported library which is less than 1MB (700KB).

      1. I get the environment after connection using
        gateway.lookupObject("$ENV").

      2. I tried other kinds of InputStreams but the time of the generic import was the same.
        I tried the following import streams:
        a. InputStream stream = new FileInputStream(fileName);
        b. InputStream stream = new BufferedInputStream(new FileInputStream(fileName));
        c. InputStream stream = new DataInputStream(new BufferedInputStream(new FileInputStream(fileName)));
        d. FileReader stream = new FileReader(fileName);
        e. BufferedReader stream = new BufferedReader(new FileReader(fileName));

      Thanks for your quick reply,
      Hanoch

       
    • hanoch

      hanoch - 2006-10-03

      Still waiting...

       
      • Terry L. Wiechmann

        Still working...;-)

        I've been having trouble with the current version of EO on GT.M V5.0. I don't have V4 installed. I could put the current fix up as a patch if you want to test it on GT.M v4.0+

        Terry

         
    • Terry L. Wiechmann

      The patch has been submitted to the EsiObjects project on SourceForge. You can access it through the Bugs or Patches link.

      This patch has been tested on GTM V5, not V4. Please let me know if you encounter any problems in that environment.

      Terry

       
    • Terry L. Wiechmann

      BTW, to use the Primitive Import, simply DO ^VESOUIMP and then enter the path name to the file you are importing. If that file is in the so called DOS format, convert it to UNIX.

      Terry

       
    • Terry L. Wiechmann

      I made a minor change to the routine VESOIM3. You should probably doen load the new .zip file and restore the ImportFixes.rsa file.

      Terry

       
    • hanoch

      hanoch - 2006-10-10

      I used your patch and tried to import and this is what I got:

      Enter the file name to import:/pos/idkun/test2.opl
      Trace: ,Z2, : 2,0+14^VESob0HO,%SYSTEM-E-ENO2, No such file or directory
      Trace: Error: Error Code: M_Z2 () Is Missing
      Trace: At: Method: Base$ServerFileStream.Primary::Open, Version: 3 <Main>+36
      Trace: Called by: Method: Base$ServerFileStream.Primary::Open, Version: 3 <Input
      >+12
      Trace: Supplemental:%SYSTEM-E-ENO2
      Trace: Raw: 2,0+14^VESob0HO,%SYSTEM-E-ENO2, No such file or directory
      Trace: Class: ServerFileStream
      Trace: OID: N%obj(4,1)
      Trace: 2,0+14^VESob0HO,%SYSTEM-E-ENO2, No such file or directory
      OOP Execution Error - Trapped: 0
      Error: Error Code: M_Z2 () Is Missing
      At: Method: Base$ServerFileStream.Primary
      ::Open, Version: 3 <Main>+36
      Called by: Method: Base$ServerFileStream.Primary::
      Open, Version: 3 <Input>+12
      Supplemental:%SYSTEM-E-ENO2
      Raw: 2,0+14^VESob0HO,%
      SYSTEM-E-ENO2, No such file or directory
      Class: ServerFileStream
      OID: N%obj(4
      ,1)
      Trace: ,Z150373090, : 150373090,0+16^VESob0HP,%GTM-E-IONOTOPEN, Attempt to USE a
      n I/O device which has not been opened
      Trace: Error: Error Code: M_Z150373090 () Is Missing
      Trace: At: Method: Base$ServerFileStream.Primary::Read, Version: 9 <Main>+36
      Trace: Called by: Method: Base$ServerFileStream.Primary::Read, Version: 9 <Input
      >+13
      Trace: Supplemental:%GTM-E-IONOTOPEN
      Trace: Raw: 150373090,0+16^VESob0HP,%GTM-E-IONOTOPEN, Attempt to USE an I/O devi
      ce which has not been opened
      Trace: Class: ServerFileStream
      Trace: OID: N%obj(4,1)
      Trace: 150373090,0+16^VESob0HP,%GTM-E-IONOTOPEN, Attempt to USE an I/O device wh
      ich has not been opened
      OOP Execution Error - Trapped: 0
      Error: Error Code: M_Z150373090 () Is Missing
      At: Method: Base$ServerFileStream
      .Primary::Read, Version: 9 <Main>+36
      Called by: Method: Base$ServerFileStream.P
      rimary::Read, Version: 9 <Input>+13
      Supplemental:%GTM-E-IONOTOPEN
      Raw: 1503730
      90,0+16^VESob0HP,%GTM-E-IONOTOPEN, Attempt to USE an I/O device which has not be
      en opened
      Class: ServerFileStream
      OID: N%obj(4,1)
      Trace: ,Z150373090, : 150373090,0+16^VESob0HP,%GTM-E-IONOTOPEN, Attempt to USE a
      n I/O device which has not been opened
      Trace: Error: Error Code: M_Z150373090 () Is Missing
      Trace: At: Method: Base$ServerFileStream.Primary::Read, Version: 9 <Main>+36
      Trace: Called by: Method: Base$ServerFileStream.Primary::ReadLine, Version: 5 <M
      ain>+23
      Trace: Supplemental:%GTM-E-IONOTOPEN
      Trace: Raw: 150373090,0+16^VESob0HP,%GTM-E-IONOTOPEN, Attempt to USE an I/O devi
      ce which has not been opened
      Trace: Class: ServerFileStream
      Trace: OID: N%obj(4,1)
      Trace: 150373090,0+16^VESob0HP,%GTM-E-IONOTOPEN, Attempt to USE an I/O device wh
      ich has not been opened
      OOP Execution Error - Trapped: 0
      Error: Error Code: M_Z150373090 () Is Missing
      At: Method: Base$ServerFileStream
      .Primary::Read, Version: 9 <Main>+36
      Called by: Method: Base$ServerFileStream.P
      rimary::ReadLine, Version: 5 <Main>+23
      Supplemental:%GTM-E-IONOTOPEN
      Raw: 1503
      73090,0+16^VESob0HP,%GTM-E-IONOTOPEN, Attempt to USE an I/O device which has not
      been opened
      Class: ServerFileStream
      OID: N%obj(4,1)
      Trace: 150373090,0+16^VESob0HP,%GTM-E-IONOTOPEN, Attempt to USE an I/O device wh
      ich has not been opened
      Import complete

       
      • Terry L. Wiechmann

        GTM links routine object code into a runtime image as I'm sure you know. Have you run down the image or done the required ZLinking? Try this first, it has often caused me problems.

        If that does not work, please check something for me. You will have to use the EsiObjects UI for this.

        1) Select the Base$ServerFileStream::Primary.Open method in the Session Browser (Tree structure in left pane).

        2) Bring the Open method up in the editor. Is Version 3 compiled? If not, compile it and try again.

        It's always instructive to look at the Intermediate Code. Right click in the code and select the Properties... option. Click on the Info tab and then double click on the routine name after the Release Immediate: text. This will bring up the routine in an edit window. You should see this code segment if it compiled for GTM:

        IF @%obji@(&quot; &quot;,&quot;Mode&quot;)=&quot;W&quot; OPEN @%obji@(&quot; &quot;,&quot;File&quot;):(noreadonly:stream)
        ELSE  IF @%obji@(&quot; &quot;,&quot;Mode&quot;)=&quot;R&quot; OPEN @%obji@(&quot; &quot;,&quot;File&quot;):(readonly:stream)
        QUIT
        

        Let me know what you find.

        Terry

         
    • hanoch

      hanoch - 2006-10-15

      The output from $ZV:
      GT.M V4.4--004 Linux x68

      My ESIObject version is 4.1.1.3

       
    • hanoch

      hanoch - 2006-11-22

      Hi Terry,

      Is there any chance you solved the Generic Import problem?

       
      • Terry L. Wiechmann

        Sorry, No - I'm very busy getting the new version (V4.2) tested and exported. We need it for a big project we are doing for the government. The problem will be fixed on that version. The new version represents lots of work done for the Navy (mostly internal) over the last couple years as well as lots of cleanup work I've done. It will be based on GT.M V5.1. My goal is to have a beta copy released sometime next month.

         
    • Jerry Goodnough

      Jerry Goodnough - 2006-09-14

      Greetings,

      Yes is is a way to do the generic import directly on the server - Although on the EO side Enviorment.Serialization_StreamGenericImport is called by all clients (including the windows client). I'm very suprised that your direct call took 2 hours, what were you using as a client?

      The routie ^VESOUIMP is a server side generic import routine. This routine uses Base$ServerFileStream & Enviorment.Serialization_StreamGenericImport to load from a file on the server - The main problem is that neither of these converted to work on GT.M - Although a quick glance indicates it should not be to hard to convert them over - I'll see if I can find someone to make the conversion.

      In the mean time I suspect that we should be able to get your direct call to Enviorment.Serialization_StreamGenericImport down to the same level as the Windows Client if you give me a bit more data.

       
    • hanoch

      hanoch - 2006-10-04

      By the way,
      I don't think the problem is in the generic import itself.

      I think there is a problem with the java gateway.
      I made simple test application which call simple EO method (which return the current date) 100 time in a for loop. The for loop took about 40 seconds.

      I made the same for loop using the execute shell in the EO client and the loop took about 1.5-2 seconds.

      So there is a signific diffrence between those 2 tests.

      Hanoch

       
      • Jerry Goodnough

        Jerry Goodnough - 2006-10-04

        Hmm... Sounds like an interaction issue with GT.M and the TCPGateway alright - Can you post your test?

        Thanks,

        Jerry

         
    • hanoch

      hanoch - 2006-10-05

      I did the test using the method getDate which is defined in the class Test and it returns $ZD($H,"DD.MM.YY 24:60")

      My test using the execute shell:

      Create A=DBServer$Test
      S TIME1=$P($H,",",2)
      F T%I=1:1:100000 S B=A.getDate
      W !,$P($H,",",2)-TIME1

      The execute of this code took 1.5 sec.

      My test using the java gatway

      String ip = "192.168.11.1";
      int port = 9000;
      TCPGateway gateway = new TCPGateway();
      gateway.openConnection(ip, port, "R.S.D. Client");
      Variant vaRet = gateway.lookupObject("$ENV");
      Object obj = vaRet.getObject();
      Environment environment = (Environment) obj;
      Variant vaRet = gateway.lookupObject(DBServerTest);
      obj = vaRet.getObject();
      Test test = (Test)obj;

      final long start = System.nanoTime();
      for (int i=0; i < 1000; i++)
      {
      Variant v = test.getDate();
      }
      final long end = System.nanoTime();
      final long difference = (end - start );
      System.out.println("Time: " + (difference / 1000000000.0));

      The execute of this code took 40 sec.

       
    • hanoch

      hanoch - 2006-10-12

      In the GTM all the routines are compiled and linked.

      I've checked the Base$ServerFileStream::Primary.Open method and it is compiled in version 3, and I saw the code segment you wrote.

       
      • Terry L. Wiechmann

        It looks like I will have to install your exact configuration and test this patch since it works on my latest. Please tell me what versions of GT.M and EsiObjects are you running?

         
    • hanoch

      hanoch - 2006-10-15

      Correction,
      My ESIObject version client is 4.1.1.3 and the server side is 4.1.1.2

       

Log in to post a comment.