View Javadoc

1   /*
2    * $Id:  $
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.module.xml.config;
11  
12  import org.mule.config.i18n.CoreMessages;
13  
14  import javax.xml.bind.JAXBContext;
15  
16  import org.springframework.beans.factory.config.AbstractFactoryBean;
17  
18  /**
19   * TODO
20   */
21  public class JaxbContextFactoryBean extends AbstractFactoryBean
22  {
23      private String packageNames;
24      private String name;
25  
26      @Override
27      public Class getObjectType()
28      {
29          return JAXBContext.class;
30      }
31  
32      @Override
33      protected Object createInstance() throws Exception
34      {
35          if(packageNames==null)
36          {
37              throw new IllegalArgumentException(CoreMessages.objectIsNull("packageNames").getMessage());
38          }
39          return JAXBContext.newInstance(packageNames);
40      }
41  
42      public String getPackageNames()
43      {
44          return packageNames;
45      }
46  
47      public void setPackageNames(String packageNames)
48      {
49          this.packageNames = packageNames;
50      }
51  
52      public String getName()
53      {
54          return name;
55      }
56  
57      public void setName(String name)
58      {
59          this.name = name;
60      }
61  }