Activity Service

- add PostgreSQL support
- add generic schema generation, plus extras (indexes, sequences, workaround for Derby)
- fix feed cleaner keepDate, also increase default from 14 to 31 days
- fix Oracle-specifc issue (when retrieving site feed)
- reformatting sqlMap config files
- improve exception handling
Add Derby warning message

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9649 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2008-07-04 13:12:31 +00:00
parent 87096f0b2a
commit cc051d8274
28 changed files with 653 additions and 485 deletions

View File

@@ -262,12 +262,16 @@ public class ActivityServiceImpl implements ActivityService
}
catch (SQLException e)
{
throw new AlfrescoRuntimeException("Failed to post activity: " + e, e);
throw new AlfrescoRuntimeException("Failed to post activity: " + e, e);
}
catch (Throwable t)
{
throw new AlfrescoRuntimeException("Failed to post activity: " + t, t);
}
}
catch (AlfrescoRuntimeException e)
{
// log error, subsume exception
// log error, subsume exception (for post activity)
logger.error(e);
}
}
@@ -313,13 +317,17 @@ public class ActivityServiceImpl implements ActivityService
}
catch (SQLException se)
{
throw new AlfrescoRuntimeException("Unable to get user feed entries: " + se.getMessage());
AlfrescoRuntimeException are = new AlfrescoRuntimeException("Unable to get user feed entries: " + se.getMessage());
logger.error(are);
throw are;
}
catch (JSONException je)
{
throw new AlfrescoRuntimeException("Unable to get user feed entries: " + je.getMessage());
AlfrescoRuntimeException are = new AlfrescoRuntimeException("Unable to get user feed entries: " + je.getMessage());
logger.error(are);
throw are;
}
return activityFeedEntries;
}
@@ -350,11 +358,15 @@ public class ActivityServiceImpl implements ActivityService
}
catch (SQLException se)
{
throw new AlfrescoRuntimeException("Unable to get site feed entries: " + se.getMessage());
AlfrescoRuntimeException are = new AlfrescoRuntimeException("Unable to get site feed entries: " + se.getMessage());
logger.error(are);
throw are;
}
catch (JSONException je)
{
throw new AlfrescoRuntimeException("Unable to get site feed entries: " + je.getMessage());
AlfrescoRuntimeException are = new AlfrescoRuntimeException("Unable to get site feed entries: " + je.getMessage());
logger.error(are);
throw are;
}
return activityFeedEntries;
@@ -382,7 +394,9 @@ public class ActivityServiceImpl implements ActivityService
}
catch (SQLException e)
{
throw new AlfrescoRuntimeException("Failed to set feed control: " + e, e);
AlfrescoRuntimeException are = new AlfrescoRuntimeException("Failed to set feed control: " + e, e);
logger.error(are);
throw are;
}
}
@@ -433,7 +447,9 @@ public class ActivityServiceImpl implements ActivityService
}
catch (SQLException e)
{
throw new AlfrescoRuntimeException("Failed to get feed controls: " + e, e);
AlfrescoRuntimeException are = new AlfrescoRuntimeException("Failed to get feed controls: " + e, e);
logger.error(are);
throw are;
}
}
@@ -456,7 +472,9 @@ public class ActivityServiceImpl implements ActivityService
}
catch (SQLException e)
{
throw new AlfrescoRuntimeException("Failed to unset feed control: " + e, e);
AlfrescoRuntimeException are = new AlfrescoRuntimeException("Failed to unset feed control: " + e, e);
logger.error(are);
throw are;
}
}
@@ -481,7 +499,9 @@ public class ActivityServiceImpl implements ActivityService
}
catch (SQLException e)
{
throw new AlfrescoRuntimeException("Failed to query feed control: " + e, e);
AlfrescoRuntimeException are = new AlfrescoRuntimeException("Failed to query feed control: " + e, e);
logger.error(are);
throw are;
}
}
}

View File

@@ -78,7 +78,7 @@ public class FeedCleaner
try
{
long nowTimeOffset = new Date().getTime();
long keepTimeOffset = nowTimeOffset - (maxAgeMins*60*1000); // millsecs = mins * 60 secs * 1000 msecs
long keepTimeOffset = nowTimeOffset - ((long)maxAgeMins*60000L); // millsecs = mins * 60 secs * 1000 msecs
Date keepDate = new Date(keepTimeOffset);
// clean old entries

View File

@@ -64,6 +64,7 @@ import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.connection.UserSuppliedConnectionProvider;
import org.hibernate.dialect.DB2Dialect;
import org.hibernate.dialect.DerbyDialect;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.HSQLDialect;
import org.hibernate.dialect.MySQL5Dialect;
@@ -102,6 +103,7 @@ public class SchemaBootstrap extends AbstractLifecycleBean
private static final String MSG_OPTIONAL_STATEMENT_FAILED = "schema.update.msg.optional_statement_failed";
private static final String WARN_DIALECT_UNSUPPORTED = "schema.update.warn.dialect_unsupported";
private static final String WARN_DIALECT_HSQL = "schema.update.warn.dialect_hsql";
private static final String WARN_DIALECT_DERBY = "schema.update.warn.dialect_derby";
private static final String ERR_MULTIPLE_SCHEMAS = "schema.update.err.found_multiple";
private static final String ERR_PREVIOUS_FAILED_BOOTSTRAP = "schema.update.err.previous_failed";
private static final String ERR_STATEMENT_FAILED = "schema.update.err.statement_failed";
@@ -905,6 +907,10 @@ public class SchemaBootstrap extends AbstractLifecycleBean
{
LogUtil.info(logger, WARN_DIALECT_HSQL);
}
if (dialectClazz.equals(DerbyDialect.class))
{
LogUtil.info(logger, WARN_DIALECT_DERBY);
}
int maxStringLength = SchemaBootstrap.DEFAULT_MAX_STRING_LENGTH;
// Adjust the maximum allowable String length according to the dialect