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.businessobjects.environment.Machine;
19  import org.figure8.join.businessobjects.environment.Resource;
20  import org.figure8.join.businessobjects.environment.ResourceType;
21  import org.figure8.join.businessobjects.environment.AbstractResource;
22  import org.figure8.join.businessobjects.environment.AbstractResourceType;
23  import org.figure8.join.businessobjects.environment.PhysicalEnvironment;
24  import org.figure8.join.businessobjects.environment.EIS;
25  import org.figure8.join.businessobjects.environment.Gateway;
26  import org.figure8.join.businessobjects.environment.EISMapping;
27  import org.figure8.join.businessobjects.environment.ResourceMapping;
28  import org.figure8.join.businessobjects.environment.ResourceVersion;
29  import org.figure8.join.businessobjects.environment.VersionedResource;
30  import org.figure8.join.businessobjects.environment.VersionedResourceType;
31  
32  import org.figure8.join.view.VersionedResourceTrackingView;
33  import org.figure8.join.view.GatewayTrackingView;
34  
35  import java.util.List;
36  import java.util.Date;
37  /**
38   * This is a business interfaces providing methods for managing resources
39   * used by software project integration team. This manager also allows to
40   * manage mapping done between resources and physical environments.
41   * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
42   * @version $Revision: 1.4 $
43   */
44  public interface ResourceManager{
45  
46     // Public -------------------------------------------------------------------
47  
48     /**
49      * Save a ResourceType within datastore (create or update). Only types that
50      * are EntityObjects ({@link AbstractResourceType}s) can be saved at that time.
51      * @param type The ResourceType to save
52      * @throws DuplicateEntityException if a ResourceType with same key already exists
53      */
54     public abstract void saveResourceType(AbstractResourceType type) throws DuplicateEntityException;
55     
56     /**
57      * Retrieve ResourceTypes corresponding to specified category
58      * @param category The category resource types whould belong to
59      * @return A list of {@code org.figure8.join.businessobjects.environment.ResourceType} of this category
60      */
61     public abstract List getResourceTypes(String category);
62     
63     /**
64      * Retrieve all defined resource types
65      * @return A list of {@code org.figure8.join.businessobjects.environment.ResourceType}
66      */
67     public abstract List getResourceTypes();
68     
69     /**
70      * Retrieve the ResourceType having the specified key
71      * @param key The unique key identifier of the ResourceType
72      * @return The ResourceType having this key or null if no type has the specified key
73      */
74     public abstract ResourceType getResourceType(String key);
75     
76     /**
77      * Save a Resource within datastore (create or update). Only resource that
78      * are EntityObjects ({@link AbstractResource}s) can be saved at that time.
79      * @param resource The Resource to save
80      * @throws DuplicateEntityException if a resource wiht same key already exists
81      */
82     public abstract void saveResource(AbstractResource resource) throws DuplicateEntityException;
83  
84     /**
85      * Retrieve resources having the specified resource type
86      * @param resourceType The type resources should belong to
87      * @return A list of {@code org.figure8.join.businessobjects.environment.Resource} of this type
88      */
89     public abstract List getResources(AbstractResourceType resourceType);
90  
91     /**
92      * Retrieve resources corresponding to specified category
93      * @param category The category resources should belong to
94      * @return A list of {@code org.figure8.join.businessobjects.environment.Resource} of this category
95      */
96     public abstract List getResources(String category);
97     
98     /**
99      * Retrieve the Resource having the specified name
100     * @param name The name of the Resource to retrieve
101     * @return The corresponding Resource or null if no Resource has the specified name
102     */
103    public abstract Resource getResource(String name);
104 
105    /**
106     * Retrieve the Resource hanving the specified identifier
107     * @param id The identifier of Resource to retrieve
108     * @return The corresponding Resource or null if no Resource has this identifier
109     */
110    public abstract Resource getResource(long id);
111 
112    /**
113     * Get a configuration changes tracking view for a specified gateway
114     * on a specified time period (between start date and end date included).
115     * @param name The name of gateway to retrieve a tracking view for
116     * @param startDate The date to start the configuration changes tracking
117     * @param endDate The date to end the configuration changes tracking
118     * @return A GatewayTrackingView for requested tracking period
119     */
120    public abstract GatewayTrackingView getGatewayTrackingView(String name, Date startDate, Date endDate);
121 
122    /**
123     * Get a view representing versioned resource configuration at a specified date
124     * @param name The name of resource to retrieve configuration for
125     * @param configDate The date to get resource configuration
126     * @return A VersionedResource for requested date
127     */
128    public abstract VersionedResource getVersionedResource(String name, Date configDate);
129 
130    /**
131     * Get a version updates tracking view for a specified versioned resource
132     * on a specified time period (between start date and end date included).
133     * @param name The name of resource to retrieve a tracking view for
134     * @param startDate The date to start the resource version updates tracking
135     * @param endDate The date to end the resource version updates tracking
136     * @return A VersionedResourceTrackingView for requested tracking period
137     */
138    public abstract VersionedResourceTrackingView getVersionedResourceTrackingView(String name,
139                                                    Date startDate, Date endDate);
140 
141    /**
142     * Save a RsourceVersion within datastore (create or update)
143     * @param version The resource version to save
144     * @throws DuplicateEntityException is a resource with same name already exists
145     */
146    public abstract void saveResourceVersion(ResourceVersion version) throws DuplicateEntityException;
147 
148    /**
149     * Retrieve the available resource versions for a resource type
150     * @param resourceType The VersionedResourceType to get versions for
151     * @return A list of {@code org.figure8.join.businessobjects.environment.ResourceVersion}
152     */
153    public abstract List getResourceVersions(VersionedResourceType resourceType);
154 
155    /**
156     * Retrieve the ResourceVersion having the specified name
157     * @param name The name of ResourceVersion to retrieve
158     * @return The corresponding ResourceVersion or null if no one has this name
159     */
160    public abstract ResourceVersion getResourceVersion(String name);
161 
162    /**
163     * Retrieve the ResourceVersion having this identifier
164     * @param id The unique identifier of ResourceVersion to retrieve
165     * @return The corresponding ResourceVersion or null if no one has this identifier
166     */
167    public abstract ResourceVersion getResourceVersion(long id);
168 
169    /**
170     * Update a versioned resource using a resource version
171     * @param resource The VersionedResource to update
172     * @param version The ResourceVersion to use for update
173     */
174    public abstract void updateResource(VersionedResource resource, ResourceVersion version);
175 
176    /**
177     * Save a Machine within datastore (create or update)
178     * @param machine The machine to save
179     * @throws DuplicateEntityException if a machine with same name already exists
180     */
181    public abstract void saveMachine(Machine machine) throws DuplicateEntityException;
182 
183    /**
184     * Retrieve the available machines used by integration team.
185     * @return A list of {@code org.figure8.join.businessobjects.environment.Machine}
186     */
187    public abstract List getMachines();
188 
189    /**
190     * Retrieve the Machine having the specified identifier
191     * @param id The identifier ot Machine to retrieve
192     * @return The corresponding Machine or null if no Machine has this identifier
193     */
194    public abstract Machine getMachine(long id);
195 
196    /**
197     * Retrieve a ResourceMapping using its unique identifier
198     * @param id The unique identifier of mapping to retrieve
199     * @return The corresponding ResourceMapping or null if no one match
200     */
201    public abstract ResourceMapping getResourceMapping(long id);
202 
203    /**
204     * Create a new mapping of an infrastructure resource onto a physical one. This closes
205     * the previously existing active mapping on environment for a resource of same type (if any).
206     * @param resource The infrastructure resource to map onto environemnt
207     * @param environment The physical environment to be mapped with resource
208     */
209    public abstract void mapResourceOnEnvironment(AbstractResource resource, PhysicalEnvironment environment);
210 
211    /**
212     * Closes the specified ResourceMapping. This involves deactivating it and removing it
213     * from active mapping list within its related physical environments.
214     * @param mapping The ResourceMapping to close
215     */
216    public abstract void closeResourceMapping(ResourceMapping mapping);
217 
218    /**
219     * Retrieve an EISMapping using its unique identifier
220     * @param id The unique identifier of mapping to retrieve
221     * @return The corresponding EISMapping or null if no one match
222     */
223    public abstract EISMapping getEISMapping(long id);
224 
225    /**
226     * Create a new mapping of an EIS onto a gateway. This closes the previously existing
227     * active mapping on gateway for the EIS of same type (if any).
228     * @param eis The EIS to map onto gateway
229     * @param gateway The gateway to be mapped with EIS
230     */
231    public abstract void mapEISOnGateway(EIS eis, Gateway gateway);
232 
233    /**
234     * Closes the specified EISMapping. This involves deactivating it and removing is
235     * from active mapping list within its related gateway.
236     * @param mapping The EISMapping to close
237     */
238    public abstract void closeEISMapping(EISMapping mapping);
239 }
240