use of org.structr.files.ssh.filesystem.StructrPath in project structr by structr.
the class StructrSchemaMethodsPath method getDirectoryStream.
@Override
public DirectoryStream<Path> getDirectoryStream(final DirectoryStream.Filter<? super Path> filter) {
if (schemaNode != null) {
return new DirectoryStream() {
boolean closed = false;
@Override
public Iterator iterator() {
final App app = StructrApp.getInstance(fs.getSecurityContext());
final List<StructrPath> nodes = new LinkedList<>();
try (final Tx tx = app.tx()) {
for (final SchemaMethod schemaMethod : schemaNode.getProperty(SchemaNode.schemaMethods)) {
// schema methods have a virtual file name so that external editors don't get confused
String name = schemaMethod.getProperty(SchemaMethod.virtualFileName);
if (name == null) {
// no virtual file name set, use real name
name = schemaMethod.getName();
}
nodes.add(new StructrSchemaMethodPath(fs, StructrSchemaMethodsPath.this, schemaNode, name));
}
tx.success();
} catch (FrameworkException fex) {
logger.warn("", fex);
}
return nodes.iterator();
}
@Override
public void close() throws IOException {
closed = true;
}
};
}
return null;
}
use of org.structr.files.ssh.filesystem.StructrPath in project structr by structr.
the class StructrSchemaNodePath method getDirectoryStream.
@Override
public DirectoryStream<Path> getDirectoryStream(DirectoryStream.Filter<? super Path> filter) {
final AbstractSchemaNode schemaNode = getSchemaNode();
if (schemaNode != null) {
return new DirectoryStream() {
boolean closed = false;
@Override
public Iterator iterator() {
if (!closed) {
final List<StructrPath> children = new LinkedList<>();
// children.add(new StructrSchemaPropertiesPath(fs, StructrSchemaNodePath.this, schemaNode));
// children.add(new StructrSchemaViewsPath(fs, StructrSchemaNodePath.this, schemaNode));
children.add(new StructrSchemaMethodsPath(fs, StructrSchemaNodePath.this, schemaNode));
children.add(resolveStructrPath("extendsClass"));
return children.iterator();
}
return Collections.emptyIterator();
}
@Override
public void close() throws IOException {
closed = true;
}
};
}
return null;
}
use of org.structr.files.ssh.filesystem.StructrPath in project structr by structr.
the class StructrFilePath method getDirectoryStream.
@Override
public DirectoryStream<Path> getDirectoryStream(DirectoryStream.Filter<? super Path> filter) {
final Folder folder = (Folder) getActualFile();
if (folder != null) {
return new DirectoryStream() {
boolean closed = false;
@Override
public Iterator iterator() {
if (!closed) {
final App app = StructrApp.getInstance(fs.getSecurityContext());
final List<StructrPath> files = new LinkedList<>();
try (final Tx tx = app.tx()) {
for (final Folder folder : folder.getFolders()) {
files.add(new StructrFilePath(fs, StructrFilePath.this, folder.getName()));
}
for (final File file : folder.getFiles()) {
files.add(new StructrFilePath(fs, StructrFilePath.this, file.getName()));
}
tx.success();
} catch (FrameworkException fex) {
logger.warn("", fex);
}
return files.iterator();
}
return Collections.emptyIterator();
}
@Override
public void close() throws IOException {
closed = true;
}
};
}
return null;
}
use of org.structr.files.ssh.filesystem.StructrPath in project structr by structr.
the class StructrSchemaPropertiesPath method getDirectoryStream.
@Override
public DirectoryStream<Path> getDirectoryStream(DirectoryStream.Filter<? super Path> filter) {
if (schemaNode != null) {
return new DirectoryStream() {
boolean closed = false;
@Override
public Iterator iterator() {
final App app = StructrApp.getInstance(fs.getSecurityContext());
final List<StructrPath> nodes = new LinkedList<>();
try (final Tx tx = app.tx()) {
for (final SchemaProperty schemaProperty : schemaNode.getProperty(SchemaNode.schemaProperties)) {
nodes.add(new StructrSchemaPropertyPath(fs, StructrSchemaPropertiesPath.this, schemaNode, schemaProperty));
}
tx.success();
} catch (FrameworkException fex) {
logger.warn("", fex);
}
return nodes.iterator();
}
@Override
public void close() throws IOException {
closed = true;
}
};
}
return null;
}
use of org.structr.files.ssh.filesystem.StructrPath in project structr by structr.
the class StructrSchemaPropertiesPath method resolveStructrPath.
@Override
public StructrPath resolveStructrPath(final String pathComponent) {
final App app = StructrApp.getInstance(fs.getSecurityContext());
StructrPath path = null;
try (final Tx tx = app.tx()) {
for (final SchemaProperty schemaProperty : schemaNode.getProperty(SchemaNode.schemaProperties)) {
if (pathComponent.equals(schemaProperty.getName())) {
path = new StructrSchemaPropertyPath(fs, StructrSchemaPropertiesPath.this, schemaNode, schemaProperty);
}
}
tx.success();
} catch (FrameworkException fex) {
logger.warn("", fex);
}
return path;
}
Aggregations