瀏覽代碼

Merge remote-tracking branch 'origin/candidate-3.10.x'

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 年之前
父節點
當前提交
f9bf1718d8

+ 6 - 0
common/deftype/deftype.cpp

@@ -3848,6 +3848,12 @@ void XmlSchemaBuilder::addSetField(const char * name, const char * itemname, ITy
     StringBuffer elementType;
     getXmlTypeName(elementType, *type.queryChildType());
 
+    if ((!itemname || !*itemname) && name) // xpaths 'Name', '/Name', and 'Name/' seem to be equivalent
+    {
+        itemname = name;
+        name = NULL;
+    }
+
     if (name && *name)
     {
         xml.append("<xs:element name=\"").append(name).append("\"");

+ 31 - 28
common/fileview2/fvresultset.cpp

@@ -571,40 +571,35 @@ ITypeInfo * containsSingleSimpleFieldBlankXPath(IResultSetMetaData * meta)
     return NULL;
 }
 
-    
+void fvSplitXPath(const char *xpath, StringBuffer &s, const char *&name, const char **childname=NULL)
+{
+    if (!xpath || !*xpath)
+        return;
+    const char * slash = strchr(xpath, '/');
+    if (!slash)
+    {
+        name = xpath;
+        if (childname)
+            *childname = NULL;
+    }
+    else
+    {
+        if (!childname || strchr(slash+1, '/')) //output ignores xpaths that are too deep
+            return;
+        name = s.clear().append(slash-xpath, xpath).str();
+        *childname = slash+1;
+    }
+}
+
 void CResultSetMetaData::getXmlSchema(ISchemaBuilder & builder, bool useXPath) const
 {
-    StringBuffer prefix, suffix;
+    StringBuffer xname;
     ForEachItemIn(idx, columns)
     {
         CResultSetColumnInfo & column = columns.item(idx);
         unsigned flag = column.flag;
         const char * name = meta->queryName(idx);
         const char * childname = NULL;
-        const char * xname = NULL;
-        if (useXPath)
-        {
-            xname = meta->queryXPath(idx);
-            if (xname)
-            {
-                const char * slash = strchr(xname, '/');
-                if (slash)
-                {
-                    const char * slash2 = strchr(slash+1, '/');
-                    prefix.clear().append(slash-xname, xname);
-                    name = prefix.str();
-                    if (slash2)
-                    {
-                        suffix.clear().append(slash2-(slash+1), slash+1);
-                        childname = suffix.str();
-                    }
-                    else
-                        childname = slash+1;
-                }
-                else
-                    name = xname;
-            }
-        }
 
         switch (flag)
         {
@@ -622,7 +617,9 @@ void CResultSetMetaData::getXmlSchema(ISchemaBuilder & builder, bool useXPath) c
             break;
         case FVFFdataset:
             {
-                if (!childname && (!xname || !*xname)) childname = "Row";
+                childname = "Row";
+                if (useXPath)
+                    fvSplitXPath(meta->queryXPath(idx), xname, name, &childname);
                 ITypeInfo * singleFieldType = (useXPath && name && *name && childname && *childname) ? containsSingleSimpleFieldBlankXPath(column.childMeta.get()) : NULL;
                 if (!singleFieldType || !builder.addSingleFieldDataset(name, childname, *singleFieldType))
                 {
@@ -639,11 +636,17 @@ void CResultSetMetaData::getXmlSchema(ISchemaBuilder & builder, bool useXPath) c
                 ITypeInfo & type = *column.type;
                 if (type.getTypeCode() == type_set)
                 {
-                    if (!childname) childname = "Item";
+                    childname = "Item";
+                    if (useXPath)
+                        fvSplitXPath(meta->queryXPath(idx), xname, name, &childname);
                     builder.addSetField(name, childname, type);
                 }
                 else
+                {
+                    if (useXPath)
+                        fvSplitXPath(meta->queryXPath(idx), xname, name);
                     builder.addField(name, type);
+                }
                 break;
             }
         }

+ 1 - 1
esp/services/ws_fileio/ws_fileioservice.cpp

@@ -26,7 +26,7 @@
 #endif
 
 ///#define FILE_DESPRAY_URL "FileDesprayAccess"
-#define FILE_IO_URL     "FileIO"
+#define FILE_IO_URL     "FileIOAccess"
 
 void CWsFileIOEx::init(IPropertyTree *cfg, const char *process, const char *service)
 {

+ 1 - 2
esp/services/ws_smc/espsmc_permissions.txt

@@ -57,9 +57,8 @@ ws_fs:
         Write - Access to DKC key files
 
 ws_fileio:
-    FileIO: Not defined in esp.xml but used by service.
+    FileIOAccess:
         Write - Access to files in dropzone... CreateFile, ReadFileData, WriteFileData
-    FileIOAccess: Defined in esp.xml but not used by service.
 
 ws_topology:
     ClusterTopologyAccess: