OZ User Data Store Manual... 6 UDS... 6 JDBC UDS... 12 Connection UDS... 17 Connection UDS... 23 DataAction... 31 DataAction... 31 - DataAction... 46... 68 HttpRequest... 76 ResultSet... 83
OZ User Data Store Manual,,,,, DataAction,, Http Request.. jar jar lib. // lib servlet.jar UDSTestPackage.jar lib. // config launch.cfg servlet.jar UDSTestPackage.jar. 2 FORCS Co., LTD
A Leader of Enterprise e-business Solution ;.\lib\udstestpackage.jar;.\lib\servlet.jar ODBC AppExample.mdb ODBC. (:) UDS. WEB-INF/classes uds_test TestUDS_RDBPoolRef.class, TestUDS_RDBPoolRefEX.class, WEB-INF/classes oz/uds FORCS Co., LTD 3
OZ User Data Store Manual OZUDSSample.class, OZUDSSampleResultSet.class. WEB-INF web.xml. <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"> <web-app> <servlet> <servlet-name>httpserver</servlet-name> <servlet-class>oz.server.ozservlet</servlet-class> </servlet> <servlet> <servlet-name>ozhello</servlet-name> <servlet-class>helloworld</servlet-class> </servlet> <servlet> <servlet-name>uds_test.testuds_rdbpoolref</servlet-name> <servlet-class>uds_test.testuds_rdbpoolref</servlet-class> </servlet> <servlet> <servlet-name>uds_test.testuds_rdbpoolrefex</servlet-name> <servlet-class>uds_test.testuds_rdbpoolrefex</servlet-class> </servlet> <servlet> <servlet-name>oz.uds.ozudssample</servlet-name> <servlet-class>oz.uds.ozudssample</servlet-class> </servlet> <servlet> <servlet-name>oz.uds.ozudssampleresultset</servlet-name> <servlet-class>oz.uds.ozudssampleresultset</servlet-class> </servlet> <servlet-mapping> <servlet-name>httpserver</servlet-name> <url-pattern>/server</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>httpserver</servlet-name> <url-pattern>/server/*</url-pattern> 4 FORCS Co., LTD
A Leader of Enterprise e-business Solution </servlet-mapping> <servlet-mapping> <servlet-name>ozhello</servlet-name> <url-pattern>/hello</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>uds_test.testuds_rdbpoolref</servlet-name> <url-pattern>/uds_test.testuds_rdbpoolref</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>uds_test.testuds_rdbpoolrefex</servlet-name> <url-pattern>/uds_test.testuds_rdbpoolrefex</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>oz.uds.ozudssample</servlet-name> <url-pattern>/oz.uds.ozudssample</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>oz.uds.ozudssampleresultset</servlet-name> <url-pattern>/oz.uds.ozudssampleresultset</url-pattern> </servlet-mapping> </web-app> ODBC conf db.properties ODBC. AppExample.vendor=odbc AppExample.dsn=AppExample AppExample.user= AppExample.password= AppExample.maxconns=5 AppExample.initconns=2 AppExample.timeout=5 Member.vendor=odbc Member.dsn=AppExample Member.user= Member.password= Member.maxconns=5 Member.initconns=2 Member.timeout=5 FORCS Co., LTD 5
OZ User Data Store Manual UDS UDS DefaultUserDataStore OZUserDataStore RawDataSource Log. UDS DefaultUserDataStore. interface OZUserDataStore interface RawDataSource abstract class DefaultUserDataStore oz.uds.userdatastore package oz.uds; import java.sql.*; public interface OZUserDataStore public void init() throws OZUserDataStoreException; public ResultSet getresultset(string argument) throws OZUserDataStoreException; public void freeresultset(resultset rst); public void close(); init Prototype Definition public void init() throws OZUserDataStoreException. UDS. getresultset Prototype public ResultSet getresultset(string argument) throws OZUserDataStoreException 6 FORCS Co., LTD
A Leader of Enterprise e-business Solution Definition ResultSet. Argument argument ResultSet freeresultset Prototype Definition public void freeresultset(resultset rst) ResultSet. getresultset ResultSet freeresultset ResultSet. Argument rst ResultSet close Prototype Definition public void close(). UDS. oz.uds.basic.rawdatasource package oz.uds.basic; import oz.uds.*; public interface RawDataSource Object getrawdata(string command) throws OZUserDataStoreException; getrawdata Prototype Definition Object getrawdata(string command) throws OZUserDataStoreException unformat int, String. Argument command DefaultUserDataStore UDS Example - TestUDS.java package uds_test; import oz.uds.*; import oz.uds.basic.defaultuserdatastore; import java.sql.*; FORCS Co., LTD 7
OZ User Data Store Manual public class TestUDS extends DefaultUserDataStore static log = true; public TestUDS() System.out.println("create TestUDS..."); public synchronized void init() public synchronized ResultSet getresultset(string command) // ResultSet ResultSet if(command.equals("null")) return null; else return new TestUDSResultSet(command); public synchronized Object getrawdata(string command) throws OZUserDataStoreException return null; oz.uds.rs.defaultresult ResultSet TestUDSResultSet - TestUDSResultSet.java package uds_test; import oz.uds.rs.*; import java.sql.resultsetmetadata; import java.sql.sqlexception; //oz.uds.rs.defaultresultset. //implements java.sql.resultset, getstring().. // DefaultResultSet // ResultSet public class TestUDSResultSet extends DefaultResultSet private int cursor = 0, num_rows = 10; private String command = new String("tempResult"); TestUDSResultSet(String _command) super(); if (_command!= null) command = _command; 8 FORCS Co., LTD
A Leader of Enterprise e-business Solution public boolean next() throws SQLException // ResultSet. // 10 next cursor++; if (cursor < num_rows) return true; else return false; public String getstring(string columnname) throws SQLException return command + Integer.toString(cursor); public ResultSetMetaData getmetadata() throws SQLException // jdbc ReusltSetMetaData, //. return new TestUDSResultSetMeta("field1"); oz.uds.rs.defaultresultmeta ResultSet TestUDSResultSet - TestUDSResultSetMeta.java package uds_test; import oz.uds.rs.*; import java.sql.sqlexception; import java.sql.types; //oz.uds.rs.defaultresultsetmeta ResultSetMeta //DefaultResultSetMeta java.sql.resultsetmeta interface // public class TestUDSResultSetMeta extends DefaultResultSetMeta private String columnname = new String("tempField"); public TestUDSResultSetMeta(String _columnname) columnname = _columnname; public int getcolumncount() throws SQLException return 1; public String getcolumnname(int column) throws SQLException return columnname; FORCS Co., LTD 9
OZ User Data Store Manual public String getcolumnlabelname(int column) throws SQLException return columnname; public int getcolumntype(int column) throws SQLException return Types.VARCHAR; public String getcolumnlabel(int int0) throws SQLException return columnname; UDS. ODI TestUDS.class. []. 10 FORCS Co., LTD
A Leader of Enterprise e-business Solution ( ),. ODI. "class1_1.odi". "class1_1.odi". "ODI " "class1_1", "" "SET_1". "SET_1" "field1" &. FORCS Co., LTD 11
OZ User Data Store Manual. JDBC UDS JDBC UDS JDBCBasedUDS DefaultUserDataStore getjdbcname(), getjdbcurl(). 12 FORCS Co., LTD
A Leader of Enterprise e-business Solution interface OZUserDataStore interface RawDataSource abstract class DefaultUserDataStore abstract class JDBCBasedUDS JDBCBasedUDS UDS Example - TestJDBCUDS.java getjdbcname() getjdbcurl() init() URL Connection. package uds_test; import oz.uds.*; import oz.uds.basic.*; import java.sql.*; public class TestJDBCUDS extends JDBCBasedUDS public void init() throws OZUserDataStoreException super.init(); DefaultUserDataStore.log = true; public String getjdbcname() return "sun.jdbc.odbc.jdbcodbcdriver"; public String getjdbcurl() return "jdbc:odbc:appexample"; // JDBCBasedUDS public ResultSet getresultset(string command) throws OZUserDataStoreException if(log)log("############### getresultset ##################"); try command = processcommand(command); ResultSet rst = stmt.executequery(command); return rst; catch (SQLException e) if(log)e.printstacktrace(ps); throw new OZUserDataStoreException(e.getMessage()); FORCS Co., LTD 13
OZ User Data Store Manual // JDBCBasedUDS public Object getrawdata(string command) throws OZUserDataStoreException return null; // JDBCBasedUDS public void close() super.close(); try if(stmt!= null)stmt.close(); stmt = null; if(conn!= null)conn.close(); conn = null; catch (SQLException e) if(log)e.printstacktrace(ps); JDBC UDS. ODI TestJDBCUDS.class.. 14 FORCS Co., LTD
A Leader of Enterprise e-business Solution ( ). ODI. "class1_2.odi". "class1_2.odi". "ODI " "class1_2", "" "SET_1". &, []. FORCS Co., LTD 15
OZ User Data Store Manual. 16 FORCS Co., LTD
A Leader of Enterprise e-business Solution Connection UDS UDS DB Connection Pool Connection oz.uds.ozrdbpoolref.java implements. oz.uds.ozrdbpoolref package oz.uds; /** * RDB UDS ConnectionPool * interface implements. * implements UDS close() * connection close(). */ public interface OZRDBPoolRef /** * UDS DB Alias *, db.properties. * @return alias name */ public String getdbalias(); /** * ConnectionPool Connection * UDS Connection. * obj[0] - java.sql.connection : Connection * obj[1] - java.lang.string : Session ID of Connection * @param obj Connection Info. */ public void setdbconnection(object[] obj); getdbalias Prototype Definition public String getdbalias() UDS DB Pool Alias.. setdbconnection Prototype public void setdbconnection(object[] obj) FORCS Co., LTD 17
OZ User Data Store Manual Definition UDS Connection DB Pool.. Argument obj Alias Connection DB Pool Connection obj[0] : Connection obj[1] : Session ID : getdbalias( Connection DB Pool ) setdbconnection( Connection UDS ) init() OZRDBPoolRef Connection ODI RDB Store, Store Auto Commit. OZRDBPoolRef implements Connection Pool close() Connection Close. OZRDBPoolRef implements init(), close(). init Connection UDS OZRDBPoolRef implements UDS Connection setdbconnections(). UDS setdbconnection() init(). OZRDBPoolRef UDS Example - TestUDS_RDBPoolRef.java package uds_test; import java.sql.*; import oz.uds.*; import oz.uds.basic.defaultuserdatastore; import oz.uds.rs.*; public class TestUDS_RDBPoolRef extends DefaultUserDataStore implements OZRDBPoolRef 18 FORCS Co., LTD
A Leader of Enterprise e-business Solution private Connection conn; private Statement stmt; /** * init DB alias. * Connection db.properties. * @return alias name */ public String getdbalias() return "AppExample"; /** * ConnectionPool Connection * UDS Connection. * obj[0] - java.sql.connection : Connection * obj[1] - java.lang.string : Session ID of Connection * @param obj Connection Info. */ public void setdbconnection(object[] obj) try conn = (Connection)obj[0]; catch(exception e) e.printstacktrace(); public void init() throws OZUserDataStoreException try stmt = conn.createstatement(); catch(exception e) e.printstacktrace(); throw new OZUserDataStoreException(e.getMessage()); public void close() try if(stmt!= null) try stmt.close(); FORCS Co., LTD 19
OZ User Data Store Manual stmt = null; catch(exception e) catch(exception e) e.printstacktrace(); public Object getrawdata(string string) throws OZUserDataStoreException return null; public ResultSet getresultset(string command) throws OZUserDataStoreException try System.out.println("COMMAND :" + command); return stmt.executequery(command); catch(exception e) e.printstacktrace(); throw new OZUserDataStoreException(e.toString()); public void freeresultset(resultset rst) if(rst!= null) try rst.close(); catch(exception e) Connection UDS. ODI 20 FORCS Co., LTD
A Leader of Enterprise e-business Solution TestUDS_RDBPoolRef.class... ODI. "class1_3.odi". "class1_3.odi". FORCS Co., LTD 21
OZ User Data Store Manual "ODI " "class1_3", "" "SET_1".. [] []... 22 FORCS Co., LTD
A Leader of Enterprise e-business Solution Connection UDS UDS DB Connection Pool Connection oz.uds.ozrdbpoolrefex.java implements. oz.uds.ozrdbpoolrefex package oz.uds; import java.util.hashmap; /** * Description: RDB UDS ConnectionPool * Connection interface implements. * implements UDS close() * connection close(). */ public interface OZRDBPoolRefEX /** * UDS DB Alias *, db.properties. * @return alias name FORCS Co., LTD 23
OZ User Data Store Manual */ public String[] getdbaliasarray(); /** * ConnectionPool Connection * UDS Connection. * map - KEY:alias, VALUE:Object[2] * obj[0] - java.sql.connection : Connection * obj[1] - java.lang.string : Session ID of Connection */ public void setdbconnections(hashmap map); getdbaliasarray Prototype Definition public String getdbaliasarray() UDS DB Pool alias. alias.. setdbconnections Prototype Definition public void setdbconnections(hashmap map) UDS Connection DB Pool HashMap. alias Connection null. Argument map key : alias name value : Object[2] [0] : Connection [1] : Session ID : getdbaliasarray( Connection DB Pool ) setdbconnections( Connection UDS ) init() OZRDBPoolRefEX Connection ODI RDB Store, Store Auto Commit. OZRDBPoolRefEX implements Connection Pool close() Connection 24 FORCS Co., LTD
A Leader of Enterprise e-business Solution Close. OZRDBPoolRefEX implements init(), close(). init Connection UDS OZRDBPoolRef implements UDS Connection setdbconnections(). UDS setdbconnections() init(). OZRDBPoolRefEX UDS Example - TestUDS_RDBPoolRefEX.java package uds_test; import java.sql.*; import java.util.*; import oz.uds.*; import oz.uds.basic.defaultuserdatastore; import oz.uds.rs.*; public class TestUDS_RDBPoolRef extends DefaultUserDataStore implements OZRDBPoolRefEX private Connection conn1; private Connection conn2; private Connection conn3; private Statement stmt1; private Statement stmt2; private Statement stmt3; String[] aliases = "AppExample", "Member", "Unknown" ; /** * UDS DB Alias. *, db.properties. * @return alias name */ public String[] getdbaliasarray() return aliases; /** * ConnectionPool Connection FORCS Co., LTD 25
OZ User Data Store Manual * UDS Connection. * map [KEY:alias, VALUE:Object[2] * obj[0] - java.sql.connection : Connection * obj[1] - java.lang.string : Session ID of Connection * @param obj Connection Info. */ public void setdbconnections(hashmap map) try Object[] obj = null; obj = (Object[])map.get(aliases[0]); if(obj!= null) conn1 = (Connection)obj[0]; obj = (Object[])map.get(aliases[1]); if(obj!= null) conn2 = (Connection)obj[0]; obj = (Object[])map.get(aliases[2]); if(obj!= null) conn3 = (Connection)obj[0]; catch(exception e) e.printstacktrace(); public void init() throws OZUserDataStoreException try stmt1 = conn1.createstatement(); stmt2 = conn2.createstatement(); stmt3 = conn3.createstatement(); catch(exception e) e.printstacktrace(); throw new OZUserDataStoreException(e.getMessage()); public void close() try if (stmt1!= null) stmt1.close(); if (stmt2!= null) stmt2.close(); if (stmt3!= null) stmt3.close(); catch(exception e) e.printstacktrace(); 26 FORCS Co., LTD
A Leader of Enterprise e-business Solution public Object getrawdata(string string) throws OZUserDataStoreException return null; public ResultSet getresultset(string command) throws OZUserDataStoreException try /** * stmt1,2,3 command. * stmt1. */ System.out.println("COMMAND :" + command); return stmt1.executequery(command); catch(exception e) e.printstacktrace(); throw new OZUserDataStoreException(e.toString()); public void freeresultset(resultset rst) if(rst!= null) try rst.close(); catch(exception e) Connection UDS. ODI TestUDS_RDBPoolRefEX.class. FORCS Co., LTD 27
OZ User Data Store Manual. ( ). ODI. "class1_4.odi". "class1_4.odi". "ODI " "class1_4", "" "SET_1".. 28 FORCS Co., LTD
A Leader of Enterprise e-business Solution [] []... FORCS Co., LTD 29
OZ User Data Store Manual 30 FORCS Co., LTD
A Leader of Enterprise e-business Solution DataAction UDS DataAction oz.uds.ozframeworkdatastore. oz.uds.ozframeworkdatastore package oz.uds; import java.sql.*; public interface OZFrameworkUserDataStore extends OZUserDataStore /** * insert a row. * * it can be implemented as following SQL like logic. * * INSERT INTO 'table' (src_fields[0], field_namses[1],...) * VALUES(src_values[0], src_value[1],...) * * extra arugment can be used to convert spacial types (TO_DATE etc) or * modify data. * * @param src_fields * field name array. * it's size varies from 0 to the number of fields in the table. * @param src_values * the target row's field data array faired with 'src_fields'. * it's size can be 0 to the number of fields in the table. * @param ext * extra argument if needs. * @return * number of inserted rows. (always 1 if normal) * @throws OZUserDataStoreException * @since 3.0 */ public abstract int insertrow(string cmd, String[] src_fields, Object[] src_values, String ext) throws OZUserDataStoreException; FORCS Co., LTD 31
OZ User Data Store Manual /** * delete row(s). * * it can be implemented as following SQL like logic. * * DELETE FROM 'table' WHERE dst_fields[0] = dst_values[0] * AND dst_fields[1] = dst_values[1] * AND... * AND extra condition * * @param dst_fields * field name array. * it's size varies from 0 to the number of fields in the table. * @param dst_values * the target row's field data array faired with 'field_names'. * it's size can be 0 to the number of fields in the table. * the type of value is one of following. * * [Java types] [SQL types] * java.io.inputstream BINARY VARBINARY LONGVARBINARY BLOB * java.lang.string CHAR LONGVARCHAR VARCHAR CLOB * java.sql.date DATE * java.sql.time TIME * java.sql.timestamp TIMESTAMP * java.lang.integer SMALLINT TUNYINT INTEGER * java.lang.double BIGINT FLOAT DOUBLE REAL NUMERIC DECIMAL * java.lang.boolean BIT * * @param ext * extra condition if needs. * @return * number of deleted rows. * @throws OZUserDataStoreException * @since 3.0 */ public abstract int deleterow(string cmd, String[] dst_fields, Object[] dst_values, String ext) throws OZUserDataStoreException; /** * update row(s). * * it can be implemented as following SQL like logic. * * UPDATE 'table' SET src_fields[0] = src_values[0], * src_field[1] = src_values[1], 32 FORCS Co., LTD
A Leader of Enterprise e-business Solution *... * WHERE dst_fields[0] = dst_values[0] * AND dst_fields[1] = dst_values[1] * AND... * AND ext * * extra arugment can be used to convert spacial types (TO_DATE etc) or * modify data. * * @param dst_fields * destination row's field name array. * it's size varies from 0 to the number of fields in the table. * @param dst_values * destination row's field data array faired with 'dst_fields'. * it's size can be 0 to the number of fields in the table. * @param src_fields * the source field name array to update. * it's size varies from 0 to the number of fields in the table. * @param src_values * the source field data array aligned with 'dst_fields' to update. * it's size can be 0 to the number of fields in the table. * @param argument * extra argument if needs. * @return * number of updated rows. * @throws OZUserDataStoreException * @since 3.0 */ public abstract int updaterow(string cmd, String[] dst_fields, Object[] dst_values, String[] src_fields, Object[] src_values, String ext) throws OZUserDataStoreException; /** * commit all data actions * * called after all data action transactions are successfully completed. * * @since 3.0 */ public abstract void commit() throws OZUserDataStoreException; /** * FORCS Co., LTD 33
OZ User Data Store Manual * rollback all data actions * * called if exception occured while doing data actions. * * @since 3.0 */ public abstract void rollback()throws OZUserDataStoreException; insertrow Prototype Definition public abstract int insertrow(string cmd, String[] src_fields, Object[] src_values, String ext) throws OZUserDataStoreException. Argument cmd src_fields src_values ext Array Array deleterow Prototype Definition public abstract int deleterow(string cmd, String[] dst_fields, Object[] dst_values, String ext) throws OZUserDataStoreException. Argument cmd dst_fields dst_values ext Array Array updaterow Prototype Definition public abstract int updaterow(string cmd, String[] dst_fields, Object[] dst_values, String[] src_fields, Object[] src_values, String ext) throws OZUserDataStoreException. Argument cmd dst_fields Array 34 FORCS Co., LTD
A Leader of Enterprise e-business Solution dst_values src_fields src_values ext Array Array Array commit Prototype Definition public abstract void commit() throws OZUserDataStoreException DataAction Commit(). rollback Prototype Definition public abstract void rollback() throws OZUserDataStoreException Commit rollback. OZFrameworkUserDataStore UDS Example - DefaultOZFrameworkUDS.java package oz.uds.appexample; import oz.uds.*; import oz.uds.basic.*; public class DefaultOZFrameworkUDS extends JDBCBasedUDS implements OZFrameworkUserDataStore public void init() throws OZUserDataStoreException super.init(); DefaultUserDataStore.log = true; public String getjdbcname() return "sun.jdbc.odbc.jdbcodbcdriver"; public String getjdbcurl() return "jdbc:odbc:appexample"; public int insertrow(string cmd, FORCS Co., LTD 35
OZ User Data Store Manual \n"); \n"); String[] src_fields, Object[] src_values, String ext) throws OZUserDataStoreException StringBuffer info = new StringBuffer(); info.append("test_dac_uds : insertrow ---------------------------------- info.append("cmd :" + cmd + "\n"); for(int i=0; i<src_fields.length; i++) info.append("sf"+i+"["+src_fields[i]+"] :" + src_values[i] + "\n"); info.append("ext :" + ext + "\n\n"); info.append("----------------------------------------------------------- System.out.println(info.toString()); try return stmt.executeupdate(cmd); catch(java.sql.sqlexception sqlexception) throw new OZUserDataStoreException(sqlexception.getMessage()); public int deleterow(string cmd, String[] dst_fields, Object[] dst_values, String ext) throws OZUserDataStoreException StringBuffer info = new StringBuffer(); info.append("test_dac_uds : deleterow ---------------------------------- \n"); info.append("cmd :" + cmd + "\n"); for(int i=0; i<dst_fields.length; i++) info.append("df"+i+"["+dst_fields[i]+"] :" + dst_values[i] + "\n"); info.append("ext :" + ext + "\n\n"); info.append("----------------------------------------------------------- \n"); System.out.println(info.toString()); try return stmt.executeupdate(cmd); catch(java.sql.sqlexception sqlexception) 36 FORCS Co., LTD
A Leader of Enterprise e-business Solution if(defaultuserdatastore.log) sqlexception.printstacktrace(defaultuserdatastore.ps); throw new OZUserDataStoreException(sqlexception.getMessage()); public int updaterow(string cmd, String[] dst_fields, Object[] dst_values, String[] src_fields, Object[] src_values, String ext) throws OZUserDataStoreException StringBuffer info = new StringBuffer(); info.append("test_dac_uds : updaterow ---------------------------------- \n"); info.append("cmd :" + cmd + "\n"); for(int i=0; i<src_fields.length; i++) info.append("sf"+i+"["+src_fields[i]+"] :" + src_values[i] + "\n"); for(int i=0; i<dst_fields.length; i++) info.append("df"+i+"["+dst_fields[i]+"] :" + dst_values[i] + "\n"); info.append("ext :" + ext + "\n\n"); info.append("----------------------------------------------------------- \n"); System.out.println(info.toString()); try return stmt.executeupdate(cmd); catch(java.sql.sqlexception sqlexception) if(defaultuserdatastore.log) sqlexception.printstacktrace(defaultuserdatastore.ps); throw new OZUserDataStoreException(sqlexception.getMessage()); public boolean isinsertrowavailable() return true; public String insertcommand(string cmd, FORCS Co., LTD 37
OZ User Data Store Manual String[] src_fields, Object[] src_values, String ext) throws OZUserDataStoreException StringBuffer result = new StringBuffer("INSERT INTO " + ext + "("); for( int i = 0; i < src_fields.length; i++) if (i == (src_fields.length-1)) result.append(src_fields[i]); else result.append(src_fields[i]).append(", "); result.append(") VALUES ( "); for( int i = 0; i < src_values.length; i++) if (i == (src_values.length-1)) result.append(src_values[i]); else result.append(src_values[i]).append(", "); return result.append(")").tostring(); public boolean isdeleterowavailable() return true; public String deletecommand(string cmd, String[] dst_fields, Object[] dst_values, String ext) throws OZUserDataStoreException StringBuffer result = new StringBuffer("DELETE FROM " + ext + " WHERE "); for( int i = 0; i < dst_fields.length; i++) if (i == 0) result.append(dst_fields[i]).append(" = ").append(dst_values[i]); 38 FORCS Co., LTD
A Leader of Enterprise e-business Solution else result.append(" AND ").append(dst_fields[i]).append(" = ").append(dst_values[i]); return result.tostring(); public boolean isupdaterowavailable() return true; public String updatecommand(string cmd, String[] dst_fields, Object[] dst_values, String[] src_fields, Object[] src_values, String ext) throws OZUserDataStoreException StringBuffer result = new StringBuffer("UPDATE " + ext + " SET "); for( int i = 0; i < src_fields.length; i++) if (i == (src_fields.length-1)) result.append(src_fields[i]).append(" = ").append(src_values[i]); else result.append(src_fields[i]).append(" = ").append(src_values[i]).append(", "); result.append(" WHERE "); for( int i = 0; i < dst_fields.length; i++) if (i == 0) result.append(dst_fields[i]).append(" = ").append(dst_values[i]); else result.append(" AND ").append(dst_fields[i]).append(" = ").append(dst_values[i]); FORCS Co., LTD 39
OZ User Data Store Manual return result.tostring(); /** * commit all data actions * * called after all data action transactions are successfully completed. * * @since 3.0 */ public void commit() throws OZUserDataStoreException if(defaultuserdatastore.log) log("############### commit ##################"); try conn.commit(); catch(java.sql.sqlexception sqlexception) if(defaultuserdatastore.log) sqlexception.printstacktrace(defaultuserdatastore.ps); throw new OZUserDataStoreException(sqlexception.getMessage()); public boolean iscommitavailable() throws OZUserDataStoreException return true; /** * * rollback all data actions * * called if exception occured while doing data actions. * * @since 3.0 */ public void rollback() throws OZUserDataStoreException 40 FORCS Co., LTD
A Leader of Enterprise e-business Solution if(defaultuserdatastore.log) log("############### rollback ##################"); try conn.rollback(); catch(java.sql.sqlexception sqlexception) if(defaultuserdatastore.log) sqlexception.printstacktrace(defaultuserdatastore.ps); throw new OZUserDataStoreException(sqlexception.getMessage()); public boolean isrollbackavailable() throws OZUserDataStoreException return true;,,. ODI DefaultOZFrameworkUDS.class.. FORCS Co., LTD 41
OZ User Data Store Manual ( ).,,. insert into CarSales (#@ARG_SF1#,#@ARG_SF2#,#@ARG_SF3#,#@ARG_SF4#,#@ARG_SF5#,#@ARG_SF6#) values ('#@ARG_SV1#','#@ARG_SV2#','#@ARG_SV3#','#@ARG_SV4#','#@ARG_SV5#','#@AR G_SV6#') DELETE FROM CarSales WHERE #@ARG_DF1# = '#@ARG_DV1#' UPDATE CarSales SET #@ARG_SF1# = '#@ARG_SV1#', #@ARG_SF2# = '#@ARG_SV2#', #@ARG_SF3# = '#@ARG_SV3#', #@ARG_SF4# = '#@ARG_SV4#', #@ARG_SF5# = '#@ARG_SV5#', #@ARG_SF6# = '#@ARG_SV6#' WHERE #@ARG_DF1# = '#@ARG_DV1#' ODI. "class2_1.odi". 42 FORCS Co., LTD
A Leader of Enterprise e-business Solution "class2_1.odi". Board "AllowInsert", "AllowDelete", "AllowUpdate" "True", "CellSelectionMode" "Single", "ODIKey" "class2_1", "DataSet" "SET_1". "#OZDeleteFlag#" "ColumnEditable" "True". FORCS Co., LTD 43
OZ User Data Store Manual Board OnClick DataAction. Table1.CommitQueuedActions(); Table1.GetDataSet().RefreshDataSet();,. DataAction. 44 FORCS Co., LTD
A Leader of Enterprise e-business Solution. Delete,. [Commit DataAction] DataAction. FORCS Co., LTD 45
OZ User Data Store Manual - DataAction UDS DataAction oz.uds.ozframeworkdatastore. oz.uds.ozframeworkdatastore. UDS OZUDSDataActionRef. OZFrameworkDataStore insert/delete/update/commit int OZUDSDataActionRef insert/delete/update/commit String OZUDSDataActionRef. oz.uds.ozudsdataactionref package oz.uds; import java.util.hashtable; public interface OZUDSDataActionRef extends OZUserDataStore 46 FORCS Co., LTD
A Leader of Enterprise e-business Solution /** * insert a row. * * it can be implemented as following SQL like logic. * * INSERT INTO 'table' (src_fields[0], field_namses[1],...) * VALUES(src_values[0], src_value[1],...) * * extra arugment can be used to convert spacial types (TO_DATE etc) or * modify data. * * @param src_fields * field name array. * it's size varies from 0 to the number of fields in the table. * @param src_values * the target row's field data array faired with 'src_fields'. * it's size can be 0 to the number of fields in the table. * @param ext * extra argument if needs. * @param param * Field name and value of Parameter and MasterSet * @return * number of inserted rows. (always 1 if normal) * @throws OZUserDataStoreException * @since 3.0 */ public abstract String insertrow(string cmd, String[] src_fields, Object[] src_values, String ext, Hashtable param) throws OZUserDataStoreException; /** * delete row(s). * * it can be implemented as following SQL like logic. * * DELETE FROM 'table' WHERE dst_fields[0] = dst_values[0] * AND dst_fields[1] = dst_values[1] * AND... * AND extra condition * * @param dst_fields * field name array. * it's size varies from 0 to the number of fields in the table. FORCS Co., LTD 47
OZ User Data Store Manual * @param dst_values * the target row's field data array faired with 'field_names'. * it's size can be 0 to the number of fields in the table. * the type of value is one of following. * * [Java types] [SQL types] * java.io.inputstream BINARY VARBINARY LONGVARBINARY BLOB * java.lang.string CHAR LONGVARCHAR VARCHAR CLOB * java.sql.date DATE * java.sql.time TIME * java.sql.timestamp TIMESTAMP * java.lang.integer SMALLINT TUNYINT INTEGER * java.lang.double BIGINT FLOAT DOUBLE REAL NUMERIC DECIMAL * java.lang.boolean BIT * * @param ext * extra condition if needs. * @param param * Field name and value of Parameter and MasterSet * @return * number of deleted rows. * @throws OZUserDataStoreException * @since 3.0 */ public abstract String deleterow(string cmd, String[] dst_fields, Object[] dst_values, String ext, Hashtable param) throws OZUserDataStoreException; /** * update row(s). * * it can be implemented as following SQL like logic. * * UPDATE 'table' SET src_fields[0] = src_values[0], * src_field[1] = src_values[1], *... * WHERE dst_fields[0] = dst_values[0] * AND dst_fields[1] = dst_values[1] * AND... * AND ext * * extra arugment can be used to convert spacial types (TO_DATE etc) or * modify data. 48 FORCS Co., LTD
A Leader of Enterprise e-business Solution * * @param dst_fields * destination row's field name array. * it's size varies from 0 to the number of fields in the table. * @param dst_values * destination row's field data array faired with 'dst_fields'. * it's size can be 0 to the number of fields in the table. * @param src_fields * the source field name array to update. * it's size varies from 0 to the number of fields in the table. * @param src_values * the source field data array aligned with 'dst_fields' to update. * it's size can be 0 to the number of fields in the table. * @param argument * extra argument if needs. * @param param * Field name and value of Parameter and MasterSet * @return * number of updated rows. * @throws OZUserDataStoreException * @since 3.0 */ public abstract String updaterow(string cmd, String[] dst_fields, Object[] dst_values, String[] src_fields, Object[] src_values, String ext, Hashtable param) throws OZUserDataStoreException; /** * commit all data actions * * called after all data action transactions are successfully completed. * * @since 3.0 */ public abstract String commit() throws OZUserDataStoreException; /** * rollback all data actions * * called if exception occured while doing data actions. * * @since 3.0 FORCS Co., LTD 49
OZ User Data Store Manual */ public abstract void rollback() throws OZUserDataStoreException; insertrow Prototype Definition public abstract String insertrow(string cmd, String[] src_fields, Object[] src_values, String ext, Hashtable param) throws OZUserDataStoreException. Argument cmd src_fields src_values ext param Array Array (OZMap ) deleterow Prototype Definition public abstract String deleterow(string cmd, String[] dst_fields, Object[] dst_values, String ext, Hashtable param) throws OZUserDataStoreException. Argument cmd dst_fields dst_values ext param Array Array (OZMap ) updaterow Prototype Definition public abstract String updaterow(string cmd, String[] dst_fields, Object[] dst_values, String[] src_fields, Object[] src_values, String ext, Hashtable param) throws OZUserDataStoreException. Argument cmd 50 FORCS Co., LTD
A Leader of Enterprise e-business Solution dst_fields dst_values src_fields src_values ext param Array Array Array Array (OZMap ) commit Prototype Definition public abstract String commit() throws OZUserDataStoreException DataAction Commit(). rollback Prototype Definition public abstract void rollback() throws OZUserDataStoreException Commit rollback. OZMap insertrow, deleterow, updaterow Hashtable param OZMap. OZMap. Key[String] : Set, Value[OZMap] : Set (FieldName, FieldValue) OZMap Map Key. OZMap. clear Prototype Definition public synchronized void clear() Map. containskey Prototype public synchronized boolean containskey(object key) FORCS Co., LTD 51
OZ User Data Store Manual Definition Map Key. Key true. Argument key Key containsvalue Prototype Definition public boolean containsvalue(object value) Map. true. Argument value elements Prototype Definition public Iterator elements() Map Value Iterator. get Prototype Definition public Object get(object key) Key. Key null. Argument key Key isempty Prototype Definition public boolean isempty() Map, true. keys Prototype Definition public Iterator keys() Map Key Iterator. put Prototype Definition public synchronized void put(object key, Object value) throws IllegalArgumentException Map Key. Argument key Map Key 52 FORCS Co., LTD
A Leader of Enterprise e-business Solution value Key remove Prototype public synchronized Object remove(object key) Map Key, Key Definition. Argument key Key size Prototype Definition public int size() Map Key Set. tostring Prototype Definition public String tostring() Key String. OZUDSDataActionRef UDS Example - UDSDataActionMARef.java.java package oz.uds.appexample; import java.util.*; import oz.uds.*; import oz.uds.basic.*; import oz.util.ozmap; /** * <p>title: </p> * <p>description: </p> * <p>copyright: Copyright (c) 2003</p> * <p>company: </p> * @author not attributable * @version 1.0 */ public class UDSDataActionMARef extends JDBCBasedUDS implements OZUDSDataActionRef public void init() FORCS Co., LTD 53
OZ User Data Store Manual throws OZUserDataStoreException super.init(); DefaultUserDataStore.log = true; public String getjdbcname() return "sun.jdbc.odbc.jdbcodbcdriver"; public String getjdbcurl() return "jdbc:odbc:appexample"; public String insertrow(string cmd, String[] src_fields, Object[] src_values, String ext, Hashtable param) throws OZUserDataStoreException StringBuffer info = new StringBuffer(); info.append("test_dac_uds : insertrow ---------------------------------- \n"); info.append("cmd :" + cmd + "\n"); for(int i=0; i<src_fields.length; i++) info.append("sf"+i+"["+src_fields[i]+"] :" + src_values[i] + "\n"); info.append("ext :" + ext + "\n\n"); Enumeration sets = param.keys(); String key = null; while(sets.hasmoreelements()) key = (String)sets.nextElement(); OZMap map = (OZMap)param.get(key); Iterator iterk = map.keys(); Iterator iterv = map.elements(); while(iterk.hasnext() && iterv.hasnext()) info.append("[" + key + "] "+iterk.next()+":" +iterv.next()+"\n"); info.append("----------------------------------------------------------- \n"); System.out.println(info.toString()); try //insert Action 54 FORCS Co., LTD
A Leader of Enterprise e-business Solution return "insert:"+stmt.executeupdate(cmd); catch(java.sql.sqlexception sqlexception) throw new OZUserDataStoreException(sqlexception.getMessage()); public String deleterow(string cmd, String[] dst_fields, Object[] dst_values, String ext, Hashtable param) throws OZUserDataStoreException StringBuffer info = new StringBuffer(); info.append("test_dac_uds : deleterow ---------------------------------- \n"); info.append("cmd :" + cmd + "\n"); for(int i=0; i<dst_fields.length; i++) info.append("df"+i+"["+dst_fields[i]+"] :" + dst_values[i] + "\n"); info.append("ext :" + ext + "\n\n"); Enumeration sets = param.keys(); String key = null; while(sets.hasmoreelements()) key = (String)sets.nextElement(); OZMap map = (OZMap)param.get(key); Iterator iterk = map.keys(); Iterator iterv = map.elements(); while(iterk.hasnext() && iterv.hasnext()) info.append("[" + key + "] "+iterk.next()+":" +iterv.next()+"\n"); info.append("----------------------------------------------------------- \n"); System.out.println(info.toString()); try //delete Action return "delete:"+stmt.executeupdate(cmd); catch(java.sql.sqlexception sqlexception) if(defaultuserdatastore.log) sqlexception.printstacktrace(defaultuserdatastore.ps); throw new OZUserDataStoreException(sqlexception.getMessage()); FORCS Co., LTD 55
OZ User Data Store Manual public String updaterow(string cmd, String[] dst_fields, Object[] dst_values, String[] src_fields, Object[] src_values, String ext, Hashtable param) throws OZUserDataStoreException StringBuffer info = new StringBuffer(); info.append("test_dac_uds : updaterow ---------------------------------- \n"); info.append("cmd :" + cmd + "\n"); for(int i=0; i<src_fields.length; i++) info.append("sf"+i+"["+src_fields[i]+"] :" + src_values[i] + "\n"); for(int i=0; i<dst_fields.length; i++) info.append("df"+i+"["+dst_fields[i]+"] :" + dst_values[i] + "\n"); info.append("ext :" + ext + "\n\n"); Enumeration sets = param.keys(); String key = null; while(sets.hasmoreelements()) key = (String)sets.nextElement(); OZMap map = (OZMap)param.get(key); Iterator iterk = map.keys(); Iterator iterv = map.elements(); while(iterk.hasnext() && iterv.hasnext()) info.append("[" + key + "] "+iterk.next()+":" +iterv.next()+"\n"); info.append("----------------------------------------------------------- \n"); System.out.println(info.toString()); try //update Action return "update:"+stmt.executeupdate(cmd); catch(java.sql.sqlexception sqlexception) if(defaultuserdatastore.log) sqlexception.printstacktrace(defaultuserdatastore.ps); throw new OZUserDataStoreException(sqlexception.getMessage()); 56 FORCS Co., LTD
A Leader of Enterprise e-business Solution public boolean isinsertrowavailable() return true; public String insertcommand(string cmd, String[] src_fields, Object[] src_values, String ext) throws OZUserDataStoreException StringBuffer result = new StringBuffer("INSERT INTO " + ext + "("); for( int i = 0; i < src_fields.length; i++) if (i == (src_fields.length-1)) result.append(src_fields[i]); else result.append(src_fields[i]).append(", "); result.append(") VALUES ( "); for( int i = 0; i < src_values.length; i++) if (i == (src_values.length-1)) result.append(src_values[i]); else result.append(src_values[i]).append(", "); return result.append(")").tostring(); public boolean isdeleterowavailable() return true; public String deletecommand(string cmd, String[] dst_fields, Object[] dst_values, String ext) throws OZUserDataStoreException FORCS Co., LTD 57
OZ User Data Store Manual StringBuffer result = new StringBuffer("DELETE FROM " + ext + " WHERE "); for( int i = 0; i < dst_fields.length; i++) if (i == 0) result.append(dst_fields[i]).append(" = ").append(dst_values[i]); else result.append(" AND ").append(dst_fields[i]).append(" = ").append(dst_values[i]); return result.tostring(); public boolean isupdaterowavailable() return true; public String updatecommand(string cmd, String[] dst_fields, Object[] dst_values, String[] src_fields, Object[] src_values, String ext) throws OZUserDataStoreException StringBuffer result = new StringBuffer("UPDATE " + ext + " SET "); for( int i = 0; i < src_fields.length; i++) if (i == (src_fields.length-1)) result.append(src_fields[i]).append(" = ").append(src_values[i]); else result.append(src_fields[i]).append(" = ").append(src_values[i]).append(", "); result.append(" WHERE "); for( int i = 0; i < dst_fields.length; i++) if (i == 0) result.append(dst_fields[i]).append(" = ").append(dst_values[i]); 58 FORCS Co., LTD
A Leader of Enterprise e-business Solution else result.append(" AND ").append(dst_fields[i]).append(" = ").append(dst_values[i]); return result.tostring(); /** * commit all data actions * * called after all data action transactions are successfully completed. * * @since 3.0 */ public String commit() throws OZUserDataStoreException if(defaultuserdatastore.log) log("############### commit ##################"); try conn.commit(); return "commit"; catch(java.sql.sqlexception sqlexception) if(defaultuserdatastore.log) sqlexception.printstacktrace(defaultuserdatastore.ps); throw new OZUserDataStoreException(sqlexception.getMessage()); public boolean iscommitavailable() throws OZUserDataStoreException return true; /** * * rollback all data actions FORCS Co., LTD 59
OZ User Data Store Manual * * called if exception occured while doing data actions. * * @since 3.0 */ public void rollback() throws OZUserDataStoreException if(defaultuserdatastore.log) log("############### rollback ##################"); try conn.rollback(); catch(java.sql.sqlexception sqlexception) if(defaultuserdatastore.log) sqlexception.printstacktrace(defaultuserdatastore.ps); throw new OZUserDataStoreException(sqlexception.getMessage()); public boolean isrollbackavailable() throws OZUserDataStoreException return true;,,. ODI UDSDataActionMARef.class. 60 FORCS Co., LTD
A Leader of Enterprise e-business Solution. ( )... FORCS Co., LTD 61
OZ User Data Store Manual (. ) []. MASTER DETAIL - 62 FORCS Co., LTD
A Leader of Enterprise e-business Solution DETAIL "" "MASTER". DETAIL,,. INSERT INTO ECustomer ( #@ARG_SF1#, #@ARG_SF2#, #@ARG_SF3#, #@ARG_SF4#, #@ARG_SF5#, #@ARG_SF6#, #@ARG_SF7#, country ) VALUES ( #@ARG_SV1#, '#@ARG_SV2#', '#@ARG_SV3#', '#@ARG_SV4#', '#@ARG_SV5#', '#@ARG_SV6#', '#@ARG_SV7#', '#MASTER.country#' ) DELETE FROM ECustomer WHERE #@ARG_DF1# = #@ARG_DV1# and country = '#MASTER.country#' UPDATE ECustomer SET #@ARG_SF2# = '#@ARG_SV2#', #@ARG_SF3# = '#@ARG_SV3#', #@ARG_SF4# = '#@ARG_SV4#', #@ARG_SF5# = '#@ARG_SV5#', #@ARG_SF6# = '#@ARG_SV6#', #@ARG_SF7# = '#@ARG_SV7#' WHERE #@ARG_DF1# = #@ARG_DV1# and country = '#MASTER.country#' ODI. "class2_2.odi" FORCS Co., LTD 63
OZ User Data Store Manual. "class2_2.odi". Board "ODIKey" "class2_2", "DataSet" "MASTER", "Field" "country", "FireRowCursorChange" "True". Board "AllowInsert", "AllowDelete", "AllowUpdate" "True", "CellSelectionMode" "Single", "ODIKey" "class2_2", "DataSet" "DETAIL". "#OZDeleteFlag#" "ColumnEditable" "True". 64 FORCS Co., LTD
A Leader of Enterprise e-business Solution Board OnClick DataAction. var Result = Table1.CommitQueuedActions(); _MessageBox(Result); Table1.GetDataSet().RefreshDataSet();,,. DataAction. FORCS Co., LTD 65
OZ User Data Store Manual. Delete,. [Commit DataAction] DataAction DataAction. 66 FORCS Co., LTD
A Leader of Enterprise e-business Solution FORCS Co., LTD 67
OZ User Data Store Manual UDS. oz.uds.ozudsparameterref. oz.uds.ozudsparameterref getparamters(), setparameters(), java.util.hashtable. oz.uds.ozudsparameterref package oz.uds; import java.util.hashtable; /** * Description: UDS DataModule * Parameter UDS interface */ public interface OZUDSParameterRef /** * Hashtable. * @return parameter hashtable */ public Hashtable getparameters(); /** *. * @param parameters Hashtable */ public void setparameters(hashtable parameters); getparameters Prototype Definition public Hashtable getparameters() Hashtable. setparameters Prototype Definition public void setparameters(hashtable parameters) Hashtable. 68 FORCS Co., LTD
A Leader of Enterprise e-business Solution Argument parameters Hashtable OZUDSParameterRef UDSParamStore Example - UDSParamStore.java package uds; import java.sql.resultset; import java.util.enumeration; import java.util.hashtable; import oz.uds.*; import oz.uds.basic.*; public class UDSParamStore extends DefaultUserDataStore implements OZUDSParameterRef private Hashtable m_parameters; static log = true; public UDSParamStore() m_parameters = new Hashtable(); public synchronized void init() public ResultSet getresultset(string argument) throws OZUserDataStoreException try m_parameters.put("command", argument); return new UDSParamResultSet(m_parameters); catch(exception ex) ex.printstacktrace(); throw new OZUserDataStoreException(ex.getMessage()); public void freeresultset(resultset resultset) FORCS Co., LTD 69
OZ User Data Store Manual public void close() m_parameters.clear(); public Hashtable getparameters() return m_parameters; public void setparameters(hashtable parameters) m_parameters = new Hashtable(); String key = ""; Enumeration keys = parameters.keys(); while(keys.hasmoreelements()) key = (String) keys.nextelement(); m_parameters.put(key, parameters.get(key)); public synchronized Object getrawdata(string command) throws OZUserDataStoreException return null; DefaultResultSet UDSParamResultSet Example - UDSParamResultSet.java package uds; import java.sql.resultsetmetadata; import java.sql.sqlexception; import java.util.*; import oz.uds.resultsetmetaskeleton; import oz.uds.rs.defaultresultset; public class UDSParamResultSet extends DefaultResultSet private Vector field1; private Vector field2; private int rowno; 70 FORCS Co., LTD
A Leader of Enterprise e-business Solution public UDSParamResultSet(Hashtable param) field1 = new Vector(); field2 = new Vector(); String f1 = ""; Object f2 = new Object(); for(enumeration enum = param.keys(); enum.hasmoreelements(); field2.add(f2!= null? f2 : "")) f1 = (String)enum.nextElement(); f2 = param.get(f1); System.out.println("[KEY:" + f1 + ", VALUE:" + f2 + "]"); field1.add(f1); rowno = -1; public boolean next() return ++rowno < field1.size(); public ResultSetMetaData getmetadata() throws SQLException return new ResultSetMetaSkeleton(new String[] "KEY", "VALUE", new String[] "VARCHAR", "VARCHAR" ); public String getstring(int col) switch(col) case 1: // '\001' return (String)field1.elementAt(rowNo); case 2: // '\002' return (String)field2.elementAt(rowNo); return "NO DATA"; FORCS Co., LTD 71
OZ User Data Store Manual public String getstring(string field) if(field == null) return "NO DATA"; if(field.equalsignorecase("key")) return getstring(1); if(field.equalsignorecase("value")) return getstring(2); else return "NO DATA"; UDSParamStore. ODI [ ]. "Parameter_City" "Parameter_Gender", "Canada" "F". 72 FORCS Co., LTD
A Leader of Enterprise e-business Solution UDSParamStore.class.. select * from ECustomer where city = "#OZParam.Parameter_City#" and gender = "#OZParam.Parameter_Gender#",. FORCS Co., LTD 73
OZ User Data Store Manual ODI. "class3_1.odi". "class3_1.odi". "ODI " "class3_1", "" "SET_1". "SET_1" "KEY" "VALUE" &. 74 FORCS Co., LTD
A Leader of Enterprise e-business Solution, (command). FORCS Co., LTD 75
OZ User Data Store Manual WAS Request UDS HttpRequest oz.uds.ozudsservletref. oz.uds.ozudsservletref oz.uds.ozuserdatastore init() setservlet() sethttprequest(). oz.uds.ozudsservletref package oz.uds; import javax.servlet.*; import javax.servlet.http.*; public interface OZUDSServletRef public void setservlet(httpservlet http_servlet); public void sethttprequest(httpservletrequest http_request); setservlet Prototype Definition public void setservlet(httpservlet http_servlet) UDS HttpServlet. Argument http_servlet http_servlet sethttprequest Prototype Definition public void sethttprequest(httpservletrequest http_request) UDS HttpRequest. Argument http_request http_request OZUDSServletRef UDSSample Example - OZUDSSample.java package oz.uds; import java.sql.*; import javax.servlet.*; 76 FORCS Co., LTD
A Leader of Enterprise e-business Solution import javax.servlet.http.*; import java.util.hashtable; import java.util.*; public class OZUDSSample implements OZUserDataStore, OZUDSServletRef, OZUDSParameterRef HttpServlet http_servlet = null; HttpServletRequest http_request = null; // methods from OZUDSServletRef public void setservlet(httpservlet http_servlet) System.out.println("http_servlet=="+http_servlet.toString()); this.http_servlet = http_servlet; public void sethttprequest(httpservletrequest http_request) System.out.println("http_request=="+http_request.toString()); this.http_request = http_request; public void setparameters(hashtable args) public Hashtable getparameters() return null; // methods from OZUserDataStore public void init() throws OZUserDataStoreException // user my_servlet & my_request public ResultSet getresultset(string argument) throws OZUserDataStoreException // return a data Vector field1 = new Vector(); Vector field2 = new Vector(); // request record add. if (http_request!= null) Enumeration enum = http_request.getparameternames(); while (enum.hasmoreelements()) String temp = (String) enum.nextelement(); System.out.println("name=" + temp + " value=" + FORCS Co., LTD 77
OZ User Data Store Manual http_request.getparameter(temp)); field1.add(temp); field2.add(http_request.getparameter(temp)); else System.out.println("http_request is null."); return new OZUDSSampleResultSet(field1, field2); public void freeresultset(resultset rst) // release resource for specific ResultSet public void close() // release all resource Servelt OZUDSSampleResultSet Example - OZUDSSampleResultSet.java package oz.uds; import java.sql.resultsetmetadata; import java.sql.sqlexception; import java.util.*; import oz.uds.resultsetmetaskeleton; import oz.uds.rs.defaultresultset; import javax.servlet.*; import javax.servlet.http.*; public class OZUDSSampleResultSet extends DefaultResultSet private Vector field1; private Vector field2; private int rowno; public OZUDSSampleResultSet(Vector value, Vector value2) field1 = value; field2 = value2; rowno = -1;//field1.size()-2; 78 FORCS Co., LTD
A Leader of Enterprise e-business Solution public boolean next() return ++rowno < field1.size(); public ResultSetMetaData getmetadata() throws SQLException return new ResultSetMetaSkeleton(new String[] "KEY", "VALUE", new String[] "VARCHAR", "VARCHAR" ); public String getstring(int col) switch(col) case 1: // '\001' return (String)field1.elementAt(rowNo); case 2: // '\002' return (String)field2.elementAt(rowNo); return "NO DATA"; public String getstring(string field) if(field == null) return "NO DATA"; if(field.equalsignorecase("key")) return getstring(1); if(field.equalsignorecase("value")) return getstring(2); else return "NO DATA"; Connection UDS FORCS Co., LTD 79
OZ User Data Store Manual. ODI OZUDSSample.class.. ( ). ODI. "class4_1.odi". "class4_1.odi". "ODI " "class4_1", "" "SET_1". 80 FORCS Co., LTD