Add winery source code
[vfc/nfvo/wfengine.git] / winery / org.eclipse.winery.repository / src / main / java / org / eclipse / winery / repository / backend / IRepository.java
1 /*******************************************************************************
2  * Copyright (c) 2012-2013 University of Stuttgart.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * and the Apache License 2.0 which both accompany this distribution,
6  * and are available at http://www.eclipse.org/legal/epl-v10.html
7  * and http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Contributors:
10  *     Oliver Kopp - initial API and implementation
11  *******************************************************************************/
12 package org.eclipse.winery.repository.backend;
13
14 import java.util.Date;
15
16 import org.apache.commons.configuration.Configuration;
17 import org.eclipse.winery.common.RepositoryFileReference;
18 import org.eclipse.winery.common.ids.GenericId;
19
20 /**
21  * Provides interface to the backend.
22  * 
23  * Currently a file-based backend is implemented. In the future, a git-based or
24  * a database-based backend is possible.
25  * 
26  * The properties are managed by org.apache.commons.configuration. In case a new
27  * backend is added, the appropriate implementation of
28  * org.apache.commons.configuration.AbstrctConfiguration has to be chosen.
29  * 
30  */
31 public interface IRepository extends IGenericRepository {
32         
33         /**
34          * Returns the configuration of the specified id
35          * 
36          * If the associated TOSCA element does not exist, an empty configuration is
37          * returned. That means, the associated TOSCA element is created (SIDE
38          * EFFECT)
39          * 
40          * The returned configuration ensures that autoSave is activated
41          * 
42          * @param id may be a reference to a TOSCAcomponent or to a nested
43          *            TOSCAelement
44          * @return a Configuration, where isAutoSave == true
45          */
46         Configuration getConfiguration(GenericId id);
47         
48         /**
49          * Enables resources to define additional properties. Currently used for
50          * tags.
51          * 
52          * Currently, more a quick hack. A generic TagsManager should be introduced
53          * to enable auto completion of tag names
54          * 
55          * If the associated TOSCA element does not exist, an empty configuration is
56          * returned. That means, the associated TOSCA element is created (SIDE
57          * EFFECT)
58          */
59         Configuration getConfiguration(RepositoryFileReference ref);
60         
61         /**
62          * 
63          * @return the last change date of the configuration belonging to the given
64          *         id. NULL if the associated TOSCA element does not exist.
65          */
66         Date getConfigurationLastUpdate(GenericId id);
67         
68 }