Java 类org.eclipse.emf.ecore.resource.URIHandler 实例源码

项目:rest-modeling-framework    文件:RamlResourceSet.java   
public RamlResourceSet() {
    final List<URIHandler> uriHandlers = Arrays.asList(
            new PlatformResourceURIHandlerImpl(),
            new FileURIHandlerImpl(),
            new EFSURIHandlerImpl(),
            new ArchiveURIHandlerImpl(),
            new ContentNegotiationURIHandler(ACCEPT_HEADER_VALUE));
    final ExtensibleURIConverterImpl uriConverter =
            new ExtensibleURIConverterImpl(uriHandlers, ContentHandler.Registry.INSTANCE.contentHandlers());
    setURIConverter(uriConverter);

    final Resource.Factory.Registry resourceFactoryRegistry = getResourceFactoryRegistry();
    final RamlResourceFactory resourceFactory = new RamlResourceFactory();
    resourceFactoryRegistry
            .getExtensionToFactoryMap().put("raml", resourceFactory);

    resourceFactoryRegistry.getProtocolToFactoryMap()
            .put("http", resourceFactory);

    final Map<String, Object> contentTypeToFactoryMap = resourceFactoryRegistry.getContentTypeToFactoryMap();
    for (final String contentType : ACCEPTED_MIME_TYPES) {
        contentTypeToFactoryMap
                .put(contentType, resourceFactory);
    }
    addBuiltinTypes();
}
项目:eclipse-avro    文件:ExtensibleURIConverterImpl.java   
public URIHandler getURIHandler(URI uri)
{
  int size = uriHandlers.size();
  if (size > 0)
  {
    URIHandler[] data = uriHandlers.data();
    for (int i = 0; i < size; ++i)
    {
      URIHandler uriHandler = data[i];
      if (uriHandler.canHandle(uri))
      {
        return uriHandler;
      }
    }
  }
  throw new RuntimeException("There is no URIHandler to handle " + uri);
}
项目:clickwatch    文件:ExtensibleURIConverterImpl.java   
public URIHandler getURIHandler(URI uri)
{
  int size = uriHandlers.size();
  if (size > 0)
  {
    URIHandler[] data = uriHandlers.data();
    for (int i = 0; i < size; ++i)
    {
      URIHandler uriHandler = data[i];
      if (uriHandler.canHandle(uri))
      {
        return uriHandler;
      }
    }
  }
  throw new RuntimeException("There is no URIHandler to handle " + uri);
}
项目:n4js    文件:BuiltInSchemeRegistrar.java   
private boolean registerScheme(URIConverter converter, @SuppressWarnings("hiding") ClassLoader classLoader) {
    URIHandler uriHandler = converter.getURIHandlers().get(0);
    if (uriHandler instanceof MyURIHandler || uriHandler.canHandle(SAMPLE_URI)) {
        return false;
    }
    converter.getURIHandlers().add(0, createURIHandler(classLoader, converter));
    return true;
}
项目:n4js    文件:N4SchemeURIBasedStorage.java   
@Override
public InputStream getContents() throws CoreException {
    URIHandler handler = schemeHelper.createURIHandler(URIConverter.INSTANCE);
    try {
        return handler.createInputStream(getURI(), Collections.emptyMap());
    } catch (IOException e) {
        throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.n4js.ts.ui", "Cannot load "
                + getFullPath(), e));
    }
}
项目:gemoc-studio-modeldebugging    文件:DebugURIHandler.java   
@Override
public InputStream createInputStream(URI uri, Map<?, ?> options) throws IOException {
    for (URIHandler handler : otherHandlers) {
        if (handler.canHandle(uri))
        {
            return handler.createInputStream(uri, options);
        }
    }
    return super.createInputStream(uri, options);
}
项目:xtext-core    文件:ExternalContentSupport.java   
public void configureConverter(URIConverter converter, IExternalContentProvider contentProvider) {
    List<URIHandler> uriHandlers = converter.getURIHandlers();
    ListIterator<URIHandler> iter = uriHandlers.listIterator();
    while(iter.hasNext()) {
        URIHandler transformed = new ExternalContentAwareURIHandler(iter.next(), contentProvider);
        iter.set(transformed);
    }
}
项目:xtext-core    文件:ResourceServiceProviderRegistryImpl.java   
@Override
protected synchronized URIConverter getURIConverter() {
    if (this.uriConverter == null) {
        List<ContentHandler> withoutPlatformDelegate = Lists.newArrayList();
        for (ContentHandler contentHandler : ContentHandler.Registry.INSTANCE.contentHandlers()) {
            if (!isTooEager(contentHandler))
                withoutPlatformDelegate.add(contentHandler);
        }
        this.uriConverter = new ExtensibleURIConverterImpl(URIHandler.DEFAULT_HANDLERS, withoutPlatformDelegate);
    }
    return this.uriConverter;
}
项目:ModelDebugging    文件:DebugURIHandler.java   
@Override
public InputStream createInputStream(URI uri, Map<?, ?> options) throws IOException {
    for (URIHandler handler : otherHandlers) {
        if (handler.canHandle(uri))
        {
            return handler.createInputStream(uri, options);
        }
    }
    return super.createInputStream(uri, options);
}
项目:OpenSPIFe    文件:EnsembleResourceSet.java   
public EnsembleResourceSet() {
    super();

    for (EnsembleResourceFactory factory : factories) {
        factory.setResourceSet(this);
    }

    List<URIHandler> handlers = new ArrayList<URIHandler>(URIHandler.DEFAULT_HANDLERS);
    handlers.addAll(0, getURIHandlerContributions());
    setURIConverter(new ExtensibleURIConverterImpl(handlers, ContentHandler.Registry.INSTANCE.contentHandlers()));
}
项目:emfstore-rest    文件:MongoDBServerResourceSetProvider.java   
/**
 * 
 * {@inheritDoc}
 * 
 * @see org.eclipse.emf.emfstore.mongodb.AbstractMongoDBResourceSetProvider#setURIConverter(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl)
 */
@Override
protected void setURIConverter(ResourceSetImpl resourceSet) {
    // reuse uri handlers set up by resourcesetfactory
    EList<URIHandler> uriHandler = resourceSet.getURIConverter().getURIHandlers();
    URIConverter uriConverter = new MongoServerURIConverter();
    uriConverter.getURIHandlers().clear();
    uriConverter.getURIHandlers().addAll(uriHandler);
    resourceSet.setURIConverter(uriConverter);
}
项目:emfstore-rest    文件:MongoDBClientResourceSetProvider.java   
/**
 * 
 * {@inheritDoc}
 * 
 * @see org.eclipse.emf.emfstore.mongodb.AbstractMongoDBResourceSetProvider#setURIConverter(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl)
 */
@Override
protected void setURIConverter(ResourceSetImpl resourceSet) {
    // reuse uri handlers set up by resourcesetfactory
    EList<URIHandler> uriHandler = resourceSet.getURIConverter().getURIHandlers();
    URIConverter uriConverter = new MongoClientURIConverter();
    uriConverter.getURIHandlers().clear();
    uriConverter.getURIHandlers().addAll(uriHandler);
    resourceSet.setURIConverter(uriConverter);
}
项目:eclipse-avro    文件:ExtensibleURIConverterImpl.java   
public EList<URIHandler> getURIHandlers()
{
  if (uriHandlers == null)
  {
    uriHandlers = new URIHandlerList();
  }
  return uriHandlers;
}
项目:clickwatch    文件:ExtensibleURIConverterImpl.java   
public EList<URIHandler> getURIHandlers()
{
  if (uriHandlers == null)
  {
    uriHandlers = new URIHandlerList();
  }
  return uriHandlers;
}
项目:n4js    文件:BuiltInSchemeRegistrar.java   
private URIHandler createURIHandler(ClassLoader theClassLoader, URIConverter converter) {
    return new MyURIHandler(theClassLoader, converter);
}
项目:n4js    文件:BuiltInSchemeRegistrar.java   
/**
 * Creates a new URI Handler for the n4scheme.
 */
public URIHandler createURIHandler(URIConverter converter) {
    return createURIHandler(classLoader, converter);
}
项目:gemoc-studio-modeldebugging    文件:DebugURIHandler.java   
public DebugURIHandler(EList<URIHandler> uriHandlers) {
    otherHandlers = new ArrayList<>();
    otherHandlers.addAll(uriHandlers);
}
项目:xtext-extras    文件:ClasspathTypeProvider.java   
@Override
public EList<URIHandler> getURIHandlers() {
    return existing.getURIHandlers();
}
项目:xtext-extras    文件:ClasspathTypeProvider.java   
@Override
public URIHandler getURIHandler(URI uri) {
    return existing.getURIHandler(uri);
}
项目:xtext-core    文件:ExternalContentSupport.java   
public ExternalContentAwareURIHandler(URIHandler delegate, IExternalContentProvider contentProvider) {
    this.delegate = delegate;
    this.contentProvider = contentProvider;
}
项目:xtext-core    文件:ExternalContentSupportTest.java   
private void checkConverter(URIConverter wrapped) {
    assertNotNull(wrapped);
    for(URIHandler handler: wrapped.getURIHandlers()) {
        assertTrue(handler instanceof ExternalContentSupport.ExternalContentAwareURIHandler);
    }
}
项目:ModelDebugging    文件:DebugURIHandler.java   
public DebugURIHandler(EList<URIHandler> uriHandlers) {
    otherHandlers = new ArrayList<>();
    otherHandlers.addAll(uriHandlers);
}
项目:eclipse-avro    文件:ExtensibleURIConverterImpl.java   
@Override
protected Object [] newData(int capacity)
{
  return new URIHandler [capacity];
}
项目:eclipse-avro    文件:ExtensibleURIConverterImpl.java   
@Override
public URIHandler [] data()
{
  return (URIHandler[])data;
}
项目:eclipse-avro    文件:ExtensibleURIConverterImpl.java   
/**
 * Creates an instance.
 */
public ExtensibleURIConverterImpl()
{
  this(URIHandler.DEFAULT_HANDLERS, ContentHandler.Registry.INSTANCE.contentHandlers());
}
项目:eclipse-avro    文件:ExtensibleURIConverterImpl.java   
/**
 * Creates an instance.
 */
public ExtensibleURIConverterImpl(Collection<URIHandler> uriHandlers, Collection<ContentHandler> contentHandlers)
{
  getURIHandlers().addAll(uriHandlers);
  getContentHandlers().addAll(contentHandlers);
}
项目:clickwatch    文件:ExtensibleURIConverterImpl.java   
@Override
protected Object [] newData(int capacity)
{
  return new URIHandler [capacity];
}
项目:clickwatch    文件:ExtensibleURIConverterImpl.java   
@Override
public URIHandler [] data()
{
  return (URIHandler[])data;
}
项目:clickwatch    文件:ExtensibleURIConverterImpl.java   
/**
 * Creates an instance.
 */
public ExtensibleURIConverterImpl()
{
  this(URIHandler.DEFAULT_HANDLERS, ContentHandler.Registry.INSTANCE.contentHandlers());
}
项目:clickwatch    文件:ExtensibleURIConverterImpl.java   
/**
 * Creates an instance.
 */
public ExtensibleURIConverterImpl(Collection<URIHandler> uriHandlers, Collection<ContentHandler> contentHandlers)
{
  getURIHandlers().addAll(uriHandlers);
  getContentHandlers().addAll(contentHandlers);
}
项目:OpenSPIFe    文件:EnsembleResourceSet.java   
/**
 * Allows for the platform to contribute {@link URIHandler} elements to
 * the resource set. Contributions can come from:
 * 
 * <ul>
 * <li>ClassRegistry extension point</li>
 * </ul>
 * 
 * @return a list of {@link URIHandler} elements.
 */
protected List<URIHandler> getURIHandlerContributions() {
    return ClassRegistry.createInstances(URIHandler.class);
}