Example #1
0
 /// <summary>
 /// Creates a resource by fetching the resource content from the given URL.
 /// </summary>
 /// <param name="path">path where we'd like to add the new resource. 
 /// Although this path is specified by the caller of the method, resource 
 /// may not be actually added at this path.</param>
 /// <param name="url">where to fetch the resource content</param>
 /// <param name="resource">a template resource</param>
 /// <returns>actual path to the new resource</returns>
 public String ImportResource(String path, String url, Resource resource)
 {
     String output = null;
     execute(delegate() { output = client.WSimportResource(path, url, 
         ResourceToWSResource(resource)); });
     return output;
 }
Example #2
0
        private static WSResource ResourceToWSResource(Resource resource)
        {
            WSResource toAdd = (resource is Collection) ? new WSCollection() : new WSResource();
            toAdd.authorUserName = resource.authorUserName;
            toAdd.description = resource.description;
            toAdd.mediaType = resource.mediaType;
            toAdd.properties = resource.properties;
            toAdd.createdTime = resource.createdTime;
            toAdd.id = resource.id;
            toAdd.lastModified = resource.lastModified;
            toAdd.lastUpdaterUserName = resource.lastUpdaterUserName;
            toAdd.parentPath = resource.parentPath;
            toAdd.path = resource.path;
            toAdd.matchingSnapshotID = resource.matchingSnapshotID;
            toAdd.contentFile = resource.contentFile;

            if (resource is Collection)
            {
                toAdd.collection = true;
                ((WSCollection)toAdd).children = ((Collection)resource).children;
                ((WSCollection)toAdd).childCount = ((Collection)resource).childCount;
            }
            return toAdd;
        }
Example #3
0
 /// <summary>
 /// Returns the meta data of the resource at a given path.
 /// </summary>
 /// <param name="path">Path of the resource. e.g. /project1/server/deployment.xml</param>
 /// <returns>Resource instance</returns>
 public Resource GetMetaData(String path)
 {
     WSResource resource = null;
     execute(delegate() { resource = client.WSgetMetaData(path); });
     Resource output = new Resource(this, resource);
     output.PathWithVersion = path;
     return output;
 }
Example #4
0
 /// <summary>
 /// Adds or updates resources in the registry. If there is no resource at the 
 /// given path, resource is added. If a resource already exist at the given path,
 /// it will be replaced with the new resource.
 /// </summary>
 /// <param name="path">the path which we'd like to use for the new resource.</param>
 /// <param name="resource">Resource instance for the new resource</param>
 /// <returns>the actual path that the server chose to use for our Resource</returns>
 public String Put(String path, Resource resource)
 {
     String output = null;
     execute(delegate() { output = client.WSput(path, ResourceToWSResource(resource)); });
     return output;
 }