
com.kumuluz.ee.jpa.eclipselink.JpaComponent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kumuluzee-jpa-eclipselink Show documentation
Show all versions of kumuluzee-jpa-eclipselink Show documentation
KumuluzEE JPA component implemented by EclipseLink
/*
* Copyright (c) 2014-2017 Kumuluz and/or its affiliates
* and other contributors as indicated by the @author tags and
* the contributor list.
*
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/MIT
*
* The software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND, express or
* implied, including but not limited to the warranties of merchantability,
* fitness for a particular purpose and noninfringement. in no event shall the
* authors or copyright holders be liable for any claim, damages or other
* liability, whether in an action of contract, tort or otherwise, arising from,
* out of or in connection with the software or the use or other dealings in the
* software. See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.kumuluz.ee.jpa.eclipselink;
import com.kumuluz.ee.common.Component;
import com.kumuluz.ee.common.config.EeConfig;
import com.kumuluz.ee.common.dependencies.EeComponentDef;
import com.kumuluz.ee.common.dependencies.EeComponentType;
import com.kumuluz.ee.common.runtime.EeRuntime;
import com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;
import com.kumuluz.ee.jpa.common.PersistenceUnitHolder;
import java.util.logging.Logger;
/**
* @author Tilen Faganel
* @since 1.0.0
*/
@EeComponentDef(name = "EclipseLink", type = EeComponentType.JPA)
public class JpaComponent implements Component {
private Logger log = Logger.getLogger(JpaComponent.class.getSimpleName());
@Override
public void init(KumuluzServerWrapper server, EeConfig eeConfig) {
PersistenceUnitHolder holder = PersistenceUnitHolder.getInstance();
// Check if JTA is present in the runtime
Boolean jtaPresent = EeRuntime.getInstance().getEeComponents().stream().anyMatch(c -> c.getType().equals(EeComponentType.JTA));
holder.setProviderProperties(new EclipseLinkSettings(jtaPresent));
}
@Override
public void load() {
log.info("Initiating EclipseLink");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy