geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/conf jsr88-product-provider-manifest.mf
Date Thu, 14 Aug 2003 09:37:23 GMT
jstrachan    2003/08/14 02:37:23

  Added:       modules/core/src/java/org/apache/geronimo/enterprise/deploy/provider
                        ServerConnection.java
                        GeronimoDeploymentManager.java
                        NoServerConnection.java
                        GeronimoDeploymentFactory.java
               modules/core/src/conf jsr88-product-provider-manifest.mf
  Log:
  applied patch by Aaron Mulder for an initial JSR 88 server provider
  
  Revision  Changes    Path
  1.1                  incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/provider/ServerConnection.java
  
  Index: ServerConnection.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.enterprise.deploy.provider;
  
  import java.io.File;
  import java.io.InputStream;
  import javax.enterprise.deploy.spi.Target;
  import javax.enterprise.deploy.spi.TargetModuleID;
  import javax.enterprise.deploy.spi.status.ProgressObject;
  import javax.enterprise.deploy.spi.exceptions.TargetException;
  import javax.enterprise.deploy.shared.ModuleType;
  
  /**
   * Encapsulates all the JSR-88 DeploymentManager methods that ordinarily
   * require a connection to the application server in order to execute.
   * Also includes some Geronimo-specific method to gather deployment
   * information from the server (such as getting a list of EJBs deployed
   * to provide as options when resolving an EJB reference).
   *
   * @version $Revision: 1.1 $
   */
  public interface ServerConnection {
      /**
       * Releases any server resources and closes the connection to the server.
       */
      public void close();
  
      /**
       * @see javax.enterprise.deploy.spi.DeploymentManager#getTargets
       */
      public Target[] getTargets() throws IllegalStateException;
  
      /**
       * @see javax.enterprise.deploy.spi.DeploymentManager#getRunningModules
       */
      public TargetModuleID[] getRunningModules(ModuleType moduleType, Target[] targetList)
throws TargetException, IllegalStateException;
  
      /**
       * @see javax.enterprise.deploy.spi.DeploymentManager#getNonRunningModules
       */
      public TargetModuleID[] getNonRunningModules(ModuleType moduleType, Target[] targetList)
throws TargetException, IllegalStateException;
  
      /**
       * @see javax.enterprise.deploy.spi.DeploymentManager#getAvailableModules
       */
      public TargetModuleID[] getAvailableModules(ModuleType moduleType, Target[] targetList)
throws TargetException, IllegalStateException;
  
      /**
       * @see javax.enterprise.deploy.spi.DeploymentManager#distribute(javax.enterprise.deploy.spi.Target[],
java.io.File, java.io.File)
       */
      public ProgressObject distribute(Target[] targetList, File moduleArchive, File deploymentPlan)
throws IllegalStateException;
  
      /**
       * @see javax.enterprise.deploy.spi.DeploymentManager#distribute(javax.enterprise.deploy.spi.Target[],
java.io.InputStream, java.io.InputStream)
       */
      public ProgressObject distribute(Target[] targetList, InputStream moduleArchive, InputStream
deploymentPlan) throws IllegalStateException;
  
      /**
       * @see javax.enterprise.deploy.spi.DeploymentManager#start
       */
      public ProgressObject start(TargetModuleID[] moduleIDList) throws IllegalStateException;
  
      /**
       * @see javax.enterprise.deploy.spi.DeploymentManager#stop
       */
      public ProgressObject stop(TargetModuleID[] moduleIDList) throws IllegalStateException;
  
      /**
       * @see javax.enterprise.deploy.spi.DeploymentManager#undeploy
       */
      public ProgressObject undeploy(TargetModuleID[] moduleIDList) throws IllegalStateException;
  
      /**
       * @see javax.enterprise.deploy.spi.DeploymentManager#isRedeploySupported
       */
      public boolean isRedeploySupported();
  
      /**
       * @see javax.enterprise.deploy.spi.DeploymentManager#redeploy(javax.enterprise.deploy.spi.TargetModuleID[],
java.io.File, java.io.File)
       */
      public ProgressObject redeploy(TargetModuleID[] moduleIDList, File moduleArchive, File
deploymentPlan) throws UnsupportedOperationException, IllegalStateException;
  
      /**
       * @see javax.enterprise.deploy.spi.DeploymentManager#redeploy(javax.enterprise.deploy.spi.TargetModuleID[],
java.io.InputStream, java.io.InputStream)
       */
      public ProgressObject redeploy(TargetModuleID[] moduleIDList, InputStream moduleArchive,
InputStream deploymentPlan) throws UnsupportedOperationException, IllegalStateException;
  }
  
  
  
  1.1                  incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/provider/GeronimoDeploymentManager.java
  
  Index: GeronimoDeploymentManager.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.enterprise.deploy.provider;
  
  import java.io.File;
  import java.io.InputStream;
  import java.util.Locale;
  import javax.enterprise.deploy.spi.DeploymentManager;
  import javax.enterprise.deploy.spi.Target;
  import javax.enterprise.deploy.spi.TargetModuleID;
  import javax.enterprise.deploy.spi.DeploymentConfiguration;
  import javax.enterprise.deploy.spi.status.ProgressObject;
  import javax.enterprise.deploy.spi.exceptions.TargetException;
  import javax.enterprise.deploy.spi.exceptions.InvalidModuleException;
  import javax.enterprise.deploy.spi.exceptions.DConfigBeanVersionUnsupportedException;
  import javax.enterprise.deploy.shared.ModuleType;
  import javax.enterprise.deploy.shared.DConfigBeanVersionType;
  import javax.enterprise.deploy.model.DeployableObject;
  
  /**
   * The Geronimo implementation of the JSR-88 DeploymentManager interface.
   * This same class is used for both connected mode and disconnected mode.
   * It uses a plugin to manage that.  Currently only J2EE 1.4 is supported.
   *
   * @version $Revision: 1.1 $
   */
  public class GeronimoDeploymentManager implements DeploymentManager {
      private ServerConnection server; // a connection to an application server
  
      GeronimoDeploymentManager(ServerConnection server) {
          this.server = server;
      }
  
      public DeploymentConfiguration createConfiguration(DeployableObject dObj) throws InvalidModuleException
{
          return null; //todo
      }
  
      /**
       * Closes the current server connection, and replaces it with one that
       * behaves in disconnected mode.
       */
      public void release() {
          server.close();
          server = new NoServerConnection();
      }
  
      /**
       * Currently only the default locale is supported.
       */
      public Locale getDefaultLocale() {
          return Locale.getDefault();
      }
  
      /**
       * Currently only the default locale is supported.
       */
      public Locale getCurrentLocale() {
          return Locale.getDefault();
      }
  
      /**
       * Currently only the default locale is supported.
       *
       * @throws UnsupportedOperationException Thrown if the argument locale is
       *         not the default locale, as changing Locales is not supported.
       */
      public void setLocale(Locale locale) throws UnsupportedOperationException {
          if(!locale.equals(Locale.getDefault())) {
              throw new UnsupportedOperationException();
          }
      }
  
      /**
       * Currently only the default locale is supported.
       */
      public Locale[] getSupportedLocales() {
          return new Locale[]{Locale.getDefault()};
      }
  
      /**
       * Currently only the default locale is supported.
       */
      public boolean isLocaleSupported(Locale locale) {
          return locale.equals(Locale.getDefault());
      }
  
      /**
       * Currently only J2EE 1.4 is supported.
       */
      public DConfigBeanVersionType getDConfigBeanVersion() {
          return DConfigBeanVersionType.V1_4;
      }
  
      /**
       * Currently only J2EE 1.4 is supported.
       */
      public boolean isDConfigBeanVersionSupported(DConfigBeanVersionType version) {
          return version.getValue() == DConfigBeanVersionType.V1_4.getValue();
      }
  
      /**
       * Currently only J2EE 1.4 is supported.
       *
       * @throws DConfigBeanVersionUnsupportedException Occurs when the argument
       *         version is not 1.4.
       */
      public void setDConfigBeanVersion(DConfigBeanVersionType version) throws DConfigBeanVersionUnsupportedException
{
          if(version.getValue() != DConfigBeanVersionType.V1_4.getValue()) {
              throw new DConfigBeanVersionUnsupportedException("This implementation only supports
J2EE 1.4");
          }
      }
  
      // ---- All of the methods below are handled by the ServerConnection -----
  
      public Target[] getTargets() throws IllegalStateException {
          return server.getTargets();
      }
  
      public TargetModuleID[] getRunningModules(ModuleType moduleType, Target[] targetList)
throws TargetException, IllegalStateException {
          return server.getRunningModules(moduleType, targetList);
      }
  
      public TargetModuleID[] getNonRunningModules(ModuleType moduleType, Target[] targetList)
throws TargetException, IllegalStateException {
          return server.getNonRunningModules(moduleType, targetList);
      }
  
      public TargetModuleID[] getAvailableModules(ModuleType moduleType, Target[] targetList)
throws TargetException, IllegalStateException {
          return server.getAvailableModules(moduleType, targetList);
      }
  
      public ProgressObject distribute(Target[] targetList, File moduleArchive, File deploymentPlan)
throws IllegalStateException {
          return server.distribute(targetList, moduleArchive, deploymentPlan);
      }
  
      public ProgressObject distribute(Target[] targetList, InputStream moduleArchive, InputStream
deploymentPlan) throws IllegalStateException {
          return server.distribute(targetList, moduleArchive, deploymentPlan);
      }
  
      public ProgressObject start(TargetModuleID[] moduleIDList) throws IllegalStateException
{
          return server.start(moduleIDList);
      }
  
      public ProgressObject stop(TargetModuleID[] moduleIDList) throws IllegalStateException
{
          return server.stop(moduleIDList);
      }
  
      public ProgressObject undeploy(TargetModuleID[] moduleIDList) throws IllegalStateException
{
          return server.undeploy(moduleIDList);
      }
  
      public boolean isRedeploySupported() {
          return server.isRedeploySupported();
      }
  
      public ProgressObject redeploy(TargetModuleID[] moduleIDList, File moduleArchive, File
deploymentPlan) throws UnsupportedOperationException, IllegalStateException {
          return server.redeploy(moduleIDList, moduleArchive, deploymentPlan);
      }
  
      public ProgressObject redeploy(TargetModuleID[] moduleIDList, InputStream moduleArchive,
InputStream deploymentPlan) throws UnsupportedOperationException, IllegalStateException {
          return server.redeploy(moduleIDList, moduleArchive, deploymentPlan);
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/provider/NoServerConnection.java
  
  Index: NoServerConnection.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.enterprise.deploy.provider;
  
  import java.io.File;
  import java.io.InputStream;
  import javax.enterprise.deploy.spi.Target;
  import javax.enterprise.deploy.spi.TargetModuleID;
  import javax.enterprise.deploy.spi.status.ProgressObject;
  import javax.enterprise.deploy.spi.exceptions.TargetException;
  import javax.enterprise.deploy.shared.ModuleType;
  
  /**
   * An implementation of ServerConnection used when there is not currently any
   * connection to a server.  This throws an IllegalArgumentException for any
   * call, which is the prescribed behavior when one of these methods is called
   * on a disconnected DeploymentManager.
   *
   * @version $Revision: 1.1 $
   */
  public class NoServerConnection implements ServerConnection {
      /**
       * Does nothing (there is no connection to close).
       */
      public void close() {}
  
      /**
       * @throws IllegalStateException Always thrown, as there is no server available.
       */
      public Target[] getTargets() throws IllegalStateException {
          throw new IllegalStateException();
      }
  
      /**
       * @throws IllegalStateException Always thrown, as there is no server available.
       */
      public TargetModuleID[] getRunningModules(ModuleType moduleType, Target[] targetList)
throws TargetException, IllegalStateException {
          throw new IllegalStateException();
      }
  
      /**
       * @throws IllegalStateException Always thrown, as there is no server available.
       */
      public TargetModuleID[] getNonRunningModules(ModuleType moduleType, Target[] targetList)
throws TargetException, IllegalStateException {
          throw new IllegalStateException();
      }
  
      /**
       * @throws IllegalStateException Always thrown, as there is no server available.
       */
      public TargetModuleID[] getAvailableModules(ModuleType moduleType, Target[] targetList)
throws TargetException, IllegalStateException {
          throw new IllegalStateException();
      }
  
      /**
       * @throws IllegalStateException Always thrown, as there is no server available.
       */
      public ProgressObject distribute(Target[] targetList, File moduleArchive, File deploymentPlan)
throws IllegalStateException {
          throw new IllegalStateException();
      }
  
      /**
       * @throws IllegalStateException Always thrown, as there is no server available.
       */
      public ProgressObject distribute(Target[] targetList, InputStream moduleArchive, InputStream
deploymentPlan) throws IllegalStateException {
          throw new IllegalStateException();
      }
  
      /**
       * @throws IllegalStateException Always thrown, as there is no server available.
       */
      public ProgressObject start(TargetModuleID[] moduleIDList) throws IllegalStateException
{
          throw new IllegalStateException();
      }
  
      /**
       * @throws IllegalStateException Always thrown, as there is no server available.
       */
      public ProgressObject stop(TargetModuleID[] moduleIDList) throws IllegalStateException
{
          throw new IllegalStateException();
      }
  
      /**
       * @throws IllegalStateException Always thrown, as there is no server available.
       */
      public ProgressObject undeploy(TargetModuleID[] moduleIDList) throws IllegalStateException
{
          throw new IllegalStateException();
      }
  
      /**
       * Can't redeploy when there's not a server connection.
       * @return <tt>false</tt>
       */
      public boolean isRedeploySupported() {
          return false;
      }
  
      /**
       * @throws IllegalStateException Always thrown, as there is no server available.
       */
      public ProgressObject redeploy(TargetModuleID[] moduleIDList, File moduleArchive, File
deploymentPlan) throws UnsupportedOperationException, IllegalStateException {
          return null;
      }
  
      /**
       * @throws IllegalStateException Always thrown, as there is no server available.
       */
      public ProgressObject redeploy(TargetModuleID[] moduleIDList, InputStream moduleArchive,
InputStream deploymentPlan) throws UnsupportedOperationException, IllegalStateException {
          return null;
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/provider/GeronimoDeploymentFactory.java
  
  Index: GeronimoDeploymentFactory.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.enterprise.deploy.provider;
  
  import javax.enterprise.deploy.spi.factories.DeploymentFactory;
  import javax.enterprise.deploy.spi.DeploymentManager;
  import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
  import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager;
  
  /**
   * The Geronimo implementation of the JSR-88 DeploymentFactory.  This is
   * analagous to a JDBC driver.  It provides access to usable
   * DeploymentManager instances, either disconnected, or connected to a
   * specific Geronimo server based on a URL, username, and password.
   *
   * URLs for this DeploymentFactory should look like this for disconnected
   * mode:
   *
   * <pre>deployer:geronimo:</pre>
   *
   * For connected mode, they should look like this:
   *
   * <pre>deployer:geronimo://server:port/application</pre>
   *
   * (Note that connected mode is not yet implemented)
   *
   * @version $Revision: 1.1 $
   */
  public class GeronimoDeploymentFactory implements DeploymentFactory {
      static { // Auto-registers a GeronimoDeploymentFactory
          DeploymentFactoryManager.getInstance().registerDeploymentFactory(new GeronimoDeploymentFactory());
      }
      // All Geronimo URLs must start with this
      private final static String URI_PREFIX = "deployer:geronimo:";
  
      /**
       * Ensures that the URI starts with the blessed Geronimo prefix.
       */
      public boolean handlesURI(String uri) {
          return uri.startsWith(URI_PREFIX);
      }
  
      /**
       * Currently always returns a disconnected DeploymentManager, but will
       * eventually return a connected one.
       *
       * @throws DeploymentManagerCreationException Occurs when the specified
       *         URI, username, and password are not valid to connect to a
       *         Geronimo server.
       */
      public DeploymentManager getDeploymentManager(String uri, String username, String password)
throws DeploymentManagerCreationException {
          if(!handlesURI(uri)) {
              throw new DeploymentManagerCreationException("Invalid URI for "+getDisplayName()+"
"+getProductVersion()+" DeploymentFactory, expecting "+URI_PREFIX+"... got "+uri);
          }
          return new GeronimoDeploymentManager(new NoServerConnection());
      }
  
      /**
       * Returns a connected DeploymentManager.
       *
       * @throws DeploymentManagerCreationException Occurs when the specified
       *         URI is not a Geronimo URI
       */
      public DeploymentManager getDisconnectedDeploymentManager(String uri) throws DeploymentManagerCreationException
{
          if(!handlesURI(uri)) {
              throw new DeploymentManagerCreationException("Invalid URI for "+getDisplayName()+"
"+getProductVersion()+" DeploymentFactory, expecting "+URI_PREFIX+"... got "+uri);
          }
          return new GeronimoDeploymentManager(new NoServerConnection());
      }
  
      public String getDisplayName() {
          return "Geronimo";
      }
  
      public String getProductVersion() {
          return "1.0";
      }
  
      /**
       * All instances of this class are equivalent.
       *
       * @return The same value, always.
       */
      public int hashCode() {
          return 42;
      }
  
      /**
       * All instances of this class are equivalent.
       *
       * @return True of the argument is a GeronimoDeploymentFactory
       */
      public boolean equals(Object o) {
          return o instanceof GeronimoDeploymentFactory;
      }
  
      public String toString() {
          return getDisplayName()+" "+getProductVersion()+" DeploymentFactory";
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/core/src/conf/jsr88-product-provider-manifest.mf
  
  Index: jsr88-product-provider-manifest.mf
  ===================================================================
  Manifest-Version: 1.0
  J2EE-DeploymentFactory-Implementation-Class: org.apache.geronimo.enterprise.deploy.provider.GeronimoDeploymentFactory
  
  
  

Mime
View raw message