Skip to content

Commit

Permalink
Add BeanDeploymentArchive SPI
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@2926 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
pmuir committed Jun 29, 2009
1 parent 24c3a16 commit b4db6c0
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 45 deletions.
@@ -0,0 +1,68 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* Licensed 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.jboss.webbeans.bootstrap.spi;

import java.net.URL;
import java.util.List;

/**
* Represents a CDI bean deployment archive.
*
* A bean deployment archive is any library jar, EJB jar or rar archive with a
* META-INF/beans.xml file, any WEB-INF/classes directory in war with a
* WEB-INF/beans.xml, or any directory in the classpath with a
* META-INF/beans.xml.
*
* For an application deployed as an ear, all library jars, EJB jars, rars and
* war WEB-INF/classes directories should be searched.
*
* For an application deployed as a war, all library jars and the
* WEB-INF/classes directory should be searched.
*
* @see
*
* @author Pete Muir
*
*/
public interface BeanDeploymentArchive
{

/**
* Get the ordered transitive closure of modules which are accessible to this
* module. The order will be used both in bean discovery and resolution.
*
* Circular dependencies will be detected and ignored by the container
*
* @return the ordered transitive closure
*/
public List<BeanDeploymentArchive> getBeanDeploymentArchiveClosure();

/**
* Gets all classes in the bean deployment archive
*
* @return an iteration over the classes
*/
public Iterable<Class<?>> getBeanClasses();

/**
* Get the deployment descriptor
*
* @return a URL pointing to the deployment descriptor
*/
public URL getBeansXml();

}
Expand Up @@ -26,8 +26,10 @@
* discover the beans to deploy
*
* @author Pete Muir
* @deprecated now encapsulated by {@link BeanDeploymentArchive}
*
*/
@Deprecated
public interface WebBeanDiscovery extends Service
{

Expand Down
Expand Up @@ -31,12 +31,5 @@ public interface BusinessInterfaceDescriptor<T>
* Gets the business interface class
*/
public Class<T> getInterface();

/**
* Gets the JNDI name under which the EJB is registered
*
* @return The JNDI name
*/
public String getJndiName();

}
42 changes: 42 additions & 0 deletions spi/src/main/java/org/jboss/webbeans/ejb/spi/EJBModule.java
@@ -0,0 +1,42 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* Licensed 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.jboss.webbeans.ejb.spi;

import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;

/**
* Represents an EJB bean deployment archive.
*
* If a bean deployment archive is identified as an EJB bean deployment, an
* instance of {@link EJBModule} should be returned instead of
* {@link BeanDeploymentArchive}; the Java EE container is responsible for
* identifying EJB bean deployment archives.
*
* @author Pete Muir
*
*/
public interface EJBModule extends BeanDeploymentArchive
{

/**
* Get all the EJBs in the deployment archive
*
* @return
*/
public Iterable<EjbDescriptor<?>> getEjbs();

}
24 changes: 5 additions & 19 deletions spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbDescriptor.java
Expand Up @@ -35,7 +35,7 @@ public interface EjbDescriptor<T>
*
* @return The EJB Bean class
*/
public Class<T> getType();
public Class<T> getBeanClass();

/**
* Gets the local business interfaces of the EJB
Expand All @@ -44,13 +44,6 @@ public interface EjbDescriptor<T>
*/
public Iterable<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces();

/**
* Gets the remote business interfaces of the EJB
*
* @return An iterator over the remote business interfaces
*/
public Iterable<BusinessInterfaceDescriptor<?>> getRemoteBusinessInterfaces();

/**
* Get the remove methods of the EJB
*
Expand All @@ -59,38 +52,31 @@ public interface EjbDescriptor<T>
public Iterable<Method> getRemoveMethods();

/**
* Indicates if the bean is stateless
* Indicates if the bean is a stateless session bean
*
* @return True if stateless, false otherwise
*/
public boolean isStateless();

/**
* Indicates if the bean is a EJB 3.1 Singleton
* Indicates if the bean is a EJB 3.1 Singleton session bean
*
* @return True if the bean is a singleton, false otherwise
*/
public boolean isSingleton();

/**
* Indicates if the EJB is stateful
* Indicates if the EJB is a stateful session bean
*
* @return True if the bean is stateful, false otherwise
*/
public boolean isStateful();

/**
* Indicates if the EJB is and MDB
* Indicates if the EJB is an MDB
*
* @return True if the bean is an MDB, false otherwise
*/
public boolean isMessageDriven();

/**
* Gets the EJB name
*
* @return The name
*/
public String getEjbName();

}
2 changes: 2 additions & 0 deletions spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java
Expand Up @@ -74,8 +74,10 @@ public interface EjbServices extends Service
/**
* Gets a descriptor for each EJB in the application
*
* @deprecated an {@link EJBModule} should be used to represent all EJBs
* @return the EJB descriptors
*/
@Deprecated
public Iterable<EjbDescriptor<?>> discoverEjbs();

}
Expand Up @@ -23,11 +23,6 @@ public Class<T> getInterface()
return delegate().getInterface();
}

public String getJndiName()
{
return delegate().getJndiName();
}

@Override
public boolean equals(Object obj)
{
Expand Down
Expand Up @@ -20,31 +20,20 @@ public abstract class ForwardingEjbDescriptor<T> implements EjbDescriptor<T>
{

protected abstract EjbDescriptor<T> delegate();


public String getEjbName()
{
return delegate().getEjbName();
}


public Iterable<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces()
{
return delegate().getLocalBusinessInterfaces();
}

public Iterable<BusinessInterfaceDescriptor<?>> getRemoteBusinessInterfaces()
{
return delegate().getRemoteBusinessInterfaces();
}

public Iterable<Method> getRemoveMethods()
{
return delegate().getRemoveMethods();
}

public Class<T> getType()
public Class<T> getBeanClass()
{
return delegate().getType();
return delegate().getBeanClass();
}

public boolean isMessageDriven()
Expand Down

0 comments on commit b4db6c0

Please sign in to comment.