Difference between revisions of "GVCoreEJBClient"

From GreenVulcano Wiki
Jump to: navigation, search
(Created page with "Class FQN: '''it.greenvulcano.gvesb.core.ejb.client.GVCoreEJBClient''' ==Following the GVCoreEJBClient public static methods== <syntaxhighlight lang="java5"> /** * Inv...")
 
 
Line 73: Line 73:
 
System.out.println("\nGVBuffer out:\n" + out);
 
System.out.println("\nGVBuffer out:\n" + out);
  
 +
</syntaxhighlight>
 +
 +
 +
Follows a sample properties file:
 +
<syntaxhighlight lang="ini">
 +
# INITIAL_CONTEXT_FACTORY
 +
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
 +
# PROVIDER_URL
 +
java.naming.provider.url=jnp://localhost:1099
 +
# SECURITY_PRINCIPAL
 +
java.naming.security.principal=admin
 +
# SECURITY_CREDENTIALS
 +
java.naming.security.credentials=admin
 +
# URL_PKG_PREFIXES
 +
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 13:57, 3 August 2012

Class FQN: it.greenvulcano.gvesb.core.ejb.client.GVCoreEJBClient

Following the GVCoreEJBClient public static methods

    /**
     * Invoke a RequestReply operation on the input.service Service.
     * 
     * @param input
     *        the input GVBuffer
     * @return the service output GVBuffer
     * @throws GVException on error
     */
    public static GVBuffer requestReply(GVBuffer input) throws GVException

    /**
     * Invoke an asynchronous Request operation on the input.service Service.
     * 
     * @param input
     *        the input GVBuffer
     * @throws GVException on error
     */
    public static void request(GVBuffer input) throws GVException

    /**
     * Invoke an asynchronous GetReply operation on the input.service Service.
     * 
     * @param input
     *        the input GVBuffer
     * @return the service output GVBuffer
     * @throws GVException on error
     */
    public static GVBuffer getReply(GVBuffer input) throws GVException

    /**
     * Invoke a specific operation on the input.service Service.
     * 
     * @param operation
     *        the operation to invoke, can be an Operation name or Forward name
     * @param input
     *        the input GVBuffer
     * @return the service output GVBuffer
     * @throws GVException on error
     */
    public static GVBuffer call(String operation, GVBuffer input) throws GVException


Follows some usage examples:

/* 
 * Invoke a synchronous service
 */
GVBuffer in = new GVBuffer("GVESB", "TOUPPER#GVESB");
in.setObject("test test test");

GVBuffer out = GVCoreEJBClient.requestReply(in);
System.out.println("\nGVBuffer out:\n" + out);


/* 
 * Invoke an asynchronous service
 */
GVBuffer in = new GVBuffer("GVESB", "TOUPPER_A");
in.setObject("test test test");

// invoke the request
GVCoreEJBClient.request(in);
// reset the payload, but keep the same ID of the request
in.setObject(null);
// invoke the getreply
GVBuffer out = GVCoreEJBClient.getReply(in);
System.out.println("\nGVBuffer out:\n" + out);


Follows a sample properties file:

# INITIAL_CONTEXT_FACTORY
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
# PROVIDER_URL
java.naming.provider.url=jnp://localhost:1099
# SECURITY_PRINCIPAL
java.naming.security.principal=admin
# SECURITY_CREDENTIALS
java.naming.security.credentials=admin
# URL_PKG_PREFIXES
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces