summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/contrib/modules/section10/src/main/java/org/apache/tuscany/sca/something/Section10Factory.java
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-05-25 07:08:30 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-05-25 07:08:30 +0000
commit6938628a4986ab9ceb87eea9d6313ebad1b214bc (patch)
treea5ef6dc238b00da486dceac30793c405f42c09b2 /sca-java-2.x/contrib/modules/section10/src/main/java/org/apache/tuscany/sca/something/Section10Factory.java
parent15163ea2fd41b74b0e0a9fdb4b9746999e388e65 (diff)
Remove the constructors that use the uri: and properties: options to keep things as simple as possible for now
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@947945 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/contrib/modules/section10/src/main/java/org/apache/tuscany/sca/something/Section10Factory.java96
1 files changed, 0 insertions, 96 deletions
diff --git a/sca-java-2.x/contrib/modules/section10/src/main/java/org/apache/tuscany/sca/something/Section10Factory.java b/sca-java-2.x/contrib/modules/section10/src/main/java/org/apache/tuscany/sca/something/Section10Factory.java
index c9600578cf..91bd3f2284 100644
--- a/sca-java-2.x/contrib/modules/section10/src/main/java/org/apache/tuscany/sca/something/Section10Factory.java
+++ b/sca-java-2.x/contrib/modules/section10/src/main/java/org/apache/tuscany/sca/something/Section10Factory.java
@@ -19,14 +19,6 @@
package org.apache.tuscany.sca.something;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
import java.util.Properties;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
@@ -39,7 +31,6 @@ import org.apache.tuscany.sca.runtime.CompositeActivator;
import org.apache.tuscany.sca.runtime.EndpointRegistry;
import org.apache.tuscany.sca.runtime.ExtensibleDomainRegistryFactory;
import org.apache.tuscany.sca.something.impl.Section10Impl;
-import org.oasisopen.sca.ServiceRuntimeException;
public class Section10Factory {
@@ -58,25 +49,6 @@ public class Section10Factory {
init(null);
}
- public Section10Factory(String configURI) {
- Properties properties;
- if (configURI == null || configURI.length() < 1) {
- properties = null;
- } else if (configURI.startsWith("properties:")) {
- try {
- properties = loadProperties(configURI.substring("properties:".length()));
- } catch (IOException e) {
- throw new ServiceRuntimeException(e);
- }
- } else if (configURI.startsWith("uri:")) {
- properties = parseConfigURI(configURI.substring("uri:".length()));
- } else {
- properties = new Properties();
- properties.setProperty("defaultDomainName", configURI);
- }
- init(properties);
- }
-
public Section10Factory(Properties config) {
init(config);
}
@@ -105,72 +77,4 @@ public class Section10Factory {
this.compositeActivator = utilities.getUtility(CompositeActivator.class);
this.domainRegistryFactory = ExtensibleDomainRegistryFactory.getInstance(extensionPointRegistry);
}
-
- /**
- * Parse the config string into a Properties object.
- * The config URI has the following format:
- * uri:<domainName>?name=value&...
- */
- private static Properties parseConfigURI(String configURI) {
- Properties properties = new Properties();
- int qm = configURI.indexOf('?');
- if (qm < 0) {
- properties.setProperty("defaultDomainName", configURI);
- } else {
- if (qm == 0) {
- properties.setProperty("defaultDomainName", "default");
- } else {
- properties.setProperty("defaultDomainName", configURI.substring(0, qm));
- }
- if (configURI.length() > qm+1) {
- Map<String, String> params = new HashMap<String, String>();
- for (String param : configURI.substring(qm+1).split("&")) {
- String[] px = param.split("=");
- if (px.length == 2) {
- params.put(px[0], px[1]);
- } else {
- params.put(px[0], "");
- }
- }
- for (String name : params.keySet()) {
- properties.setProperty(name, params.get(name));
- }
- }
- }
- return properties;
- }
-
- /**
- * load the properties from external URL or a relative file
- * properties:<url to properties file>
- */
- private static Properties loadProperties(String propsURL) throws IOException {
-
- Properties properties = new Properties();
- File file = new File(propsURL);
-
- InputStream inputStream = null;
- if (file.exists()) {
- inputStream = new FileInputStream(file);
- } else {
- URL url = null;
- try {
- url = new URL(propsURL);
- } catch (MalformedURLException e) {
- inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(propsURL);
- if (inputStream == null) {
- throw new IOException("File does not exist: " + propsURL + ", could not be found on the classpath and is not a valid URL: " + e);
- }
- }
- if (inputStream == null && url != null) {
- inputStream = url.openStream();
- }
- }
- if (inputStream != null) {
- properties.load(inputStream);
- inputStream.close();
- }
-
- return properties;
- }
}