Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2011 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM Corporation - initial API and implementation /
 
 package org.eclipse.equinox.internal.p2.updatesite;
 
 import java.net.URI;
 import java.util.*;
 import  org.eclipse.equinox.p2.publisher.eclipse.URLEntry;

A model of an update site. Copied from org.eclipse.update.core.model.SiteModel.
 
 public class SiteModel {
 
 	private List<URLEntry> archiveReferences;
Map of String (category id) -> SiteCategory
 
 	private URLEntry description;
Map of String (feature id) -> SiteFeature
 
 	private List<SiteFeaturefeatures;
 	private List<SiteIUius;
 	private URI locationURI;
 	private boolean supportsPack200;
 	private String type;
 	private URLEntry[] associateSites;
 	private List<StringmessageKeys;
 	private Map<LocaleMap<StringString>> localizations;

Creates an uninitialized site model object.

Since:
2.0
 
 	public SiteModel() {
 		super();
 	}

Adds an archive reference model to site. Throws a runtime exception if this object is marked read-only.

Parameters:
archiveReference archive reference model
Since:
2.0
 
 	public void addArchive(URLEntry archiveReference) {
 		if (this. == null)
 			this. = new ArrayList<URLEntry>();
 		if (!this..contains(archiveReference))
 			this..add(archiveReference);
 	}

Adds a category to the site.

Parameters:
category category model
 
 	public void addCategory(SiteCategory category) {
 		if ( == null)
 		if (!.containsKey(category.getName())) {
 			.put(category.getName(), category);
 			if ( != null && !.isEmpty())
 		}
 	}

Adds a feature reference model to site.

Parameters:
featureReference feature reference model
 
 	public void addFeature(SiteFeature featureReference) {
 		if (this. == null)
 			this. = new ArrayList<SiteFeature>();
 		this..add(featureReference);
 	}

Adds a iu model to site.

Parameters:
iu iu model
 
	public void addIU(SiteIU iu) {
		if (this. == null)
			this. = new ArrayList<SiteIU>();
		this..add(iu);
	}

Returns an array of plug-in and non-plug-in archive reference models on this site

Returns:
an array of archive reference models, or an empty array if there are no archives known to this site.
Since:
2.0
	public URLEntry[] getArchives() {
		if ( == null || .size() == 0)
			return new URLEntry[0];
		return .toArray(new URLEntry[0]);
	}
	public URLEntry[] getAssociatedSites() {
	}

Returns an array of category models for this site.

Returns:
array of site category models, or an empty array.
Since:
2.0
		if ( == null || .size() == 0)
			return new SiteCategory[0];
	}

Returns the category with the given name.

Returns:
the category with the given name, or null
	public SiteCategory getCategory(String name) {
		return ( == null ? null : .get(name));
	}

Returns the site description.

Returns:
site description, or null.
	public URLEntry getDescription() {
		return ;
	}

Returns an array of feature reference models on this site.

Returns:
an array of feature reference models, or an empty array.
	public SiteFeature[] getFeatures() {
		if ( == null || .size() == 0)
			return new SiteFeature[0];
		return .toArray(new SiteFeature[0]);
	}

Returns an array of IU models on this site.

Returns:
an array of IU models, or an empty array.
	public SiteIU[] getIUs() {
		if ( == null || .size() == 0)
			return new SiteIU[0];
		return .toArray(new SiteIU[0]);
	}

Gets the localizations for the site as a map from locale to the set of translated properties for that locale.

Returns:
a map from locale to property set
Since:
3.4
		return this.;
	}

Returns the resolved URI for the site.

Returns:
url, or null
	public URI getLocationURI() {
		if ( == null &&  != null) {
			try {
catch (URISyntaxException e) {
				//ignore and return null
			}
		}
		return ;
	}

Returns the unresolved URI string for the site.

Returns:
url string, or null
	}

Return the keys for translatable strings

Returns:
the list of keys for translatable strings; may be null
Since:
3.4
	public List<StringgetMessageKeys() {
		return ;
	}

Returns the URI from which the list of mirrors of this site can be retrieved.
	public String getMirrorsURI() {
	}

Returns the site type.

Returns:
site type, or null.
Since:
2.0
	public String getType() {
		return ;
	}
	public boolean isPack200Supported() {
	}

Sets the site description.

Parameters:
description site description
Since:
2.0
	public void setDescription(URLEntry description) {
		this. = description;
	}

Sets the localizations for the site as a map from locale to the set of translated properties for that locale.

Parameters:
localizations as a map from locale to property set
Since:
3.4
	public void setLocalizations(Map<LocaleMap<StringString>> localizations) {
		this. = localizations;
		if (localizations != null && !localizations.isEmpty() && //
				 != null && !.isEmpty()) {
			for (SiteCategory category : .values()) {
				category.setLocalizations(localizations);
			}
		}
	}

Sets the unresolved URI for the site.

Parameters:
locationURIString url for the site (as a string)
Since:
2.0
	public void setLocationURIString(String locationURIString) {
		this. = locationURIString;
	}

Sets keys for translatable strings

Parameters:
keys for translatable strings
Since:
3.4
	public void setMessageKeys(List<Stringkeys) {
		this. = keys;
	}

Sets the mirrors url. Mirror sites will then be obtained from this mirror url later. This method is complementary to setMirrorsiteEntryModels(), and only one of these methods should be called.

Parameters:
mirrorsURI additional update site mirrors
Since:
3.1
	public void setMirrorsURIString(String mirrorsURI) {
		this. = mirrorsURI;
	}
	public void setSupportsPack200(boolean value) {
		this. = value;
	}

Sets the site type. Throws a runtime exception if this object is marked read-only.

Parameters:
type site type
Since:
2.0
	public void setType(String type) {
		this. = type;
	}

Sets the associated sites for this update site.

Parameters:
associateSites the associated sites
	public void setAssociateSites(URLEntry[] associateSites) {
		this. = associateSites;
	}
	public void setDigestURIString(String digestURIString) {
		this. = digestURIString;
	}
	}
New to GrepCode? Check out our FAQ X