modules/host-android/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomain.java [168:222]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    static SCADomain createNewInstance(String domainURI, String contributionLocation, String... composites) {

        SCADomain domain = null;

        try {
            // Determine the runtime and application ClassLoader
            final ClassLoader runtimeClassLoader = SCADomain.class.getClassLoader();
            final ClassLoader applicationClassLoader = Thread.currentThread().getContextClassLoader();

            Class<?> implClass = ServiceDiscovery.getInstance().loadFirstServiceClass(SCADomain.class);

            if (implClass == null) {

                // Create a default SCA domain implementation
                domain =
                    new DefaultSCADomain(runtimeClassLoader, applicationClassLoader, domainURI, contributionLocation,
                                         composites);
            } else {

                // Create an instance of the discovered SCA domain implementation
                Constructor<?> constructor = null;
                try {
                    constructor =
                        implClass.getConstructor(ClassLoader.class,
                                                 ClassLoader.class,
                                                 String.class,
                                                 String.class,
                                                 String[].class);
                } catch (NoSuchMethodException e) {
                }
                if (constructor != null) {
                    domain =
                        (SCADomain)constructor.newInstance(runtimeClassLoader,
                                                           applicationClassLoader,
                                                           domainURI,
                                                           contributionLocation,
                                                           composites);
                } else {

                    constructor = implClass.getConstructor(ClassLoader.class, String.class);
                    domain = (SCADomain)constructor.newInstance(runtimeClassLoader, domainURI);
                }
            }

            // FIXME: temporary support for connect() API
            theDomain = domain;

            return domain;

        } catch (ServiceRuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomain.java [168:222]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    static SCADomain createNewInstance(String domainURI, String contributionLocation, String... composites) {

        SCADomain domain = null;

        try {
            // Determine the runtime and application ClassLoader
            final ClassLoader runtimeClassLoader = SCADomain.class.getClassLoader();
            final ClassLoader applicationClassLoader = Thread.currentThread().getContextClassLoader();

            Class<?> implClass = ServiceDiscovery.getInstance().loadFirstServiceClass(SCADomain.class);

            if (implClass == null) {

                // Create a default SCA domain implementation
                domain =
                    new DefaultSCADomain(runtimeClassLoader, applicationClassLoader, domainURI, contributionLocation,
                                         composites);
            } else {

                // Create an instance of the discovered SCA domain implementation
                Constructor<?> constructor = null;
                try {
                    constructor =
                        implClass.getConstructor(ClassLoader.class,
                                                 ClassLoader.class,
                                                 String.class,
                                                 String.class,
                                                 String[].class);
                } catch (NoSuchMethodException e) {
                }
                if (constructor != null) {
                    domain =
                        (SCADomain)constructor.newInstance(runtimeClassLoader,
                                                           applicationClassLoader,
                                                           domainURI,
                                                           contributionLocation,
                                                           composites);
                } else {

                    constructor = implClass.getConstructor(ClassLoader.class, String.class);
                    domain = (SCADomain)constructor.newInstance(runtimeClassLoader, domainURI);
                }
            }

            // FIXME: temporary support for connect() API
            theDomain = domain;

            return domain;

        } catch (ServiceRuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



