/*
 * Copyright (c) 2014-2015 Neil Ellis
 *
 * Licensed 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 com.sillelien.dollar.api.script;

import com.sillelien.dollar.api.Pipeable;
import com.sillelien.dollar.api.plugin.ExtensionPoint;
import com.sillelien.dollar.api.plugin.NoOpProxy;

import java.util.ServiceLoader;

public interface ModuleResolver extends ExtensionPoint<ModuleResolver> {

    public static ModuleResolver resolveModule(String scheme) {
        final ServiceLoader<ModuleResolver> loader = ServiceLoader.load(ModuleResolver.class);
        for (ModuleResolver piper : loader) {
            if (piper.getScheme().equals(scheme)) {
                return piper.copy();
            }
        }
        return NoOpProxy.newInstance(ModuleResolver.class);
    }


    String getScheme();

    <T> Pipeable resolve(String uriWithoutScheme, T scope) throws Exception;
}

@@ -1,13 +1,16 @@
 /*%0A *
+   
  Copyrig
@@ -28,9 +28,9 @@
 -201
-5
+7
  Nei
@@ -42,16 +42,19 @@
 is%0A *%0A *
+   
  License
@@ -112,16 +112,19 @@
 se%22);%0A *
+   
  you may
@@ -183,16 +183,19 @@
 ense.%0A *
+   
  You may
@@ -239,16 +239,19 @@
 *       
+  
+ 
 http://w
@@ -290,16 +290,19 @@
 .0%0A *%0A *
+   
  Unless 
@@ -364,16 +364,19 @@
 tware%0A *
+   
  distrib
@@ -436,16 +436,19 @@
 ASIS,%0A *
+   
  WITHOUT
@@ -515,16 +515,19 @@
 lied.%0A *
+   
  See the
@@ -589,16 +589,19 @@
 s and%0A *
+   
  limitat
@@ -1343,16 +1343,18 @@
 %0A%0A    %3CT
+,P
 %3E Pipeab
@@ -1396,16 +1396,26 @@
  T scope
+, P parser
 ) throws

Work on scopes (4)