com.oracle.coherence.cdi.server.BeanProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of coherence-cdi-server Show documentation
Show all versions of coherence-cdi-server Show documentation
CDI-enabled Coherence Server
/*
* Copyright (c) 2020, 2021 Oracle and/or its affiliates.
*
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
package com.oracle.coherence.cdi.server;
import com.oracle.coherence.common.base.Logger;
import com.tangosol.config.ConfigurationException;
import com.tangosol.config.xml.ElementProcessor;
import com.tangosol.config.xml.ProcessingContext;
import com.tangosol.config.xml.XmlSimpleName;
import com.tangosol.run.xml.XmlElement;
import javax.enterprise.inject.spi.CDI;
/**
* Element processor for {@code } XML element.
*
* @author Aleks Seovic 2019.10.02
* @since 20.06
*/
@XmlSimpleName("bean")
public class BeanProcessor
implements ElementProcessor
{
public BeanProcessor()
{
try
{
m_cdi = CDI.current();
}
catch (Throwable thrown)
{
Logger.err("Error obtaining CDI", thrown);
}
}
@Override
public BeanBuilder process(ProcessingContext context, XmlElement element)
throws ConfigurationException
{
return context.inject(new BeanBuilder(m_cdi, element.getString()), element);
}
void setCDI(CDI