Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 113987 Details for
Bug 247664
Repositories remain open after MirrorApplication has finished
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Checks if a repository is already open and removes repositories accordingly after application has finished
247664patch.txt (text/plain), 5.94 KB, created by
Andrew Cattle
on 2008-10-01 09:41:33 EDT
(
hide
)
Description:
Checks if a repository is already open and removes repositories accordingly after application has finished
Filename:
MIME Type:
Creator:
Andrew Cattle
Created:
2008-10-01 09:41:33 EDT
Size:
5.94 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.p2.metadata.repository >Index: src/org/eclipse/equinox/internal/p2/metadata/mirror/MirrorApplication.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/mirror/MirrorApplication.java,v >retrieving revision 1.4 >diff -u -r1.4 MirrorApplication.java >--- src/org/eclipse/equinox/internal/p2/metadata/mirror/MirrorApplication.java 30 Sep 2008 22:02:20 -0000 1.4 >+++ src/org/eclipse/equinox/internal/p2/metadata/mirror/MirrorApplication.java 1 Oct 2008 13:37:02 -0000 >@@ -34,6 +34,8 @@ > private boolean transitive = false; > private boolean append = false; > private IMetadataRepositoryManager cachedManager; >+ private boolean sourceLoaded = false; >+ private boolean destinationLoaded = false; > > /** > * Convert a list of tokens into an array. The list separator has to be >@@ -62,12 +64,27 @@ > initializeFromArguments((String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS)); > setupRepositories(); > new Mirroring().mirror(source, destination, rootSpecs, transitive); >+ //if the repository was not already loaded before the mirror application started, close it. >+ if (!sourceLoaded) >+ getManager().removeRepository(sourceLocation); >+ if (!destinationLoaded) >+ getManager().removeRepository(destinationLocation); >+ > return IApplication.EXIT_OK; > } > > private void setupRepositories() throws ProvisionException { > if (destinationLocation == null || sourceLocation == null) > throw new IllegalStateException("Must specify a source and destination"); //$NON-NLS-1$ >+ >+ //Check if repositories are already loaded >+ //TODO modify the contains statement once the API is available >+ if (getManager().contains(sourceLocation)) >+ sourceLoaded = true; >+ //TODO modify the contains statement once the API is available >+ if (getManager().contains(destinationLocation)) >+ destinationLoaded = true; >+ > destination = initializeDestination(); > source = getManager().loadRepository(sourceLocation, null); > } >@@ -77,16 +94,18 @@ > * as well as creating one manually in case we are running a stand-alone application > * in which no one has registered a manager yet. > */ >- private IMetadataRepositoryManager getManager() { >+ private MetadataRepositoryManager getManager() { > if (cachedManager != null) >- return cachedManager; >+ //TODO remove cast when API is available >+ return (MetadataRepositoryManager) cachedManager; > IMetadataRepositoryManager result = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName()); > // service not available... create one and hang onto it > if (result == null) { > cachedManager = new MetadataRepositoryManager(); > result = cachedManager; > } >- return result; >+ //TODO remove cast when API is available >+ return (MetadataRepositoryManager) result; > } > > private IMetadataRepository initializeDestination() throws ProvisionException { >#P org.eclipse.equinox.p2.artifact.repository >Index: src/org/eclipse/equinox/internal/p2/artifact/mirror/MirrorApplication.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/mirror/MirrorApplication.java,v >retrieving revision 1.11 >diff -u -r1.11 MirrorApplication.java >--- src/org/eclipse/equinox/internal/p2/artifact/mirror/MirrorApplication.java 30 Sep 2008 22:02:21 -0000 1.11 >+++ src/org/eclipse/equinox/internal/p2/artifact/mirror/MirrorApplication.java 1 Oct 2008 13:37:04 -0000 >@@ -33,6 +33,8 @@ > private boolean append = false; > private boolean raw = false; > private IArtifactRepositoryManager cachedManager; >+ private boolean sourceLoaded = false; >+ private boolean destinationLoaded = false; > > /* (non-Javadoc) > * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) >@@ -42,6 +44,12 @@ > initializeFromArguments((String[]) args.get(IApplicationContext.APPLICATION_ARGS)); > setupRepositories(); > new Mirroring(source, destination, raw).run(); >+ //if the repository was not already loaded before the mirror application started, close it. >+ if (!sourceLoaded) >+ getManager().removeRepository(sourceLocation); >+ if (!destinationLoaded) >+ getManager().removeRepository(destinationLocation); >+ > return IApplication.EXIT_OK; > } > >@@ -50,19 +58,29 @@ > * as well as creating one manually in case we are running a stand-alone application > * in which no one has registered a manager yet. > */ >- private IArtifactRepositoryManager getManager() { >+ private ArtifactRepositoryManager getManager() { > if (cachedManager != null) >- return cachedManager; >+ //TODO remove cast when API is available >+ return (ArtifactRepositoryManager) cachedManager; > IArtifactRepositoryManager result = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName()); > // service not available... create one and hang onto it > if (result == null) { > cachedManager = new ArtifactRepositoryManager(); > result = cachedManager; > } >- return result; >+ //TODO remove cast when API is available >+ return (ArtifactRepositoryManager) result; > } > > private void setupRepositories() throws ProvisionException { >+ //Check if repositories are already loaded >+ //TODO modify the contains statement once the API is available >+ if (getManager().contains(sourceLocation)) >+ sourceLoaded = true; >+ //TODO modify the contains statement once the API is available >+ if (getManager().contains(destinationLocation)) >+ destinationLoaded = true; >+ > source = getManager().loadRepository(sourceLocation, null); > if (destinationLocation == null) > destination = source;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
dj.houghton
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 247664
: 113987