Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
TransformerResolver |
|
| 0.0;0 | ||||
TransformerResolver$RegistryAction |
|
| 0.0;0 |
1 | /* | |
2 | * $Id: TransformerResolver.java 20570 2010-12-09 20:04:42Z aperepel $ | |
3 | * -------------------------------------------------------------------------------------- | |
4 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
5 | * | |
6 | * The software in this package is published under the terms of the CPAL v1.0 | |
7 | * license, a copy of which has been included with this distribution in the | |
8 | * LICENSE.txt file. | |
9 | */ | |
10 | package org.mule.api.registry; | |
11 | ||
12 | import org.mule.api.transformer.DataType; | |
13 | import org.mule.api.transformer.Transformer; | |
14 | ||
15 | /** | |
16 | * A TransformResolver is used to find transformers that match a certain criteria in the registry. | |
17 | * Implementations of this interface will use some or all of the information passed in to discover | |
18 | * a matching transformer. | |
19 | * <p/> | |
20 | * Any implementations of this interface must be registered with the registry before it will get | |
21 | * picked up. Typically this is done using the <code>registry-bootstrap.properties</code>. | |
22 | * | |
23 | * @since 3.0.0 | |
24 | */ | |
25 | public interface TransformerResolver | |
26 | { | |
27 | /** | |
28 | * Possible registry actions that occur that will trigger an event fired via {@link #transformerChange()} method. | |
29 | */ | |
30 | 0 | enum RegistryAction |
31 | { | |
32 | /** | |
33 | * signals that a transformer was added to the registry | |
34 | */ | |
35 | 0 | ADDED, |
36 | /** | |
37 | * signals that a transformer was removed from the registry | |
38 | */ | |
39 | 0 | REMOVED |
40 | } | |
41 | ||
42 | /** | |
43 | * Responsible for finding a transformer with the given criteria. Note that if a transformer | |
44 | * is not found null should be return, an exception must NOT be thrown. | |
45 | * | |
46 | * @param source information about the source object including the object iself | |
47 | * @param result information about the result object to transform to | |
48 | * @return a transformer from the registry that matches the criteria or null if a transformer was not found | |
49 | * @throws ResolverException Only thrown if an exception is thrown during the search, this exception will just be a wrapper | |
50 | */ | |
51 | Transformer resolve(DataType<?> source, DataType<?> result) throws ResolverException; | |
52 | ||
53 | /** | |
54 | * A callback that is called when a transformer is registered or unregistered from the registry. | |
55 | * This is used in situations where the resolver caches transformers and the cache needs to be | |
56 | * updated. | |
57 | * | |
58 | * @param transformer the transformer that has changed | |
59 | * @param registryAction whether the transformer was added or removed | |
60 | */ | |
61 | void transformerChange(Transformer transformer, RegistryAction registryAction); | |
62 | } |