]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
9a1bb24d94ca2054989d1db083e8873d6213d74b
[tmp/jakarta-migration.git] /
1 package org.collectionspace.services.advancedsearch;
2
3 import javax.xml.bind.JAXBContext;
4 import javax.xml.bind.JAXBException;
5
6 import org.collectionspace.collectionspace_core.CollectionSpaceCore;
7 import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
8 import org.collectionspace.services.collectionobject.domain.nagpra.CollectionObjectsNAGPRA;
9 import org.collectionspace.services.collectionobject.domain.naturalhistory_extension.CollectionobjectsNaturalhistory;
10
11 /**
12  * Singleton for the {@link JAXBContext} which the AdvancedSearch will use
13  * Eventually this should just be a bean which can be injected
14  * @since 8.3.0
15  */
16 public final class AdvancedSearchJAXBContext {
17         private static final AdvancedSearchJAXBContext INSTANCE = new AdvancedSearchJAXBContext();
18
19         private final JAXBContext jaxbContext;
20
21         private AdvancedSearchJAXBContext() {
22                 try {
23                         jaxbContext = JAXBContext.newInstance(CollectionSpaceCore.class, CollectionobjectsCommon.class,
24                                                               CollectionobjectsNaturalhistory.class, CollectionObjectsNAGPRA.class);
25                 } catch (JAXBException e) {
26                         throw new RuntimeException("Unable to create JAXBContext for AdvancedSearch");
27                 }
28         }
29
30         public static JAXBContext getJaxbContext() {
31                 return INSTANCE.jaxbContext;
32         }
33 }