* EOAccess/EOModel.m

separate out the connection dictionary in a separate
          file, bump file version
	patch form Graham Lee, see patch 8087 on savannah


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@36746 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
buzzdee 2013-06-23 07:19:31 +00:00
parent 8af32fca81
commit 55aca26e97
3 changed files with 38 additions and 6 deletions

View file

@ -22,6 +22,13 @@ Debian Etch/x86
Debian Lenny/x86
CentOS 5.2/x68_64
Changes in version 0.13.0
=========================
This release contains the following changes:
- on new saved eomodels the connection dictionary is now
separated out from the index.eomodeld into the
connectionSettings.plist file
Changes in version 0.12.0
=========================
This release contains the following changes:

View file

@ -2,6 +2,9 @@
* Apps/EOModelEditor/EOMEDocument.m
fix saving of new created models and make the Inspector
work on OSX
* EOAccess/EOModel.m
separate out the connection dictionary in a separate
file, bump file version
2013-06-22: Graham Lee <iamleeg@gmail.com>
* EOModeler/EOModelExtensions.m

View file

@ -78,7 +78,7 @@ RCS_ID("$Id$")
#include "EOPrivate.h"
#include "EOAttributePriv.h"
#define DEFAULT_MODEL_VERSION 2
#define DEFAULT_MODEL_VERSION 3
NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
@ -521,7 +521,21 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
propList = [fileContents propertyList];
EOFLOGObjectLevelArgs(@"gsdb", @"propList=%@", propList);
NSAssert1(propList!=nil, @"Model at path %@ is invalid", indexPath);
if([[indexPath pathExtension] isEqualToString: @"eomodeld"])
{
NSString *connectionPath = [modelPath stringByAppendingPathComponent: @"connectionSettings.plist"];
NSString *externalConnectionSettings = [NSString stringWithContentsOfFile: connectionPath];
if (externalConnectionSettings!=nil)
{
id connectionProperties = [externalConnectionSettings propertyList];
//copy the original settings and merge the connection settings in
NSMutableDictionary *mutableProperties = [propList mutableCopy];
[mutableProperties setObject: connectionProperties
forKey: @"connectionDictionary"];
propList = mutableProperties;
[mutableProperties autorelease];
}
}
self = [self initWithTableOfContentsPropertyList: propList
path: modelPath];
NSAssert2(self!=nil,@"Failed to initialize with path %@ and plist %@",
@ -754,6 +768,18 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
[NSException raise: NSInvalidArgumentException
format: fmt];
}
if (writeSingleFile == NO)
{
NSString *connectionSettingsPath = [path stringByAppendingPathComponent: @"connectionSettings.plist"];
if ([self _writePlist: [self connectionDictionary] toFile: connectionSettingsPath] == NO)
{
NSString *fmt;
fmt = [NSString stringWithFormat: @"Could not create file: %@",
fileName];
[NSException raise: NSInvalidArgumentException
format: fmt];
}
}
}
@end
@ -893,10 +919,6 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
[propertyList setObject: _adaptorName
forKey: @"adaptorName"];
if (_connectionDictionary)
[propertyList setObject: _connectionDictionary
forKey: @"connectionDictionary"];
if (_userInfo)
[propertyList setObject: _userInfo
forKey: @"userInfo"];