当前位置: 首页>>代码示例>>Java>>正文


Java Document类代码示例

本文整理汇总了Java中org.infinispan.schematic.document.Document的典型用法代码示例。如果您正苦于以下问题:Java Document类的具体用法?Java Document怎么用?Java Document使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Document类属于org.infinispan.schematic.document包,在下文中一共展示了Document类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: retrieveDocumentForId

import org.infinispan.schematic.document.Document; //导入依赖的package包/类
Document retrieveDocumentForId(final String id)
		throws FileNotFoundException, JargonException {
	log.info("retrieveDocumentForId()");
	if (id == null || id.isEmpty()) {
		throw new IllegalArgumentException("null or empty id");
	}

	log.info("id:{}", id);

	log.info("get irodsFileFactory...");
	IRODSFile docFile = connectorContext.getIrodsAccessObjectFactory()
			.getIRODSFileFactory(irodsAccount).instanceIRODSFile(id);

	if (!docFile.exists()) {
		throw new FileNotFoundException("file not found");
	}

	if (docFile.isDirectory()) {
		return retriveCollectionForId(docFile);
	} else {
		return retriveDataObjectForId(docFile);
	}

}
 
开发者ID:michael-conway,项目名称:jargon-modeshape,代码行数:25,代码来源:DocumentMapper.java

示例2: fireModifyEvent

import org.infinispan.schematic.document.Document; //导入依赖的package包/类
/**
 * Sends a change set with a modify node event for the given file.
 * 
 * @param file the file; may not be null
 */
public void fireModifyEvent(final File file) {
    final ConnectorChangeSet changes = newConnectorChangedSet();
    final String key = idFor(file);
    final Document doc = getDocumentById(key);
    final DocumentReader reader = readDocument(doc);
    // Not sure why we are using CREATED as the JCR value that has changed
    // LASTMODIFIED seems to make more sense?
    getLogger().debug(
        "Firing modify file event with\n\tkey {0}\n\tpathToNode {1}", key,
        key);
    final DateTime dt =
        this.factories().getDateFactory().create(
            System.currentTimeMillis() - 10000);

    final Property dtprop =
        new BasicPropertyFactory(factories()).create(JcrLexicon.CREATED,
            PropertyType.DATE, dt);

    changes.propertyChanged(key, key, reader.getProperty(JCR_CREATED),
        dtprop);
    changes.publish(null);
}
 
开发者ID:nigelgbanks,项目名称:fcrepo-filesystem-modeshape-federation-connector,代码行数:28,代码来源:FileSystemConnector.java

示例3: getDocumentById

import org.infinispan.schematic.document.Document; //导入依赖的package包/类
@Override
public Document getDocumentById(final String id) {
	log.info("getDocumentById()");
	if (id == null || id.isEmpty()) {
		throw new IllegalArgumentException("null id");
	}

	log.info("id:{}", id);
	
	Document document = documentMapper.

}
 
开发者ID:michael-conway,项目名称:jargon-modeshape,代码行数:13,代码来源:IRODSWriteableConnector.java

示例4: getProperties

import org.infinispan.schematic.document.Document; //导入依赖的package包/类
@Override
public Map<Name, Property> getProperties(final String id) {
    final File sidecarFile = sidecarFile(id);
    if (!sidecarFile.exists()) {
        return NO_PROPERTIES;
    }
    try {
        final Document document = read(new FileInputStream(sidecarFile));
        final Map<Name, Property> results = new HashMap<Name, Property>();
        translator.getProperties(document, results);
        return results;
    } catch (final IOException e) {
        throw new DocumentStoreException(id, e);
    }
}
 
开发者ID:nigelgbanks,项目名称:fcrepo-filesystem-modeshape-federation-connector,代码行数:16,代码来源:JsonSidecarExtraPropertyStore.java

示例5: updateProperties

import org.infinispan.schematic.document.Document; //导入依赖的package包/类
@Override
public void updateProperties(final String id,
    final Map<Name, Property> properties) {
    final File sidecarFile = sidecarFile(id);
    try {
        EditableDocument document = null;
        if (!sidecarFile.exists()) {
            if (properties.isEmpty()) {
                return;
            }
            sidecarFile.createNewFile();
            document = Schematic.newDocument();
        } else {
            final Document existing =
                read(new FileInputStream(sidecarFile));
            document = Schematic.newDocument(existing);
        }
        for (final Map.Entry<Name, Property> entry : properties.entrySet()) {
            final Property property = entry.getValue();
            if (property == null) {
                translator.removeProperty(document, entry.getKey(), null);
            } else {
                translator.setProperty(document, property, null);
            }
        }
        write(document, new FileOutputStream(sidecarFile));
    } catch (final IOException e) {
        throw new DocumentStoreException(id, e);
    }
}
 
开发者ID:nigelgbanks,项目名称:fcrepo-filesystem-modeshape-federation-connector,代码行数:31,代码来源:JsonSidecarExtraPropertyStore.java

示例6: getChildren

import org.infinispan.schematic.document.Document; //导入依赖的package包/类
/**
 * Return a document which represents a page of children. The document for
 * the parent node should include as many children as desired, and then
 * include a reference to the next page of children with the {{PageWriter#
 * addPage(String, String, long, long)}} method. Each page returned by this
 * method should also include a reference to the next page.
 * 
 * @param pageKey a non-null {@link PageKey} instance, which offers
 *        information about the page that should be retrieved.
 * @return either a non-null page document or {@code null} indicating that
 *         such a page doesn't exist
 */
@Override
public Document getChildren(final PageKey pageKey) {
    final String parentId = pageKey.getParentId();
    final File folder = fileFor(parentId);
    assert folder.isDirectory();
    if (!folder.canRead()) {
        getLogger().debug("Cannot read the {0} folder",
            folder.getAbsolutePath());
        return null;
    }
    return newFolderWriter(parentId, folder, pageKey.getOffsetInt())
        .document();
}
 
开发者ID:nigelgbanks,项目名称:fcrepo-filesystem-modeshape-federation-connector,代码行数:26,代码来源:FileSystemConnector.java

示例7: fireCreateEvent

import org.infinispan.schematic.document.Document; //导入依赖的package包/类
/**
 * Sends a change set with a new node event for the given file.
 * 
 * @param file the file; may not be null
 */
public void fireCreateEvent(final File file) {

    final ConnectorChangeSet changes = newConnectorChangedSet();
    final String key = idFor(file);
    final Document doc = getDocumentById(key);
    final DocumentReader reader = readDocument(doc);
    getLogger().debug(
        "Firing create file event with\n\tkey {0}\n\tpathToNode {1}", key,
        key);
    changes.nodeCreated(key, "/", key, reader.getProperties());
    changes.publish(null);
}
 
开发者ID:nigelgbanks,项目名称:fcrepo-filesystem-modeshape-federation-connector,代码行数:18,代码来源:FileSystemConnector.java

示例8: retriveDataObjectForId

import org.infinispan.schematic.document.Document; //导入依赖的package包/类
private Document retriveDataObjectForId(IRODSFile docFile) {
	// TODO Auto-generated method stub
	return null;
}
 
开发者ID:michael-conway,项目名称:jargon-modeshape,代码行数:5,代码来源:DocumentMapper.java

示例9: retriveCollectionForId

import org.infinispan.schematic.document.Document; //导入依赖的package包/类
private Document retriveCollectionForId(IRODSFile docFile) {
	// TODO Auto-generated method stub
	return null;
}
 
开发者ID:michael-conway,项目名称:jargon-modeshape,代码行数:5,代码来源:DocumentMapper.java

示例10: getChildren

import org.infinispan.schematic.document.Document; //导入依赖的package包/类
@Override
public Document getChildren(final PageKey arg0) {
	// TODO Auto-generated method stub
	return null;
}
 
开发者ID:michael-conway,项目名称:jargon-modeshape,代码行数:6,代码来源:IRODSWriteableConnector.java

示例11: storeDocument

import org.infinispan.schematic.document.Document; //导入依赖的package包/类
@Override
public void storeDocument(final Document arg0) {
	// TODO Auto-generated method stub

}
 
开发者ID:michael-conway,项目名称:jargon-modeshape,代码行数:6,代码来源:IRODSWriteableConnector.java

示例12: read

import org.infinispan.schematic.document.Document; //导入依赖的package包/类
protected Document read(final InputStream stream) throws IOException {
    return Json.read(stream);
}
 
开发者ID:nigelgbanks,项目名称:fcrepo-filesystem-modeshape-federation-connector,代码行数:4,代码来源:JsonSidecarExtraPropertyStore.java

示例13: write

import org.infinispan.schematic.document.Document; //导入依赖的package包/类
protected void write(final Document document, final OutputStream stream)
    throws IOException {
    Json.write(document, stream);
}
 
开发者ID:nigelgbanks,项目名称:fcrepo-filesystem-modeshape-federation-connector,代码行数:5,代码来源:JsonSidecarExtraPropertyStore.java

示例14: getDocumentById

import org.infinispan.schematic.document.Document; //导入依赖的package包/类
/**
 * Returns a {@link Document} instance representing the document with a
 * given id. The document should have a "proper" structure for it to be
 * usable by ModeShape.
 * 
 * @param id a {@code non-null} string
 * @return either an {@link Document} instance or {@code null}
 */
@Override
public Document getDocumentById(final String id) {
    final File file = fileFor(id);
    if (isExcluded(file) || !file.exists()) {
        return null;
    }
    final boolean isRoot = isRoot(id);
    final boolean isResource = isContentNode(id);
    DocumentWriter writer = null;
    File parentFile = file.getParentFile();
    if (isResource) {
        writer = newDocument(id);
        final BinaryValue binaryValue = binaryFor(file);
        writer.setPrimaryType(NT_RESOURCE);
        writer.addProperty(JCR_DATA, binaryValue);
        if (addMimeTypeMixin) {
            String mimeType = null;
            final String encoding = null; // We don't really know this
            try {
                mimeType = binaryValue.getMimeType();
            } catch (final Throwable e) {
                getLogger().error(e, JcrI18n.couldNotGetMimeType,
                    getSourceName(), id, e.getMessage());
            }
            writer.addProperty(JCR_ENCODING, encoding);
            writer.addProperty(JCR_MIME_TYPE, mimeType);
        }
        writer.addProperty(JCR_LAST_MODIFIED, factories().getDateFactory()
            .create(file.lastModified()));
        writer.addProperty(JCR_LAST_MODIFIED_BY, null); // ignored

        // make these binary not queryable. If we really want to query them,
        // we need to switch to external binaries
        writer.setNotQueryable();
        parentFile = file;
    } else if (file.isFile()) {
        writer = newDocument(id);
        writer.setPrimaryType(NT_FILE);
        writer.addProperty(JCR_CREATED, factories().getDateFactory()
            .create(file.lastModified()));
        writer.addProperty(JCR_CREATED_BY, null); // ignored
        final String childId =
            isRoot ? JCR_CONTENT_SUFFIX : id + JCR_CONTENT_SUFFIX;
        writer.addChild(childId, JCR_CONTENT);
    } else {
        writer = newFolderWriter(id, file, 0);
    }

    if (!isRoot) {
        // Set the reference to the parent ...
        final String parentId = idFor(parentFile);
        writer.setParents(parentId);
    }

    // Add the extra properties (if there are any), overwriting any
    // properties with the same names
    // (e.g., jcr:primaryType, jcr:mixinTypes, jcr:mimeType, etc.) ...
    writer.addProperties(extraPropertiesStore().getProperties(id));

    // Add the 'mix:mixinType' mixin; if other mixins are stored in the
    // extra properties, this will append ...
    if (addMimeTypeMixin) {
        writer.addMixinType(MIX_MIME_TYPE);
    }

    // Return the document ...
    return writer.document();
}
 
开发者ID:nigelgbanks,项目名称:fcrepo-filesystem-modeshape-federation-connector,代码行数:77,代码来源:FileSystemConnector.java


注:本文中的org.infinispan.schematic.document.Document类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。