/* */ package org.jboss.metadata;
/* */
/* */ import java.lang.reflect.Method;
/* */ import java.util.ArrayList;
/* */ import java.util.Collection;
/* */ import java.util.Iterator;
/* */ import java.util.Set;
/* */ import java.util.concurrent.ConcurrentHashMap;
/* */ import javax.ejb.TransactionAttributeType;
/* */ import org.jboss.invocation.InvocationType;
/* */ import org.jboss.metadata.ejb.jboss.ContainerConfigurationMetaData;
/* */ import org.jboss.metadata.ejb.jboss.IORSecurityConfigMetaData;
/* */ import org.jboss.metadata.ejb.jboss.InvokerBindingMetaData;
/* */ import org.jboss.metadata.ejb.jboss.InvokerBindingsMetaData;
/* */ import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
/* */ import org.jboss.metadata.ejb.jboss.JBossMetaData;
/* */ import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
/* */ import org.jboss.metadata.ejb.spec.ContainerTransactionsMetaData;
/* */ import org.jboss.metadata.ejb.spec.ExcludeListMetaData;
/* */ import org.jboss.metadata.ejb.spec.MethodInterfaceType;
/* */ import org.jboss.metadata.ejb.spec.MethodPermissionsMetaData;
/* */ import org.jboss.metadata.javaee.spec.EJBLocalReferenceMetaData;
/* */ import org.jboss.metadata.javaee.spec.EJBLocalReferencesMetaData;
/* */ import org.jboss.metadata.javaee.spec.EJBReferenceMetaData;
/* */ import org.jboss.metadata.javaee.spec.EJBReferencesMetaData;
/* */ import org.jboss.metadata.javaee.spec.EnvironmentEntriesMetaData;
/* */ import org.jboss.metadata.javaee.spec.EnvironmentEntryMetaData;
/* */ import org.jboss.metadata.javaee.spec.MessageDestinationReferenceMetaData;
/* */ import org.jboss.metadata.javaee.spec.MessageDestinationReferencesMetaData;
/* */ import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferenceMetaData;
/* */ import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferencesMetaData;
/* */ import org.jboss.metadata.javaee.spec.ResourceReferenceMetaData;
/* */ import org.jboss.metadata.javaee.spec.ResourceReferencesMetaData;
/* */ import org.jboss.metadata.javaee.spec.ServiceReferenceMetaData;
/* */ import org.jboss.metadata.javaee.spec.ServiceReferencesMetaData;
/* */ import org.jboss.metadata.spi.MetaData;
/* */
/* */ @Deprecated
/* */ public abstract class BeanMetaData extends OldMetaData<JBossEnterpriseBeanMetaData>
/* */ {
/* */ public static final char SESSION_TYPE = 'S';
/* */ public static final char ENTITY_TYPE = 'E';
/* */ public static final char MDB_TYPE = 'M';
/* */ public static final String LOCAL_INVOKER_PROXY_BINDING = "LOCAL";
/* 92 */ private ConcurrentHashMap<Method, Byte> methodTx = new ConcurrentHashMap();
/* */ private ApplicationMetaData applicationMetaData;
/* */
/* */ public static BeanMetaData create(ApplicationMetaData app, JBossEnterpriseBeanMetaData delegate)
/* */ {
/* 106 */ if (delegate == null)
/* 107 */ throw new IllegalArgumentException("Null delegate");
/* 108 */ if (delegate.isSession())
/* 109 */ return new SessionMetaData(app, delegate);
/* 110 */ if (delegate.isMessageDriven())
/* 111 */ return new MessageDrivenMetaData(app, delegate);
/* 112 */ if (delegate.isEntity())
/* 113 */ return new EntityMetaData(app, delegate);
/* 114 */ throw new IllegalArgumentException("Unknown delegate: " + delegate);
/* */ }
/* */
/* */ protected BeanMetaData(ApplicationMetaData app, JBossEnterpriseBeanMetaData delegate)
/* */ {
/* 125 */ super(delegate);
/* 126 */ this.applicationMetaData = app;
/* */ }
/* */
/* */ protected BeanMetaData(MetaData metaData)
/* */ {
/* 138 */ super(metaData, JBossEnterpriseBeanMetaData.class);
/* */ }
/* */
/* */ public boolean isSession()
/* */ {
/* 148 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).isSession();
/* */ }
/* */
/* */ public boolean isMessageDriven()
/* */ {
/* 158 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).isMessageDriven();
/* */ }
/* */
/* */ public boolean isEntity()
/* */ {
/* 168 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).isEntity();
/* */ }
/* */
/* */ public String getEjbName()
/* */ {
/* 178 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).getEjbName();
/* */ }
/* */
/* */ public abstract String getHome();
/* */
/* */ public abstract String getRemote();
/* */
/* */ public abstract String getLocalHome();
/* */
/* */ public abstract String getLocal();
/* */
/* */ public abstract String getServiceEndpoint();
/* */
/* */ public String getEjbClass()
/* */ {
/* 223 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).getEjbClass();
/* */ }
/* */
/* */ public boolean isContainerManagedTx()
/* */ {
/* 233 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).isCMT();
/* */ }
/* */
/* */ public boolean isBeanManagedTx()
/* */ {
/* 243 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).isBMT();
/* */ }
/* */
/* */ public Iterator<EjbRefMetaData> getEjbReferences()
/* */ {
/* 253 */ EJBReferencesMetaData ejbRefs = ((JBossEnterpriseBeanMetaData)getDelegate()).getEjbReferences();
/* 254 */ return new OldMetaDataIterator(ejbRefs, EJBReferenceMetaData.class, EjbRefMetaData.class);
/* */ }
/* */
/* */ public Iterator<EjbLocalRefMetaData> getEjbLocalReferences()
/* */ {
/* 264 */ EJBLocalReferencesMetaData ejbLocalRefs = ((JBossEnterpriseBeanMetaData)getDelegate()).getEjbLocalReferences();
/* 265 */ return new OldMetaDataIterator(ejbLocalRefs, EJBLocalReferenceMetaData.class, EjbLocalRefMetaData.class);
/* */ }
/* */
/* */ public EjbRefMetaData getEjbRefByName(String name)
/* */ {
/* 277 */ EJBReferenceMetaData result = ((JBossEnterpriseBeanMetaData)getDelegate()).getEjbReferenceByName(name);
/* 278 */ if (result != null)
/* 279 */ return new EjbRefMetaData(result);
/* 280 */ return null;
/* */ }
/* */
/* */ public EjbLocalRefMetaData getEjbLocalRefByName(String name)
/* */ {
/* 292 */ EJBLocalReferenceMetaData result = ((JBossEnterpriseBeanMetaData)getDelegate()).getEjbLocalReferenceByName(name);
/* 293 */ if (result != null)
/* 294 */ return new EjbLocalRefMetaData(result);
/* 295 */ return null;
/* */ }
/* */
/* */ public Iterator<EnvEntryMetaData> getEnvironmentEntries()
/* */ {
/* 305 */ EnvironmentEntriesMetaData result = ((JBossEnterpriseBeanMetaData)getDelegate()).getEnvironmentEntries();
/* 306 */ return new OldMetaDataIterator(result, EnvironmentEntryMetaData.class, EnvEntryMetaData.class);
/* */ }
/* */
/* */ public abstract Iterator<SecurityRoleRefMetaData> getSecurityRoleReferences();
/* */
/* */ public Iterator<ResourceRefMetaData> getResourceReferences()
/* */ {
/* 323 */ ResourceReferencesMetaData result = ((JBossEnterpriseBeanMetaData)getDelegate()).getResourceReferences();
/* 324 */ return new OldMetaDataIterator(result, ResourceReferenceMetaData.class, ResourceRefMetaData.class);
/* */ }
/* */
/* */ public Iterator<ResourceEnvRefMetaData> getResourceEnvReferences()
/* */ {
/* 334 */ ResourceEnvironmentReferencesMetaData result = ((JBossEnterpriseBeanMetaData)getDelegate()).getResourceEnvironmentReferences();
/* 335 */ return new OldMetaDataIterator(result, ResourceEnvironmentReferenceMetaData.class, ResourceEnvRefMetaData.class);
/* */ }
/* */
/* */ public Iterator<MessageDestinationRefMetaData> getMessageDestinationReferences()
/* */ {
/* 345 */ MessageDestinationReferencesMetaData result = ((JBossEnterpriseBeanMetaData)getDelegate()).getMessageDestinationReferences();
/* 346 */ return new OldMetaDataIterator(result, MessageDestinationReferenceMetaData.class, MessageDestinationRefMetaData.class);
/* */ }
/* */
/* */ public Iterator<ServiceReferenceMetaData> getServiceReferences()
/* */ {
/* 356 */ ServiceReferencesMetaData result = ((JBossEnterpriseBeanMetaData)getDelegate()).getServiceReferences();
/* 357 */ return result != null ? result.iterator() : new ArrayList().iterator();
/* */ }
/* */
/* */ public SecurityIdentityMetaData getSecurityIdentityMetaData()
/* */ {
/* 367 */ org.jboss.metadata.ejb.spec.SecurityIdentityMetaData securityIdentity = ((JBossEnterpriseBeanMetaData)getDelegate()).getSecurityIdentity();
/* 368 */ if (securityIdentity != null)
/* 369 */ return new SecurityIdentityMetaData(securityIdentity);
/* 370 */ return null;
/* */ }
/* */
/* */ public Iterator<MethodMetaData> getTransactionMethods()
/* */ {
/* 380 */ ContainerTransactionsMetaData transactions = ((JBossEnterpriseBeanMetaData)getDelegate()).getContainerTransactions();
/* 381 */ return new TransactionMethodMetaDataIterator(transactions);
/* */ }
/* */
/* */ public byte getMethodTransactionType(String methodName, Class[] params, InvocationType iface)
/* */ {
/* 394 */ TransactionAttributeType type = ((JBossEnterpriseBeanMetaData)getDelegate()).getMethodTransactionType(methodName, params, invocationTypeToMethodInterfaceType(iface));
/* 395 */ return mapTransactionType(type);
/* */ }
/* */
/* */ public byte getTransactionMethod(Method m, InvocationType iface)
/* */ {
/* 407 */ if (m == null) {
/* 408 */ return 2;
/* */ }
/* 410 */ Byte b = (Byte)this.methodTx.get(m);
/* 411 */ if (b != null) {
/* 412 */ return b.byteValue();
/* */ }
/* 414 */ TransactionAttributeType type = ((JBossEnterpriseBeanMetaData)getDelegate()).getMethodTransactionType(m, invocationTypeToMethodInterfaceType(iface));
/* 415 */ byte result = mapTransactionType(type);
/* */
/* 418 */ if (result == 6) {
/* 419 */ result = 1;
/* */ }
/* 421 */ this.methodTx.put(m, Byte.valueOf(result));
/* 422 */ return result;
/* */ }
/* */
/* */ public Iterator<MethodMetaData> getPermissionMethods()
/* */ {
/* 432 */ MethodPermissionsMetaData methodPermissions = ((JBossEnterpriseBeanMetaData)getDelegate()).getMethodPermissions();
/* 433 */ return new PermissionMethodMetaDataIterator(methodPermissions);
/* */ }
/* */
/* */ public EjbPortComponentMetaData getPortComponent()
/* */ {
/* 438 */ JBossMetaData jmd = ((JBossEnterpriseBeanMetaData)getDelegate()).getJBossMetaDataWithCheck();
/* 439 */ JBossSessionBeanMetaData jebmd = (JBossSessionBeanMetaData)jmd.getEnterpriseBean(getEjbName());
/* 440 */ return new EjbPortComponentMetaData(jebmd.getPortComponent());
/* */ }
/* */
/* */ public Iterator<MethodMetaData> getExcludedMethods()
/* */ {
/* 450 */ ExcludeListMetaData excluded = ((JBossEnterpriseBeanMetaData)getDelegate()).getExcludeList();
/* 451 */ return new ExcludedMethodMetaDataIterator(excluded);
/* */ }
/* */
/* */ public Set<String> getMethodPermissions(String methodName, Class[] params, InvocationType iface)
/* */ {
/* 470 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).getMethodPermissions(methodName, params, invocationTypeToMethodInterfaceType(iface));
/* */ }
/* */
/* */ public boolean hasMethodPermission(String methodName, Class[] params, InvocationType iface)
/* */ {
/* 484 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).hasMethodPermissions(methodName, params, invocationTypeToMethodInterfaceType(iface));
/* */ }
/* */
/* */ public boolean isExcludeMissingMethods()
/* */ {
/* 494 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).getJBossMetaDataWithCheck().isExcludeMissingMethods();
/* */ }
/* */
/* */ public ApplicationMetaData getApplicationMetaData()
/* */ {
/* 504 */ if (this.applicationMetaData == null)
/* 505 */ throw new IllegalStateException("ApplicationMetaData has not been initialized.");
/* 506 */ return this.applicationMetaData;
/* */ }
/* */
/* */ public Iterator<String> getInvokerBindings()
/* */ {
/* 516 */ InvokerBindingsMetaData invokerBindings = ((JBossEnterpriseBeanMetaData)getDelegate()).determineInvokerBindings();
/* 517 */ return new InvokerBindingsIterator(invokerBindings);
/* */ }
/* */
/* */ public String getInvokerBinding(String invokerName)
/* */ {
/* 528 */ InvokerBindingMetaData binding = ((JBossEnterpriseBeanMetaData)getDelegate()).determineInvokerBinding(invokerName);
/* 529 */ String bindingName = binding.getJndiName();
/* 530 */ if (bindingName == null)
/* */ {
/* 532 */ bindingName = isMessageDriven() ? getEjbName() : getJndiName();
/* */ }
/* 534 */ return bindingName;
/* */ }
/* */
/* */ public abstract String getJndiName();
/* */
/* */ public String getLocalJndiName()
/* */ {
/* 552 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).determineLocalJndiName();
/* */ }
/* */
/* */ public String getContainerObjectNameJndiName()
/* */ {
/* 562 */ return getHome() != null ? getJndiName() : getLocalJndiName();
/* */ }
/* */
/* */ public String getConfigurationName()
/* */ {
/* 572 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).determineConfigurationName();
/* */ }
/* */
/* */ public ConfigurationMetaData getContainerConfiguration()
/* */ {
/* 583 */ ContainerConfigurationMetaData containerConfigurationMetaData = ((JBossEnterpriseBeanMetaData)getDelegate()).determineContainerConfiguration();
/* 584 */ return new ConfigurationMetaData(containerConfigurationMetaData);
/* */ }
/* */
/* */ public String getSecurityProxy()
/* */ {
/* 594 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).getSecurityProxy();
/* */ }
/* */
/* */ public abstract SecurityIdentityMetaData getEjbTimeoutIdentity();
/* */
/* */ public String getDefaultConfigurationName()
/* */ {
/* 611 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).getDefaultConfigurationName();
/* */ }
/* */
/* */ public Collection<String> getDepends()
/* */ {
/* 621 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).determineAllDepends();
/* */ }
/* */
/* */ public boolean isMethodReadOnly(String methodName)
/* */ {
/* 632 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).isMethodReadOnly(methodName);
/* */ }
/* */
/* */ public boolean isMethodReadOnly(Method method)
/* */ {
/* 643 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).isMethodReadOnly(method);
/* */ }
/* */
/* */ public int getTransactionTimeout(String methodName)
/* */ {
/* 654 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).getMethodTransactionTimeout(methodName);
/* */ }
/* */
/* */ public int getTransactionTimeout(Method method)
/* */ {
/* 665 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).getMethodTransactionTimeout(method);
/* */ }
/* */
/* */ public abstract boolean isClustered();
/* */
/* */ public abstract boolean isCallByValue();
/* */
/* */ public abstract ClusterConfigMetaData getClusterConfigMetaData();
/* */
/* */ public IorSecurityConfigMetaData getIorSecurityConfigMetaData()
/* */ {
/* 696 */ IORSecurityConfigMetaData config = ((JBossEnterpriseBeanMetaData)getDelegate()).getIorSecurityConfig();
/* 697 */ if (config == null)
/* 698 */ return null;
/* 699 */ return new IorSecurityConfigMetaData(config);
/* */ }
/* */
/* */ public boolean getExceptionRollback()
/* */ {
/* 709 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).isExceptionOnRollback();
/* */ }
/* */
/* */ public boolean getTimerPersistence()
/* */ {
/* 719 */ return ((JBossEnterpriseBeanMetaData)getDelegate()).isTimerPersistence();
/* */ }
/* */
/* */ static MethodInterfaceType invocationTypeToMethodInterfaceType(InvocationType type)
/* */ {
/* 741 */ if (type == null)
/* 742 */ return null;
/* 743 */ if (type == InvocationType.REMOTE)
/* 744 */ return MethodInterfaceType.Remote;
/* 745 */ if (type == InvocationType.LOCAL)
/* 746 */ return MethodInterfaceType.Local;
/* 747 */ if (type == InvocationType.HOME)
/* 748 */ return MethodInterfaceType.Home;
/* 749 */ if (type == InvocationType.LOCALHOME)
/* 750 */ return MethodInterfaceType.LocalHome;
/* 751 */ if (type == InvocationType.SERVICE_ENDPOINT)
/* 752 */ return MethodInterfaceType.ServiceEndpoint;
/* 753 */ throw new IllegalArgumentException("Unexpected invocation type: " + type);
/* */ }
/* */
/* */ static byte mapTransactionType(TransactionAttributeType type)
/* */ {
/* 764 */ if (type == null)
/* 765 */ return 6;
/* 766 */ switch (1.$SwitchMap$javax$ejb$TransactionAttributeType[type.ordinal()])
/* */ {
/* */ case 1:
/* 769 */ return 0;
/* */ case 2:
/* 771 */ return 2;
/* */ case 3:
/* 773 */ return 3;
/* */ case 4:
/* 775 */ return 4;
/* */ case 5:
/* 777 */ return 5;
/* */ }
/* 779 */ return 1;
/* */ }
/* */
/* */ public void addPermissionMethod(MethodMetaData method)
/* */ {
/* 791 */ throw new UnsupportedOperationException("addPermissionMethod");
/* */ }
/* */
/* */ public void addExcludedMethod(MethodMetaData method)
/* */ {
/* 802 */ throw new UnsupportedOperationException("addExcludedMethod");
/* */ }
/* */
/* */ public void addTransactionMethod(MethodMetaData method)
/* */ {
/* 813 */ throw new UnsupportedOperationException("addTransactionMethod");
/* */ }
/* */ }
/* Location: /home/mnovotny/projects/EMBEDDED_JBOSS_BETA3_COMMUNITY/embedded/output/lib/embedded-jboss/lib/jboss-embedded-all.jar
* Qualified Name: org.jboss.metadata.BeanMetaData
* JD-Core Version: 0.6.0
*/