View Javadoc
1   package net.sumaris.core.dao.technical.schema;
2   
3   /*-
4    * #%L
5    * SUMARiS:: Core
6    * %%
7    * Copyright (C) 2018 - 2019 SUMARiS Consortium
8    * %%
9    * This program is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU General Public License as
11   * published by the Free Software Foundation, either version 3 of the
12   * License, or (at your option) any later version.
13   * 
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Public License for more details.
18   * 
19   * You should have received a copy of the GNU General Public
20   * License along with this program.  If not, see
21   * <http://www.gnu.org/licenses/gpl-3.0.html>.
22   * #L%
23   */
24  
25  import org.hibernate.boot.Metadata;
26  import org.hibernate.boot.model.relational.Database;
27  import org.hibernate.engine.spi.SessionFactoryImplementor;
28  import org.hibernate.integrator.spi.Integrator;
29  import org.hibernate.jpa.boot.spi.IntegratorProvider;
30  import org.hibernate.service.spi.SessionFactoryServiceRegistry;
31  
32  import java.util.List;
33  
34  public class MetadataExtractorIntegrator implements Integrator, IntegratorProvider {
35  
36      public static final MetadataExtractorIntegratoraExtractorIntegrator.html#MetadataExtractorIntegrator">MetadataExtractorIntegrator INSTANCE = new MetadataExtractorIntegrator();
37  
38      private Database database;
39  
40      private Metadata metadata;
41  
42      private SessionFactoryImplementor sessionFactory;
43  
44      public Database getDatabase() {
45          return database;
46      }
47  
48      public Metadata getMetadata() {
49          return metadata;
50      }
51  
52      public SessionFactoryImplementor getSessionFactory() {
53          return sessionFactory;
54      }
55  
56      @Override
57      public void integrate(
58              Metadata metadata,
59              SessionFactoryImplementor sessionFactory,
60              SessionFactoryServiceRegistry serviceRegistry) {
61  
62          this.database = metadata.getDatabase();
63          this.metadata = metadata;
64          this.sessionFactory = sessionFactory;
65      }
66  
67      @Override
68      public void disintegrate(
69          SessionFactoryImplementor sessionFactory,
70          SessionFactoryServiceRegistry serviceRegistry) {
71  
72      }
73  
74      @Override
75      public List<Integrator> getIntegrators() {
76          return null;
77      }
78  
79  
80  }