View Javadoc

1   /**
2    * Copyright 2005-2007 the original author or authors.
3    *
4    * Licensed under the Gnu General Pubic License, Version 2.0 (the
5    * "License"); you may not use this file except in compliance with
6    * the License. You may obtain a copy of the License at
7    *
8    *      http://www.opensource.org/licenses/gpl-license.php
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13   * See the Gnu General Public License for more details.
14   */
15  package org.figure8.join.businessfacades.environment;
16  
17  import org.figure8.join.core.DuplicateEntityException;
18  import org.figure8.join.services.workflow.OperationNotAllowedException;
19  import org.figure8.join.businessobjects.environment.Deployment;
20  import org.figure8.join.businessobjects.environment.EnvironmentMapping;
21  import org.figure8.join.businessobjects.environment.LogicalEnvironment;
22  import org.figure8.join.businessobjects.environment.PhysicalEnvironment;
23  import org.figure8.join.view.EnvironmentView;
24  import org.figure8.join.view.PhysicalEnvironmentTrackingView;
25  
26  import java.util.List;
27  import java.util.Date;
28  /**
29   * This is a business interface providing methods for manipulating the
30   * different environments managed using the Join application.<br/>
31   * Implementation of this methods should define how logical and physical
32   * environments are created, updated and retrieved.
33   * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
34   * @version $Revision: 1.4 $
35   */
36  public interface EnvironmentManager{
37  
38     // Public -------------------------------------------------------------------
39  
40     /**
41      * Save a LogicalEnvironment within datastore (create or update)
42      * @param environment The logical environment to save
43      * @throws DuplicateEntityException if an environment with same key already exists
44      */
45     public abstract void saveLogicalEnvironment(LogicalEnvironment environment) throws DuplicateEntityException;
46  
47     /**
48      * Retrieve all the defined logical environments.
49      * @return A list of {@code org.figure8.join.businessobjects.environment.LogicalEnvironment} objects
50      */
51     public abstract List getLogicalEnvironments();
52  
53     /**
54      * Retrieve a logical environment using its entity identifier
55      * @param id The unique identifier of environment to retrieve
56      * @return The specified environment or null if not found
57      */
58     public abstract LogicalEnvironment getLogicalEnvironment(long id);
59  
60     /**
61      * Retrieve a logical environment using its key
62      * @param key The key of environment to retrieve
63      * @return The specified environment or null if not found
64      */
65     public abstract LogicalEnvironment getLogicalEnvironment(String key);
66  
67     /**
68      * Build an {@link EnvironmentView} object from a Logical environment instance. A view
69      * is a consolidated object aroung logical environmnet allowing to embbed related infos.
70      * @param environment The logical environemnt to get a view for
71      * @return The view object representing a logical environment and its consolidated informations.
72      */
73     public abstract EnvironmentView getEnvironmentView(LogicalEnvironment environment);
74  
75     /**
76      * Retrieve an EnvironmentMapping using its unique identifier
77      * @param id The unique identifier of mapping to retrieve
78      * @return The EnvironmentMapping corresponding to this id or null if no one matches
79      */
80     public abstract EnvironmentMapping getEnvironmentMapping(long id);
81  
82     /**
83      * Retrieve all the environment mappings for a LogicalEnvironment through time
84      * @param environment The logical environment to retrieve mappings for
85      * @return A List of {@link EnvironmentMapping} objects for this logical environmnet
86      */
87     public abstract List getEnvironmentMappings(LogicalEnvironment environment);
88  
89     /**
90      * Retrieve all the environment mappings for a PhysicalEnvironment through time
91      * @param environment The physical environment to retrieve mappings for
92      * @return A list of {@link EnvironmentMapping} objects for this physical environment
93      */
94     public abstract List getEnvironmentMappings(PhysicalEnvironment environment);
95  
96     /**
97      * Retrieve EnvironmentMapping that was active for an environment at specified date
98      * @param environment The LogicalEnvironment to retrieve mapping for
99      * @param configDate The date to retrieve active mapping
100     * @return The active {@link EnvironmentMapping} at date or null if no one was active
101     */
102    public abstract EnvironmentMapping getEnvironmentMappingAtDate(LogicalEnvironment environment, Date configDate);
103 
104    /**
105     * Create a new mapping of a logical environment onto a physical one. This closes
106     * all the other current active environment mappings for this 2 environments.
107     * @param logicalEnv The logical environment to map onto physical
108     * @param physicalEnv The physical environment to be mapped with logical
109     */
110    public abstract void mapEnvironments(LogicalEnvironment logicalEnv, PhysicalEnvironment physicalEnv);
111 
112    /**
113     * Closes the specified EnvironmentMapping. This involves deactivating it and removing it
114     * from active mapping list within its related logical and physical environments.
115     * @param mapping The EnvironmentMapping to close
116     */
117    public abstract void closeEnvironmentMapping(EnvironmentMapping mapping);
118 
119    /**
120     * Save a PhysicalEnvironment within datastore (create or update)
121     * @param environment The physical environment to save
122     * @throws DuplicateEntityException if an environment with same key already exists
123     */
124    public abstract void savePhysicalEnvironment(PhysicalEnvironment environment) throws DuplicateEntityException;
125 
126    /**
127     * Retrieve all the defined physical environments.
128     * @return A list of {@code org.figure8.join.businessobjects.environment.PhysicalEnvironment} objects
129     */
130    public abstract List getPhysicalEnvironments();
131 
132    /**
133     * Retrieve a physical environment using its entity identifier
134     * @param id The unique identifier of environment to retrieve
135     * @return The specified environment or null if not found
136     */
137    public abstract PhysicalEnvironment getPhysicalEnvironment(long id);
138 
139    /**
140     * Retrieve a physical environment using its key
141     * @param key The key of environment to retrieve
142     * @return The specified environment or null if not found
143     */
144    public abstract PhysicalEnvironment getPhysicalEnvironment(String key);
145 
146    /**
147     * Get a view representing physical environment configuration at a specified date
148     * @param key The key of environment to retrieve a configuration view for
149     * @param configDate The date to get environment configuration
150     * @return A PhysicalEnvironment for requested date
151     */
152    public abstract PhysicalEnvironment getPhysicalEnvironmentAtDate(String key, Date configDate);
153 
154    /**
155     * Get a configuration changes traking view for a specified physical environment
156     * on a specified time period (between start date and end date included).
157     * @param key The key of environment to retrieve a tracking view for
158     * @param startDate The date to start the configuration changes tracking
159     * @param endDate The date to end the configuration changes tracking
160     * @return A PhysicalEnvrionmentTrakingView for requested tracking period
161     */
162    public abstract PhysicalEnvironmentTrackingView getPhysicalEnvironmentTrackingView(String key,
163                                                       Date startDate, Date endDate);
164 
165    /**
166     * Save a Deployment informations within datastore (create or update)
167     * @param deployment The deployment information to save
168     */
169    public abstract void saveDeployment(Deployment deployment);
170 
171    /**
172     * Create a Deployment informations : this is the beginning step of
173     * a Deployment lifecycle. Following steps may be chained automically
174     * or not depending on transitions policy.
175     * @param deployment The deployment information to create
176     * @throws OperationNotAllowedException if deployment cannot be done depending on workflow rules
177     */
178    public abstract void createDeployment(Deployment deployment) throws OperationNotAllowedException;
179 
180    /**
181     * Start preparation process of a Deployment : this is the second
182     * step of deployment lifecycle.
183     * @param deployment The deployment to start preparation process for
184     */
185    public abstract void prepareDeployment(Deployment deployment);
186 
187    /**
188     * Start the realization process of a Deployment : this is a step
189     * that must follow the "prepared" state of deployment.
190     * @param deployment The deployment to start realization process for
191     * @throws OperationNotAllowedException if deployment cannot be realized depending on workflow rules
192     */
193    public abstract void realizeDeployment(Deployment deployment) throws OperationNotAllowedException;
194 
195    /**
196     * Cancel a deployment process whether it is in preparation phase
197     * or in realization phase.
198     * @param deployment The informations on deployment process to cancel
199     * @param comments Comments on deployment cancelling
200     */
201    public abstract void cancelDeployment(Deployment deployment, String comments);
202 
203    /**
204     * End a deployment process : this is the final step into this process.
205     * Deployment will be then into a "done" state.
206     * @param deployment The informations on deployment process to end
207     * @param comments Comments on deployment end
208     * @throws OperationNotAllowedException if deployment cannot be ended depending on workflow rules
209     */
210    public abstract void endDeployment(Deployment deployment, String comments) throws OperationNotAllowedException;
211 
212    /**
213     * Get all the deployments being in preparation stage at that time
214     * @return A list of {@link Deployment}s having a status corresponding to preparation process
215     */
216    public abstract List getPreparingDeployments();
217 
218    /**
219     * Get all the deployments being in realization stage at that time
220     * @return A list of {@link Deployment}s having a status corresponding to realization process
221     */
222    public abstract List getRealizingDeployments();
223 
224    /**
225     * Retrieve all the deployments realized for a logical environment
226     * @param environment The LogicalEnvironment we wants deployments for
227     * @return A list of {@link Deployment}s done for the specified logical environment
228     */
229    public abstract List getDeployments(LogicalEnvironment environment);
230 
231    /**
232     * Retrieve all the deployments realized onto a physical environment
233     * @param environment The PhysicalEnvironment we want deployments for
234     * @return A list of {@link Deployment}s done onto the specified physical environment
235     */
236    public abstract List getDeployments(PhysicalEnvironment environment);
237 
238    /**
239     * Retrieve a Deployment using its unique identifier
240     * @param id The identifier of deployment to retrieve
241     * @return The corresponding deployment or null if no deployment has this identifier
242     */
243    public abstract Deployment getDeployment(long id);
244 }