Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * 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 org.apache.tuscany.sca.runtime;
 
 import java.net.URI;
 import java.util.List;
 import java.util.Set;
 
A delegating DomainRegistryFactory
 
     private String[] allSchemes;
     private String defaultScheme = "tuscany";
 
         this. = registry.getExtensionPoint(DomainRegistryFactoryExtensionPoint.class);
         if (ps.getProperties().containsKey("defaultScheme")) {
              = ps.getProperties().getProperty("defaultScheme");
         }
         
     }
     
         this. = factories;
     }
     
         UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
         return utilities.getUtility(ExtensibleDomainRegistryFactory.class);
     }
 
     public void addListener(EndpointListener listener) {
         for (DomainRegistryFactory factory : .getDomainRegistryFactories()) {
             factory.addListener(listener);
         }
     }
 
         List<EndpointRegistryregistries = new ArrayList<EndpointRegistry>();
         for (DomainRegistryFactory factory : .getDomainRegistryFactories()) {
             registries.addAll(factory.getEndpointRegistries());
         }
         return registries;
     }
 
     public EndpointRegistry getEndpointRegistry(String endpointRegistryURIString domainURI) {
         if (endpointRegistryURI == null) {
             endpointRegistryURI = .getDomainRegistryMapping().get(domainURI);
             if (endpointRegistryURI == null) {
                 endpointRegistryURI = domainURI;
             }
         }
 
         String scheme = endpointRegistryURI == null ? null : URI.create(endpointRegistryURI).getScheme();
         if (scheme == null) {
             
             // See if there is a previously created registry for that domain
             for (DomainRegistryFactory factory : .getDomainRegistryFactories()) {
                 for (EndpointRegistry endpointRegistry : factory.getEndpointRegistries()) {
                     if (endpointRegistry.getDomainURI().equals(domainURI)) {
                         return endpointRegistry;
                     }
                 }
             }
 
             scheme = ;
             endpointRegistryURI = scheme + ":" + endpointRegistryURI;
         } else {
             scheme = scheme.toLowerCase();
         }
         for (DomainRegistryFactory factory : .getDomainRegistryFactories()) {
            String[] schemes = factory.getSupportedSchemes();
            if (schemes != null && Arrays.asList(schemes).contains(scheme)) {
                EndpointRegistry endpointRegistry = factory.getEndpointRegistry(endpointRegistryURIdomainURI);
                if (endpointRegistry == null) {
                    continue;
                } else {
                    return endpointRegistry;
                }
            }
        }
        throw new ServiceRuntimeException("No EndpointRegistry can support " + endpointRegistryURI);
    }
    public void removeListener(EndpointListener listener) {
        for (DomainRegistryFactory factory : .getDomainRegistryFactories()) {
            factory.removeListener(listener);
        }
    }
    public synchronized String[] getSupportedSchemes() {
        if ( == null) {
            Set<StringsupportedSchemes = new HashSet<String>();
            for (DomainRegistryFactory factory : .getDomainRegistryFactories()) {
                String[] schemes = factory.getSupportedSchemes();
                if (schemes != null) {
                    supportedSchemes.addAll(Arrays.asList(schemes));
                }
            }
             = supportedSchemes.toArray(new String[supportedSchemes.size()]);
        }
        return ;
    }
New to GrepCode? Check out our FAQ X