use of org.eclipse.wst.server.core.util.ModuleFolder in project webtools.servertools by eclipse.
the class ModulePublishInfo method loadResource.
/**
* Used only for reading from WTP 1.x workspaces.
*/
protected IModuleResource[] loadResource(IMemento memento, IPath path) {
if (memento == null)
return EMPTY_MODULE_RESOURCE;
List<IModuleResource> list = new ArrayList<IModuleResource>(10);
// load files
IMemento[] children = memento.getChildren(FILE);
if (children != null) {
int size = children.length;
for (int i = 0; i < size; i++) {
String name2 = children[i].getString(NAME);
long stamp = Long.parseLong(children[i].getString(STAMP));
ModuleFile file = new ModuleFile(name2, path, stamp);
list.add(file);
}
}
// load folders
children = memento.getChildren(FOLDER);
if (children != null) {
int size = children.length;
for (int i = 0; i < size; i++) {
String name2 = children[i].getString(NAME);
ModuleFolder folder = new ModuleFolder(null, name2, path);
folder.setMembers(loadResource(children[i], path.append(name2)));
list.add(folder);
}
}
IModuleResource[] resources2 = new IModuleResource[list.size()];
list.toArray(resources2);
return resources2;
}
use of org.eclipse.wst.server.core.util.ModuleFolder in project webtools.servertools by eclipse.
the class ModulePublishInfo method loadResource.
private IModuleResource[] loadResource(DataInput in, IPath path) throws IOException {
int size = in.readInt();
if (size > 1000000)
throw new IOException("Folder capacity limit reached");
IModuleResource[] resources2 = new IModuleResource[size];
for (int i = 0; i < size; i++) {
byte b = in.readByte();
if (b == 0) {
String name2 = in.readUTF();
long stamp = in.readLong();
resources2[i] = new ModuleFile(name2, path, stamp);
} else if (b == 1) {
String name2 = in.readUTF();
ModuleFolder folder = new ModuleFolder(null, name2, path);
folder.setMembers(loadResource(in, path.append(name2)));
resources2[i] = folder;
}
}
return resources2;
}
Aggregations