This repository has been archived by the owner on Nov 30, 2021. It is now read-only.
/
ProjectService.java
116 lines (101 loc) · 3.9 KB
/
ProjectService.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
* Copyright 2012 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.guvnor.common.services.project.service;
import org.guvnor.common.services.project.model.POM;
import org.guvnor.common.services.project.model.Package;
import org.guvnor.common.services.project.model.Project;
import org.guvnor.common.services.project.model.ProjectImports;
import org.guvnor.common.services.shared.file.SupportsRead;
import org.guvnor.common.services.shared.file.SupportsUpdate;
import org.guvnor.common.services.workingset.client.model.WorkingSetSettings;
import org.jboss.errai.bus.server.annotations.Remote;
import org.uberfire.backend.repositories.Repository;
import org.uberfire.backend.vfs.Path;
import java.util.Set;
/**
*
*/
@Remote
public interface ProjectService extends SupportsRead<ProjectImports>,
SupportsUpdate<ProjectImports> {
WorkingSetSettings loadWorkingSetConfig( final Path project );
/**
* Given a Resource path resolve it to the containing Project Path. A Project path is the folder containing pom.xml
* @param resource
* @return Path to the folder containing the Project's pom.xml file or null if the resource was not in a Project
*/
Project resolveProject( final Path resource );
/**
* Given a Resource path resolve it to the containing Package Path. A Package path is the folder containing the resource.
* The folder must be within a valid Project structure and at least reference /src/main/java, /src/main/resources,
* src/test/java or src/test/resources (or deeper).
* @param resource
* @return Path to the folder containing the resource file or null if the resource is not in a Package.
*/
org.guvnor.common.services.project.model.Package resolvePackage( final Path resource );
/**
* Given a Project resolves the calculation of all the packages for this project.
* @param project
* @return Collection containing all the packages for the project.
*/
Set<Package> resolvePackages( final Project project );
/**
* Return true if the file is the Project's pom.xml file
* @param resource
* @return
*/
boolean isPom( Path resource );
/**
* Return true if the file is the Project's kmodule.xml file
* @param resource
* @return
*/
boolean isKModule( Path resource );
/**
* Creates a new project to the given path.
* @param repository
* @param name
* @param pom
* @param baseURL the base URL where the Guvnor is hosted in web container
* @return
*/
Project newProject( final Repository repository,
final String name,
final POM pom,
final String baseURL );
/**
* Creates a new package as a child of the provide package.
* @param pkg
* @param packageName
* @return
*/
Package newPackage( final Package pkg,
final String packageName );
/**
* Add a role to a project; limiting access to users with the role
* @param project The Project
* @param role The required role
*/
void addRole( final Project project,
final String role );
/**
* Remove a role from a project
* @param project The Project
* @param role The role
*/
void removeRole( final Project project,
final String role );
}