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.container;
23  
24  import net.sourceforge.osgi.deployment.maven.IResource;
25  
26  /**
27   * <p>
28   * From the Deployment Admin Specification:
29   * </p>
30   * <p>
31   * A Deployment Package consists of installable <i>resources</i>. Resources are described in the <i>Name sections</i> of the Manifest. They are stored in the
32   * JAR file under a path. This path is called the <i>resource id</i>. Subsets of these resources are the bundles. Bundles are treated differently from the
33   * other resources by the Deployment Admin service. Non-bundle resources are called <i>processed resources</i>.
34   * </p>
35   * 
36   * @author Siamak Haschemi, haschemi@informatik.hu-berlin.de
37   * 
38   */
39  public class ProcessedResource implements IResource {
40    private String m_processor;
41    private String m_filePath;
42    private String m_targetPath;
43  
44    /**
45     * A constructor which initializes an instance of a {@link ProcessedResource}.
46     */
47    public ProcessedResource() {
48      m_processor = null;
49      m_filePath = null;
50      m_targetPath = null;
51    }
52  
53    /**
54     * @return the file
55     */
56    public final String getFilePath() {
57      return m_filePath;
58    }
59  
60    /**
61     * @param p_filePath
62     *          the file to set
63     */
64    public final void setFilePath(final String p_filePath) {
65      m_filePath = p_filePath;
66    }
67  
68    /**
69     * @return the targetPath
70     */
71    public final String getTargetPath() {
72      return m_targetPath;
73    }
74  
75    /**
76     * @param p_targetPath
77     *          the targetPath to set
78     */
79    public final void setTargetPath(final String p_targetPath) {
80      m_targetPath = p_targetPath;
81    }
82  
83    /**
84     * @return the processor
85     */
86    public final String getProcessor() {
87      return m_processor;
88    }
89  
90    /**
91     * @param p_processor
92     *          the processor to set
93     */
94    public final void setProcessor(final String p_processor) {
95      m_processor = p_processor;
96    }
97  
98    /**
99     * @return the path and the name of the resource
100    * @see net.sourceforge.osgi.deployment.maven.IResource#getResourceId()
101    */
102   public final String getResourceId() {
103     String resourceId = m_filePath;
104     if (m_targetPath != null && m_targetPath.length() > 0) {
105       resourceId = m_targetPath + "/" + resourceId;
106     }
107     return resourceId;
108   }
109 
110 }