|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.rhq.enterprise.server.plugins.url.UrlProvider
public class UrlProvider
This is a basic implementation of a content source that provides primative package synchronization with a URL-based content source, such as an HTTP server. In order for this URL content source to properly scan and find content in the remote server, an index file must exist that provides metadata about each file. There are two forms of the index metadata file. The simple form is a list of each file relative to the root URL location. This index file can include paths to subdirectories under the root URL. The index file must be named "content-index.txt" unless overridden by the content source's configuration setting. The metadata stored in this simple index file describes the packages. Each line in the simple index file must be a single filename, followed by the MD5 of the files:
release-v1.0.zip|abe347586edbc6723461253457687bef release-v2.0.zip|456834fed6edb3452346125345768723d patches/patch-123.jar|56bc47586e5456edfb6a2534e7687345 patches/patch-4567.jar|dcb567886eabc6723461253457687befNote that this is a very inefficient type of content source because of the lack of metadata. Because the only thing we know is the URL to a piece of content and nothing else, the only way to determine things like version number is to possible download the content to scan it. The other index file supported is an XML file that contains the full set of metadata needed to fully define a package. Its XML file has a schema - look at the schema for the full syntax. Subclasses can override this class if they want to support more full-featured metadata (for example, an RSS feed found at the index URL). The index file can be specified as a full URL - if it is not, it will be assumed relative to the root URL.
| Constructor Summary | |
|---|---|
UrlProvider()
|
|
| Method Summary | |
|---|---|
protected ContentProviderPackageDetails |
createPackage(RemotePackageInfo rpi)
Created the package details given the remote package information. |
protected RemotePackageInfo.SupportedPackageType |
determinePackageType(RemotePackageInfo rpi)
|
protected ContentProviderPackageDetails |
findPackage(java.util.List<ContentProviderPackageDetails> packages,
ContentProviderPackageDetails pkg)
|
protected java.io.InputStream |
getIndexInputStream()
Returns the stream that contains the index file content. |
protected java.net.URL |
getIndexUrl()
|
java.io.InputStream |
getInputStream(java.lang.String location)
|
protected java.util.Map<java.lang.String,RemotePackageInfo> |
getRemotePackageInfosFromIndex()
Returns info on all the files listed in the index file. |
protected java.net.URL |
getRootUrl()
|
protected java.lang.String |
getRootUrlString()
Returns a stringified version of root URL that is used to build a full URL to content. |
protected java.util.Map<java.lang.String,RemotePackageInfo.SupportedPackageType> |
getSupportedPackageTypes()
|
void |
initialize(Configuration configuration)
|
protected void |
initializePackageTypes(Configuration config)
|
protected void |
setIndexUrl(java.net.URL indexURL)
|
protected void |
setRootUrl(java.net.URL url)
|
protected void |
setSupportedPackageTypes(java.util.Map<java.lang.String,RemotePackageInfo.SupportedPackageType> supportedPackageTypes)
|
void |
shutdown()
|
void |
synchronizePackages(java.lang.String repoName,
PackageSyncReport report,
java.util.Collection<ContentProviderPackageDetails> existingPackages)
|
protected void |
syncPackage(PackageSyncReport report,
java.util.List<ContentProviderPackageDetails> packages,
RemotePackageInfo rpi)
Builds up the report of packages by adding to it the content that is being processed. |
void |
testConnection()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public UrlProvider()
| Method Detail |
|---|
protected java.lang.String getRootUrlString()
protected java.net.URL getRootUrl()
protected void setRootUrl(java.net.URL url)
protected java.net.URL getIndexUrl()
protected void setIndexUrl(java.net.URL indexURL)
protected java.util.Map<java.lang.String,RemotePackageInfo.SupportedPackageType> getSupportedPackageTypes()
protected void setSupportedPackageTypes(java.util.Map<java.lang.String,RemotePackageInfo.SupportedPackageType> supportedPackageTypes)
public void initialize(Configuration configuration)
throws java.lang.Exception
initialize in interface ContentProviderjava.lang.Exceptionpublic void shutdown()
shutdown in interface ContentProvider
public void synchronizePackages(java.lang.String repoName,
PackageSyncReport report,
java.util.Collection<ContentProviderPackageDetails> existingPackages)
throws java.lang.Exception
synchronizePackages in interface PackageSourcejava.lang.Exception
public void testConnection()
throws java.lang.Exception
testConnection in interface ContentProviderjava.lang.Exception
public java.io.InputStream getInputStream(java.lang.String location)
throws java.lang.Exception
getInputStream in interface PackageSourcejava.lang.Exception
protected java.io.InputStream getIndexInputStream()
throws java.lang.Exception
index file content.
java.lang.Exception
protected java.util.Map<java.lang.String,RemotePackageInfo> getRemotePackageInfosFromIndex()
throws java.lang.Exception
index file.
java.lang.Exception - if the index file is missing or cannot be processed
protected void syncPackage(PackageSyncReport report,
java.util.List<ContentProviderPackageDetails> packages,
RemotePackageInfo rpi)
throws java.lang.Exception
packages if they exist
leaving only packages remaining that do not exist on the remote system.
report - the report that we are building uppackages - existing packages not yet found on the remote system but exist in server inventoryrpi - information about the package that needs to be synced
java.lang.Exception - if the sync fails
protected ContentProviderPackageDetails createPackage(RemotePackageInfo rpi)
throws java.lang.Exception
rpi - information about the remote package
java.lang.Exception
protected ContentProviderPackageDetails findPackage(java.util.List<ContentProviderPackageDetails> packages,
ContentProviderPackageDetails pkg)
protected void initializePackageTypes(Configuration config)
protected RemotePackageInfo.SupportedPackageType determinePackageType(RemotePackageInfo rpi)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||