incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r917690 - /sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/Activator.java
Date Mon, 01 Mar 2010 20:12:49 GMT
Author: justin
Date: Mon Mar  1 20:12:49 2010
New Revision: 917690

URL: http://svn.apache.org/viewvc?rev=917690&view=rev
Log:
SLING-1417 - allowing non-file urls in the value of sling.repository.config.file.url

Modified:
    sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/Activator.java

Modified: sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/Activator.java?rev=917690&r1=917689&r2=917690&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/Activator.java
(original)
+++ sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/Activator.java
Mon Mar  1 20:12:49 2010
@@ -264,12 +264,12 @@
         if (homeDir == null)
         	return;
 
-        File configFile = getConfigFile(bundleContext, homeDir);
+        String configFileUrl = getConfigFileUrl(bundleContext, homeDir);
 
         // default config values
         props.put(SLING_CONTEXT, slingContext);
         props.put(SlingServerRepository.REPOSITORY_CONFIG_URL,
-            configFile.getPath());
+            configFileUrl);
         props.put(SlingServerRepository.REPOSITORY_HOME_DIR,
             homeDir.getPath());
         props.put(SlingServerRepository.REPOSITORY_REGISTRATION_NAME,
@@ -307,30 +307,29 @@
     	return homeDir;
     }
 
-    private File getConfigFile(BundleContext bundleContext, File homeDir) throws IOException
{
-    	File configFile;
-
+    private String getConfigFileUrl(BundleContext bundleContext, File homeDir) throws IOException
{
     	String repoConfigFileUrl = bundleContext.getProperty("sling.repository.config.file.url");
     	if (repoConfigFileUrl != null) {
     		// the repository config file is set
     		URL configFileUrl = null;
 			try {
+			    // verify it is a good url
 				configFileUrl = new URL(repoConfigFileUrl);
+				return repoConfigFileUrl;
 			} catch (MalformedURLException e) {
 				// this not an url, trying with "file:"
 				configFileUrl = new URL("file:///" + repoConfigFileUrl);
+				File configFile = new File(configFileUrl.getFile());
+				if (configFile.canRead()) {
+				    return configFileUrl.toString();
+				}
 			}
-
-    		// local support only
-    		configFile = new File(configFileUrl.getFile());
-    		if (configFile.canRead())
-    			return configFile;
     	}
 
         // ensure the configuration file (inside the home Dir !)
-        configFile = new File(homeDir, "repository.xml");
+        File configFile = new File(homeDir, "repository.xml");
         SlingServerRepository.copyFile(bundleContext.getBundle(), "repository.xml", configFile);
-    	return configFile;
+    	return configFile.toURI().toURL().toString();
     }
 
 }



Mime
View raw message