Issue #1441 Break net.dods dependency on AWIPS code

Change-Id: I13289bff3f3ea80317a858f8a32cc280b1ac0480

Former-commit-id: ddcc816bba [formerly 010eabebb27f6a2571ffb2a09e1715cb84c57ce9]
Former-commit-id: c00f5f394a
This commit is contained in:
Dustin Johnson 2013-01-10 11:14:07 -06:00
parent 5733a44770
commit c29d2e2e71
2 changed files with 17 additions and 5 deletions

View file

@ -7,8 +7,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime, org.eclipse.core.runtime,
javax.servlet;bundle-version="2.5.0", javax.servlet;bundle-version="2.5.0",
org.apache.http;bundle-version="4.1.2", org.apache.http;bundle-version="4.1.2",
org.junit, org.junit
com.raytheon.uf.common.util;bundle-version="1.12.1174"
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: gnu-getopt-1.0.6.jar, Bundle-ClassPath: gnu-getopt-1.0.6.jar,

View file

@ -24,7 +24,6 @@ import java.net.URL;
import java.util.zip.InflaterInputStream; import java.util.zip.InflaterInputStream;
import com.raytheon.dods.HttpConnectStrategy; import com.raytheon.dods.HttpConnectStrategy;
import com.raytheon.uf.common.util.ReflectionUtil;
import dods.dap.parser.ParseException; import dods.dap.parser.ParseException;
@ -147,8 +146,8 @@ public class DConnect {
*/ */
public DConnect(String urlString, String proxyHost, String proxyPort, public DConnect(String urlString, String proxyHost, String proxyPort,
boolean acceptDeflate) throws FileNotFoundException { boolean acceptDeflate) throws FileNotFoundException {
this(urlString, proxyHost, proxyPort, acceptDeflate, ReflectionUtil this(urlString, proxyHost, proxyPort, acceptDeflate,
.newInstanceOfAssignableType(HttpConnectStrategy.class, newInstanceOfAssignableType(HttpConnectStrategy.class,
HTTP_CONNECT_STRATEGY)); HTTP_CONNECT_STRATEGY));
} }
@ -769,4 +768,18 @@ public class DConnect {
return dds; return dds;
} }
private static <T> T newInstanceOfAssignableType(Class<T> assignableClass,
String name) {
try {
@SuppressWarnings("unchecked")
final Class<? extends T> forName = (Class<? extends T>) Class
.forName(name);
return assignableClass.cast(forName.newInstance());
} catch (Exception e) {
throw new IllegalArgumentException(String.format(
"%s is not assignable to a field of type %s", name,
assignableClass.getName()), e);
}
}
} }