[
https://issues.apache.org/jira/browse/GEODE-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Michael Martell updated GEODE-2910:
-----------------------------------
Description:
We had trouble passing objects to functions via the REST API because we had no
objects registered. The only documentation we found for passing objects was
[here|http://geode.apache.org/docs/guide/11/rest_apps/develop_rest_apps.html#topic_rbc_h25_m4]
where it says:
"... the Item domain object must be in the CLASSPATH of all members receiving
the function."
As a C# programmer, this is very confusing. Helpful to spell out that your C#
class needs to have a Java equivalent loaded in the server. Also that the
object type name includes the Java package name.
Adding the following simple example to the documentation would have been a
great demonstration of how objects are registered.
This Java class is required to register the Item object (referred to in the
link above) on the server:
{code}
package cheezypizza;
public class Item {
public int itemNo;
public String description;
public int quantity;
public float unitprice;
public double totalprice;
}
{code}
A script to register the objects:
{code}
# Build the jar
javac -classpath /mnt/c/gemfire/lib/\* -d ./out src/cheezypizza/*.java
cd out
jar cvMf functions.jar cheezypizza/*.class
# Copy jar to server
scp functions.jar $HOSTNAME:/home/user
# In gfsh, starting the server, specify --classpath=
start server --name=rest-server --start-rest-api=true --http-service-port=8080
--classpath=/home/user/functions.jar
{code}
was:
We had trouble passing objects to functions via the REST API because we had no
objects registered. The only documentation we found for passing objects was
[here|http://geode.apache.org/docs/guide/11/rest_apps/develop_rest_apps.html#topic_rbc_h25_m4]
where it says:
"... the Item domain object must be in the CLASSPATH of all members receiving
the function."
As a C# programmer, this is very confusing. Helpful to spell out that your C#
class needs to have a Java equivalent loaded in the server. Also that the
object type name includes the Java package name.
Adding the following simple example to the documentation would have been a
great demonstration of how objects are registered.
This Java class is required to register the above Item object on the server:
{code}
package cheezypizza;
public class Item {
public int itemNo;
public String description;
public int quantity;
public float unitprice;
public double totalprice;
}
{code}
A script to register the objects:
{code}
# Build the jar
javac -classpath /mnt/c/gemfire/lib/\* -d ./out src/cheezypizza/*.java
cd out
jar cvMf functions.jar cheezypizza/*.class
# Copy jar to server
scp functions.jar $HOSTNAME:/home/user
# In gfsh, starting the server, specify --classpath=
start server --name=rest-server --start-rest-api=true --http-service-port=8080
--classpath=/home/user/functions.jar
{code}
> Declaring Object Types in Geode Without Using Client Unclear
> ------------------------------------------------------------
>
> Key: GEODE-2910
> URL: https://issues.apache.org/jira/browse/GEODE-2910
> Project: Geode
> Issue Type: Improvement
> Components: docs
> Reporter: Michael Martell
>
> We had trouble passing objects to functions via the REST API because we had
> no objects registered. The only documentation we found for passing objects
> was
> [here|http://geode.apache.org/docs/guide/11/rest_apps/develop_rest_apps.html#topic_rbc_h25_m4]
> where it says:
> "... the Item domain object must be in the CLASSPATH of all members receiving
> the function."
> As a C# programmer, this is very confusing. Helpful to spell out that your C#
> class needs to have a Java equivalent loaded in the server. Also that the
> object type name includes the Java package name.
> Adding the following simple example to the documentation would have been a
> great demonstration of how objects are registered.
> This Java class is required to register the Item object (referred to in the
> link above) on the server:
> {code}
> package cheezypizza;
> public class Item {
> public int itemNo;
> public String description;
> public int quantity;
> public float unitprice;
> public double totalprice;
> }
> {code}
> A script to register the objects:
> {code}
> # Build the jar
> javac -classpath /mnt/c/gemfire/lib/\* -d ./out src/cheezypizza/*.java
> cd out
> jar cvMf functions.jar cheezypizza/*.class
> # Copy jar to server
> scp functions.jar $HOSTNAME:/home/user
> # In gfsh, starting the server, specify --classpath=
> start server --name=rest-server --start-rest-api=true
> --http-service-port=8080 --classpath=/home/user/functions.jar
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)