You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2008/05/29 18:20:08 UTC
svn commit: r661381 - in
/felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin:
ObrDeploy.java ObrDeployFile.java ObrRemoteClean.java
Author: clement
Date: Thu May 29 09:20:08 2008
New Revision: 661381
URL: http://svn.apache.org/viewvc?rev=661381&view=rev
Log:
Revert my last changes (commit on the bad branch)
Removed:
felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrRemoteClean.java
Modified:
felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java
felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeployFile.java
Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java?rev=661381&r1=661380&r2=661381&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java (original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java Thu May 29 09:20:08 2008
@@ -21,7 +21,6 @@
import java.io.File;
import java.net.URI;
-import java.net.URL;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -89,13 +88,6 @@
* @parameter expression="${altDeploymentRepository}"
*/
private String altDeploymentRepository;
-
- /**
- * OBR File deployment repository Format: id::layout::url
- *
- * @parameter expression="${url}"
- */
- private String url;
/**
* Local Repository.
@@ -147,16 +139,6 @@
* Attached doc artifact
*/
private Artifact m_docArtifact;
-
- /**
- * Optional URL prefix.
- * This prefix is used to compute an absoluteURL for the deployed resource.
- * The resulting URL is computed by appending the relative artifact path to
- * the prefix.
- *
- * @parameter expression="${prefix}"
- */
- private URL prefix;
public void execute() throws MojoExecutionException
@@ -223,18 +205,6 @@
Config userConfig = new Config();
userConfig.setRemoteFile( true );
-
- // If a prefix is specified, use an absolute URL composed from the prefix.
- if (prefix != null)
- {
- getLog().info("Prefix used: " + prefix);
- URI bundleJar = ObrUtils.getArtifactURI( localRepository, project.getArtifact() );
- String relative = ObrUtils.getRelativeURI( ObrUtils.toFileURI( mavenRepository ), bundleJar).toASCIIString();
- URL resourceURL = new URL(prefix, relative);
- getLog().info("Bundle URI : " + resourceURL);
- userConfig.setRemoteBundle(resourceURL.toURI());
- userConfig.setPathRelative(false);
- }
update = new ObrUpdate( repositoryXml, obrXmlFile, project, mavenRepository, userConfig, log );
update.parseRepositoryXml();
@@ -277,29 +247,15 @@
private void openRepositoryConnection( RemoteFileManager remoteFile ) throws MojoExecutionException
{
- if ( deploymentRepository == null && altDeploymentRepository == null && url == null)
+ if ( deploymentRepository == null && altDeploymentRepository == null )
{
String msg = "Deployment failed: repository element was not specified in the pom inside"
- + " distributionManagement element or in -DaltDeploymentRepository=id::layout::url " +
- "or -Durl=id::layout::url parameter";
+ + " distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter";
throw new MojoExecutionException( msg );
}
-
- if (url != null)
- {
- getLog().info( "Using obr-specific alternative deployment repository " + url );
-
- Matcher matcher = ALT_REPO_SYNTAX_PATTERN.matcher( url );
- if ( !matcher.matches() )
- {
- throw new MojoExecutionException( "Invalid syntax for OBR-specific alternative repository \""
- + url + "\". Use \"id::layout::url\"." );
- }
-
- remoteFile.connect( matcher.group( 1 ).trim(), matcher.group( 3 ).trim() );
- } else if ( altDeploymentRepository != null )
+ if ( altDeploymentRepository != null )
{
getLog().info( "Using alternate deployment repository " + altDeploymentRepository );
Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeployFile.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeployFile.java?rev=661381&r1=661380&r2=661381&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeployFile.java (original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeployFile.java Thu May 29 09:20:08 2008
@@ -21,11 +21,8 @@
import java.io.File;
import java.net.URI;
-import java.net.URL;
import java.util.Arrays;
import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -97,13 +94,6 @@
* @parameter expression="${bundleUrl}"
*/
private String bundleUrl;
-
- /**
- * Optional URL prefix
- *
- * @parameter expression="${prefix}" default-value="http://repo1.maven.org/maven2/"
- */
- private URL prefix;
/**
* Local Repository.
@@ -129,37 +119,13 @@
* @component
*/
private WagonManager m_wagonManager;
-
- /**
- * The Maven project.
- *
- * @parameter expression="${project}"
- * @readonly
- */
- private MavenProject maven_project;
public void execute() throws MojoExecutionException
{
- // Is a project attached to this build ?
- MavenProject project = null;
- URI obrXmlFile = null;
- if (maven_project == null)
- {
- // No : compute a project from the arguments
- project = getProject();
- obrXmlFile = ObrUtils.toFileURI( obrXml );
-
- }
- else
- {
- // Yes : use the attached project and OBR file
- project = maven_project;
- obrXmlFile = ObrUtils.findObrXml( project.getResources() );
- }
-
-
+ MavenProject project = getProject();
String projectType = project.getPackaging();
+
// ignore unsupported project types, useful when bundleplugin is configured in parent pom
if ( !supportedProjectTypes.contains( projectType ) )
{
@@ -185,7 +151,8 @@
Log log = getLog();
ObrUpdate update;
- RemoteFileManager remoteFile = openConnection();
+ RemoteFileManager remoteFile = new RemoteFileManager( m_wagonManager, settings, log );
+ remoteFile.connect( repositoryId, url );
// ======== LOCK REMOTE OBR ========
log.info( "LOCK " + remoteFile + '/' + repositoryName );
@@ -201,6 +168,7 @@
String mavenRepository = localRepository.getBasedir();
URI repositoryXml = downloadedRepositoryXml.toURI();
+ URI obrXmlFile = ObrUtils.toFileURI( obrXml );
URI bundleJar;
if ( null == file )
@@ -214,30 +182,16 @@
Config userConfig = new Config();
userConfig.setRemoteFile( true );
-
+
if ( null != bundleUrl )
{
// public URL differs from the bundle file location
- URI resourceURL = URI.create( bundleUrl );
- userConfig.setRemoteBundle( resourceURL );
- getLog().info("Bundle URI : " + resourceURL);
-
+ userConfig.setRemoteBundle( URI.create( bundleUrl ) );
}
else if ( null != file )
{
// assume file will be deployed in remote repository, so find the remote relative location
- URI resourceURL = URI.create( localRepository.pathOf( project.getArtifact() ) );
- userConfig.setRemoteBundle( resourceURL );
- getLog().info("Bundle URI : " + resourceURL);
- }
- else
- {
- // assume that we have an already deployed artifact accessible at the public URL composed by : prefix/maven_path
- getLog().info("Prefix used: " + prefix);
- String relative = ObrUtils.getRelativeURI( ObrUtils.toFileURI( mavenRepository ), bundleJar).toASCIIString();
- URL resourceURL = new URL(prefix, relative);
- getLog().info("Bundle URI : " + resourceURL);
- userConfig.setRemoteBundle(resourceURL.toURI());
+ userConfig.setRemoteBundle( URI.create( localRepository.pathOf( project.getArtifact() ) ) );
}
update = new ObrUpdate( repositoryXml, obrXmlFile, project, mavenRepository, userConfig, log );
@@ -271,23 +225,4 @@
}
}
}
-
- private static final Pattern ALT_REPO_SYNTAX_PATTERN = Pattern.compile( "(.+)::(.+)::(.+)" );
-
-
- private RemoteFileManager openConnection() throws MojoExecutionException {
- RemoteFileManager remoteFile = new RemoteFileManager( m_wagonManager, settings, getLog() );
- Matcher matcher = ALT_REPO_SYNTAX_PATTERN.matcher( url );
-
- if ( !matcher.matches() )
- {
- remoteFile.connect(repositoryId, url);
- }
- else
- {
- remoteFile.connect( matcher.group( 1 ).trim(), matcher.group( 3 ).trim() );
- }
-
- return remoteFile;
- }
}