mirror of https://github.com/apache/maven.git
PR: MNG-951
timestamp the metadata so that it can be merged correctly git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@292139 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
55dc8586c7
commit
31a4d8ea41
|
@ -159,6 +159,7 @@ public abstract class AbstractRepositoryMetadata
|
||||||
{
|
{
|
||||||
Versioning versioning = new Versioning();
|
Versioning versioning = new Versioning();
|
||||||
versioning.setSnapshot( snapshot );
|
versioning.setSnapshot( snapshot );
|
||||||
|
versioning.updateTimestamp();
|
||||||
return versioning;
|
return versioning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,16 +179,16 @@ public abstract class AbstractRepositoryMetadata
|
||||||
AbstractRepositoryMetadata repoMetadata = (AbstractRepositoryMetadata) metadata;
|
AbstractRepositoryMetadata repoMetadata = (AbstractRepositoryMetadata) metadata;
|
||||||
this.metadata.merge( repoMetadata.getMetadata() );
|
this.metadata.merge( repoMetadata.getMetadata() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String extendedToString()
|
public String extendedToString()
|
||||||
{
|
{
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
|
||||||
buffer.append( "\nRepository Metadata\n--------------------------" );
|
buffer.append( "\nRepository Metadata\n--------------------------" );
|
||||||
buffer.append( "\nGroupId: " ).append( getGroupId() );
|
buffer.append( "\nGroupId: " ).append( getGroupId() );
|
||||||
buffer.append( "\nArtifactId: " ).append( getArtifactId() );
|
buffer.append( "\nArtifactId: " ).append( getArtifactId() );
|
||||||
buffer.append( "\nMetadata Type: " ).append(getClass().getName() );
|
buffer.append( "\nMetadata Type: " ).append( getClass().getName() );
|
||||||
|
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,12 +89,6 @@ public class DefaultRepositoryMetadataManager
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// NOTE: [jc; 21-sept-2005] won't this cause inconsistencies if the metadata wasn't found?
|
|
||||||
// this will write out an essentially empty metadata file, which will result
|
|
||||||
// in the loop below NOT merging anything (each successive pass is still empty),
|
|
||||||
// which means that the last repository will be set as the artifact repo, rather
|
|
||||||
// than leaving it null. This is the root cause of MNG-900, but I'm not sure how
|
|
||||||
// to fix it.
|
|
||||||
metadata.storeInLocalRepository( localRepository, repository );
|
metadata.storeInLocalRepository( localRepository, repository );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,7 +99,6 @@ public class DefaultRepositoryMetadataManager
|
||||||
// snapshot timestamp, or some other timestamp later encoded into the metadata.
|
// snapshot timestamp, or some other timestamp later encoded into the metadata.
|
||||||
// TODO: this needs to be repeated here so the merging doesn't interfere with the written metadata
|
// TODO: this needs to be repeated here so the merging doesn't interfere with the written metadata
|
||||||
// - we'd be much better having a pristine input, and an ongoing metadata for merging instead
|
// - we'd be much better having a pristine input, and an ongoing metadata for merging instead
|
||||||
loadMetadata( metadata, localRepository, localRepository );
|
|
||||||
|
|
||||||
for ( Iterator i = remoteRepositories.iterator(); i.hasNext(); )
|
for ( Iterator i = remoteRepositories.iterator(); i.hasNext(); )
|
||||||
{
|
{
|
||||||
|
@ -119,6 +112,7 @@ public class DefaultRepositoryMetadataManager
|
||||||
loadMetadata( metadata, repository, localRepository );
|
loadMetadata( metadata, repository, localRepository );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
loadMetadata( metadata, localRepository, localRepository );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadMetadata( RepositoryMetadata repoMetadata, ArtifactRepository remoteRepository,
|
private void loadMetadata( RepositoryMetadata repoMetadata, ArtifactRepository remoteRepository,
|
||||||
|
@ -134,12 +128,15 @@ public class DefaultRepositoryMetadataManager
|
||||||
|
|
||||||
if ( repoMetadata.getMetadata() != null )
|
if ( repoMetadata.getMetadata() != null )
|
||||||
{
|
{
|
||||||
if ( !metadata.merge( repoMetadata.getMetadata() ) )
|
if ( repoMetadata.getMetadata().merge( metadata ) )
|
||||||
{
|
{
|
||||||
repoMetadata.setRepository( remoteRepository );
|
repoMetadata.setRepository( remoteRepository );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
repoMetadata.setMetadata( metadata );
|
else
|
||||||
|
{
|
||||||
|
repoMetadata.setMetadata( metadata );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +185,7 @@ public class DefaultRepositoryMetadataManager
|
||||||
getLogger().debug( "System is offline. Cannot resolve metadata:\n" + metadata.extendedToString() + "\n\n" );
|
getLogger().debug( "System is offline. Cannot resolve metadata:\n" + metadata.extendedToString() + "\n\n" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
File file = new File( localRepository.getBasedir(),
|
File file = new File( localRepository.getBasedir(),
|
||||||
localRepository.pathOfLocalRepositoryMetadata( metadata, remoteRepository ) );
|
localRepository.pathOfLocalRepositoryMetadata( metadata, remoteRepository ) );
|
||||||
|
|
||||||
|
@ -210,7 +207,7 @@ public class DefaultRepositoryMetadataManager
|
||||||
getLogger().debug( "System is offline. Cannot resolve metadata:\n" + metadata.extendedToString() + "\n\n" );
|
getLogger().debug( "System is offline. Cannot resolve metadata:\n" + metadata.extendedToString() + "\n\n" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
wagonManager.getArtifactMetadata( metadata, repository, file, checksumPolicy );
|
wagonManager.getArtifactMetadata( metadata, repository, file, checksumPolicy );
|
||||||
|
@ -245,7 +242,7 @@ public class DefaultRepositoryMetadataManager
|
||||||
getLogger().warn( "System is offline. Cannot deploy metadata:\n" + metadata.extendedToString() + "\n\n" );
|
getLogger().warn( "System is offline. Cannot deploy metadata:\n" + metadata.extendedToString() + "\n\n" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getLogger().info( "Retrieving previous metadata from " + deploymentRepository.getId() );
|
getLogger().info( "Retrieving previous metadata from " + deploymentRepository.getId() );
|
||||||
|
|
||||||
File file = new File( localRepository.getBasedir(),
|
File file = new File( localRepository.getBasedir(),
|
||||||
|
|
|
@ -33,7 +33,8 @@ public class SnapshotArtifactRepositoryMetadata
|
||||||
|
|
||||||
public SnapshotArtifactRepositoryMetadata( Artifact artifact )
|
public SnapshotArtifactRepositoryMetadata( Artifact artifact )
|
||||||
{
|
{
|
||||||
this( artifact, new Snapshot() );
|
super( createMetadata( artifact, null ) );
|
||||||
|
this.artifact = artifact;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SnapshotArtifactRepositoryMetadata( Artifact artifact, Snapshot snapshot )
|
public SnapshotArtifactRepositoryMetadata( Artifact artifact, Snapshot snapshot )
|
||||||
|
|
|
@ -109,17 +109,9 @@ public abstract class AbstractVersionTransformation
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Locally installed file is newer, don't use the resolved version
|
// Locally installed file is newer, don't use the resolved version
|
||||||
getLogger().debug( artifact.getArtifactId() + ": using locally installed snapshot");
|
getLogger().debug( artifact.getArtifactId() + ": using locally installed snapshot" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( version.equals( artifact.getBaseVersion() ) )
|
|
||||||
{
|
|
||||||
// odd: we hit here when: using legecy repo, not local, and no snapshot version meta data was availble
|
|
||||||
// but the repository was set to one of the remote repos (and it was the wrong one).
|
|
||||||
artifact.setRepository( null );
|
|
||||||
}
|
|
||||||
|
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,12 +149,12 @@ public abstract class AbstractVersionTransformation
|
||||||
if ( !wagonManager.isOnline() )
|
if ( !wagonManager.isOnline() )
|
||||||
{
|
{
|
||||||
LegacyArtifactMetadata metadata = createLegacyMetadata( artifact );
|
LegacyArtifactMetadata metadata = createLegacyMetadata( artifact );
|
||||||
getLogger().debug( "System is offline. Cannot resolve metadata:\n" + metadata.extendedToString() + "\n\n" );
|
getLogger().debug(
|
||||||
|
"System is offline. Cannot resolve metadata:\n" + metadata.extendedToString() + "\n\n" );
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boolean checkedUpdates = false;
|
boolean checkedUpdates = false;
|
||||||
for ( Iterator i = remoteRepositories.iterator(); i.hasNext(); )
|
for ( Iterator i = remoteRepositories.iterator(); i.hasNext(); )
|
||||||
{
|
{
|
||||||
|
@ -178,8 +170,8 @@ public abstract class AbstractVersionTransformation
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boolean checkForUpdates = localMetadata == null
|
boolean checkForUpdates = localMetadata == null ||
|
||||||
|| policy.checkOutOfDate( localMetadata.getLastModified() );
|
policy.checkOutOfDate( localMetadata.getLastModified() );
|
||||||
|
|
||||||
if ( checkForUpdates )
|
if ( checkForUpdates )
|
||||||
{
|
{
|
||||||
|
@ -207,7 +199,7 @@ public abstract class AbstractVersionTransformation
|
||||||
catch ( ResourceDoesNotExistException e )
|
catch ( ResourceDoesNotExistException e )
|
||||||
{
|
{
|
||||||
getLogger().debug( "Legacy metadata for: " + artifact.getId() +
|
getLogger().debug( "Legacy metadata for: " + artifact.getId() +
|
||||||
" could not be found on repository: " + repository.getId(), e );
|
" could not be found on repository: " + repository.getId() );
|
||||||
}
|
}
|
||||||
catch ( ArtifactMetadataRetrievalException e )
|
catch ( ArtifactMetadataRetrievalException e )
|
||||||
{
|
{
|
||||||
|
@ -233,7 +225,8 @@ public abstract class AbstractVersionTransformation
|
||||||
resolvedArtifactCache.add( getCacheKey( artifact ) );
|
resolvedArtifactCache.add( getCacheKey( artifact ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( localMetadata != null && artifact.getFile().exists() && !localMetadata.newerThanFile( artifact.getFile() ) )
|
if ( localMetadata != null && artifact.getFile().exists() &&
|
||||||
|
!localMetadata.newerThanFile( artifact.getFile() ) )
|
||||||
{
|
{
|
||||||
if ( getLogger().isDebugEnabled() && !alreadyResolved )
|
if ( getLogger().isDebugEnabled() && !alreadyResolved )
|
||||||
{
|
{
|
||||||
|
@ -242,7 +235,7 @@ public abstract class AbstractVersionTransformation
|
||||||
}
|
}
|
||||||
localMetadata = null;
|
localMetadata = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return localMetadata != null ? localMetadata.constructVersion() : null;
|
return localMetadata != null ? localMetadata.constructVersion() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,7 @@ public class ReleaseArtifactTransformation
|
||||||
private ArtifactMetadata createMetadata( Artifact artifact )
|
private ArtifactMetadata createMetadata( Artifact artifact )
|
||||||
{
|
{
|
||||||
Versioning versioning = new Versioning();
|
Versioning versioning = new Versioning();
|
||||||
|
versioning.updateTimestamp();
|
||||||
versioning.addVersion( artifact.getVersion() );
|
versioning.addVersion( artifact.getVersion() );
|
||||||
|
|
||||||
if ( artifact.isRelease() )
|
if ( artifact.isRelease() )
|
||||||
|
|
|
@ -59,8 +59,9 @@ public class SnapshotTransformation
|
||||||
{
|
{
|
||||||
if ( artifact.isSnapshot() )
|
if ( artifact.isSnapshot() )
|
||||||
{
|
{
|
||||||
RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata( artifact );
|
Snapshot snapshot = new Snapshot();
|
||||||
metadata.getMetadata().getVersioning().getSnapshot().setLocalCopy( true );
|
snapshot.setLocalCopy( true );
|
||||||
|
RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata( artifact, snapshot );
|
||||||
|
|
||||||
artifact.addMetadata( metadata );
|
artifact.addMetadata( metadata );
|
||||||
}
|
}
|
||||||
|
@ -129,12 +130,13 @@ public class SnapshotTransformation
|
||||||
if ( !wagonManager.isOnline() )
|
if ( !wagonManager.isOnline() )
|
||||||
{
|
{
|
||||||
getLogger().debug( "System is offline. Cannot resolve metadata:\n" + metadata.extendedToString() + "\n\n" );
|
getLogger().debug( "System is offline. Cannot resolve metadata:\n" + metadata.extendedToString() + "\n\n" );
|
||||||
|
|
||||||
getLogger().info( "System is offline. Assuming build number of 0 for " + metadata.getGroupId() + ":" + metadata.getArtifactId() + " snapshot." );
|
getLogger().info( "System is offline. Assuming build number of 0 for " + metadata.getGroupId() + ":" +
|
||||||
|
metadata.getArtifactId() + " snapshot." );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
getLogger().info( "Retrieving previous build number from " + remoteRepository.getId() );
|
getLogger().info( "Retrieving previous build number from " + remoteRepository.getId() );
|
||||||
repositoryMetadataManager.resolveAlways( metadata, localRepository, remoteRepository );
|
repositoryMetadataManager.resolveAlways( metadata, localRepository, remoteRepository );
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>maven-plugin-parent</artifactId>
|
<artifactId>maven-plugin-parent</artifactId>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<version>2.0-beta-1</version>
|
<version>2.0-beta-3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>maven-plugin-plugin</artifactId>
|
<artifactId>maven-plugin-plugin</artifactId>
|
||||||
|
@ -26,6 +26,11 @@
|
||||||
<groupId>org.apache.maven</groupId>
|
<groupId>org.apache.maven</groupId>
|
||||||
<artifactId>maven-project</artifactId>
|
<artifactId>maven-project</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-repository-metadata</artifactId>
|
||||||
|
<version>2.0-beta-3-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven</groupId>
|
<groupId>org.apache.maven</groupId>
|
||||||
<artifactId>maven-plugin-tools-api</artifactId>
|
<artifactId>maven-plugin-tools-api</artifactId>
|
||||||
|
|
|
@ -42,6 +42,7 @@ public class AddPluginArtifactMetadataMojo
|
||||||
|
|
||||||
Versioning versioning = new Versioning();
|
Versioning versioning = new Versioning();
|
||||||
versioning.setLatest( projectArtifact.getVersion() );
|
versioning.setLatest( projectArtifact.getVersion() );
|
||||||
|
versioning.updateTimestamp();
|
||||||
ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( projectArtifact, versioning );
|
ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( projectArtifact, versioning );
|
||||||
projectArtifact.addMetadata( metadata );
|
projectArtifact.addMetadata( metadata );
|
||||||
|
|
||||||
|
|
|
@ -53,109 +53,123 @@
|
||||||
<codeSegment>
|
<codeSegment>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<code><![CDATA[
|
<code><![CDATA[
|
||||||
public boolean merge( Metadata sourceMetadata )
|
public boolean merge( Metadata sourceMetadata )
|
||||||
|
{
|
||||||
|
boolean changed = false;
|
||||||
|
|
||||||
|
for ( java.util.Iterator i = sourceMetadata.getPlugins().iterator(); i.hasNext(); )
|
||||||
|
{
|
||||||
|
Plugin plugin = (Plugin) i.next();
|
||||||
|
boolean found = false;
|
||||||
|
|
||||||
|
for ( java.util.Iterator it = getPlugins().iterator(); it.hasNext() && !found; )
|
||||||
{
|
{
|
||||||
boolean changed = false;
|
Plugin preExisting = (Plugin) it.next();
|
||||||
|
|
||||||
for ( java.util.Iterator i = sourceMetadata.getPlugins().iterator(); i.hasNext(); )
|
if ( preExisting.getPrefix().equals( plugin.getPrefix() ) )
|
||||||
{
|
{
|
||||||
Plugin plugin = (Plugin) i.next();
|
found = true;
|
||||||
boolean found = false;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for ( java.util.Iterator it = getPlugins().iterator(); it.hasNext() && !found; )
|
if ( !found )
|
||||||
{
|
{
|
||||||
Plugin preExisting = (Plugin) it.next();
|
Plugin mappedPlugin = new Plugin();
|
||||||
|
|
||||||
if ( preExisting.getPrefix().equals( plugin.getPrefix() ) )
|
mappedPlugin.setArtifactId( plugin.getArtifactId() );
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !found )
|
mappedPlugin.setPrefix( plugin.getPrefix() );
|
||||||
{
|
|
||||||
Plugin mappedPlugin = new Plugin();
|
|
||||||
|
|
||||||
mappedPlugin.setArtifactId( plugin.getArtifactId() );
|
addPlugin( mappedPlugin );
|
||||||
|
|
||||||
mappedPlugin.setPrefix( plugin.getPrefix() );
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
addPlugin( mappedPlugin );
|
Versioning versioning = sourceMetadata.getVersioning();
|
||||||
|
if ( versioning != null )
|
||||||
|
{
|
||||||
|
Versioning v = getVersioning();
|
||||||
|
if ( v == null )
|
||||||
|
{
|
||||||
|
v = new Versioning();
|
||||||
|
setVersioning( v );
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
changed = true;
|
for ( Iterator i = versioning.getVersions().iterator(); i.hasNext(); )
|
||||||
}
|
{
|
||||||
|
String version = (String) i.next();
|
||||||
|
if ( !v.getVersions().contains( version ) )
|
||||||
|
{
|
||||||
|
changed = true;
|
||||||
|
v.getVersions().add( version );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( versioning.getLastUpdated() == null || versioning.getLastUpdated().length() == 0 )
|
||||||
|
{
|
||||||
|
// this should only be for historical reasons - we assume local is newer
|
||||||
|
versioning.setLastUpdated( v.getLastUpdated() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( v.getLastUpdated() == null || v.getLastUpdated().length() == 0 ||
|
||||||
|
versioning.getLastUpdated().compareTo( v.getLastUpdated() ) > 0 )
|
||||||
|
{
|
||||||
|
v.setLastUpdated( versioning.getLastUpdated() );
|
||||||
|
|
||||||
|
if ( versioning.getRelease() != null )
|
||||||
|
{
|
||||||
|
changed = true;
|
||||||
|
v.setRelease( versioning.getRelease() );
|
||||||
|
}
|
||||||
|
if ( versioning.getLatest() != null )
|
||||||
|
{
|
||||||
|
changed = true;
|
||||||
|
v.setLatest( versioning.getLatest() );
|
||||||
}
|
}
|
||||||
|
|
||||||
Versioning versioning = sourceMetadata.getVersioning();
|
Snapshot s = v.getSnapshot();
|
||||||
if ( versioning != null )
|
Snapshot snapshot = versioning.getSnapshot();
|
||||||
|
if ( snapshot != null )
|
||||||
{
|
{
|
||||||
Versioning v = getVersioning();
|
if ( s == null )
|
||||||
if ( v != null )
|
|
||||||
{
|
{
|
||||||
if ( versioning.getRelease() != null )
|
s = new Snapshot();
|
||||||
{
|
v.setSnapshot( s );
|
||||||
changed = true;
|
changed = true;
|
||||||
v.setRelease( versioning.getRelease() );
|
}
|
||||||
}
|
|
||||||
if ( versioning.getLatest() != null )
|
|
||||||
{
|
|
||||||
changed = true;
|
|
||||||
v.setLatest( versioning.getLatest() );
|
|
||||||
}
|
|
||||||
for ( java.util.Iterator i = versioning.getVersions().iterator(); i.hasNext(); )
|
|
||||||
{
|
|
||||||
String version = (String) i.next();
|
|
||||||
if ( !v.getVersions().contains( version ) )
|
|
||||||
{
|
|
||||||
changed = true;
|
|
||||||
v.getVersions().add( version );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Snapshot s = v.getSnapshot();
|
if ( snapshot.isLocalCopy() )
|
||||||
Snapshot snapshot = versioning.getSnapshot();
|
{
|
||||||
if ( snapshot != null )
|
s.setLocalCopy( true );
|
||||||
{
|
s.setTimestamp( null );
|
||||||
if ( s == null )
|
s.setBuildNumber( 0 );
|
||||||
{
|
changed = true;
|
||||||
v.setSnapshot( snapshot );
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
else if ( snapshot.isLocalCopy() )
|
|
||||||
{
|
|
||||||
s.setLocalCopy( true );
|
|
||||||
s.setTimestamp( null );
|
|
||||||
s.setBuildNumber( 0 );
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( snapshot.getTimestamp() != null && !snapshot.getTimestamp().equals( s.getTimestamp() ) )
|
|
||||||
{
|
|
||||||
s.setTimestamp( snapshot.getTimestamp() );
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
if ( snapshot.getBuildNumber() > 0 && s.getBuildNumber() != snapshot.getBuildNumber() )
|
|
||||||
{
|
|
||||||
s.setBuildNumber( snapshot.getBuildNumber() );
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
if ( s.isLocalCopy() )
|
|
||||||
{
|
|
||||||
s.setLocalCopy( false );
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setVersioning( versioning );
|
if ( snapshot.getTimestamp() != null && !snapshot.getTimestamp().equals( s.getTimestamp() ) )
|
||||||
changed = true;
|
{
|
||||||
|
s.setTimestamp( snapshot.getTimestamp() );
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
if ( snapshot.getBuildNumber() > 0 && s.getBuildNumber() != snapshot.getBuildNumber() )
|
||||||
|
{
|
||||||
|
s.setBuildNumber( snapshot.getBuildNumber() );
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
if ( s.isLocalCopy() )
|
||||||
|
{
|
||||||
|
s.setLocalCopy( false );
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return changed;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
]]></code>
|
]]></code>
|
||||||
</codeSegment>
|
</codeSegment>
|
||||||
</codeSegments>
|
</codeSegments>
|
||||||
|
@ -194,7 +208,27 @@
|
||||||
<multiplicity>*</multiplicity>
|
<multiplicity>*</multiplicity>
|
||||||
</association>
|
</association>
|
||||||
</field>
|
</field>
|
||||||
|
<field>
|
||||||
|
<name>lastUpdated</name>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<type>String</type>
|
||||||
|
<description>When the metadata was last updated</description>
|
||||||
|
</field>
|
||||||
</fields>
|
</fields>
|
||||||
|
<codeSegments>
|
||||||
|
<codeSegment>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<code>
|
||||||
|
public void updateTimestamp()
|
||||||
|
{
|
||||||
|
java.util.TimeZone timezone = java.util.TimeZone.getTimeZone( "UTC" );
|
||||||
|
java.text.DateFormat fmt = new java.text.SimpleDateFormat( "yyyyMMddHHmmss" );
|
||||||
|
fmt.setTimeZone( timezone );
|
||||||
|
setLastUpdated( fmt.format( new java.util.Date() ) );
|
||||||
|
}
|
||||||
|
</code>
|
||||||
|
</codeSegment>
|
||||||
|
</codeSegments>
|
||||||
</class>
|
</class>
|
||||||
<class>
|
<class>
|
||||||
<name>Snapshot</name>
|
<name>Snapshot</name>
|
||||||
|
|
Loading…
Reference in New Issue