You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by je...@apache.org on 2010/04/16 16:14:02 UTC
svn commit: r934896 [8/12] - in
/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server:
chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/
chemistry-opencmis-server-bindings/src/main/java/org/apache/chemi...
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FolderInfo.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FolderInfo.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FolderInfo.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FolderInfo.java Fri Apr 16 14:14:00 2010
@@ -23,22 +23,22 @@ import org.apache.chemistry.opencmis.ser
public class FolderInfo extends ObjectInfoImpl {
- public FolderInfo() {
- setBaseType(BaseTypeId.CMIS_FOLDER);
- setContentType(null);
- setFileName(null);
- setHasAcl(true);
- setHasContent(false);
- setVersionSeriesId(null);
- setIsCurrentVersion(true);
- setRelationshipSourceIds(null);
- setRelationshipTargetIds(null);
- setRenditionInfos(null);
- setSupportsDescendants(true);
- setSupportsFolderTree(true);
- setSupportsPolicies(false);
- setSupportsRelationships(false);
- setWorkingCopyId(null);
- setWorkingCopyOriginalId(null);
- }
+ public FolderInfo() {
+ setBaseType(BaseTypeId.CMIS_FOLDER);
+ setContentType(null);
+ setFileName(null);
+ setHasAcl(true);
+ setHasContent(false);
+ setVersionSeriesId(null);
+ setIsCurrentVersion(true);
+ setRelationshipSourceIds(null);
+ setRelationshipTargetIds(null);
+ setRenditionInfos(null);
+ setSupportsDescendants(true);
+ setSupportsFolderTree(true);
+ setSupportsPolicies(false);
+ setSupportsRelationships(false);
+ setWorkingCopyId(null);
+ setWorkingCopyOriginalId(null);
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/MIMETypes.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/MIMETypes.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/MIMETypes.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/MIMETypes.java Fri Apr 16 14:14:00 2010
@@ -24,217 +24,216 @@ import java.util.Map;
public class MIMETypes {
- private static Map<String, String> EXT2MIME = new HashMap<String, String>();
+ private static Map<String, String> EXT2MIME = new HashMap<String, String>();
- static {
- EXT2MIME.put("", "application/octet-stream");
- EXT2MIME.put("ai", "application/postscript");
- EXT2MIME.put("aif", "audio/x-aiff");
- EXT2MIME.put("aifc", "audio/x-aiff");
- EXT2MIME.put("aiff", "audio/x-aiff");
- EXT2MIME.put("asf", "video/x-ms-asf");
- EXT2MIME.put("asr", "video/x-ms-asf");
- EXT2MIME.put("asx", "video/x-ms-asf");
- EXT2MIME.put("au", "audio/basic");
- EXT2MIME.put("avi", "video/x-msvideo");
- EXT2MIME.put("axs", "application/olescript");
- EXT2MIME.put("bas", "text/plain");
- EXT2MIME.put("bmp", "image/bmp");
- EXT2MIME.put("c", "text/plain");
- EXT2MIME.put("cat", "application/vnd.ms-pkiseccat");
- EXT2MIME.put("cdf", "application/x-cdf");
- EXT2MIME.put("cer", "application/x-x509-ca-cert");
- EXT2MIME.put("clp", "application/x-msclip");
- EXT2MIME.put("cmx", "image/x-cmx");
- EXT2MIME.put("cod", "image/cis-cod");
- EXT2MIME.put("cpio", "application/x-cpio");
- EXT2MIME.put("crd", "application/x-mscardfile");
- EXT2MIME.put("crl", "application/pkix-crl");
- EXT2MIME.put("crt", "application/x-x509-ca-cert");
- EXT2MIME.put("csh", "application/x-csh");
- EXT2MIME.put("css", "text/css");
- EXT2MIME.put("dll", "application/x-msdownload");
- EXT2MIME.put("doc", "application/msword");
- EXT2MIME.put("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
- EXT2MIME.put("doct", "application/vnd.openxmlformats-officedocument.wordprocessingml.template");
- EXT2MIME.put("dot", "application/msword");
- EXT2MIME.put("dvi", "application/x-dvi");
- EXT2MIME.put("dxr", "application/x-director");
- EXT2MIME.put("eps", "application/postscript");
- EXT2MIME.put("etx", "text/x-setext");
- EXT2MIME.put("evy", "application/envoy");
- EXT2MIME.put("fif", "application/fractals");
- EXT2MIME.put("flr", "x-world/x-vrml");
- EXT2MIME.put("gif", "image/gif");
- EXT2MIME.put("gtar", "application/x-gtar");
- EXT2MIME.put("gz", "application/x-gzip");
- EXT2MIME.put("h", "text/plain");
- EXT2MIME.put("hdf", "application/x-hdf");
- EXT2MIME.put("hlp", "application/winhlp");
- EXT2MIME.put("hqx", "application/mac-binhex40");
- EXT2MIME.put("hta", "application/hta");
- EXT2MIME.put("htc", "text/x-component");
- EXT2MIME.put("htm", "text/html");
- EXT2MIME.put("html", "text/html");
- EXT2MIME.put("htt", "text/webviewhtml");
- EXT2MIME.put("ico", "image/x-icon");
- EXT2MIME.put("ief", "image/ief");
- EXT2MIME.put("iii", "application/x-iphone");
- EXT2MIME.put("isp", "application/x-internet-signup");
- EXT2MIME.put("jfif", "image/pipeg");
- EXT2MIME.put("jpe", "image/jpeg");
- EXT2MIME.put("jpeg", "image/jpeg");
- EXT2MIME.put("jpg", "image/jpeg");
- EXT2MIME.put("js", "application/x-javascript");
- EXT2MIME.put("latex", "application/x-latex");
- EXT2MIME.put("lsf", "video/x-la-asf");
- EXT2MIME.put("lsx", "video/x-la-asf");
- EXT2MIME.put("m3u", "audio/x-mpegurl");
- EXT2MIME.put("man", "application/x-troff-man");
- EXT2MIME.put("mdb", "application/x-msaccess");
- EXT2MIME.put("me", "application/x-troff-me");
- EXT2MIME.put("mhtv", "message/rfc822");
- EXT2MIME.put("mhtml", "message/rfc822");
- EXT2MIME.put("mid", "audio/mid");
- EXT2MIME.put("mov", "video/quicktime");
- EXT2MIME.put("movie", "video/x-sgi-movie");
- EXT2MIME.put("mp2", "video/mpeg");
- EXT2MIME.put("mp3", "audio/mpeg");
- EXT2MIME.put("mpa", "video/mpeg");
- EXT2MIME.put("mpe", "video/mpegv");
- EXT2MIME.put("mpeg", "video/mpeg");
- EXT2MIME.put("mpg", "video/mpegv");
- EXT2MIME.put("mpp", "application/vnd.ms-project");
- EXT2MIME.put("mpv2", "video/mpeg");
- EXT2MIME.put("ms", "application/x-troff-ms");
- EXT2MIME.put("mvb", "application/x-msmediaview");
- EXT2MIME.put("nws", "message/rfc822");
- EXT2MIME.put("oda", "application/oda");
- EXT2MIME.put("p10", "application/pkcs10");
- EXT2MIME.put("p12", "application/x-pkcs12v");
- EXT2MIME.put("p7b", "application/x-pkcs7-certificates");
- EXT2MIME.put("p7c", "application/x-pkcs7-mime");
- EXT2MIME.put("p7m", "application/x-pkcs7-mime");
- EXT2MIME.put("p7r", "application/x-pkcs7-certreqresp");
- EXT2MIME.put("p7s", "application/x-pkcs7-signature");
- EXT2MIME.put("pbm", "image/x-portable-bitmap");
- EXT2MIME.put("pdf", "application/pdf");
- EXT2MIME.put("pfx", "application/x-pkcs12");
- EXT2MIME.put("pgm", "image/x-portable-graymap");
- EXT2MIME.put("vpko", "application/ynd.ms-pkipko");
- EXT2MIME.put("pma", "application/x-perfmon");
- EXT2MIME.put("pmc", "application/x-perfmon");
- EXT2MIME.put("pml", "application/x-perfmon");
- EXT2MIME.put("pmr", "application/x-perfmon");
- EXT2MIME.put("pmw", "application/x-perfmon");
- EXT2MIME.put("png", "image/png");
- EXT2MIME.put("pnm", "image/x-portable-anymap");
- EXT2MIME.put("pot", "application/vnd.ms-powerpoint");
- EXT2MIME.put("ppm", "image/x-portable-pixmap");
- EXT2MIME.put("pps", "application/vnd.ms-powerpoint");
- EXT2MIME.put("ppt", "application/vnd.ms-powerpoint");
- EXT2MIME.put("pptx",
- "application/vnd.openxmlformats-officedocument.presentationml.presentation");
- EXT2MIME.put("ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow");
- EXT2MIME.put("potx", "application/vnd.openxmlformats-officedocument.presentationml.template");
- EXT2MIME.put("prf", "application/pics-rules");
- EXT2MIME.put("ps", "application/postscript");
- EXT2MIME.put("pub", "application/x-mspublisher");
- EXT2MIME.put("qt", "video/quicktime");
- EXT2MIME.put("ra", "audio/x-pn-realaudio");
- EXT2MIME.put("ram", "audio/x-pn-realaudio");
- EXT2MIME.put("ras", "image/x-cmu-raster");
- EXT2MIME.put("rgb", "image/x-rgb");
- EXT2MIME.put("rmi", "audio/mid");
- EXT2MIME.put("roff", "application/x-troff");
- EXT2MIME.put("rtf", "application/rtf");
- EXT2MIME.put("rtx", "text/richtext");
- EXT2MIME.put("scd", "application/x-msschedule");
- EXT2MIME.put("sct", "text/scriptlet");
- EXT2MIME.put("sh", "application/x-sh");
- EXT2MIME.put("shar", "application/x-shar");
- EXT2MIME.put("sit", "application/x-stuffit");
- EXT2MIME.put("snd", "audio/basic");
- EXT2MIME.put("spc", "application/x-pkcs7-certificates");
- EXT2MIME.put("spl", "application/futuresplash");
- EXT2MIME.put("src", "application/x-wais-source");
- EXT2MIME.put("sst", "application/vnd.ms-pkicertstore");
- EXT2MIME.put("stl", "application/vnd.ms-pkistl");
- EXT2MIME.put("stm", "text/html");
- EXT2MIME.put("svg", "image/svg+xml");
- EXT2MIME.put("swf", "application/x-shockwave-flash");
- EXT2MIME.put("t", "application/x-troff");
- EXT2MIME.put("tar", "application/x-tar");
- EXT2MIME.put("tcl", "application/x-tcl");
- EXT2MIME.put("tex", "application/x-tex");
- EXT2MIME.put("texi", "application/x-texinfo");
- EXT2MIME.put("texinfo", "application/x-texinfo");
- EXT2MIME.put("tgz", "application/x-compressed");
- EXT2MIME.put("tif", "image/tiff");
- EXT2MIME.put("tiff", "image/tiff");
- EXT2MIME.put("tr", "application/x-troff");
- EXT2MIME.put("trm", "application/x-msterminal");
- EXT2MIME.put("tsv", "text/tab-separated-values");
- EXT2MIME.put("txt", "text/plain");
- EXT2MIME.put("uls", "text/iuls");
- EXT2MIME.put("ustar", "application/x-ustar");
- EXT2MIME.put("vcf", "text/x-vcard");
- EXT2MIME.put("vrml", "x-world/x-vrml");
- EXT2MIME.put("wav", "audio/x-wav");
- EXT2MIME.put("wcm", "application/vnd.ms-works");
- EXT2MIME.put("wdb", "application/vnd.ms-works");
- EXT2MIME.put("wmf", "application/x-msmetafile");
- EXT2MIME.put("wps", "application/vnd.ms-works");
- EXT2MIME.put("wri", "application/x-mswrite");
- EXT2MIME.put("wrl", "x-world/x-vrml");
- EXT2MIME.put("wrz", "x-world/x-vrml");
- EXT2MIME.put("xaf", "x-world/x-vrml");
- EXT2MIME.put("xbm", "image/x-xbitmap");
- EXT2MIME.put("xla", "application/vnd.ms-excel");
- EXT2MIME.put("xlc", "application/vnd.ms-excel");
- EXT2MIME.put("xlm", "application/vnd.ms-excel");
- EXT2MIME.put("xls", "application/vnd.ms-excel");
- EXT2MIME.put("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
- EXT2MIME.put("xlt", "application/vnd.ms-excel");
- EXT2MIME.put("xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template");
- EXT2MIME.put("xlw", "application/vnd.ms-excel");
- EXT2MIME.put("xml", "text/xml");
- EXT2MIME.put("xof", "x-world/x-vrml");
- EXT2MIME.put("xpm", "image/x-xpixmap");
- EXT2MIME.put("xwd", "image/x-xwindowdump");
- EXT2MIME.put("z", "application/x-compress");
- EXT2MIME.put("zip", "application/zip");
- }
-
- /**
- * Returns the MIME type for file extension.
- */
- public static String getMIMEType(String ext) {
- if (ext == null) {
- return EXT2MIME.get("");
- }
-
- int x = ext.lastIndexOf('.');
- if (x > -1) {
- ext = ext.substring(x + 1);
- }
-
- String mime = EXT2MIME.get(ext.toLowerCase());
- if (mime == null) {
- mime = EXT2MIME.get("");
- }
-
- return mime;
- }
-
- /**
- * Returns the MIME type for a file.
- */
- public static String getMIMEType(File file) {
- if (file == null) {
- return getMIMEType("");
- }
+ static {
+ EXT2MIME.put("", "application/octet-stream");
+ EXT2MIME.put("ai", "application/postscript");
+ EXT2MIME.put("aif", "audio/x-aiff");
+ EXT2MIME.put("aifc", "audio/x-aiff");
+ EXT2MIME.put("aiff", "audio/x-aiff");
+ EXT2MIME.put("asf", "video/x-ms-asf");
+ EXT2MIME.put("asr", "video/x-ms-asf");
+ EXT2MIME.put("asx", "video/x-ms-asf");
+ EXT2MIME.put("au", "audio/basic");
+ EXT2MIME.put("avi", "video/x-msvideo");
+ EXT2MIME.put("axs", "application/olescript");
+ EXT2MIME.put("bas", "text/plain");
+ EXT2MIME.put("bmp", "image/bmp");
+ EXT2MIME.put("c", "text/plain");
+ EXT2MIME.put("cat", "application/vnd.ms-pkiseccat");
+ EXT2MIME.put("cdf", "application/x-cdf");
+ EXT2MIME.put("cer", "application/x-x509-ca-cert");
+ EXT2MIME.put("clp", "application/x-msclip");
+ EXT2MIME.put("cmx", "image/x-cmx");
+ EXT2MIME.put("cod", "image/cis-cod");
+ EXT2MIME.put("cpio", "application/x-cpio");
+ EXT2MIME.put("crd", "application/x-mscardfile");
+ EXT2MIME.put("crl", "application/pkix-crl");
+ EXT2MIME.put("crt", "application/x-x509-ca-cert");
+ EXT2MIME.put("csh", "application/x-csh");
+ EXT2MIME.put("css", "text/css");
+ EXT2MIME.put("dll", "application/x-msdownload");
+ EXT2MIME.put("doc", "application/msword");
+ EXT2MIME.put("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
+ EXT2MIME.put("doct", "application/vnd.openxmlformats-officedocument.wordprocessingml.template");
+ EXT2MIME.put("dot", "application/msword");
+ EXT2MIME.put("dvi", "application/x-dvi");
+ EXT2MIME.put("dxr", "application/x-director");
+ EXT2MIME.put("eps", "application/postscript");
+ EXT2MIME.put("etx", "text/x-setext");
+ EXT2MIME.put("evy", "application/envoy");
+ EXT2MIME.put("fif", "application/fractals");
+ EXT2MIME.put("flr", "x-world/x-vrml");
+ EXT2MIME.put("gif", "image/gif");
+ EXT2MIME.put("gtar", "application/x-gtar");
+ EXT2MIME.put("gz", "application/x-gzip");
+ EXT2MIME.put("h", "text/plain");
+ EXT2MIME.put("hdf", "application/x-hdf");
+ EXT2MIME.put("hlp", "application/winhlp");
+ EXT2MIME.put("hqx", "application/mac-binhex40");
+ EXT2MIME.put("hta", "application/hta");
+ EXT2MIME.put("htc", "text/x-component");
+ EXT2MIME.put("htm", "text/html");
+ EXT2MIME.put("html", "text/html");
+ EXT2MIME.put("htt", "text/webviewhtml");
+ EXT2MIME.put("ico", "image/x-icon");
+ EXT2MIME.put("ief", "image/ief");
+ EXT2MIME.put("iii", "application/x-iphone");
+ EXT2MIME.put("isp", "application/x-internet-signup");
+ EXT2MIME.put("jfif", "image/pipeg");
+ EXT2MIME.put("jpe", "image/jpeg");
+ EXT2MIME.put("jpeg", "image/jpeg");
+ EXT2MIME.put("jpg", "image/jpeg");
+ EXT2MIME.put("js", "application/x-javascript");
+ EXT2MIME.put("latex", "application/x-latex");
+ EXT2MIME.put("lsf", "video/x-la-asf");
+ EXT2MIME.put("lsx", "video/x-la-asf");
+ EXT2MIME.put("m3u", "audio/x-mpegurl");
+ EXT2MIME.put("man", "application/x-troff-man");
+ EXT2MIME.put("mdb", "application/x-msaccess");
+ EXT2MIME.put("me", "application/x-troff-me");
+ EXT2MIME.put("mhtv", "message/rfc822");
+ EXT2MIME.put("mhtml", "message/rfc822");
+ EXT2MIME.put("mid", "audio/mid");
+ EXT2MIME.put("mov", "video/quicktime");
+ EXT2MIME.put("movie", "video/x-sgi-movie");
+ EXT2MIME.put("mp2", "video/mpeg");
+ EXT2MIME.put("mp3", "audio/mpeg");
+ EXT2MIME.put("mpa", "video/mpeg");
+ EXT2MIME.put("mpe", "video/mpegv");
+ EXT2MIME.put("mpeg", "video/mpeg");
+ EXT2MIME.put("mpg", "video/mpegv");
+ EXT2MIME.put("mpp", "application/vnd.ms-project");
+ EXT2MIME.put("mpv2", "video/mpeg");
+ EXT2MIME.put("ms", "application/x-troff-ms");
+ EXT2MIME.put("mvb", "application/x-msmediaview");
+ EXT2MIME.put("nws", "message/rfc822");
+ EXT2MIME.put("oda", "application/oda");
+ EXT2MIME.put("p10", "application/pkcs10");
+ EXT2MIME.put("p12", "application/x-pkcs12v");
+ EXT2MIME.put("p7b", "application/x-pkcs7-certificates");
+ EXT2MIME.put("p7c", "application/x-pkcs7-mime");
+ EXT2MIME.put("p7m", "application/x-pkcs7-mime");
+ EXT2MIME.put("p7r", "application/x-pkcs7-certreqresp");
+ EXT2MIME.put("p7s", "application/x-pkcs7-signature");
+ EXT2MIME.put("pbm", "image/x-portable-bitmap");
+ EXT2MIME.put("pdf", "application/pdf");
+ EXT2MIME.put("pfx", "application/x-pkcs12");
+ EXT2MIME.put("pgm", "image/x-portable-graymap");
+ EXT2MIME.put("vpko", "application/ynd.ms-pkipko");
+ EXT2MIME.put("pma", "application/x-perfmon");
+ EXT2MIME.put("pmc", "application/x-perfmon");
+ EXT2MIME.put("pml", "application/x-perfmon");
+ EXT2MIME.put("pmr", "application/x-perfmon");
+ EXT2MIME.put("pmw", "application/x-perfmon");
+ EXT2MIME.put("png", "image/png");
+ EXT2MIME.put("pnm", "image/x-portable-anymap");
+ EXT2MIME.put("pot", "application/vnd.ms-powerpoint");
+ EXT2MIME.put("ppm", "image/x-portable-pixmap");
+ EXT2MIME.put("pps", "application/vnd.ms-powerpoint");
+ EXT2MIME.put("ppt", "application/vnd.ms-powerpoint");
+ EXT2MIME.put("pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation");
+ EXT2MIME.put("ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow");
+ EXT2MIME.put("potx", "application/vnd.openxmlformats-officedocument.presentationml.template");
+ EXT2MIME.put("prf", "application/pics-rules");
+ EXT2MIME.put("ps", "application/postscript");
+ EXT2MIME.put("pub", "application/x-mspublisher");
+ EXT2MIME.put("qt", "video/quicktime");
+ EXT2MIME.put("ra", "audio/x-pn-realaudio");
+ EXT2MIME.put("ram", "audio/x-pn-realaudio");
+ EXT2MIME.put("ras", "image/x-cmu-raster");
+ EXT2MIME.put("rgb", "image/x-rgb");
+ EXT2MIME.put("rmi", "audio/mid");
+ EXT2MIME.put("roff", "application/x-troff");
+ EXT2MIME.put("rtf", "application/rtf");
+ EXT2MIME.put("rtx", "text/richtext");
+ EXT2MIME.put("scd", "application/x-msschedule");
+ EXT2MIME.put("sct", "text/scriptlet");
+ EXT2MIME.put("sh", "application/x-sh");
+ EXT2MIME.put("shar", "application/x-shar");
+ EXT2MIME.put("sit", "application/x-stuffit");
+ EXT2MIME.put("snd", "audio/basic");
+ EXT2MIME.put("spc", "application/x-pkcs7-certificates");
+ EXT2MIME.put("spl", "application/futuresplash");
+ EXT2MIME.put("src", "application/x-wais-source");
+ EXT2MIME.put("sst", "application/vnd.ms-pkicertstore");
+ EXT2MIME.put("stl", "application/vnd.ms-pkistl");
+ EXT2MIME.put("stm", "text/html");
+ EXT2MIME.put("svg", "image/svg+xml");
+ EXT2MIME.put("swf", "application/x-shockwave-flash");
+ EXT2MIME.put("t", "application/x-troff");
+ EXT2MIME.put("tar", "application/x-tar");
+ EXT2MIME.put("tcl", "application/x-tcl");
+ EXT2MIME.put("tex", "application/x-tex");
+ EXT2MIME.put("texi", "application/x-texinfo");
+ EXT2MIME.put("texinfo", "application/x-texinfo");
+ EXT2MIME.put("tgz", "application/x-compressed");
+ EXT2MIME.put("tif", "image/tiff");
+ EXT2MIME.put("tiff", "image/tiff");
+ EXT2MIME.put("tr", "application/x-troff");
+ EXT2MIME.put("trm", "application/x-msterminal");
+ EXT2MIME.put("tsv", "text/tab-separated-values");
+ EXT2MIME.put("txt", "text/plain");
+ EXT2MIME.put("uls", "text/iuls");
+ EXT2MIME.put("ustar", "application/x-ustar");
+ EXT2MIME.put("vcf", "text/x-vcard");
+ EXT2MIME.put("vrml", "x-world/x-vrml");
+ EXT2MIME.put("wav", "audio/x-wav");
+ EXT2MIME.put("wcm", "application/vnd.ms-works");
+ EXT2MIME.put("wdb", "application/vnd.ms-works");
+ EXT2MIME.put("wmf", "application/x-msmetafile");
+ EXT2MIME.put("wps", "application/vnd.ms-works");
+ EXT2MIME.put("wri", "application/x-mswrite");
+ EXT2MIME.put("wrl", "x-world/x-vrml");
+ EXT2MIME.put("wrz", "x-world/x-vrml");
+ EXT2MIME.put("xaf", "x-world/x-vrml");
+ EXT2MIME.put("xbm", "image/x-xbitmap");
+ EXT2MIME.put("xla", "application/vnd.ms-excel");
+ EXT2MIME.put("xlc", "application/vnd.ms-excel");
+ EXT2MIME.put("xlm", "application/vnd.ms-excel");
+ EXT2MIME.put("xls", "application/vnd.ms-excel");
+ EXT2MIME.put("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+ EXT2MIME.put("xlt", "application/vnd.ms-excel");
+ EXT2MIME.put("xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template");
+ EXT2MIME.put("xlw", "application/vnd.ms-excel");
+ EXT2MIME.put("xml", "text/xml");
+ EXT2MIME.put("xof", "x-world/x-vrml");
+ EXT2MIME.put("xpm", "image/x-xpixmap");
+ EXT2MIME.put("xwd", "image/x-xwindowdump");
+ EXT2MIME.put("z", "application/x-compress");
+ EXT2MIME.put("zip", "application/zip");
+ }
+
+ /**
+ * Returns the MIME type for file extension.
+ */
+ public static String getMIMEType(String ext) {
+ if (ext == null) {
+ return EXT2MIME.get("");
+ }
+
+ int x = ext.lastIndexOf('.');
+ if (x > -1) {
+ ext = ext.substring(x + 1);
+ }
+
+ String mime = EXT2MIME.get(ext.toLowerCase());
+ if (mime == null) {
+ mime = EXT2MIME.get("");
+ }
+
+ return mime;
+ }
+
+ /**
+ * Returns the MIME type for a file.
+ */
+ public static String getMIMEType(File file) {
+ if (file == null) {
+ return getMIMEType("");
+ }
- return getMIMEType(file.getName());
- }
+ return getMIMEType(file.getName());
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/NavigationService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/NavigationService.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/NavigationService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/NavigationService.java Fri Apr 16 14:14:00 2010
@@ -42,130 +42,135 @@ import org.apache.chemistry.opencmis.ser
*/
public class NavigationService implements CmisNavigationService {
- private RepositoryMap fRepositoryMap;
+ private RepositoryMap fRepositoryMap;
- /**
- * Constructor.
- */
- public NavigationService(RepositoryMap repositoryMap) {
- fRepositoryMap = repositoryMap;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisNavigationService#getCheckedOutDocs(org.apache.opencmis.
- * server.spi.CallContext , java.lang.String, java.lang.String, java.lang.String,
- * java.lang.String, java.lang.Boolean, org.apache.opencmis.commons.enums.IncludeRelationships,
- * java.lang.String, java.math.BigInteger, java.math.BigInteger,
- * org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public ObjectList getCheckedOutDocs(CallContext context, String repositoryId, String folderId,
- String filter, String orderBy, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter, BigInteger maxItems,
- BigInteger skipCount, ExtensionsData extension, ObjectInfoHolder objectInfos) {
- fRepositoryMap.getAuthenticatedRepository(context, repositoryId);
-
- ObjectListImpl result = new ObjectListImpl();
- result.setHasMoreItems(false);
- result.setNumItems(BigInteger.ZERO);
- List<ObjectData> emptyList = Collections.emptyList();
- result.setObjects(emptyList);
-
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisNavigationService#getChildren(org.apache.opencmis.server
- * .spi.CallContext, java.lang.String, java.lang.String, java.lang.String, java.lang.String,
- * java.lang.Boolean, org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
- * java.lang.Boolean, java.math.BigInteger, java.math.BigInteger,
- * org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public ObjectInFolderList getChildren(CallContext context, String repositoryId, String folderId,
- String filter, String orderBy, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter,
- Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount,
- ExtensionsData extension, ObjectInfoHolder objectInfos) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getChildren(context,
- folderId, filter, includeAllowableActions, includePathSegment, maxItems, skipCount,
- objectInfos);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisNavigationService#getDescendants(org.apache.opencmis.server
- * .spi.CallContext , java.lang.String, java.lang.String, java.math.BigInteger, java.lang.String,
- * java.lang.Boolean, org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
- * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public List<ObjectInFolderContainer> getDescendants(CallContext context, String repositoryId,
- String folderId, BigInteger depth, String filter, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter,
- Boolean includePathSegment, ExtensionsData extension, ObjectInfoHolder objectInfos) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getDescendants(context,
- folderId, depth, filter, includeAllowableActions, includePathSegment, objectInfos, false);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisNavigationService#getFolderParent(org.apache.opencmis.server
- * .spi.CallContext , java.lang.String, java.lang.String, java.lang.String,
- * org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public ObjectData getFolderParent(CallContext context, String repositoryId, String folderId,
- String filter, ExtensionsData extension, ObjectInfoHolder objectInfos) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getFolderParent(
- context, folderId, filter, objectInfos);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisNavigationService#getFolderTree(org.apache.opencmis.server
- * .spi.CallContext , java.lang.String, java.lang.String, java.math.BigInteger, java.lang.String,
- * java.lang.Boolean, org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
- * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public List<ObjectInFolderContainer> getFolderTree(CallContext context, String repositoryId,
- String folderId, BigInteger depth, String filter, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter,
- Boolean includePathSegment, ExtensionsData extension, ObjectInfoHolder objectInfos) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getDescendants(context,
- folderId, depth, filter, includeAllowableActions, includePathSegment, objectInfos, true);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisNavigationService#getObjectParents(org.apache.opencmis.server
- * .spi.CallContext , java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
- * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean,
- * org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public List<ObjectParentData> getObjectParents(CallContext context, String repositoryId,
- String objectId, String filter, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter,
- Boolean includeRelativePathSegment, ExtensionsData extension, ObjectInfoHolder objectInfos) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId)
- .getObjectParents(context, objectId, filter, includeAllowableActions,
- includeRelativePathSegment, objectInfos);
- }
+ /**
+ * Constructor.
+ */
+ public NavigationService(RepositoryMap repositoryMap) {
+ fRepositoryMap = repositoryMap;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisNavigationService#getCheckedOutDocs
+ * (org.apache.opencmis. server.spi.CallContext , java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
+ * java.math.BigInteger, java.math.BigInteger,
+ * org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public ObjectList getCheckedOutDocs(CallContext context, String repositoryId, String folderId, String filter,
+ String orderBy, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+ String renditionFilter, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension,
+ ObjectInfoHolder objectInfos) {
+ fRepositoryMap.getAuthenticatedRepository(context, repositoryId);
+
+ ObjectListImpl result = new ObjectListImpl();
+ result.setHasMoreItems(false);
+ result.setNumItems(BigInteger.ZERO);
+ List<ObjectData> emptyList = Collections.emptyList();
+ result.setObjects(emptyList);
+
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisNavigationService#getChildren(org.
+ * apache.opencmis.server .spi.CallContext, java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
+ * java.lang.Boolean, java.math.BigInteger, java.math.BigInteger,
+ * org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public ObjectInFolderList getChildren(CallContext context, String repositoryId, String folderId, String filter,
+ String orderBy, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+ String renditionFilter, Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount,
+ ExtensionsData extension, ObjectInfoHolder objectInfos) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getChildren(context, folderId, filter,
+ includeAllowableActions, includePathSegment, maxItems, skipCount, objectInfos);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisNavigationService#getDescendants(org
+ * .apache.opencmis.server .spi.CallContext , java.lang.String,
+ * java.lang.String, java.math.BigInteger, java.lang.String,
+ * java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
+ * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public List<ObjectInFolderContainer> getDescendants(CallContext context, String repositoryId, String folderId,
+ BigInteger depth, String filter, Boolean includeAllowableActions,
+ IncludeRelationships includeRelationships, String renditionFilter, Boolean includePathSegment,
+ ExtensionsData extension, ObjectInfoHolder objectInfos) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getDescendants(context, folderId,
+ depth, filter, includeAllowableActions, includePathSegment, objectInfos, false);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisNavigationService#getFolderParent(
+ * org.apache.opencmis.server .spi.CallContext , java.lang.String,
+ * java.lang.String, java.lang.String,
+ * org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public ObjectData getFolderParent(CallContext context, String repositoryId, String folderId, String filter,
+ ExtensionsData extension, ObjectInfoHolder objectInfos) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getFolderParent(context, folderId,
+ filter, objectInfos);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisNavigationService#getFolderTree(org
+ * .apache.opencmis.server .spi.CallContext , java.lang.String,
+ * java.lang.String, java.math.BigInteger, java.lang.String,
+ * java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
+ * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public List<ObjectInFolderContainer> getFolderTree(CallContext context, String repositoryId, String folderId,
+ BigInteger depth, String filter, Boolean includeAllowableActions,
+ IncludeRelationships includeRelationships, String renditionFilter, Boolean includePathSegment,
+ ExtensionsData extension, ObjectInfoHolder objectInfos) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getDescendants(context, folderId,
+ depth, filter, includeAllowableActions, includePathSegment, objectInfos, true);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisNavigationService#getObjectParents
+ * (org.apache.opencmis.server .spi.CallContext , java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
+ * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public List<ObjectParentData> getObjectParents(CallContext context, String repositoryId, String objectId,
+ String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+ String renditionFilter, Boolean includeRelativePathSegment, ExtensionsData extension,
+ ObjectInfoHolder objectInfos) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getObjectParents(context, objectId,
+ filter, includeAllowableActions, includeRelativePathSegment, objectInfos);
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/ObjectService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/ObjectService.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/ObjectService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/ObjectService.java Fri Apr 16 14:14:00 2010
@@ -47,313 +47,317 @@ import org.apache.chemistry.opencmis.ser
*/
public class ObjectService implements CmisObjectService {
- private RepositoryMap fRepositoryMap;
+ private RepositoryMap fRepositoryMap;
- /**
- * Constructor.
- */
- public ObjectService(RepositoryMap repositoryMap) {
- fRepositoryMap = repositoryMap;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisObjectService#create(org.apache.opencmis.server.spi.CallContext
- * , java.lang.String, org.apache.opencmis.commons.provider.PropertiesData, java.lang.String,
- * org.apache.opencmis.commons.provider.ContentStreamData,
- * org.apache.opencmis.commons.enums.VersioningState, java.util.List,
- * org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public ObjectData create(CallContext context, String repositoryId, Properties properties,
- String folderId, ContentStream contentStream, VersioningState versioningState,
- List<String> policies, ExtensionsData extension, ObjectInfoHolder objectInfos) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).create(context,
- properties, folderId, contentStream, versioningState, objectInfos);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisObjectService#createDocument(org.apache.opencmis.server.
- * spi.CallContext, java.lang.String, org.apache.opencmis.commons.provider.PropertiesData,
- * java.lang.String, org.apache.opencmis.commons.provider.ContentStreamData,
- * org.apache.opencmis.commons.enums.VersioningState, java.util.List,
- * org.apache.opencmis.commons.provider.AccessControlList,
- * org.apache.opencmis.commons.provider.AccessControlList,
- * org.apache.opencmis.commons.api.ExtensionsData)
- */
- public String createDocument(CallContext context, String repositoryId, Properties properties,
- String folderId, ContentStream contentStream, VersioningState versioningState,
- List<String> policies, Acl addAces, Acl removeAces,
- ExtensionsData extension) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).createDocument(context,
- properties, folderId, contentStream, versioningState);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisObjectService#createDocumentFromSource(org.apache.opencmis
- * .server.spi. CallContext, java.lang.String, java.lang.String,
- * org.apache.opencmis.commons.provider.PropertiesData, java.lang.String,
- * org.apache.opencmis.commons.enums.VersioningState, java.util.List,
- * org.apache.opencmis.commons.provider.AccessControlList,
- * org.apache.opencmis.commons.provider.AccessControlList,
- * org.apache.opencmis.commons.api.ExtensionsData)
- */
- public String createDocumentFromSource(CallContext context, String repositoryId, String sourceId,
- Properties properties, String folderId, VersioningState versioningState,
- List<String> policies, Acl addAces, Acl removeAces,
- ExtensionsData extension) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId)
- .createDocumentFromSource(context, sourceId, properties, folderId, versioningState);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisObjectService#createFolder(org.apache.opencmis.server.spi
- * .CallContext, java.lang.String, org.apache.opencmis.commons.provider.PropertiesData,
- * java.lang.String, java.util.List, org.apache.opencmis.commons.provider.AccessControlList,
- * org.apache.opencmis.commons.provider.AccessControlList,
- * org.apache.opencmis.commons.api.ExtensionsData)
- */
- public String createFolder(CallContext context, String repositoryId, Properties properties,
- String folderId, List<String> policies, Acl addAces,
- Acl removeAces, ExtensionsData extension) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).createFolder(context,
- properties, folderId);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisObjectService#createPolicy(org.apache.opencmis.server.spi
- * .CallContext, java.lang.String, org.apache.opencmis.commons.provider.PropertiesData,
- * java.lang.String, java.util.List, org.apache.opencmis.commons.provider.AccessControlList,
- * org.apache.opencmis.commons.provider.AccessControlList,
- * org.apache.opencmis.commons.api.ExtensionsData)
- */
- public String createPolicy(CallContext context, String repositoryId, Properties properties,
- String folderId, List<String> policies, Acl addAces,
- Acl removeAces, ExtensionsData extension) {
- fRepositoryMap.getAuthenticatedRepository(context, repositoryId);
- throw new CmisNotSupportedException("createPolicy not supported!");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisObjectService#createRelationship(org.apache.opencmis.server
- * .spi.CallContext , java.lang.String, org.apache.opencmis.commons.provider.PropertiesData,
- * java.util.List, org.apache.opencmis.commons.provider.AccessControlList,
- * org.apache.opencmis.commons.provider.AccessControlList,
- * org.apache.opencmis.commons.api.ExtensionsData)
- */
- public String createRelationship(CallContext context, String repositoryId,
- Properties properties, List<String> policies, Acl addAces,
- Acl removeAces, ExtensionsData extension) {
- fRepositoryMap.getAuthenticatedRepository(context, repositoryId);
- throw new CmisNotSupportedException("createRelationship not supported!");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisObjectService#deleteContentStream(org.apache.opencmis.server
- * .spi.CallContext , java.lang.String, org.apache.opencmis.commons.provider.Holder,
- * org.apache.opencmis.commons.provider.Holder, org.apache.opencmis.commons.api.ExtensionsData)
- */
- public void deleteContentStream(CallContext context, String repositoryId,
- Holder<String> objectId, Holder<String> changeToken, ExtensionsData extension) {
- fRepositoryMap.getAuthenticatedRepository(context, repositoryId).setContentStream(context,
- objectId, true, null);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisObjectService#deleteObjectOrCancelCheckOut(org.apache.opencmis
- * .server. spi.CallContext, java.lang.String, java.lang.String, java.lang.Boolean,
- * org.apache.opencmis.commons.api.ExtensionsData)
- */
- public void deleteObjectOrCancelCheckOut(CallContext context, String repositoryId,
- String objectId, Boolean allVersions, ExtensionsData extension) {
- fRepositoryMap.getAuthenticatedRepository(context, repositoryId)
- .deleteObject(context, objectId);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisObjectService#deleteTree(org.apache.opencmis.server.spi.
- * CallContext, java.lang.String, java.lang.String, java.lang.Boolean,
- * org.apache.opencmis.commons.enums.UnfileObjects, java.lang.Boolean,
- * org.apache.opencmis.commons.api.ExtensionsData)
- */
- public FailedToDeleteData deleteTree(CallContext context, String repositoryId, String folderId,
- Boolean allVersions, UnfileObject unfileObjects, Boolean continueOnFailure,
- ExtensionsData extension) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).deleteTree(context,
- folderId, continueOnFailure);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisObjectService#getAllowableActions(org.apache.opencmis.server
- * .spi.CallContext , java.lang.String, java.lang.String,
- * org.apache.opencmis.commons.api.ExtensionsData)
- */
- public AllowableActions getAllowableActions(CallContext context, String repositoryId,
- String objectId, ExtensionsData extension) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getAllowableActions(
- context, objectId);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisObjectService#getContentStream(org.apache.opencmis.server
- * .spi.CallContext, java.lang.String, java.lang.String, java.lang.String, java.math.BigInteger,
- * java.math.BigInteger, org.apache.opencmis.commons.api.ExtensionsData)
- */
- public ContentStream getContentStream(CallContext context, String repositoryId,
- String objectId, String streamId, BigInteger offset, BigInteger length,
- ExtensionsData extension) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getContentStream(
- context, objectId, offset, length);
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.apache.opencmis.server.spi.CmisObjectService#getObject(org.apache.opencmis.server.spi.
- * CallContext, java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
- * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean,
- * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public ObjectData getObject(CallContext context, String repositoryId, String objectId,
- String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
- String renditionFilter, Boolean includePolicyIds, Boolean includeAcl,
- ExtensionsData extension, ObjectInfoHolder objectInfos) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getObject(context,
- objectId, filter, includeAllowableActions, includeAcl, objectInfos);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisObjectService#getObjectByPath(org.apache.opencmis.server
- * .spi.CallContext, java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
- * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean,
- * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public ObjectData getObjectByPath(CallContext context, String repositoryId, String path,
- String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
- String renditionFilter, Boolean includePolicyIds, Boolean includeAcl,
- ExtensionsData extension, ObjectInfoHolder objectInfos) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getObjectByPath(
- context, path, filter, includeAllowableActions, includeAcl, objectInfos);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisObjectService#getProperties(org.apache.opencmis.server.spi
- * .CallContext, java.lang.String, java.lang.String, java.lang.String,
- * org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public Properties getProperties(CallContext context, String repositoryId, String objectId,
- String filter, ExtensionsData extension) {
- ObjectData object = fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getObject(
- context, objectId, filter, false, false, null);
- return object.getProperties();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisObjectService#getRenditions(org.apache.opencmis.server.spi
- * .CallContext, java.lang.String, java.lang.String, java.lang.String, java.math.BigInteger,
- * java.math.BigInteger, org.apache.opencmis.commons.api.ExtensionsData)
- */
- public List<RenditionData> getRenditions(CallContext context, String repositoryId,
- String objectId, String renditionFilter, BigInteger maxItems, BigInteger skipCount,
- ExtensionsData extension) {
- fRepositoryMap.getAuthenticatedRepository(context, repositoryId);
- return Collections.emptyList();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisObjectService#moveObject(org.apache.opencmis.server.spi.
- * CallContext, java.lang.String, org.apache.opencmis.commons.provider.Holder, java.lang.String,
- * java.lang.String, org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public ObjectData moveObject(CallContext context, String repositoryId, Holder<String> objectId,
- String targetFolderId, String sourceFolderId, ExtensionsData extension,
- ObjectInfoHolder objectInfos) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).moveObject(context,
- objectId, targetFolderId, objectInfos);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisObjectService#setContentStream(org.apache.opencmis.server
- * .spi.CallContext, java.lang.String, org.apache.opencmis.commons.provider.Holder,
- * java.lang.Boolean, org.apache.opencmis.commons.provider.Holder,
- * org.apache.opencmis.commons.provider.ContentStreamData,
- * org.apache.opencmis.commons.api.ExtensionsData)
- */
- public void setContentStream(CallContext context, String repositoryId, Holder<String> objectId,
- Boolean overwriteFlag, Holder<String> changeToken, ContentStream contentStream,
- ExtensionsData extension) {
- fRepositoryMap.getAuthenticatedRepository(context, repositoryId).setContentStream(context,
- objectId, overwriteFlag, contentStream);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisObjectService#updateProperties(org.apache.opencmis.server
- * .spi.CallContext, java.lang.String, org.apache.opencmis.commons.provider.Holder,
- * org.apache.opencmis.commons.provider.Holder,
- * org.apache.opencmis.commons.provider.PropertiesData,
- * org.apache.opencmis.commons.provider.AccessControlList,
- * org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public ObjectData updateProperties(CallContext context, String repositoryId,
- Holder<String> objectId, Holder<String> changeToken, Properties properties,
- Acl acl, ExtensionsData extension, ObjectInfoHolder objectInfos) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).updateProperties(
- context, objectId, properties, objectInfos);
- }
+ /**
+ * Constructor.
+ */
+ public ObjectService(RepositoryMap repositoryMap) {
+ fRepositoryMap = repositoryMap;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisObjectService#create(org.apache.opencmis
+ * .server.spi.CallContext , java.lang.String,
+ * org.apache.opencmis.commons.provider.PropertiesData, java.lang.String,
+ * org.apache.opencmis.commons.provider.ContentStreamData,
+ * org.apache.opencmis.commons.enums.VersioningState, java.util.List,
+ * org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public ObjectData create(CallContext context, String repositoryId, Properties properties, String folderId,
+ ContentStream contentStream, VersioningState versioningState, List<String> policies,
+ ExtensionsData extension, ObjectInfoHolder objectInfos) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).create(context, properties, folderId,
+ contentStream, versioningState, objectInfos);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisObjectService#createDocument(org.apache
+ * .opencmis.server. spi.CallContext, java.lang.String,
+ * org.apache.opencmis.commons.provider.PropertiesData, java.lang.String,
+ * org.apache.opencmis.commons.provider.ContentStreamData,
+ * org.apache.opencmis.commons.enums.VersioningState, java.util.List,
+ * org.apache.opencmis.commons.provider.AccessControlList,
+ * org.apache.opencmis.commons.provider.AccessControlList,
+ * org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public String createDocument(CallContext context, String repositoryId, Properties properties, String folderId,
+ ContentStream contentStream, VersioningState versioningState, List<String> policies, Acl addAces,
+ Acl removeAces, ExtensionsData extension) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).createDocument(context, properties,
+ folderId, contentStream, versioningState);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisObjectService#createDocumentFromSource
+ * (org.apache.opencmis .server.spi. CallContext, java.lang.String,
+ * java.lang.String, org.apache.opencmis.commons.provider.PropertiesData,
+ * java.lang.String, org.apache.opencmis.commons.enums.VersioningState,
+ * java.util.List, org.apache.opencmis.commons.provider.AccessControlList,
+ * org.apache.opencmis.commons.provider.AccessControlList,
+ * org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public String createDocumentFromSource(CallContext context, String repositoryId, String sourceId,
+ Properties properties, String folderId, VersioningState versioningState, List<String> policies,
+ Acl addAces, Acl removeAces, ExtensionsData extension) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).createDocumentFromSource(context,
+ sourceId, properties, folderId, versioningState);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisObjectService#createFolder(org.apache
+ * .opencmis.server.spi .CallContext, java.lang.String,
+ * org.apache.opencmis.commons.provider.PropertiesData, java.lang.String,
+ * java.util.List, org.apache.opencmis.commons.provider.AccessControlList,
+ * org.apache.opencmis.commons.provider.AccessControlList,
+ * org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public String createFolder(CallContext context, String repositoryId, Properties properties, String folderId,
+ List<String> policies, Acl addAces, Acl removeAces, ExtensionsData extension) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).createFolder(context, properties,
+ folderId);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisObjectService#createPolicy(org.apache
+ * .opencmis.server.spi .CallContext, java.lang.String,
+ * org.apache.opencmis.commons.provider.PropertiesData, java.lang.String,
+ * java.util.List, org.apache.opencmis.commons.provider.AccessControlList,
+ * org.apache.opencmis.commons.provider.AccessControlList,
+ * org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public String createPolicy(CallContext context, String repositoryId, Properties properties, String folderId,
+ List<String> policies, Acl addAces, Acl removeAces, ExtensionsData extension) {
+ fRepositoryMap.getAuthenticatedRepository(context, repositoryId);
+ throw new CmisNotSupportedException("createPolicy not supported!");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisObjectService#createRelationship(org
+ * .apache.opencmis.server .spi.CallContext , java.lang.String,
+ * org.apache.opencmis.commons.provider.PropertiesData, java.util.List,
+ * org.apache.opencmis.commons.provider.AccessControlList,
+ * org.apache.opencmis.commons.provider.AccessControlList,
+ * org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public String createRelationship(CallContext context, String repositoryId, Properties properties,
+ List<String> policies, Acl addAces, Acl removeAces, ExtensionsData extension) {
+ fRepositoryMap.getAuthenticatedRepository(context, repositoryId);
+ throw new CmisNotSupportedException("createRelationship not supported!");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisObjectService#deleteContentStream(
+ * org.apache.opencmis.server .spi.CallContext , java.lang.String,
+ * org.apache.opencmis.commons.provider.Holder,
+ * org.apache.opencmis.commons.provider.Holder,
+ * org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public void deleteContentStream(CallContext context, String repositoryId, Holder<String> objectId,
+ Holder<String> changeToken, ExtensionsData extension) {
+ fRepositoryMap.getAuthenticatedRepository(context, repositoryId)
+ .setContentStream(context, objectId, true, null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisObjectService#deleteObjectOrCancelCheckOut
+ * (org.apache.opencmis .server. spi.CallContext, java.lang.String,
+ * java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public void deleteObjectOrCancelCheckOut(CallContext context, String repositoryId, String objectId,
+ Boolean allVersions, ExtensionsData extension) {
+ fRepositoryMap.getAuthenticatedRepository(context, repositoryId).deleteObject(context, objectId);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisObjectService#deleteTree(org.apache
+ * .opencmis.server.spi. CallContext, java.lang.String, java.lang.String,
+ * java.lang.Boolean, org.apache.opencmis.commons.enums.UnfileObjects,
+ * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public FailedToDeleteData deleteTree(CallContext context, String repositoryId, String folderId,
+ Boolean allVersions, UnfileObject unfileObjects, Boolean continueOnFailure, ExtensionsData extension) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).deleteTree(context, folderId,
+ continueOnFailure);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisObjectService#getAllowableActions(
+ * org.apache.opencmis.server .spi.CallContext , java.lang.String,
+ * java.lang.String, org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public AllowableActions getAllowableActions(CallContext context, String repositoryId, String objectId,
+ ExtensionsData extension) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getAllowableActions(context, objectId);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisObjectService#getContentStream(org
+ * .apache.opencmis.server .spi.CallContext, java.lang.String,
+ * java.lang.String, java.lang.String, java.math.BigInteger,
+ * java.math.BigInteger, org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public ContentStream getContentStream(CallContext context, String repositoryId, String objectId, String streamId,
+ BigInteger offset, BigInteger length, ExtensionsData extension) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getContentStream(context, objectId,
+ offset, length);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ *
+ * @seeorg.apache.opencmis.server.spi.CmisObjectService#getObject(org.apache.
+ * opencmis.server.spi. CallContext, java.lang.String, java.lang.String,
+ * java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
+ * java.lang.Boolean, java.lang.Boolean,
+ * org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public ObjectData getObject(CallContext context, String repositoryId, String objectId, String filter,
+ Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+ Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getObject(context, objectId, filter,
+ includeAllowableActions, includeAcl, objectInfos);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisObjectService#getObjectByPath(org.
+ * apache.opencmis.server .spi.CallContext, java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
+ * java.lang.Boolean, java.lang.Boolean,
+ * org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public ObjectData getObjectByPath(CallContext context, String repositoryId, String path, String filter,
+ Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+ Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getObjectByPath(context, path, filter,
+ includeAllowableActions, includeAcl, objectInfos);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisObjectService#getProperties(org.apache
+ * .opencmis.server.spi .CallContext, java.lang.String, java.lang.String,
+ * java.lang.String, org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public Properties getProperties(CallContext context, String repositoryId, String objectId, String filter,
+ ExtensionsData extension) {
+ ObjectData object = fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getObject(context,
+ objectId, filter, false, false, null);
+ return object.getProperties();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisObjectService#getRenditions(org.apache
+ * .opencmis.server.spi .CallContext, java.lang.String, java.lang.String,
+ * java.lang.String, java.math.BigInteger, java.math.BigInteger,
+ * org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public List<RenditionData> getRenditions(CallContext context, String repositoryId, String objectId,
+ String renditionFilter, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+ fRepositoryMap.getAuthenticatedRepository(context, repositoryId);
+ return Collections.emptyList();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisObjectService#moveObject(org.apache
+ * .opencmis.server.spi. CallContext, java.lang.String,
+ * org.apache.opencmis.commons.provider.Holder, java.lang.String,
+ * java.lang.String, org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public ObjectData moveObject(CallContext context, String repositoryId, Holder<String> objectId,
+ String targetFolderId, String sourceFolderId, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).moveObject(context, objectId,
+ targetFolderId, objectInfos);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisObjectService#setContentStream(org
+ * .apache.opencmis.server .spi.CallContext, java.lang.String,
+ * org.apache.opencmis.commons.provider.Holder, java.lang.Boolean,
+ * org.apache.opencmis.commons.provider.Holder,
+ * org.apache.opencmis.commons.provider.ContentStreamData,
+ * org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public void setContentStream(CallContext context, String repositoryId, Holder<String> objectId,
+ Boolean overwriteFlag, Holder<String> changeToken, ContentStream contentStream, ExtensionsData extension) {
+ fRepositoryMap.getAuthenticatedRepository(context, repositoryId).setContentStream(context, objectId,
+ overwriteFlag, contentStream);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisObjectService#updateProperties(org
+ * .apache.opencmis.server .spi.CallContext, java.lang.String,
+ * org.apache.opencmis.commons.provider.Holder,
+ * org.apache.opencmis.commons.provider.Holder,
+ * org.apache.opencmis.commons.provider.PropertiesData,
+ * org.apache.opencmis.commons.provider.AccessControlList,
+ * org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public ObjectData updateProperties(CallContext context, String repositoryId, Holder<String> objectId,
+ Holder<String> changeToken, Properties properties, Acl acl, ExtensionsData extension,
+ ObjectInfoHolder objectInfos) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).updateProperties(context, objectId,
+ properties, objectInfos);
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/RepositoryMap.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/RepositoryMap.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/RepositoryMap.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/RepositoryMap.java Fri Apr 16 14:14:00 2010
@@ -34,78 +34,78 @@ import org.apache.chemistry.opencmis.ser
*/
public class RepositoryMap {
- private Map<String, FileShareRepository> fMap;
- private Map<String, String> fLogins;
+ private Map<String, FileShareRepository> fMap;
+ private Map<String, String> fLogins;
- public RepositoryMap() {
- fMap = new HashMap<String, FileShareRepository>();
- fLogins = new HashMap<String, String>();
- }
-
- /**
- * Adds a repository object.
- */
- public void addRepository(FileShareRepository fsr) {
- if ((fsr == null) || (fsr.getRepositoryId() == null)) {
- return;
- }
-
- fMap.put(fsr.getRepositoryId(), fsr);
- }
-
- /**
- * Gets a repository object by id.
- */
- public FileShareRepository getRepository(String repositoryId) {
- // get repository object
- FileShareRepository result = fMap.get(repositoryId);
- if (result == null) {
- throw new CmisObjectNotFoundException("Unknown repository '" + repositoryId + "'!");
- }
-
- return result;
- }
-
- /**
- * Gets a repository object by id.
- */
- public FileShareRepository getAuthenticatedRepository(CallContext context, String repositoryId) {
- // check user and password first
- if (!authenticate(context.getUsername(), context.getPassword())) {
- throw new CmisPermissionDeniedException();
- }
-
- // get repository object
- return getRepository(repositoryId);
- }
-
- /**
- * Returns all repository objects.
- */
- public Collection<FileShareRepository> getRepositories() {
- return fMap.values();
- }
-
- /**
- * Adds a login.
- */
- public void addLogin(String username, String password) {
- if ((username == null) || (password == null)) {
- return;
- }
-
- fLogins.put(username.trim(), password);
- }
-
- /**
- * Authenticates a user against the configured logins.
- */
- private boolean authenticate(String username, String password) {
- String pwd = fLogins.get(username);
- if (pwd == null) {
- return false;
- }
+ public RepositoryMap() {
+ fMap = new HashMap<String, FileShareRepository>();
+ fLogins = new HashMap<String, String>();
+ }
+
+ /**
+ * Adds a repository object.
+ */
+ public void addRepository(FileShareRepository fsr) {
+ if ((fsr == null) || (fsr.getRepositoryId() == null)) {
+ return;
+ }
+
+ fMap.put(fsr.getRepositoryId(), fsr);
+ }
+
+ /**
+ * Gets a repository object by id.
+ */
+ public FileShareRepository getRepository(String repositoryId) {
+ // get repository object
+ FileShareRepository result = fMap.get(repositoryId);
+ if (result == null) {
+ throw new CmisObjectNotFoundException("Unknown repository '" + repositoryId + "'!");
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets a repository object by id.
+ */
+ public FileShareRepository getAuthenticatedRepository(CallContext context, String repositoryId) {
+ // check user and password first
+ if (!authenticate(context.getUsername(), context.getPassword())) {
+ throw new CmisPermissionDeniedException();
+ }
+
+ // get repository object
+ return getRepository(repositoryId);
+ }
+
+ /**
+ * Returns all repository objects.
+ */
+ public Collection<FileShareRepository> getRepositories() {
+ return fMap.values();
+ }
+
+ /**
+ * Adds a login.
+ */
+ public void addLogin(String username, String password) {
+ if ((username == null) || (password == null)) {
+ return;
+ }
+
+ fLogins.put(username.trim(), password);
+ }
+
+ /**
+ * Authenticates a user against the configured logins.
+ */
+ private boolean authenticate(String username, String password) {
+ String pwd = fLogins.get(username);
+ if (pwd == null) {
+ return false;
+ }
- return pwd.equals(password);
- }
+ return pwd.equals(password);
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/RepositoryService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/RepositoryService.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/RepositoryService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/RepositoryService.java Fri Apr 16 14:14:00 2010
@@ -38,85 +38,87 @@ import org.apache.chemistry.opencmis.ser
*/
public class RepositoryService implements CmisRepositoryService {
- private RepositoryMap fRepositoryMap;
+ private RepositoryMap fRepositoryMap;
- /**
- * Constructor.
- */
- public RepositoryService(RepositoryMap repositoryMap) {
- fRepositoryMap = repositoryMap;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisRepositoryService#getRepositoryInfo(org.apache.opencmis.
- * server.spi.CallContext , java.lang.String, org.apache.opencmis.commons.api.ExtensionsData)
- */
- public RepositoryInfo getRepositoryInfo(CallContext context, String repositoryId,
- ExtensionsData extension) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getRepositoryInfo(
- context);
- }
-
- /*
- * (non-Javadoc)
- *
- *
- * @seeorg.apache.opencmis.server.spi.CmisRepositoryService#getRepositoryInfos(org.apache.opencmis.
- * server.spi. CallContext, org.apache.opencmis.commons.api.ExtensionsData)
- */
- public List<RepositoryInfo> getRepositoryInfos(CallContext context, ExtensionsData extension) {
- List<RepositoryInfo> result = new ArrayList<RepositoryInfo>();
-
- for (FileShareRepository fsr : fRepositoryMap.getRepositories()) {
- result.add(fsr.getRepositoryInfo(context));
- }
-
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisRepositoryService#getTypeChildren(org.apache.opencmis.server
- * .spi.CallContext , java.lang.String, java.lang.String, java.lang.Boolean, java.math.BigInteger,
- * java.math.BigInteger, org.apache.opencmis.commons.api.ExtensionsData)
- */
- public TypeDefinitionList getTypeChildren(CallContext context, String repositoryId,
- String typeId, Boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount,
- ExtensionsData extension) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getTypesChildren(
- context, typeId, includePropertyDefinitions, maxItems, skipCount);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisRepositoryService#getTypeDefinition(org.apache.opencmis.
- * server.spi.CallContext , java.lang.String, java.lang.String,
- * org.apache.opencmis.commons.api.ExtensionsData)
- */
- public TypeDefinition getTypeDefinition(CallContext context, String repositoryId, String typeId,
- ExtensionsData extension) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getTypeDefinition(
- context, typeId);
- }
-
- /*
- * (non-Javadoc)
- *
- *
- * @seeorg.apache.opencmis.server.spi.CmisRepositoryService#getTypeDescendants(org.apache.opencmis.
- * server.spi. CallContext, java.lang.String, java.lang.String, java.math.BigInteger,
- * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData)
- */
- public List<TypeDefinitionContainer> getTypeDescendants(CallContext context, String repositoryId,
- String typeId, BigInteger depth, Boolean includePropertyDefinitions, ExtensionsData extension) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getTypesDescendants(
- context, typeId, depth, includePropertyDefinitions);
- }
+ /**
+ * Constructor.
+ */
+ public RepositoryService(RepositoryMap repositoryMap) {
+ fRepositoryMap = repositoryMap;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisRepositoryService#getRepositoryInfo
+ * (org.apache.opencmis. server.spi.CallContext , java.lang.String,
+ * org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public RepositoryInfo getRepositoryInfo(CallContext context, String repositoryId, ExtensionsData extension) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getRepositoryInfo(context);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ *
+ *
+ * @seeorg.apache.opencmis.server.spi.CmisRepositoryService#getRepositoryInfos
+ * (org.apache.opencmis. server.spi. CallContext,
+ * org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public List<RepositoryInfo> getRepositoryInfos(CallContext context, ExtensionsData extension) {
+ List<RepositoryInfo> result = new ArrayList<RepositoryInfo>();
+
+ for (FileShareRepository fsr : fRepositoryMap.getRepositories()) {
+ result.add(fsr.getRepositoryInfo(context));
+ }
+
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisRepositoryService#getTypeChildren(
+ * org.apache.opencmis.server .spi.CallContext , java.lang.String,
+ * java.lang.String, java.lang.Boolean, java.math.BigInteger,
+ * java.math.BigInteger, org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public TypeDefinitionList getTypeChildren(CallContext context, String repositoryId, String typeId,
+ Boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getTypesChildren(context, typeId,
+ includePropertyDefinitions, maxItems, skipCount);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisRepositoryService#getTypeDefinition
+ * (org.apache.opencmis. server.spi.CallContext , java.lang.String,
+ * java.lang.String, org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public TypeDefinition getTypeDefinition(CallContext context, String repositoryId, String typeId,
+ ExtensionsData extension) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getTypeDefinition(context, typeId);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ *
+ *
+ * @seeorg.apache.opencmis.server.spi.CmisRepositoryService#getTypeDescendants
+ * (org.apache.opencmis. server.spi. CallContext, java.lang.String,
+ * java.lang.String, java.math.BigInteger, java.lang.Boolean,
+ * org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public List<TypeDefinitionContainer> getTypeDescendants(CallContext context, String repositoryId, String typeId,
+ BigInteger depth, Boolean includePropertyDefinitions, ExtensionsData extension) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getTypesDescendants(context, typeId,
+ depth, includePropertyDefinitions);
+ }
}