protected void initializeRepositories(PublisherInfo publisherInfo) throws ProvisionException { try { if (metadataLocation != null) { // Try to load the metadata repository. If it loads, check the "compressed" flag, and cache it. // If there are any errors loading it (i.e. it doesn't exist), just skip this step // If there are serious problems with the repository, the superclass initializeRepositories method // will handle it. IMetadataRepository result = Publisher.loadMetadataRepository(agent, metadataLocation, true, true); if (result != null) { Object property = result.getProperties().get(IRepository.PROP_COMPRESSED); if (property != null) { boolean compressProperty = Boolean.valueOf((String) property); this.compress = compressProperty || compress; } } } } catch (ProvisionException e) { //do nothing } super.initializeRepositories(publisherInfo); }
IMetadataRepository result = loadMetadataRepository(agent, location, true, true); if (result != null && result.isModifiable()) { result.setProperty(IRepository.PROP_COMPRESSED, compress ? "true" : "false"); //$NON-NLS-1$//$NON-NLS-2$ IMetadataRepositoryManager manager = getService(agent, IMetadataRepositoryManager.SERVICE_NAME); String repositoryName = name == null ? location + " - metadata" : name; //$NON-NLS-1$ IMetadataRepository result = manager.createRepository(location, repositoryName, IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null);
protected void initializeRepositories(PublisherInfo publisherInfo) throws ProvisionException { if (artifactLocation != null) { IArtifactRepository repo = Publisher.createArtifactRepository(agent, artifactLocation, artifactRepoName, compress, reusePackedFiles); if (!append && !isEmpty(repo)) { File repoLocation = URIUtil.toFile(artifactLocation); if (metadataLocation == null) throw new ProvisionException(createConfigurationEror(Messages.exception_noMetadataRepo)); publisherInfo.setMetadataRepository(Publisher.createMetadataRepository(agent, metadataLocation, metadataRepoName, append, compress));
IArtifactRepository result = loadArtifactRepository(agent, location, true, true); if (result != null && result.isModifiable()) { result.setProperty(IRepository.PROP_COMPRESSED, compress ? "true" : "false"); //$NON-NLS-1$//$NON-NLS-2$ IArtifactRepositoryManager manager = getService(agent, IArtifactRepositoryManager.SERVICE_NAME); String repositoryName = name != null ? name : location + " - artifacts"; //$NON-NLS-1$ IArtifactRepository result = manager.createRepository(location, repositoryName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null);
protected Publisher createPublisher(PublisherInfo publisherInfo) { return new Publisher(publisherInfo); }
IPublisherAction[] actions = createActions(); Publisher publisher = createPublisher(publisherInfo); IStatus result = publisher.publish(actions, new NullProgressMonitor()); long after = System.currentTimeMillis();
/** * Load a metadata repository from the given location. * @param location the URI location of the repository * @param modifiable whether to ask the manager for a modifiable repository * @param removeFromManager remove the loaded repository from the manager if it wasn't already loaded * @return the loaded repository * @throws ProvisionException */ public static IMetadataRepository loadMetadataRepository(IProvisioningAgent agent, URI location, boolean modifiable, boolean removeFromManager) throws ProvisionException { IMetadataRepositoryManager manager = getService(agent, IMetadataRepositoryManager.SERVICE_NAME); boolean existing = manager.contains(location); IMetadataRepository result = manager.loadRepository(location, modifiable ? IRepositoryManager.REPOSITORY_HINT_MODIFIABLE : 0, null); if (!existing && removeFromManager) manager.removeRepository(location); return result; }
public IStatus publish(IPublisherAction[] actions, IProgressMonitor monitor) { if (monitor == null) monitor = new NullProgressMonitor(); SubMonitor sub = SubMonitor.convert(monitor, actions.length); if (Tracing.DEBUG_PUBLISHING) Tracing.debug("Invoking publisher"); //$NON-NLS-1$ try { ArtifactProcess artifactProcess = new ArtifactProcess(actions, info); IStatus finalStatus = null; if (info.getArtifactRepository() != null) { finalStatus = info.getArtifactRepository().executeBatch(artifactProcess, sub); if (!finalStatus.matches(IStatus.ERROR | IStatus.CANCEL)) // If the batch process didn't report any errors, then // Use the status from our actions finalStatus = artifactProcess.getStatus(); } else { artifactProcess.run(sub); finalStatus = artifactProcess.getStatus(); } if (Tracing.DEBUG_PUBLISHING) Tracing.debug("Publishing complete. Result=" + finalStatus); //$NON-NLS-1$ savePublishedIUs(); if (!finalStatus.isOK()) return finalStatus; return Status.OK_STATUS; } finally { sub.done(); } }
IMetadataRepository result = loadMetadataRepository(agent, location, true, true); if (result != null && result.isModifiable()) { result.setProperty(IRepository.PROP_COMPRESSED, compress ? "true" : "false"); //$NON-NLS-1$//$NON-NLS-2$ IMetadataRepositoryManager manager = getService(agent, IMetadataRepositoryManager.SERVICE_NAME); String repositoryName = name == null ? location + " - metadata" : name; //$NON-NLS-1$ IMetadataRepository result = manager.createRepository(location, repositoryName, IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null);
protected void initializeRepositories(PublisherInfo publisherInfo) throws ProvisionException { if (artifactLocation != null) { IArtifactRepository repo = Publisher.createArtifactRepository(agent, artifactLocation, artifactRepoName, compress, reusePackedFiles); if (!append && !isEmpty(repo)) { File repoLocation = URIUtil.toFile(artifactLocation); if (metadataLocation == null) throw new ProvisionException(createConfigurationEror(Messages.exception_noMetadataRepo)); publisherInfo.setMetadataRepository(Publisher.createMetadataRepository(agent, metadataLocation, metadataRepoName, append, compress));
IArtifactRepository result = loadArtifactRepository(agent, location, true, true); if (result != null && result.isModifiable()) { result.setProperty(IRepository.PROP_COMPRESSED, compress ? "true" : "false"); //$NON-NLS-1$//$NON-NLS-2$ IArtifactRepositoryManager manager = getService(agent, IArtifactRepositoryManager.SERVICE_NAME); String repositoryName = name != null ? name : location + " - artifacts"; //$NON-NLS-1$ IArtifactRepository result = manager.createRepository(location, repositoryName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null);
protected Publisher createPublisher(PublisherInfo publisherInfo) { return new Publisher(publisherInfo); }
IPublisherAction[] actions = createActions(); Publisher publisher = createPublisher(publisherInfo); IStatus result = publisher.publish(actions, new NullProgressMonitor()); long after = System.currentTimeMillis();
/** * Load a metadata repository from the given location. * @param location the URI location of the repository * @param modifiable whether to ask the manager for a modifiable repository * @param removeFromManager remove the loaded repository from the manager if it wasn't already loaded * @return the loaded repository * @throws ProvisionException */ public static IMetadataRepository loadMetadataRepository(IProvisioningAgent agent, URI location, boolean modifiable, boolean removeFromManager) throws ProvisionException { IMetadataRepositoryManager manager = getService(agent, IMetadataRepositoryManager.SERVICE_NAME); boolean existing = manager.contains(location); IMetadataRepository result = manager.loadRepository(location, modifiable ? IRepositoryManager.REPOSITORY_HINT_MODIFIABLE : 0, null); if (!existing && removeFromManager) manager.removeRepository(location); return result; }
public IStatus publish(IPublisherAction[] actions, IProgressMonitor monitor) { if (monitor == null) monitor = new NullProgressMonitor(); SubMonitor sub = SubMonitor.convert(monitor, actions.length); if (Tracing.DEBUG_PUBLISHING) Tracing.debug("Invoking publisher"); //$NON-NLS-1$ try { ArtifactProcess artifactProcess = new ArtifactProcess(actions, info); IStatus finalStatus = null; if (info.getArtifactRepository() != null) { finalStatus = info.getArtifactRepository().executeBatch(artifactProcess, sub); if (!finalStatus.matches(IStatus.ERROR | IStatus.CANCEL)) // If the batch process didn't report any errors, then // Use the status from our actions finalStatus = artifactProcess.getStatus(); } else { artifactProcess.run(sub); finalStatus = artifactProcess.getStatus(); } if (Tracing.DEBUG_PUBLISHING) Tracing.debug("Publishing complete. Result=" + finalStatus); //$NON-NLS-1$ savePublishedIUs(); if (!finalStatus.isOK()) return finalStatus; return Status.OK_STATUS; } finally { sub.done(); } }
private IStatus generateMetadata(UpdateSite updateSite, IMetadataRepository repository, IProgressMonitor monitor) { PublisherInfo info = new PublisherInfo(); info.setMetadataRepository(repository); IPublisherAction[] actions = new IPublisherAction[] {new RemoteUpdateSiteAction(updateSite, null)}; Publisher publisher = new Publisher(info); return publisher.publish(actions, monitor); }
IMetadataRepository result = loadMetadataRepository(agent, location, true, true); if (result != null && result.isModifiable()) { result.setProperty(IRepository.PROP_COMPRESSED, compress ? "true" : "false"); //$NON-NLS-1$//$NON-NLS-2$ IMetadataRepositoryManager manager = getService(agent, IMetadataRepositoryManager.SERVICE_NAME); String repositoryName = name == null ? location + " - metadata" : name; //$NON-NLS-1$ IMetadataRepository result = manager.createRepository(location, repositoryName, IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null);
protected void initializeRepositories(PublisherInfo publisherInfo) throws ProvisionException { if (artifactLocation != null) { IArtifactRepository repo = Publisher.createArtifactRepository(agent, artifactLocation, artifactRepoName, compress, reusePackedFiles); if (!append && !isEmpty(repo)) { File repoLocation = URIUtil.toFile(artifactLocation); if (metadataLocation == null) throw new ProvisionException(createConfigurationEror(Messages.exception_noMetadataRepo)); publisherInfo.setMetadataRepository(Publisher.createMetadataRepository(agent, metadataLocation, metadataRepoName, append, compress));
IArtifactRepository result = loadArtifactRepository(agent, location, true, true); if (result != null && result.isModifiable()) { result.setProperty(IRepository.PROP_COMPRESSED, compress ? "true" : "false"); //$NON-NLS-1$//$NON-NLS-2$ IArtifactRepositoryManager manager = getService(agent, IArtifactRepositoryManager.SERVICE_NAME); String repositoryName = name != null ? name : location + " - artifacts"; //$NON-NLS-1$ IArtifactRepository result = manager.createRepository(location, repositoryName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null);