⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rowviewsource.java

📁 java web 开发,Java Xml 编程指南书籍源码
💻 JAVA
字号:
/* a RowViewSource is a resettable, storable,
adjustable RowSeq...it supports deletions
but not additions. It may be based on
a database, a folder of XML files, an
email folder, or some other actual source of data,
but in general a RowViewSource has a view of its
data, and does not expect to know for certain
whether or not it has all the fields required for
adding data, so the "addRow" procedure is likely
to throw an Exception ("RowViewSource.addRow not implemented",
for an email source or file, or an sql exception for a database,
or of course it might work.)

In the case of email, initSession opens an email session
with an Env which specifies

In the database case, initSession opens a connection with
an Env which specifies
dbDriver (e.g. "sun.jdbc.odbc.JdbcOdbcDriver", on classpath)
dbName   (e.g. "jdbc:odbc:PHONEBOOK")
dbUser   (e.g. "Joe Schmoe")
dbPwd    (e.g. "?hArd-tO-gUEss?")
dbSource  (e.g. "VeryPersonalNumbers")

dbQuery  (e.g. "SELECT * FROM |dbSource| ORDER BY LastName,FirstName"
dbSubstDelim (default of "|")

verbose, debug ("true" | "false", not booleans)

dbQuery will in this case be constructed by substitution, and
reconstructed whenever dbSource is changed (by setSource()); a
new RowSeq is of course constructed on top of this, with
column labels and column types to match.

Similarly, in the email case, initSession opens a connection
with an Env which specifies the protocol providers

dbDriver (e.g. "pop3" or "imap"; drivers must be on classpath)
dbName   (e.g. "mail.dreamscape.com"; some supplier).
dbUser
dbPwd
dbSource   (e.g., "INBOX" --only this is supported by pop3)

theColumnLabels  (e.g. {"msgsubject", "msgdate", "msgflags"...}
                 these are defined in the MessageData type.

theColumnTypes  (optional, otherwise set to VARCHAR)


Again, in the xml file case, initSession opens a connection

dbName   (e.g. "/C:/MyNa/xml/applets/setupfiles/" )
dbSource (e.g. "xyz.xml")

and in this case the rest is provided.

*/
package MyNa.xml;

import MyNa.utils.*;

public interface RowViewSource {
  public void initSession(Env E)throws Exception;
   // opens session with db or host or whatever;
   // sets defaults, e.g. for any sendTo operations.
  public boolean hasError();
  public String getErrorMessage();
  public String getErrorType();
   // in traditional style, an error message is cleared by reading it

  public String[]getColumnLabels();
  public String[]getColumnTypes();
  public int getNumberOfColumns();
  public int getRowNum();

  public void setDbName(String dbname);
  public void setDbDriver(String dbDriver);
  public void setDbUser(String dbUser);
  public void setDbPwd(String dbPwd);
  public void setDbSource(String sourceName);
  public void setRowNum(int N);

  public void setColumnLabels(String columnLabels);
  public void setColumnTypes(String columnTypes);
  public void setColumnLabels(String []columnLabels);
  public void setColumnTypes(String []columnTypes);


  public RowSeq getRowList();  // columnLabels view
  public RowSeq getFilteredRowList(String field,String pat);
  public RowSeq getAllColumnsRowList(); // wider view
  public Env getRow(int N);
  public void delRow(int N);
  public void delRows(String[]fieldNames,String[]vals);
   // deletes rows in which each of those fieldnames
   // has exactly the corresponding value, apart from
   // case (nulls match each other).j
  public void delRowRange(int start,int end);
  public void delRowSearch(String field,String pat);
    // deletes rows in which that field contains pat.
  public void sendTo(String sourceType,String sourceName);
   // e.g., sendTo("mail","joe@email.addr.com");
   // or sendTo("db","INBOX");
   // or sendTo("file","/C:/MyNa/msgs.xml");
   // other options can be added; e.g. sendTo("socket", "56789")
   // or sendTo("string","StringName"); may use env.

  public void sendTo(Env E); 
  public void close();

  public void addRow(String[]fieldNames,String[]vals);
   // adds row in which each of those fieldnames
   // has the corresponding value; may not be supported.

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -