[jboss-cvs] JBossAS SVN: r91013 - in projects/embedded/trunk: core/src/main/java/org/jboss/embedded/core and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jul 9 14:38:12 EDT 2009
Author: ALRubinger
Date: 2009-07-09 14:38:12 -0400 (Thu, 09 Jul 2009)
New Revision: 91013
Added:
projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/
projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/AbstractVirtualDeployment.java
projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/ExtensibleVirtualDeployment.java
projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/ResourceNotFoundException.java
projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/SecurityActions.java
projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeployment.java
projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeploymentFactory.java
projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeploymentGroup.java
projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeploymentGroupImpl.java
projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeploymentImpl.java
projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/server/JBossASEmbeddedServerImpl.java
projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/TempDevelopmentOnlyTestCase.java
projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/slsb/
projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/slsb/OutputBean.java
projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/slsb/OutputLocalBusiness.java
Removed:
projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/server/JBossASEmbeddedServer.java
projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/OutputBean.java
projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/OutputLocalBusiness.java
Modified:
projects/embedded/trunk/build/pom.xml
projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/ServerTestCase.java
Log:
[EMB-32] Prototyping for virtual archives/deployments and a working unit test for local EJB invocation
Modified: projects/embedded/trunk/build/pom.xml
===================================================================
--- projects/embedded/trunk/build/pom.xml 2009-07-09 18:16:43 UTC (rev 91012)
+++ projects/embedded/trunk/build/pom.xml 2009-07-09 18:38:12 UTC (rev 91013)
@@ -139,15 +139,38 @@
</dependency>
<!--
TODO: Remove
- This is just so that JBBOOT-94 is brought in, some Maven weirdness going on
- where jboss.bind.address default is still coming up as 127.0.0.0 even though
- the dependency plugin shows jboss-bootstrap-spi-as:2.0.0-alpha-2 is being used
+ This is just until all deps for bootstrap are updated
-->
<dependency>
<groupId>org.jboss.bootstrap</groupId>
<artifactId>jboss-bootstrap-impl-as</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.bootstrap</groupId>
+ <artifactId>jboss-bootstrap-impl-mc</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.bootstrap</groupId>
+ <artifactId>jboss-bootstrap-impl-base</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.bootstrap</groupId>
+ <artifactId>jboss-bootstrap-spi</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.bootstrap</groupId>
+ <artifactId>jboss-bootstrap-spi-as</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.bootstrap</groupId>
+ <artifactId>jboss-bootstrap-spi-mc</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
</dependencyManagement>
Added: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/AbstractVirtualDeployment.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/AbstractVirtualDeployment.java (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/AbstractVirtualDeployment.java 2009-07-09 18:38:12 UTC (rev 91013)
@@ -0,0 +1,580 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.core.deployment;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.List;
+
+import org.jboss.logging.Logger;
+import org.jboss.virtual.MemoryFileFactory;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * AbstractVirtualDeployment
+ *
+ * Base implementation of {@link ExtensibleVirtualDeployment}
+ *
+ * @see {@link ExtensibleVirtualDeployment}
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public abstract class AbstractVirtualDeployment<T extends ExtensibleVirtualDeployment<T>>
+ implements
+ ExtensibleVirtualDeployment<T>
+{
+
+ //-------------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Logger
+ */
+ private static final Logger log = Logger.getLogger(AbstractVirtualDeployment.class);
+
+ /**
+ * Protocol of VFS in-memory
+ */
+ private static final String PROTOCOL_VFS_MEMORY = "vfsmemory";
+
+ /**
+ * Extension for Java Archives
+ */
+ public static final String EXTENSION_JAR = ".jar";
+
+ /**
+ * Delimiter for paths while looking for resources
+ */
+ private static final char DELIMITER_RESOURCE_PATH = '/';
+
+ /**
+ * Delimiter for paths in fully-qualified class names
+ */
+ private static final char DELIMITER_CLASS_NAME_PATH = '.';
+
+ /**
+ * The filename extension appended to classes
+ */
+ private static final String EXTENSION_CLASS = ".class";
+
+ /**
+ * Newline character
+ */
+ private static final char NEWLINE = '\n';
+
+ //-------------------------------------------------------------------------------------||
+ // Instance Members -------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * The root of the deployment
+ */
+ private final VirtualFile root;
+
+ /**
+ * The URL to the root deployment
+ */
+ private final URL rootUrl;
+
+ /**
+ * The ClassLoader used in loading resources and classes into the virtual deployment
+ */
+ private final ClassLoader classLoader;
+
+ //-------------------------------------------------------------------------------------||
+ // Constructor ------------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Constructor
+ *
+ * Creates a new {@link AbstractVirtualDeployment} using the Thread Context
+ * ClassLoader.
+ *
+ * @param name Unique name for the deployment
+ * @throws IllegalArgumentException If the name was not specified
+ */
+ public AbstractVirtualDeployment(final String name) throws IllegalArgumentException
+ {
+ this(name, SecurityActions.getThreadContextClassLoader());
+ }
+
+ /**
+ * Constructor
+ *
+ * @param name Unique name for the deployment
+ * @param cl ClassLoader to be used in loading resources and classes
+ * @throws IllegalArgumentException If the name, actual class or ClassLoader was not specified
+ */
+ public AbstractVirtualDeployment(final String name, final ClassLoader cl) throws IllegalArgumentException
+ {
+ // Precondition check
+ if (name == null || name.length() == 0)
+ {
+ throw new IllegalArgumentException("name must be specified");
+ }
+ if (cl == null)
+ {
+ throw new IllegalArgumentException("ClassLoader must be specified");
+ }
+
+ // Create the root for the deployment
+ VirtualFile file = null;
+ URL url = null;
+ try
+ {
+ final URL memoryRootUrl = new URL(PROTOCOL_VFS_MEMORY, name, "");
+ MemoryFileFactory.createRoot(memoryRootUrl);
+ url = memoryRootUrl;
+ file = VFS.getRoot(memoryRootUrl);
+ }
+ catch (final IOException ioe)
+ {
+ throw new RuntimeException("Error in creating the root for virtual deployment \"" + name + "\"", ioe);
+ }
+
+ // Set properties for the root
+ this.root = file;
+ this.rootUrl = url;
+
+ // Set the CL
+ this.classLoader = cl;
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.embedded.core.deployment.VirtualDeployment#addClass(java.lang.Class)
+ */
+ @Override
+ public T addClass(final Class<?> clazz) throws IllegalArgumentException
+ {
+ // Precondition check
+ if (clazz == null)
+ {
+ throw new IllegalArgumentException("Class must be specified");
+ }
+
+ // Get the resource name of the class
+ final String name = this.getResourceNameOfClass(clazz);
+
+ // Add it as a resource
+ return this.addResource(name);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.embedded.core.deployment.VirtualDeployment#addClasses(java.lang.Class<?>[])
+ */
+ @Override
+ public T addClasses(final Class<?>... classes) throws IllegalArgumentException
+ {
+ // Precondition check
+ if (classes == null || classes.length == 0)
+ {
+ throw new IllegalArgumentException("At least one class must be specified");
+ }
+
+ // For each class
+ for (final Class<?> clazz : classes)
+ {
+ this.addClass(clazz);
+ }
+
+ // Return
+ return this.covarientReturn();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.embedded.core.deployment.VirtualDeployment#addResource(java.lang.String)
+ */
+ @Override
+ public T addResource(final String name) throws IllegalArgumentException
+ {
+ // Precondition check
+ if (name == null || name.length() == 0)
+ {
+ throw new IllegalArgumentException("name must be specified");
+ }
+
+ // Get the content of the resource
+ byte[] content = null;
+ try
+ {
+ content = this.getBytesOfResource(name);
+ }
+ catch (final IOException ioe)
+ {
+ throw new RuntimeException("Could not add resource \"" + name + "\" to " + this, ioe);
+ }
+
+ // Get the root URL of the memory file
+ final URL rootUrl = this.getRootUrl();
+
+ // Construct a new URL for this new memoryfile
+ URL newUrl = null;
+ try
+ {
+ newUrl = new URL(rootUrl, name);
+ }
+ catch (final MalformedURLException murle)
+ {
+ throw new RuntimeException("Could not form URL for new resource \"" + name + "\" in " + this, murle);
+ }
+
+ // Put the new memory file in place
+ MemoryFileFactory.putFile(newUrl, content);
+ log.debug("Added \"" + name + "\": " + newUrl);
+
+ // Return
+ return this.covarientReturn();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.embedded.core.deployment.ExtensibleVirtualDeployment#toString(boolean)
+ */
+ @Override
+ public String toString(final boolean verbose)
+ {
+ // If we want verbose output
+ if (verbose)
+ {
+ // Describe the root
+ return this.describe(this.getRoot());
+ }
+
+ // Fall back on toString
+ return this.toString();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.embedded.core.deployment.ExtensibleVirtualDeployment#getRoot()
+ */
+ @Override
+ public VirtualFile getRoot()
+ {
+ return this.root;
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Contracts --------------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Obtains the actual class (type) of this instance, used
+ * in covarient return (casting)
+ *
+ * @return the actualClass
+ */
+ protected abstract Class<T> getActualClass();
+
+ //-------------------------------------------------------------------------------------||
+ // Internal Helper Methods ------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Returns the name of the class such that it may be accessed via ClassLoader.getResource()
+ *
+ * @param clazz The class
+ * @throws IllegalArgumentException If the class was not specified
+ */
+ private String getResourceNameOfClass(final Class<?> clazz) throws IllegalArgumentException
+ {
+ // Precondition check
+ if (clazz == null)
+ {
+ throw new IllegalArgumentException("Class must be specified");
+ }
+
+ // Build the name
+ final String fqn = clazz.getName();
+ final String nameAsResourcePath = fqn.replace(DELIMITER_CLASS_NAME_PATH, DELIMITER_RESOURCE_PATH);
+ final String resourceName = nameAsResourcePath + EXTENSION_CLASS;
+
+ // Return
+ return resourceName;
+ }
+
+ /**
+ * Obtains the URL of the resource with the requested name.
+ * The search order is described by {@link ClassLoader#getResource(String)}
+ *
+ * @param name
+ * @return
+ * @throws IllegalArgumentException If name is not specified or could not
+ */
+ private URL getResourceUrl(final String name) throws IllegalArgumentException
+ {
+ // Precondition check
+ if (name == null || name.length() == 0)
+ {
+ throw new IllegalArgumentException("name must be specified");
+ }
+
+ // Find
+ final ClassLoader cl = this.getClassLoader();
+ final URL url = cl.getResource(name);
+
+ // Ensure found
+ if (url == null)
+ {
+ throw new ResourceNotFoundException("Could not find resource with name \"" + name + "\" in: " + cl);
+ }
+
+ // Return
+ return url;
+ }
+
+ /**
+ * Obtains the contents (bytes) of the specified resource
+ *
+ * @param name
+ * @return
+ * @throws IOException
+ * @throws IllegalArgumentException If the name is not specified
+ */
+ private byte[] getBytesOfResource(final String name) throws IOException, IllegalArgumentException
+ {
+ // Precondition check
+ if (name == null || name.length() == 0)
+ {
+ throw new IllegalArgumentException("name must be specified");
+ }
+
+ // Get the URL
+ final URL resourceUrl = this.getResourceUrl(name);
+
+ // Open a connection and read in all the bytes
+ final URLConnection connection = resourceUrl.openConnection();
+ final int length = connection.getContentLength();
+ assert length > -1 : "Content length is not known";
+ byte contents[] = new byte[length];
+ final InputStream in = connection.getInputStream();
+ int read = 0;
+ int currentLocation = 0;
+ int bytesToRead = 1024;
+ // Avoid ArrayIndexOutOfBounds by adjusting back the bytes we read in
+ if (bytesToRead + currentLocation > length)
+ {
+ bytesToRead = length;
+ }
+
+ // Read into the byte array
+ while ((read = (in.read(contents, currentLocation, bytesToRead))) > 0)
+ {
+ // Mark our new offset
+ currentLocation += read;
+
+ // Avoid ArrayIndexOutOfBounds
+ if (bytesToRead + currentLocation > length)
+ {
+ bytesToRead = length - currentLocation;
+ }
+ }
+
+ // Close up the stream
+ in.close();
+
+ // Return the byte array
+ if (log.isTraceEnabled())
+ {
+ log.trace("Read " + contents.length + " bytes for: " + name);
+ }
+ return contents;
+ }
+
+ /**
+ * Returns this instance as a typed server (as specified by K),
+ * throwing a descriptive error message in case the server is not assignable
+ */
+ protected final T covarientReturn()
+ {
+ // Get the actual class
+ final Class<T> actualClass = this.getActualClass();
+
+ // Cast
+ try
+ {
+ return actualClass.cast(this);
+ }
+ catch (ClassCastException cce)
+ {
+ throw new RuntimeException("Actual class is incorrect and " + actualClass
+ + " was not assignable to this instance: " + this, cce);
+ }
+ }
+
+ /**
+ * Describes this file in form:
+ *
+ * "/path/resource.ext - x bytes"
+ *
+ * In addition to all children of the given file root.
+ *
+ * @param file The root to describe
+ * @return
+ * @throws IllegalArgumentException If either the file or builder are not specified
+ */
+ private String describe(final VirtualFile file)
+ {
+ // Precondition checks
+ if (file == null)
+ {
+ throw new IllegalArgumentException("file must be specified");
+ }
+
+ // Make a StringBuilder
+ final StringBuilder sb = new StringBuilder();
+
+ // Start the output
+ sb.append(file);
+ sb.append(NEWLINE);
+
+ // Describe in depth
+ return this.describe(file, sb);
+ }
+
+ /**
+ * Describes this file in form:
+ *
+ * "/path/resource.ext - x bytes"
+ *
+ * In addition to all children of the given file root.
+ *
+ * @param file The root to describe
+ * @param sb The builder to which the description will be appended
+ * @return
+ * @throws IllegalArgumentException If either the file or builder are not specified
+ */
+ private String describe(final VirtualFile file, final StringBuilder sb) throws IllegalArgumentException
+ {
+ // Precondition checks
+ if (file == null)
+ {
+ throw new IllegalArgumentException("file must be specified");
+ }
+ if (sb == null)
+ {
+ throw new IllegalArgumentException("builder must be specified");
+ }
+
+ // Get information for this root
+ final String path = file.getPathName();
+ final long size;
+ try
+ {
+ size = file.getSize();
+ }
+ catch (final IOException ioe)
+ {
+ throw new RuntimeException("Could not get size for: " + file, ioe);
+ }
+
+ // Append this information
+ sb.append(path);
+ sb.append(" - ");
+ sb.append(size);
+ sb.append(" bytes");
+ sb.append(NEWLINE);
+
+ // Recurse into any children
+ final List<VirtualFile> children;
+ try
+ {
+ children = file.getChildren();
+ }
+ catch (final IOException ioe)
+ {
+ throw new RuntimeException("Could not obtain children for: " + file, ioe);
+ }
+ if (children != null && children.size() > 0)
+ {
+ for (final VirtualFile child : children)
+ {
+ this.describe(child, sb);
+ }
+ }
+
+ // Return
+ return sb.toString();
+ }
+
+ /**
+ * Copies and returns the specified URL. Used
+ * to ensure we don't export mutable URLs
+ *
+ * @param url
+ * @return
+ */
+ protected final URL copyURL(final URL url)
+ {
+ // If null, return
+ if (url == null)
+ {
+ return url;
+ }
+
+ try
+ {
+ // Copy
+ return new URL(url.toExternalForm());
+ }
+ catch (MalformedURLException e)
+ {
+ throw new RuntimeException("Error in copying URL", e);
+ }
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Accessors / Mutators ---------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Returns the ClassLoader used to load classes
+ * and resources into this virtual deployment
+ *
+ * @return
+ */
+ protected final ClassLoader getClassLoader()
+ {
+ return this.classLoader;
+ }
+
+ /**
+ * Returns a copy of this root's URL (not the
+ * actual reference as we want to protect internal
+ * state from mutation)
+ * @return
+ */
+ protected final URL getRootUrl()
+ {
+ return this.copyURL(this.rootUrl);
+ }
+}
Added: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/ExtensibleVirtualDeployment.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/ExtensibleVirtualDeployment.java (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/ExtensibleVirtualDeployment.java 2009-07-09 18:38:12 UTC (rev 91013)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.core.deployment;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * ExtensibleVirtualDeployment
+ *
+ * Represents a single in-memory deployment which may
+ * be constructed declaratively / programmatically.
+ *
+ * @see {@link VirtualDeploymentGroup}
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @author adrian at jboss.org
+ * @version $Revision: $
+ */
+public interface ExtensibleVirtualDeployment<T extends ExtensibleVirtualDeployment<?>>
+{
+ //-------------------------------------------------------------------------------------||
+ // Contracts --------------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Adds the specified Class to the deployment
+ *
+ * @param The class to add
+ * @return This virtual deployment
+ * @throws IllegalArgumentException If no class was specified
+ */
+ T addClass(Class<?> clazz) throws IllegalArgumentException;
+
+ /**
+ * Adds the specified Classes to the deployment.
+ *
+ * @param classes
+ * @return This virtual deployment
+ * @throws IllegalArgumentException If no classes were specified
+ */
+ T addClasses(Class<?>... classes) throws IllegalArgumentException;
+
+ /**
+ * Adds the resource with the specified name to the
+ * deployment. The resource name must be visible to the ClassLoader
+ * of the deployment
+ *
+ * @param name
+ * @return
+ * @throws IllegalArgumentException If the name was not specified
+ */
+ T addResource(String name) throws IllegalArgumentException;
+
+ /**
+ * Returns a multiline "ls -l"-equse output of the contents of
+ * this deployment and (recursively) its children if the verbosity
+ * flag is set to "true". Otherwise the no-arg version is invoked
+ *
+ * @return
+ */
+ String toString(boolean verbose);
+
+ /**
+ * Obtains the VFS file which is the root level
+ * of this deployment
+ *
+ * @return
+ */
+ VirtualFile getRoot();
+
+}
Added: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/ResourceNotFoundException.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/ResourceNotFoundException.java (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/ResourceNotFoundException.java 2009-07-09 18:38:12 UTC (rev 91013)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.core.deployment;
+
+/**
+ * ResourceNotFoundException
+ *
+ * Thrown when a resource is requested, but could not be found
+ * within the context of the given ClassLoader
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class ResourceNotFoundException extends IllegalArgumentException
+{
+ //-------------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * serialVersionUID
+ */
+ private static final long serialVersionUID = 1L;
+
+ //-------------------------------------------------------------------------------------||
+ // Constructors -----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ public ResourceNotFoundException()
+ {
+ super();
+ }
+
+ public ResourceNotFoundException(final String message, final Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public ResourceNotFoundException(final String s)
+ {
+ super(s);
+ }
+
+ public ResourceNotFoundException(final Throwable cause)
+ {
+ super(cause);
+ }
+
+}
Added: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/SecurityActions.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/SecurityActions.java (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/SecurityActions.java 2009-07-09 18:38:12 UTC (rev 91013)
@@ -0,0 +1,47 @@
+package org.jboss.embedded.core.deployment;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * SecurityActions
+ *
+ * A set of privileged actions that are not to leak out
+ * of this package
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+class SecurityActions
+{
+
+ //-------------------------------------------------------------------------------||
+ // Constructor ------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * No external instanciation
+ */
+ private SecurityActions()
+ {
+
+ }
+
+ //-------------------------------------------------------------------------------||
+ // Utility Methods --------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * Obtains the Thread Context ClassLoader
+ */
+ static ClassLoader getThreadContextClassLoader()
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+}
Property changes on: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/SecurityActions.java
___________________________________________________________________
Name: svn:executable
+ *
Added: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeployment.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeployment.java (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeployment.java 2009-07-09 18:38:12 UTC (rev 91013)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.core.deployment;
+
+/**
+ * VirtualDeployment
+ *
+ * Represents a single in-memory deployment which may
+ * be constructed declaratively / programmatically.
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface VirtualDeployment extends ExtensibleVirtualDeployment<VirtualDeployment>
+{
+ /*
+ * API inherited from {@link ExtensibleVirtualDeployment}; this type in
+ * place to define generics
+ */
+}
Added: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeploymentFactory.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeploymentFactory.java (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeploymentFactory.java 2009-07-09 18:38:12 UTC (rev 91013)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.core.deployment;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.jboss.bootstrap.spi.as.server.JBossASServer;
+import org.jboss.bootstrap.spi.as.server.JBossASServerFactory;
+import org.jboss.embedded.core.server.JBossASEmbeddedServerImpl;
+import org.jboss.logging.Logger;
+import org.jboss.virtual.MemoryFileFactory;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * VirtualDeploymentFactory
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class VirtualDeploymentFactory
+{
+
+ //-------------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ private static final Logger log = Logger.getLogger(VirtualDeploymentFactory.class);
+
+ //-------------------------------------------------------------------------------------||
+ // Instance Members -------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ //-------------------------------------------------------------------------------------||
+ // Constructor ------------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Internal constructor to enforce no instanciation outside this class
+ * (really, ever)
+ */
+ private VirtualDeploymentFactory()
+ {
+
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ //-------------------------------------------------------------------------------------||
+ // Functional Methods -----------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ public static VirtualDeploymentGroup createVirtualDeployment(final String name)
+ {
+ try
+ {
+ URL url = new URL("vfsmemory", name, "");
+ MemoryFileFactory.createRoot(url);
+ // create some dummy contents so we can have a virtual war file
+// byte contents[] =
+// {};
+// MemoryFileFactory.putFile(new URL(url, name), contents);
+ VirtualFile root = VFS.getRoot(url);
+
+ MemoryFileFactory.createDirectory(url);
+
+
+ log.info(root);
+
+ }
+ catch (final IOException ioe)
+ {
+ throw new RuntimeException("Could not create virtual deployment", ioe);
+ }
+
+ return null;
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Internal Helper Methods ------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ public static void main(final String... args) throws Exception
+ {
+ JBossASServer server = new JBossASEmbeddedServerImpl("/home/alrubinger/business/jboss/wc/jbossas/branches/Branch_5_x/build/output/jboss-5.2.0.Beta");
+ server.start();
+
+
+ createVirtualDeployment("something");
+
+ server.shutdown();
+ }
+}
Added: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeploymentGroup.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeploymentGroup.java (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeploymentGroup.java 2009-07-09 18:38:12 UTC (rev 91013)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.core.deployment;
+
+import java.util.Collection;
+
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+
+/**
+ * VirtualDeploymentGroup
+ *
+ * Represents a collection of virtual (ie. not necessarily
+ * backed by true flat file structures) deployments. May
+ * be used to programmatically assemble archives from
+ * classes or resources in arbitrary locations available
+ * either from a ClassLoader or Class Path.
+ *
+ * @see {@link ExtensibleVirtualDeployment}
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @author adrian at jboss.org
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface VirtualDeploymentGroup
+{
+ //-------------------------------------------------------------------------------------||
+ // Contracts --------------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ // VirtualDeploymentGroup addClass(Class<?> clazz);
+ //
+ // VirtualDeploymentGroup addClasses(Class<?>... classes);
+ //
+ // VirtualDeploymentGroup addResource(File resource);
+ //
+ // VirtualDeploymentGroup addResource(URL resource);
+ //
+ // VirtualDeploymentGroup addResource(String resource);
+ //
+ // VirtualDeploymentGroup addResources(File... resource);
+ //
+ // VirtualDeploymentGroup addResources(URL... resource);
+ //
+ // VirtualDeploymentGroup addResources(String... resource);
+
+ /**
+ * Returns a Collection of the underlying deployments that
+ * comprise this group. The returned object will be immutable
+ * such that internal state is not leaked to the client.
+ *
+ * @return
+ */
+ Collection<VFSDeployment> getDeployments();
+}
Added: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeploymentGroupImpl.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeploymentGroupImpl.java (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeploymentGroupImpl.java 2009-07-09 18:38:12 UTC (rev 91013)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.core.deployment;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.logging.Logger;
+
+/**
+ * VirtualDeploymentGroupImpl
+ *
+ * Threadsafe Implementation of a {@link VirtualDeploymentGroup}
+ *
+ * @see {@link VirtualDeploymentGroup}
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @author adrian at jboss.org
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class VirtualDeploymentGroupImpl implements VirtualDeploymentGroup
+{
+
+ //-------------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Logger
+ */
+ private static final Logger log = Logger.getLogger(VirtualDeploymentGroupImpl.class);
+
+ //-------------------------------------------------------------------------------------||
+ // Instance Members -------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * The deployments in this group. Must be a Threadsafe implementation.
+ */
+ private final List<VFSDeployment> deployments;
+
+ //-------------------------------------------------------------------------------------||
+ // Constructor ------------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * No-arg Constructor, sets requisite internal state
+ */
+ public VirtualDeploymentGroupImpl()
+ {
+ // Set internal state
+ this.deployments = new CopyOnWriteArrayList<VFSDeployment>();
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /* (non-Javadoc)
+ * @see org.jboss.embedded.core.deployment.VirtualDeploymentGroup#getDeployments()
+ */
+ @Override
+ public Collection<VFSDeployment> getDeployments()
+ {
+ return Collections.unmodifiableList(this.deployments);
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Functional Methods -----------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ //-------------------------------------------------------------------------------------||
+ // Internal Helper Methods ------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+}
Added: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeploymentImpl.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeploymentImpl.java (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployment/VirtualDeploymentImpl.java 2009-07-09 18:38:12 UTC (rev 91013)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.core.deployment;
+
+/**
+ * VirtualDeploymentImpl
+ *
+ * Concrete implementation of a virtual deployment
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class VirtualDeploymentImpl extends AbstractVirtualDeployment<VirtualDeployment> implements VirtualDeployment
+{
+ //-------------------------------------------------------------------------------------||
+ // Constructors -----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Constructor
+ *
+ * Creates a new {@link AbstractVirtualDeployment} using the Thread Context
+ * ClassLoader.
+ *
+ * @param name Unique name for the deployment
+ * @throws IllegalArgumentException If the name was not specified
+ */
+ public VirtualDeploymentImpl(final String name) throws IllegalArgumentException
+ {
+ super(name);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param name Unique name for the deployment
+ * @param cl ClassLoader to be used in loading resources and classes
+ * @throws IllegalArgumentException If the name, actual class or ClassLoader was not specified
+ */
+ public VirtualDeploymentImpl(final String name, final ClassLoader cl) throws IllegalArgumentException
+ {
+ super(name, cl);
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.embedded.core.deployment.AbstractVirtualDeployment#getActualClass()
+ */
+ @Override
+ protected Class<VirtualDeployment> getActualClass()
+ {
+ return VirtualDeployment.class;
+ }
+}
Deleted: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/server/JBossASEmbeddedServer.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/server/JBossASEmbeddedServer.java 2009-07-09 18:16:43 UTC (rev 91012)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/server/JBossASEmbeddedServer.java 2009-07-09 18:38:12 UTC (rev 91013)
@@ -1,123 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, 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.embedded.core.server;
-
-import org.jboss.bootstrap.impl.as.config.BasicJBossASServerConfig;
-import org.jboss.bootstrap.impl.as.server.JBossASServerImpl;
-import org.jboss.bootstrap.spi.lifecycle.LifecycleEventHandler;
-import org.jboss.bootstrap.spi.lifecycle.LifecycleState;
-import org.jboss.embedded.core.lifecycle.IgnoreXbUnorderedSequenceLifecycleEventHandler;
-import org.jboss.embedded.core.lifecycle.InitLoggingManagerLifecycleEventHandler;
-import org.jboss.embedded.core.lifecycle.SetRmiHostnameLifecycleEventHandler;
-import org.jboss.logging.Logger;
-
-/**
- * JBossASEmbeddedServer
- *
- * Extension of the JBossAS Server implementation
- * for use in Embedded environments
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public class JBossASEmbeddedServer extends JBossASServerImpl
-{
-
- //-------------------------------------------------------------------------------------||
- // Class Members ----------------------------------------------------------------------||
- //-------------------------------------------------------------------------------------||
-
- /**
- * Logger
- */
- private static final Logger log = Logger.getLogger(JBossASEmbeddedServer.class);
-
- //-------------------------------------------------------------------------------------||
- // Constructor ------------------------------------------------------------------------||
- //-------------------------------------------------------------------------------------||
-
- /**
- * Constructor
- *
- * @param Absolute location of JBOSS_HOME on the filesystem
- * @throws IllegalArgumentException If jbossHome is not specified
- */
- public JBossASEmbeddedServer(final String jbossHome) throws IllegalArgumentException
- {
- // Call the super implementation
- super(new BasicJBossASServerConfig());
-
- // Precondition check
- if (jbossHome == null || jbossHome.length() == 0)
- {
- throw new IllegalArgumentException("JBOSS_HOME is required but was not specified");
- }
-
- // Set JBOSS_HOME
- this.getConfiguration().jbossHome(jbossHome);
-
- // Set some lifecycle handlers
- @SuppressWarnings("deprecation")
- final LifecycleEventHandler ignoreXbOrder = new IgnoreXbUnorderedSequenceLifecycleEventHandler();
- this.registerEventHandler(LifecycleState.STARTING, ignoreXbOrder);
- @SuppressWarnings("deprecation")
- final LifecycleEventHandler setRmiHostname = new SetRmiHostnameLifecycleEventHandler();
- this.registerEventHandler(LifecycleState.STARTING, setRmiHostname);
- @SuppressWarnings("deprecation")
- final LifecycleEventHandler initLoggingManager = new InitLoggingManagerLifecycleEventHandler();
- this.registerEventHandler(LifecycleState.STARTING, initLoggingManager);
-
- //TODO
- /*
- * Do we need some handler for boot.log? Something like:
- */
- log.warn(this + " has not installed any handler for a boot.log in $JBOSS_HOME/server/[name]/log");
- // /*
- // * Set boot log directory
- // */
- // final String sysPropBootLogDir = "jboss.boot.server.log.dir";
- // final String sysPropLogDir = JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_LOG_DIR;
- // String serverName = System.getProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_NAME);
- // if (serverName == null || serverName.length() == 0)
- // {
- // serverName = JBossASConfigurationInitializer.VALUE_SERVER_NAME_DEFAULT;
- // }
- // final String manualBootLogDir = System.getProperty(sysPropBootLogDir);
- // final String manualLogDir = System.getProperty(sysPropLogDir);
- // // If nothing's been explicitly specified
- // if (manualBootLogDir == null && manualLogDir == null)
- // {
- // // We default it
- // final File jbossHomeFile = new File(jbossHome);
- // final URL jbossHomeUrl = jbossHomeFile.toURI().toURL();
- // final URL serverLog = new URL(jbossHomeUrl, "server/" + serverName + "/log/");
- // final File serverLogFile = new File(serverLog.toURI());
- // final String serverLogString = serverLogFile.getAbsolutePath();
- // System.setProperty(sysPropBootLogDir, serverLogString);
- // }
- // // If we've got a manual log dir, use it
- // else if (manualLogDir != null)
- // {
- // System.setProperty(sysPropBootLogDir, manualLogDir);
- // }
- }
-}
Copied: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/server/JBossASEmbeddedServerImpl.java (from rev 90910, projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/server/JBossASEmbeddedServer.java)
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/server/JBossASEmbeddedServerImpl.java (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/server/JBossASEmbeddedServerImpl.java 2009-07-09 18:38:12 UTC (rev 91013)
@@ -0,0 +1,193 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.core.server;
+
+import org.jboss.bootstrap.impl.as.server.JBossASServerImpl;
+import org.jboss.bootstrap.spi.lifecycle.LifecycleEventHandler;
+import org.jboss.bootstrap.spi.lifecycle.LifecycleState;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.embedded.core.deployment.VirtualDeployment;
+import org.jboss.embedded.core.lifecycle.IgnoreXbUnorderedSequenceLifecycleEventHandler;
+import org.jboss.embedded.core.lifecycle.InitLoggingManagerLifecycleEventHandler;
+import org.jboss.embedded.core.lifecycle.SetRmiHostnameLifecycleEventHandler;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * JBossASEmbeddedServer
+ *
+ * Extension of the JBossAS Server implementation
+ * for use in Embedded environments
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class JBossASEmbeddedServerImpl extends JBossASServerImpl implements JBossASEmbeddedServer
+{
+
+ //-------------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Logger
+ */
+ private static final Logger log = Logger.getLogger(JBossASEmbeddedServerImpl.class);
+
+ //-------------------------------------------------------------------------------------||
+ // Constructor ------------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Constructor
+ *
+ *
+ *
+ * @throws IllegalStateException
+ */
+ public JBossASEmbeddedServerImpl() throws IllegalStateException
+ {
+
+ }
+
+ /**
+ * Constructor
+ *
+ * @param Absolute location of JBOSS_HOME on the filesystem
+ * @throws IllegalArgumentException If jbossHome is not specified
+ */
+ public JBossASEmbeddedServerImpl(final String jbossHome) throws IllegalArgumentException
+ {
+ // Call the super implementation
+ super();
+
+ // Precondition check
+ if (jbossHome == null || jbossHome.length() == 0)
+ {
+ throw new IllegalArgumentException("JBOSS_HOME is required but was not specified");
+ }
+
+ // Set JBOSS_HOME
+ this.getConfiguration().jbossHome(jbossHome);
+
+ // Set some lifecycle handlers
+ @SuppressWarnings("deprecation")
+ final LifecycleEventHandler ignoreXbOrder = new IgnoreXbUnorderedSequenceLifecycleEventHandler();
+ this.registerEventHandler(LifecycleState.INITIALIZED, ignoreXbOrder);
+ @SuppressWarnings("deprecation")
+ final LifecycleEventHandler setRmiHostname = new SetRmiHostnameLifecycleEventHandler();
+ this.registerEventHandler(LifecycleState.INITIALIZED, setRmiHostname);
+ @SuppressWarnings("deprecation")
+ final LifecycleEventHandler initLoggingManager = new InitLoggingManagerLifecycleEventHandler();
+ this.registerEventHandler(LifecycleState.INITIALIZED, initLoggingManager);
+
+ //TODO
+ /*
+ * Do we need some handler for boot.log? Something like:
+ */
+ log.warn(this + " has not installed any handler for a boot.log in $JBOSS_HOME/server/[name]/log");
+ // /*
+ // * Set boot log directory
+ // */
+ // final String sysPropBootLogDir = "jboss.boot.server.log.dir";
+ // final String sysPropLogDir = JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_LOG_DIR;
+ // String serverName = System.getProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_NAME);
+ // if (serverName == null || serverName.length() == 0)
+ // {
+ // serverName = JBossASConfigurationInitializer.VALUE_SERVER_NAME_DEFAULT;
+ // }
+ // final String manualBootLogDir = System.getProperty(sysPropBootLogDir);
+ // final String manualLogDir = System.getProperty(sysPropLogDir);
+ // // If nothing's been explicitly specified
+ // if (manualBootLogDir == null && manualLogDir == null)
+ // {
+ // // We default it
+ // final File jbossHomeFile = new File(jbossHome);
+ // final URL jbossHomeUrl = jbossHomeFile.toURI().toURL();
+ // final URL serverLog = new URL(jbossHomeUrl, "server/" + serverName + "/log/");
+ // final File serverLogFile = new File(serverLog.toURI());
+ // final String serverLogString = serverLogFile.getAbsolutePath();
+ // System.setProperty(sysPropBootLogDir, serverLogString);
+ // }
+ // // If we've got a manual log dir, use it
+ // else if (manualLogDir != null)
+ // {
+ // System.setProperty(sysPropBootLogDir, manualLogDir);
+ // }
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /* (non-Javadoc)
+ * @see org.jboss.embedded.core.server.JBossASEmbeddedServer#deploy(org.jboss.deployers.client.spi.Deployment)
+ */
+ @Override
+ public void deploy(final Deployment deployment) throws DeploymentException, IllegalArgumentException
+ {
+ // Precondition check
+ if (deployment == null)
+ {
+ throw new IllegalArgumentException("deployment must be specified");
+ }
+
+ // TODO Auto-generated method stub
+ final Kernel kernel = this.getKernel();
+ final KernelController controller = kernel.getController();
+ final ControllerContext context = controller.getContext("MainDeployer", ControllerState.INSTALLED);
+ if (context == null)
+ {
+ throw new IllegalStateException("Main deployer could not be found");
+ }
+ final Object target = context.getTarget();
+ final MainDeployer mainDeployer = MainDeployer.class.cast(target);
+ mainDeployer.deploy(deployment);
+ mainDeployer.checkComplete();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.embedded.core.server.JBossASEmbeddedServer#deploy(org.jboss.embedded.core.deployment.VirtualDeployment)
+ */
+ @Override
+ public void deploy(final VirtualDeployment deployment) throws DeploymentException, IllegalArgumentException
+ {
+ // Precondition check
+ if (deployment == null)
+ {
+ throw new IllegalArgumentException("deployment must be specified");
+ }
+
+ // Make a VFS Deployment
+ final VirtualFile root = deployment.getRoot();
+ final Deployment d = VFSDeploymentFactory.getInstance().createVFSDeployment(root);
+ this.deploy(d);
+ }
+
+}
Modified: projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/ServerTestCase.java
===================================================================
--- projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/ServerTestCase.java 2009-07-09 18:16:43 UTC (rev 91012)
+++ projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/ServerTestCase.java 2009-07-09 18:38:12 UTC (rev 91013)
@@ -26,7 +26,7 @@
import org.jboss.bootstrap.spi.as.server.JBossASServer;
import org.jboss.bootstrap.spi.lifecycle.LifecycleState;
-import org.jboss.embedded.core.server.JBossASEmbeddedServer;
+import org.jboss.embedded.core.server.JBossASEmbeddedServerImpl;
import org.jboss.logging.Logger;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -49,6 +49,12 @@
* from java.endorsed.dirs in pom.xml Surefire Config
* 2) This class must be in package org.jboss due to JMX
* package checking in AS org.jboss.management.j2ee.deployers.LocalJBossServerDomain at 335
+ * or else:
+ * Caused by: java.lang.NullPointerException
+ * at org.jboss.management.j2ee.deployers.ServiceModuleJSR77Deployer.deployJsr77(ServiceModuleJSR77Deployer.java:62)
+ * at org.jboss.management.j2ee.deployers.ServiceModuleJSR77Deployer.deployJsr77(ServiceModuleJSR77Deployer.java:40)
+ * at org.jboss.management.j2ee.deployers.AbstractVFSJSR77Deployer.deployJsr77(AbstractVFSJSR77Deployer.java:46)
+ * at org.jboss.management.j2ee.deployers.AbstractJSR77Deployer.deploy(AbstractJSR77Deployer.java:173)
*
* @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
* @version $Revision: $
@@ -104,7 +110,7 @@
// Make Server
log.info("Using JBOSS_HOME: " + jbossHome);
- server = new JBossASEmbeddedServer(jbossHome);
+ server = new JBossASEmbeddedServerImpl(jbossHome);
// Start
log.info("Starting Server: " + server);
@@ -136,7 +142,7 @@
* Ensures that the server reports as running
*/
@Test
- public void testServerStart() throws Throwable
+ public void testServerStart() throws Exception
{
log.info("testServerStart");
final LifecycleState state = server.getState();
Added: projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/TempDevelopmentOnlyTestCase.java
===================================================================
--- projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/TempDevelopmentOnlyTestCase.java (rev 0)
+++ projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/TempDevelopmentOnlyTestCase.java 2009-07-09 18:38:12 UTC (rev 91013)
@@ -0,0 +1,136 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.
+ */
+//FIXME We have to be in org.jboss due to JMX getPackage in AS
+package org.jboss;
+
+import javax.naming.InitialContext;
+
+import junit.framework.Assert;
+
+import org.jboss.bootstrap.spi.lifecycle.LifecycleState;
+import org.jboss.embedded.core.deployment.VirtualDeployment;
+import org.jboss.embedded.core.deployment.VirtualDeploymentImpl;
+import org.jboss.embedded.core.server.JBossASEmbeddedServer;
+import org.jboss.embedded.core.server.JBossASEmbeddedServerImpl;
+import org.jboss.embedded.testsuite.fulldep.ejb3.slsb.OutputBean;
+import org.jboss.embedded.testsuite.fulldep.ejb3.slsb.OutputLocalBusiness;
+import org.jboss.logging.Logger;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * TempDevelopmentOnlyTestCase
+ *
+ * Some test case I'm just using as a launcher while doing development
+ * to see how things piece together, move along folks. :)
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class TempDevelopmentOnlyTestCase
+{
+
+ //-------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ private static final Logger log = Logger.getLogger(TempDevelopmentOnlyTestCase.class);
+
+ /**
+ * The server instance
+ */
+ private static JBossASEmbeddedServer server;
+
+ //-------------------------------------------------------------------------------||
+ // Lifecycle --------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * Starts up the Application Server. Relies upon either Environment
+ * Variable "JBOSS_HOME" or System Property "jboss.home" being set, with
+ * precedence to the system property
+ */
+ @BeforeClass
+ public static void startEmbedddedAS() throws Exception
+ {
+ // Get JBOSS_HOME
+ //TODO From sysprop or envvar
+ String jbossHome = "/home/alrubinger/business/jboss/wc/jbossas/branches/Branch_5_x/build/output/jboss-5.2.0.Beta";
+ // Make Server
+ log.info("Using JBOSS_HOME: " + jbossHome);
+ server = new JBossASEmbeddedServerImpl(jbossHome);
+
+ // Start
+ log.info("Starting Server: " + server);
+ server.start();
+ log.info("...started.");
+ }
+
+ /**
+ * Shuts down the Application Server after the suite ends
+ */
+ @AfterClass
+ public static void stopEmbeddedAS() throws Exception
+ {
+ // If exists and started
+ if (server != null && server.getState().equals(LifecycleState.STARTED))
+ {
+ // Shutdown
+ log.info("Shutting down server: " + server);
+ server.shutdown();
+ }
+ }
+
+ //-------------------------------------------------------------------------------||
+ // Tests ------------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * Tests virtual deployment by constructing an in-memory unit and deploying into the server
+ */
+ @Test
+ public void testVirtualDeployment() throws Exception
+ {
+ // Log
+ log.info("testVirtualDeployment");
+
+ // Make a deployment
+ final String name = "testDeployment.jar";
+ final VirtualDeployment deployment = new VirtualDeploymentImpl(name).addClasses(OutputBean.class,
+ OutputLocalBusiness.class);
+ log.info(deployment.toString(true));
+
+ // Deploy
+ server.deploy(deployment);
+
+ // Test
+ final OutputLocalBusiness bean = (OutputLocalBusiness) new InitialContext().lookup(OutputBean.class
+ .getSimpleName()
+ + "/local");;
+ final String output = bean.getOutput();
+ log.info("Got output: " + output);
+ Assert.assertEquals(OutputLocalBusiness.OUTPUT, output);
+
+ }
+
+}
Deleted: projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/OutputBean.java
===================================================================
--- projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/OutputBean.java 2009-07-09 18:16:43 UTC (rev 91012)
+++ projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/OutputBean.java 2009-07-09 18:38:12 UTC (rev 91013)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, 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.embedded.testsuite.fulldep.ejb3;
-
-import javax.ejb.Local;
-import javax.ejb.Stateless;
-
-/**
- * OutputBean
- *
- * Simple SLSB which will return a contracted output
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
- at Stateless
- at Local(OutputLocalBusiness.class)
-public class OutputBean implements OutputLocalBusiness
-{
- //-------------------------------------------------------------------------------------||
- // Required Implementations -----------------------------------------------------------||
- //-------------------------------------------------------------------------------------||
-
- public String getOutput()
- {
- return OutputLocalBusiness.OUTPUT;
- }
-}
Deleted: projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/OutputLocalBusiness.java
===================================================================
--- projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/OutputLocalBusiness.java 2009-07-09 18:16:43 UTC (rev 91012)
+++ projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/OutputLocalBusiness.java 2009-07-09 18:38:12 UTC (rev 91013)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, 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.embedded.testsuite.fulldep.ejb3;
-
-/**
- * OutputLocalBusiness
- *
- * Local business interface to an SLSB which will
- * return a contracted String output
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public interface OutputLocalBusiness
-{
- //-------------------------------------------------------------------------------||
- // Constants --------------------------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- String OUTPUT = "Embedded SLSB Local Business Output";
-
- //-------------------------------------------------------------------------------||
- // Contracts --------------------------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- /**
- * Returns the contracted output
- */
- String getOutput();
-}
Copied: projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/slsb/OutputBean.java (from rev 90915, projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/OutputBean.java)
===================================================================
--- projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/slsb/OutputBean.java (rev 0)
+++ projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/slsb/OutputBean.java 2009-07-09 18:38:12 UTC (rev 91013)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.testsuite.fulldep.ejb3.slsb;
+
+import javax.ejb.Local;
+import javax.ejb.Stateless;
+
+/**
+ * OutputBean
+ *
+ * Simple SLSB which will return a contracted output
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Local(OutputLocalBusiness.class)
+public class OutputBean implements OutputLocalBusiness
+{
+ //-------------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ public String getOutput()
+ {
+ String sd="";
+ sd.toCharArray();
+ return OutputLocalBusiness.OUTPUT;
+ }
+}
Copied: projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/slsb/OutputLocalBusiness.java (from rev 90915, projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/OutputLocalBusiness.java)
===================================================================
--- projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/slsb/OutputLocalBusiness.java (rev 0)
+++ projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/slsb/OutputLocalBusiness.java 2009-07-09 18:38:12 UTC (rev 91013)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.testsuite.fulldep.ejb3.slsb;
+
+/**
+ * OutputLocalBusiness
+ *
+ * Local business interface to an SLSB which will
+ * return a contracted String output
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface OutputLocalBusiness
+{
+ //-------------------------------------------------------------------------------||
+ // Constants --------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ String OUTPUT = "Embedded SLSB Local Business Output";
+
+ //-------------------------------------------------------------------------------||
+ // Contracts --------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * Returns the contracted output
+ */
+ String getOutput();
+}
More information about the jboss-cvs-commits
mailing list