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.artifact;
16  
17  import org.figure8.join.core.DuplicateEntityException;
18  import org.figure8.join.core.InvalidParameterException;
19  import org.figure8.join.services.repository.Repository;
20  import org.figure8.join.businessobjects.commons.Release;
21  import org.figure8.join.businessobjects.artifact.Assembly;
22  import org.figure8.join.businessobjects.artifact.Component;
23  import org.figure8.join.businessobjects.artifact.Deliverable;
24  import org.figure8.join.businessobjects.artifact.ComponentType;
25  import org.figure8.join.businessobjects.artifact.DeliverableType;
26  
27  import java.io.InputStream;
28  import java.util.List;
29  /**
30   * This is a business facade interface allowing to manage the software
31   * project artifacts and their categories (aka. {@link DeliverableType}s and
32   * {@link ComponentType}s).<br/>
33   * Implementation of this methods should define how artifacts and their categories
34   * are created, updated and retrieved. It may also defined how and when artifacts
35   * are stored within their {@link Repository}. Such repositories are initialized
36   * by container and passed to implementations.
37   * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
38   * @version $Revision: 1.3 $
39   *
40   * @see org.figure8.join.services.repository.Repository
41   */
42  public interface ArtifactManager{
43     
44     // Public -------------------------------------------------------------------
45  
46     /**
47      * Bind a component to an existing assembly. If component is not already
48      * registered, create it. And update its reference assembly (the one that
49      * first contains the component)
50      * @param component The component to bind to assembly
51      * @param assembly The assembly that is containing component
52      */
53     public abstract void bindComponent(Component component, Assembly assembly);
54  
55     /**
56      * Get a component having this specified key.
57      * @param key Unique business identifier of component to retrieve
58      * @return The component having this business key
59      */
60     public abstract Component getComponent(String key);
61  
62     /**
63      * Retrieve a list of components corresponding to the specified type and created into release
64      * @param type The component type of the components to retrieve
65      * @param release The release the components have been bound to
66      * @return A list of {@code org.figure8.join.businessobjects.artifact.Component}s
67      */
68     public abstract List getComponents(ComponentType type, Release release);
69  
70     /**
71      * Retrieve a list of components of the specified type and contained into release
72      * @param type The component type of the components to retrieve
73      * @param release The release the components have been bound to
74      * @return A list of {@code org.figure8.join.businessobjects.artifact.Component}s
75      */
76     public abstract List getContainedComponents(ComponentType type, Release release);
77  
78     /**
79      * Save a component type within datastore
80      * @param type Type to save (create or update)
81      * @throws DuplicateEntityException if another type with same key already exists
82      */
83     public abstract void saveComponentType(ComponentType type) throws DuplicateEntityException;
84  
85     /**
86      * Get a component category having the specified key.
87      * @param key Unique business identifier of the component type to retrieve
88      * @return ComponentType having this <b>key</b>
89      */
90     public abstract ComponentType getComponentType(String key);
91  
92     /**
93      * Retrieve the component types (or category) of software.
94      * @return List of available {@code org.figure8.join.businessobjects.artifact.ComponentType}
95      */
96     public abstract List getComponentTypes();
97  
98     /**
99      * Create a deliverable within datastore and register its content. The
100     * stream parameter may be null if deliverable content should be retrievied
101     * through a SCM extraction or some other mean ...
102     * @param deliverable The new deliverable to register within Join application
103     * @param content The stream containing deliverable content (if any)
104     * @throws InvalidParameterException if deliverable is already registered
105     * @throws DuplicateEntityException if another deliverable with same key already exists
106     */
107    public abstract void registerDeliverable(Deliverable deliverable, InputStream content)
108            throws InvalidParameterException, DuplicateEntityException;
109 
110    /**
111     * Save a deliverable within datastore. This method should be used only for
112     * updating existing deliverables. They must have been first created using the
113     * <code>registerDeliverable()</code> method.
114     * @param deliverable The deliverable to save (just an update)
115     * @throws InvalidParameterException if deliverable has not been registered before
116     */
117    public abstract void saveDeliverable(Deliverable deliverable) throws InvalidParameterException;
118 
119    /**
120     * Get a deliverable having this specified key.
121     * @param key Unique business identifier of deliverable to retrieve
122     * @return The deliverable having this business key
123     */
124    public abstract Deliverable getDeliverable(String key);
125 
126    /**
127     * Retrieve a list of deliverables corresponding to the specified type
128     * @param type The deliverable type of the deliverables to retrieve
129     * @param maxResult An int to limit the size of list returned
130     * @return A list of {@code org.figure8.join.businessobjects.artifact.Deliverable}s
131     */
132    public abstract List getLastDeliverables(DeliverableType type, int maxResult);
133 
134    /**
135     * Retrieve a list of deliverables corresponding to the specified type for this release
136     * @param type The deliverable type of the deliverables to retrieve
137     * @param release The release the deliverables have been bound to
138     * @return A list of {@code org.figure8.join.businessobjects.artifact.Deliverable}s
139     */
140    public abstract List getDeliverables(DeliverableType type, Release release);
141 
142    /**
143     * Set the repository to use for storing deliverables. This repository
144     * is necessary when registering a new Deliverables.
145     * @param repository The repository for storing deliverables content
146     */
147    public abstract void setDeliverablesRepository(Repository repository);
148 
149    /**
150     * Save a deliverable type within datastore. If type is a newly created type,
151     * its key should a non existing one. Otherwise, a DuplicateEntityException will
152     * thrown. If type is already existing, the key is an immutable field an a runtime
153     * exception exception will be thrown if it has changed.
154     * @param type Type to save (create or update)
155     * @throws DuplicateEntityException if another type with same key already exists
156     */
157    public abstract void saveDeliverableType(DeliverableType type) throws DuplicateEntityException;
158 
159    /**
160     * Get a deliverable type having the specified key.
161     * @param key Unique business identifier of the deliverable type to retrieve
162     * @return DeliverableType having this <b>key</b>
163     */
164    public abstract DeliverableType getDeliverableType(String key);
165 
166    /**
167     * Retrieve the deliverable types (or category) of software.
168     * @return List of available {@code org.figure8.join.businessobjects.artifact.DeliverableType}
169     */
170    public abstract List getDeliverableTypes();
171 }