Search in sources :

Example 1 with StructrToplevelAttributes

use of org.structr.files.ssh.filesystem.StructrToplevelAttributes in project structr by structr.

the class StructrSchemaNodePath method getAttributes.

@Override
public <T extends BasicFileAttributes> T getAttributes(Class<T> type, LinkOption... options) throws IOException {
    final AbstractSchemaNode schemaNode = getSchemaNode();
    if (schemaNode != null) {
        final App app = StructrApp.getInstance(fs.getSecurityContext());
        String name = null;
        try (final Tx tx = app.tx()) {
            name = schemaNode.getName();
            tx.success();
        } catch (FrameworkException fex) {
            logger.warn("", fex);
        }
        return (T) new StructrToplevelAttributes(name);
    }
    throw new NoSuchFileException(toString());
}
Also used : StructrApp(org.structr.core.app.StructrApp) App(org.structr.core.app.App) Tx(org.structr.core.graph.Tx) FrameworkException(org.structr.common.error.FrameworkException) AbstractSchemaNode(org.structr.core.entity.AbstractSchemaNode) StructrToplevelAttributes(org.structr.files.ssh.filesystem.StructrToplevelAttributes) NoSuchFileException(java.nio.file.NoSuchFileException)

Aggregations

NoSuchFileException (java.nio.file.NoSuchFileException)1 FrameworkException (org.structr.common.error.FrameworkException)1 App (org.structr.core.app.App)1 StructrApp (org.structr.core.app.StructrApp)1 AbstractSchemaNode (org.structr.core.entity.AbstractSchemaNode)1 Tx (org.structr.core.graph.Tx)1 StructrToplevelAttributes (org.structr.files.ssh.filesystem.StructrToplevelAttributes)1