[Yanel-commits] rev 20253 - in public/yanel/trunk/src:
contributions/resources/wiki/src/build
contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources
core/java/org/wyona/yanel/cmdl core/java/org/wyona/yanel/core
core/java/org/wyona/yanel/core/map core/java/org/wyona/yanel/servlet
impl/java/org/wyona/yanel/impl/map
josias at wyona.com
josias at wyona.com
Thu Nov 23 14:08:18 CET 2006
Author: josias
Date: 2006-11-23 14:08:16 +0100 (Thu, 23 Nov 2006)
New Revision: 20253
Removed:
public/yanel/trunk/src/core/java/org/wyona/yanel/core/map/MapFactory.java
public/yanel/trunk/src/impl/java/org/wyona/yanel/impl/map/MapFactoryImpl.java
Modified:
public/yanel/trunk/src/contributions/resources/wiki/src/build/dependencies.xml
public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/LinkChecker.java
public/yanel/trunk/src/core/java/org/wyona/yanel/cmdl/YanelCommandLine.java
public/yanel/trunk/src/core/java/org/wyona/yanel/core/Yanel.java
public/yanel/trunk/src/core/java/org/wyona/yanel/servlet/YanelServlet.java
Log:
removed MapFactory and instantiate Map by means of the spring framework. fixes bug #5057. thanks to Paloma for the patch.
Modified: public/yanel/trunk/src/contributions/resources/wiki/src/build/dependencies.xml
===================================================================
--- public/yanel/trunk/src/contributions/resources/wiki/src/build/dependencies.xml 2006-11-23 12:42:08 UTC (rev 20252)
+++ public/yanel/trunk/src/contributions/resources/wiki/src/build/dependencies.xml 2006-11-23 13:08:16 UTC (rev 20253)
@@ -27,6 +27,8 @@
version="0.0.1-dev-r19469"/>
<dependency groupId="yarep" artifactId="yarep"
version="0.0.1-dev-r20207"/>
+ <dependency groupId="spring" artifactId="spring"
+ version="2.0"/>
</artifact:dependencies>
<artifact:dependencies pathId="maven2.resource.classpath" filesetId="maven2.resource.fileset">
Modified: public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/LinkChecker.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/LinkChecker.java 2006-11-23 12:42:08 UTC (rev 20252)
+++ public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/LinkChecker.java 2006-11-23 13:08:16 UTC (rev 20253)
@@ -2,12 +2,12 @@
import java.io.ByteArrayInputStream;
import org.apache.log4j.Category;
+import org.wyona.yanel.core.Yanel;
import org.wyona.yanel.core.Resource;
import org.wyona.yanel.core.ResourceTypeRegistry;
import org.wyona.yanel.core.api.attributes.ViewableV1;
import org.wyona.yanel.core.api.attributes.ViewableV2;
import org.wyona.yanel.core.map.Map;
-import org.wyona.yanel.core.map.MapFactory;
import org.wyona.yanel.core.util.ResourceAttributeHelper;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -81,13 +81,13 @@
}
private boolean resourceExists(String path) {
- Resource resource = null;
- MapFactory mf = MapFactory.newInstance();
- Map map = mf.newMap();
- String rti = map.getResourceTypeIdentifier(new org.wyona.yanel.core.Path(path));
- ResourceTypeRegistry rtr = new ResourceTypeRegistry();
+ Resource resource = null;
String viewId = null;
try {
+ Map map = (Map) Yanel.getInstance().getBeanFactory().getBean("map");
+ String rti = map.getResourceTypeIdentifier(new org.wyona.yanel.core.Path(path));
+
+ ResourceTypeRegistry rtr = new ResourceTypeRegistry();
resource = rtr.newResource(rti);
if(ResourceAttributeHelper.hasAttributeImplemented(resource, "Viewable", "1")) {
Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/cmdl/YanelCommandLine.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/cmdl/YanelCommandLine.java 2006-11-23 12:42:08 UTC (rev 20252)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/cmdl/YanelCommandLine.java 2006-11-23 13:08:16 UTC (rev 20253)
@@ -27,7 +27,6 @@
import org.wyona.yanel.core.api.attributes.ViewableV1;
import org.wyona.yanel.core.attributes.viewable.View;
import org.wyona.yanel.core.map.Map;
-import org.wyona.yanel.core.map.MapFactory;
import org.wyona.yanel.core.map.Realm;
import org.wyona.yanel.util.ResourceAttributeHelper;
@@ -52,8 +51,7 @@
System.out.println("Welcome to the Yanel command line interface!\n");
Yanel yanel = Yanel.getInstance();
- MapFactory mf = MapFactory.newInstance();
- Map map = mf.newMap();
+ Map map = (Map) yanel.getBeanFactory().getBean("map");
ResourceTypeRegistry rtr = new ResourceTypeRegistry();
Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/Yanel.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/Yanel.java 2006-11-23 12:42:08 UTC (rev 20252)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/Yanel.java 2006-11-23 13:08:16 UTC (rev 20253)
@@ -17,7 +17,6 @@
package org.wyona.yanel.core;
import org.wyona.yanel.core.map.Map;
-import org.wyona.yanel.core.map.MapFactory;
import org.wyona.yarep.core.RepositoryFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.ApplicationContext;
@@ -40,14 +39,16 @@
* Private constructor
*/
private Yanel() throws Exception {
- MapFactory mf = MapFactory.newInstance();
- map = mf.newMap();
+
+ applicationContext = new ClassPathXmlApplicationContext(SPRING_CONFIG_FILE);
+ // example:
+ //RepositoryFactory repoFactory = (RepositoryFactory)applicationContext.getBean("repositoryFactory");
+
+ map = (Map) applicationContext.getBean("map");
rtr = new ResourceTypeRegistry();
- applicationContext = new ClassPathXmlApplicationContext(SPRING_CONFIG_FILE);
-
- // example:
- //RepositoryFactory repoFactory = (RepositoryFactory)applicationContext.getBean("repositoryFactory");
+
+
}
public static Yanel getInstance() throws Exception {
Deleted: public/yanel/trunk/src/core/java/org/wyona/yanel/core/map/MapFactory.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/map/MapFactory.java 2006-11-23 12:42:08 UTC (rev 20252)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/map/MapFactory.java 2006-11-23 13:08:16 UTC (rev 20253)
@@ -1,55 +0,0 @@
-/*
- * Copyright 2006 Wyona
- *
- * Licensed 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.wyona.org/licenses/APACHE-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.wyona.yanel.core.map;
-
-/**
- *
- */
-public abstract class MapFactory {
-
- /**
- * Obtain a new instance of a MapFactory.
- * This method uses the following ordered lookup procedure
- * to determine the MapFactory implementation class to load:
- *
- * - Use the org.wyona.yanel.core.maps.MapFactory system property.
- * - Use the properties file "yanel.properties" in the classpath.
- * This configuration file is in standard java.util.Properties format
- * and contains the fully qualified name of the implementation class
- * with the key being the system property defined above.
- * - Use the Services API (as detailed in the JAR specification), if available, to determine the classname.
- * The Services API will look for a classname in the file
- * META-INF/services/org.wyona.yanel.core.maps.MapFactory in jars available to the runtime.
- *
- * Once an application has obtained a reference to a MapFactory it can
- * use the factory to configure and obtain maps instances.
- */
- public static MapFactory newInstance() {
- // TODO: See for implementation http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance()
- try {
- return (MapFactory) Class.forName("org.wyona.yanel.impl.map.MapFactoryImpl").newInstance();
- } catch (Exception e) {
- System.err.println(e);
- }
- return null;
- }
-
- /**
- *
- */
- public abstract Map newMap();
-}
Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/servlet/YanelServlet.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/servlet/YanelServlet.java 2006-11-23 12:42:08 UTC (rev 20252)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/servlet/YanelServlet.java 2006-11-23 13:08:16 UTC (rev 20253)
@@ -26,7 +26,6 @@
import org.wyona.yanel.core.api.attributes.ViewableV2;
import org.wyona.yanel.core.attributes.viewable.View;
import org.wyona.yanel.core.map.Map;
-import org.wyona.yanel.core.map.MapFactory;
import org.wyona.yanel.core.map.Realm;
import org.wyona.yanel.util.ResourceAttributeHelper;
@@ -89,8 +88,8 @@
IdentityManagerFactory imf = IdentityManagerFactory.newInstance();
im = imf.newIdentityManager();
- MapFactory mf = MapFactory.newInstance();
- map = mf.newMap();
+
+ map = (Map) yanel.getBeanFactory().getBean("map");
//sslPort = "8443";
sslPort = config.getInitParameter("ssl-port");
Deleted: public/yanel/trunk/src/impl/java/org/wyona/yanel/impl/map/MapFactoryImpl.java
===================================================================
--- public/yanel/trunk/src/impl/java/org/wyona/yanel/impl/map/MapFactoryImpl.java 2006-11-23 12:42:08 UTC (rev 20252)
+++ public/yanel/trunk/src/impl/java/org/wyona/yanel/impl/map/MapFactoryImpl.java 2006-11-23 13:08:16 UTC (rev 20253)
@@ -1,33 +0,0 @@
-/*
- * Copyright 2006 Wyona
- *
- * Licensed 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.wyona.org/licenses/APACHE-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.wyona.yanel.impl.map;
-
-import org.wyona.yanel.core.map.Map;
-import org.wyona.yanel.core.map.MapFactory;
-
-/**
- *
- */
-public class MapFactoryImpl extends MapFactory {
-
- /**
- *
- */
- public Map newMap() {
- return new MapImpl();
- }
-}
More information about the Yanel-commits
mailing list