[jboss-cvs] JBossAS SVN: r70961 - in projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3: security and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Mar 18 15:49:55 EDT 2008
Author: anil.saldhana at jboss.com
Date: 2008-03-18 15:49:55 -0400 (Tue, 18 Mar 2008)
New Revision: 70961
Added:
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/security/bridge/
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/security/bridge/SecurityDomainMetaDataBridge.java
Modified:
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/aop/BeanContainer.java
Log:
EJBTHREE-1225: security domain metadata bridge
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/aop/BeanContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/aop/BeanContainer.java 2008-03-18 19:33:27 UTC (rev 70960)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/aop/BeanContainer.java 2008-03-18 19:49:55 UTC (rev 70961)
@@ -49,6 +49,7 @@
import org.jboss.ejb3.interceptors.metadata.InterceptorMetaDataBridge;
import org.jboss.ejb3.metadata.MetaDataBridge;
import org.jboss.ejb3.metadata.annotation.AnnotationRepositoryToMetaData;
+import org.jboss.ejb3.security.bridge.SecurityDomainMetaDataBridge;
import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
import org.jboss.metadata.ejb.spec.InterceptorMetaData;
@@ -240,6 +241,8 @@
annotations.addComponentMetaDataLoaderFactory(new InterceptorComponentMetaDataLoaderFactory(interceptorBridges));
annotations.addMetaDataBridge(new AdditiveBeanInterceptorMetaDataBridge(beanClass));
+ //Add a security domain bridge
+ annotations.addMetaDataBridge(new SecurityDomainMetaDataBridge());
// Ensure that an @Clustered annotation is visible to AOP if the XML says the bean is clustered.
annotations.addMetaDataBridge(new ClusteredMetaDataBridge());
Added: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/security/bridge/SecurityDomainMetaDataBridge.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/security/bridge/SecurityDomainMetaDataBridge.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/security/bridge/SecurityDomainMetaDataBridge.java 2008-03-18 19:49:55 UTC (rev 70961)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.security.bridge;
+
+import java.lang.annotation.Annotation;
+
+import org.jboss.ejb3.annotation.SecurityDomain;
+import org.jboss.ejb3.annotation.impl.SecurityDomainImpl;
+import org.jboss.ejb3.metadata.MetaDataBridge;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+
+/**
+ * Meta data bridge to return the SecurityDomain Annotation
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @author Anil.Saldhana at jboss.com
+ * @version $Revision: 68904 $
+ */
+public class SecurityDomainMetaDataBridge implements MetaDataBridge<JBossEnterpriseBeanMetaData>
+{
+ public <A extends Annotation> A retrieveAnnotation(Class<A> annotationClass, JBossEnterpriseBeanMetaData beanMetaData, ClassLoader classLoader)
+ {
+ if (annotationClass == SecurityDomain.class)
+ {
+ String securityDomain = beanMetaData.getSecurityDomain();
+ //TODO: How to get the merged meta data? Is the following line correct?
+ if(securityDomain == null)
+ securityDomain = beanMetaData.getJBossMetaData().getSecurityDomain();
+ if (securityDomain != null)
+ return annotationClass.cast(new SecurityDomainImpl(securityDomain));
+ }
+ return null;
+ }
+
+ public <A extends Annotation> A retrieveAnnotation(Class<A> annotationClass, JBossEnterpriseBeanMetaData beanMetaData, ClassLoader classLoader, String methodName, String... parameterNames)
+ {
+ return null;
+ }
+}
More information about the jboss-cvs-commits
mailing list