/*
 * Copyright (c) OSGi Alliance (2006, 2011). All Rights Reserved.
 *
 * 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.
 */

// This document is an experimental draft to enable interoperability
// between bundle repositories. There is currently no commitment to 
// turn this draft into an official specification.  
package org.osgi.service.repository;

import java.io.IOException;
import java.net.URL;

/**
 * A repository builder service interface to allow third party code to simply build
 * repositories by pointing at a URL location.
 * 
 * OBR implementations should provide an implementation of this interface that parses
 * the OBR XML schema.
 * 
 * @ThreadSafe
 */
public interface RepositoryBuilder {
  /**
   * Attempts to build a Repository from the supplied location.
   * 
   * @param location The location of the repository
   *  
   * @return A repository or null if this builder does not know how to build a repository
   * from the supplied location
   * 
   * @throws IOException if building this repository fails due to an unexpected problem
   */
  Repository build(URL location) throws IOException;
}

@@ -1051,113 +1051,646 @@
 %0A * 
-OBR implementations should provide an implementation of this interface that parses%0A * the OBR XML schema.
+%3Cp%3E%0A * A trivial implementation of this interface can attempt to build a repository based on%0A * a file system directory:%0A * %0A * %3Cpre%3Epublic Repository build(URL location) throws IOException %7B%0A *  Repository built = null;%0A *  %0A *  if (%22file%22.equals(location.getProtocol())) %7B%0A *    try %7B%0A *      File file = new File(location.toURI());%0A *      %0A *      if (file.isDirectory()) %7B%0A *        List&lt;Resource&gt; resources = scanResources(file);          %0A *        built = new RepositoryImpl(resources);%0A *      %7D%0A *    %7D catch (URISyntaxException e) %7B%0A *      // can't be a file repo%0A *    %7D      %0A *  %7D%0A *  %0A *  return built;%0A *%7D%3C/pre%3E%0A * 
 %0A * 

add some words about how to build a simple repository builder that scans a file system