Enhanced Class Deployment
J/Foundation now supports an easier mechanism for deploying JUDR classes. While you can continue to use the deployment descriptor to define the SQL statements to register each method in a JUDR class, you can use the Enhanced Class Deployment feature to simplify the registration of each method.
With Enhanced Class Deployment you add a properties file to your jar file that you wish to deploy JUDR's from. This properties file by default is named 'judr.properties' and resides in the root of your JAR file.
judr-registration: judr.custom.properties
For more information see, A manifest file.
Java UDR properties file
Key | Value |
---|---|
register-class-name | A comma separated list of fully qualified package+class names. Example: com.informix.judr.Strings. |
register-class-prefix | A prefix that is placed in front of any Java method being registered to make a SQL equivalent. Example: Using "j_" as a prefix to the method toString() makes the SQL function "j_toString()". |
register-class-default-properties | The SQL properties you want on each method registered. Use a comma separated list of values. Examples: 'parallizable, variant'. |
register-class-default-grantee | A comma separated list of users that you want access to these JUDR's granted to. Example: 'PUBLIC, informix' |
Automatic method registration
- The method is public
- The method is static
- The return value is void or a mappable type (see Table 2)
- The parameters to the method are empty or all of them are mappable types (see Table 2)
Once a method in a class is determined to be eligible for automatic registration, J/Foundation will automatically create the "CREATE FUNCTION/PROCEDURE" SQL statement to register the method as a Java UDR using the class-prefix, default-properties specified in the 'judr.properties' file if they are provided. It will also automatically issue a "GRANT" SQL statement to grant access to the JUDR for any users or groups specified in the default-grantee list in the 'judr.properties' file.
register-class-name: ClassWithNoPackage, com.informix.StringUtilities, \
com.informix.Utilities
register-class-prefix: j_
register-class-default-grantees: PUBLIC
CREATE PROCEDURE j_getString(integer) EXTERNAL NAME ‘myjarlabel:com.informix.StringUtilities.getString(int)’ LANGUAGE JAVA;
GRANT EXECUTE on j_getString TO PUBLIC;
> execute procedure j_getString(56);
Basic Java types as well as
Interval and Blob/Clob types are automatically mapped to the following Informix types.Java Type | Informix Type |
---|---|
Character.TYPE Character.class |
CHAR(1) |
Boolean.TYPE Boolean.class |
BOOLEAN |
Integer.TYPE Integer.class |
INTEGER |
Long.TYPE Long.class |
BIGINT |
Double.TYPE Double.class |
FLOAT |
Float.TYPE Float.class |
SMALLFLOAT |
Short.TYPE Short.class |
SMALLINT |
StringTYPE String.class |
LVARCHAR |
java.sql.Date java.util.Date java.sql.Timestamp |
DATETIME YEAR TO FRACTION(5) |
java.sql.Time | DATETIME HOUR TO SECOND |
IntervalYM | INTERVAL YEAR TO MONTH |
IntervalDM | INTERVAL DAY TO FRACTION(5) |
java.sql.Blob | BLOB |
java.sql.Clob | CLOB |