All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.openejb.jee.Interceptor Maven / Gradle / Ivy

The newest version!
/**
 *
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package org.apache.openejb.jee;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * ejb-jar_3_1.xsd
 * 

*

Java class for interceptorType complex type. *

*

The following schema fragment specifies the expected content contained within this class. *

*

 * <complexType name="interceptorType">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="description" type="{http://java.sun.com/xml/ns/javaee}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="interceptor-class" type="{http://java.sun.com/xml/ns/javaee}fully-qualified-classType"/>
 *         <element name="around-invoke" type="{http://java.sun.com/xml/ns/javaee}around-invokeType" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="around-timeout" type="{http://java.sun.com/xml/ns/javaee}around-timeoutType" maxOccurs="unbounded" minOccurs="0"/>
 *         <group ref="{http://java.sun.com/xml/ns/javaee}jndiEnvironmentRefsGroup"/>
 *         <element name="post-activate" type="{http://java.sun.com/xml/ns/javaee}lifecycle-callbackType" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="pre-passivate" type="{http://java.sun.com/xml/ns/javaee}lifecycle-callbackType" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *       <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}ID" />
 *     </restriction>
 *   </complexContent>
 * </complexType>
 * 
*/ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "interceptorType", propOrder = { "descriptions", "interceptorClass", "aroundInvoke", "aroundTimeout", "envEntry", "ejbRef", "ejbLocalRef", "serviceRef", "resourceRef", "resourceEnvRef", "messageDestinationRef", "persistenceContextRef", "persistenceUnitRef", "postConstruct", "preDestroy", "dataSource", "postActivate", "prePassivate", "afterBegin", "beforeCompletion", "afterCompletion" }) public class Interceptor implements JndiConsumer, Session { @XmlTransient protected TextMap description = new TextMap(); @XmlElement(name = "interceptor-class", required = true) protected String interceptorClass; @XmlElement(name = "around-invoke", required = true) protected List aroundInvoke; @XmlElement(name = "around-timeout") protected List aroundTimeout; @XmlElement(name = "env-entry", required = true) protected KeyedCollection envEntry; @XmlElement(name = "ejb-ref", required = true) protected KeyedCollection ejbRef; @XmlElement(name = "ejb-local-ref", required = true) protected KeyedCollection ejbLocalRef; @XmlElement(name = "service-ref", required = true) protected KeyedCollection serviceRef; @XmlElement(name = "resource-ref", required = true) protected KeyedCollection resourceRef; @XmlElement(name = "resource-env-ref", required = true) protected KeyedCollection resourceEnvRef; @XmlElement(name = "message-destination-ref", required = true) protected KeyedCollection messageDestinationRef; @XmlElement(name = "persistence-context-ref", required = true) protected KeyedCollection persistenceContextRef; @XmlElement(name = "persistence-unit-ref", required = true) protected KeyedCollection persistenceUnitRef; @XmlElement(name = "data-source", required = true) protected KeyedCollection dataSource; @XmlElement(name = "post-construct", required = true) protected List postConstruct; @XmlElement(name = "pre-destroy", required = true) protected List preDestroy; @XmlElement(name = "post-activate", required = true) protected List postActivate; @XmlElement(name = "pre-passivate", required = true) protected List prePassivate; @XmlElement(name = "after-begin", required = true) protected List afterBegin; @XmlElement(name = "before-completion", required = true) protected List beforeCompletion; @XmlElement(name = "after-completion", required = true) protected List afterCompletion; @XmlAttribute @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlID protected String id; public Interceptor() { } public Interceptor(final Class interceptorClass) { this.interceptorClass = interceptorClass.getName(); } public Interceptor(final String interceptorClass) { this.interceptorClass = interceptorClass; } public String getJndiConsumerName() { if (interceptorClass == null) { return null; } return interceptorClass.replaceAll(".*\\.", ""); } @XmlElement(name = "description", required = true) public Text[] getDescriptions() { return description.toArray(); } public void setDescriptions(final Text[] text) { description.set(text); } public String getDescription() { return description.get(); } public String getInterceptorClass() { return interceptorClass; } public void setInterceptorClass(final String value) { this.interceptorClass = value; } public List getAroundInvoke() { if (aroundInvoke == null) { aroundInvoke = new ArrayList(); } return this.aroundInvoke; } public void addAroundInvoke(final String method) { assert interceptorClass != null : "Set the interceptorClass before calling this method"; getAroundInvoke().add(new AroundInvoke(interceptorClass, method)); } public List getAroundTimeout() { if (aroundTimeout == null) { aroundTimeout = new ArrayList(); } return this.aroundTimeout; } public Collection getEnvEntry() { if (envEntry == null) { envEntry = new KeyedCollection(); } return this.envEntry; } public Map getEnvEntryMap() { if (envEntry == null) { envEntry = new KeyedCollection(); } return this.envEntry.toMap(); } public Collection getEjbRef() { if (ejbRef == null) { ejbRef = new KeyedCollection(); } return this.ejbRef; } public Map getEjbRefMap() { if (ejbRef == null) { ejbRef = new KeyedCollection(); } return this.ejbRef.toMap(); } public Collection getEjbLocalRef() { if (ejbLocalRef == null) { ejbLocalRef = new KeyedCollection(); } return this.ejbLocalRef; } public Map getEjbLocalRefMap() { if (ejbLocalRef == null) { ejbLocalRef = new KeyedCollection(); } return this.ejbLocalRef.toMap(); } public Collection getServiceRef() { if (serviceRef == null) { serviceRef = new KeyedCollection(); } return this.serviceRef; } public Map getServiceRefMap() { if (serviceRef == null) { serviceRef = new KeyedCollection(); } return this.serviceRef.toMap(); } public Collection getResourceRef() { if (resourceRef == null) { resourceRef = new KeyedCollection(); } return this.resourceRef; } public Map getResourceRefMap() { if (resourceRef == null) { resourceRef = new KeyedCollection(); } return this.resourceRef.toMap(); } public Collection getResourceEnvRef() { if (resourceEnvRef == null) { resourceEnvRef = new KeyedCollection(); } return this.resourceEnvRef; } public Map getResourceEnvRefMap() { if (resourceEnvRef == null) { resourceEnvRef = new KeyedCollection(); } return this.resourceEnvRef.toMap(); } public Collection getMessageDestinationRef() { if (messageDestinationRef == null) { messageDestinationRef = new KeyedCollection(); } return this.messageDestinationRef; } public Map getMessageDestinationRefMap() { if (messageDestinationRef == null) { messageDestinationRef = new KeyedCollection(); } return this.messageDestinationRef.toMap(); } public Collection getPersistenceContextRef() { if (persistenceContextRef == null) { persistenceContextRef = new KeyedCollection(); } return this.persistenceContextRef; } public Map getPersistenceContextRefMap() { if (persistenceContextRef == null) { persistenceContextRef = new KeyedCollection(); } return this.persistenceContextRef.toMap(); } public Collection getPersistenceUnitRef() { if (persistenceUnitRef == null) { persistenceUnitRef = new KeyedCollection(); } return this.persistenceUnitRef; } public Map getPersistenceUnitRefMap() { if (persistenceUnitRef == null) { persistenceUnitRef = new KeyedCollection(); } return this.persistenceUnitRef.toMap(); } @Override public Collection getDataSource() { if (dataSource == null) { dataSource = new KeyedCollection(); } return this.dataSource; } @Override public Map getDataSourceMap() { if (dataSource == null) { dataSource = new KeyedCollection(); } return this.dataSource.toMap(); } public List getPostConstruct() { if (postConstruct == null) { postConstruct = new ArrayList(); } return this.postConstruct; } public void addPostConstruct(final String method) { assert interceptorClass != null : "Set the interceptorClass before calling this method"; getPostConstruct().add(new LifecycleCallback(interceptorClass, method)); } public List getPreDestroy() { if (preDestroy == null) { preDestroy = new ArrayList(); } return this.preDestroy; } public void addPreDestroy(final String method) { assert interceptorClass != null : "Set the interceptorClass before calling this method"; getPreDestroy().add(new LifecycleCallback(interceptorClass, method)); } public List getPostActivate() { if (postActivate == null) { postActivate = new ArrayList(); } return this.postActivate; } public void addPostActivate(final String method) { assert interceptorClass != null : "Set the interceptorClass before calling this method"; getPostActivate().add(new LifecycleCallback(interceptorClass, method)); } public List getPrePassivate() { if (prePassivate == null) { prePassivate = new ArrayList(); } return this.prePassivate; } public void addPrePassivate(final String method) { assert interceptorClass != null : "Set the interceptorClass before calling this method"; getPrePassivate().add(new LifecycleCallback(interceptorClass, method)); } public void addAfterBegin(final String method) { assert interceptorClass != null : "Set the interceptorClass before calling this method"; getAfterBegin().add(new LifecycleCallback(interceptorClass, method)); } public void addAfterCompletion(final String method) { assert interceptorClass != null : "Set the interceptorClass before calling this method"; getAfterCompletion().add(new LifecycleCallback(interceptorClass, method)); } public void addBeforeCompletion(final String method) { assert interceptorClass != null : "Set the interceptorClass before calling this method"; getBeforeCompletion().add(new LifecycleCallback(interceptorClass, method)); } public List getAfterBegin() { if (afterBegin == null) { afterBegin = new ArrayList(); } return this.afterBegin; } public List getAfterCompletion() { if (afterCompletion == null) { afterCompletion = new ArrayList(); } return this.afterCompletion; } public List getBeforeCompletion() { if (beforeCompletion == null) { beforeCompletion = new ArrayList(); } return this.beforeCompletion; } public List getInitMethod() { return new ArrayList(); } public List getRemoveMethod() { return new ArrayList(); } public String getId() { return id; } public void setId(final String value) { this.id = value; } public void addAroundTimeout(final String method) { assert interceptorClass != null : "Set the interceptorClass before calling this method"; getAroundTimeout().add(new AroundTimeout(interceptorClass, method)); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy