Skip to content

Package: ECPProjectManager

ECPProjectManager

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2013 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Eike Stepper - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.core;
15:
16: import java.util.Collection;
17:
18: import org.eclipse.emf.ecp.core.exceptions.ECPProjectWithNameExistsException;
19: import org.eclipse.emf.ecp.core.util.ECPProperties;
20:
21: /**
22: * The ECPProjectManager provides access to ECPProjects and manages their lifecycle.
23: * It is available as an OSGi service or using {@link org.eclipse.emf.ecp.core.util.ECPUtil} It publishes
24: * observable events on the {@link org.eclipse.emf.ecp.core.util.observer.ECPObserverBus ECPObserverBus}.
25: * Related Observer types: {@link org.eclipse.emf.ecp.core.util.observer.ECPProjectsChangedObserver
26: * ECPProjectsChangedObserver}, {@link org.eclipse.emf.ecp.core.util.observer.ECPProjectContentChangedObserver
27: * ECPProjectContentChangedObserver}, {@link org.eclipse.emf.ecp.core.util.observer.ECPProjectOpenClosedObserver
28: * ECPProjectOpenClosedObserver}, {@link org.eclipse.emf.ecp.core.util.observer.ECPProjectPreDeleteObserver
29: * ECPProjectPreDeleteObserver}. Use {@link org.eclipse.emf.ecp.core.util.ECPUtil#getECPObserverBus()
30: * ECPUtil#getECPObserverBus()} to
31: * retrieve the ObserverBus and
32: * {@link org.eclipse.emf.ecp.core.util.observer.ECPObserverBus#register(org.eclipse.emf.ecp.core.util.observer.ECPObserver)
33: * ECPObserverBus#register(ECPObserver)} to register an Observer.
34: *
35: * @author Eike Stepper
36: * @author Jonas
37: * @author Eugen Neufeld
38: * @noimplement This interface is not intended to be implemented by clients.
39: * @noextend This interface is not intended to be extended by clients.
40: */
41: public interface ECPProjectManager {
42:
43:         /**
44:          * Method to construct an offline Project, this method calls
45:          * {@link #createProject(ECPProvider, String, ECPProperties)} with empty properties. If
46:          * {@link ECPProvider#hasCreateProjectWithoutRepositorySupport()} returns
47:          * false an UnsupportedOperationException is thrown.
48:          *
49:          * @param provider the {@link ECPProvider} of this project
50:          * @param name the name of the project
51:          * @return created {@link ECPProject}
52:          * @throws ECPProjectWithNameExistsException when a project with the same name already exists
53:          */
54:
55:         ECPProject createProject(ECPProvider provider, String name) throws ECPProjectWithNameExistsException;
56:
57:         /**
58:          * Method to construct an offline Project and notify listeners about this add. If
59:          * {@link ECPProvider#hasCreateProjectWithoutRepositorySupport()} returns
60:          * false an UnsupportedOperationException is thrown.
61:          *
62:          * @param provider the {@link ECPProvider} of this project
63:          * @param name the name of the project
64:          * @param properties the project properties
65:          * @return created {@link ECPProject}
66:          * @throws ECPProjectWithNameExistsException when a project with the same name already exists
67:          */
68:
69:         ECPProject createProject(ECPProvider provider, String name, ECPProperties properties)
70:                 throws ECPProjectWithNameExistsException;
71:
72:         /**
73:          * Method to construct an shared Project, e.g. during a checkout, and notify listeners about this add.
74:          *
75:          * @param repository the {@link ECPRepository} of this project
76:          * @param name the name of the project
77:          * @param properties the project properties
78:          * @return created {@link ECPProject}
79:          * @throws ECPProjectWithNameExistsException when a project with the same name already exists
80:          */
81:         ECPProject createProject(ECPRepository repository, String name, ECPProperties properties)
82:                 throws ECPProjectWithNameExistsException;
83:
84:         /**
85:          * Method to construct a new Project based on an existing project as template. If the template project is shared, so
86:          * is the created project.
87:          *
88:          * @param project the template {@link ECPProject}
89:          * @param name the name of the created project
90:          * @return the clone of the {@link ECPProject}
91:          */
92:         ECPProject createProject(ECPProject project, String name);
93:
94:         /**
95:          * Retrieves the project the adaptable belongs to if possible.
96:          * This method checks whether the adaptable is {@link org.eclipse.emf.ecp.core.util.ECPProjectAware ECPProjectAware}
97:          * and else uses the AdapterUtil to adapt to a
98:          * project.
99:          *
100:          * @param adaptable the Object to adapt
101:          * @return the adapted {@link ECPProject}
102:          */
103:         ECPProject getProject(Object adaptable);
104:
105:         /**
106:          * Searches for a project based on the provided {@link String}.
107:          *
108:          * @param name of the project to search for
109:          * @return the {@link ECPProject}
110:          */
111:
112:         ECPProject getProject(String name);
113:
114:         /**
115:          * Returns all known projects.
116:          *
117:          * @return an array of all known projects
118:          */
119:         Collection<ECPProject> getProjects();
120:
121: }