| Class | Line # | Actions | |||||
|---|---|---|---|---|---|---|---|
| ResourceTypeResolver | 44 | 0 | - | 0 | 0 |
| 1 | /* | |
| 2 | * See the NOTICE file distributed with this work for additional | |
| 3 | * information regarding copyright ownership. | |
| 4 | * | |
| 5 | * This is free software; you can redistribute it and/or modify it | |
| 6 | * under the terms of the GNU Lesser General Public License as | |
| 7 | * published by the Free Software Foundation; either version 2.1 of | |
| 8 | * the License, or (at your option) any later version. | |
| 9 | * | |
| 10 | * This software is distributed in the hope that it will be useful, | |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | * Lesser General Public License for more details. | |
| 14 | * | |
| 15 | * You should have received a copy of the GNU Lesser General Public | |
| 16 | * License along with this software; if not, write to the Free | |
| 17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
| 18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
| 19 | */ | |
| 20 | package org.xwiki.resource; | |
| 21 | ||
| 22 | import java.util.Map; | |
| 23 | ||
| 24 | import org.xwiki.component.annotation.Role; | |
| 25 | ||
| 26 | /** | |
| 27 | * Transforms some representation of an XWiki Resource Type into a {@link org.xwiki.resource.ResourceType} instance. | |
| 28 | * <p> | |
| 29 | * Note that you could wonder why this interface is required when the | |
| 30 | * {@link org.xwiki.resource.ResourceReferenceResolver} interface returns a {@link org.xwiki.resource.ResourceReference} | |
| 31 | * which itself provides that Type through {@link org.xwiki.resource.ResourceReference#getType()} method. The reason is | |
| 32 | * that some code needs to find out the Resource Type without parsing the full representation before taking | |
| 33 | * some decision. This is the case for example for the XWiki Routing Filter which needs to decide how to perform the | |
| 34 | * routing based on the Resource Type. That code is executed when there's no Execution Context yet and thus resolving | |
| 35 | * the full Resource Reference would fail since it requires some valid Execution Context to extract the wiki name | |
| 36 | * from the URL. | |
| 37 | * </p> | |
| 38 | * | |
| 39 | * @param <T> the object to transform into a Resource Type | |
| 40 | * @version $Id: 0cfa838156233d7af50bef31eedd19e0748e0548 $ | |
| 41 | * @since 7.1M1 | |
| 42 | */ | |
| 43 | @Role | |
| 44 | public interface ResourceTypeResolver<T> | |
| 45 | { | |
| 46 | /** | |
| 47 | * Transforms some representation of a XWiki Resource Type into a {@link org.xwiki.resource.ResourceType} instance. | |
| 48 | * | |
| 49 | * @param representation the object to transform into a {@link org.xwiki.resource.ResourceType} instance | |
| 50 | * @param parameters generic parameters that depend on the underlying implementation. In order to know what to pass | |
| 51 | * you need to check the documentation for the implementation you're using. | |
| 52 | * @return the {@link org.xwiki.resource.ResourceType} instance | |
| 53 | * @throws CreateResourceTypeException if there was an error while creating the Resource Type object (the | |
| 54 | * representation doesn't contain a valid Resource Type for example) | |
| 55 | */ | |
| 56 | ResourceType resolve(T representation, Map<String, Object> parameters) throws CreateResourceTypeException; | |
| 57 | } |