[jboss-svn-commits] JBoss Common SVN: r3781 - in arquillian/trunk/spi/src/main/java/org/jboss/arquillian/spi: util and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Nov 25 03:17:57 EST 2009


Author: aslak
Date: 2009-11-25 03:17:57 -0500 (Wed, 25 Nov 2009)
New Revision: 3781

Added:
   arquillian/trunk/spi/src/main/java/org/jboss/arquillian/spi/DeploymentAppender.java
   arquillian/trunk/spi/src/main/java/org/jboss/arquillian/spi/util/DeploymentAppenders.java
Log:
ARQ-29 Added SPI for adding archives to the deployment

Added: arquillian/trunk/spi/src/main/java/org/jboss/arquillian/spi/DeploymentAppender.java
===================================================================
--- arquillian/trunk/spi/src/main/java/org/jboss/arquillian/spi/DeploymentAppender.java	                        (rev 0)
+++ arquillian/trunk/spi/src/main/java/org/jboss/arquillian/spi/DeploymentAppender.java	2009-11-25 08:17:57 UTC (rev 3781)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.arquillian.spi;
+
+import org.jboss.shrinkwrap.api.Archive;
+
+/**
+ * DeploymentAppender
+ * 
+ * SPI used for modules who need to add classes/resources to the deployed archive.
+ *
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public interface DeploymentAppender
+{
+
+   Archive<?> createArchive();
+   
+}

Added: arquillian/trunk/spi/src/main/java/org/jboss/arquillian/spi/util/DeploymentAppenders.java
===================================================================
--- arquillian/trunk/spi/src/main/java/org/jboss/arquillian/spi/util/DeploymentAppenders.java	                        (rev 0)
+++ arquillian/trunk/spi/src/main/java/org/jboss/arquillian/spi/util/DeploymentAppenders.java	2009-11-25 08:17:57 UTC (rev 3781)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.arquillian.spi.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.arquillian.spi.DeploymentAppender;
+import org.jboss.shrinkwrap.api.Archive;
+
+/**
+ * DeploymentAppenders
+ * 
+ * Helper class for getting all Archives that should be added to the deployment. 
+ *
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public class DeploymentAppenders
+{
+
+   /**
+    * Load/Create all Archives provided by the different modules. 
+    * 
+    * @return A List of all archives
+    */
+   public List<Archive<?>> getArchives() 
+   {
+      List<Archive<?>> archives = new ArrayList<Archive<?>>();
+      DefaultServiceLoader<DeploymentAppender> serviceLoader = DefaultServiceLoader.load(
+            DeploymentAppender.class);
+   
+      for(DeploymentAppender deploymentAppender : serviceLoader)
+      {
+         archives.add(deploymentAppender.createArchive());
+      }
+      return archives;
+   }
+   
+}



More information about the jboss-svn-commits mailing list