3b63b0fb05d747d2d808c4b44332bd08f45347cd
[vfc/nfvo/wfengine.git] /
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.resources;
13
14 import javax.ws.rs.core.Response;
15
16 import org.eclipse.winery.model.tosca.Definitions;
17 import org.eclipse.winery.common.ids.definitions.TOSCAComponentId;
18
19 public abstract class AbstractComponentInstanceWithReferencesResource extends AbstractComponentInstanceResource {
20         
21         public AbstractComponentInstanceWithReferencesResource(TOSCAComponentId id) {
22                 super(id);
23         }
24         
25         /**
26          * Ensures that the presented XML is in line with the stored files
27          */
28         @Override
29         public Response getXML() {
30                 this.synchronizeReferences();
31                 return super.getXML();
32         }
33         
34         @Override
35         public String getDefinitionsAsXMLString() {
36                 this.synchronizeReferences();
37                 return super.getDefinitionsAsXMLString();
38         }
39         
40         @Override
41         public Definitions getDefinitions() {
42                 this.synchronizeReferences();
43                 return super.getDefinitions();
44         }
45         
46         /**
47          * Synchronizes the artifact references with the files stored in the
48          * repository
49          */
50         public abstract void synchronizeReferences();
51         
52 }