You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2009/11/29 19:57:35 UTC
svn commit: r885258 - in /cayenne/main/trunk/framework:
cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/
cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/
cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuratio...
Author: aadamchik
Date: Sun Nov 29 18:57:34 2009
New Revision: 885258
URL: http://svn.apache.org/viewvc?rev=885258&view=rev
Log:
CAY-1319 Switch Cayenne configuration loading to cayenne-di container
* Extending DI container to support provider instance injection - useful for unit tests
* Unit tests
* Making injectable properties protected to allow meaningful subclassing
* XMLDataChannelDescriptorLoader
* XMLDataMapLoader
Added:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataChannelDescriptor.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataChannelDescriptorLoader.java
- copied, changed from r885090, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataChannelLoader.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataMapLoader.java
- copied, changed from r885090, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DomainLoaderAction.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataNodeDescriptor.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/SAXNestedTagHandler.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoader.java
- copied, changed from r885090, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataChannelLoader.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoaderAction.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataMapLoader.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/runtime/
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/runtime/DataDomainProvider.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoaderTest.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/runtime/
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/runtime/DataChannelProviderTest.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/cayenne-testConfig1.xml
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/cayenne-testConfig2.xml
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/cayenne-testConfig3.xml
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigMap2.map.xml
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigMap3_1.map.xml
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigMap3_2.map.xml
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigNode3.driver.xml
Removed:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataChannelLoader.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataChannelProvider.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DomainLoaderAction.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataChannelLoader.java
Modified:
cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/BindingBuilder.java
cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/Injector.java
cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/DefaultBindingBuilder.java
cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/DefaultInjector.java
cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/InjectionStack.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/CayenneModule.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DefaultRuntimeProperties.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/RuntimeProperties.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/resource/ClassLoaderResourceLocator.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/resource/URLResource.java
Modified: cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/BindingBuilder.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/BindingBuilder.java?rev=885258&r1=885257&r2=885258&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/BindingBuilder.java (original)
+++ cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/BindingBuilder.java Sun Nov 29 18:57:34 2009
@@ -33,5 +33,8 @@
BindingBuilder<T> toProvider(Class<? extends Provider<? extends T>> providerType)
throws DIException;
+ BindingBuilder<T> toProviderInstance(Provider<? extends T> provider)
+ throws DIException;
+
void in(Scope scope);
}
Modified: cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/Injector.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/Injector.java?rev=885258&r1=885257&r2=885258&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/Injector.java (original)
+++ cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/Injector.java Sun Nov 29 18:57:34 2009
@@ -40,4 +40,12 @@
<T> Map<String, ?> getMapConfiguration(Class<T> type);
<T> List<?> getListConfiguration(Class<T> type);
+
+ /**
+ * Performs field injection on a given object, ignoring constructor injection. Since
+ * Cayenne DI injector returns fully injected objects, this method is rarely used
+ * directly. One possible use is in unit tests to test a specific object that requires
+ * field injection.
+ */
+ void injectMembers(Object object);
}
Modified: cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/DefaultBindingBuilder.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/DefaultBindingBuilder.java?rev=885258&r1=885257&r2=885258&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/DefaultBindingBuilder.java (original)
+++ cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/DefaultBindingBuilder.java Sun Nov 29 18:57:34 2009
@@ -51,7 +51,9 @@
}
public BindingBuilder<T> toInstance(T instance) throws DIException {
- return bindInScope(new InstanceProvider<T>(instance));
+ Provider<T> provider0 = new InstanceProvider<T>(instance);
+ Provider<T> provider1 = new FieldInjectingProvider<T>(provider0, injector, key);
+ return bindInScope(provider1);
};
public BindingBuilder<T> toProvider(
@@ -70,6 +72,21 @@
return bindInScope(provider3);
}
+ public BindingBuilder<T> toProviderInstance(Provider<? extends T> provider) {
+
+ Provider<Provider<? extends T>> provider0 = new InstanceProvider<Provider<? extends T>>(
+ provider);
+ Provider<Provider<? extends T>> provider1 = new FieldInjectingProvider<Provider<? extends T>>(
+ provider0,
+ injector,
+ key);
+
+ Provider<T> provider2 = new CustomProvidersProvider<T>(provider1);
+ Provider<T> provider3 = new FieldInjectingProvider<T>(provider2, injector, key);
+
+ return bindInScope(provider3);
+ }
+
public void in(Scope scope) {
if (this.scope != scope) {
Modified: cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/DefaultInjector.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/DefaultInjector.java?rev=885258&r1=885257&r2=885258&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/DefaultInjector.java (original)
+++ cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/DefaultInjector.java Sun Nov 29 18:57:34 2009
@@ -82,8 +82,10 @@
if (provider == null) {
throw new DIException(
- "Type '%s' has no bound list configuration in the DI container.",
- type.getName());
+ "Type '%s' has no bound list configuration in the DI container."
+ + " Injection stack: %s",
+ type.getName(),
+ injectionStack);
}
return provider.get();
@@ -99,8 +101,10 @@
if (provider == null) {
throw new DIException(
- "Type '%s' has no bound map configuration in the DI container.",
- type.getName());
+ "Type '%s' has no bound map configuration in the DI container."
+ + " Injection stack: %s",
+ type.getName(),
+ injectionStack);
}
return provider.get();
@@ -122,4 +126,13 @@
return provider;
}
+ public void injectMembers(Object object) {
+ Provider<Object> provider0 = new InstanceProvider<Object>(object);
+ Provider<Object> provider1 = new FieldInjectingProvider<Object>(
+ provider0,
+ this,
+ DIUtil.toKey(object.getClass()));
+ provider1.get();
+ }
+
}
Modified: cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/InjectionStack.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/InjectionStack.java?rev=885258&r1=885257&r2=885258&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/InjectionStack.java (original)
+++ cayenne/main/trunk/framework/cayenne-di-unpublished/src/main/java/org/apache/cayenne/di/spi/InjectionStack.java Sun Nov 29 18:57:34 2009
@@ -70,4 +70,15 @@
throw new IndexOutOfBoundsException("0");
}
}
+
+ @Override
+ public String toString() {
+ List<String> localStack = stack.get();
+ if (localStack != null) {
+ return String.valueOf(localStack);
+ }
+ else {
+ return "[]";
+ }
+ }
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/CayenneModule.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/CayenneModule.java?rev=885258&r1=885257&r2=885258&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/CayenneModule.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/CayenneModule.java Sun Nov 29 18:57:34 2009
@@ -18,11 +18,13 @@
****************************************************************/
package org.apache.cayenne.configuration;
+import org.apache.cayenne.DataChannel;
import org.apache.cayenne.di.Binder;
import org.apache.cayenne.di.Module;
import org.apache.cayenne.di.Scopes;
import org.apache.cayenne.resource.ClassLoaderResourceLocator;
import org.apache.cayenne.resource.ResourceLocator;
+import org.apache.cayenne.runtime.DataDomainProvider;
/**
* A DI module containing all Cayenne runtime configurations. To customize Cayenne runtime
@@ -46,11 +48,21 @@
RuntimeProperties.CAYENNE_RUNTIME_NAME,
runtimeName);
- // configure various services
- binder.bind(DataChannelLoader.class).to(XMLDataChannelLoader.class).in(
- Scopes.SINGLETON);
+ // a service to provide the main stack DataChannel
+ binder.bind(DataChannel.class).toProvider(DataDomainProvider.class);
+
+ // a service to load project XML descriptors
+ binder.bind(DataChannelDescriptorLoader.class).to(
+ XMLDataChannelDescriptorLoader.class).in(Scopes.SINGLETON);
+
+ // a service to load DataMap XML descriptors
+ binder.bind(DataMapLoader.class).to(XMLDataMapLoader.class).in(Scopes.SINGLETON);
+
+ // a locator of resources, such as XML descriptors
binder.bind(ResourceLocator.class).to(ClassLoaderResourceLocator.class).in(
Scopes.SINGLETON);
+
+ // a global properties object
binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class).in(
Scopes.SINGLETON);
}
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataChannelDescriptor.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataChannelDescriptor.java?rev=885258&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataChannelDescriptor.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataChannelDescriptor.java Sun Nov 29 18:57:34 2009
@@ -0,0 +1,84 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ****************************************************************/
+package org.apache.cayenne.configuration;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.resource.Resource;
+
+/**
+ * A descriptor of a DataChannel normally loaded from XML configuration.
+ *
+ * @since 3.1
+ */
+public class DataChannelDescriptor {
+
+ protected String name;
+ protected String version;
+ protected Map<String, String> properties;
+ protected Collection<DataMap> dataMaps;
+ protected Collection<DataNodeDescriptor> dataNodeDescriptors;
+ protected Resource configurationResource;
+
+ public DataChannelDescriptor() {
+ properties = new HashMap<String, String>();
+ dataMaps = new ArrayList<DataMap>(5);
+ dataNodeDescriptors = new ArrayList<DataNodeDescriptor>(3);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ public Collection<DataMap> getDataMaps() {
+ return dataMaps;
+ }
+
+ public Collection<DataNodeDescriptor> getDataNodeDescriptors() {
+ return dataNodeDescriptors;
+ }
+
+ public Resource getConfigurationResource() {
+ return configurationResource;
+ }
+
+ public void setConfigurationResource(Resource descriptorResource) {
+ this.configurationResource = descriptorResource;
+ }
+}
Copied: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataChannelDescriptorLoader.java (from r885090, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataChannelLoader.java)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataChannelDescriptorLoader.java?p2=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataChannelDescriptorLoader.java&p1=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataChannelLoader.java&r1=885090&r2=885258&rev=885258&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataChannelLoader.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataChannelDescriptorLoader.java Sun Nov 29 18:57:34 2009
@@ -19,21 +19,21 @@
package org.apache.cayenne.configuration;
import org.apache.cayenne.CayenneRuntimeException;
-import org.apache.cayenne.DataChannel;
/**
- * An object that can load a named CayenneRuntime from some configuration source.
+ * An object that can load a named {@link DataChannelDescriptor} from some configuration
+ * source.
*
* @since 3.1
*/
-public interface DataChannelLoader {
+public interface DataChannelDescriptorLoader {
/**
- * Loads a DataChannel from some configuration source, usually an XML file found on
- * classpath.
+ * Loads a DataChannelDescriptor from some configuration source, usually an XML file
+ * found on classpath.
*
* @param runtimeName the name of {@link CayenneRuntime} that invoked this method.
- * Often configuration resource names are tied to the runtime name.
+ * Configuration resource names are normally derived from the runtime name.
*/
- DataChannel get(String runtimeName) throws CayenneRuntimeException;
+ DataChannelDescriptor load(String runtimeName) throws CayenneRuntimeException;
}
Copied: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataMapLoader.java (from r885090, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DomainLoaderAction.java)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataMapLoader.java?p2=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataMapLoader.java&p1=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DomainLoaderAction.java&r1=885090&r2=885258&rev=885258&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DomainLoaderAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataMapLoader.java Sun Nov 29 18:57:34 2009
@@ -18,28 +18,18 @@
****************************************************************/
package org.apache.cayenne.configuration;
-import java.io.InputStream;
-
-import org.apache.cayenne.access.DataDomain;
-import org.xml.sax.helpers.DefaultHandler;
+import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.map.DataMap;
/**
+ * A loader of DataMaps, resolved relatively to a given {@link DataChannelDescriptor}.
+ *
* @since 3.1
*/
-class DomainLoaderAction extends DefaultHandler {
-
- DataDomain loadDomain(InputStream in) {
+public interface DataMapLoader {
- // try {
- // XMLReader parser = Util.createXmlReader();
- //
- // parser.setContentHandler(this);
- // parser.setErrorHandler(this);
- // parser.parse(new InputSource(in));
- // }
- // catch (Exception ex) {
- //
- // }
- throw new UnsupportedOperationException("TODO");
- }
+ DataMap load(
+ DataChannelDescriptor parentDataChannelDescriptor,
+ String location,
+ String name) throws CayenneRuntimeException;
}
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataNodeDescriptor.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataNodeDescriptor.java?rev=885258&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataNodeDescriptor.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DataNodeDescriptor.java Sun Nov 29 18:57:34 2009
@@ -0,0 +1,99 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ****************************************************************/
+package org.apache.cayenne.configuration;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.cayenne.access.DataNode;
+import org.apache.cayenne.resource.Resource;
+
+/**
+ * A descriptor of a {@link DataNode}, normally loaded from XML.
+ *
+ * @since 3.1
+ */
+public class DataNodeDescriptor {
+
+ protected String name;
+ protected Collection<String> dataMapNames;
+
+ protected String location;
+ protected String adapterClass;
+ protected String dataSourceFactoryClass;
+ protected String schemaUpdateStrategyClass;
+
+ protected Resource configurationResource;
+
+ public DataNodeDescriptor() {
+ dataMapNames = new ArrayList<String>();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Collection<String> getDataMapNames() {
+ return dataMapNames;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getAdapterClass() {
+ return adapterClass;
+ }
+
+ public void setAdapterClass(String adapter) {
+ this.adapterClass = adapter;
+ }
+
+ public String getDataSourceFactoryClass() {
+ return dataSourceFactoryClass;
+ }
+
+ public void setDataSourceFactoryClass(String dataSourceFactory) {
+ this.dataSourceFactoryClass = dataSourceFactory;
+ }
+
+ public Resource getConfigurationResource() {
+ return configurationResource;
+ }
+
+ public void setConfigurationResource(Resource descriptorResource) {
+ this.configurationResource = descriptorResource;
+ }
+
+ public String getSchemaUpdateStrategyClass() {
+ return schemaUpdateStrategyClass;
+ }
+
+ public void setSchemaUpdateStrategyClass(String schemaUpdateStrategyClass) {
+ this.schemaUpdateStrategyClass = schemaUpdateStrategyClass;
+ }
+}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DefaultRuntimeProperties.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DefaultRuntimeProperties.java?rev=885258&r1=885257&r2=885258&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DefaultRuntimeProperties.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DefaultRuntimeProperties.java Sun Nov 29 18:57:34 2009
@@ -31,7 +31,7 @@
*/
public class DefaultRuntimeProperties implements RuntimeProperties {
- private Map<String, String> properties;
+ protected Map<String, String> properties;
public DefaultRuntimeProperties(@Inject Map<String, String> properties) {
this.properties = properties;
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/RuntimeProperties.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/RuntimeProperties.java?rev=885258&r1=885257&r2=885258&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/RuntimeProperties.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/RuntimeProperties.java Sun Nov 29 18:57:34 2009
@@ -25,6 +25,9 @@
*/
public interface RuntimeProperties {
+ /**
+ * A property defining the name of the current runtime.
+ */
public static final String CAYENNE_RUNTIME_NAME = "cayenne.runtime.name";
/**
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/SAXNestedTagHandler.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/SAXNestedTagHandler.java?rev=885258&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/SAXNestedTagHandler.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/SAXNestedTagHandler.java Sun Nov 29 18:57:34 2009
@@ -0,0 +1,112 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ****************************************************************/
+package org.apache.cayenne.configuration;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * A superclass of nested tag handlers for parsing of XML documents with SAX.
+ *
+ * @since 3.1
+ */
+class SAXNestedTagHandler extends DefaultHandler {
+
+ private final static Locator NOOP_LOCATOR = new Locator() {
+
+ public int getColumnNumber() {
+ return -1;
+ }
+
+ public int getLineNumber() {
+ return -1;
+ }
+
+ public String getPublicId() {
+ return "<unknown>";
+ }
+
+ public String getSystemId() {
+ return "<unknown>";
+ }
+ };
+
+ protected XMLReader parser;
+ protected ContentHandler parentHandler;
+ protected Locator locator;
+
+ SAXNestedTagHandler(XMLReader parser, SAXNestedTagHandler parentHandler) {
+ this.parentHandler = parentHandler;
+ this.parser = parser;
+
+ if (parentHandler != null) {
+ locator = parentHandler.locator;
+ }
+
+ if (locator == null) {
+ locator = NOOP_LOCATOR;
+ }
+ }
+
+ protected ContentHandler createChildTagHandler(
+ String namespaceURI,
+ String localName,
+ String qName,
+ Attributes attributes) {
+
+ // loose handling of unrecognized tags - just ignore them
+ return new SAXNestedTagHandler(parser, this);
+ }
+
+ protected void stop() {
+ // pop self from the handler stack
+ parser.setContentHandler(parentHandler);
+ }
+
+ @Override
+ public final void startElement(
+ String namespaceURI,
+ String localName,
+ String qName,
+ Attributes attributes) throws SAXException {
+
+ // push child handler to the stack...
+ ContentHandler childHandler = createChildTagHandler(
+ namespaceURI,
+ localName,
+ qName,
+ attributes);
+ parser.setContentHandler(childHandler);
+ }
+
+ @Override
+ public void endElement(String namespaceURI, String localName, String qName)
+ throws SAXException {
+ stop();
+ }
+
+ @Override
+ public void setDocumentLocator(Locator locator) {
+ this.locator = locator;
+ }
+}
Copied: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoader.java (from r885090, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataChannelLoader.java)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoader.java?p2=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoader.java&p1=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataChannelLoader.java&r1=885090&r2=885258&rev=885258&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataChannelLoader.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoader.java Sun Nov 29 18:57:34 2009
@@ -18,15 +18,9 @@
****************************************************************/
package org.apache.cayenne.configuration;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
import java.util.Collection;
import org.apache.cayenne.CayenneRuntimeException;
-import org.apache.cayenne.DataChannel;
-import org.apache.cayenne.access.DataDomain;
-import org.apache.cayenne.di.DIException;
import org.apache.cayenne.di.Inject;
import org.apache.cayenne.resource.Resource;
import org.apache.cayenne.resource.ResourceLocator;
@@ -36,12 +30,15 @@
/**
* @since 3.1
*/
-public class XMLDataChannelLoader implements DataChannelLoader {
+public class XMLDataChannelDescriptorLoader implements DataChannelDescriptorLoader {
- private static Log logger = LogFactory.getLog(XMLDataChannelLoader.class);
+ private static Log logger = LogFactory.getLog(XMLDataChannelDescriptorLoader.class);
@Inject
- private ResourceLocator resourceLocator;
+ protected ResourceLocator resourceLocator;
+
+ @Inject
+ protected DataMapLoader dataMapLoader;
protected String getResourceName(String runtimeName) {
if (runtimeName == null) {
@@ -51,7 +48,7 @@
return "cayenne-" + runtimeName + ".xml";
}
- public DataChannel get(String runtimeName) throws CayenneRuntimeException {
+ public DataChannelDescriptor load(String runtimeName) throws CayenneRuntimeException {
logger.debug("starting configuration loading: " + runtimeName);
@@ -66,45 +63,21 @@
}
Resource configurationResource = configurations.iterator().next();
- URL configurationURL = configurationResource.getURL();
// no support for multiple configs yet, but this is not a hard error
if (configurations.size() > 1) {
logger.info("found "
+ configurations.size()
+ " Cayenne configurations, will use the first one: "
- + configurationURL);
+ + configurationResource.getURL());
}
- DataDomain channel;
-
- InputStream in = null;
- try {
- in = configurationURL.openStream();
- channel = new DomainLoaderAction().loadDomain(in);
- }
- catch (Exception e) {
- throw new DIException(
- "Error loading configuration from %s",
- e,
- configurationURL);
- }
- finally {
- try {
- if (in != null) {
- in.close();
- }
- }
- catch (IOException ioex) {
- logger.info("failure closing input stream for "
- + configurationURL
- + ", ignoring", ioex);
- }
- }
+ DataChannelDescriptor descriptor = new XMLDataChannelDescriptorLoaderAction(
+ dataMapLoader).load(configurationResource);
- channel.setName(runtimeName);
+ descriptor.setName(runtimeName);
- logger.debug("finsihed configuration loading: " + runtimeName);
- return channel;
+ logger.debug("finished configuration loading: " + runtimeName);
+ return descriptor;
}
}
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoaderAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoaderAction.java?rev=885258&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoaderAction.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoaderAction.java Sun Nov 29 18:57:34 2009
@@ -0,0 +1,222 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ****************************************************************/
+package org.apache.cayenne.configuration;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.resource.Resource;
+import org.apache.cayenne.util.Util;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
+/**
+ * A helper class to load the main Cayenne project descriptor as well as dependent map and
+ * node descriptors.
+ *
+ * @since 3.1
+ */
+class XMLDataChannelDescriptorLoaderAction {
+
+ private static Log logger = LogFactory
+ .getLog(XMLDataChannelDescriptorLoaderAction.class);
+
+ static final String DOMAIN_TAG = "domain";
+ static final String MAP_TAG = "map";
+ static final String NODE_TAG = "node";
+ static final String PROPERTY_TAG = "property";
+ static final String MAP_REF_TAG = "map-ref";
+
+ private DataMapLoader mapLoader;
+
+ XMLDataChannelDescriptorLoaderAction(DataMapLoader mapLoader) {
+ this.mapLoader = mapLoader;
+ }
+
+ DataChannelDescriptor load(Resource resource) {
+
+ URL configurationURL = resource.getURL();
+
+ DataChannelDescriptor descriptor = new DataChannelDescriptor();
+ descriptor.setConfigurationResource(resource);
+
+ DataChannelHandler rootHandler;
+
+ InputStream in = null;
+
+ try {
+ in = configurationURL.openStream();
+ XMLReader parser = Util.createXmlReader();
+
+ rootHandler = new DataChannelHandler(descriptor, parser);
+ parser.setContentHandler(rootHandler);
+ parser.setErrorHandler(rootHandler);
+ parser.parse(new InputSource(in));
+ }
+ catch (Exception e) {
+ throw new CayenneRuntimeException(
+ "Error loading configuration from %s",
+ e,
+ configurationURL);
+ }
+ finally {
+ try {
+ if (in != null) {
+ in.close();
+ }
+ }
+ catch (IOException ioex) {
+ logger.info("failure closing input stream for "
+ + configurationURL
+ + ", ignoring", ioex);
+ }
+ }
+
+ return descriptor;
+ }
+
+ final class DataChannelHandler extends SAXNestedTagHandler {
+
+ private DataChannelDescriptor descriptor;
+
+ DataChannelHandler(DataChannelDescriptor dataChannelDescriptor, XMLReader parser) {
+ super(parser, null);
+ this.descriptor = dataChannelDescriptor;
+ }
+
+ @Override
+ protected ContentHandler createChildTagHandler(
+ String namespaceURI,
+ String localName,
+ String name,
+ Attributes atts) {
+
+ if (localName.equals(DOMAIN_TAG)) {
+ return new DataChannelChildrenHandler(parser, this);
+ }
+
+ return super.createChildTagHandler(namespaceURI, localName, name, atts);
+ }
+ }
+
+ final class DataChannelChildrenHandler extends SAXNestedTagHandler {
+
+ private DataChannelDescriptor descriptor;
+
+ DataChannelChildrenHandler(XMLReader parser, DataChannelHandler parentHandler) {
+ super(parser, parentHandler);
+ this.descriptor = parentHandler.descriptor;
+ }
+
+ @Override
+ protected ContentHandler createChildTagHandler(
+ String namespaceURI,
+ String localName,
+ String name,
+ Attributes attributes) {
+
+ if (localName.equals(PROPERTY_TAG)) {
+
+ String key = attributes.getValue("", "name");
+ String value = attributes.getValue("", "value");
+ if (key != null && value != null) {
+ descriptor.getProperties().put(key, value);
+ }
+ }
+ else if (localName.equals(MAP_TAG)) {
+
+ String dataMapName = attributes.getValue("", "name");
+ String dataMapLocation = attributes.getValue("", "location");
+
+ DataMap dataMap = mapLoader
+ .load(descriptor, dataMapLocation, dataMapName);
+ descriptor.getDataMaps().add(dataMap);
+ }
+ else if (localName.equals(NODE_TAG)) {
+
+ String nodeName = attributes.getValue("", "name");
+ if (nodeName == null) {
+ throw new CayenneRuntimeException("Error: <node> without 'name'.");
+ }
+
+ DataNodeDescriptor nodeDescriptor = new DataNodeDescriptor();
+ descriptor.getDataNodeDescriptors().add(nodeDescriptor);
+
+ nodeDescriptor.setName(nodeName);
+ nodeDescriptor.setAdapterClass(attributes.getValue("", "adapter"));
+
+ // TODO: andrus, 11.29.2009 : should we rename that to "location"??
+ String location = attributes.getValue("", "datasource");
+ nodeDescriptor.setLocation(location);
+
+ nodeDescriptor.setDataSourceFactoryClass(attributes.getValue(
+ "",
+ "factory"));
+ nodeDescriptor.setSchemaUpdateStrategyClass(attributes.getValue(
+ "",
+ "schema-update-strategy"));
+
+ // this may be bogus for nodes other than driver nodes, but here we can't
+ // tell for sure
+ if (location != null) {
+ nodeDescriptor.setConfigurationResource(descriptor
+ .getConfigurationResource()
+ .getRelativeResource(location));
+ }
+
+ return new DataNodeChildrenHandler(parser, this, nodeDescriptor);
+ }
+
+ return super.createChildTagHandler(namespaceURI, localName, name, attributes);
+ }
+ }
+
+ final class DataNodeChildrenHandler extends SAXNestedTagHandler {
+
+ private DataNodeDescriptor nodeDescriptor;
+
+ DataNodeChildrenHandler(XMLReader parser, SAXNestedTagHandler parentHandler,
+ DataNodeDescriptor nodeDescriptor) {
+ super(parser, parentHandler);
+ this.nodeDescriptor = nodeDescriptor;
+ }
+
+ @Override
+ protected ContentHandler createChildTagHandler(
+ String namespaceURI,
+ String localName,
+ String name,
+ Attributes attributes) {
+
+ if (localName.equals(MAP_REF_TAG)) {
+
+ String mapName = attributes.getValue("", "name");
+ nodeDescriptor.getDataMapNames().add(mapName);
+ }
+ return super.createChildTagHandler(namespaceURI, localName, name, attributes);
+ }
+ }
+}
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataMapLoader.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataMapLoader.java?rev=885258&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataMapLoader.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/XMLDataMapLoader.java Sun Nov 29 18:57:34 2009
@@ -0,0 +1,88 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ****************************************************************/
+package org.apache.cayenne.configuration;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.map.MapLoader;
+import org.apache.cayenne.resource.Resource;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.xml.sax.InputSource;
+
+/**
+ * @since 3.1
+ */
+public class XMLDataMapLoader implements DataMapLoader {
+
+ private static Log logger = LogFactory.getLog(XMLDataMapLoader.class);
+
+ public DataMap load(
+ DataChannelDescriptor parentDataChannelDescriptor,
+ String location,
+ String name) throws CayenneRuntimeException {
+
+ Resource baseResource = parentDataChannelDescriptor.getConfigurationResource();
+ if (baseResource == null) {
+ throw new NullPointerException("Null parentDataChannelDescriptor's resource");
+ }
+
+ Resource dataMapResource = baseResource.getRelativeResource(location);
+
+ // TODO: andrus 11.27.2009 - deprecate MapLoader and implement a loader
+ // here. MapLoader is in the wrong place, exposes ContentHandler methods and
+ // implements if/else contextless matching of tags... should use something like
+ // SAXNestedTagHandler instead.
+ MapLoader mapLoader = new MapLoader();
+ URL url = dataMapResource.getURL();
+
+ InputStream in = null;
+
+ DataMap map;
+
+ try {
+ in = url.openStream();
+
+ map = mapLoader.loadDataMap(new InputSource(in));
+ }
+ catch (Exception e) {
+ throw new CayenneRuntimeException("Error loading configuration from %s", e, url);
+ }
+ finally {
+ try {
+ if (in != null) {
+ in.close();
+ }
+ }
+ catch (IOException ioex) {
+ logger.info(
+ "failure closing input stream for " + url + ", ignoring",
+ ioex);
+ }
+ }
+
+ map.setName(name);
+ map.setLocation(location);
+ return map;
+ }
+}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/resource/ClassLoaderResourceLocator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/resource/ClassLoaderResourceLocator.java?rev=885258&r1=885257&r2=885258&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/resource/ClassLoaderResourceLocator.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/resource/ClassLoaderResourceLocator.java Sun Nov 29 18:57:34 2009
@@ -41,7 +41,6 @@
Enumeration<URL> urls;
try {
urls = getClassLoader().getResources(name);
-
}
catch (IOException e) {
throw new ConfigurationException("Error getting resources for ");
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/resource/URLResource.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/resource/URLResource.java?rev=885258&r1=885257&r2=885258&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/resource/URLResource.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/resource/URLResource.java Sun Nov 29 18:57:34 2009
@@ -24,13 +24,15 @@
import org.apache.cayenne.CayenneRuntimeException;
/**
+ * A {@link Resource} implementation wrapping a resource URL.
+ *
* @since 3.1
*/
-class URLResource implements Resource {
+public class URLResource implements Resource {
private URL url;
- URLResource(URL url) {
+ public URLResource(URL url) {
this.url = url;
}
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/runtime/DataDomainProvider.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/runtime/DataDomainProvider.java?rev=885258&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/runtime/DataDomainProvider.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/runtime/DataDomainProvider.java Sun Nov 29 18:57:34 2009
@@ -0,0 +1,80 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ****************************************************************/
+package org.apache.cayenne.runtime;
+
+import org.apache.cayenne.DataChannel;
+import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
+import org.apache.cayenne.configuration.DataChannelDescriptorLoader;
+import org.apache.cayenne.configuration.DataNodeDescriptor;
+import org.apache.cayenne.configuration.RuntimeProperties;
+import org.apache.cayenne.di.DIException;
+import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.di.Provider;
+import org.apache.cayenne.map.DataMap;
+
+/**
+ * A {@link DataChannel} provider that provides a single instance of DataDomain configured
+ * per configuration supplied via injected {@link DataChannelDescriptorLoader}.
+ *
+ * @since 3.1
+ */
+public class DataDomainProvider implements Provider<DataChannel> {
+
+ @Inject
+ protected DataChannelDescriptorLoader loader;
+
+ @Inject
+ protected RuntimeProperties configurationProperties;
+
+ protected volatile DataChannel dataChannel;
+
+ public DataChannel get() throws DIException {
+
+ if (dataChannel == null) {
+ synchronized (this) {
+ if (dataChannel == null) {
+ createDataChannel();
+ }
+ }
+ }
+
+ return dataChannel;
+ }
+
+ protected void createDataChannel() {
+ String runtimeName = configurationProperties
+ .get(RuntimeProperties.CAYENNE_RUNTIME_NAME);
+ DataChannelDescriptor descriptor = loader.load(runtimeName);
+
+ DataDomain dataChannel = new DataDomain(descriptor.getName());
+
+ dataChannel.initWithProperties(descriptor.getProperties());
+
+ for (DataMap dataMap : descriptor.getDataMaps()) {
+ dataChannel.addMap(dataMap);
+ }
+
+ for (DataNodeDescriptor dataNodeDescriptor : descriptor.getDataNodeDescriptors()) {
+ // TODO: load data nodes
+ }
+
+ this.dataChannel = dataChannel;
+ }
+}
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoaderTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoaderTest.java?rev=885258&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoaderTest.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoaderTest.java Sun Nov 29 18:57:34 2009
@@ -0,0 +1,250 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ****************************************************************/
+package org.apache.cayenne.configuration;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.di.Binder;
+import org.apache.cayenne.di.DIBootstrap;
+import org.apache.cayenne.di.Injector;
+import org.apache.cayenne.di.Module;
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.resource.Resource;
+import org.apache.cayenne.resource.ResourceLocator;
+import org.apache.cayenne.resource.URLResource;
+
+public class XMLDataChannelDescriptorLoaderTest extends TestCase {
+
+ public void testLoadEmpty() {
+
+ // create dependencies
+ final String testConfigName = "testConfig1";
+
+ final ResourceLocator locator = new ResourceLocator() {
+
+ public Collection<Resource> findResources(String name) {
+
+ String baseUrl = getClass().getPackage().getName().replace('.', '/');
+
+ Enumeration<URL> en;
+ try {
+ en = getClass().getClassLoader().getResources(
+ baseUrl + "/cayenne-" + testConfigName + ".xml");
+ }
+ catch (IOException e) {
+ throw new RuntimeException("error finding test resource: ", e);
+ }
+
+ URL url = en.nextElement();
+ return Collections.<Resource> singleton(new URLResource(url));
+ }
+ };
+
+ Module testModule = new Module() {
+
+ public void configure(Binder binder) {
+ binder.bind(ResourceLocator.class).toInstance(locator);
+ binder.bind(DataMapLoader.class).to(XMLDataMapLoader.class);
+ }
+ };
+
+ Injector injector = DIBootstrap.createInjector(testModule);
+
+ // create and initialize loader instance to test
+ XMLDataChannelDescriptorLoader loader = new XMLDataChannelDescriptorLoader();
+ injector.injectMembers(loader);
+
+ DataChannelDescriptor descriptor = loader.load(testConfigName);
+
+ assertNotNull(descriptor);
+ assertEquals(testConfigName, descriptor.getName());
+ }
+
+ public void testLoad_MissingConfig() {
+
+ // create dependencies
+ final ResourceLocator locator = new ResourceLocator() {
+
+ public Collection<Resource> findResources(String name) {
+
+ return Collections.emptyList();
+ }
+ };
+
+ Module testModule = new Module() {
+
+ public void configure(Binder binder) {
+ binder.bind(ResourceLocator.class).toInstance(locator);
+ binder.bind(DataMapLoader.class).to(XMLDataMapLoader.class);
+ }
+ };
+
+ Injector injector = DIBootstrap.createInjector(testModule);
+
+ // create and initialize loader instance to test
+ XMLDataChannelDescriptorLoader loader = new XMLDataChannelDescriptorLoader();
+ injector.injectMembers(loader);
+
+ try {
+ loader.load("testConfig1_missing");
+ fail("No exception was thrown on bad absent config name");
+ }
+ catch (CayenneRuntimeException e) {
+ // expected
+ }
+ }
+
+ public void testLoadDataMap() {
+
+ // create dependencies
+ final String testConfigName = "testConfig2";
+
+ final ResourceLocator locator = new ResourceLocator() {
+
+ public Collection<Resource> findResources(String name) {
+
+ String baseUrl = getClass().getPackage().getName().replace('.', '/');
+
+ Enumeration<URL> en;
+ try {
+ en = getClass().getClassLoader().getResources(
+ baseUrl + "/cayenne-" + testConfigName + ".xml");
+ }
+ catch (IOException e) {
+ throw new RuntimeException("error finding test resource: ", e);
+ }
+
+ URL url = en.nextElement();
+ return Collections.<Resource> singleton(new URLResource(url));
+ }
+ };
+
+ Module testModule = new Module() {
+
+ public void configure(Binder binder) {
+ binder.bind(ResourceLocator.class).toInstance(locator);
+ binder.bind(DataMapLoader.class).to(XMLDataMapLoader.class);
+ }
+ };
+
+ Injector injector = DIBootstrap.createInjector(testModule);
+
+ // create and initialize loader instance to test
+ XMLDataChannelDescriptorLoader loader = new XMLDataChannelDescriptorLoader();
+ injector.injectMembers(loader);
+
+ DataChannelDescriptor descriptor = loader.load(testConfigName);
+
+ assertNotNull(descriptor);
+
+ assertEquals(testConfigName, descriptor.getName());
+
+ Collection<DataMap> maps = descriptor.getDataMaps();
+ assertEquals(1, maps.size());
+ assertEquals("testConfigMap2", maps.iterator().next().getName());
+ }
+
+ public void testLoadDataEverything() {
+
+ // create dependencies
+ final String testConfigName = "testConfig3";
+
+ final ResourceLocator locator = new ResourceLocator() {
+
+ public Collection<Resource> findResources(String name) {
+
+ String baseUrl = getClass().getPackage().getName().replace('.', '/');
+
+ Enumeration<URL> en;
+ try {
+ en = getClass().getClassLoader().getResources(
+ baseUrl + "/cayenne-" + testConfigName + ".xml");
+ }
+ catch (IOException e) {
+ throw new RuntimeException("error finding test resource: ", e);
+ }
+
+ URL url = en.nextElement();
+ return Collections.<Resource> singleton(new URLResource(url));
+ }
+ };
+
+ Module testModule = new Module() {
+
+ public void configure(Binder binder) {
+ binder.bind(ResourceLocator.class).toInstance(locator);
+ binder.bind(DataMapLoader.class).to(XMLDataMapLoader.class);
+ }
+ };
+
+ Injector injector = DIBootstrap.createInjector(testModule);
+
+ // create and initialize loader instance to test
+ XMLDataChannelDescriptorLoader loader = new XMLDataChannelDescriptorLoader();
+ injector.injectMembers(loader);
+
+ DataChannelDescriptor descriptor = loader.load(testConfigName);
+
+ assertNotNull(descriptor);
+
+ assertEquals(testConfigName, descriptor.getName());
+
+ Collection<DataMap> maps = descriptor.getDataMaps();
+ assertEquals(2, maps.size());
+
+ Iterator<DataMap> mapsIt = maps.iterator();
+
+ DataMap map1 = mapsIt.next();
+ DataMap map2 = mapsIt.next();
+
+ assertEquals("testConfigMap3_1", map1.getName());
+ assertEquals("testConfigMap3_2", map2.getName());
+
+ Collection<DataNodeDescriptor> nodes = descriptor.getDataNodeDescriptors();
+ assertEquals(1, nodes.size());
+
+ DataNodeDescriptor node1 = nodes.iterator().next();
+ assertEquals("testConfigNode3", node1.getName());
+ assertEquals("testConfigNode3.driver.xml", node1.getLocation());
+ assertNotNull(node1.getConfigurationResource());
+ assertEquals(descriptor.getConfigurationResource().getRelativeResource(
+ "testConfigNode3.driver.xml").getURL(), node1
+ .getConfigurationResource()
+ .getURL());
+
+ assertEquals("org.example.test.Adapter", node1.getAdapterClass());
+ assertEquals("org.example.test.DataSourceFactory", node1
+ .getDataSourceFactoryClass());
+ assertEquals("org.example.test.SchemaUpdateStartegy", node1
+ .getSchemaUpdateStrategyClass());
+ assertNotNull(node1.getDataMapNames());
+
+ assertEquals(1, node1.getDataMapNames().size());
+
+ assertEquals("testConfigMap3_2", node1.getDataMapNames().iterator().next());
+ }
+}
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/runtime/DataChannelProviderTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/runtime/DataChannelProviderTest.java?rev=885258&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/runtime/DataChannelProviderTest.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/runtime/DataChannelProviderTest.java Sun Nov 29 18:57:34 2009
@@ -0,0 +1,78 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ****************************************************************/
+package org.apache.cayenne.runtime;
+
+import java.util.Collections;
+
+import junit.framework.TestCase;
+
+import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.DataChannel;
+import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
+import org.apache.cayenne.configuration.DataChannelDescriptorLoader;
+import org.apache.cayenne.configuration.DefaultRuntimeProperties;
+import org.apache.cayenne.configuration.RuntimeProperties;
+import org.apache.cayenne.di.Binder;
+import org.apache.cayenne.di.DIBootstrap;
+import org.apache.cayenne.di.Injector;
+import org.apache.cayenne.di.Module;
+
+public class DataChannelProviderTest extends TestCase {
+
+ public void testGet() {
+
+ // create dependencies
+ final String testConfigName = "testConfig";
+ final DataChannelDescriptor testDescriptor = new DataChannelDescriptor();
+
+ final DataChannelDescriptorLoader testLoader = new DataChannelDescriptorLoader() {
+
+ public DataChannelDescriptor load(String runtimeName)
+ throws CayenneRuntimeException {
+ assertEquals(testConfigName, runtimeName);
+ return testDescriptor;
+ }
+ };
+
+ final DefaultRuntimeProperties testProperties = new DefaultRuntimeProperties(
+ Collections.singletonMap(
+ RuntimeProperties.CAYENNE_RUNTIME_NAME,
+ testConfigName));
+
+ Module testModule = new Module() {
+
+ public void configure(Binder binder) {
+ binder.bind(RuntimeProperties.class).toInstance(testProperties);
+ binder.bind(DataChannelDescriptorLoader.class).toInstance(testLoader);
+ }
+ };
+
+ Injector injector = DIBootstrap.createInjector(testModule);
+
+ // create and initialize provide instance to test
+ DataDomainProvider provider = new DataDomainProvider();
+ injector.injectMembers(provider);
+
+ DataChannel channel = provider.get();
+ assertNotNull(channel);
+
+ assertTrue(channel instanceof DataDomain);
+ }
+}
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/cayenne-testConfig1.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/cayenne-testConfig1.xml?rev=885258&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/cayenne-testConfig1.xml (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/cayenne-testConfig1.xml Sun Nov 29 18:57:34 2009
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<domain project-version="6">
+
+</domain>
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/cayenne-testConfig2.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/cayenne-testConfig2.xml?rev=885258&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/cayenne-testConfig2.xml (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/cayenne-testConfig2.xml Sun Nov 29 18:57:34 2009
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<domain project-version="6">
+ <map name="testConfigMap2" location="testConfigMap2.map.xml"/>
+</domain>
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/cayenne-testConfig3.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/cayenne-testConfig3.xml?rev=885258&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/cayenne-testConfig3.xml (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/cayenne-testConfig3.xml Sun Nov 29 18:57:34 2009
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<domain project-version="6">
+ <map name="testConfigMap3_1" location="testConfigMap3_1.map.xml" />
+ <map name="testConfigMap3_2" location="testConfigMap3_2.map.xml" />
+
+ <node name="testConfigNode3" datasource="testConfigNode3.driver.xml"
+ adapter="org.example.test.Adapter" factory="org.example.test.DataSourceFactory"
+ schema-update-strategy="org.example.test.SchemaUpdateStartegy">
+ <map-ref name="testConfigMap3_2" />
+ </node>
+</domain>
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigMap2.map.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigMap2.map.xml?rev=885258&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigMap2.map.xml (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigMap2.map.xml Sun Nov 29 18:57:34 2009
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<data-map xmlns="http://cayenne.apache.org/schema/3.0/modelMap"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://cayenne.apache.org/schema/3.0/modelMap http://cayenne.apache.org/schema/3.0/modelMap.xsd"
+ project-version="6">
+
+</data-map>
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigMap3_1.map.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigMap3_1.map.xml?rev=885258&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigMap3_1.map.xml (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigMap3_1.map.xml Sun Nov 29 18:57:34 2009
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<data-map xmlns="http://cayenne.apache.org/schema/3.0/modelMap"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://cayenne.apache.org/schema/3.0/modelMap http://cayenne.apache.org/schema/3.0/modelMap.xsd"
+ project-version="6">
+
+</data-map>
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigMap3_2.map.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigMap3_2.map.xml?rev=885258&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigMap3_2.map.xml (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigMap3_2.map.xml Sun Nov 29 18:57:34 2009
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<data-map xmlns="http://cayenne.apache.org/schema/3.0/modelMap"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://cayenne.apache.org/schema/3.0/modelMap http://cayenne.apache.org/schema/3.0/modelMap.xsd"
+ project-version="6">
+
+</data-map>
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigNode3.driver.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigNode3.driver.xml?rev=885258&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigNode3.driver.xml (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/org/apache/cayenne/configuration/testConfigNode3.driver.xml Sun Nov 29 18:57:34 2009
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<driver project-version="6">
+ <connectionPool min="1" max="1"/>
+ <login/>
+</driver>