use of org.eclipse.ceylon.cmr.spi.ContentHandle in project ceylon by eclipse.
the class URLContentStore method find.
public OpenNode find(Node parent, String child) {
final String path = compatiblePath(getFullPath(parent, child));
// enough
if (hasContent(child) && !urlExists(path)) {
return null;
}
final RemoteNode node = createNode(child);
ContentHandle handle;
if (hasContent(child))
handle = createContentHandle(parent, child, path, node);
else
handle = DefaultNode.HANDLE_MARKER;
node.setHandle(handle);
return node;
}
use of org.eclipse.ceylon.cmr.spi.ContentHandle in project ceylon by eclipse.
the class DefaultNode method hasBinaries.
@Override
public boolean hasBinaries() {
synchronized (this) {
if (handle != null)
return handle.hasBinaries();
}
final ContentStore cs = findService(ContentStore.class);
final ContentHandle ch = cs.peekContent(this);
synchronized (this) {
handle = (ch == null) ? HANDLE_MARKER : ch;
}
return (ch != null && ch.hasBinaries());
}
use of org.eclipse.ceylon.cmr.spi.ContentHandle in project ceylon by eclipse.
the class DefaultNode method getContent.
@Override
@SuppressWarnings("unchecked")
public <T> T getContent(Class<T> contentType) throws IOException {
if (File.class.equals(contentType)) {
synchronized (this) {
if (handle != null)
return (T) handle.getContentAsFile();
}
final ContentStore cs = findService(ContentStore.class);
ContentHandle ch = cs.getContent(this);
if (ch == null) {
ch = HANDLE_MARKER;
}
synchronized (this) {
handle = ch;
}
return (T) ch.getContentAsFile();
} else {
return super.getContent(contentType);
}
}
use of org.eclipse.ceylon.cmr.spi.ContentHandle in project ceylon by eclipse.
the class DefaultNode method getSize.
@Override
public long getSize() throws IOException {
synchronized (this) {
if (handle != null)
return handle.getSize();
}
final ContentStore cs = findService(ContentStore.class);
ContentHandle ch = cs.getContent(this);
if (ch == null) {
ch = HANDLE_MARKER;
}
synchronized (this) {
handle = ch;
}
return ch.getSize();
}
Aggregations