You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2009/12/07 20:12:05 UTC
svn commit: r888091 - in /incubator/shindig/trunk/java/gadgets/src:
main/java/org/apache/shindig/gadgets/features/
test/java/org/apache/shindig/gadgets/features/
Author: lindner
Date: Mon Dec 7 19:12:03 2009
New Revision: 888091
URL: http://svn.apache.org/viewvc?rev=888091&view=rev
Log:
Revert "Accommodate Windows file paths as URIs in Feature loader system. Not the"
This reverts commit da90ab9ab709a85f4fc1978b7140ffbca2a0d3ad.
Modified:
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureRegistry.java
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureResourceLoader.java
incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/features/FeatureRegistryTest.java
Modified: incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureRegistry.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureRegistry.java?rev=888091&r1=888090&r2=888091&view=diff
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureRegistry.java (original)
+++ incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureRegistry.java Mon Dec 7 19:12:03 2009
@@ -29,7 +29,6 @@
import org.apache.shindig.common.uri.Uri;
import org.apache.shindig.common.uri.UriBuilder;
import org.apache.shindig.common.util.ResourceLoader;
-import org.apache.shindig.common.util.Utf8UrlCoder;
import org.apache.shindig.gadgets.GadgetContext;
import org.apache.shindig.gadgets.GadgetException;
import org.apache.shindig.gadgets.RenderingContext;
@@ -295,13 +294,6 @@
return uri;
}
- static File getFile(String filePath) {
- if (File.separatorChar == '\\') {
- filePath = Utf8UrlCoder.decode(filePath);
- }
- return new File(filePath);
- }
-
private List<FeatureNode> getTransitiveDeps(Collection<String> needed, List<String> unsupported) {
final List<FeatureNode> requested = getRequestedNodes(needed, unsupported);
@@ -437,8 +429,7 @@
loadFile(featureFile);
} else if (featureFile.getName().toLowerCase(Locale.ENGLISH).endsWith(".xml")) {
String content = ResourceLoader.getContent(featureFile);
- Uri parent = new UriBuilder().setScheme(FILE_SCHEME).setAuthority("")
- .setPath(featureFile.getAbsolutePath()).toUri();
+ Uri parent = Uri.fromJavaUri(featureFile.toURI());
loadFeature(parent, content);
} else {
if (logger.isLoggable(Level.FINEST)) {
Modified: incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureResourceLoader.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureResourceLoader.java?rev=888091&r1=888090&r2=888091&view=diff
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureResourceLoader.java (original)
+++ incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureResourceLoader.java Mon Dec 7 19:12:03 2009
@@ -74,8 +74,8 @@
}
protected FeatureResource loadFile(String path, Map<String, String> attribs) throws IOException {
- return new DualModeStaticResource(path, getFileContent(FeatureRegistry.getFile(getOptPath(path))),
- getFileContent(FeatureRegistry.getFile(path)));
+ return new DualModeStaticResource(path, getFileContent(new File(getOptPath(path))),
+ getFileContent(new File(path)));
}
protected String getFileContent(File file) {
Modified: incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/features/FeatureRegistryTest.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/features/FeatureRegistryTest.java?rev=888091&r1=888090&r2=888091&view=diff
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/features/FeatureRegistryTest.java (original)
+++ incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/features/FeatureRegistryTest.java Mon Dec 7 19:12:03 2009
@@ -27,7 +27,6 @@
import org.apache.shindig.common.uri.Uri;
import org.apache.shindig.common.uri.UriBuilder;
-import org.apache.shindig.common.util.Utf8UrlCoder;
import org.apache.shindig.config.ContainerConfig;
import org.apache.shindig.gadgets.GadgetContext;
import org.apache.shindig.gadgets.GadgetException;
@@ -134,9 +133,9 @@
File featureFile = File.createTempFile("feature", ".xml", featureDir);
featureFile.deleteOnExit();
out = new BufferedWriter(new FileWriter(featureFile));
- out.write(xml(NODEP_TPL, "gadget", getFileName(resFile), null));
+ out.write(xml(NODEP_TPL, "gadget", resFile.getAbsolutePath(), null));
out.close();
- registry.register(getFileName(childDir));
+ registry.register(childDir.getAbsolutePath());
// Verify single resource works all the way through.
List<FeatureResource> resources = registry.getAllFeatures();
@@ -681,17 +680,7 @@
BufferedWriter out = new BufferedWriter(new FileWriter(file));
out.write(content);
out.close();
- return new UriBuilder().setScheme("file").setAuthority("").setPath(
- getFileName(file)).toUri();
- }
-
- private static String getFileName(File input) throws Exception {
- if (File.separatorChar == '\\') {
- // Crazy gross special Windows stuff.
- return Utf8UrlCoder.encode(input.getCanonicalPath().replaceAll("\\\\", "/"))
- .replaceAll("%2F", "/");
- }
- return input.getCanonicalPath();
+ return Uri.fromJavaUri(file.toURI());
}
private static Uri makeResourceUri(String suffix) {
@@ -722,4 +711,4 @@
return key.startsWith("/") ? key.substring(1) : key;
}
}
-}
+}
\ No newline at end of file