Lines 16-21
Link Here
|
16 |
* Xuan Chen (IBM) - Fix 160768 - [refresh][dstore] Refresh on renamed node within a zip does not work; |
16 |
* Xuan Chen (IBM) - Fix 160768 - [refresh][dstore] Refresh on renamed node within a zip does not work; |
17 |
* Xuan Chen (IBM) - Fix 189487 - copy and paste a folder did not work - workbench hang |
17 |
* Xuan Chen (IBM) - Fix 189487 - copy and paste a folder did not work - workbench hang |
18 |
* Xuan Chen (IBM) - [189681] [dstore][linux] Refresh Folder in My Home messes up Refresh in Root |
18 |
* Xuan Chen (IBM) - [189681] [dstore][linux] Refresh Folder in My Home messes up Refresh in Root |
|
|
19 |
* Xuan Chen (IBM) - [191280] [dstore] Expand fails for folder "/folk" with 3361 children |
19 |
*******************************************************************************/ |
20 |
*******************************************************************************/ |
20 |
|
21 |
|
21 |
package org.eclipse.rse.dstore.universal.miners; |
22 |
package org.eclipse.rse.dstore.universal.miners; |
Lines 26-32
Link Here
|
26 |
import java.net.ServerSocket; |
27 |
import java.net.ServerSocket; |
27 |
import java.util.ArrayList; |
28 |
import java.util.ArrayList; |
28 |
import java.util.HashMap; |
29 |
import java.util.HashMap; |
29 |
import java.util.IdentityHashMap; |
30 |
import java.util.Iterator; |
30 |
import java.util.List; |
31 |
import java.util.List; |
31 |
|
32 |
|
32 |
import org.eclipse.dstore.core.miners.Miner; |
33 |
import org.eclipse.dstore.core.miners.Miner; |
Lines 1752-1762
Link Here
|
1752 |
File[] list, String queryType, String filter, int include, String types[]) |
1753 |
File[] list, String queryType, String filter, int include, String types[]) |
1753 |
{ |
1754 |
{ |
1754 |
|
1755 |
|
1755 |
IdentityHashMap foundMap = new IdentityHashMap(list.length); |
1756 |
HashMap filteredChildren = new HashMap(); |
1756 |
List children = subject.getNestedData(); |
1757 |
List children = subject.getNestedData(); |
1757 |
if (children != null) |
1758 |
if (children != null) |
1758 |
{ |
1759 |
{ |
1759 |
ArrayList filteredChildren = new ArrayList(); |
1760 |
long enterForTime = System.currentTimeMillis(); |
|
|
1761 |
//Use a HashMap instead of array list to improve performance |
1760 |
for (int f = 0; f < children.size(); f++) |
1762 |
for (int f = 0; f < children.size(); f++) |
1761 |
{ |
1763 |
{ |
1762 |
DataElement child = (DataElement)children.get(f); |
1764 |
DataElement child = (DataElement)children.get(f); |
Lines 1767-1802
Link Here
|
1767 |
{ |
1769 |
{ |
1768 |
if (StringCompare.compare(filter, child.getName(), false)) |
1770 |
if (StringCompare.compare(filter, child.getName(), false)) |
1769 |
{ |
1771 |
{ |
1770 |
filteredChildren.add(child); |
1772 |
//filteredChildren.add(child); |
|
|
1773 |
filteredChildren.put(child.getName(), child); |
1771 |
} |
1774 |
} |
1772 |
} |
1775 |
} |
1773 |
else |
1776 |
else |
1774 |
{ |
1777 |
{ |
1775 |
filteredChildren.add(child); |
1778 |
//filteredChildren.add(child); |
|
|
1779 |
filteredChildren.put(child.getName(), child); |
1776 |
} |
1780 |
} |
1777 |
} |
1781 |
} |
1778 |
} |
1782 |
} |
|
|
1783 |
} |
1779 |
|
1784 |
|
1780 |
|
1785 |
|
1781 |
if (filteredChildren.size() != 0) |
1786 |
|
1782 |
{ |
1787 |
boolean found = false; |
1783 |
boolean found; |
|
|
1784 |
Object[] currentObjList = filteredChildren.toArray(); |
1785 |
|
1788 |
|
1786 |
// Check if the current Objects in the DataStore are valid... exist |
1789 |
// Check if the current Objects in the DataStore are valid... exist |
1787 |
// on the remote host |
1790 |
// on the remote host |
1788 |
try { |
1791 |
try { |
1789 |
for (int i = 0; i < currentObjList.length; ++i) |
1792 |
for (int j = 0; j < list.length; ++j) |
1790 |
{ |
|
|
1791 |
found = false; |
1792 |
DataElement previousElement = (DataElement) currentObjList[i]; |
1793 |
for (int j = 0; j < list.length && !found; ++j) |
1794 |
{ |
1793 |
{ |
1795 |
|
1794 |
|
1796 |
if (previousElement.getName().equals(list[j].getName()) && !previousElement.isDeleted()) |
1795 |
found = false; |
|
|
1796 |
File file = list[j]; |
1797 |
String fileName = file.getName(); |
1798 |
boolean isHidden = file.isHidden() || fileName.charAt(0) == '.'; |
1799 |
|
1800 |
DataElement previousElement = (DataElement)filteredChildren.get(fileName); |
1801 |
if (previousElement != null && !previousElement.isDeleted()) |
1797 |
{ |
1802 |
{ |
1798 |
// Type have to be equal as well |
1803 |
// Type have to be equal as well |
1799 |
String type = ((DataElement) currentObjList[i]).getType(); |
1804 |
//String type = ((DataElement) currentObjList[i]).getType(); |
|
|
1805 |
String type = previousElement.getType(); |
1800 |
boolean isfile = list[j].isFile(); |
1806 |
boolean isfile = list[j].isFile(); |
1801 |
if (((type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR) || type.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR)) && isfile) |
1807 |
if (((type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR) || type.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR)) && isfile) |
1802 |
|| |
1808 |
|| |
Lines 1808-1998
Link Here
|
1808 |
String thisType = types[j]; |
1814 |
String thisType = types[j]; |
1809 |
if (attributes.indexOf(thisType) != -1) |
1815 |
if (attributes.indexOf(thisType) != -1) |
1810 |
{ |
1816 |
{ |
1811 |
foundMap.put(list[j], currentObjList[i]); // already exists so don't recreate the element |
1817 |
filteredChildren.remove(list[j].getName()); //remove it from the filterChildren list |
1812 |
found = true; |
1818 |
found = true; |
1813 |
} |
1819 |
} |
1814 |
} |
1820 |
} |
1815 |
else |
1821 |
else |
1816 |
{ |
1822 |
{ |
1817 |
foundMap.put(list[j], currentObjList[i]); // already exists so don't recreate the element |
1823 |
filteredChildren.remove(list[j].getName()); |
1818 |
found = true; |
1824 |
found = true; |
1819 |
} |
1825 |
} |
1820 |
} |
1826 |
} |
1821 |
} |
1827 |
} |
1822 |
} // end for j |
1828 |
|
1823 |
|
1829 |
DataElement deObj = null; |
1824 |
// Object in DataStore no longer exists in the host. Remove |
1830 |
if (!isHidden || showHidden) |
1825 |
// it from DataStore. |
|
|
1826 |
if (found == false) |
1827 |
{ |
1828 |
//DataElement deObj = ds.find(subject, DE.A_NAME,((DataElement) currentObjList[i]).getName(), 1); |
1829 |
ds.deleteObject(subject, previousElement); |
1830 |
} |
1831 |
} // end for i |
1832 |
} catch (Exception e) { |
1833 |
e.printStackTrace(); |
1834 |
UniversalServerUtilities.logError(CLASSNAME, |
1835 |
"createDataElement failed with exception - isFile ", e); //$NON-NLS-1$ |
1836 |
} |
1837 |
} // end currentObj not 0 |
1838 |
} |
1839 |
|
1840 |
// Now query the other way. If the object queried, exists on the host, |
1841 |
// then check if |
1842 |
// it is already in datastore. If so do not recreate it. |
1843 |
|
1844 |
|
1845 |
|
1846 |
// DKM - test - dummy object |
1847 |
//ds.createObject(subject,IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR,"I'm not really here!"); |
1848 |
|
1849 |
for (int i = 0; i < list.length; i++) |
1850 |
{ |
1851 |
DataElement deObj = null; |
1852 |
File file = list[i]; |
1853 |
|
1854 |
try |
1855 |
{ |
1856 |
String fileName = file.getName(); |
1857 |
boolean isHidden = file.isHidden() || fileName.charAt(0) == '.'; |
1858 |
|
1859 |
if (!isHidden || showHidden) |
1860 |
{ |
1861 |
// check for duplicates |
1862 |
Object obj = foundMap.get(file); |
1863 |
if (obj != null && obj instanceof DataElement) |
1864 |
{ |
1865 |
deObj = (DataElement)obj; |
1866 |
} |
1867 |
//deObj = getFileElement(subject, list[i]); |
1868 |
|
1869 |
if (deObj == null) |
1870 |
{ |
1871 |
if (include == IClientServerConstants.INCLUDE_ALL) |
1872 |
{ |
1831 |
{ |
1873 |
if (file.isDirectory()) |
1832 |
if (found) |
1874 |
{ |
1833 |
{ |
1875 |
deObj = ds.createObject(subject,deUniversalFolderObject,fileName); |
1834 |
//this object already exists in the DStore |
|
|
1835 |
deObj = previousElement; |
1876 |
} |
1836 |
} |
1877 |
else |
1837 |
else |
1878 |
// file |
|
|
1879 |
{ |
1838 |
{ |
1880 |
if (ArchiveHandlerManager.getInstance().isArchive(file)) |
1839 |
//We need to create a new data element for this object. |
|
|
1840 |
if (include == IClientServerConstants.INCLUDE_ALL) |
1881 |
{ |
1841 |
{ |
1882 |
deObj = ds |
1842 |
if (file.isDirectory()) |
1883 |
.createObject( |
1843 |
{ |
1884 |
subject, |
1844 |
deObj = ds.createObject(subject,deUniversalFolderObject,fileName); |
1885 |
deUniversalArchiveFileObject, |
1845 |
} |
|
|
1846 |
else |
1847 |
// file |
1848 |
{ |
1849 |
if (ArchiveHandlerManager.getInstance().isArchive(file)) |
1850 |
{ |
1851 |
deObj = ds |
1852 |
.createObject( |
1853 |
subject, |
1854 |
deUniversalArchiveFileObject, |
1855 |
fileName); |
1856 |
} |
1857 |
else |
1858 |
{ |
1859 |
deObj = ds.createObject(subject, |
1860 |
deUniversalFileObject, |
1886 |
fileName); |
1861 |
fileName); |
|
|
1862 |
} |
1863 |
} |
1887 |
} |
1864 |
} |
1888 |
else |
1865 |
else if (include == IClientServerConstants.INCLUDE_FOLDERS_ONLY) |
1889 |
{ |
1866 |
{ |
1890 |
deObj = ds.createObject(subject, |
1867 |
if (ArchiveHandlerManager.getInstance().isArchive(file)) |
1891 |
deUniversalFileObject, |
1868 |
{ |
1892 |
fileName); |
1869 |
deObj = ds.createObject(subject, |
1893 |
} |
1870 |
deUniversalArchiveFileObject, |
1894 |
} |
|
|
1895 |
} |
1896 |
else if (include == IClientServerConstants.INCLUDE_FOLDERS_ONLY) |
1897 |
{ |
1898 |
if (ArchiveHandlerManager.getInstance().isArchive(file)) |
1899 |
{ |
1900 |
deObj = ds.createObject(subject, |
1901 |
deUniversalArchiveFileObject, |
1902 |
fileName); |
1903 |
} |
1904 |
else |
1905 |
{ |
1906 |
deObj = ds.createObject(subject, |
1907 |
deUniversalFolderObject, |
1908 |
fileName); |
1909 |
} |
1910 |
} |
1911 |
else if (include == IClientServerConstants.INCLUDE_FILES_ONLY) |
1912 |
{ |
1913 |
if (ArchiveHandlerManager.getInstance().isArchive(file)) |
1914 |
{ |
1915 |
deObj = ds.createObject(subject, |
1916 |
deUniversalArchiveFileObject, |
1917 |
fileName); |
1918 |
} |
1919 |
else |
1920 |
{ |
1921 |
deObj = ds |
1922 |
.createObject(subject, |
1923 |
deUniversalFileObject, |
1924 |
fileName); |
1871 |
fileName); |
1925 |
} |
1872 |
} |
1926 |
} |
1873 |
else |
1927 |
|
1874 |
{ |
1928 |
if (deObj != null) |
1875 |
deObj = ds.createObject(subject, |
1929 |
{ |
1876 |
deUniversalFolderObject, |
1930 |
if (queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR)) |
1877 |
fileName); |
1931 |
{ |
1878 |
} |
1932 |
deObj.setAttribute(DE.A_VALUE, subject.getAttribute(DE.A_VALUE)); |
1879 |
} |
1933 |
} |
1880 |
else if (include == IClientServerConstants.INCLUDE_FILES_ONLY) |
1934 |
else |
|
|
1935 |
{ |
1936 |
|
1937 |
if (subject.getName().length() > 0) |
1938 |
{ |
1881 |
{ |
1939 |
String valueStr = subject.getAttribute(DE.A_VALUE); |
1882 |
if (ArchiveHandlerManager.getInstance().isArchive(file)) |
1940 |
//String valueStr = list[i].getParentFile().getAbsolutePath(); |
|
|
1941 |
StringBuffer valueBuffer = new StringBuffer(valueStr); |
1942 |
if ((_isWindows && valueStr.endsWith("\\"))|| valueStr.endsWith("/") || subject.getName().startsWith("/")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
1943 |
{ |
1883 |
{ |
1944 |
valueBuffer.append(subject.getName()); |
1884 |
deObj = ds.createObject(subject, |
1945 |
deObj.setAttribute(DE.A_VALUE,valueBuffer.toString()); |
1885 |
deUniversalArchiveFileObject, |
|
|
1886 |
fileName); |
1946 |
} |
1887 |
} |
1947 |
else |
1888 |
else |
1948 |
{ |
1889 |
{ |
1949 |
valueBuffer.append(File.separatorChar); |
1890 |
deObj = ds |
1950 |
valueBuffer.append(subject.getName()); |
1891 |
.createObject(subject, |
1951 |
deObj.setAttribute(DE.A_VALUE,valueBuffer.toString()); |
1892 |
deUniversalFileObject, |
|
|
1893 |
fileName); |
1952 |
} |
1894 |
} |
1953 |
} |
1895 |
} |
1954 |
else |
1896 |
if (deObj != null) |
|
|
1897 |
{ |
1898 |
if (queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR)) |
1899 |
{ |
1900 |
deObj.setAttribute(DE.A_VALUE, subject.getAttribute(DE.A_VALUE)); |
1901 |
} |
1902 |
else |
1903 |
{ |
1904 |
|
1905 |
if (subject.getName().length() > 0) |
1906 |
{ |
1907 |
String valueStr = subject.getAttribute(DE.A_VALUE); |
1908 |
//String valueStr = list[i].getParentFile().getAbsolutePath(); |
1909 |
StringBuffer valueBuffer = new StringBuffer(valueStr); |
1910 |
if ((_isWindows && valueStr.endsWith("\\"))|| valueStr.endsWith("/") || subject.getName().startsWith("/")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
1911 |
{ |
1912 |
valueBuffer.append(subject.getName()); |
1913 |
deObj.setAttribute(DE.A_VALUE,valueBuffer.toString()); |
1914 |
} |
1915 |
else |
1916 |
{ |
1917 |
valueBuffer.append(File.separatorChar); |
1918 |
valueBuffer.append(subject.getName()); |
1919 |
deObj.setAttribute(DE.A_VALUE,valueBuffer.toString()); |
1920 |
} |
1921 |
} |
1922 |
else |
1923 |
{ |
1924 |
String valueStr = list[j].getParentFile().getAbsolutePath(); |
1925 |
deObj.setAttribute(DE.A_VALUE, valueStr); |
1926 |
} |
1927 |
} |
1928 |
} |
1929 |
} |
1930 |
|
1931 |
String properties = setProperties(file); |
1932 |
if (deObj != null) |
1933 |
{ |
1934 |
if (types != null) |
1935 |
{ |
1936 |
String oldSource = deObj.getAttribute(DE.A_SOURCE); |
1937 |
String newSource = properties + "|" + types[j]; |
1938 |
if (!oldSource.startsWith(newSource)) |
1939 |
|
1940 |
{ |
1941 |
deObj.setAttribute(DE.A_SOURCE, newSource); //$NON-NLS-1$ |
1942 |
} |
1943 |
} |
1944 |
else |
1955 |
{ |
1945 |
{ |
1956 |
String valueStr = list[i].getParentFile().getAbsolutePath(); |
1946 |
String oldSource = deObj.getAttribute(DE.A_SOURCE); |
1957 |
deObj.setAttribute(DE.A_VALUE, valueStr); |
1947 |
String newSource = properties; |
|
|
1948 |
if (!oldSource.startsWith(newSource)) |
1949 |
deObj.setAttribute(DE.A_SOURCE, properties); |
1958 |
} |
1950 |
} |
1959 |
} |
1951 |
} |
1960 |
} |
1952 |
} |
1961 |
} |
1953 |
} // end for j |
1962 |
// DKM - do basic property stuff here |
1954 |
|
1963 |
String properties = setProperties(file); |
1955 |
//Object left over in the filteredChildren is no longer in the system any more. Need to remove. |
1964 |
if (deObj != null) |
1956 |
Iterator myIterator = filteredChildren.keySet().iterator(); |
|
|
1957 |
while(myIterator.hasNext()) |
1965 |
{ |
1958 |
{ |
1966 |
if (types != null) |
1959 |
ds.deleteObject(subject, (DataElement)(filteredChildren.get(myIterator.next()))); |
1967 |
{ |
|
|
1968 |
/* |
1969 |
String oldClassification = getClassificationString(deObj.getAttribute(DE.A_SOURCE)); |
1970 |
if (oldClassification != null && !oldClassification.equals(types[i])) |
1971 |
{ |
1972 |
deObj.setAttribute(DE.A_SOURCE, properties + "|" + oldClassification + " " + types[i]); |
1973 |
} |
1974 |
else |
1975 |
*/ |
1976 |
{ |
1977 |
deObj.setAttribute(DE.A_SOURCE, properties + "|" + types[i]); //$NON-NLS-1$ |
1978 |
} |
1979 |
} |
1980 |
else |
1981 |
{ |
1982 |
deObj.setAttribute(DE.A_SOURCE, properties); |
1983 |
} |
1984 |
} |
1960 |
} |
1985 |
} |
1961 |
|
1986 |
} catch (Exception e) |
1962 |
} catch (Exception e) { |
1987 |
{ |
1963 |
e.printStackTrace(); |
1988 |
UniversalServerUtilities |
1964 |
UniversalServerUtilities.logError(CLASSNAME, |
1989 |
.logError( |
1965 |
"createDataElement failed with exception - isFile ", e); //$NON-NLS-1$ |
1990 |
CLASSNAME, |
|
|
1991 |
"createDataElement failed with exception - isHidden ", //$NON-NLS-1$ |
1992 |
e); |
1993 |
} |
1966 |
} |
1994 |
} // end for |
|
|
1995 |
//*/ |
1996 |
|
1967 |
|
1997 |
} |
1968 |
} |
1998 |
|
1969 |
|
Lines 2006-2017
Link Here
|
2006 |
String virtualPath) |
1977 |
String virtualPath) |
2007 |
{ |
1978 |
{ |
2008 |
|
1979 |
|
2009 |
IdentityHashMap foundMap = null; |
1980 |
HashMap filteredChildren = new HashMap(); |
2010 |
List children = subject.getNestedData(); |
1981 |
List children = subject.getNestedData(); |
2011 |
if (children != null) |
1982 |
if (children != null) |
2012 |
{ |
1983 |
{ |
2013 |
ArrayList filteredChildren = new ArrayList(); |
|
|
2014 |
|
2015 |
for (int f = 0; f < children.size(); f++) |
1984 |
for (int f = 0; f < children.size(); f++) |
2016 |
{ |
1985 |
{ |
2017 |
DataElement child = (DataElement)children.get(f); |
1986 |
DataElement child = (DataElement)children.get(f); |
Lines 2021-2053
Link Here
|
2021 |
{ |
1990 |
{ |
2022 |
if (StringCompare.compare(filter, child.getName(), false)) |
1991 |
if (StringCompare.compare(filter, child.getName(), false)) |
2023 |
{ |
1992 |
{ |
2024 |
filteredChildren.add(child); |
1993 |
filteredChildren.put(child.getName(), child); |
2025 |
} |
1994 |
} |
2026 |
} |
1995 |
} |
2027 |
else |
1996 |
else |
2028 |
{ |
1997 |
{ |
2029 |
filteredChildren.add(child); |
1998 |
filteredChildren.put(child.getName(), child); |
2030 |
} |
1999 |
} |
2031 |
} |
2000 |
} |
|
|
2001 |
} |
2032 |
|
2002 |
|
2033 |
foundMap = new IdentityHashMap(list.length); |
2003 |
|
2034 |
|
|
|
2035 |
if (filteredChildren.size() != 0) |
2036 |
{ |
2037 |
boolean found; |
2038 |
Object[] currentObjList = filteredChildren.toArray(); |
2039 |
|
2004 |
|
2040 |
// Check if the current Objects in the DataStore are valid... exist |
2005 |
// Check if the current Objects in the DataStore are valid... exist |
2041 |
// on the remote host |
2006 |
// on the remote host |
2042 |
try { |
2007 |
try { |
2043 |
for (int i = 0; i < currentObjList.length; ++i) { |
2008 |
boolean found = false; |
2044 |
found = false; |
2009 |
for (int j = 0; j < list.length; ++j) |
2045 |
DataElement previousElement = (DataElement) currentObjList[i]; |
|
|
2046 |
for (int j = 0; j < list.length && !found; ++j) |
2047 |
{ |
2010 |
{ |
2048 |
|
2011 |
found = false; |
2049 |
if (!previousElement.isDeleted() |
2012 |
DataElement previousElement = (DataElement)filteredChildren.get(list[j].name); |
2050 |
&& previousElement.getName().equals(list[j].name)) |
2013 |
if (previousElement != null &&!previousElement.isDeleted()) |
2051 |
{ |
2014 |
{ |
2052 |
// Type have to be equal as well |
2015 |
// Type have to be equal as well |
2053 |
String type = previousElement.getType(); |
2016 |
String type = previousElement.getType(); |
Lines 2056-2122
Link Here
|
2056 |
|| (type.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR) && !isfile) |
2019 |
|| (type.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR) && !isfile) |
2057 |
) |
2020 |
) |
2058 |
{ |
2021 |
{ |
2059 |
foundMap.put(list[j], previousElement); |
2022 |
filteredChildren.remove(list[j].name); |
2060 |
found = true; |
2023 |
found = true; |
2061 |
} |
2024 |
} |
2062 |
} |
2025 |
} |
|
|
2026 |
DataElement deObj = null; |
2027 |
VirtualChild child = list[j]; |
2028 |
|
2029 |
if (found) |
2030 |
{ |
2031 |
deObj = previousElement; |
2032 |
} |
2033 |
if (deObj == null) |
2034 |
{ |
2035 |
if (child.isDirectory) |
2036 |
{ |
2037 |
deObj = _dataStore.createObject(subject, IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR,child.name); |
2038 |
} |
2039 |
else // file |
2040 |
{ |
2041 |
deObj = _dataStore.createObject(subject,IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR, child.name); |
2042 |
} |
2043 |
|
2044 |
} |
2045 |
String oldValue = deObj.getAttribute(DE.A_VALUE); |
2046 |
String newValue = rootPath + ArchiveHandlerManager.VIRTUAL_SEPARATOR + virtualPath; |
2047 |
if (!oldValue.startsWith(newValue)) |
2048 |
{ |
2049 |
deObj.setAttribute(DE.A_VALUE, newValue); //$NON-NLS-1$ |
2050 |
} |
2051 |
String oldSource = deObj.getAttribute(DE.A_SOURCE); |
2052 |
String newSource = setProperties(child); |
2053 |
if (!oldSource.startsWith(newSource)) |
2054 |
{ |
2055 |
deObj.setAttribute(DE.A_SOURCE, newSource); //$NON-NLS-1$ |
2056 |
} |
2057 |
|
2063 |
} // end for j |
2058 |
} // end for j |
2064 |
|
2059 |
|
2065 |
// Object in DataStore no longer exists in the host. Remove |
2060 |
//Object left over in the filteredChildren is no longer in the system any more. Need to remove. |
2066 |
// it from DataStore. |
2061 |
Iterator myIterator = filteredChildren.keySet().iterator(); |
2067 |
if (found == false) |
2062 |
while(myIterator.hasNext()) |
2068 |
{ |
2063 |
{ |
2069 |
ds.deleteObject(subject, previousElement); |
2064 |
ds.deleteObject(subject, (DataElement)(filteredChildren.get(myIterator.next()))); |
2070 |
} |
2065 |
} |
2071 |
} // end for i |
|
|
2072 |
} catch (Exception e) { |
2066 |
} catch (Exception e) { |
2073 |
e.printStackTrace(); |
2067 |
e.printStackTrace(); |
2074 |
UniversalServerUtilities.logError(CLASSNAME, |
2068 |
UniversalServerUtilities.logError(CLASSNAME, |
2075 |
"createDataElement failed with exception - isFile ", e); //$NON-NLS-1$ |
2069 |
"createDataElement failed with exception - isFile ", e); //$NON-NLS-1$ |
2076 |
} |
2070 |
} |
2077 |
} // end currentObj not 0 |
2071 |
} // end currentObj not 0 |
2078 |
} |
|
|
2079 |
|
2080 |
|
2072 |
|
2081 |
// Now query the other way. If the object queried, exists on the host, |
|
|
2082 |
// then check if |
2083 |
// it is already in datastore. If so do not recreate it. |
2084 |
|
2085 |
if (list != null) |
2086 |
{ |
2087 |
for (int i = 0; i < list.length; i++) |
2088 |
{ |
2089 |
DataElement deObj = null; |
2090 |
VirtualChild child = list[i]; |
2091 |
Object obj = null; |
2092 |
if (foundMap != null) |
2093 |
{ |
2094 |
obj = foundMap.get(child); |
2095 |
} |
2096 |
if (obj != null && obj instanceof DataElement) |
2097 |
{ |
2098 |
deObj = (DataElement)obj; |
2099 |
} |
2100 |
|
2101 |
if (deObj == null) |
2102 |
{ |
2103 |
if (child.isDirectory) |
2104 |
{ |
2105 |
deObj = _dataStore.createObject(subject, IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR,child.name); |
2106 |
} |
2107 |
else // file |
2108 |
{ |
2109 |
deObj = _dataStore.createObject(subject,IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR, child.name); |
2110 |
} |
2111 |
|
2112 |
} |
2113 |
deObj.setAttribute(DE.A_VALUE, rootPath + ArchiveHandlerManager.VIRTUAL_SEPARATOR + virtualPath); |
2114 |
deObj.setAttribute(DE.A_SOURCE, setProperties(child)); |
2115 |
} |
2116 |
} |
2117 |
|
2118 |
//*/ |
2119 |
} |
2120 |
|
2073 |
|
2121 |
public String setProperties(File fileObj) { |
2074 |
public String setProperties(File fileObj) { |
2122 |
return setProperties(fileObj, false); |
2075 |
return setProperties(fileObj, false); |