Home Help Center

help with slice2java

lakshmiKlakshmiK Member Lakshmi kondapiOrganization: ItechU.SProject: Printer
Hi all,

I 'm new to slcie2java. Can anyone help me with steps to create an projectIce.jar.?


Thanks

Comments

  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    This doesn't sound like an Ice specific problem, it sounds more like you don't know how to create a jar file... could be a little more specific?
  • lakshmiKlakshmiK Member Lakshmi kondapiOrganization: ItechU.SProject: Printer
    slice2java

    Hi,

    I am new to Slice2Java. I need to connect to an ice file from java. For that what are the steps, I need to follow.


    Thanks
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    What do you mean connect to an ice file from Java? If you want a complete example, take a look at any of the Ice demos. The simplest is demo/Ice/minimal.
  • lakshmiKlakshmiK Member Lakshmi kondapiOrganization: ItechU.SProject: Printer
    slice2java

    The examples under demo/ice/minimal tell about the cpp files, I m looking for java examples. Can you please tell me all the steps to convert an .ice file to java?.
  • dwaynedwayne St. John's, NewfoundlandMember Dwayne BooneOrganization: ZeroC, Inc.Project: Internet Communications Engine
    The java demos can be found in multiple places:

    * In the Ice 3.3 source distribution they can be found in the java/demo subdirectory.
    * In the Windows binary installers they are in the demoj subdirectory.
    * In the demo distribution for Unix they are also found in the demoj subdirectory.

    Each of these distributions also contain README/INSTALL files that include instructions for building and running the demos.
  • lakshmiKlakshmiK Member Lakshmi kondapiOrganization: ItechU.SProject: Printer
    slice2java

    If I convert Ice file into java file. Do I have to write a client and server? Also, do I have to write build.xml file or slice2java automatically generates build.xml file to run the Ice file. Please correct me . I'm using eclipse as IDE.


    Thanks
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    slice2java translates the a Slice file (.ice) file into corresponding java source files according to the rules defined in the Java language mapping section of the Ice manual. How exactly you do this depends on your build environment. We use ant, hence the build.xml files contained in our demo distribution. If you do not use ant, then you have to determine a suitable method to do this with your build environment.
  • lakshmiKlakshmiK Member Lakshmi kondapiOrganization: ItechU.SProject: Printer
    slice2java

    Hi, I'm using the minimal example. I have copied all the files except build.xml into my project using eclipse and generated java files. After doing this , Do I have to run the ant to generate build.xml file.

    Thanks
  • lakshmiKlakshmiK Member Lakshmi kondapiOrganization: ItechU.SProject: Printer
    interface

    Hi,

    In the ice file, I have something as follows.


    interface Resr
    {
    ["nonmutating"] idempotent FileSystemPr::PrStruct getPr(string RecLocator) throws PrException;
    OptPr setPrXdr(Ice::ByteSeq xdrPnr) throws PrException;

    }


    From this I understood that in the interface resr it calls getPr which returns PrStruct of the FileSystemPr.ice . Is that correct ?

    Also I want to know what is nonmutating and idempotent means.

    Thanks
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    You really need to see the Ice manual. All of these questions are answered in there.

    For the slice language look at chapter 4: The Slice language. http://www.zeroc.com/doc/Ice-3.3.0/manual/Slice.html#49350

    For idempotent see http://www.zeroc.com/doc/Ice-3.3.0/manual/Overview.3.2.html (look for "At-Most-Once Semantics"). For nonmutating look at http://www.zeroc.com/doc/Ice-3.3.0/reference/Ice/OperationMode.html. Note that nonmutating is deprecated and should not be used any longer.
  • lakshmiKlakshmiK Member Lakshmi kondapiOrganization: ItechU.SProject: Printer
    Structs

    I have a struct in a ice file like below

    struct Itm
    {
    int ItemNum; string ItemText;
    };
    sequence<Itm> Itms;

    I'm working in java. I wanted to convert Itm to string in java. Is it possible?

    Please let me know

    thanks
  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    There is no built-in feature to turn a Slice sequence into a string. You can write your own method that iterates over the sequence and stringifies it.

    Alternatively, you can compile the Slice definition with --stream and use the generated helper class to serialize the sequence into a byte stream. You could then encode the result using a base-64 encoding or some such.

    See the Dynamic Ice chapter in the manual for more info.

    Cheers,

    Michi.
Sign In or Register to comment.