org.activemath.omdocjdom.lucene
Class LuceneMBaseXmlRpcServer

java.lang.Object
  extended by org.activemath.omdocjdom.lucene.LuceneMBaseXmlRpcServer

public class LuceneMBaseXmlRpcServer
extends Object

This class acts as a wrapper of any given OmdocLuceneMBaseRef to serve it through XML-RPC on the given port number. It is omptimized for OmdocLuceneMBaseRef object.

Use its peer OmdocLuceneMBaseRef to communicate with it and obtain an MBaseRef at the other side.

Version:

Nested Class Summary
 class LuceneMBaseXmlRpcServer.ReloadErrorHandler
          This class is made public only for the purposes of being served by XML-RPC server...
 
Field Summary
static String CVS_ID
          Missing description of the Field
protected static org.apache.commons.logging.Log log
          Missing description of the Field
static int NO_SUCH_ITEM_ERRCODE
          The XML-RPC error code sent when an ID requested did not exist.
 
Constructor Summary
LuceneMBaseXmlRpcServer(int portNumber, OmdocLuceneMBaseRef mbaseRef)
          Missing description of constructor for the OJXMLRPClucenembaseServer object
LuceneMBaseXmlRpcServer(OmdocLuceneMBaseRef mbaseRef)
          A server-less version to be embedded in other servers... provides the XML-RPC type- conversion facility.
LuceneMBaseXmlRpcServer(Subconfiguration config)
          A constructor that reads its properties from the Manager properties and uses the Manager's MBaseRef.
 
Method Summary
 boolean assertItsUp()
          Relays to MBaseRef.assertItsUp().
protected  void attemptShutdown(String candidatePassword)
          Missing description of the Method
 MBaseRef close()
          Closes the attached server listening to the socket.
 String create()
           
 String deleteTerm(String id)
           
protected  void finalize()
          Missing description of the Method
 Collection generateImportIDs(String col, String fileName)
           
 String generateImports(String col, String fileName)
          This method makes omdoc documents compatible with the databse It resolve all references and add necessary imports statements
 String getAttribute(String id, String attributeName)
           
 String getCanonicalID(String givenID)
          Calls MBaseRef.getCanonicalID(org.activemath.abstractcontent.MBaseID).
 String getChildren(String id, String xPathExpr)
          Invokes MBaseRef.getChildren(org.activemath.abstractcontent.MBaseID, java.lang.String), returns the result as an XML string.
 Vector getCollectionsProvided()
          Calls MBaseRef.getStructuredListOfConcepts(java.util.Collection).
 Hashtable getCommonName(String id)
           
 String getCompleteDCMetadata(String id)
           
 Vector getDefinitions(String id)
           
 Vector getDefinitions(String id, Vector collections)
          Missing description of the gets the definitions attribute of the OJXMLRPClucenembaseServer object
 Vector getDependencies(String id)
          This method returns a vector (an XML-RPC array) of dependencies.
 String getDocument(String id)
          This method is only for debug purpose.
 String getFormalContent(String id)
           
 Vector getForWhat(String id)
          Missing description of the gets the forWhat attribute of the OJXMLRPClucenembaseServer object
 Vector getIncomingRelations(String id, Vector collections)
           
 Vector getItemsModifiedSince(Date date)
           
 Vector getItemsModifiedSince(String date)
           
 Date getLastModified(Vector ids)
           
 String getMetadata(String id)
           
 String getMethodNames()
          Returns the attached description of the methods (FIXME: currently missing).
 Hashtable getOMDocPath(String givenID)
          Returns the path of the OMDoc from which was loaded the element pointed at by this ID.
 Vector getOutgoingRelations(String id)
           
 Vector getProofs(String id)
           
 Vector getProofs(String id, Vector collections)
           
 Vector getRelated(String id)
           
 Vector getRelated(String id, Vector collections)
          This method returns a vector (an XML-RPC array) of dependencies.
 String getStructuredListOfConcepts(Vector collections)
          Missing description of the gets the structuredListOfConcepts attribute of the OJXMLRPClucenembaseServer object
 String getTextualContent(String id)
           
 String getTheory(String id)
           
 String getTypeString(String id)
           
 Vector listItems(String idString)
           
 Vector listItems(Vector collections, String type)
           
 Vector listTheories(Vector collections)
           
 Vector listTheories1(String collection)
           
static void main(String[] args)
           
 String reload()
          Works only with OmdocLuceneMBaseRef and invokes there the OmdocLuceneMBaseRef.reload().
 String reload(String fileName)
           
 String reloadWithErrors()
          Reloads the content from the directory.
 Vector searchIDs(String idSubstring)
          Searches for an id by substring...
 Vector searchText(String textToSearch)
           
 Vector searchText(String textToSearch, Vector collections)
          Calls MBaseRef.searchText(java.lang.String, java.util.Collection).
 String shutdown(String key)
          Shuts down using the generated password (currently deactivated)
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CVS_ID

public static final String CVS_ID
Missing description of the Field

See Also:
Constant Field Values

NO_SUCH_ITEM_ERRCODE

public static final int NO_SUCH_ITEM_ERRCODE
The XML-RPC error code sent when an ID requested did not exist.

See Also:
Constant Field Values

log

protected static org.apache.commons.logging.Log log
Missing description of the Field

Constructor Detail

LuceneMBaseXmlRpcServer

public LuceneMBaseXmlRpcServer(Subconfiguration config)
                        throws MBaseException
A constructor that reads its properties from the Manager properties and uses the Manager's MBaseRef.

Parameters:
config - Missing description of Parameter
Throws:
MBaseException - Missing description of Exception

LuceneMBaseXmlRpcServer

public LuceneMBaseXmlRpcServer(int portNumber,
                               OmdocLuceneMBaseRef mbaseRef)
                        throws MBaseException
Missing description of constructor for the OJXMLRPClucenembaseServer object

Parameters:
portNumber - Missing description of Parameter
mbaseRef - Missing description of Parameter
Throws:
MBaseException - Missing description of Exception

LuceneMBaseXmlRpcServer

public LuceneMBaseXmlRpcServer(OmdocLuceneMBaseRef mbaseRef)
A server-less version to be embedded in other servers... provides the XML-RPC type- conversion facility.

Parameters:
mbaseRef - the mbase that's to be wrapped.
Method Detail

getDependencies

public Vector getDependencies(String id)
                       throws Exception
This method returns a vector (an XML-RPC array) of dependencies. Dependency objects are simple records with the following keys: This has a slight redundancy: for getDependencies(java.lang.String), the "of" value is the id requested and for getRelated(java.lang.String, java.util.Vector), the "on" value is the id requested.

Parameters:
id - Missing description of Parameter
Returns:
Missing description of return The dependencies value
Throws:
MBaseException - Missing description of Exception
Exception

getRelated

public Vector getRelated(String id,
                         Vector collections)
                  throws Exception
This method returns a vector (an XML-RPC array) of dependencies. Dependency objects are simple records with the following keys: This has a slight redundancy: for getDependencies(java.lang.String), the "of" value is the id requested and for getRelated(java.lang.String, java.util.Vector), the "on" value is the id requested.

Parameters:
id - Missing description of Parameter
collections - Missing description of Parameter
Returns:
Missing description of return The related value
Throws:
MBaseException - Missing description of Exception
Exception

getRelated

public Vector getRelated(String id)
                  throws Exception
Throws:
Exception

getForWhat

public Vector getForWhat(String id)
                  throws Exception
Missing description of the gets the forWhat attribute of the OJXMLRPClucenembaseServer object

Parameters:
id - Missing description of Parameter
Returns:
Missing description of return The forWhat value
Throws:
MBaseException - Missing description of Exception
Exception

getDefinitions

public Vector getDefinitions(String id,
                             Vector collections)
                      throws Exception
Missing description of the gets the definitions attribute of the OJXMLRPClucenembaseServer object

Parameters:
id - Missing description of Parameter
collections - Missing description of Parameter
Returns:
Missing description of return The definitions value
Throws:
MBaseException - Missing description of Exception
Exception

getDefinitions

public Vector getDefinitions(String id)
                      throws Exception
Throws:
Exception

getProofs

public Vector getProofs(String id,
                        Vector collections)
                 throws Exception
Throws:
Exception

getProofs

public Vector getProofs(String id)
                 throws Exception
Throws:
Exception

getTypeString

public String getTypeString(String id)
                     throws Exception
Throws:
Exception

getTheory

public String getTheory(String id)
                 throws Exception
Throws:
Exception

getDocument

public String getDocument(String id)
                   throws Exception
This method is only for debug purpose. It returns the document stored in the mbase

Parameters:
id -
Returns:
a string representation of the document
Throws:
Exception

getCommonName

public Hashtable getCommonName(String id)
                        throws Exception
Throws:
Exception

getMetadata

public String getMetadata(String id)
                   throws Exception
Throws:
Exception

getCompleteDCMetadata

public String getCompleteDCMetadata(String id)
                             throws Exception
Throws:
Exception

getTextualContent

public String getTextualContent(String id)
                         throws Exception
Throws:
Exception

getFormalContent

public String getFormalContent(String id)
                        throws Exception
Throws:
Exception

getAttribute

public String getAttribute(String id,
                           String attributeName)
                    throws Exception
Throws:
Exception

getChildren

public String getChildren(String id,
                          String xPathExpr)
                   throws Exception
Invokes MBaseRef.getChildren(org.activemath.abstractcontent.MBaseID, java.lang.String), returns the result as an XML string.

Throws:
Exception

getMethodNames

public String getMethodNames()
Returns the attached description of the methods (FIXME: currently missing).


listItems

public Vector listItems(String idString)
                 throws Exception
Throws:
Exception

listTheories

public Vector listTheories(Vector collections)
                    throws Exception
Throws:
Exception

listItems

public Vector listItems(Vector collections,
                        String type)
                 throws Exception
Throws:
Exception

listTheories1

public Vector listTheories1(String collection)
                     throws Exception
Throws:
Exception

getStructuredListOfConcepts

public String getStructuredListOfConcepts(Vector collections)
                                   throws Exception
Missing description of the gets the structuredListOfConcepts attribute of the OJXMLRPClucenembaseServer object

Parameters:
collections - Missing description of Parameter
Returns:
Missing description of return The structuredListOfConcepts value
Throws:
MBaseException - Missing description of Exception
Exception

getCollectionsProvided

public Vector getCollectionsProvided()
                              throws Exception
Calls MBaseRef.getStructuredListOfConcepts(java.util.Collection).

Returns:
A Vector of strings
Throws:
MBaseException - if anything happens.
Exception

getCanonicalID

public String getCanonicalID(String givenID)
                      throws Exception
Calls MBaseRef.getCanonicalID(org.activemath.abstractcontent.MBaseID).

Parameters:
givenID - A string with, at least, the ID name
Returns:
The ID of the first item that matches this ID name
Throws:
MBaseItemNotFoundException - If there is no such ID.
Exception - If anything happens

searchText

public Vector searchText(String textToSearch,
                         Vector collections)
                  throws Exception
Calls MBaseRef.searchText(java.lang.String, java.util.Collection).

Parameters:
textToSearch -
collections - The collections to search through
Returns:
A Vector of IDs containing the given text
Throws:
Exception - If anything happens.

searchText

public Vector searchText(String textToSearch)
                  throws Exception
Throws:
Exception

assertItsUp

public boolean assertItsUp()
                    throws Exception
Relays to MBaseRef.assertItsUp().

Returns:
Missing description of the Returned Value
Throws:
MBaseException - Missing description of Exception
Exception

shutdown

public String shutdown(String key)
                throws Exception
Shuts down using the generated password (currently deactivated)

Parameters:
key - The password
Returns:
"Shutting down in a second"
Throws:
Exception - if anything

reload

public String reload()
              throws Exception
Works only with OmdocLuceneMBaseRef and invokes there the OmdocLuceneMBaseRef.reload().

Returns:
Done see log for details
Throws:
Exception - Only if the underlying LuceneBuilder is configured to do so.

reload

public String reload(String fileName)
              throws Exception
Throws:
Exception

create

public String create()
              throws Exception
Throws:
Exception

reloadWithErrors

public String reloadWithErrors()
                        throws Exception
Reloads the content from the directory. Works only with OmdocLuceneMBaseRef.

Returns:
a name-prefix from which to invoke the method nextError which is a record of keys systemId (the file-name, relative to the basePath), message, exceptionClass, lineNumber, and columnNumber Or a string saying finished
Throws:
Exception

generateImports

public String generateImports(String col,
                              String fileName)
                       throws Exception
This method makes omdoc documents compatible with the databse It resolve all references and add necessary imports statements

Parameters:
col - a String value. The name of the collection.
fileName - It is a absoulte path of the omdoc fileName
Returns:
It returns a string of all imports statements
Throws:
Exception - Description of the Exception

generateImportIDs

public Collection generateImportIDs(String col,
                                    String fileName)
                             throws Exception
Throws:
Exception

searchIDs

public Vector searchIDs(String idSubstring)
                 throws Exception
Searches for an id by substring...

Parameters:
idSubstring - The substring to search (may be empty to get a compelte list)
Returns:
The list of IDs that match
Throws:
Exception

deleteTerm

public String deleteTerm(String id)
                  throws Exception
Throws:
Exception

close

public MBaseRef close()
Closes the attached server listening to the socket. (is not publically offered through XML-RPC as its return type is not XML-RPC friendly)

Returns:
Anything... an incompatible return-type.

attemptShutdown

protected void attemptShutdown(String candidatePassword)
Missing description of the Method

Parameters:
candidatePassword - Missing description of Parameter

finalize

protected void finalize()
Missing description of the Method

Overrides:
finalize in class Object

getOMDocPath

public Hashtable getOMDocPath(String givenID)
                       throws Exception
Returns the path of the OMDoc from which was loaded the element pointed at by this ID. This may expose absolute-filenames which may be considered insecure. Absolute file-names occur only in the case where a basepath was specified after a few documents in the command-line startup of OmdocJdomMBase. The risk seemd not so big.

Parameters:
givenID - The ID to be found
Returns:
A table with keys
  • path, the path relative to the basePath.
  • lineNumber the line-number in the file
  • columnNumber the column-number in the file
Throws:
MBaseItemNotFoundException - if the ID is not found
Exception - If anything happens,

getLastModified

public Date getLastModified(Vector ids)
                     throws org.apache.xmlrpc.XmlRpcException
Throws:
org.apache.xmlrpc.XmlRpcException

getItemsModifiedSince

public Vector getItemsModifiedSince(String date)
                             throws org.apache.xmlrpc.XmlRpcException
Throws:
org.apache.xmlrpc.XmlRpcException

getItemsModifiedSince

public Vector getItemsModifiedSince(Date date)
                             throws org.apache.xmlrpc.XmlRpcException
Throws:
org.apache.xmlrpc.XmlRpcException

getIncomingRelations

public Vector getIncomingRelations(String id,
                                   Vector collections)
                            throws org.apache.xmlrpc.XmlRpcException
Throws:
org.apache.xmlrpc.XmlRpcException

getOutgoingRelations

public Vector getOutgoingRelations(String id)
                            throws org.apache.xmlrpc.XmlRpcException
Throws:
org.apache.xmlrpc.XmlRpcException

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception