001 // SECTION-START[License Header]
002 // <editor-fold defaultstate="collapsed" desc=" Generated License ">
003 /*
004 * Copyright (c) 2009 The JOMC Project
005 * Copyright (c) 2005 Christian Schulte <cs@jomc.org>
006 * All rights reserved.
007 *
008 * Redistribution and use in source and binary forms, with or without
009 * modification, are permitted provided that the following conditions
010 * are met:
011 *
012 * o Redistributions of source code must retain the above copyright
013 * notice, this list of conditions and the following disclaimer.
014 *
015 * o Redistributions in binary form must reproduce the above copyright
016 * notice, this list of conditions and the following disclaimer in
017 * the documentation and/or other materials provided with the
018 * distribution.
019 *
020 * THIS SOFTWARE IS PROVIDED BY THE JOMC PROJECT AND CONTRIBUTORS "AS IS"
021 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
022 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
023 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JOMC PROJECT OR
024 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
025 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
026 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
027 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
028 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
029 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
030 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
031 *
032 * $Id: Locator.java 968 2009-11-18 06:08:28Z schulte2005 $
033 *
034 */
035 // </editor-fold>
036 // SECTION-END
037 package org.jomc.spi;
038
039 import java.io.IOException;
040 import java.net.URI;
041
042 // SECTION-START[Documentation]
043 // <editor-fold defaultstate="collapsed" desc=" Generated Documentation ">
044 /**
045 * Locates objects.
046 * <p>This specification declares a multiplicity of {@code Many}.
047 * An application assembler may provide multiple implementations of this specification (including none).
048 * Use of class {@link org.jomc.ObjectManager ObjectManager} is supported for getting these implementations or for
049 * selecting a single implementation.<pre>
050 * Locator[] objects = (Locator[]) ObjectManagerFactory.getObjectManager( getClassLoader() ).getObject( Locator.class );
051 * Locator object = ObjectManagerFactory.getObjectManager( getClassLoader() ).getObject( Locator.class, "<i>implementation name</i>" );
052 * </pre>
053 * </p>
054 *
055 * <p>This specification does not apply to any scope. A new object is returned whenever requested.</p>
056 *
057 * @author <a href="mailto:cs@jomc.org">Christian Schulte</a> 1.0
058 * @version $Id: Locator.java 968 2009-11-18 06:08:28Z schulte2005 $
059 */
060 // </editor-fold>
061 // SECTION-END
062 // SECTION-START[Annotations]
063 // <editor-fold defaultstate="collapsed" desc=" Generated Annotations ">
064 @javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
065 comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-8/jomc-tools" )
066 // </editor-fold>
067 // SECTION-END
068 public interface Locator
069 {
070 // SECTION-START[Locator]
071
072 /**
073 * Gets an object for a given location URI.
074 *
075 * @param specification The specification class of the object to locate.
076 * @param location The location URI of the object to locate.
077 * @param <T> The type of the object.
078 *
079 * @return The object located at {@code location} or {@code null} if no object is found at {@code location}.
080 *
081 * @throws NullPointerException if {@code specification} or {@code location} is {@code null}.
082 * @throws IOException if locating the object fails.
083 */
084 <T> T getObject( Class<T> specification, URI location ) throws NullPointerException, IOException;
085
086 // SECTION-END
087 }