001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *  http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    
020    //
021    // This source code implements specifications defined by the Java
022    // Community Process. In order to remain compliant with the specification
023    // DO NOT add / change / or delete method signatures!
024    //
025    
026    package javax.enterprise.deploy.spi.factories;
027    
028    import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
029    import javax.enterprise.deploy.spi.DeploymentManager;
030    
031    /**
032     * The DeploymentFactory interface is a deployment driver for a J2EE plaform
033     * product.  It returns a DeploymentManager object which represents a
034     * connection to a specific J2EE platform product.
035     *
036     * Each application server vendor must provide an implementation of this class
037     * in order for the J2EE Deployment API to work with their product.
038     *
039     * The class implementing this interface should have a public no-argument
040     * constructor, and it should be stateless (two instances of the class should
041     * always behave the same).  It is suggested but not required that the class
042     * have a static initializer that registers an instance of the class with the
043     * DeploymentFactoryManager class.
044     *
045     * A <tt>connected</tt> or <tt>disconnected</tt> DeploymentManager can be
046     * requested.  A DeploymentManager that runs connected to the platform can
047     * provide access to J2EE resources.  A DeploymentManager that runs
048     * disconnected only provides module deployment configuration support.
049     *
050     * @see javax.enterprise.deploy.shared.factories.DeploymentFactoryManager
051     *
052     * @version $Rev: 467553 $ $Date: 2006-10-25 06:01:51 +0200 (Mi, 25. Okt 2006) $
053     */
054    public interface DeploymentFactory {
055        /**
056         * Tests whether this factory can create a DeploymentManager object based
057         * on the specified URI.  This does not indicate whether such an attempt
058         * will be successful, only whether the factory can handle the uri.
059         *
060         * @param uri The uri to check
061         *
062         * @return <tt>true</tt> if the factory can handle the uri.
063         */
064        public boolean handlesURI(String uri);
065    
066        /**
067         * Returns a <tt>connected</tt> DeploymentManager instance.
068         *
069         * @param uri      The URI that specifies the connection parameters
070         * @param username An optional username (may be <tt>null</tt> if no
071         *                 authentication is required for this platform).
072         * @param password An optional password (may be <tt>null</tt> if no
073         *                 authentication is required for this platform).
074         *
075         * @return A ready DeploymentManager instance.
076         *
077         * @throws DeploymentManagerCreationException occurs when a
078         *         DeploymentManager could not be returned (server down, unable
079         *         to authenticate, etc).
080         */
081        public DeploymentManager getDeploymentManager(String uri, String username, String password) throws DeploymentManagerCreationException;
082    
083        /**
084         * Returns a <tt>disconnected</tt> DeploymentManager instance.
085         *
086         * @param uri the uri of the DeploymentManager to return.
087         *
088         * @return A DeploymentManager <tt>disconnected</tt> instance.
089         *
090         * @throws DeploymentManagerCreationException occurs if the
091         *         DeploymentManager could not be created.
092         */
093        public DeploymentManager getDisconnectedDeploymentManager(String uri) throws DeploymentManagerCreationException;
094    
095        /**
096         * Provide a string with the name of this vendor's DeploymentManager.
097         *
098         * @return the name of the vendor's DeploymentManager.
099         */
100        public String getDisplayName();
101    
102        /**
103         * Provides a string identifying the version of this vendor's
104         * DeploymentManager.
105         *
106         * @return the name of the vendor's DeploymentManager.
107         */
108        public String getProductVersion();
109    }