// Path: fcrepo-api-x-model/src/main/java/org/fcrepo/apix/model/Extension.java
// public interface Extension {
// 
//     /**
//      * RDF type this extension binds to.
//      *
//      * @return URI of the <code>rdf:type</code> this extension binds to.
//      */
//     public URI bindingClass();
// 
//     /**
//      * Determine if this extension exposes services.
//      *
//      * @return true if the extension exposes services
//      */
//     public boolean isExposing();
// 
//     /**
//      * Determine if this extension intercepts requests.
//      *
//      * @return true if the extension intercepts requests.
//      */
//     public boolean isIntercepting();
// 
//     /**
//      * Get specification for exposed services.
//      *
//      * @return Service exposure specification.
//      */
//     public ServiceExposureSpec exposed();
// 
//     /**
//      * Get specification for intercepting modality.
//      *
//      * @return Specification.
//      */
//     public Spec intercepted();
// 
//     /**
//      * The URI (location) of the extension.
//      * <p>
//      * This is a potentially more lightweight operation than <code>getResource().uri()</code>
//      * </p>
//      *
//      * @return its resolvable URI.
//      */
//     public URI uri();
// 
//     /**
//      * Underlying RDF representation of an extension.
//      *
//      * @return A serialization of the extension resource.
//      */
//     public WebResource getResource();
// 
//     /**
//      * Implementation specification for an extension.
//      */
//     public interface Spec {
// 
//         /**
//          * Set of consumed services.
//          *
//          * @return Non-null set.
//          */
//         public Set<URI> consumed();
// 
//     }
// 
//     /**
//      * Implementation specification for a service-exposing specification.
//      */
//     public interface ServiceExposureSpec extends Spec {
// 
//         /**
//          * The URI naming the exposed service.
//          * <p>
//          * This is not an endpoint URI, it is the URI which names the service in the abstract sense. A lookup in a
//          * {@link org.fcrepo.apix.model.components.ServiceRegistry} by URI can be expected to provide more information
//          * </p>
//          *
//          * @return the exposed service URI.
//          */
//         public URI exposedService();
// 
//         /**
//          * URI the service is exposed at.
//          * <p>
//          * May be absolute or relative. If relative, the {@link org.fcrepo.apix.model.components.Routing} component
//          * will use this to mint the resolvable URI a service is exposed at.
//          * </p>
//          *
//          * @return service exposure URI.
//          */
//         public URI exposedAt();
// 
//         /**
//          * The scope of the exposed service.
//          *
//          * @return scope (external, repository, resource)
//          */
//         public Scope scope();
//     }
// 
//     public enum Scope {
//         RESOURCE,
//         REPOSITORY,
//         EXTERNAL
//     }
// }


import org.fcrepo.apix.model.WebResource;
import java.net.URI;
import java.util.Collection;
import org.fcrepo.apix.model.Extension;
/*
 * Licensed to DuraSpace under one or more contributor license agreements.
 * See the NOTICE file distributed with this work for additional information
 * regarding copyright ownership.
 *
 * DuraSpace 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.fcrepo.apix.model.components;



/**
 * Binds extensions to resources.
 * <p>
 * An extension describes the class of resources that it may be bound to. Implementations of this service determine
 * (eg via OWL reasoning) whether a given resource meets the binding criteria of a given extension.
 * </p>
 *
 * @author apb@jhu.edu
 */
public interface ExtensionBinding {

    /**
     * Determine all known extensions that bind to the given resource.
     * <p>
     * This is intended for calculating the set of extensions that bind to given, physical resource. There is no
     * presumption that this resource exists on the repository or the web (i.e. it can be from a request).
     * </p>
     * <p>
     * Implementations will consult an underlying registry of extensions
     * </p>
     *
     * @param resource Candidate resource.
     * @return All extensions that bind to the given resource, or an empty collection if none.
     */
    public Collection<Extension> getExtensionsFor(WebResource resource);

    /**
     * Determine which of the given extensions bind to the given resource.
     *
     * @param resource Candidate resource
     * @param from Candidate extensions
     * @return All extensions from the list that bind to the resource, or empty if none.
     */
    public Collection<Extension> getExtensionsFor(WebResource resource, Collection<Extension> from);

    /**
     * Determine all known extensions that bind to the given resource, given its URI.
     * <p>
     * The given URI may be a resource in the repository, on the web, or otherwise within a registry specified by the
     * implementation of this component. Depending on implementation, results may be based on lookup of pre-computed
     * bindings.
     * </p>
     * <p>
     * Implementations will consult an underlying registry of extensions
     * </p>
     *
     * @param resourceURI URI of the candidate resource.
     * @return All extensions that bind to the given resource, or an empty collection if none.
     */
// Path: fcrepo-api-x-model/src/main/java/org/fcrepo/apix/model/Extension.java
// public interface Extension {
// 
//     /**
//      * RDF type this extension binds to.
//      *
//      * @return URI of the <code>rdf:type</code> this extension binds to.
//      */
//     public URI bindingClass();
// 
//     /**
//      * Determine if this extension exposes services.
//      *
//      * @return true if the extension exposes services
//      */
//     public boolean isExposing();
// 
//     /**
//      * Determine if this extension intercepts requests.
//      *
//      * @return true if the extension intercepts requests.
//      */
//     public boolean isIntercepting();
// 
//     /**
//      * Get specification for exposed services.
//      *
//      * @return Service exposure specification.
//      */
//     public ServiceExposureSpec exposed();
// 
//     /**
//      * Get specification for intercepting modality.
//      *
//      * @return Specification.
//      */
//     public Spec intercepted();
// 
//     /**
//      * The URI (location) of the extension.
//      * <p>
//      * This is a potentially more lightweight operation than <code>getResource().uri()</code>
//      * </p>
//      *
//      * @return its resolvable URI.
//      */
//     public URI uri();
// 
//     /**
//      * Underlying RDF representation of an extension.
//      *
//      * @return A serialization of the extension resource.
//      */
//     public WebResource getResource();
// 
//     /**
//      * Implementation specification for an extension.
//      */
//     public interface Spec {
// 
//         /**
//          * Set of consumed services.
//          *
//          * @return Non-null set.
//          */
//         public Set<URI> consumed();
// 
//     }
// 
//     /**
//      * Implementation specification for a service-exposing specification.
//      */
//     public interface ServiceExposureSpec extends Spec {
// 
//         /**
//          * The URI naming the exposed service.
//          * <p>
//          * This is not an endpoint URI, it is the URI which names the service in the abstract sense. A lookup in a
//          * {@link org.fcrepo.apix.model.components.ServiceRegistry} by URI can be expected to provide more information
//          * </p>
//          *
//          * @return the exposed service URI.
//          */
//         public URI exposedService();
// 
//         /**
//          * URI the service is exposed at.
//          * <p>
//          * May be absolute or relative. If relative, the {@link org.fcrepo.apix.model.components.Routing} component
//          * will use this to mint the resolvable URI a service is exposed at.
//          * </p>
//          *
//          * @return service exposure URI.
//          */
//         public URI exposedAt();
// 
//         /**
//          * The scope of the exposed service.
//          *
//          * @return scope (external, repository, resource)
//          */
//         public Scope scope();
//     }
// 
//     public enum Scope {
//         RESOURCE,
//         REPOSITORY,
//         EXTERNAL
//     }
// }


// Path: fcrepo-api-x-model/src/main/java/org/fcrepo/apix/model/components/ExtensionBinding.java
import org.fcrepo.apix.model.WebResource;
import java.net.URI;
import java.util.Collection;
import org.fcrepo.apix.model.Extension;

/*
 * Licensed to DuraSpace under one or more contributor license agreements.
 * See the NOTICE file distributed with this work for additional information
 * regarding copyright ownership.
 *
 * DuraSpace 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.fcrepo.apix.model.components;



/**
 * Binds extensions to resources.
 * <p>
 * An extension describes the class of resources that it may be bound to. Implementations of this service determine
 * (eg via OWL reasoning) whether a given resource meets the binding criteria of a given extension.
 * </p>
 *
 * @author apb@jhu.edu
 */
public interface ExtensionBinding {

    /**
     * Determine all known extensions that bind to the given resource.
     * <p>
     * This is intended for calculating the set of extensions that bind to given, physical resource. There is no
     * presumption that this resource exists on the repository or the web (i.e. it can be from a request).
     * </p>
     * <p>
     * Implementations will consult an underlying registry of extensions
     * </p>
     *
     * @param resource Candidate resource.
     * @return All extensions that bind to the given resource, or an empty collection if none.
     */
    public Collection<Extension> getExtensionsFor(WebResource resource);

    /**
     * Determine which of the given extensions bind to the given resource.
     *
     * @param resource Candidate resource
     * @param from Candidate extensions
     * @return All extensions from the list that bind to the resource, or empty if none.
     */
    public Collection<Extension> getExtensionsFor(WebResource resource, Collection<Extension> from);

    /**
     * Determine all known extensions that bind to the given resource, given its URI.
     * <p>
     * The given URI may be a resource in the repository, on the web, or otherwise within a registry specified by the
     * implementation of this component. Depending on implementation, results may be based on lookup of pre-computed
     * bindings.
     * </p>
     * <p>
     * Implementations will consult an underlying registry of extensions
     * </p>
     *
     * @param resourceURI URI of the candidate resource.
     * @return All extensions that bind to the given resource, or an empty collection if none.
     */
    public Collection<Extension> getExtensionsFor(URI resourceURI);