View Javadoc

1   package com.terradue.jcatalogue.client.internal.digester;
2   
3   /*
4    *    Copyright 2011-2012 Terradue srl
5    *
6    *    Licensed under the Apache License, Version 2.0 (the "License");
7    *    you may not use this file except in compliance with the License.
8    *    You may obtain a copy of the License at
9    *
10   *       http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *    Unless required by applicable law or agreed to in writing, software
13   *    distributed under the License is distributed on an "AS IS" BASIS,
14   *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   *    See the License for the specific language governing permissions and
16   *    limitations under the License.
17   */
18  
19  import org.apache.commons.digester3.binder.AbstractNamespaceURIBasedRulesModule;
20  
21  import com.terradue.jcatalogue.client.CatalogueDescription;
22  
23  public final class OpenSearchModule
24      extends AbstractNamespaceURIBasedRulesModule
25  {
26  
27      public OpenSearchModule()
28      {
29          super( "http://a9.com/-/spec/opensearch/1.1/" );
30      }
31  
32      @Override
33      protected void configure()
34      {
35          forPattern( "OpenSearchDescription" ).createObject().ofType( CatalogueDescription.class );
36          forPattern( "OpenSearchDescription/ShortName" ).setBeanProperty().withName( "shortName" );
37          forPattern( "OpenSearchDescription/LongName" ).setBeanProperty().withName( "longName" );
38          forPattern( "OpenSearchDescription/Description" ).setBeanProperty().withName( "description" );
39          forPattern( "OpenSearchDescription/Tags" ).setBeanProperty().withName( "tags" );
40          forPattern( "OpenSearchDescription/ShortName" ).setBeanProperty().withName( "shortName" );
41          forPattern( "OpenSearchDescription/Contact" ).setBeanProperty().withName( "contact" );
42          forPattern( "OpenSearchDescription/Developer" ).setBeanProperty().withName( "developer" );
43          forPattern( "OpenSearchDescription/Attribution" ).setBeanProperty().withName( "attribution" );
44          forPattern( "OpenSearchDescription/SyndicationRight" ).setBeanProperty().withName( "syndicationRight" );
45          forPattern( "OpenSearchDescription/AdultContent" ).setBeanProperty().withName( "adultContent" );
46          forPattern( "OpenSearchDescription/Language" ).setBeanProperty().withName( "language" );
47          forPattern( "OpenSearchDescription/InputEncoding" ).setBeanProperty().withName( "inputEncoding" );
48          forPattern( "OpenSearchDescription/OutputEncoding" ).setBeanProperty().withName( "outputEncoding" );
49  
50          forPattern( "OpenSearchDescription/Url" )
51              .factoryCreate()
52              .usingFactory( new OpenSearchUrlCreationFactory() )
53              .then()
54              .setNext( "addOpenSearchUrl" );
55      }
56  
57  }