Index: lams_build/lib/lams/lams-contentrepository.jar =================================================================== RCS file: /usr/local/cvsroot/lams_build/lib/lams/lams-contentrepository.jar,v diff -u -r1.20 -r1.21 Binary files differ Index: lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/client/IToolContentHandler.java =================================================================== RCS file: /usr/local/cvsroot/lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/client/IToolContentHandler.java,v diff -u -r1.5 -r1.6 --- lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/client/IToolContentHandler.java 30 Nov 2005 02:34:30 -0000 1.5 +++ lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/client/IToolContentHandler.java 29 Mar 2006 03:02:29 -0000 1.6 @@ -96,6 +96,21 @@ throws RepositoryCheckedException, InvalidParameterException, RepositoryCheckedException; + /** + * Save a directory of files in the content repository. + * + * @param ticket ticket issued on login. Identifies tool and workspace - mandatory + * @param dirPath directory path containing files - mandatory + * @param startFile relative path of initial file - optional + * @return nodeKey (uuid and version) + * @throws InvalidParameterException One of the mandatory parameters is missing. + * @throws FileException An error occured writing the files to disk. + * @throws RepositoryCheckedException Some other error occured. + */ + public abstract NodeKey uploadPackage(String dirPath, String startFile) + throws RepositoryCheckedException, InvalidParameterException, + RepositoryCheckedException; + /** * Delete a file node. If the node does not exist, then nothing happens (ie ItemNotFoundException is NOT thrown). * @param uuid id of the file node. Mandatory Index: lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/client/ToolContentHandler.java =================================================================== RCS file: /usr/local/cvsroot/lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/client/ToolContentHandler.java,v diff -u -r1.8 -r1.9 --- lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/client/ToolContentHandler.java 30 Nov 2005 02:34:30 -0000 1.8 +++ lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/client/ToolContentHandler.java 29 Mar 2006 03:02:29 -0000 1.9 @@ -226,6 +226,40 @@ } /** + * Save a directory of files in the content repository. + * + * @param ticket ticket issued on login. Identifies tool and workspace - mandatory + * @param dirPath directory path containing files - mandatory + * @param startFile relative path of initial file - optional + * @return nodeKey (uuid and version) + * @throws InvalidParameterException One of the mandatory parameters is missing. + * @throws FileException An error occured writing the files to disk. + * @throws RepositoryCheckedException Some other error occured. + */ + public NodeKey uploadPackage(String dirPath, String startFile) throws RepositoryCheckedException, InvalidParameterException, RepositoryCheckedException { + if ( dirPath == null ) + throw new InvalidParameterException("uploadFile: dirPath parameter empty. Directory containing files must be supplied"); + + NodeKey nodeKey = null; + try { + try { + nodeKey = getRepositoryService().addPackageItem(getTicket(false), dirPath, startFile, null); + } catch (AccessDeniedException e) { + log.warn("Unable to access repository to add directory of files. AccessDeniedException: " + +e.getMessage()+" Retrying login."); + nodeKey = getRepositoryService().addPackageItem(getTicket(true), dirPath, startFile, null); + } + + } catch (RepositoryCheckedException e2) { + log.warn("Unable to access repository to add directory of files. Repository Exception: " + +e2.getMessage()+" Retry not possible."); + throw e2; + } + + return nodeKey; + } + + /** * Copy an entry in the content repository. * * @param uuid id of the file node. Mandatory @@ -278,8 +312,8 @@ } } - /** Get a file node. - * @param uuid id of the file node. Mandatory + /** Get a file or package node. + * @param uuid id of the file/package node. Mandatory * @throws FileException An error occured writing the input stream to disk. * @throws ItemNotFoundException This file node does not exist, so cannot delete it. * @throws RepositoryCheckedException Some other error occured.