You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2008/12/02 10:04:38 UTC
svn commit: r722406 - in
/felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp:
./ om/
Author: cziegeler
Date: Tue Dec 2 01:04:37 2008
New Revision: 722406
URL: http://svn.apache.org/viewvc?rev=722406&view=rev
Log:
Refactor plugin and add initial support for processor resources.
Added:
felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/BundleCollector.java (with props)
felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/ResourceCollector.java (with props)
felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/ProcessorResource.java (with props)
Modified:
felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/Constants.java
felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/PackagerMojo.java
felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/AbstractResource.java
felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/BundleResource.java
felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/DeploymentPackageInfo.java
Added: felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/BundleCollector.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/BundleCollector.java?rev=722406&view=auto
==============================================================================
--- felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/BundleCollector.java (added)
+++ felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/BundleCollector.java Tue Dec 2 01:04:37 2008
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.maven.dp;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+
+import org.apache.felix.maven.dp.om.BundleResource;
+import org.apache.felix.maven.dp.om.DeploymentPackageInfo;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Collect all bundles for this deployment package.
+ */
+public class BundleCollector {
+
+ private final MavenProject project;
+ private final Log log;
+
+
+ public BundleCollector(final MavenProject project,
+ final Log log) {
+ this.project = project;
+ this.log = log;
+ }
+
+ protected Log getLog() {
+ return this.log;
+ }
+
+ public void collect(final DeploymentPackageInfo pck)
+ throws MojoExecutionException {
+ this.getLog().info("Collecting all bundles...");
+ final Map resolved = this.project.getArtifactMap();
+ final Set artifacts = this.project.getDependencyArtifacts();
+ final Iterator i = artifacts.iterator();
+ while ( i.hasNext() ) {
+ final Artifact artifact = (Artifact) i.next();
+ final BundleInfo info = this.checkArtifact(artifact, resolved);
+ if ( info != null ) {
+ this.getLog().info("Found bundle " + info.symbolicname + ":" + info.bundleVersion);
+ pck.addBundleResource(new BundleResource(info.symbolicname, info.bundleVersion, info.artifactFile));
+ }
+ }
+
+ }
+
+ /**
+ * Check if the artifact is a java artifact (jar or bundle)
+ */
+ protected boolean isJavaArtifact(Artifact artifact) {
+ if ( "jar".equals(artifact.getType()) ) {
+ return true;
+ }
+ if ( "bundle".equals(artifact.getType()) ) {
+ return true;
+ }
+ return false;
+ }
+
+ protected BundleInfo checkArtifact(final Artifact declared, Map resolved)
+ throws MojoExecutionException {
+ this.getLog().info(" Processing artifact " + declared);
+ if (declared.getScope() == null
+ || Artifact.SCOPE_COMPILE.equals(declared.getScope())
+ || Artifact.SCOPE_PROVIDED.equals(declared.getScope())
+ || Artifact.SCOPE_RUNTIME.equals(declared.getScope())) {
+ this.getLog().debug(" Resolving artifact " + declared);
+ final Artifact artifact = (declared.isResolved() ? declared : (Artifact) resolved.get(ArtifactUtils.versionlessKey(declared)));
+ if ( artifact == null ) {
+ throw new MojoExecutionException("Unable to resolve artifact " + declared);
+ } else if ( this.isJavaArtifact(artifact) ) {
+ this.getLog().debug(" Getting manifest from artifact " + artifact);
+ try {
+ final Manifest m = this.getManifest(artifact);
+ if (m != null ) {
+ final String name = m.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME);
+ if ( name != null ) {
+ this.getLog().debug(" Found bundle: " + artifact.getArtifactId() + " with name " + name);
+ final BundleInfo info = new BundleInfo();
+ info.symbolicname = name;
+ info.bundleVersion = m.getMainAttributes().getValue(Constants.BUNDLE_VERSION);
+ info.artifactFile = artifact.getFile();
+ info.artifact = artifact;
+ return info;
+ }
+ } else {
+ this.getLog().debug(" Unable to get manifest from artifact " + artifact);
+ }
+ } catch (IOException ioe) {
+ throw new MojoExecutionException("Unable to get manifest from artifact " + artifact, ioe);
+ }
+ } else {
+ this.getLog().debug(" Artifact is not a Java artifact " + declared);
+ }
+ } else {
+ this.getLog().debug(" Artifact " + declared + " has not scope compile, provided or runtime, but: " + declared.getScope());
+ }
+ return null;
+ }
+
+
+ /**
+ * Get the manifest from the artifact.
+ * @param artifact
+ * @return
+ * @throws IOException
+ */
+ protected Manifest getManifest(Artifact artifact) throws IOException {
+ JarFile file = null;
+ try {
+ file = new JarFile(artifact.getFile());
+ return file.getManifest();
+ } finally {
+ if (file != null) {
+ try {
+ file.close();
+ } catch (IOException ignore) {
+ }
+ }
+ }
+ }
+}
Propchange: felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/BundleCollector.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/BundleCollector.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/BundleCollector.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/Constants.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/Constants.java?rev=722406&r1=722405&r2=722406&view=diff
==============================================================================
--- felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/Constants.java (original)
+++ felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/Constants.java Tue Dec 2 01:04:37 2008
@@ -21,22 +21,24 @@
public interface Constants extends org.osgi.framework.Constants {
// manifest main attribute header constants
+ public static final String DEPLOYMENTPACKAGE_MANIFESTVERSION = "DeploymentPackage-ManifestVersion";
+ public static final String DEPLOYMENTPACKAGE_CONTENTTYPE = "Content-Type";
public static final String DEPLOYMENTPACKAGE_SYMBOLICMAME = "DeploymentPackage-SymbolicName";
public static final String DEPLOYMENTPACKAGE_VERSION = "DeploymentPackage-Version";
public static final String DEPLOYMENTPACKAGE_FIXPACK = "DeploymentPackage-FixPack";
+ public static final String DEPLOYMENTPACKAGE_DESCRIPTION = "DeploymentPackage-Description";
+ public static final String DEPLOYMENTPACKAGE_DOCURL = "DeploymentPackage-DocURL";
+ public static final String DEPLOYMENTPACKAGE_COPYRIGHT = "DeploymentPackage-Copyright";
+ public static final String DEPLOYMENTPACKAGE_CONTACTADDRESS = "DeploymentPackage-ContactAddress";
+ public static final String DEPLOYMENTPACKAGE_VENDOR = "DeploymentPackage-Vendor";
+ public static final String DEPLOYMENTPACKAGE_LICENSEURL = "DeploymentPackage-License";
// manifest 'name' section header constants
public static final String RESOURCE_PROCESSOR = "Resource-Processor";
public static final String DEPLOYMENTPACKAGE_MISSING = "DeploymentPackage-Missing";
public static final String DEPLOYMENTPACKAGE_CUSTOMIZER = "DeploymentPackage-Customizer";
- // event topics and properties
- public static final String EVENTTOPIC_INSTALL = "org/osgi/service/deployment/INSTALL";
- public static final String EVENTTOPIC_UNINSTALL = "org/osgi/service/deployment/UNINSTALL";
- public static final String EVENTTOPIC_COMPLETE = "org/osgi/service/deployment/COMPLETE";
- public static final String EVENTPROPERTY_DEPLOYMENTPACKAGE_NAME = "deploymentpackage.name";
- public static final String EVENTPROPERTY_SUCCESSFUL = "successful";
-
- // miscellaneous constants
- public static final String BUNDLE_LOCATION_PREFIX = "osgi-dp:";
+ public static final String DEPLOYMENT_PACKAGE_VERSION = "1.0";
+ public static final String MANIFEST_VERSION = "1.0";
+ public static final String CONTENT_TYPE = "application/vnd.osgi.dp";
}
\ No newline at end of file
Modified: felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/PackagerMojo.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/PackagerMojo.java?rev=722406&r1=722405&r2=722406&view=diff
==============================================================================
--- felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/PackagerMojo.java (original)
+++ felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/PackagerMojo.java Tue Dec 2 01:04:37 2008
@@ -22,20 +22,15 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
import java.util.jar.Attributes;
import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
import org.apache.commons.io.IOUtils;
import org.apache.felix.maven.dp.om.BundleResource;
import org.apache.felix.maven.dp.om.DeploymentPackageInfo;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.ArtifactUtils;
-import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
+import org.apache.felix.maven.dp.om.ProcessorResource;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
@@ -48,6 +43,8 @@
* @requiresDependencyResolution test
* @description Create an OSGi deployment package
*
+ * TODO: Convert path names with chars differing from [A-Za-z0-9_.-]
+ *
* @version $Rev$, $Date$
*/
public class PackagerMojo extends org.apache.maven.plugin.AbstractMojo {
@@ -78,11 +75,6 @@
private String finalName;
/**
- * @component
- */
- private ArtifactHandlerManager artifactHandlerManager;
-
- /**
* @see org.apache.maven.plugin.Mojo#execute()
*/
public void execute() throws MojoExecutionException, MojoFailureException {
@@ -95,18 +87,12 @@
pck.setDescription(this.project.getDescription());
// collect bundles
- this.getLog().info("Collecting all bundles...");
- final Map resolved = this.project.getArtifactMap();
- final Set artifacts = this.project.getDependencyArtifacts();
- final Iterator i = artifacts.iterator();
- while ( i.hasNext() ) {
- final Artifact artifact = (Artifact) i.next();
- final BundleInfo info = this.checkArtifact(artifact, resolved);
- if ( info != null ) {
- this.getLog().info("Found bundle " + info.symbolicname + ":" + info.bundleVersion);
- pck.addBundleResource(new BundleResource(info));
- }
- }
+ final BundleCollector bc = new BundleCollector(this.project, this.getLog());
+ bc.collect(pck);
+
+ // collect resources
+ final ResourceCollector rc = new ResourceCollector(this.project, this.getLog());
+ rc.collect(pck);
// write jar file
this.createJarFile(pck);
@@ -124,15 +110,16 @@
try {
// manifest
final Manifest mf = new Manifest();
- addManifestEntry(mf, Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
+ addManifestEntry(mf, Attributes.Name.MANIFEST_VERSION.toString(), Constants.MANIFEST_VERSION);
- addManifestEntry(mf, "DeploymentPackage-ManifestVersion", "1.0");
- addManifestEntry(mf, "Content-Type", "application/vnd.osgi.dp");
+ addManifestEntry(mf, Constants.DEPLOYMENTPACKAGE_MANIFESTVERSION, Constants.DEPLOYMENT_PACKAGE_VERSION);
+ addManifestEntry(mf, Constants.DEPLOYMENTPACKAGE_CONTENTTYPE, Constants.CONTENT_TYPE);
addManifestEntry(mf, Constants.DEPLOYMENTPACKAGE_SYMBOLICMAME, pck.getSymbolicName());
addManifestEntry(mf, Constants.DEPLOYMENTPACKAGE_VERSION, pck.getVersion());
- addManifestEntry(mf, "DeploymentPackage-Description", pck.getDescription());
+ addManifestEntry(mf, Constants.DEPLOYMENTPACKAGE_DESCRIPTION, pck.getDescription());
+ addManifestEntry(mf, Constants.DEPLOYMENTPACKAGE_DOCURL, pck.getDocUrl());
// create entries for bundles
final Iterator bI = pck.getBundleResources().iterator();
@@ -145,9 +132,22 @@
mf.getEntries().put(rsrc.getId(), attr);
}
+ // create entries for resources
+ final Iterator rI = pck.getProcessorResources().iterator();
+ while (rI.hasNext() ) {
+ final ProcessorResource rsrc = (ProcessorResource)rI.next();
+ // add new entry
+ final Attributes attr = new Attributes();
+ if ( rsrc.getResourceProcessor() != null ) {
+ addAttr(attr, Constants.RESOURCE_PROCESSOR, rsrc.getResourceProcessor());
+ }
+ mf.getEntries().put(rsrc.getId(), attr);
+ }
+
jfos = new FileOutputStream(jarFile);
jos = new JarOutputStream(jfos, mf);
+ // add bundles
final Iterator bundleIterator = pck.getBundleResources().iterator();
while ( bundleIterator.hasNext() ) {
final BundleResource rsrc = (BundleResource) bundleIterator.next();
@@ -156,6 +156,16 @@
IOUtils.copy(rsrc.getInputStream(), jos);
jos.closeEntry();
}
+ // add resources
+ final Iterator resourceIterator = pck.getProcessorResources().iterator();
+ while ( resourceIterator.hasNext() ) {
+ final ProcessorResource rsrc = (ProcessorResource) resourceIterator.next();
+ final JarEntry je = new JarEntry(rsrc.getId());
+ jos.putNextEntry(je);
+ IOUtils.copy(rsrc.getInputStream(), jos);
+ jos.closeEntry();
+ }
+
jos.flush();
} catch (IOException ioe) {
throw new MojoExecutionException("Unable to write javadoc bundle file", ioe);
@@ -171,81 +181,8 @@
}
private void addManifestEntry(final Manifest mf, final String name, final String value) {
- mf.getMainAttributes().put(new Attributes.Name(name), value);
- }
-
- /**
- * Check if the artifact is a java artifact (jar or bundle)
- */
- protected boolean isJavaArtifact(Artifact artifact) {
- if ( "jar".equals(artifact.getType()) ) {
- return true;
- }
- if ( "bundle".equals(artifact.getType()) ) {
- return true;
- }
- return false;
- }
-
- /**
- * Get the manifest from the artifact.
- * @param artifact
- * @return
- * @throws IOException
- */
- protected Manifest getManifest(Artifact artifact) throws IOException {
- JarFile file = null;
- try {
- file = new JarFile(artifact.getFile());
- return file.getManifest();
- } finally {
- if (file != null) {
- try {
- file.close();
- } catch (IOException ignore) {
- }
- }
- }
- }
-
- protected BundleInfo checkArtifact(final Artifact declared, Map resolved)
- throws MojoExecutionException {
- this.getLog().info(" Processing artifact " + declared);
- if (declared.getScope() == null
- || Artifact.SCOPE_COMPILE.equals(declared.getScope())
- || Artifact.SCOPE_PROVIDED.equals(declared.getScope())
- || Artifact.SCOPE_RUNTIME.equals(declared.getScope())) {
- this.getLog().debug(" Resolving artifact " + declared);
- final Artifact artifact = (declared.isResolved() ? declared : (Artifact) resolved.get(ArtifactUtils.versionlessKey(declared)));
- if ( artifact == null ) {
- throw new MojoExecutionException("Unable to resolve artifact " + declared);
- } else if ( this.isJavaArtifact(artifact) ) {
- this.getLog().debug(" Getting manifest from artifact " + artifact);
- try {
- final Manifest m = this.getManifest(artifact);
- if (m != null ) {
- final String name = m.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME);
- if ( name != null ) {
- this.getLog().debug(" Found bundle: " + artifact.getArtifactId() + " with name " + name);
- final BundleInfo info = new BundleInfo();
- info.symbolicname = name;
- info.bundleVersion = m.getMainAttributes().getValue(Constants.BUNDLE_VERSION);
- info.artifactFile = artifact.getFile();
- info.artifact = artifact;
- return info;
- }
- } else {
- this.getLog().debug(" Unable to get manifest from artifact " + artifact);
- }
- } catch (IOException ioe) {
- throw new MojoExecutionException("Unable to get manifest from artifact " + artifact, ioe);
- }
- } else {
- this.getLog().debug(" Artifact is not a Java artifact " + declared);
- }
- } else {
- this.getLog().debug(" Artifact " + declared + " has not scope compile, provided or runtime, but: " + declared.getScope());
+ if ( value != null && value.length() > 0 ) {
+ mf.getMainAttributes().put(new Attributes.Name(name), value);
}
- return null;
}
}
Added: felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/ResourceCollector.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/ResourceCollector.java?rev=722406&view=auto
==============================================================================
--- felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/ResourceCollector.java (added)
+++ felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/ResourceCollector.java Tue Dec 2 01:04:37 2008
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.maven.dp;
+
+import java.io.File;
+import java.util.Iterator;
+
+import org.apache.felix.maven.dp.om.DeploymentPackageInfo;
+import org.apache.felix.maven.dp.om.ProcessorResource;
+import org.apache.maven.model.Resource;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.DirectoryScanner;
+
+/**
+ * Collect all resources for this deployment package.
+ */
+public class ResourceCollector {
+
+ private final MavenProject project;
+ private final Log log;
+
+
+ public ResourceCollector(final MavenProject project,
+ final Log log) {
+ this.project = project;
+ this.log = log;
+ }
+
+ protected Log getLog() {
+ return this.log;
+ }
+
+ public void collect(final DeploymentPackageInfo pck)
+ throws MojoExecutionException {
+ this.getLog().info("Collecting all resources...");
+ final Iterator rI = this.project.getResources().iterator();
+ while ( rI.hasNext() ) {
+ final Resource rsrc = (Resource) rI.next();
+ final File dir = new File(rsrc.getDirectory());
+ if ( dir.exists() && dir.isDirectory() ) {
+ this.getLog().debug("Scanning resource " + rsrc);
+ final DirectoryScanner scanner = new DirectoryScanner();
+ scanner.setBasedir( dir );
+
+ if ( rsrc.getExcludes() != null && rsrc.getExcludes().size() > 0 ) {
+ scanner.setExcludes( (String[])rsrc.getExcludes().toArray(new String[rsrc.getExcludes().size()]) );
+ }
+ scanner.addDefaultExcludes();
+ if ( rsrc.getIncludes() != null && rsrc.getIncludes().size() > 0 ) {
+ scanner.setIncludes( (String[])rsrc.getIncludes().toArray(new String[rsrc.getIncludes().size()]) );
+ }
+
+ scanner.scan();
+
+ final String[] files = scanner.getIncludedFiles();
+ if ( files != null ) {
+ for(int m=0; m<files.length; m++) {
+ this.getLog().debug("Found resource " + files[m]);
+ // get processor identifier from path
+ final String relPath = files[m].substring(dir.getAbsolutePath().length() + 1);
+ final int pos = relPath.indexOf(File.separatorChar);
+ final String processorId = relPath.substring(0, pos);
+
+ // auto detect processor
+ final String processor;
+ if ( processorId.equals("META-INF") ) {
+ // additional resources
+ processor = null;
+ } else if ( processorId.equals("autoconf") ) {
+ processor = "org.osgi.deployment.rp.autoconf";
+ } else {
+ processor = processorId;
+ }
+ this.getLog().debug(" Processor for " + files[m] + " is " + processor);
+ pck.addProcessorResource(new ProcessorResource(new File(files[m]), processor, relPath));
+ }
+ }
+
+ }
+ }
+ }
+}
Propchange: felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/ResourceCollector.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/ResourceCollector.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/ResourceCollector.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/AbstractResource.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/AbstractResource.java?rev=722406&r1=722405&r2=722406&view=diff
==============================================================================
--- felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/AbstractResource.java (original)
+++ felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/AbstractResource.java Tue Dec 2 01:04:37 2008
@@ -30,32 +30,18 @@
private String name;
/**
- * @return The resource name.
- */
- public String getName() {
- return name;
- }
-
- /**
* Set the name
* @param value New name
*/
- public void setName(final String value) {
+ protected void setName(final String value) {
this.name = value;
}
/**
- * @return the targetPath
- */
- public String getTargetPath() {
- return targetPath;
- }
-
- /**
* Set the target path.
* @param value The target path.
*/
- public void setTargetPath(final String value) {
+ protected void setTargetPath(final String value) {
targetPath = value;
}
Modified: felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/BundleResource.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/BundleResource.java?rev=722406&r1=722405&r2=722406&view=diff
==============================================================================
--- felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/BundleResource.java (original)
+++ felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/BundleResource.java Tue Dec 2 01:04:37 2008
@@ -18,36 +18,41 @@
*/
package org.apache.felix.maven.dp.om;
+import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
-import org.apache.felix.maven.dp.BundleInfo;
-
/**
* Description of a bundle resource.
*/
public class BundleResource extends AbstractResource {
- private BundleInfo info;
-
- public BundleResource(final BundleInfo info) {
- this.setName(info.symbolicname + "-" + info.bundleVersion + ".jar");
+ private final String symbolicName;
+ private final String bundleVersion;
+ private final File artifact;
+
+ public BundleResource(final String symbolicName,
+ final String version,
+ final File artifact) {
+ this.symbolicName = symbolicName;
+ this.bundleVersion = version;
+ this.setName(this.symbolicName + "-" + this.bundleVersion + ".jar");
this.setTargetPath("bundles");
- this.info = info;
+ this.artifact = artifact;
}
public String getSymbolicName() {
- return info.symbolicname;
+ return this.symbolicName;
}
public String getVersion() {
- return info.bundleVersion;
+ return this.bundleVersion;
}
public InputStream getInputStream()
throws IOException {
- return new FileInputStream(info.artifactFile);
+ return new FileInputStream(this.artifact);
}
}
Modified: felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/DeploymentPackageInfo.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/DeploymentPackageInfo.java?rev=722406&r1=722405&r2=722406&view=diff
==============================================================================
--- felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/DeploymentPackageInfo.java (original)
+++ felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/DeploymentPackageInfo.java Tue Dec 2 01:04:37 2008
@@ -53,6 +53,9 @@
/** List of bundle resources. */
private final List bundleResources = new ArrayList();
+ /** List of other resources */
+ private final List resources = new ArrayList();
+
public String getSymbolicName() {
return symbolicName;
}
@@ -128,4 +131,16 @@
public void addBundleResource(final BundleResource resource) {
this.bundleResources.add(resource);
}
+
+ /**
+ * Get the list of resources.
+ * @return The resources.
+ */
+ public final List getProcessorResources() {
+ return this.resources;
+ }
+
+ public void addProcessorResource(final ProcessorResource resource) {
+ this.resources.add(resource);
+ }
}
Added: felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/ProcessorResource.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/ProcessorResource.java?rev=722406&view=auto
==============================================================================
--- felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/ProcessorResource.java (added)
+++ felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/ProcessorResource.java Tue Dec 2 01:04:37 2008
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.maven.dp.om;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+
+/**
+ * Description of a processor resource.
+ */
+public class ProcessorResource extends AbstractResource {
+
+ private final File artifact;
+
+ private final String resourceProcessor;
+
+ public ProcessorResource(final File artifact,
+ final String resourceProcessor,
+ final String relPath) {
+ this.artifact = artifact;
+ final int pos = relPath.lastIndexOf('/');
+ if ( pos == -1 ) {
+ this.setName(relPath);
+ } else {
+ this.setTargetPath(relPath.substring(0, pos));
+ this.setName(relPath.substring(pos+1));
+ }
+ this.resourceProcessor = resourceProcessor;
+ }
+
+ public InputStream getInputStream()
+ throws IOException {
+ return new FileInputStream(this.artifact);
+ }
+
+ public String getResourceProcessor() {
+ return this.resourceProcessor;
+ }
+}
Propchange: felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/ProcessorResource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/ProcessorResource.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/sandbox/cziegeler/maven-dp-plugin/src/main/java/org/apache/felix/maven/dp/om/ProcessorResource.java
------------------------------------------------------------------------------
svn:mime-type = text/plain