1 /* 2 * Copyright (c) 2005-2007 Creative Sphere Limited. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * 10 * Creative Sphere - initial API and implementation 11 * 12 */ 13 package org.abstracthorizon.extend.server.deployment; 14 15 import java.net.URI; 16 17 /** 18 * This interface describes module loader - a class that knows how to load module from given URI. 19 * 20 * @author Daniel Sendula 21 */ 22 public interface ModuleLoader { 23 24 /** 25 * Returns <code>true</code> if module loader knows how to load (create) module from given URI. 26 * @param uri URI 27 * @return <code>true</code> if module loader knows how to load (create) module from given URI 28 */ 29 boolean canLoad(URI uri); 30 31 /** 32 * Translates URI to moduleId 33 * @param uri uri 34 * @return module id or <code>null</code> 35 */ 36 ModuleId toModuleId(URI uri); 37 38 /** 39 * Loads module from given URI. If {@link #canLoad(URI)} returns <code>false</code> then this method 40 * will return <code>null</code>. 41 * @param uri URI for module to be loaded from 42 * @return module from given URI 43 */ 44 Module load(URI uri); 45 46 /** 47 * Loads module from given URI. If {@link #canLoad(URI)} returns <code>false</code> then this method 48 * will return <code>null</code>. 49 * @param uri URI for module to be loaded from 50 * @param moduleId module id to be used while creating module 51 * @return module from given URI 52 */ 53 Module loadAs(URI uri, ModuleId moduleId); 54 55 }