felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1579048 - /felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/ResourceUtil.java
Date Tue, 18 Mar 2014 21:28:56 GMT
Author: pderop
Date: Tue Mar 18 21:28:56 2014
New Revision: 1579048

URL: http://svn.apache.org/r1579048
Log:
added ResourceUtil from old codebase

Added:
    felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/ResourceUtil.java

Added: felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/ResourceUtil.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/ResourceUtil.java?rev=1579048&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/ResourceUtil.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/ResourceUtil.java Tue Mar 18
21:28:56 2014
@@ -0,0 +1,45 @@
+/*
+ * 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 dm;
+
+import java.net.URL;
+import java.util.Dictionary;
+import java.util.Properties;
+
+/**
+ * Utility class for resource handling.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class ResourceUtil {
+	/**
+	 * Creates a set of properties for a resource based on its URL.
+	 * 
+	 * @param url the URL
+	 * @return a set of properties
+	 */
+    public static Dictionary createProperties(URL url) {
+        Properties props = new Properties();
+        props.setProperty(ResourceHandler.PROTOCOL, url.getProtocol());
+        props.setProperty(ResourceHandler.HOST, url.getHost());
+        props.setProperty(ResourceHandler.PORT, Integer.toString(url.getPort()));
+        props.setProperty(ResourceHandler.PATH, url.getPath());
+        return props;
+    }
+}



Mime
View raw message