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

org.apache.openejb.jee.AssemblyDescriptor 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.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.LinkedHashMap;
import java.util.List;
import java.util.Map;


/**
 * ejb-jar_3_1.xsd
 * 

*

*

Java class for assembly-descriptorType complex type. *

*

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

*

 * <complexType name="assembly-descriptorType">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="security-role" type="{http://java.sun.com/xml/ns/javaee}security-roleType" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="method-permission" type="{http://java.sun.com/xml/ns/javaee}method-permissionType" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="container-transaction" type="{http://java.sun.com/xml/ns/javaee}container-transactionType" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="interceptor-binding" type="{http://java.sun.com/xml/ns/javaee}interceptor-bindingType" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="message-destination" type="{http://java.sun.com/xml/ns/javaee}message-destinationType" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="exclude-list" type="{http://java.sun.com/xml/ns/javaee}exclude-listType" minOccurs="0"/>
 *         <element name="application-exception" type="{http://java.sun.com/xml/ns/javaee}application-exceptionType" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *       <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}ID" />
 *     </restriction>
 *   </complexContent>
 * </complexType>
 * 
*/ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "assembly-descriptorType", propOrder = { "securityRole", "methodPermission", "containerTransaction", //TODO moved out of assembly descriptor in schema "containerConcurrency", "interceptorBinding", "messageDestination", "excludeList", "applicationException" }) public class AssemblyDescriptor { @XmlElement(name = "security-role", required = true) protected List securityRole; @XmlElement(name = "method-permission", required = true) protected List methodPermission; @XmlElement(name = "container-transaction", required = true) protected List containerTransaction; //TODO moved out of assembly descriptor in schema @XmlElement(name = "container-concurrency", required = true) protected List containerConcurrency; @XmlElement(name = "interceptor-binding", required = true) protected List interceptorBinding; @XmlElement(name = "message-destination", required = true) protected List messageDestination; @XmlElement(name = "exclude-list") protected ExcludeList excludeList; @XmlElement(name = "application-exception", required = true) protected KeyedCollection applicationException; @XmlAttribute @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlID protected String id; public List getSecurityRole() { if (securityRole == null) { securityRole = new ArrayList(); } return this.securityRole; } public List getMethodPermission() { if (methodPermission == null) { methodPermission = new ArrayList(); } return this.methodPermission; } public List getContainerTransaction() { if (containerTransaction == null) { containerTransaction = new ArrayList(); } return this.containerTransaction; } public Map> getMethodTransactionMap(final String ejbName) { return getMethodAttributes(ejbName, getContainerTransaction()); } //TODO moved out of assembly descriptor in schema public List getContainerConcurrency() { if (containerConcurrency == null) { containerConcurrency = new ArrayList(); } return this.containerConcurrency; } //TODO moved out of assembly descriptor in schema public Map> getMethodConcurrencyMap(final String ejbName) { return getMethodAttributes(ejbName, getContainerConcurrency()); } private Map> getMethodAttributes(final String ejbName, final List bindings) { final Map> methods = new LinkedHashMap>(); for (final AttributeBinding binding : bindings) { for (final Method method : binding.getMethod()) { if (method.getEjbName().equals(ejbName)) { final String methodName = method.getMethodName(); List list = methods.get(methodName); if (list == null) { list = new ArrayList(); methods.put(methodName, list); } list.add(new MethodAttribute(binding.getAttribute(), method)); } } } return methods; } public List getInterceptorBinding() { if (interceptorBinding == null) { interceptorBinding = new ArrayList(); } return this.interceptorBinding; } public InterceptorBinding addInterceptorBinding(final InterceptorBinding binding) { getInterceptorBinding().add(binding); return binding; } public List getMessageDestination() { if (messageDestination == null) { messageDestination = new ArrayList(); } return this.messageDestination; } public ExcludeList getExcludeList() { if (excludeList == null) { excludeList = new ExcludeList(); } return excludeList; } public void setExcludeList(final ExcludeList value) { this.excludeList = value; } public Collection getApplicationException() { if (applicationException == null) { applicationException = new KeyedCollection(); } return this.applicationException; } public Map getApplicationExceptionMap() { return ((KeyedCollection) getApplicationException()).toMap(); } public ApplicationException getApplicationException(final String className) { return this.getApplicationExceptionMap().get(className); } public ApplicationException getApplicationException(final Class clazz) { return getApplicationException(clazz.getName()); } public void addApplicationException(final Class clazz, final boolean rollback, final boolean inherited) { getApplicationException().add(new ApplicationException(clazz, rollback)); } public String getId() { return id; } public void setId(final String value) { this.id = value; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy