You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2011/06/02 12:32:07 UTC
svn commit: r1130475 [4/6] - in /incubator/lcf/trunk: ./
connectors/activedirectory/
connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/
connectors/documentum/ connectors/documentum/connecto...
Modified: incubator/lcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java?rev=1130475&r1=1130474&r2=1130475&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java (original)
+++ incubator/lcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java Thu Jun 2 10:32:04 2011
@@ -187,29 +187,19 @@ public class WebcrawlerConnector extends
* This must return a model value as specified above.
*@return the model type value.
*/
+ @Override
public int getConnectorModel()
{
// We return all seeds every time.
return MODEL_ALL;
}
- /** Return the path for the UI interface JSP elements.
- * These JSP's must be provided to allow the connector to be configured, and to
- * permit it to present document filtering specification information in the UI.
- * This method should return the name of the folder, under the <webapp>/connectors/
- * area, where the appropriate JSP's can be found. The name should NOT have a slash in it.
- *@return the folder part
- */
- public String getJSPFolder()
- {
- return "webcrawler";
- }
-
/** Install the connector.
* This method is called to initialize persistent storage for the connector, such as database tables etc.
* It is called when the connector is registered.
*@param threadContext is the current thread context.
*/
+ @Override
public void install(IThreadContext threadContext)
throws ManifoldCFException
{
@@ -251,6 +241,7 @@ public class WebcrawlerConnector extends
* It is called when the connector is deregistered.
*@param threadContext is the current thread context.
*/
+ @Override
public void deinstall(IThreadContext threadContext)
throws ManifoldCFException
{
@@ -289,6 +280,7 @@ public class WebcrawlerConnector extends
/** Return the list of activities that this connector supports (i.e. writes into the log).
*@return the list.
*/
+ @Override
public String[] getActivitiesList()
{
return new String[]{ACTIVITY_FETCH, ACTIVITY_ROBOTSPARSE, ACTIVITY_LOGON_START, ACTIVITY_LOGON_END};
@@ -298,6 +290,7 @@ public class WebcrawlerConnector extends
/** Return the list of relationship types that this connector recognizes.
*@return the list.
*/
+ @Override
public String[] getRelationshipTypes()
{
return new String[]{REL_LINK,REL_REDIRECT};
@@ -306,6 +299,7 @@ public class WebcrawlerConnector extends
/** Clear out any state information specific to a given thread.
* This method is called when this object is returned to the connection pool.
*/
+ @Override
public void clearThreadContext()
{
super.clearThreadContext();
@@ -365,6 +359,7 @@ public class WebcrawlerConnector extends
/** This method is periodically called for all connectors that are connected but not
* in active use.
*/
+ @Override
public void poll()
throws ManifoldCFException
{
@@ -373,6 +368,7 @@ public class WebcrawlerConnector extends
/** Check status of connection.
*/
+ @Override
public String check()
throws ManifoldCFException
{
@@ -382,6 +378,7 @@ public class WebcrawlerConnector extends
/** Close the connection. Call this before discarding the repository connector.
*/
+ @Override
public void disconnect()
throws ManifoldCFException
{
@@ -404,6 +401,7 @@ public class WebcrawlerConnector extends
*@param documentIdentifier is the document identifier.
*@return the bin name.
*/
+ @Override
public String[] getBinNames(String documentIdentifier)
{
try
@@ -443,6 +441,7 @@ public class WebcrawlerConnector extends
*@param startTime is the beginning of the time range to consider, inclusive.
*@param endTime is the end of the time range to consider, exclusive.
*/
+ @Override
public void addSeedDocuments(ISeedingActivity activities, DocumentSpecification spec,
long startTime, long endTime)
throws ManifoldCFException, ServiceInterruption
@@ -511,6 +510,7 @@ public class WebcrawlerConnector extends
* Empty version strings indicate that there is no versioning ability for the corresponding document, and the document
* will always be processed.
*/
+ @Override
public String[] getDocumentVersions(String[] documentIdentifiers, String[] oldVersions, IVersionActivity activities,
DocumentSpecification spec, int jobMode, boolean usesDefaultAuthority)
throws ManifoldCFException, ServiceInterruption
@@ -538,7 +538,7 @@ public class WebcrawlerConnector extends
String value = nv.getValue();
fixedListStrings[0] = name;
fixedListStrings[1] = value;
- StringBuffer newsb = new StringBuffer();
+ StringBuilder newsb = new StringBuilder();
packFixedList(newsb,fixedListStrings,'=');
metadata[k++] = newsb.toString();
}
@@ -613,7 +613,7 @@ public class WebcrawlerConnector extends
// Do the mapping from the current host name to the IP address
URL url = new URL(currentURI);
String hostName = url.getHost();
- StringBuffer ipAddressBuffer = new StringBuffer();
+ StringBuilder ipAddressBuffer = new StringBuilder();
int ipAddressStatus = lookupIPAddress(currentURI,activities,hostName,currentTime,ipAddressBuffer);
if (ipAddressStatus == RESULTSTATUS_TRUE)
{
@@ -1038,7 +1038,7 @@ public class WebcrawlerConnector extends
break;
case RESULT_VERSION_NEEDED:
// Calculate version from document data, which is presumed to be present.
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
// Acls
packList(sb,acls,'+');
@@ -1100,6 +1100,7 @@ public class WebcrawlerConnector extends
*@param scanOnly is an array corresponding to the document identifiers. It is set to true to indicate when the processing
* should only find other references, and should not actually call the ingestion methods.
*/
+ @Override
public void processDocuments(String[] documentIdentifiers, String[] versions, IProcessActivity activities, DocumentSpecification spec, boolean[] scanOnly)
throws ManifoldCFException, ServiceInterruption
{
@@ -1148,7 +1149,7 @@ public class WebcrawlerConnector extends
// Unpack the version string
ArrayList acls = new ArrayList();
- StringBuffer denyAclBuffer = new StringBuffer();
+ StringBuilder denyAclBuffer = new StringBuilder();
ArrayList metadata = new ArrayList();
int index = unpackList(acls,version,0,'+');
if (index < version.length() && version.charAt(index++) == '+')
@@ -1270,6 +1271,7 @@ public class WebcrawlerConnector extends
*@param documentIdentifiers is the set of document identifiers.
*@param versions is the corresponding set of version identifiers (individual identifiers may be null).
*/
+ @Override
public void releaseDocumentVersions(String[] documentIdentifiers, String[] versions)
throws ManifoldCFException
{
@@ -1289,6 +1291,7 @@ public class WebcrawlerConnector extends
/** Get the maximum number of documents to amalgamate together into one batch, for this connector.
*@return the maximum number. 0 indicates "unlimited".
*/
+ @Override
public int getMaxDocumentRequest()
{
// The web in general does not batch well. Multiple chunks have no advantage over one-at-a-time requests.
@@ -1311,7 +1314,8 @@ public class WebcrawlerConnector extends
*@param parameters are the configuration parameters, as they currently exist, for this connection being configured.
*@param tabsArray is an array of tab names. Add to this array any tab names that are specific to the connector.
*/
- public void outputConfigurationHeader(IThreadContext threadContext, IHTTPOutput out, ConfigParams parameters, ArrayList tabsArray)
+ @Override
+ public void outputConfigurationHeader(IThreadContext threadContext, IHTTPOutput out, ConfigParams parameters, List<String> tabsArray)
throws ManifoldCFException, IOException
{
tabsArray.add("Email");
@@ -1642,6 +1646,7 @@ public class WebcrawlerConnector extends
*@param parameters are the configuration parameters, as they currently exist, for this connection being configured.
*@param tabName is the current tab name.
*/
+ @Override
public void outputConfigurationBody(IThreadContext threadContext, IHTTPOutput out, ConfigParams parameters, String tabName)
throws ManifoldCFException, IOException
{
@@ -2561,6 +2566,7 @@ public class WebcrawlerConnector extends
*@param parameters are the configuration parameters, as they currently exist, for this connection being configured.
*@return null if all is well, or a string error message if there is an error that should prevent saving of the connection (and cause a redirection to an error page).
*/
+ @Override
public String processConfigurationPost(IThreadContext threadContext, IPostParameters variableContext, ConfigParams parameters)
throws ManifoldCFException
{
@@ -2936,6 +2942,7 @@ public class WebcrawlerConnector extends
*@param out is the output to which any HTML should be sent.
*@param parameters are the configuration parameters, as they currently exist, for this connection being configured.
*/
+ @Override
public void viewConfiguration(IThreadContext threadContext, IHTTPOutput out, ConfigParams parameters)
throws ManifoldCFException, IOException
{
@@ -3270,7 +3277,8 @@ public class WebcrawlerConnector extends
*@param ds is the current document specification for this job.
*@param tabsArray is an array of tab names. Add to this array any tab names that are specific to the connector.
*/
- public void outputSpecificationHeader(IHTTPOutput out, DocumentSpecification ds, ArrayList tabsArray)
+ @Override
+ public void outputSpecificationHeader(IHTTPOutput out, DocumentSpecification ds, List<String> tabsArray)
throws ManifoldCFException, IOException
{
tabsArray.add("Seeds");
@@ -3383,6 +3391,7 @@ public class WebcrawlerConnector extends
*@param ds is the current document specification for this job.
*@param tabName is the current tab name.
*/
+ @Override
public void outputSpecificationBody(IHTTPOutput out, DocumentSpecification ds, String tabName)
throws ManifoldCFException, IOException
{
@@ -3849,6 +3858,7 @@ public class WebcrawlerConnector extends
*@param ds is the current document specification for this job.
*@return null if all is well, or a string error message if there is an error that should prevent saving of the job (and cause a redirection to an error page).
*/
+ @Override
public String processSpecificationPost(IPostParameters variableContext, DocumentSpecification ds)
throws ManifoldCFException
{
@@ -4122,6 +4132,7 @@ public class WebcrawlerConnector extends
*@param out is the output to which any HTML should be sent.
*@param ds is the current document specification for this job.
*/
+ @Override
public void viewSpecification(IHTTPOutput out, DocumentSpecification ds)
throws ManifoldCFException, IOException
{
@@ -4469,7 +4480,7 @@ public class WebcrawlerConnector extends
*/
protected String makeSessionLoginEventName(INamingActivity activities, String sequenceKey)
{
- return activities.createGlobalString(getJSPFolder()+":session:"+sequenceKey);
+ return activities.createGlobalString("webcrawler:session:"+sequenceKey);
}
/** Calculate the event name for DNS access.
@@ -4477,13 +4488,13 @@ public class WebcrawlerConnector extends
protected String makeDNSEventName(INamingActivity activities, String hostNameKey)
{
// Use the connector unique id, and use a convention that guarantees uniqueness.
- return activities.createGlobalString(getJSPFolder()+":dns:"+hostNameKey);
+ return activities.createGlobalString("webcrawler:dns:"+hostNameKey);
}
/** Look up an ipaddress given a non-canonical host name.
*@return appropriate status.
*/
- protected int lookupIPAddress(String documentIdentifier, IVersionActivity activities, String hostName, long currentTime, StringBuffer ipAddressBuffer)
+ protected int lookupIPAddress(String documentIdentifier, IVersionActivity activities, String hostName, long currentTime, StringBuilder ipAddressBuffer)
throws ManifoldCFException, ServiceInterruption
{
String eventName = makeDNSEventName(activities,hostName);
@@ -4554,7 +4565,7 @@ public class WebcrawlerConnector extends
protected String makeRobotsEventName(INamingActivity versionActivities, String robotsKey)
{
// Use the connector unique id, and use a convention that guarantees uniqueness.
- return versionActivities.createGlobalString(getJSPFolder()+":robots:"+robotsKey);
+ return versionActivities.createGlobalString("webcrawler:robots:"+robotsKey);
}
/** Check robots to see if fetch is allowed.
@@ -4976,7 +4987,7 @@ public class WebcrawlerConnector extends
}
java.util.Arrays.sort(sortArray);
- StringBuffer newString = new StringBuffer();
+ StringBuilder newString = new StringBuilder();
boolean isFirst = true;
i = 0;
while (i < sortArray.length)
@@ -5000,7 +5011,7 @@ public class WebcrawlerConnector extends
else
{
// Do not reorder!
- StringBuffer newString = new StringBuffer();
+ StringBuilder newString = new StringBuilder();
int index = 0;
boolean isFirst = true;
while (index < queryString.length())
@@ -6748,7 +6759,7 @@ public class WebcrawlerConnector extends
}
/** Stuffer for packing a single string with an end delimiter */
- protected static void pack(StringBuffer output, String value, char delimiter)
+ protected static void pack(StringBuilder output, String value, char delimiter)
{
int i = 0;
while (i < value.length())
@@ -6762,7 +6773,7 @@ public class WebcrawlerConnector extends
}
/** Unstuffer for the above. */
- protected static int unpack(StringBuffer sb, String value, int startPosition, char delimiter)
+ protected static int unpack(StringBuilder sb, String value, int startPosition, char delimiter)
{
while (startPosition < value.length())
{
@@ -6780,7 +6791,7 @@ public class WebcrawlerConnector extends
}
/** Stuffer for packing lists of fixed length */
- protected static void packFixedList(StringBuffer output, String[] values, char delimiter)
+ protected static void packFixedList(StringBuilder output, String[] values, char delimiter)
{
int i = 0;
while (i < values.length)
@@ -6792,7 +6803,7 @@ public class WebcrawlerConnector extends
/** Unstuffer for unpacking lists of fixed length */
protected static int unpackFixedList(String[] output, String value, int startPosition, char delimiter)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
int i = 0;
while (i < output.length)
{
@@ -6804,7 +6815,7 @@ public class WebcrawlerConnector extends
}
/** Stuffer for packing lists of variable length */
- protected static void packList(StringBuffer output, ArrayList values, char delimiter)
+ protected static void packList(StringBuilder output, ArrayList values, char delimiter)
{
pack(output,Integer.toString(values.size()),delimiter);
int i = 0;
@@ -6815,7 +6826,7 @@ public class WebcrawlerConnector extends
}
/** Another stuffer for packing lists of variable length */
- protected static void packList(StringBuffer output, String[] values, char delimiter)
+ protected static void packList(StringBuilder output, String[] values, char delimiter)
{
pack(output,Integer.toString(values.length),delimiter);
int i = 0;
@@ -6834,7 +6845,7 @@ public class WebcrawlerConnector extends
*/
protected static int unpackList(ArrayList output, String value, int startPosition, char delimiter)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
startPosition = unpack(sb,value,startPosition,delimiter);
try
{
Modified: incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/common/XMLStringContext.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/common/XMLStringContext.java?rev=1130475&r1=1130474&r2=1130475&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/common/XMLStringContext.java (original)
+++ incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/common/XMLStringContext.java Thu Jun 2 10:32:04 2011
@@ -32,12 +32,12 @@ import java.io.IOException;
import org.apache.manifoldcf.core.interfaces.*;
/** An instance of this class represents a parsing context within a node, where the data value is to be recorded as an in-memory string. The data string is
-* available as a local stringbuffer object, which will be accessible to any class that extends this one.
+* available as a local StringBuilder object, which will be accessible to any class that extends this one.
*/
public class XMLStringContext extends XMLContext
{
/** The string buffer */
- protected StringBuffer value = new StringBuffer();
+ protected StringBuilder value = new StringBuilder();
/** Full constructor. Used for individual tags. */
public XMLStringContext(XMLStream theStream, String namespaceURI, String localname, String qname, Attributes theseAttributes)
Modified: incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/common/XMLWriterContext.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/common/XMLWriterContext.java?rev=1130475&r1=1130474&r2=1130475&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/common/XMLWriterContext.java (original)
+++ incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/common/XMLWriterContext.java Thu Jun 2 10:32:04 2011
@@ -164,7 +164,7 @@ public class XMLWriterContext extends XM
/** Convert a string to a value that's safe to include inside an attribute value */
protected static String escapeAttribute(String value)
{
- StringBuffer rval = new StringBuffer();
+ StringBuilder rval = new StringBuilder();
int i = 0;
while (i < value.length())
{
@@ -186,7 +186,7 @@ public class XMLWriterContext extends XM
char x = chars[i];
if (x == '<' || x == '>' || x == '&'|| (x < ' ' && x >= 0))
{
- StringBuffer rval = new StringBuffer();
+ StringBuilder rval = new StringBuilder();
rval.append("&#").append(Integer.toString((int)x)).append(";");
out.write(rval.toString());
continue;
Modified: incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java?rev=1130475&r1=1130474&r2=1130475&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java (original)
+++ incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java Thu Jun 2 10:32:04 2011
@@ -463,7 +463,7 @@ public class IncrementalIngester extends
Iterator iter = docIDValues.keySet().iterator();
j = 0;
ArrayList list = new ArrayList();
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
while (iter.hasNext())
{
if (j == maxInClause)
@@ -697,7 +697,7 @@ public class IncrementalIngester extends
Iterator iter = docURIHashValues.keySet().iterator();
j = 0;
ArrayList hashList = new ArrayList();
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
while (iter.hasNext())
{
if (j == maxInClause)
@@ -915,7 +915,7 @@ public class IncrementalIngester extends
beginTransaction();
try
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
ArrayList list = new ArrayList();
int maxCount = getMaxInClause();
int j = 0;
@@ -1038,7 +1038,7 @@ public class IncrementalIngester extends
beginTransaction();
try
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
ArrayList list = new ArrayList();
int maxCount = getMaxInClause();
int j = 0;
@@ -1140,7 +1140,7 @@ public class IncrementalIngester extends
// Loop through the hash codes
Iterator iter = idCodes.keySet().iterator();
ArrayList list = new ArrayList();
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
j = 0;
while (iter.hasNext())
{
Modified: incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/IOutputConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/IOutputConnector.java?rev=1130475&r1=1130474&r2=1130475&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/IOutputConnector.java (original)
+++ incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/IOutputConnector.java Thu Jun 2 10:32:04 2011
@@ -155,7 +155,7 @@ public interface IOutputConnector extend
*@param os is the current output specification for this job.
*@param tabsArray is an array of tab names. Add to this array any tab names that are specific to the connector.
*/
- public void outputSpecificationHeader(IHTTPOutput out, OutputSpecification os, ArrayList tabsArray)
+ public void outputSpecificationHeader(IHTTPOutput out, OutputSpecification os, List<String> tabsArray)
throws ManifoldCFException, IOException;
/** Output the specification body section.
Modified: incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/output/BaseOutputConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/output/BaseOutputConnector.java?rev=1130475&r1=1130474&r2=1130475&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/output/BaseOutputConnector.java (original)
+++ incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/output/BaseOutputConnector.java Thu Jun 2 10:32:04 2011
@@ -101,6 +101,57 @@ public abstract class BaseOutputConnecto
return true;
}
+ /** Get an output version string, given an output specification. The output version string is used to uniquely describe the pertinent details of
+ * the output specification and the configuration, to allow the Connector Framework to determine whether a document will need to be output again.
+ * Note that the contents of the document cannot be considered by this method, and that a different version string (defined in IRepositoryConnector)
+ * is used to describe the version of the actual document.
+ *
+ * This method presumes that the connector object has been configured, and it is thus able to communicate with the output data store should that be
+ * necessary.
+ *@param spec is the current output specification for the job that is doing the crawling.
+ *@return a string, of unlimited length, which uniquely describes output configuration and specification in such a way that if two such strings are equal,
+ * the document will not need to be sent again to the output data store.
+ */
+ public String getOutputDescription(OutputSpecification spec)
+ throws ManifoldCFException, ServiceInterruption
+ {
+ // Empty string from the base class.
+ return "";
+ }
+
+ /** Add (or replace) a document in the output data store using the connector.
+ * This method presumes that the connector object has been configured, and it is thus able to communicate with the output data store should that be
+ * necessary.
+ * The OutputSpecification is *not* provided to this method, because the goal is consistency, and if output is done it must be consistent with the
+ * output description, since that was what was partly used to determine if output should be taking place. So it may be necessary for this method to decode
+ * an output description string in order to determine what should be done.
+ *@param documentURI is the URI of the document. The URI is presumed to be the unique identifier which the output data store will use to process
+ * and serve the document. This URI is constructed by the repository connector which fetches the document, and is thus universal across all output connectors.
+ *@param outputDescription is the description string that was constructed for this document by the getOutputDescription() method.
+ *@param document is the document data to be processed (handed to the output data store).
+ *@param authorityNameString is the name of the authority responsible for authorizing any access tokens passed in with the repository document. May be null.
+ *@param activities is the handle to an object that the implementer of an output connector may use to perform operations, such as logging processing activity.
+ *@return the document status (accepted or permanently rejected).
+ */
+ public int addOrReplaceDocument(String documentURI, String outputDescription, RepositoryDocument document, String authorityNameString, IOutputAddActivity activities)
+ throws ManifoldCFException, ServiceInterruption
+ {
+ return DOCUMENTSTATUS_REJECTED;
+ }
+
+ /** Remove a document using the connector.
+ * Note that the last outputDescription is included, since it may be necessary for the connector to use such information to know how to properly remove the document.
+ *@param documentURI is the URI of the document. The URI is presumed to be the unique identifier which the output data store will use to process
+ * and serve the document. This URI is constructed by the repository connector which fetches the document, and is thus universal across all output connectors.
+ *@param outputDescription is the last description string that was constructed for this document by the getOutputDescription() method above.
+ *@param activities is the handle to an object that the implementer of an output connector may use to perform operations, such as logging processing activity.
+ */
+ public void removeDocument(String documentURI, String outputDescription, IOutputRemoveActivity activities)
+ throws ManifoldCFException, ServiceInterruption
+ {
+ // Does nothing in the base class
+ }
+
// UI support methods.
//
// These support methods come in two varieties. The first bunch is involved in setting up connection configuration information. The second bunch
@@ -117,7 +168,19 @@ public abstract class BaseOutputConnecto
*@param os is the current output specification for this job.
*@param tabsArray is an array of tab names. Add to this array any tab names that are specific to the connector.
*/
- public void outputSpecificationHeader(IHTTPOutput out, OutputSpecification os, ArrayList tabsArray)
+ public void outputSpecificationHeader(IHTTPOutput out, OutputSpecification os, List<String> tabsArray)
+ throws ManifoldCFException, IOException
+ {
+ // Call the old method signature, for backwards compatibility
+ ArrayList<Object> localTabsArray = new ArrayList<Object>();
+ outputSpecificationHeader(out,os,localTabsArray);
+ for (Object o : localTabsArray)
+ {
+ tabsArray.add((String)o);
+ }
+ }
+
+ public void outputSpecificationHeader(IHTTPOutput out, OutputSpecification os, ArrayList<Object> tabsArray)
throws ManifoldCFException, IOException
{
}
Modified: incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/outputconnection/OutputConnectionManager.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/outputconnection/OutputConnectionManager.java?rev=1130475&r1=1130474&r2=1130475&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/outputconnection/OutputConnectionManager.java (original)
+++ incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/outputconnection/OutputConnectionManager.java Thu Jun 2 10:32:04 2011
@@ -524,7 +524,7 @@ public class OutputConnectionManager ext
try
{
i = 0;
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
ArrayList params = new ArrayList();
int j = 0;
int maxIn = getMaxInClause();
Modified: incubator/lcf/trunk/framework/api-servlet/src/main/java/org/apache/manifoldcf/api/APIServlet.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/api-servlet/src/main/java/org/apache/manifoldcf/api/APIServlet.java?rev=1130475&r1=1130474&r2=1130475&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/api-servlet/src/main/java/org/apache/manifoldcf/api/APIServlet.java (original)
+++ incubator/lcf/trunk/framework/api-servlet/src/main/java/org/apache/manifoldcf/api/APIServlet.java Thu Jun 2 10:32:04 2011
@@ -331,7 +331,7 @@ public class APIServlet extends HttpServ
}
// We presume the data is utf-8
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
char[] buffer = new char[65536];
Reader r = new InputStreamReader(data,"utf-8");
while (true)
@@ -445,7 +445,7 @@ public class APIServlet extends HttpServ
}
// We presume the data is utf-8
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
char[] buffer = new char[65536];
Reader r = new InputStreamReader(data,"utf-8");
while (true)
Modified: incubator/lcf/trunk/framework/authority-servlet/src/main/java/org/apache/manifoldcf/authorityservice/servlet/UserACLServlet.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/authority-servlet/src/main/java/org/apache/manifoldcf/authorityservice/servlet/UserACLServlet.java?rev=1130475&r1=1130474&r2=1130475&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/authority-servlet/src/main/java/org/apache/manifoldcf/authorityservice/servlet/UserACLServlet.java (original)
+++ incubator/lcf/trunk/framework/authority-servlet/src/main/java/org/apache/manifoldcf/authorityservice/servlet/UserACLServlet.java Thu Jun 2 10:32:04 2011
@@ -171,7 +171,7 @@ public class UserACLServlet extends Http
i = 0;
// Ask all the registered authorities for their ACLs, and merge the final list together.
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
// Set response mime type
response.setContentType("text/plain; charset=ISO8859-1");
ServletOutputStream out = response.getOutputStream();
Modified: incubator/lcf/trunk/framework/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/build.xml?rev=1130475&r1=1130474&r2=1130475&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/build.xml (original)
+++ incubator/lcf/trunk/framework/build.xml Thu Jun 2 10:32:04 2011
@@ -25,7 +25,7 @@
<target name="doc">
<mkdir dir="dist/doc"/>
- <javadoc destdir="dist/doc" maxmemory="256M" source="1.4" useexternalfile="true">
+ <javadoc destdir="dist/doc" maxmemory="256M" source="1.5" useexternalfile="true">
<classpath>
<fileset dir="lib">
<include name="*.jar"/>
@@ -40,7 +40,7 @@
<target name="compile-core">
<mkdir dir="build/core/classes"/>
- <javac srcdir="core/src/main/java" destdir="build/core/classes" target="1.5" source="1.4" debug="true" debuglevel="lines,vars,source">
+ <javac srcdir="core/src/main/java" destdir="build/core/classes" target="1.5" source="1.5" debug="true" debuglevel="lines,vars,source">
<classpath>
<fileset dir="lib">
<include name="*.jar"/>
@@ -51,7 +51,7 @@
<target name="compile-ui-core" depends="compile-core">
<mkdir dir="build/ui-core/classes"/>
- <javac srcdir="ui-core/src/main/java" destdir="build/ui-core/classes" target="1.5" source="1.4" debug="true" debuglevel="lines,vars,source">
+ <javac srcdir="ui-core/src/main/java" destdir="build/ui-core/classes" target="1.5" source="1.5" debug="true" debuglevel="lines,vars,source">
<classpath>
<fileset dir="lib">
<include name="*.jar"/>
@@ -63,7 +63,7 @@
<target name="compile-agents" depends="compile-core">
<mkdir dir="build/agents/classes"/>
- <javac srcdir="agents/src/main/java" destdir="build/agents/classes" target="1.5" source="1.4" debug="true" debuglevel="lines,vars,source">
+ <javac srcdir="agents/src/main/java" destdir="build/agents/classes" target="1.5" source="1.5" debug="true" debuglevel="lines,vars,source">
<classpath>
<fileset dir="lib">
<include name="*.jar"/>
@@ -75,7 +75,7 @@
<target name="compile-pull-agent" depends="compile-core,compile-agents">
<mkdir dir="build/pull-agent/classes"/>
- <javac srcdir="pull-agent/src/main/java" destdir="build/pull-agent/classes" target="1.5" source="1.4" debug="true" debuglevel="lines,vars,source">
+ <javac srcdir="pull-agent/src/main/java" destdir="build/pull-agent/classes" target="1.5" source="1.5" debug="true" debuglevel="lines,vars,source">
<classpath>
<fileset dir="lib">
<include name="*.jar"/>
@@ -88,7 +88,7 @@
<target name="compile-jetty-runner" depends="compile-core,compile-agents">
<mkdir dir="build/jetty-runner/classes"/>
- <javac srcdir="jetty-runner/src/main/java" destdir="build/jetty-runner/classes" target="1.5" source="1.4" debug="true" debuglevel="lines,vars,source">
+ <javac srcdir="jetty-runner/src/main/java" destdir="build/jetty-runner/classes" target="1.5" source="1.5" debug="true" debuglevel="lines,vars,source">
<classpath>
<fileset dir="lib">
<include name="*.jar"/>
@@ -102,7 +102,7 @@
<target name="compile-authority-servlet" depends="compile-core,compile-agents,compile-pull-agent">
<mkdir dir="build/authority-servlet/classes"/>
- <javac srcdir="authority-servlet/src/main/java" destdir="build/authority-servlet/classes" target="1.5" source="1.4" debug="true" debuglevel="lines,vars,source">
+ <javac srcdir="authority-servlet/src/main/java" destdir="build/authority-servlet/classes" target="1.5" source="1.5" debug="true" debuglevel="lines,vars,source">
<classpath>
<fileset dir="lib">
<include name="*.jar"/>
@@ -116,7 +116,7 @@
<target name="compile-api-servlet" depends="compile-core,compile-ui-core,compile-agents,compile-pull-agent">
<mkdir dir="build/api-servlet/classes"/>
- <javac srcdir="api-servlet/src/main/java" destdir="build/api-servlet/classes" target="1.5" source="1.4" debug="true" debuglevel="lines,vars,source">
+ <javac srcdir="api-servlet/src/main/java" destdir="build/api-servlet/classes" target="1.5" source="1.5" debug="true" debuglevel="lines,vars,source">
<classpath>
<fileset dir="lib">
<include name="*.jar"/>
@@ -148,7 +148,7 @@
<jasper2 validateXml="false" uriroot="crawler-ui/src/main/webapp" webXmlFragment="crawler-ui/src/main/webapp/WEB-INF/web-generated.xml" outputDir="build/crawler-ui/java" />
<!-- Compile java classes -->
<mkdir dir="build/crawler-ui/classes"/>
- <javac srcdir="build/crawler-ui/java" destdir="build/crawler-ui/classes" target="1.5" source="1.4" debug="true" debuglevel="lines,vars,source">
+ <javac srcdir="build/crawler-ui/java" destdir="build/crawler-ui/classes" target="1.5" source="1.5" debug="true" debuglevel="lines,vars,source">
<classpath id="classpath">
<pathelement location="${java.home}/../lib/tools.jar"/>
<fileset dir="lib">
Modified: incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/cachemanager/CacheManager.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/cachemanager/CacheManager.java?rev=1130475&r1=1130474&r2=1130475&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/cachemanager/CacheManager.java (original)
+++ incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/cachemanager/CacheManager.java Thu Jun 2 10:32:04 2011
@@ -202,7 +202,7 @@ public class CacheManager implements ICa
{
if (Logging.cache.isDebugEnabled())
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (locateObjectDescriptions != null)
{
sb.append("{");
@@ -219,7 +219,7 @@ public class CacheManager implements ICa
else
sb.append("NULL");
- StringBuffer inv = new StringBuffer();
+ StringBuilder inv = new StringBuilder();
if (invalidateKeys != null)
{
inv.append("{");
@@ -525,7 +525,7 @@ public class CacheManager implements ICa
if (Logging.cache.isDebugEnabled())
{
StringSet ks = objectDescription.getObjectKeys();
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (ks != null)
{
sb.append("{");
Modified: incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/common/XMLDoc.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/common/XMLDoc.java?rev=1130475&r1=1130474&r2=1130475&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/common/XMLDoc.java (original)
+++ incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/common/XMLDoc.java Thu Jun 2 10:32:04 2011
@@ -73,7 +73,7 @@ public class XMLDoc
{
Object element = currentRoot;
- StringBuffer bf = new StringBuffer();
+ StringBuilder bf = new StringBuilder();
boolean bWild = false;
ArrayList working = new ArrayList();
@@ -288,11 +288,11 @@ public class XMLDoc
}
}
- /** Construct a new document tree from a stringbuffer form of
+ /** Construct a new document tree from a StringBuilder form of
* an xml document
* @param data xml to parse
*/
- public XMLDoc(StringBuffer data)
+ public XMLDoc(StringBuilder data)
throws ManifoldCFException
{
try
@@ -409,7 +409,7 @@ public class XMLDoc
public final String getData(Object obj)
{
Node enode = (Node)obj;
- StringBuffer data = new StringBuffer();
+ StringBuilder data = new StringBuilder();
NodeList cdata = enode.getChildNodes();
// expect just 1
Modified: incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/connector/BaseConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/connector/BaseConnector.java?rev=1130475&r1=1130474&r2=1130475&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/connector/BaseConnector.java (original)
+++ incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/connector/BaseConnector.java Thu Jun 2 10:32:04 2011
@@ -127,7 +127,19 @@ public abstract class BaseConnector impl
*@param parameters are the configuration parameters, as they currently exist, for this connection being configured.
*@param tabsArray is an array of tab names. Add to this array any tab names that are specific to the connector.
*/
- public void outputConfigurationHeader(IThreadContext threadContext, IHTTPOutput out, ConfigParams parameters, ArrayList tabsArray)
+ public void outputConfigurationHeader(IThreadContext threadContext, IHTTPOutput out, ConfigParams parameters, List<String> tabsArray)
+ throws ManifoldCFException, IOException
+ {
+ // Call the old method signature, for backwards compatibility
+ ArrayList<Object> localTabsArray = new ArrayList<Object>();
+ outputConfigurationHeader(threadContext,out,parameters,localTabsArray);
+ for (Object o : localTabsArray)
+ {
+ tabsArray.add((String)o);
+ }
+ }
+
+ public void outputConfigurationHeader(IThreadContext threadContext, IHTTPOutput out, ConfigParams parameters, ArrayList<Object> tabsArray)
throws ManifoldCFException, IOException
{
}
Modified: incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/BaseTable.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/BaseTable.java?rev=1130475&r1=1130474&r2=1130475&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/BaseTable.java (original)
+++ incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/BaseTable.java Thu Jun 2 10:32:04 2011
@@ -82,7 +82,7 @@ public class BaseTable
*@param whereClause is the where clause describing the match (including the WHERE), or null if none.
*@param whereParameters are the parameters that come with the where clause, if any.
*/
- protected void performUpdate(Map parameterMap, String whereClause, ArrayList whereParameters, StringSet invalidateKeys)
+ protected void performUpdate(Map parameterMap, String whereClause, List whereParameters, StringSet invalidateKeys)
throws ManifoldCFException
{
dbInterface.performUpdate(tableName,parameterMap,whereClause,whereParameters,invalidateKeys);
@@ -93,7 +93,7 @@ public class BaseTable
*@param whereClause is the where clause describing the match (including the WHERE), or null if none.
*@param whereParameters are the parameters that come with the where clause, if any.
*/
- protected void performDelete(String whereClause, ArrayList whereParameters, StringSet invalidateKeys)
+ protected void performDelete(String whereClause, List whereParameters, StringSet invalidateKeys)
throws ManifoldCFException
{
dbInterface.performDelete(tableName,whereClause,whereParameters,invalidateKeys);
@@ -119,7 +119,7 @@ public class BaseTable
*@param columnDeleteList is the list of column names to delete.
*@param invalidateKeys are the cache keys that should be invalidated, if any.
*/
- public void performAlter(Map columnMap, Map columnModifyMap, ArrayList columnDeleteList,
+ public void performAlter(Map columnMap, Map columnModifyMap, List<String> columnDeleteList,
StringSet invalidateKeys)
throws ManifoldCFException
{
@@ -131,7 +131,7 @@ public class BaseTable
*@param columnList is the list of columns that need to be included
* in the index, in order.
*/
- protected void addTableIndex(boolean unique, ArrayList columnList)
+ protected void addTableIndex(boolean unique, List<String> columnList)
throws ManifoldCFException
{
dbInterface.addTableIndex(tableName,unique,columnList);
@@ -209,7 +209,7 @@ public class BaseTable
*@param params are the parameterized values, if needed.
*@param invalidateKeys are the cache keys to invalidate.
*/
- protected void performModification(String query, ArrayList params, StringSet invalidateKeys)
+ protected void performModification(String query, List params, StringSet invalidateKeys)
throws ManifoldCFException
{
dbInterface.performModification(query,params,invalidateKeys);
@@ -223,7 +223,7 @@ public class BaseTable
* or null if no LRU behavior desired.
*@return a resultset.
*/
- protected IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass)
+ protected IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass)
throws ManifoldCFException
{
return dbInterface.performQuery(query,params,cacheKeys,queryClass);
@@ -238,7 +238,7 @@ public class BaseTable
*@param resultLimit is the maximum number of results desired.
*@return a resultset.
*/
- protected IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass, int resultLimit)
+ protected IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass, int resultLimit)
throws ManifoldCFException
{
return dbInterface.performQuery(query,params,cacheKeys,queryClass,resultLimit,null);
@@ -334,15 +334,15 @@ public class BaseTable
* This filter wraps a query and returns a new query whose results are similar to POSTGRESQL's DISTINCT-ON feature.
* Specifically, for each combination of the specified distinct fields in the result, only the first such row is included in the final
* result.
- *@param outputParameters is a blank arraylist into which to put parameters. Null may be used if the baseParameters parameter is null.
+ *@param outputParameters is a blank list into which to put parameters. Null may be used if the baseParameters parameter is null.
*@param baseQuery is the base query, which can either be tables and where clause, or can be another SELECT in parens,
* e.g. "(SELECT ...) t3"
*@param baseParameters are the parameters corresponding to the baseQuery.
*@param distinctFields are the fields to consider to be distinct.
*@param otherFields are the rest of the fields to return, keyed by the AS name, value being the column value, e.g. "value AS key"
- *@return a revised query that performs the necessary DISTINCT ON operation. The arraylist outputParameters will also be appropriately filled in.
+ *@return a revised query that performs the necessary DISTINCT ON operation. The list outputParameters will also be appropriately filled in.
*/
- public String constructDistinctOnClause(ArrayList outputParameters, String baseQuery, ArrayList baseParameters, String[] distinctFields, Map otherFields)
+ public String constructDistinctOnClause(List outputParameters, String baseQuery, List baseParameters, String[] distinctFields, Map otherFields)
{
return dbInterface.constructDistinctOnClause(outputParameters,baseQuery,baseParameters,distinctFields,otherFields);
}
Modified: incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java?rev=1130475&r1=1130474&r2=1130475&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java (original)
+++ incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java Thu Jun 2 10:32:04 2011
@@ -53,22 +53,22 @@ public class DBInterfaceDerby extends Da
boolean inTransaction = false;
// This is where we keep track of tables that we need to analyze on transaction exit
- protected ArrayList tablesToAnalyze = new ArrayList();
+ protected List<String> tablesToAnalyze = new ArrayList<String>();
// Keep track of tables to reindex on transaction exit
- protected ArrayList tablesToReindex = new ArrayList();
+ protected List<String> tablesToReindex = new ArrayList<String>();
// This is where we keep temporary table statistics, which accumulate until they reach a threshold, and then are added into shared memory.
/** Accumulated reindex statistics. This map is keyed by the table name, and contains TableStatistics values. */
- protected static Map currentReindexStatistics = new HashMap();
+ protected static Map<String,TableStatistics> currentReindexStatistics = new HashMap<String,TableStatistics>();
/** Table reindex thresholds, as read from configuration information. Keyed by table name, contains Integer values. */
- protected static Map reindexThresholds = new HashMap();
+ protected static Map<String,Integer> reindexThresholds = new HashMap<String,Integer>();
/** Accumulated analyze statistics. This map is keyed by the table name, and contains TableStatistics values. */
- protected static Map currentAnalyzeStatistics = new HashMap();
+ protected static Map<String,TableStatistics> currentAnalyzeStatistics = new HashMap<String,TableStatistics>();
/** Table analyze thresholds, as read from configuration information. Keyed by table name, contains Integer values. */
- protected static Map analyzeThresholds = new HashMap();
+ protected static Map<String,Integer> analyzeThresholds = new HashMap<String,Integer>();
/** The number of inserts, deletes, etc. before we update the shared area. */
protected static final int commitThreshold = 100;
@@ -176,25 +176,25 @@ public class DBInterfaceDerby extends Da
* invalidated.
*@param parameterMap is the map of column name/values to write.
*/
- public void performInsert(String tableName, Map parameterMap, StringSet invalidateKeys)
+ public void performInsert(String tableName, Map<String,Object> parameterMap, StringSet invalidateKeys)
throws ManifoldCFException
{
- ArrayList paramArray = new ArrayList();
+ List paramArray = new ArrayList();
- StringBuffer bf = new StringBuffer();
+ StringBuilder bf = new StringBuilder();
bf.append("INSERT INTO ");
bf.append(tableName);
bf.append(" (") ;
- StringBuffer values = new StringBuffer(" VALUES (");
+ StringBuilder values = new StringBuilder(" VALUES (");
// loop for cols
- Iterator it = parameterMap.entrySet().iterator();
+ Iterator<Map.Entry<String,Object>> it = parameterMap.entrySet().iterator();
boolean first = true;
while (it.hasNext())
{
- Map.Entry e = (Map.Entry)it.next();
- String key = (String)e.getKey();
+ Map.Entry<String,Object> e = it.next();
+ String key = e.getKey();
Object o = e.getValue();
if (o != null)
@@ -229,23 +229,24 @@ public class DBInterfaceDerby extends Da
*@param whereClause is the where clause describing the match (including the WHERE), or null if none.
*@param whereParameters are the parameters that come with the where clause, if any.
*/
- public void performUpdate(String tableName, Map parameterMap, String whereClause, ArrayList whereParameters, StringSet invalidateKeys)
+ public void performUpdate(String tableName, Map<String,Object> parameterMap, String whereClause,
+ List whereParameters, StringSet invalidateKeys)
throws ManifoldCFException
{
- ArrayList paramArray = new ArrayList();
+ List paramArray = new ArrayList();
- StringBuffer bf = new StringBuffer();
+ StringBuilder bf = new StringBuilder();
bf.append("UPDATE ");
bf.append(tableName);
bf.append(" SET ") ;
// loop for parameters
- Iterator it = parameterMap.entrySet().iterator();
+ Iterator<Map.Entry<String,Object>> it = parameterMap.entrySet().iterator();
boolean first = true;
while (it.hasNext())
{
- Map.Entry e = (Map.Entry)it.next();
- String key = (String)e.getKey();
+ Map.Entry<String,Object> e = it.next();
+ String key = e.getKey();
Object o = e.getValue();
@@ -294,10 +295,10 @@ public class DBInterfaceDerby extends Da
*@param whereClause is the where clause describing the match (including the WHERE), or null if none.
*@param whereParameters are the parameters that come with the where clause, if any.
*/
- public void performDelete(String tableName, String whereClause, ArrayList whereParameters, StringSet invalidateKeys)
+ public void performDelete(String tableName, String whereClause, List whereParameters, StringSet invalidateKeys)
throws ManifoldCFException
{
- StringBuffer bf = new StringBuffer();
+ StringBuilder bf = new StringBuilder();
bf.append("DELETE FROM ");
bf.append(tableName);
if (whereClause != null)
@@ -320,19 +321,19 @@ public class DBInterfaceDerby extends Da
* layer.
*@param invalidateKeys are the cache keys that should be invalidated, if any.
*/
- public void performCreate(String tableName, Map columnMap, StringSet invalidateKeys)
+ public void performCreate(String tableName, Map<String,ColumnDescription> columnMap, StringSet invalidateKeys)
throws ManifoldCFException
{
int constraintNumber = 0;
- StringBuffer queryBuffer = new StringBuffer("CREATE TABLE ");
+ StringBuilder queryBuffer = new StringBuilder("CREATE TABLE ");
queryBuffer.append(tableName);
queryBuffer.append('(');
- Iterator iter = columnMap.keySet().iterator();
+ Iterator<String> iter = columnMap.keySet().iterator();
boolean first = true;
while (iter.hasNext())
{
- String columnName = (String)iter.next();
- ColumnDescription cd = (ColumnDescription)columnMap.get(columnName);
+ String columnName = iter.next();
+ ColumnDescription cd = columnMap.get(columnName);
if (!first)
queryBuffer.append(',');
else
@@ -345,7 +346,7 @@ public class DBInterfaceDerby extends Da
}
- protected void appendDescription(StringBuffer queryBuffer, String columnName, ColumnDescription cd, boolean forceNull)
+ protected void appendDescription(StringBuilder queryBuffer, String columnName, ColumnDescription cd, boolean forceNull)
throws ManifoldCFException
{
queryBuffer.append(columnName);
@@ -383,7 +384,8 @@ public class DBInterfaceDerby extends Da
*@param columnDeleteList is the list of column names to delete.
*@param invalidateKeys are the cache keys that should be invalidated, if any.
*/
- public void performAlter(String tableName, Map columnMap, Map columnModifyMap, ArrayList columnDeleteList,
+ public void performAlter(String tableName, Map<String,ColumnDescription> columnMap,
+ Map<String,ColumnDescription> columnModifyMap, List<String> columnDeleteList,
StringSet invalidateKeys)
throws ManifoldCFException
{
@@ -395,7 +397,7 @@ public class DBInterfaceDerby extends Da
int i = 0;
while (i < columnDeleteList.size())
{
- String columnName = (String)columnDeleteList.get(i++);
+ String columnName = columnDeleteList.get(i++);
performModification("ALTER TABLE ONLY "+tableName+" DROP "+columnName,null,invalidateKeys);
}
}
@@ -403,16 +405,16 @@ public class DBInterfaceDerby extends Da
// Do the modifies. This involves renaming each column to a temp column, then creating a new one, then copying
if (columnModifyMap != null)
{
- Iterator iter = columnModifyMap.keySet().iterator();
+ Iterator<String> iter = columnModifyMap.keySet().iterator();
while (iter.hasNext())
{
- String columnName = (String)iter.next();
- ColumnDescription cd = (ColumnDescription)columnModifyMap.get(columnName);
+ String columnName = iter.next();
+ ColumnDescription cd = columnModifyMap.get(columnName);
String renameColumn = "__temp__";
// Create a new column we can copy the data into.
performModification("RENAME COLUMN "+tableName+"."+columnName+" TO "+renameColumn,null,invalidateKeys);
// Create new column
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
appendDescription(sb,columnName,cd,true);
performModification("ALTER TABLE "+tableName+" ADD "+sb.toString(),null,invalidateKeys);
// Copy old data to new
@@ -428,12 +430,12 @@ public class DBInterfaceDerby extends Da
// Now, do the adds
if (columnMap != null)
{
- Iterator iter = columnMap.keySet().iterator();
+ Iterator<String> iter = columnMap.keySet().iterator();
while (iter.hasNext())
{
- String columnName = (String)iter.next();
- ColumnDescription cd = (ColumnDescription)columnMap.get(columnName);
- StringBuffer sb = new StringBuffer();
+ String columnName = iter.next();
+ ColumnDescription cd = columnMap.get(columnName);
+ StringBuilder sb = new StringBuilder();
appendDescription(sb,columnName,cd,false);
performModification("ALTER TABLE "+tableName+" ADD "+sb.toString(),null,invalidateKeys);
}
@@ -474,14 +476,14 @@ public class DBInterfaceDerby extends Da
*@param columnList is the list of columns that need to be included
* in the index, in order.
*/
- public void addTableIndex(String tableName, boolean unique, ArrayList columnList)
+ public void addTableIndex(String tableName, boolean unique, List<String> columnList)
throws ManifoldCFException
{
String[] columns = new String[columnList.size()];
int i = 0;
while (i < columns.length)
{
- columns[i] = (String)columnList.get(i);
+ columns[i] = columnList.get(i);
i++;
}
performAddIndex(null,tableName,new IndexDescription(unique,columns));
@@ -502,7 +504,7 @@ public class DBInterfaceDerby extends Da
if (indexName == null)
// Build an index name
indexName = "I"+IDFactory.make(context);
- StringBuffer queryBuffer = new StringBuffer("CREATE ");
+ StringBuilder queryBuffer = new StringBuilder("CREATE ");
if (description.getIsUnique())
queryBuffer.append("UNIQUE ");
queryBuffer.append("INDEX ");
@@ -568,7 +570,7 @@ public class DBInterfaceDerby extends Da
lockManager.enterWriteCriticalSection(tableStatisticsLock);
try
{
- TableStatistics ts = (TableStatistics)currentAnalyzeStatistics.get(tableName);
+ TableStatistics ts = currentAnalyzeStatistics.get(tableName);
// Lock this table's statistics files
lockManager.enterWriteLock(tableStatisticsLock);
try
@@ -605,7 +607,7 @@ public class DBInterfaceDerby extends Da
lockManager.enterWriteCriticalSection(tableStatisticsLock);
try
{
- TableStatistics ts = (TableStatistics)currentReindexStatistics.get(tableName);
+ TableStatistics ts = currentReindexStatistics.get(tableName);
// Lock this table's statistics files
lockManager.enterWriteLock(tableStatisticsLock);
try
@@ -634,7 +636,7 @@ public class DBInterfaceDerby extends Da
{
if (getTransactionID() == null)
{
- ArrayList list = new ArrayList();
+ List list = new ArrayList();
list.add("APP");
list.add(tableName.toUpperCase());
performModification("CALL SYSCS_UTIL.SYSCS_UPDATE_STATISTICS(?,?,null)",list,null);
@@ -654,12 +656,12 @@ public class DBInterfaceDerby extends Da
try
{
// To reindex, we (a) get all the table's indexes, (b) drop them, (c) recreate them
- Map x = getTableIndexes(tableName,null,null);
- Iterator iter = x.keySet().iterator();
+ Map<String,IndexDescription> x = getTableIndexes(tableName,null,null);
+ Iterator<String> iter = x.keySet().iterator();
while (iter.hasNext())
{
- String indexName = (String)iter.next();
- IndexDescription id = (IndexDescription)x.get(indexName);
+ String indexName = iter.next();
+ IndexDescription id = x.get(indexName);
performRemoveIndex(indexName);
performAddIndex(indexName,tableName,id);
}
@@ -809,7 +811,7 @@ public class DBInterfaceDerby extends Da
*@param params are the parameterized values, if needed.
*@param invalidateKeys are the cache keys to invalidate.
*/
- public void performModification(String query, ArrayList params, StringSet invalidateKeys)
+ public void performModification(String query, List params, StringSet invalidateKeys)
throws ManifoldCFException
{
while (true)
@@ -858,18 +860,18 @@ public class DBInterfaceDerby extends Da
*@return a map of column names and ColumnDescription objects, describing the schema, or null if the
* table doesn't exist.
*/
- public Map getTableSchema(String tableName, StringSet cacheKeys, String queryClass)
+ public Map<String,ColumnDescription> getTableSchema(String tableName, StringSet cacheKeys, String queryClass)
throws ManifoldCFException
{
String query = "SELECT CAST(t0.columnname AS VARCHAR(128)) AS columnname,CAST(t0.columndatatype AS VARCHAR(128)) AS columndatatype FROM sys.syscolumns t0, sys.systables t1 WHERE t0.referenceid=t1.tableid AND CAST(t1.tablename AS VARCHAR(128))=? ORDER BY t0.columnnumber ASC";
- ArrayList list = new ArrayList();
+ List list = new ArrayList();
list.add(tableName.toUpperCase());
IResultSet set = performQuery(query,list,cacheKeys,queryClass);
if (set.getRowCount() == 0)
return null;
// Digest the result
- HashMap rval = new HashMap();
+ Map<String,ColumnDescription> rval = new HashMap<String,ColumnDescription>();
int i = 0;
while (i < set.getRowCount())
{
@@ -890,14 +892,14 @@ public class DBInterfaceDerby extends Da
*@param queryClass is the name of the query class, or null.
*@return a map of index names and IndexDescription objects, describing the indexes.
*/
- public Map getTableIndexes(String tableName, StringSet cacheKeys, String queryClass)
+ public Map<String,IndexDescription> getTableIndexes(String tableName, StringSet cacheKeys, String queryClass)
throws ManifoldCFException
{
- Map rval = new HashMap();
+ Map<String,IndexDescription> rval = new HashMap<String,IndexDescription>();
// This query returns all index names for the table
String query = "SELECT t0.conglomeratename FROM sys.sysconglomerates t0,sys.systables t1 WHERE t0.tableid=t1.tableid AND t0.isindex IS NOT NULL AND CAST(t1.tablename AS VARCHAR(128))=?";
- ArrayList list = new ArrayList();
+ List list = new ArrayList();
list.add(tableName);
// It doesn't look like there's a way to find exactly what is in the index, and what the columns are. Since
@@ -947,7 +949,7 @@ public class DBInterfaceDerby extends Da
* or null if no LRU behavior desired.
*@return a resultset.
*/
- public IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass)
+ public IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass)
throws ManifoldCFException
{
try
@@ -970,7 +972,7 @@ public class DBInterfaceDerby extends Da
*@param returnLimit is a description of how to limit the return result, or null if no limit.
*@return a resultset.
*/
- public IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass,
+ public IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass,
int maxResults, ILimitChecker returnLimit)
throws ManifoldCFException
{
@@ -995,7 +997,7 @@ public class DBInterfaceDerby extends Da
*@param returnLimit is a description of how to limit the return result, or null if no limit.
*@return a resultset.
*/
- public IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass,
+ public IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass,
int maxResults, ResultSpecification resultSpec, ILimitChecker returnLimit)
throws ManifoldCFException
{
@@ -1061,7 +1063,7 @@ public class DBInterfaceDerby extends Da
*/
public String constructOffsetLimitClause(int offset, int limit)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (offset != 0)
sb.append("OFFSET ").append(Integer.toString(offset)).append(" ROWS");
if (limit != -1)
@@ -1077,15 +1079,16 @@ public class DBInterfaceDerby extends Da
* This filter wraps a query and returns a new query whose results are similar to POSTGRESQL's DISTINCT-ON feature.
* Specifically, for each combination of the specified distinct fields in the result, only the first such row is included in the final
* result.
- *@param outputParameters is a blank arraylist into which to put parameters. Null may be used if the baseParameters parameter is null.
+ *@param outputParameters is a blank list into which to put parameters. Null may be used if the baseParameters parameter is null.
*@param baseQuery is the base query, which is another SELECT statement, without parens,
* e.g. "SELECT ..."
*@param baseParameters are the parameters corresponding to the baseQuery.
*@param distinctFields are the fields to consider to be distinct. These should all be keys in otherFields below.
*@param otherFields are the rest of the fields to return, keyed by the AS name, value being the base query column value, e.g. "value AS key"
- *@return a revised query that performs the necessary DISTINCT ON operation. The arraylist outputParameters will also be appropriately filled in.
+ *@return a revised query that performs the necessary DISTINCT ON operation. The list outputParameters will also be appropriately filled in.
*/
- public String constructDistinctOnClause(ArrayList outputParameters, String baseQuery, ArrayList baseParameters, String[] distinctFields, Map otherFields)
+ public String constructDistinctOnClause(List outputParameters, String baseQuery, List baseParameters, String[] distinctFields,
+ Map<String,String> otherFields)
{
// Derby does not really support this functionality.
// We could hack a workaround, along the following lines:
@@ -1108,13 +1111,13 @@ public class DBInterfaceDerby extends Da
if (baseParameters != null)
outputParameters.addAll(baseParameters);
- StringBuffer sb = new StringBuffer("SELECT ");
+ StringBuilder sb = new StringBuilder("SELECT ");
boolean needComma = false;
- Iterator iter = otherFields.keySet().iterator();
+ Iterator<String> iter = otherFields.keySet().iterator();
while (iter.hasNext())
{
- String fieldName = (String)iter.next();
- String columnValue = (String)otherFields.get(fieldName);
+ String fieldName = iter.next();
+ String columnValue = otherFields.get(fieldName);
if (needComma)
sb.append(",");
needComma = true;
@@ -1163,7 +1166,7 @@ public class DBInterfaceDerby extends Da
lockManager.enterWriteCriticalSection(tableStatisticsLock);
try
{
- Integer threshold = (Integer)reindexThresholds.get(tableName);
+ Integer threshold = reindexThresholds.get(tableName);
int reindexThreshold;
if (threshold == null)
{
@@ -1174,7 +1177,7 @@ public class DBInterfaceDerby extends Da
else
reindexThreshold = threshold.intValue();
- TableStatistics ts = (TableStatistics)currentReindexStatistics.get(tableName);
+ TableStatistics ts = currentReindexStatistics.get(tableName);
if (ts == null)
{
ts = new TableStatistics();
@@ -1220,7 +1223,7 @@ public class DBInterfaceDerby extends Da
lockManager.enterWriteCriticalSection(tableStatisticsLock);
try
{
- Integer threshold = (Integer)analyzeThresholds.get(tableName);
+ Integer threshold = analyzeThresholds.get(tableName);
int analyzeThreshold;
if (threshold == null)
{
@@ -1231,7 +1234,7 @@ public class DBInterfaceDerby extends Da
else
analyzeThreshold = threshold.intValue();
- TableStatistics ts = (TableStatistics)currentAnalyzeStatistics.get(tableName);
+ TableStatistics ts = currentAnalyzeStatistics.get(tableName);
if (ts == null)
{
ts = new TableStatistics();
@@ -1381,13 +1384,13 @@ public class DBInterfaceDerby extends Da
int i = 0;
while (i < tablesToAnalyze.size())
{
- analyzeTableInternal((String)tablesToAnalyze.get(i++));
+ analyzeTableInternal(tablesToAnalyze.get(i++));
}
tablesToAnalyze.clear();
i = 0;
while (i < tablesToReindex.size())
{
- reindexTableInternal((String)tablesToReindex.get(i++));
+ reindexTableInternal(tablesToReindex.get(i++));
}
tablesToReindex.clear();
}
Modified: incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java?rev=1130475&r1=1130474&r2=1130475&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java (original)
+++ incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java Thu Jun 2 10:32:04 2011
@@ -130,25 +130,25 @@ public class DBInterfaceHSQLDB extends D
* invalidated.
*@param parameterMap is the map of column name/values to write.
*/
- public void performInsert(String tableName, Map parameterMap, StringSet invalidateKeys)
+ public void performInsert(String tableName, Map<String,Object> parameterMap, StringSet invalidateKeys)
throws ManifoldCFException
{
- ArrayList paramArray = new ArrayList();
+ List paramArray = new ArrayList();
- StringBuffer bf = new StringBuffer();
+ StringBuilder bf = new StringBuilder();
bf.append("INSERT INTO ");
bf.append(tableName);
bf.append(" (") ;
- StringBuffer values = new StringBuffer(" VALUES (");
+ StringBuilder values = new StringBuilder(" VALUES (");
// loop for cols
- Iterator it = parameterMap.entrySet().iterator();
+ Iterator<Map.Entry<String,Object>> it = parameterMap.entrySet().iterator();
boolean first = true;
while (it.hasNext())
{
- Map.Entry e = (Map.Entry)it.next();
- String key = (String)e.getKey();
+ Map.Entry<String,Object> e = it.next();
+ String key = e.getKey();
Object o = e.getValue();
if (o != null)
@@ -183,23 +183,24 @@ public class DBInterfaceHSQLDB extends D
*@param whereClause is the where clause describing the match (including the WHERE), or null if none.
*@param whereParameters are the parameters that come with the where clause, if any.
*/
- public void performUpdate(String tableName, Map parameterMap, String whereClause, ArrayList whereParameters, StringSet invalidateKeys)
+ public void performUpdate(String tableName, Map<String,Object> parameterMap, String whereClause,
+ List whereParameters, StringSet invalidateKeys)
throws ManifoldCFException
{
- ArrayList paramArray = new ArrayList();
+ List paramArray = new ArrayList();
- StringBuffer bf = new StringBuffer();
+ StringBuilder bf = new StringBuilder();
bf.append("UPDATE ");
bf.append(tableName);
bf.append(" SET ") ;
// loop for parameters
- Iterator it = parameterMap.entrySet().iterator();
+ Iterator<Map.Entry<String,Object>> it = parameterMap.entrySet().iterator();
boolean first = true;
while (it.hasNext())
{
- Map.Entry e = (Map.Entry)it.next();
- String key = (String)e.getKey();
+ Map.Entry<String,Object> e = it.next();
+ String key = e.getKey();
Object o = e.getValue();
@@ -248,10 +249,10 @@ public class DBInterfaceHSQLDB extends D
*@param whereClause is the where clause describing the match (including the WHERE), or null if none.
*@param whereParameters are the parameters that come with the where clause, if any.
*/
- public void performDelete(String tableName, String whereClause, ArrayList whereParameters, StringSet invalidateKeys)
+ public void performDelete(String tableName, String whereClause, List whereParameters, StringSet invalidateKeys)
throws ManifoldCFException
{
- StringBuffer bf = new StringBuffer();
+ StringBuilder bf = new StringBuilder();
bf.append("DELETE FROM ");
bf.append(tableName);
if (whereClause != null)
@@ -274,18 +275,18 @@ public class DBInterfaceHSQLDB extends D
* layer.
*@param invalidateKeys are the cache keys that should be invalidated, if any.
*/
- public void performCreate(String tableName, Map columnMap, StringSet invalidateKeys)
+ public void performCreate(String tableName, Map<String,ColumnDescription> columnMap, StringSet invalidateKeys)
throws ManifoldCFException
{
- StringBuffer queryBuffer = new StringBuffer("CREATE TABLE ");
+ StringBuilder queryBuffer = new StringBuilder("CREATE TABLE ");
queryBuffer.append(tableName);
queryBuffer.append('(');
- Iterator iter = columnMap.keySet().iterator();
+ Iterator<String> iter = columnMap.keySet().iterator();
boolean first = true;
while (iter.hasNext())
{
- String columnName = (String)iter.next();
- ColumnDescription cd = (ColumnDescription)columnMap.get(columnName);
+ String columnName = iter.next();
+ ColumnDescription cd = columnMap.get(columnName);
if (!first)
queryBuffer.append(',');
else
@@ -298,7 +299,7 @@ public class DBInterfaceHSQLDB extends D
}
- protected static void appendDescription(StringBuffer queryBuffer, String columnName, ColumnDescription cd, boolean forceNull)
+ protected static void appendDescription(StringBuilder queryBuffer, String columnName, ColumnDescription cd, boolean forceNull)
{
queryBuffer.append(columnName);
queryBuffer.append(' ');
@@ -333,7 +334,8 @@ public class DBInterfaceHSQLDB extends D
*@param columnDeleteList is the list of column names to delete.
*@param invalidateKeys are the cache keys that should be invalidated, if any.
*/
- public void performAlter(String tableName, Map columnMap, Map columnModifyMap, ArrayList columnDeleteList,
+ public void performAlter(String tableName, Map<String,ColumnDescription> columnMap,
+ Map<String,ColumnDescription> columnModifyMap, List<String> columnDeleteList,
StringSet invalidateKeys)
throws ManifoldCFException
{
@@ -345,7 +347,7 @@ public class DBInterfaceHSQLDB extends D
int i = 0;
while (i < columnDeleteList.size())
{
- String columnName = (String)columnDeleteList.get(i++);
+ String columnName = columnDeleteList.get(i++);
performModification("ALTER TABLE "+tableName+" DROP "+columnName+" RESTRICT",null,invalidateKeys);
}
}
@@ -353,21 +355,21 @@ public class DBInterfaceHSQLDB extends D
// Do the modifies. This involves renaming each column to a temp column, then creating a new one, then copying
if (columnModifyMap != null)
{
- Iterator iter = columnModifyMap.keySet().iterator();
+ Iterator<String> iter = columnModifyMap.keySet().iterator();
while (iter.hasNext())
{
- StringBuffer sb;
- String columnName = (String)iter.next();
- ColumnDescription cd = (ColumnDescription)columnModifyMap.get(columnName);
+ StringBuilder sb;
+ String columnName = iter.next();
+ ColumnDescription cd = columnModifyMap.get(columnName);
String renameColumn = "__temp__";
- sb = new StringBuffer();
+ sb = new StringBuilder();
appendDescription(sb,renameColumn,cd,true);
// Rename current column. This too involves a copy.
performModification("ALTER TABLE "+tableName+" ADD "+sb.toString(),null,invalidateKeys);
performModification("UPDATE "+tableName+" SET "+renameColumn+"="+columnName,null,invalidateKeys);
performModification("ALTER TABLE "+tableName+" DROP "+columnName+" RESTRICT",null,invalidateKeys);
// Create new column
- sb = new StringBuffer();
+ sb = new StringBuilder();
appendDescription(sb,columnName,cd,true);
performModification("ALTER TABLE "+tableName+" ADD "+sb.toString(),null,invalidateKeys);
// Copy old data to new
@@ -383,12 +385,12 @@ public class DBInterfaceHSQLDB extends D
// Now, do the adds
if (columnMap != null)
{
- Iterator iter = columnMap.keySet().iterator();
+ Iterator<String> iter = columnMap.keySet().iterator();
while (iter.hasNext())
{
- String columnName = (String)iter.next();
- ColumnDescription cd = (ColumnDescription)columnMap.get(columnName);
- StringBuffer sb = new StringBuffer();
+ String columnName = iter.next();
+ ColumnDescription cd = columnMap.get(columnName);
+ StringBuilder sb = new StringBuilder();
appendDescription(sb,columnName,cd,false);
performModification("ALTER TABLE "+tableName+" ADD "+sb.toString(),null,invalidateKeys);
}
@@ -429,14 +431,14 @@ public class DBInterfaceHSQLDB extends D
*@param columnList is the list of columns that need to be included
* in the index, in order.
*/
- public void addTableIndex(String tableName, boolean unique, ArrayList columnList)
+ public void addTableIndex(String tableName, boolean unique, List<String> columnList)
throws ManifoldCFException
{
String[] columns = new String[columnList.size()];
int i = 0;
while (i < columns.length)
{
- columns[i] = (String)columnList.get(i);
+ columns[i] = columnList.get(i);
i++;
}
performAddIndex(null,tableName,new IndexDescription(unique,columns));
@@ -457,7 +459,7 @@ public class DBInterfaceHSQLDB extends D
if (indexName == null)
// Build an index name
indexName = "I"+IDFactory.make(context);
- StringBuffer queryBuffer = new StringBuffer("CREATE ");
+ StringBuilder queryBuffer = new StringBuilder("CREATE ");
if (description.getIsUnique())
queryBuffer.append("UNIQUE ");
queryBuffer.append("INDEX ");
@@ -605,7 +607,7 @@ public class DBInterfaceHSQLDB extends D
*@param params are the parameterized values, if needed.
*@param invalidateKeys are the cache keys to invalidate.
*/
- public void performModification(String query, ArrayList params, StringSet invalidateKeys)
+ public void performModification(String query, List params, StringSet invalidateKeys)
throws ManifoldCFException
{
try
@@ -625,11 +627,11 @@ public class DBInterfaceHSQLDB extends D
*@return a map of column names and ColumnDescription objects, describing the schema, or null if the
* table doesn't exist.
*/
- public Map getTableSchema(String tableName, StringSet cacheKeys, String queryClass)
+ public Map<String,ColumnDescription> getTableSchema(String tableName, StringSet cacheKeys, String queryClass)
throws ManifoldCFException
{
- StringBuffer query = new StringBuffer();
- ArrayList list = new ArrayList();
+ StringBuilder query = new StringBuilder();
+ List list = new ArrayList();
list.add(tableName.toUpperCase());
query.append("SELECT column_name, is_nullable, data_type, character_maximum_length ")
.append("FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='PUBLIC' AND table_name=?");
@@ -637,7 +639,7 @@ public class DBInterfaceHSQLDB extends D
if (set.getRowCount() == 0)
return null;
- query = new StringBuffer();
+ query = new StringBuilder();
query.append("SELECT column_name ")
.append("FROM INFORMATION_SCHEMA.SYSTEM_PRIMARYKEYS WHERE table_schem='PUBLIC' AND table_name=?");
IResultSet primarySet = performQuery(query.toString(),list,cacheKeys,queryClass);
@@ -648,7 +650,7 @@ public class DBInterfaceHSQLDB extends D
primaryKey = "";
// Digest the result
- HashMap rval = new HashMap();
+ Map<String,ColumnDescription> rval = new HashMap<String,ColumnDescription>();
int i = 0;
while (i < set.getRowCount())
{
@@ -678,18 +680,18 @@ public class DBInterfaceHSQLDB extends D
*@param queryClass is the name of the query class, or null.
*@return a map of index names and IndexDescription objects, describing the indexes.
*/
- public Map getTableIndexes(String tableName, StringSet cacheKeys, String queryClass)
+ public Map<String,IndexDescription> getTableIndexes(String tableName, StringSet cacheKeys, String queryClass)
throws ManifoldCFException
{
- Map rval = new HashMap();
+ Map<String,IndexDescription> rval = new HashMap<String,IndexDescription>();
String query = "SELECT index_name,column_name,non_unique,ordinal_position FROM INFORMATION_SCHEMA.SYSTEM_INDEXINFO "+
"WHERE table_schem='PUBLIC' AND TABLE_NAME=? ORDER BY index_name,ordinal_position ASC";
- ArrayList list = new ArrayList();
+ List list = new ArrayList();
list.add(tableName.toUpperCase());
IResultSet result = performQuery(query,list,cacheKeys,queryClass);
String lastIndexName = null;
- ArrayList indexColumns = null;
+ List<String> indexColumns = null;
boolean isUnique = false;
int i = 0;
while (i < result.getRowCount())
@@ -710,7 +712,7 @@ public class DBInterfaceHSQLDB extends D
if (lastIndexName == null)
{
lastIndexName = indexName;
- indexColumns = new ArrayList();
+ indexColumns = new ArrayList<String>();
isUnique = false;
}
indexColumns.add(columnName);
@@ -723,7 +725,7 @@ public class DBInterfaceHSQLDB extends D
return rval;
}
- protected void addIndex(Map rval, String indexName, boolean isUnique, ArrayList indexColumns)
+ protected void addIndex(Map rval, String indexName, boolean isUnique, List<String> indexColumns)
{
if (indexName.indexOf("sys_idx") != -1)
return;
@@ -731,7 +733,7 @@ public class DBInterfaceHSQLDB extends D
int i = 0;
while (i < columnNames.length)
{
- columnNames[i] = (String)indexColumns.get(i);
+ columnNames[i] = indexColumns.get(i);
i++;
}
rval.put(indexName,new IndexDescription(isUnique,columnNames));
@@ -767,7 +769,7 @@ public class DBInterfaceHSQLDB extends D
* or null if no LRU behavior desired.
*@return a resultset.
*/
- public IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass)
+ public IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass)
throws ManifoldCFException
{
try
@@ -790,7 +792,7 @@ public class DBInterfaceHSQLDB extends D
*@param returnLimit is a description of how to limit the return result, or null if no limit.
*@return a resultset.
*/
- public IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass,
+ public IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass,
int maxResults, ILimitChecker returnLimit)
throws ManifoldCFException
{
@@ -815,7 +817,7 @@ public class DBInterfaceHSQLDB extends D
*@param returnLimit is a description of how to limit the return result, or null if no limit.
*@return a resultset.
*/
- public IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass,
+ public IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass,
int maxResults, ResultSpecification resultSpec, ILimitChecker returnLimit)
throws ManifoldCFException
{
@@ -862,7 +864,7 @@ public class DBInterfaceHSQLDB extends D
*/
public String constructOffsetLimitClause(int offset, int limit)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (offset != 0)
sb.append("OFFSET ").append(Integer.toString(offset));
if (limit != -1)
@@ -878,15 +880,16 @@ public class DBInterfaceHSQLDB extends D
* This filter wraps a query and returns a new query whose results are similar to POSTGRESQL's DISTINCT-ON feature.
* Specifically, for each combination of the specified distinct fields in the result, only the first such row is included in the final
* result.
- *@param outputParameters is a blank arraylist into which to put parameters. Null may be used if the baseParameters parameter is null.
+ *@param outputParameters is a blank list into which to put parameters. Null may be used if the baseParameters parameter is null.
*@param baseQuery is the base query, which is another SELECT statement, without parens,
* e.g. "SELECT ..."
*@param baseParameters are the parameters corresponding to the baseQuery.
*@param distinctFields are the fields to consider to be distinct. These should all be keys in otherFields below.
*@param otherFields are the rest of the fields to return, keyed by the AS name, value being the base query column value, e.g. "value AS key"
- *@return a revised query that performs the necessary DISTINCT ON operation. The arraylist outputParameters will also be appropriately filled in.
+ *@return a revised query that performs the necessary DISTINCT ON operation. The list outputParameters will also be appropriately filled in.
*/
- public String constructDistinctOnClause(ArrayList outputParameters, String baseQuery, ArrayList baseParameters, String[] distinctFields, Map otherFields)
+ public String constructDistinctOnClause(List outputParameters, String baseQuery, List baseParameters,
+ String[] distinctFields, Map<String,String> otherFields)
{
// HSQLDB does not really support this functionality.
// We could hack a workaround, along the following lines:
@@ -909,13 +912,13 @@ public class DBInterfaceHSQLDB extends D
if (baseParameters != null)
outputParameters.addAll(baseParameters);
- StringBuffer sb = new StringBuffer("SELECT ");
+ StringBuilder sb = new StringBuilder("SELECT ");
boolean needComma = false;
- Iterator iter = otherFields.keySet().iterator();
+ Iterator<String> iter = otherFields.keySet().iterator();
while (iter.hasNext())
{
- String fieldName = (String)iter.next();
- String columnValue = (String)otherFields.get(fieldName);
+ String fieldName = iter.next();
+ String columnValue = otherFields.get(fieldName);
if (needComma)
sb.append(",");
needComma = true;