Archived

This forum has been archived. Please start a new discussion on GitHub.

help with slice2java

Hi all,

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


Thanks

Comments

  • matthew
    matthew NL, Canada
    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?
  • 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
  • matthew
    matthew NL, Canada
    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.
  • 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?.
  • dwayne
    dwayne St. John's, Newfoundland
    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.
  • 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
  • matthew
    matthew NL, Canada
    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.
  • 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
  • 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
  • matthew
    matthew NL, Canada
    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.
  • 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
  • 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.