View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   * 
19   * Author: Siamak Haschemi
20   * Contact: haschemi@informatik.hu-berlin.de
21   */
22  package net.sourceforge.osgi.deployment.maven;
23  
24  import java.io.File;
25  import java.util.List;
26  
27  import net.sourceforge.osgi.deployment.maven.container.DeploymentPackageInfo;
28  
29  import org.apache.maven.artifact.factory.ArtifactFactory;
30  import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
31  import org.apache.maven.artifact.repository.ArtifactRepository;
32  import org.apache.maven.artifact.resolver.ArtifactResolver;
33  import org.apache.maven.plugin.logging.Log;
34  import org.apache.maven.project.MavenProject;
35  import org.codehaus.plexus.archiver.manager.ArchiverManager;
36  
37  
38  /**
39   * The deployment context provides all relevant data to the deployment plugin. Currently it depends on maven classes and interfaces, but the idea is to abstract
40   * from maven in order to use the deployment plugin with other technologies.
41   * 
42   * @author Siamak Haschemi, haschemi@informatik.hu-berlin.de
43   * 
44   */
45  public interface IDeploymentPluginContext {
46  
47    /**
48     * @return the Maven logger
49     */
50    Log getLogger();
51  
52    /**
53     * @return the outputDirectory
54     */
55    File getOutputDirectory();
56  
57    /**
58     * @return the baseDir
59     */
60    File getBaseDir();
61  
62    /**
63     * @return the manifestLocation
64     */
65    File getManifestLocation();
66  
67    /**
68     * @return the project
69     */
70    MavenProject getProject();
71  
72    /**
73     * @return the buildDirectory
74     */
75    String getBuildDirectory();
76  
77    /**
78     * @return the supportedProjectTypes
79     */
80    List< String > getSupportedProjectTypes();
81  
82    /**
83     * @return the localRepository
84     */
85    ArtifactRepository getLocalRepository();
86  
87    /**
88     * @return the remoteRepositories
89     */
90    List< ArtifactRepository > getRemoteRepositories();
91  
92    /**
93     * @return the artifactFactory
94     */
95    ArtifactFactory getArtifactFactory();
96  
97    /**
98     * @return the artifactResolver
99     */
100   ArtifactResolver getArtifactResolver();
101 
102   /**
103    * @return the artifactHandlerManager
104    */
105   ArtifactHandlerManager getArtifactHandlerManager();
106 
107   /**
108    * @return the archiverManager
109    */
110   ArchiverManager getArchiverManager();
111 
112   /**
113    * @return the deploymentPackage
114    */
115   DeploymentPackageInfo getDeploymentPackageInfo();
116 
117   /**
118    * @return the writeExtraData
119    */
120   boolean isWriteExtraData();
121 
122   /**
123    * Returns the name of the plugin.
124    * 
125    * @return the name of the plugin
126    */
127   String getPluginName();
128 
129   /**
130    * Returns the plugin version.
131    * 
132    * @return the plugin version
133    */
134   String getPluginVersion();
135 
136   /**
137    * This method resolves an artifact on all available repositories and returns the file handle to that artifact.
138    * 
139    * @param p_groupId
140    *          the groupId of the artifact to resolve
141    * @param p_artifactId
142    *          the artifactId of the artifact to resolve
143    * @param p_version
144    *          the version of the artifact to resolve
145    * @return the resolved file handle of the artifact
146    */
147   File resolveResource(final String p_groupId, final String p_artifactId, final String p_version);
148 
149 }