本文整理汇总了Java中org.modeshape.jcr.value.Property类的典型用法代码示例。如果您正苦于以下问题:Java Property类的具体用法?Java Property怎么用?Java Property使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Property类属于org.modeshape.jcr.value包,在下文中一共展示了Property类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateProperties
import org.modeshape.jcr.value.Property; //导入依赖的package包/类
@Override
public void updateProperties(final String id,
final Map<Name, Property> properties) {
final File sidecar = sidecarFile(id);
final Map<Name, Property> existing = load(id, sidecar);
if (existing == null || existing.isEmpty()) {
write(id, sidecar, properties);
} else {
// Merge the changed properties into the existing ...
for (final Map.Entry<Name, Property> entry : properties.entrySet()) {
final Name name = entry.getKey();
final Property property = entry.getValue();
if (property == null) {
existing.remove(name);
} else {
existing.put(name, property);
}
}
// Now write out all of the updated properties ...
write(id, sidecar, existing);
}
}
开发者ID:nigelgbanks,项目名称:fcrepo-filesystem-modeshape-federation-connector,代码行数:23,代码来源:LegacySidecarExtraPropertyStore.java
示例2: load
import org.modeshape.jcr.value.Property; //导入依赖的package包/类
protected Map<Name, Property> load(final String id,
final File propertiesFile) {
if (!propertiesFile.exists() || !propertiesFile.canRead()) {
return NO_PROPERTIES;
}
try {
final String content = IoUtil.read(propertiesFile);
final Map<Name, Property> result = new HashMap<Name, Property>();
for (final String line : StringUtil.splitLines(content)) {
// Parse each line ...
final Property property = parse(line, result);
if (property != null) {
result.put(property.getName(), property);
}
}
return result;
} catch (final Throwable e) {
throw new DocumentStoreException(id, e);
}
}
开发者ID:nigelgbanks,项目名称:fcrepo-filesystem-modeshape-federation-connector,代码行数:21,代码来源:LegacySidecarExtraPropertyStore.java
示例3: storeProperties
import org.modeshape.jcr.value.Property; //导入依赖的package包/类
@Override
public void storeProperties(final String id,
final Map<Name, Property> properties) {
final File sidecarFile = sidecarFile(id);
try {
if (!sidecarFile.exists()) {
if (properties.isEmpty()) {
return;
}
sidecarFile.createNewFile();
}
final EditableDocument document = Schematic.newDocument();
for (final Property property : properties.values()) {
if (property == null) {
continue;
}
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,代码行数:24,代码来源:JsonSidecarExtraPropertyStore.java
示例4: fireModifyEvent
import org.modeshape.jcr.value.Property; //导入依赖的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
示例5: getProperties
import org.modeshape.jcr.value.Property; //导入依赖的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
示例6: updateProperties
import org.modeshape.jcr.value.Property; //导入依赖的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
示例7: getProperties
import org.modeshape.jcr.value.Property; //导入依赖的package包/类
@Override
public Map<Name, Property> getProperties(final String arg0) {
// TODO Auto-generated method stub
return null;
}
示例8: storeProperties
import org.modeshape.jcr.value.Property; //导入依赖的package包/类
@Override
public void storeProperties(final String arg0,
final Map<Name, Property> arg1) {
// TODO Auto-generated method stub
}
示例9: updateProperties
import org.modeshape.jcr.value.Property; //导入依赖的package包/类
@Override
public void updateProperties(final String arg0,
final Map<Name, Property> arg1) {
// TODO Auto-generated method stub
}
示例10: getProperties
import org.modeshape.jcr.value.Property; //导入依赖的package包/类
@Override
public Map<Name, Property> getProperties(final String id) {
return load(id, sidecarFile(id));
}
开发者ID:nigelgbanks,项目名称:fcrepo-filesystem-modeshape-federation-connector,代码行数:5,代码来源:LegacySidecarExtraPropertyStore.java
示例11: storeProperties
import org.modeshape.jcr.value.Property; //导入依赖的package包/类
@Override
public void storeProperties(final String id,
final Map<Name, Property> properties) {
write(id, sidecarFile(id), properties);
}
开发者ID:nigelgbanks,项目名称:fcrepo-filesystem-modeshape-federation-connector,代码行数:6,代码来源:LegacySidecarExtraPropertyStore.java
示例12: write
import org.modeshape.jcr.value.Property; //导入依赖的package包/类
protected void write(final String id, final File propertiesFile,
final Map<Name, Property> properties) {
if (properties.isEmpty()) {
if (propertiesFile.exists()) {
// Delete the file ...
propertiesFile.delete();
}
return;
}
try {
Writer fileWriter = null;
try {
// Write the primary type first ...
final Property primaryType =
properties.get(JcrLexicon.PRIMARY_TYPE);
if (primaryType != null) {
fileWriter = new FileWriter(propertiesFile);
write(primaryType, fileWriter);
}
// Then write the mixin types ...
final Property mixinTypes =
properties.get(JcrLexicon.MIXIN_TYPES);
if (mixinTypes != null) {
if (fileWriter == null) {
fileWriter = new FileWriter(propertiesFile);
}
write(mixinTypes, fileWriter);
}
// Then write the UUID ...
final Property uuid = properties.get(JcrLexicon.UUID);
if (uuid != null) {
if (fileWriter == null) {
fileWriter = new FileWriter(propertiesFile);
}
write(uuid, fileWriter);
}
// Then all the others ...
for (final Property property : properties.values()) {
if (property == null) {
continue;
}
if (property == primaryType || property == mixinTypes ||
property == uuid) {
continue;
}
if (fileWriter == null) {
fileWriter = new FileWriter(propertiesFile);
}
write(property, fileWriter);
}
} finally {
if (fileWriter != null) {
fileWriter.close();
} else {
// Nothing was written, so remove the sidecar file ...
propertiesFile.delete();
}
}
} catch (final Throwable e) {
throw new DocumentStoreException(id, e);
}
}
开发者ID:nigelgbanks,项目名称:fcrepo-filesystem-modeshape-federation-connector,代码行数:63,代码来源:LegacySidecarExtraPropertyStore.java