Added a workaround for Spring 2.0-rc1 for AMQ-825 where we avoid using File objects on the default persistence adapter and use Strings instead. Its unfortunate (I tried patching xbean-spring to get around this but I'm afraid it doesn't seem possible). So folks using Java to configure the dataDirectory will need to change foo.setDataDirectory(file) to foo.setDataDirectoryFile(file) or switch to using a String

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@421936 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2006-07-14 16:25:29 +00:00
parent 3fcd7ca39c
commit fd3c5104df
5 changed files with 20 additions and 11 deletions

View File

@ -988,7 +988,7 @@ public class BrokerService implements Service, Serializable {
protected DefaultPersistenceAdapterFactory createPersistenceFactory() {
DefaultPersistenceAdapterFactory factory = new DefaultPersistenceAdapterFactory();
factory.setDataDirectory(getDataDirectory());
factory.setDataDirectoryFile(getDataDirectory());
factory.setTaskRunnerFactory(getTaskRunnerFactory());
return factory;
}

View File

@ -125,7 +125,7 @@ public class DefaultPersistenceAdapterFactory extends DataSourceSupport implemen
public File getJournalArchiveDirectory() {
if( journalArchiveDirectory == null && useQuickJournal ) {
journalArchiveDirectory = new File(getDataDirectory(), "journal");
journalArchiveDirectory = new File(getDataDirectoryFile(), "journal");
}
return journalArchiveDirectory;
}
@ -162,7 +162,7 @@ public class DefaultPersistenceAdapterFactory extends DataSourceSupport implemen
* @throws IOException
*/
protected void createJournal() throws IOException {
File journalDir = new File(getDataDirectory(), "journal").getCanonicalFile();
File journalDir = new File(getDataDirectoryFile(), "journal").getCanonicalFile();
if( failIfJournalIsLocked ) {
journal = new JournalImpl(journalDir, journalLogFiles, journalLogFileSize, getJournalArchiveDirectory());
} else {

View File

@ -31,7 +31,8 @@ import java.io.IOException;
*/
public class DataSourceSupport {
private File dataDirectory;
private String dataDirectory = "activemq-data";
private File dataDirectoryFile;
private DataSource dataSource;
public DataSourceSupport() {
@ -41,14 +42,22 @@ public class DataSourceSupport {
this.dataSource = dataSource;
}
public File getDataDirectory() {
if (dataDirectory == null) {
dataDirectory = new File("activemq-data");
public File getDataDirectoryFile() {
if (dataDirectoryFile == null) {
dataDirectoryFile = new File(getDataDirectory());
}
return dataDirectoryFile;
}
public void setDataDirectoryFile(File dataDirectory) {
this.dataDirectoryFile = dataDirectory;
}
public String getDataDirectory() {
return dataDirectory;
}
public void setDataDirectory(File dataDirectory) {
public void setDataDirectory(String dataDirectory) {
this.dataDirectory = dataDirectory;
}
@ -69,7 +78,7 @@ public class DataSourceSupport {
protected DataSource createDataSource() throws IOException {
// Setup the Derby datasource.
System.setProperty("derby.system.home", getDataDirectory().getCanonicalPath());
System.setProperty("derby.system.home", getDataDirectoryFile().getCanonicalPath());
System.setProperty("derby.storage.fileSyncTransactionLog", "true");
System.setProperty("derby.storage.pageCacheSize", "100");

View File

@ -30,7 +30,7 @@ public class JDBCDurableSubscriptionTest extends DurableSubscriptionTestSupport
protected PersistenceAdapter createPersistenceAdapter() throws IOException {
File dataDir = new File("target/test-data/durableJDBC");
DefaultPersistenceAdapterFactory factory = new DefaultPersistenceAdapterFactory();
factory.setDataDirectory(dataDir);
factory.setDataDirectoryFile(dataDir);
factory.setUseJournal(false);
return factory.createPersistenceAdapter();
}

View File

@ -30,7 +30,7 @@ public class JournalDurableSubscriptionTest extends DurableSubscriptionTestSuppo
protected PersistenceAdapter createPersistenceAdapter() throws IOException {
File dataDir = new File("target/test-data/durableJournal");
DefaultPersistenceAdapterFactory factory = new DefaultPersistenceAdapterFactory();
factory.setDataDirectory(dataDir);
factory.setDataDirectoryFile(dataDir);
factory.setUseJournal(true);
factory.setJournalLogFileSize(1024*64);
return factory.createPersistenceAdapter();