import lotus.domino *;. import java.util.Vector; import java.util.Enumeration; public class JavaAgent extends AgentBase {public void NotesMain () {try {Session session = getSession (); AgentContext agentContext = session.getAgentContext () ; DBHandler lobs = new DBHandler (); // Instantiate root frameDateTime date = session.createDateTime ( "11/11/01"); DocumentCollection dc = agentContext.unprocessedSearch ( "AttachedFile = 1", date, 0); if (dc .Getcount ()! = 0) {INTEGER INTOBJ = New Integer (0); Document Doc = DC.GetFirstDocument (); if (Doc! = null) {Lobs.dbConnection (); if (lobs.m_connection! = null) {while (doc = null!) {Item it = doc.getFirstItem ( "UNID"); RichTextItem rtitem = (RichTextItem) doc.getFirstItem ( "attachfile"); Vector v = rtitem.getEmbeddedObjects (); Enumeration e = v. elements (); while (e.hasMoreElements ()) {EmbeddedObject eo = (EmbeddedObject) e.nextElement (); lobs.insertBLOB (it.getValueString (), eo);} doc.replaceItemValue ( "AttachedFile", intObj); Doc.save (true); doc = dc.getnextdocument (doc);} // End WH ILE (Doc! = null) Lobs.closeSession ();} // end if (lobs.m_connection! = null)} // end if (doc! = null)} log.close ();} catch (Exception E) {E.PrintStackTrace ();}}}