incubator-depot-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject svn commit: rev 10585 - in incubator/depot/trunk/update: . src/java src/java/org/apache/depot/update/ant src/java/org/apache/depot/update/ant/task src/java/org/apache/depot/update/protocols src/java/org/apache/depot/update/protocols/impl
Date Mon, 10 May 2004 22:21:51 GMT
Author: ajack
Date: Mon May 10 15:21:50 2004
New Revision: 10585

Added:
   incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/task/EnvironmentToolTask.java
Modified:
   incubator/depot/trunk/update/build-ant-sample.xml
   incubator/depot/trunk/update/src/java/depot-update-antlib.xml
   incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/ResourceElement.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/task/RepositoryToolTask.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/protocols/DefaultProtocolOperationsManager.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/protocols/impl/HttpClientProtocolOperationsProvider.java
Log:
Try to debug why VFS isn't being used on Gump.


Modified: incubator/depot/trunk/update/build-ant-sample.xml
==============================================================================
--- incubator/depot/trunk/update/build-ant-sample.xml	(original)
+++ incubator/depot/trunk/update/build-ant-sample.xml	Mon May 10 15:21:50 2004
@@ -35,11 +35,17 @@
 	</target>
 	
 	<!-- Display the contents of a repository -->
-	<target name="repo" description="Display Contents of a Repostiory">
-		<taskdef resource="depot-update-antlib.xml" />		
+	<taskdef resource="depot-update-antlib.xml" />		
+	
+	<target name="repo-env" description="Display Environment (for Repo Tools)">
+		<repoenv />
+	</target>
+	
+	<target name="repo" description="Display Contents of a Repostiory"
+			depends="repo-env">
 		<repotool />
 	</target>
 
-	<target name="gump" depends="version-optional, repo" />
+	<target name="gump" depends="version-optional, repo-env, repo" />
 	
 </project>

Modified: incubator/depot/trunk/update/src/java/depot-update-antlib.xml
==============================================================================
--- incubator/depot/trunk/update/src/java/depot-update-antlib.xml	(original)
+++ incubator/depot/trunk/update/src/java/depot-update-antlib.xml	Mon May 10 15:21:50 2004
@@ -20,6 +20,8 @@
     <typedef name="resource" classname="org.apache.depot.update.ant.ResourceElement"/>
     <typedef name="repository" classname="org.apache.depot.update.ant.RepositoryElement"/>
     
+    <taskdef name="repoenv" classname="org.apache.depot.update.ant.task.EnvironmentToolTask"/>
     <taskdef name="repotool" classname="org.apache.depot.update.ant.task.RepositoryToolTask"/>
+    
     <taskdef name="reposync" classname="org.apache.depot.update.ant.task.SynchronizeTask"/>
 </antlib>

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/ResourceElement.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/ResourceElement.java
(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/ResourceElement.java
Mon May 10 15:21:50 2004
@@ -238,6 +238,7 @@
 		}
 		return resource;
 	}
+	
 	ResourceResult query(IRepository repo) { //TODO
 		// experiment
 		getProject().log("Looking for " + this, Project.MSG_DEBUG);

Added: incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/task/EnvironmentToolTask.java
==============================================================================
--- (empty file)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/task/EnvironmentToolTask.java
Mon May 10 15:21:50 2004
@@ -0,0 +1,69 @@
+/*
+ * Copyright  2004 The Apache Software Foundation
+ *
+ *  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.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.depot.update.ant.task;
+
+import org.apache.depot.common.log.LogConstants;
+import org.apache.depot.common.log.Logger;
+import org.apache.depot.common.util.envsafe.ClassLoaderContext;
+import org.apache.depot.update.protocols.DefaultProtocolOperationsManager;
+import org.apache.depot.version.ant.util.AntLogListener;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+
+/**
+ * @author ajack
+ */
+public class EnvironmentToolTask extends Task {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.tools.ant.Task#execute()
+	 */
+	public void execute() throws BuildException {
+
+		log("Execute RepositoryTool...", Project.MSG_DEBUG);
+
+		// Set logging context, to only errors...
+		Logger logger = Logger.pushContext(new AntLogListener(this));
+	
+		try {			
+			ClassLoaderContext context = new ClassLoaderContext(this);
+
+			// See which (if any) of these are loadable.
+			// Would have to imagine  one (plain JDK) is.	
+			testLoad(context, DefaultProtocolOperationsManager.URL_PROVIDER);
+			testLoad(context, DefaultProtocolOperationsManager.HTTP_CLIENT_PROVIDER);	
+			testLoad(context, DefaultProtocolOperationsManager.VFS_PROVIDER);	
+		}
+		finally {
+			Logger.popContext(logger);
+		}
+	}
+	
+	private void testLoad(ClassLoaderContext context, String clazzName) {
+		try{
+			Object o = context.attemptLoad(clazzName, "test");			
+			Logger.getLogger().info("Loaded [" + clazzName + "] as [" + o + "]");
+		}
+		catch (Throwable t)
+		{
+			Logger.getLogger().info("Failed to load [" + clazzName + "] : ", t);
+		}
+	}
+}

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/task/RepositoryToolTask.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/task/RepositoryToolTask.java
(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/task/RepositoryToolTask.java
Mon May 10 15:21:50 2004
@@ -19,6 +19,7 @@
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.depot.common.log.LogConstants;
 import org.apache.depot.common.log.Logger;
 import org.apache.depot.update.UpdateException;
 import org.apache.depot.update.config.UpdateConfig;
@@ -69,8 +70,9 @@
 
 		log("Execute RepositoryTool...", Project.MSG_DEBUG);
 
-		// Set logging context..
-		Logger logger = Logger.pushContext(new AntLogListener(this));
+		// Set logging context, to only errors...
+		Logger logger = Logger.pushContext(LogConstants.ERROR,
+				new AntLogListener(this));
 
 		UpdateConfig.configure();
 
@@ -103,15 +105,23 @@
 						for (Iterator gi = groups.iterator(); gi.hasNext();) {
 							ResourceGroup group = (ResourceGroup) gi.next();
 
-							log(" - Group: " + group);
+							try {
 
-							List specifiers = repo.listSpecifiers(group,
-									AllSelector.getInstance());
+								List specifiers = repo.listSpecifiers(group,
+										AllSelector.getInstance());
 
-							for (Iterator si = specifiers.iterator(); si.hasNext();) {
-								ResourceSpecifier specifier = (ResourceSpecifier) si.next();
+								log(" - Group: " + group + " (Specifiers : "
+										+ specifiers.size() + ")");
 
-								log("  - " + specifier, Project.MSG_VERBOSE);
+								for (Iterator si = specifiers.iterator(); si.hasNext();) {
+									ResourceSpecifier specifier = (ResourceSpecifier) si.next();
+
+									log("  - " + specifier, Project.MSG_VERBOSE);
+								}
+							} catch (UpdateException re) {
+								Logger.getLogger().error(
+										" - Failed to list specifiers in group: "
+												+ group, re);
 							}
 						}
 					} catch (UpdateException re) {
@@ -138,8 +148,8 @@
 				}
 			}
 
-			log(" Artefact Statistics : Parsed=" + statistics.getParsed() + " Failed="
-					+ statistics.getFailed() + " Ignored="
+			log(" Artefact Statistics : Parsed=" + statistics.getParsed()
+					+ " Failed=" + statistics.getFailed() + " Ignored="
 					+ statistics.getIgnored());
 
 			List ignored = statistics.getIgnoredObjects();

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/protocols/DefaultProtocolOperationsManager.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/protocols/DefaultProtocolOperationsManager.java
(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/protocols/DefaultProtocolOperationsManager.java
Mon May 10 15:21:50 2004
@@ -27,9 +27,9 @@
  */
 public class DefaultProtocolOperationsManager extends ProtocolOperationsManager {
 
-	private static final String VFS_PROVIDER = "org.apache.depot.update.protocols.impl.VfsProtocolOperationsProvider";
-	private static final String HTTP_CLIENT_PROVIDER = "org.apache.depot.update.protocols.impl.HttpClientProtocolOperationsProvider";
-	private static final String URL_PROVIDER = "org.apache.depot.update.protocols.impl.BasicProtocolOperationsProvider";
+	public static final String VFS_PROVIDER = "org.apache.depot.update.protocols.impl.VfsProtocolOperationsProvider";
+	public static final String HTTP_CLIENT_PROVIDER = "org.apache.depot.update.protocols.impl.HttpClientProtocolOperationsProvider";
+	public static final String URL_PROVIDER = "org.apache.depot.update.protocols.impl.BasicProtocolOperationsProvider";
 
 	/**
 	 * @param context

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/protocols/impl/HttpClientProtocolOperationsProvider.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/protocols/impl/HttpClientProtocolOperationsProvider.java
(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/protocols/impl/HttpClientProtocolOperationsProvider.java
Mon May 10 15:21:50 2004
@@ -20,6 +20,7 @@
 import java.io.FileOutputStream;
 import java.util.List;
 
+import org.apache.commons.codec.Encoder;
 import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.logging.LogFactory;
 import org.apache.depot.common.util.io.IOUtils;
@@ -47,6 +48,7 @@
 		Class causeAFailedLoadAtConstructionIfGoingToHappen = HttpClientUserAgent.class;
 		Class causeAFailedLoadAtConstructionIfGoingToHappen2 = LogFactory.class;
 		Class causeAFailedLoadAtConstructionIfGoingToHappen3 = HttpMethod.class;
+		Class causeAFailedLoadAtConstructionIfGoingToHappen4 = Encoder.class;
 		}
 
 	public void init(ResourceUpdaterContext context) throws Exception {

Mime
View raw message