Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.mitre.cvw
Class DocServerInterface  view DocServerInterface download DocServerInterface.java

java.lang.Object
  extended byorg.mitre.cvw.DocServerInterface
All Implemented Interfaces:
ObjectValues, java.lang.Runnable

public class DocServerInterface
extends java.lang.Object
implements java.lang.Runnable, ObjectValues

This class implements the Document Server public interface between a client and the Document Server.

Version:
1.0

Field Summary
private static java.util.Dictionary currentAttributes
           
private static org.mitre.cvw.docserv.Document currentDocument
           
(package private)  DSIController dsiController
           
(package private)  org.mitre.cvw.docclnt.DocFactory factory
           
(package private)  int ID
           
private  java.util.Vector mimeTypes
           
(package private)  int operation
           
(package private)  DSIParms parms
           
private  NPDocServer plugin
           
(package private)  DSIParms result
           
 
Fields inherited from interface org.mitre.cvw.ObjectValues
BALLOT, CHECKEDOUTDOC, CHECKOUT, CURRONLINEUSER, CURRUSER, DISCONNECTED, DOC, DOC_SC, DOCBUSY, DOCCHECKIN, DOCCOPY, DOCCREATE, DOCCREATEBACKGROUND, DOCCREATEDATE, DOCCREATOR, DOCCREATORONLY, DOCDELETE, DOCDESC, DOCEDITORS, DOCEXPORT, DOCINFO, DOCMIMETYPE, DOCOPEN, DOCSETDESC, DOCSTATUS, DOCTYPE, DOCUMENT, DROP, FLOOR, FOLDER, FOLDER_SC, FORM, FORMFOLDER, GETALLTYPES, GETCHECKEDDOCS, GETDOCTEXTS, GETDOCTEXTSCO, GETEXTDESC, GROUP, IMAGEMENU, NOTCHECKEDOUTDOC, NOTE, NOTE_SC, ONLINEUSER, PROXY, PROXYWIN, RECORDER, REMOTE, REMOTEUSER, REVERT, REVISION, ROOM, ROOMKEY, SETDOCATTRS, SETDOCNAME, STANDARD, TAKE, UNKNOWN, URL, URL_SC, USER, USERSTAT, WB, WHITEBOARD, WHITEBOARD_SC
 
Constructor Summary
DocServerInterface(DSIController dsiController)
          Constructor
DocServerInterface(DSIController dsiController, int Operation, DSIParms params, int myID)
          Constructor
 
Method Summary
 void AddDocComment(int docID, java.lang.String comment)
          Add a comment to the document.
 void ClearDocLock(int docID)
          Clear a document lock
 void ClearDocLog(int docID)
          Clears the document log of all editors, etc.
private  java.lang.String createDateString(java.lang.String numericDate)
           
 java.lang.Integer CreateNewDocument(java.lang.String name, java.lang.String mimeType, java.lang.String description, java.lang.String path)
          Creates a new document on the document server.
 void DocCheckin(java.lang.String objNum, int docID)
          Checks in a document from the user's home directory to the document server, asking the user for a comment about this revision.
 void DocCheckout(int docID)
          Check out a document to the current user.
 java.lang.Integer DocCopy(int docID)
          Copy a document on the document server.
 void DocDelete(int docID)
          Delete a document from the document server.
private  void DocExport(int docID, java.lang.String path)
          Exports the contents of the document to the provided file name.
private  void DocManipulate(int docID, boolean chkout, DSDB docdb)
          Actually tries to open a document, either for read only or for editing depending on the parameter sent in.
 void DocOpen(int docID, boolean shortcut, boolean doOpen, java.applet.AppletContext context)
          Open a document and display for the user.
 void DocReturn(java.lang.String objNum, int docID)
          Reverts a doc back to the doc server, scrapping changes.
 java.util.Vector DocUserStatus()
          Return a vector (list) of docID's currently checked out to the current user.
private  java.util.Dictionary getAllDocAttributes(int docID)
           
 java.util.Vector GetAllTypes()
          Get a list of available CVW types as defined by the browser.
 java.util.Vector GetCheckedDocs()
          Return a vector (list) of docID's currently checked out to anyone.
(package private) static java.util.Dictionary getCurrentAttributes()
          accessor for cached attributes
(package private) static org.mitre.cvw.docserv.Document getCurrentDocument()
          accessor for cached document.
private  java.lang.String getDocAttribute(int docID, java.lang.String attributeName)
          Get a document parameter from the docservlet
 java.lang.String GetDocCreateDate(int docID)
          Returns the document create date as a pre-built string:
 java.lang.String GetDocCreator(int docID)
          Returns the document creator as a pre-built string: on
 java.lang.String GetDocCreatorOnly(int docID)
          Returns the document creator as a pre-built string:
 java.lang.String GetDocDescription(int docID)
          Returns the description of a document.
 java.util.Vector GetDocEditors(int docID)
          Returns the list of editors and editor comments (in a vector) for a document.
 java.lang.String GetDocExtension(int docID)
          Returns the document type (MIME type) for a docID.
 java.util.Dictionary getDocInfo(int docID)
          Get all the information about a document
 java.lang.String GetDocMime(int docID)
          Returns the document type (MIME type) for a docID.
 java.lang.String GetDocName(int docID)
          Given a docID, return the document name.
 java.lang.Integer GetDocRevision(int docID)
          Returns the latest revision number of the given document.
 java.lang.String GetDocStatus(int docID)
          Get the status of a document as a pre-built string including the name, date and time of the checkout owner.
 java.lang.String GetDocType(int docID)
          Returns the type of document.
 java.util.Vector GetDocViewer(java.lang.String mimetype)
          Get the document viewer for this MIME type.
 java.lang.String GetExtDesc(java.lang.String ext)
          Match an extension to a name
 java.lang.String GetMimeSuffix(java.lang.String mimetype)
          Get type file suffix, given the MIME type
 java.lang.String GetMimeType(java.lang.String typename)
          Get the MIME type that lives with this CVW type name.
private  java.lang.String getNewFileName(int docID)
          Returns a unique filename based on date/time.
 java.util.Vector getTypeDescs(java.util.Vector ids)
          Returns a list of types (in text), given a list of docID's.
 java.util.Vector getTypeDescsCO(java.util.Vector ids)
          Returns a list of types (in text) and CheckOut status, given a list of docID's.
 java.lang.String GetTypeName(java.lang.String mimetype)
          Get the CVW type name corresponding to this MIME type
 java.lang.String LaunchDoc(DSDBEntry entry, boolean ReadOnly, boolean takeAction, java.applet.AppletContext context, boolean shortcut)
           
 void run()
          Performs the desired function on its own thread; switches on the integer doc server function and calls the appropriate method with the necessary parameters.
(package private) static void setCurrentAttributes(java.util.Dictionary attr)
          set the document attributes
(package private) static void setCurrentDocument(org.mitre.cvw.docserv.Document doc)
          set the cached document
private  void setDocAttribute(int docID, java.lang.String attributeName, java.lang.String value)
          Set a document parameter on the docservlet
private  void setDocAttributes(int docID, java.util.Dictionary attrs, boolean lock)
           
 void SetDocDescription(int docID, java.lang.String desc)
          Sets the document description.
 void SetDocName(int docID, java.lang.String name)
          Set the document name.
private  java.util.Vector stringToIntVector(java.lang.String buf)
          Converts a string buffer consisting of newline-separated ints to a vector of Integers containing the values.
private  java.util.Vector stringToLinesVector(java.lang.String buf)
          Converts a string buffer consisting of newline-separated Strings to a vector of Strings.
private  void updateLocalCache(int docID, java.lang.String name)
           
private  void xferStatus(int len)
           
private  void xferString(java.lang.String size)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

operation

int operation

ID

int ID

result

DSIParms result

parms

DSIParms parms

dsiController

DSIController dsiController

factory

org.mitre.cvw.docclnt.DocFactory factory

plugin

private NPDocServer plugin

mimeTypes

private java.util.Vector mimeTypes

currentDocument

private static org.mitre.cvw.docserv.Document currentDocument

currentAttributes

private static java.util.Dictionary currentAttributes
Constructor Detail

DocServerInterface

public DocServerInterface(DSIController dsiController)
Constructor


DocServerInterface

public DocServerInterface(DSIController dsiController,
                          int Operation,
                          DSIParms params,
                          int myID)
Constructor

Method Detail

getCurrentDocument

static org.mitre.cvw.docserv.Document getCurrentDocument()
accessor for cached document.


getCurrentAttributes

static java.util.Dictionary getCurrentAttributes()
accessor for cached attributes


setCurrentDocument

static void setCurrentDocument(org.mitre.cvw.docserv.Document doc)
set the cached document


setCurrentAttributes

static void setCurrentAttributes(java.util.Dictionary attr)
set the document attributes


run

public void run()
Performs the desired function on its own thread; switches on the integer doc server function and calls the appropriate method with the necessary parameters.

Specified by:
run in interface java.lang.Runnable

getTypeDescsCO

public java.util.Vector getTypeDescsCO(java.util.Vector ids)
                                throws org.mitre.cvw.docserv.DocServException,
                                       DocIDException
Returns a list of types (in text) and CheckOut status, given a list of docID's.


getTypeDescs

public java.util.Vector getTypeDescs(java.util.Vector ids)
                              throws org.mitre.cvw.docserv.DocServException,
                                     DocIDException
Returns a list of types (in text), given a list of docID's.


GetDocCreator

public java.lang.String GetDocCreator(int docID)
                               throws org.mitre.cvw.docserv.DocServException,
                                      DocIDException
Returns the document creator as a pre-built string: on


GetDocCreatorOnly

public java.lang.String GetDocCreatorOnly(int docID)
                                   throws org.mitre.cvw.docserv.DocServException,
                                          DocIDException
Returns the document creator as a pre-built string:


GetDocCreateDate

public java.lang.String GetDocCreateDate(int docID)
                                  throws org.mitre.cvw.docserv.DocServException,
                                         DocIDException
Returns the document create date as a pre-built string:


GetDocType

public java.lang.String GetDocType(int docID)
                            throws org.mitre.cvw.docserv.DocServException,
                                   DocIDException
Returns the type of document. The DocServer supports this field directly, so we just return the results of that field.


GetDocRevision

public java.lang.Integer GetDocRevision(int docID)
                                 throws DocIDException,
                                        org.mitre.cvw.docserv.DocServException
Returns the latest revision number of the given document.


getDocInfo

public java.util.Dictionary getDocInfo(int docID)
                                throws DocIDException,
                                       org.mitre.cvw.docserv.DocServException
Get all the information about a document


getDocAttribute

private java.lang.String getDocAttribute(int docID,
                                         java.lang.String attributeName)
                                  throws DocIDException,
                                         org.mitre.cvw.docserv.DocServException
Get a document parameter from the docservlet


getAllDocAttributes

private java.util.Dictionary getAllDocAttributes(int docID)
                                          throws DocIDException,
                                                 org.mitre.cvw.docserv.DocServException

updateLocalCache

private void updateLocalCache(int docID,
                              java.lang.String name)

setDocAttribute

private void setDocAttribute(int docID,
                             java.lang.String attributeName,
                             java.lang.String value)
                      throws DocIDException,
                             org.mitre.cvw.docserv.DocServException
Set a document parameter on the docservlet


setDocAttributes

private void setDocAttributes(int docID,
                              java.util.Dictionary attrs,
                              boolean lock)
                       throws DocIDException,
                              org.mitre.cvw.docserv.DocServException

DocUserStatus

public java.util.Vector DocUserStatus()
                               throws org.mitre.cvw.docserv.DocServException
Return a vector (list) of docID's currently checked out to the current user. The 'current' user is set when the DSI object is instantiated. If the DocServer reports no documents checked out, then a new (empty) vector is returned.


GetCheckedDocs

public java.util.Vector GetCheckedDocs()
                                throws org.mitre.cvw.docserv.DocServException
Return a vector (list) of docID's currently checked out to anyone. If the DocServer reports nothing is checked out, then a new (empty) vector is returned.


DocCopy

public java.lang.Integer DocCopy(int docID)
                          throws org.mitre.cvw.docserv.DocServException,
                                 DocIDException
Copy a document on the document server. Returns the new docID of the copied document (the newly-created one)


GetDocMime

public java.lang.String GetDocMime(int docID)
                            throws org.mitre.cvw.docserv.DocServException,
                                   DocIDException
Returns the document type (MIME type) for a docID.


GetDocExtension

public java.lang.String GetDocExtension(int docID)
                                 throws org.mitre.cvw.docserv.DocServException,
                                        DocIDException
Returns the document type (MIME type) for a docID.


GetDocDescription

public java.lang.String GetDocDescription(int docID)
                                   throws org.mitre.cvw.docserv.DocServException,
                                          DocIDException
Returns the description of a document.


GetDocEditors

public java.util.Vector GetDocEditors(int docID)
                               throws org.mitre.cvw.docserv.DocServException,
                                      DocIDException
Returns the list of editors and editor comments (in a vector) for a document.


GetDocStatus

public java.lang.String GetDocStatus(int docID)
                              throws org.mitre.cvw.docserv.DocServException,
                                     DocIDException
Get the status of a document as a pre-built string including the name, date and time of the checkout owner. For example: Laurie on 12:12:42 EDT


GetDocName

public java.lang.String GetDocName(int docID)
                            throws org.mitre.cvw.docserv.DocServException,
                                   DocIDException
Given a docID, return the document name.


DocDelete

public void DocDelete(int docID)
               throws org.mitre.cvw.docserv.DocServException,
                      DocIDException,
                      DocAlreadyOutException
Delete a document from the document server. Note: Throws DocAlreadyOutException if the document is locked for any reason.


CreateNewDocument

public java.lang.Integer CreateNewDocument(java.lang.String name,
                                           java.lang.String mimeType,
                                           java.lang.String description,
                                           java.lang.String path)
                                    throws org.mitre.cvw.docserv.DocServException,
                                           DescriptionNotSetException,
                                           java.io.FileNotFoundException,
                                           java.io.IOException
Creates a new document on the document server. Requires a path to the file for import, a name, a MIME type, a description.


createDateString

private java.lang.String createDateString(java.lang.String numericDate)

ClearDocLog

public void ClearDocLog(int docID)
                 throws DocIDException,
                        org.mitre.cvw.docserv.DocServException,
                        DocAlreadyOutException
Clears the document log of all editors, etc.


SetDocDescription

public void SetDocDescription(int docID,
                              java.lang.String desc)
                       throws DocIDException,
                              org.mitre.cvw.docserv.DocServException,
                              DocAlreadyOutException
Sets the document description.


SetDocName

public void SetDocName(int docID,
                       java.lang.String name)
                throws DocIDException,
                       org.mitre.cvw.docserv.DocServException,
                       DocAlreadyOutException
Set the document name.


DocCheckout

public void DocCheckout(int docID)
                 throws DocAlreadyOutException,
                        DocIDException,
                        org.mitre.cvw.docserv.DocServException,
                        DocumentOutException,
                        LocalFileStoreException
Check out a document to the current user. Subtle difference in the exceptions: Throws DocumentOutException if another user has the document out. Throws DocAlreadyOutException if the current user has the doc out.


DocExport

private void DocExport(int docID,
                       java.lang.String path)
                throws org.mitre.cvw.docserv.DocServException,
                       java.io.FileNotFoundException,
                       DocIDException,
                       CancelledException,
                       java.io.IOException
Exports the contents of the document to the provided file name.


xferString

private void xferString(java.lang.String size)

xferStatus

private void xferStatus(int len)

DocManipulate

private void DocManipulate(int docID,
                           boolean chkout,
                           DSDB docdb)
                    throws org.mitre.cvw.docserv.DocServException,
                           DocumentOutException,
                           LocalFileStoreException,
                           DocIDException,
                           java.io.IOException
Actually tries to open a document, either for read only or for editing depending on the parameter sent in.


DocCheckin

public void DocCheckin(java.lang.String objNum,
                       int docID)
                throws DocNotCheckedOutException,
                       LocalDocumentLostException,
                       DocIDException,
                       org.mitre.cvw.docserv.DocServException,
                       CancelledException,
                       LocalFileStoreException,
                       java.io.IOException
Checks in a document from the user's home directory to the document server, asking the user for a comment about this revision.
MCP send cvw-document-checkin


DocOpen

public void DocOpen(int docID,
                    boolean shortcut,
                    boolean doOpen,
                    java.applet.AppletContext context)
             throws org.mitre.cvw.docserv.DocServException,
                    DocIDException,
                    DocNotOpenedException,
                    LocalFileStoreException
Open a document and display for the user. DocOpen checks to see if the docID exists in the local database. If not, or if it does but as a R/O document, DocOpen calls LaunchDoc, which handles the actual helper-app launch. If the document is listed as checked out (R/W), DocOpen calls LaunchDoc with a R/W flag set. If "shortcut" is true, LaunchDoc is always called as for a read-only document. "doOpen" is ignored, for now. "context" must come from the applet calling this API method and must be a valid context for that applet. This allows DocOpen to point the browser directly at the DocServer, if necessary.


GetMimeType

public java.lang.String GetMimeType(java.lang.String typename)
                             throws NoMatchException
Get the MIME type that lives with this CVW type name.


GetMimeSuffix

public java.lang.String GetMimeSuffix(java.lang.String mimetype)
                               throws NoMatchException
Get type file suffix, given the MIME type


GetTypeName

public java.lang.String GetTypeName(java.lang.String mimetype)
                             throws NoMatchException
Get the CVW type name corresponding to this MIME type


GetAllTypes

public java.util.Vector GetAllTypes()
Get a list of available CVW types as defined by the browser. Returns a vector of strings.


GetExtDesc

public java.lang.String GetExtDesc(java.lang.String ext)
                            throws org.mitre.cvw.docserv.DocServException
Match an extension to a name


DocReturn

public void DocReturn(java.lang.String objNum,
                      int docID)
               throws DocNotCheckedOutException,
                      DocIDException,
                      org.mitre.cvw.docserv.DocServException,
                      CancelledException
Reverts a doc back to the doc server, scrapping changes.


ClearDocLock

public void ClearDocLock(int docID)
                  throws org.mitre.cvw.docserv.DocServException,
                         DocIDException,
                         DocNotCheckedOutException
Clear a document lock


LaunchDoc

public java.lang.String LaunchDoc(DSDBEntry entry,
                                  boolean ReadOnly,
                                  boolean takeAction,
                                  java.applet.AppletContext context,
                                  boolean shortcut)

GetDocViewer

public java.util.Vector GetDocViewer(java.lang.String mimetype)
Get the document viewer for this MIME type. Returns a vector of two elements, the MIME type viewer and MIME type editor. NO LONGER USED.


AddDocComment

public void AddDocComment(int docID,
                          java.lang.String comment)
                   throws DocIDException,
                          org.mitre.cvw.docserv.DocServException
Add a comment to the document.


stringToIntVector

private java.util.Vector stringToIntVector(java.lang.String buf)
Converts a string buffer consisting of newline-separated ints to a vector of Integers containing the values. The last number MUST have a newline after it, or it will be ignored.


stringToLinesVector

private java.util.Vector stringToLinesVector(java.lang.String buf)
Converts a string buffer consisting of newline-separated Strings to a vector of Strings.


getNewFileName

private java.lang.String getNewFileName(int docID)
Returns a unique filename based on date/time.