id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
136,200 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java | MultiIndex.rsyncRecoveryIndexFromCoordinator | private boolean rsyncRecoveryIndexFromCoordinator() throws IOException
{
File indexDirectory = new File(handler.getContext().getIndexDirectory());
RSyncConfiguration rSyncConfiguration = handler.getRsyncConfiguration();
try
{
IndexRecovery indexRecovery = handler.getContext().getIndexRecovery();
// check if index not ready
if (!indexRecovery.checkIndexReady())
{
return false;
}
try
{
if(rSyncConfiguration.isRsyncOffline())
{
//Switch index offline
indexRecovery.setIndexOffline();
}
String indexPath = handler.getContext().getIndexDirectory();
String urlFormatString =rSyncConfiguration.generateRsyncSource(indexPath);
RSyncJob rSyncJob = new RSyncJob(String.format(urlFormatString, indexRecovery.getCoordinatorAddress()), indexPath,
rSyncConfiguration.getRsyncUserName(), rSyncConfiguration.getRsyncPassword(), OfflinePersistentIndex.NAME);
rSyncJob.execute();
}
finally
{
if(rSyncConfiguration.isRsyncOffline())
{
//Switch index online
indexRecovery.setIndexOnline();
}
}
//recovery finish correctly
return true;
}
catch (RepositoryException e)
{
LOG.error("Cannot retrieve the indexes from the coordinator, the indexes will then be created from indexing",
e);
} catch (RepositoryConfigurationException e)
{
LOG.error("Cannot retrieve the indexes from the coordinator, the indexes will then be created from indexing",
e);
}
LOG.info("Clean up index directory " + indexDirectory.getAbsolutePath());
DirectoryHelper.removeDirectory(indexDirectory);
return false;
} | java | private boolean rsyncRecoveryIndexFromCoordinator() throws IOException
{
File indexDirectory = new File(handler.getContext().getIndexDirectory());
RSyncConfiguration rSyncConfiguration = handler.getRsyncConfiguration();
try
{
IndexRecovery indexRecovery = handler.getContext().getIndexRecovery();
// check if index not ready
if (!indexRecovery.checkIndexReady())
{
return false;
}
try
{
if(rSyncConfiguration.isRsyncOffline())
{
//Switch index offline
indexRecovery.setIndexOffline();
}
String indexPath = handler.getContext().getIndexDirectory();
String urlFormatString =rSyncConfiguration.generateRsyncSource(indexPath);
RSyncJob rSyncJob = new RSyncJob(String.format(urlFormatString, indexRecovery.getCoordinatorAddress()), indexPath,
rSyncConfiguration.getRsyncUserName(), rSyncConfiguration.getRsyncPassword(), OfflinePersistentIndex.NAME);
rSyncJob.execute();
}
finally
{
if(rSyncConfiguration.isRsyncOffline())
{
//Switch index online
indexRecovery.setIndexOnline();
}
}
//recovery finish correctly
return true;
}
catch (RepositoryException e)
{
LOG.error("Cannot retrieve the indexes from the coordinator, the indexes will then be created from indexing",
e);
} catch (RepositoryConfigurationException e)
{
LOG.error("Cannot retrieve the indexes from the coordinator, the indexes will then be created from indexing",
e);
}
LOG.info("Clean up index directory " + indexDirectory.getAbsolutePath());
DirectoryHelper.removeDirectory(indexDirectory);
return false;
} | [
"private",
"boolean",
"rsyncRecoveryIndexFromCoordinator",
"(",
")",
"throws",
"IOException",
"{",
"File",
"indexDirectory",
"=",
"new",
"File",
"(",
"handler",
".",
"getContext",
"(",
")",
".",
"getIndexDirectory",
"(",
")",
")",
";",
"RSyncConfiguration",
"rSync... | Retrieves index from other node using rsync server.
@throws IOException if can't clean up directory after retrieving being failed | [
"Retrieves",
"index",
"from",
"other",
"node",
"using",
"rsync",
"server",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java#L3936-L3989 |
136,201 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java | MultiIndex.hasDeletions | public boolean hasDeletions() throws CorruptIndexException, IOException
{
boolean result = false;
for (PersistentIndex index : indexes)
{
IndexWriter writer = index.getIndexWriter();
result |= writer.hasDeletions();
}
return result;
} | java | public boolean hasDeletions() throws CorruptIndexException, IOException
{
boolean result = false;
for (PersistentIndex index : indexes)
{
IndexWriter writer = index.getIndexWriter();
result |= writer.hasDeletions();
}
return result;
} | [
"public",
"boolean",
"hasDeletions",
"(",
")",
"throws",
"CorruptIndexException",
",",
"IOException",
"{",
"boolean",
"result",
"=",
"false",
";",
"for",
"(",
"PersistentIndex",
"index",
":",
"indexes",
")",
"{",
"IndexWriter",
"writer",
"=",
"index",
".",
"ge... | Checks if index has deletions. | [
"Checks",
"if",
"index",
"has",
"deletions",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java#L4006-L4017 |
136,202 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DefaultHighlighter.java | DefaultHighlighter.createDefaultExcerpt | protected String createDefaultExcerpt(String text,
String excerptStart,
String excerptEnd,
String fragmentStart,
String fragmentEnd,
int maxLength) throws IOException {
StringReader reader = new StringReader(text);
StringBuilder excerpt = new StringBuilder(excerptStart);
excerpt.append(fragmentStart);
if (!text.isEmpty()) {
int min = excerpt.length();
char[] buf = new char[maxLength];
int len = reader.read(buf);
StringBuilder tmp = new StringBuilder();
tmp.append(buf, 0, len);
if (len == buf.length) {
for (int i = tmp.length() - 1; i > min; i--) {
if (Character.isWhitespace(tmp.charAt(i))) {
tmp.delete(i, tmp.length());
tmp.append(" ...");
break;
}
}
}
excerpt.append(Text.encodeIllegalXMLCharacters(tmp.toString()));
}
excerpt.append(fragmentEnd).append(excerptEnd);
return excerpt.toString();
} | java | protected String createDefaultExcerpt(String text,
String excerptStart,
String excerptEnd,
String fragmentStart,
String fragmentEnd,
int maxLength) throws IOException {
StringReader reader = new StringReader(text);
StringBuilder excerpt = new StringBuilder(excerptStart);
excerpt.append(fragmentStart);
if (!text.isEmpty()) {
int min = excerpt.length();
char[] buf = new char[maxLength];
int len = reader.read(buf);
StringBuilder tmp = new StringBuilder();
tmp.append(buf, 0, len);
if (len == buf.length) {
for (int i = tmp.length() - 1; i > min; i--) {
if (Character.isWhitespace(tmp.charAt(i))) {
tmp.delete(i, tmp.length());
tmp.append(" ...");
break;
}
}
}
excerpt.append(Text.encodeIllegalXMLCharacters(tmp.toString()));
}
excerpt.append(fragmentEnd).append(excerptEnd);
return excerpt.toString();
} | [
"protected",
"String",
"createDefaultExcerpt",
"(",
"String",
"text",
",",
"String",
"excerptStart",
",",
"String",
"excerptEnd",
",",
"String",
"fragmentStart",
",",
"String",
"fragmentEnd",
",",
"int",
"maxLength",
")",
"throws",
"IOException",
"{",
"StringReader"... | Creates a default excerpt with the given text.
@param text the text.
@param excerptStart the excerpt start.
@param excerptEnd the excerpt end.
@param fragmentStart the fragement start.
@param fragmentEnd the fragment end.
@param maxLength the maximum length of the fragment.
@return a default excerpt.
@throws IOException if an error occurs while reading from the text. | [
"Creates",
"a",
"default",
"excerpt",
"with",
"the",
"given",
"text",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DefaultHighlighter.java#L371-L399 |
136,203 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java | LinkedWorkspaceStorageCacheImpl.putItem | protected void putItem(final ItemData data)
{
cache.put(new CacheId(data.getIdentifier()), new CacheValue(data, System.currentTimeMillis() + liveTime));
cache.put(new CacheQPath(data.getParentIdentifier(), data.getQPath(), ItemType.getItemType(data)),
new CacheValue(data, System.currentTimeMillis() + liveTime));
} | java | protected void putItem(final ItemData data)
{
cache.put(new CacheId(data.getIdentifier()), new CacheValue(data, System.currentTimeMillis() + liveTime));
cache.put(new CacheQPath(data.getParentIdentifier(), data.getQPath(), ItemType.getItemType(data)),
new CacheValue(data, System.currentTimeMillis() + liveTime));
} | [
"protected",
"void",
"putItem",
"(",
"final",
"ItemData",
"data",
")",
"{",
"cache",
".",
"put",
"(",
"new",
"CacheId",
"(",
"data",
".",
"getIdentifier",
"(",
")",
")",
",",
"new",
"CacheValue",
"(",
"data",
",",
"System",
".",
"currentTimeMillis",
"(",... | Put item in cache C.
@param data | [
"Put",
"item",
"in",
"cache",
"C",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java#L937-L942 |
136,204 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java | LinkedWorkspaceStorageCacheImpl.getItem | protected ItemData getItem(final String identifier)
{
long start = System.currentTimeMillis();
try
{
final CacheId k = new CacheId(identifier);
final CacheValue v = cache.get(k);
if (v != null)
{
final ItemData c = v.getItem();
if (v.getExpiredTime() > System.currentTimeMillis())
{
// check if wasn't removed
if (LOG.isDebugEnabled())
{
LOG.debug(name + ", getItem() " + identifier + " --> "
+ (c != null ? c.getQPath().getAsString() + " parent:" + c.getParentIdentifier() : "[null]"));
}
hits.incrementAndGet();
return c;
}
// remove expired
writeLock.lock();
try
{
cache.remove(k);
// remove by parentId + path
cache.remove(new CacheQPath(c.getParentIdentifier(), c.getQPath(), ItemType.getItemType(c)));
// remove cached child lists
if (c.isNode())
{
nodesCache.remove(c.getIdentifier());
propertiesCache.remove(c.getIdentifier());
}
}
finally
{
writeLock.unlock();
}
}
miss.incrementAndGet();
return null;
}
finally
{
totalGetTime += System.currentTimeMillis() - start;
}
} | java | protected ItemData getItem(final String identifier)
{
long start = System.currentTimeMillis();
try
{
final CacheId k = new CacheId(identifier);
final CacheValue v = cache.get(k);
if (v != null)
{
final ItemData c = v.getItem();
if (v.getExpiredTime() > System.currentTimeMillis())
{
// check if wasn't removed
if (LOG.isDebugEnabled())
{
LOG.debug(name + ", getItem() " + identifier + " --> "
+ (c != null ? c.getQPath().getAsString() + " parent:" + c.getParentIdentifier() : "[null]"));
}
hits.incrementAndGet();
return c;
}
// remove expired
writeLock.lock();
try
{
cache.remove(k);
// remove by parentId + path
cache.remove(new CacheQPath(c.getParentIdentifier(), c.getQPath(), ItemType.getItemType(c)));
// remove cached child lists
if (c.isNode())
{
nodesCache.remove(c.getIdentifier());
propertiesCache.remove(c.getIdentifier());
}
}
finally
{
writeLock.unlock();
}
}
miss.incrementAndGet();
return null;
}
finally
{
totalGetTime += System.currentTimeMillis() - start;
}
} | [
"protected",
"ItemData",
"getItem",
"(",
"final",
"String",
"identifier",
")",
"{",
"long",
"start",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"try",
"{",
"final",
"CacheId",
"k",
"=",
"new",
"CacheId",
"(",
"identifier",
")",
";",
"final",
... | Get item from cache C by item id. Checks is it expired, calcs statistics.
@param identifier
@return item | [
"Get",
"item",
"from",
"cache",
"C",
"by",
"item",
"id",
".",
"Checks",
"is",
"it",
"expired",
"calcs",
"statistics",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java#L1366-L1419 |
136,205 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java | LinkedWorkspaceStorageCacheImpl.setLiveTime | public void setLiveTime(long liveTime)
{
writeLock.lock();
try
{
this.liveTime = liveTime;
}
finally
{
writeLock.unlock();
}
LOG
.info(name + " : set liveTime=" + liveTime + "ms. New value will be applied to items cached from this moment.");
} | java | public void setLiveTime(long liveTime)
{
writeLock.lock();
try
{
this.liveTime = liveTime;
}
finally
{
writeLock.unlock();
}
LOG
.info(name + " : set liveTime=" + liveTime + "ms. New value will be applied to items cached from this moment.");
} | [
"public",
"void",
"setLiveTime",
"(",
"long",
"liveTime",
")",
"{",
"writeLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"this",
".",
"liveTime",
"=",
"liveTime",
";",
"}",
"finally",
"{",
"writeLock",
".",
"unlock",
"(",
")",
";",
"}",
"LOG",
".",
... | Set liveTime of newly cached items.
@param liveTime | [
"Set",
"liveTime",
"of",
"newly",
"cached",
"items",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java#L1770-L1783 |
136,206 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java | LinkedWorkspaceStorageCacheImpl.removeItem | protected void removeItem(final ItemData item)
{
final String itemId = item.getIdentifier();
cache.remove(new CacheId(itemId));
final CacheValue v2 =
cache.remove(new CacheQPath(item.getParentIdentifier(), item.getQPath(), ItemType.getItemType(item)));
if (v2 != null && !v2.getItem().getIdentifier().equals(itemId))
{
// same path but diff identifier node... phantom
removeItem(v2.getItem());
}
} | java | protected void removeItem(final ItemData item)
{
final String itemId = item.getIdentifier();
cache.remove(new CacheId(itemId));
final CacheValue v2 =
cache.remove(new CacheQPath(item.getParentIdentifier(), item.getQPath(), ItemType.getItemType(item)));
if (v2 != null && !v2.getItem().getIdentifier().equals(itemId))
{
// same path but diff identifier node... phantom
removeItem(v2.getItem());
}
} | [
"protected",
"void",
"removeItem",
"(",
"final",
"ItemData",
"item",
")",
"{",
"final",
"String",
"itemId",
"=",
"item",
".",
"getIdentifier",
"(",
")",
";",
"cache",
".",
"remove",
"(",
"new",
"CacheId",
"(",
"itemId",
")",
")",
";",
"final",
"CacheValu... | Remove item from cache C.
@param item | [
"Remove",
"item",
"from",
"cache",
"C",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java#L1790-L1803 |
136,207 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java | LinkedWorkspaceStorageCacheImpl.removeChildProperty | protected PropertyData removeChildProperty(final String parentIdentifier, final String childIdentifier)
{
final List<PropertyData> childProperties = propertiesCache.get(parentIdentifier);
if (childProperties != null)
{
synchronized (childProperties)
{ // [PN] 17.01.07
for (Iterator<PropertyData> i = childProperties.iterator(); i.hasNext();)
{
PropertyData cn = i.next();
if (cn.getIdentifier().equals(childIdentifier))
{
i.remove();
if (childProperties.size() <= 0)
{
propertiesCache.remove(parentIdentifier);
}
return cn;
}
}
}
}
return null;
} | java | protected PropertyData removeChildProperty(final String parentIdentifier, final String childIdentifier)
{
final List<PropertyData> childProperties = propertiesCache.get(parentIdentifier);
if (childProperties != null)
{
synchronized (childProperties)
{ // [PN] 17.01.07
for (Iterator<PropertyData> i = childProperties.iterator(); i.hasNext();)
{
PropertyData cn = i.next();
if (cn.getIdentifier().equals(childIdentifier))
{
i.remove();
if (childProperties.size() <= 0)
{
propertiesCache.remove(parentIdentifier);
}
return cn;
}
}
}
}
return null;
} | [
"protected",
"PropertyData",
"removeChildProperty",
"(",
"final",
"String",
"parentIdentifier",
",",
"final",
"String",
"childIdentifier",
")",
"{",
"final",
"List",
"<",
"PropertyData",
">",
"childProperties",
"=",
"propertiesCache",
".",
"get",
"(",
"parentIdentifie... | Remove property by id if parent properties are cached in CP.
@param parentIdentifier
- parent id
@param childIdentifier
- property id
@return removed property or null if property not cached or parent properties are not cached | [
"Remove",
"property",
"by",
"id",
"if",
"parent",
"properties",
"are",
"cached",
"in",
"CP",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java#L2065-L2088 |
136,208 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java | LinkedWorkspaceStorageCacheImpl.removeChildNode | protected NodeData removeChildNode(final String parentIdentifier, final String childIdentifier)
{
final List<NodeData> childNodes = nodesCache.get(parentIdentifier);
if (childNodes != null)
{
synchronized (childNodes)
{ // [PN] 17.01.07
for (Iterator<NodeData> i = childNodes.iterator(); i.hasNext();)
{
NodeData cn = i.next();
if (cn.getIdentifier().equals(childIdentifier))
{
i.remove();
return cn;
}
}
}
}
return null;
} | java | protected NodeData removeChildNode(final String parentIdentifier, final String childIdentifier)
{
final List<NodeData> childNodes = nodesCache.get(parentIdentifier);
if (childNodes != null)
{
synchronized (childNodes)
{ // [PN] 17.01.07
for (Iterator<NodeData> i = childNodes.iterator(); i.hasNext();)
{
NodeData cn = i.next();
if (cn.getIdentifier().equals(childIdentifier))
{
i.remove();
return cn;
}
}
}
}
return null;
} | [
"protected",
"NodeData",
"removeChildNode",
"(",
"final",
"String",
"parentIdentifier",
",",
"final",
"String",
"childIdentifier",
")",
"{",
"final",
"List",
"<",
"NodeData",
">",
"childNodes",
"=",
"nodesCache",
".",
"get",
"(",
"parentIdentifier",
")",
";",
"i... | Remove child node by id if parent child nodes are cached in CN.
@param parentIdentifier
- parebt if
@param childIdentifier
- node id
@return removed node or null if node not cached or parent child nodes are not cached | [
"Remove",
"child",
"node",
"by",
"id",
"if",
"parent",
"child",
"nodes",
"are",
"cached",
"in",
"CN",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java#L2099-L2118 |
136,209 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java | LinkedWorkspaceStorageCacheImpl.dump | String dump()
{
StringBuilder res = new StringBuilder();
for (Map.Entry<CacheKey, CacheValue> ce : cache.entrySet())
{
res.append(ce.getKey().hashCode());
res.append("\t\t");
res.append(ce.getValue().getItem().getIdentifier());
res.append(", ");
res.append(ce.getValue().getItem().getQPath().getAsString());
res.append(", ");
res.append(ce.getValue().getExpiredTime());
res.append(", ");
res.append(ce.getKey().getClass().getSimpleName());
res.append("\r\n");
}
return res.toString();
} | java | String dump()
{
StringBuilder res = new StringBuilder();
for (Map.Entry<CacheKey, CacheValue> ce : cache.entrySet())
{
res.append(ce.getKey().hashCode());
res.append("\t\t");
res.append(ce.getValue().getItem().getIdentifier());
res.append(", ");
res.append(ce.getValue().getItem().getQPath().getAsString());
res.append(", ");
res.append(ce.getValue().getExpiredTime());
res.append(", ");
res.append(ce.getKey().getClass().getSimpleName());
res.append("\r\n");
}
return res.toString();
} | [
"String",
"dump",
"(",
")",
"{",
"StringBuilder",
"res",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"CacheKey",
",",
"CacheValue",
">",
"ce",
":",
"cache",
".",
"entrySet",
"(",
")",
")",
"{",
"res",
".",
"app... | For debug. | [
"For",
"debug",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java#L2135-L2153 |
136,210 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java | JobRepositoryRestore.restore | final protected void restore() throws RepositoryRestoreExeption
{
try
{
stateRestore = REPOSITORY_RESTORE_STARTED;
startTime = Calendar.getInstance();
restoreRepository();
stateRestore = REPOSITORY_RESTORE_SUCCESSFUL;
endTime = Calendar.getInstance();
}
catch (Throwable t) //NOSONAR
{
stateRestore = REPOSITORY_RESTORE_FAIL;
restoreException = t;
throw new RepositoryRestoreExeption(t.getMessage(), t);
}
finally
{
if (removeJobOnceOver)
{
backupManager.restoreRepositoryJobs.remove(this);
}
}
} | java | final protected void restore() throws RepositoryRestoreExeption
{
try
{
stateRestore = REPOSITORY_RESTORE_STARTED;
startTime = Calendar.getInstance();
restoreRepository();
stateRestore = REPOSITORY_RESTORE_SUCCESSFUL;
endTime = Calendar.getInstance();
}
catch (Throwable t) //NOSONAR
{
stateRestore = REPOSITORY_RESTORE_FAIL;
restoreException = t;
throw new RepositoryRestoreExeption(t.getMessage(), t);
}
finally
{
if (removeJobOnceOver)
{
backupManager.restoreRepositoryJobs.remove(this);
}
}
} | [
"final",
"protected",
"void",
"restore",
"(",
")",
"throws",
"RepositoryRestoreExeption",
"{",
"try",
"{",
"stateRestore",
"=",
"REPOSITORY_RESTORE_STARTED",
";",
"startTime",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"restoreRepository",
"(",
")",
";",
... | Restore repository. Provide information about start and finish process.
@throws RepositoryRestoreExeption
if exception occurred during restore | [
"Restore",
"repository",
".",
"Provide",
"information",
"about",
"start",
"and",
"finish",
"process",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java#L139-L165 |
136,211 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java | JobRepositoryRestore.removeRepository | protected void removeRepository(RepositoryService repositoryService, String repositoryName)
throws RepositoryException,
RepositoryConfigurationException
{
ManageableRepository mr = null;
try
{
mr = repositoryService.getRepository(repositoryName);
}
catch (RepositoryException e)
{
// The repository not exist.
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
if (mr != null)
{
closeAllSession(mr);
repositoryService.removeRepository(repositoryName);
repositoryService.getConfig().retain(); // save configuration to persistence (file or persister)
}
} | java | protected void removeRepository(RepositoryService repositoryService, String repositoryName)
throws RepositoryException,
RepositoryConfigurationException
{
ManageableRepository mr = null;
try
{
mr = repositoryService.getRepository(repositoryName);
}
catch (RepositoryException e)
{
// The repository not exist.
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
if (mr != null)
{
closeAllSession(mr);
repositoryService.removeRepository(repositoryName);
repositoryService.getConfig().retain(); // save configuration to persistence (file or persister)
}
} | [
"protected",
"void",
"removeRepository",
"(",
"RepositoryService",
"repositoryService",
",",
"String",
"repositoryName",
")",
"throws",
"RepositoryException",
",",
"RepositoryConfigurationException",
"{",
"ManageableRepository",
"mr",
"=",
"null",
";",
"try",
"{",
"mr",
... | Remove repository.
@param repositoryService
RepositoryService, the repository service
@param repositoryName
String, the repository name
@throws RepositoryException
will be generated the RepositoryException
@throws RepositoryConfigurationException | [
"Remove",
"repository",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java#L294-L319 |
136,212 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java | JobRepositoryRestore.closeAllSession | private void closeAllSession(ManageableRepository mr) throws NoSuchWorkspaceException
{
for (String wsName : mr.getWorkspaceNames())
{
if (!mr.canRemoveWorkspace(wsName))
{
WorkspaceContainerFacade wc = mr.getWorkspaceContainer(wsName);
SessionRegistry sessionRegistry = (SessionRegistry)wc.getComponent(SessionRegistry.class);
sessionRegistry.closeSessions(wsName);
}
}
} | java | private void closeAllSession(ManageableRepository mr) throws NoSuchWorkspaceException
{
for (String wsName : mr.getWorkspaceNames())
{
if (!mr.canRemoveWorkspace(wsName))
{
WorkspaceContainerFacade wc = mr.getWorkspaceContainer(wsName);
SessionRegistry sessionRegistry = (SessionRegistry)wc.getComponent(SessionRegistry.class);
sessionRegistry.closeSessions(wsName);
}
}
} | [
"private",
"void",
"closeAllSession",
"(",
"ManageableRepository",
"mr",
")",
"throws",
"NoSuchWorkspaceException",
"{",
"for",
"(",
"String",
"wsName",
":",
"mr",
".",
"getWorkspaceNames",
"(",
")",
")",
"{",
"if",
"(",
"!",
"mr",
".",
"canRemoveWorkspace",
"... | Close all open session in repository
@param mr
@throws NoSuchWorkspaceException | [
"Close",
"all",
"open",
"session",
"in",
"repository"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java#L385-L396 |
136,213 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/DefaultItemDataCopyVisitor.java | DefaultItemDataCopyVisitor.findItemStates | protected List<ItemState> findItemStates(QPath itemPath)
{
List<ItemState> istates = new ArrayList<ItemState>();
for (ItemState istate : itemAddStates)
{
if (istate.getData().getQPath().equals(itemPath))
istates.add(istate);
}
return istates;
} | java | protected List<ItemState> findItemStates(QPath itemPath)
{
List<ItemState> istates = new ArrayList<ItemState>();
for (ItemState istate : itemAddStates)
{
if (istate.getData().getQPath().equals(itemPath))
istates.add(istate);
}
return istates;
} | [
"protected",
"List",
"<",
"ItemState",
">",
"findItemStates",
"(",
"QPath",
"itemPath",
")",
"{",
"List",
"<",
"ItemState",
">",
"istates",
"=",
"new",
"ArrayList",
"<",
"ItemState",
">",
"(",
")",
";",
"for",
"(",
"ItemState",
"istate",
":",
"itemAddState... | Find item states.
@param itemPath item path
@return List of states | [
"Find",
"item",
"states",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/DefaultItemDataCopyVisitor.java#L243-L252 |
136,214 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/DefaultItemDataCopyVisitor.java | DefaultItemDataCopyVisitor.findLastItemState | protected ItemState findLastItemState(QPath itemPath)
{
for (int i = itemAddStates.size() - 1; i >= 0; i--)
{
ItemState istate = itemAddStates.get(i);
if (istate.getData().getQPath().equals(itemPath))
return istate;
}
return null;
} | java | protected ItemState findLastItemState(QPath itemPath)
{
for (int i = itemAddStates.size() - 1; i >= 0; i--)
{
ItemState istate = itemAddStates.get(i);
if (istate.getData().getQPath().equals(itemPath))
return istate;
}
return null;
} | [
"protected",
"ItemState",
"findLastItemState",
"(",
"QPath",
"itemPath",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"itemAddStates",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"ItemState",
"istate",
"=",
"itemAddStates"... | Find last ItemState.
@param itemPath item path
@return ItemState | [
"Find",
"last",
"ItemState",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/DefaultItemDataCopyVisitor.java#L260-L269 |
136,215 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/CNDStreamReader.java | CNDStreamReader.read | public List<NodeTypeData> read(InputStream is) throws RepositoryException
{
try
{
if (is != null)
{
/** Lexing input stream */
CNDLexer lex = new CNDLexer(new ANTLRInputStream(is));
CommonTokenStream tokens = new CommonTokenStream(lex);
/** Parsing input stream */
CNDParser parser = new CNDParser(tokens);
CNDParser.cnd_return r;
/** Throw exception if any lex errors found */
if (lex.hasError())
{
throw new RepositoryException("Lexer errors found " + lex.getErrors().toString());
}
r = parser.cnd();
/** Throw exception if any parse errors found */
if (parser.hasError())
{
throw new RepositoryException("Parser errors found " + parser.getErrors().toString());
}
CommonTreeNodeStream nodes = new CommonTreeNodeStream(r.getTree());
CNDWalker walker = new CNDWalker(nodes);
/**
* Running tree walker to build nodetypes. Namespace registry is
* provided to register namespaced mentioned in stream and
* locationFactory is used to parse JCR names
*/
walker.cnd(namespaceRegistry);
return walker.getNodeTypes();
}
else
{
return new ArrayList<NodeTypeData>();
}
}
catch (IOException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (RecognitionException e)
{
throw new RepositoryException(e.getMessage(), e);
}
} | java | public List<NodeTypeData> read(InputStream is) throws RepositoryException
{
try
{
if (is != null)
{
/** Lexing input stream */
CNDLexer lex = new CNDLexer(new ANTLRInputStream(is));
CommonTokenStream tokens = new CommonTokenStream(lex);
/** Parsing input stream */
CNDParser parser = new CNDParser(tokens);
CNDParser.cnd_return r;
/** Throw exception if any lex errors found */
if (lex.hasError())
{
throw new RepositoryException("Lexer errors found " + lex.getErrors().toString());
}
r = parser.cnd();
/** Throw exception if any parse errors found */
if (parser.hasError())
{
throw new RepositoryException("Parser errors found " + parser.getErrors().toString());
}
CommonTreeNodeStream nodes = new CommonTreeNodeStream(r.getTree());
CNDWalker walker = new CNDWalker(nodes);
/**
* Running tree walker to build nodetypes. Namespace registry is
* provided to register namespaced mentioned in stream and
* locationFactory is used to parse JCR names
*/
walker.cnd(namespaceRegistry);
return walker.getNodeTypes();
}
else
{
return new ArrayList<NodeTypeData>();
}
}
catch (IOException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (RecognitionException e)
{
throw new RepositoryException(e.getMessage(), e);
}
} | [
"public",
"List",
"<",
"NodeTypeData",
">",
"read",
"(",
"InputStream",
"is",
")",
"throws",
"RepositoryException",
"{",
"try",
"{",
"if",
"(",
"is",
"!=",
"null",
")",
"{",
"/** Lexing input stream */",
"CNDLexer",
"lex",
"=",
"new",
"CNDLexer",
"(",
"new",... | Method which reads input stream as compact node type definition string. If
any namespaces are placed in stream they are registered through namespace
registry.
@param is {@link InputStream} to read from.
@return List of parsed nodetypes
@throws RepositoryException Exception is thrown when wrong input is
provided in stream or any {@link IOException} are repacked to
{@link RepositoryException} | [
"Method",
"which",
"reads",
"input",
"stream",
"as",
"compact",
"node",
"type",
"definition",
"string",
".",
"If",
"any",
"namespaces",
"are",
"placed",
"in",
"stream",
"they",
"are",
"registered",
"through",
"namespace",
"registry",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/CNDStreamReader.java#L73-L120 |
136,216 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanerTool.java | DBCleanerTool.execute | protected void execute(List<String> scripts) throws SQLException
{
SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
// set needed auto commit mode
boolean autoCommit = connection.getAutoCommit();
if (autoCommit != this.autoCommit)
{
connection.setAutoCommit(this.autoCommit);
}
Statement st = connection.createStatement();
try
{
for (String scr : scripts)
{
String sql = JDBCUtils.cleanWhitespaces(scr.trim());
if (!sql.isEmpty())
{
if (LOG.isDebugEnabled())
{
LOG.debug("Execute script: \n[" + sql + "]");
}
executeQuery(st, sql);
}
}
}
finally
{
try
{
st.close();
}
catch (SQLException e)
{
LOG.error("Can't close the Statement." + e.getMessage());
}
// restore previous auto commit mode
if (autoCommit != this.autoCommit)
{
connection.setAutoCommit(autoCommit);
}
}
} | java | protected void execute(List<String> scripts) throws SQLException
{
SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
// set needed auto commit mode
boolean autoCommit = connection.getAutoCommit();
if (autoCommit != this.autoCommit)
{
connection.setAutoCommit(this.autoCommit);
}
Statement st = connection.createStatement();
try
{
for (String scr : scripts)
{
String sql = JDBCUtils.cleanWhitespaces(scr.trim());
if (!sql.isEmpty())
{
if (LOG.isDebugEnabled())
{
LOG.debug("Execute script: \n[" + sql + "]");
}
executeQuery(st, sql);
}
}
}
finally
{
try
{
st.close();
}
catch (SQLException e)
{
LOG.error("Can't close the Statement." + e.getMessage());
}
// restore previous auto commit mode
if (autoCommit != this.autoCommit)
{
connection.setAutoCommit(autoCommit);
}
}
} | [
"protected",
"void",
"execute",
"(",
"List",
"<",
"String",
">",
"scripts",
")",
"throws",
"SQLException",
"{",
"SecurityHelper",
".",
"validateSecurityPermission",
"(",
"JCRRuntimePermissions",
".",
"MANAGE_REPOSITORY_PERMISSION",
")",
";",
"// set needed auto commit mod... | Execute script on database. Set auto commit mode if needed.
@param scripts
the scripts for execution
@throws SQLException | [
"Execute",
"script",
"on",
"database",
".",
"Set",
"auto",
"commit",
"mode",
"if",
"needed",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanerTool.java#L159-L204 |
136,217 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DocOrderScoreNodeIterator.java | DocOrderScoreNodeIterator.initOrderedIterator | private void initOrderedIterator()
{
if (orderedNodes != null)
{
return;
}
long time = 0;
if (LOG.isDebugEnabled())
{
time = System.currentTimeMillis();
}
ScoreNode[][] nodes = (ScoreNode[][])scoreNodes.toArray(new ScoreNode[scoreNodes.size()][]);
final Set<String> invalidIDs = new HashSet<String>(2);
/** Cache for Nodes obtainer during the order (comparator work) */
final Map<String, NodeData> lcache = new HashMap<String, NodeData>();
do
{
if (invalidIDs.size() > 0)
{
// previous sort run was not successful -> remove failed uuids
List<ScoreNode[]> tmp = new ArrayList<ScoreNode[]>();
for (int i = 0; i < nodes.length; i++)
{
if (!invalidIDs.contains(nodes[i][selectorIndex].getNodeId()))
{
tmp.add(nodes[i]);
}
}
nodes = (ScoreNode[][])tmp.toArray(new ScoreNode[tmp.size()][]);
invalidIDs.clear();
}
try
{
// sort the uuids
Arrays.sort(nodes, new ScoreNodeComparator(lcache, invalidIDs));
}
catch (SortFailedException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
}
while (invalidIDs.size() > 0);
if (LOG.isDebugEnabled())
{
LOG.debug("" + nodes.length + " node(s) ordered in " + (System.currentTimeMillis() - time) + " ms");
}
orderedNodes = new ScoreNodeIteratorImpl(nodes);
} | java | private void initOrderedIterator()
{
if (orderedNodes != null)
{
return;
}
long time = 0;
if (LOG.isDebugEnabled())
{
time = System.currentTimeMillis();
}
ScoreNode[][] nodes = (ScoreNode[][])scoreNodes.toArray(new ScoreNode[scoreNodes.size()][]);
final Set<String> invalidIDs = new HashSet<String>(2);
/** Cache for Nodes obtainer during the order (comparator work) */
final Map<String, NodeData> lcache = new HashMap<String, NodeData>();
do
{
if (invalidIDs.size() > 0)
{
// previous sort run was not successful -> remove failed uuids
List<ScoreNode[]> tmp = new ArrayList<ScoreNode[]>();
for (int i = 0; i < nodes.length; i++)
{
if (!invalidIDs.contains(nodes[i][selectorIndex].getNodeId()))
{
tmp.add(nodes[i]);
}
}
nodes = (ScoreNode[][])tmp.toArray(new ScoreNode[tmp.size()][]);
invalidIDs.clear();
}
try
{
// sort the uuids
Arrays.sort(nodes, new ScoreNodeComparator(lcache, invalidIDs));
}
catch (SortFailedException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
}
while (invalidIDs.size() > 0);
if (LOG.isDebugEnabled())
{
LOG.debug("" + nodes.length + " node(s) ordered in " + (System.currentTimeMillis() - time) + " ms");
}
orderedNodes = new ScoreNodeIteratorImpl(nodes);
} | [
"private",
"void",
"initOrderedIterator",
"(",
")",
"{",
"if",
"(",
"orderedNodes",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"long",
"time",
"=",
"0",
";",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"time",
"=",
"System",
".",
... | Initializes the NodeIterator in document order | [
"Initializes",
"the",
"NodeIterator",
"in",
"document",
"order"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DocOrderScoreNodeIterator.java#L169-L225 |
136,218 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/JCRRestore.java | JCRRestore.getFullBackupFile | public static File getFullBackupFile(File restoreDir)
{
Pattern p = Pattern.compile(".+\\.0");
for (File f : PrivilegedFileHelper.listFiles(restoreDir, new FileFilter()
{
public boolean accept(File pathname)
{
Pattern p = Pattern.compile(".+\\.[0-9]+");
Matcher m = p.matcher(pathname.getName());
return m.matches();
}
}))
{
Matcher m = p.matcher(f.getName());
if (m.matches())
{
return f;
}
}
return null;
} | java | public static File getFullBackupFile(File restoreDir)
{
Pattern p = Pattern.compile(".+\\.0");
for (File f : PrivilegedFileHelper.listFiles(restoreDir, new FileFilter()
{
public boolean accept(File pathname)
{
Pattern p = Pattern.compile(".+\\.[0-9]+");
Matcher m = p.matcher(pathname.getName());
return m.matches();
}
}))
{
Matcher m = p.matcher(f.getName());
if (m.matches())
{
return f;
}
}
return null;
} | [
"public",
"static",
"File",
"getFullBackupFile",
"(",
"File",
"restoreDir",
")",
"{",
"Pattern",
"p",
"=",
"Pattern",
".",
"compile",
"(",
"\".+\\\\.0\"",
")",
";",
"for",
"(",
"File",
"f",
":",
"PrivilegedFileHelper",
".",
"listFiles",
"(",
"restoreDir",
",... | Returns file with full backup. In case of RDBMS backup
it may be a directory.
@param restoreDir
@return | [
"Returns",
"file",
"with",
"full",
"backup",
".",
"In",
"case",
"of",
"RDBMS",
"backup",
"it",
"may",
"be",
"a",
"directory",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/JCRRestore.java#L94-L116 |
136,219 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/JCRRestore.java | JCRRestore.getIncrementalFiles | public static List<File> getIncrementalFiles(File restoreDir)
{
ArrayList<File> list = new ArrayList<File>();
Pattern fullBackupPattern = Pattern.compile(".+\\.0");
for (File f : PrivilegedFileHelper.listFiles(restoreDir, new FileFilter()
{
public boolean accept(File pathname)
{
Pattern p = Pattern.compile(".+\\.[0-9]+");
Matcher m = p.matcher(pathname.getName());
return m.matches();
}
}))
{
if (fullBackupPattern.matcher(f.getName()).matches() == false)
{
list.add(f);
}
}
return list;
} | java | public static List<File> getIncrementalFiles(File restoreDir)
{
ArrayList<File> list = new ArrayList<File>();
Pattern fullBackupPattern = Pattern.compile(".+\\.0");
for (File f : PrivilegedFileHelper.listFiles(restoreDir, new FileFilter()
{
public boolean accept(File pathname)
{
Pattern p = Pattern.compile(".+\\.[0-9]+");
Matcher m = p.matcher(pathname.getName());
return m.matches();
}
}))
{
if (fullBackupPattern.matcher(f.getName()).matches() == false)
{
list.add(f);
}
}
return list;
} | [
"public",
"static",
"List",
"<",
"File",
">",
"getIncrementalFiles",
"(",
"File",
"restoreDir",
")",
"{",
"ArrayList",
"<",
"File",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"Pattern",
"fullBackupPattern",
"=",
"Pattern",
".",
... | Get list of incremental backup files.
@param restoreDir
@return list of files | [
"Get",
"list",
"of",
"incremental",
"backup",
"files",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/JCRRestore.java#L124-L147 |
136,220 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/JCRRestore.java | JCRRestore.incrementalRestore | public void incrementalRestore(File incrementalBackupFile) throws FileNotFoundException, IOException,
ClassNotFoundException, RepositoryException
{
ObjectInputStream ois = null;
try
{
ois = new ObjectInputStream(PrivilegedFileHelper.fileInputStream(incrementalBackupFile));
while (true)
{
TransactionChangesLog changesLog = readExternal(ois);
changesLog.setSystemId(Constants.JCR_CORE_RESTORE_WORKSPACE_INITIALIZER_SYSTEM_ID); // mark changes
ChangesLogIterator cli = changesLog.getLogIterator();
while (cli.hasNextLog())
{
if (cli.nextLog().getEventType() == ExtendedEvent.LOCK)
{
cli.removeLog();
}
}
saveChangesLog(changesLog);
}
}
catch (EOFException ioe)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + ioe.getMessage());
}
}
} | java | public void incrementalRestore(File incrementalBackupFile) throws FileNotFoundException, IOException,
ClassNotFoundException, RepositoryException
{
ObjectInputStream ois = null;
try
{
ois = new ObjectInputStream(PrivilegedFileHelper.fileInputStream(incrementalBackupFile));
while (true)
{
TransactionChangesLog changesLog = readExternal(ois);
changesLog.setSystemId(Constants.JCR_CORE_RESTORE_WORKSPACE_INITIALIZER_SYSTEM_ID); // mark changes
ChangesLogIterator cli = changesLog.getLogIterator();
while (cli.hasNextLog())
{
if (cli.nextLog().getEventType() == ExtendedEvent.LOCK)
{
cli.removeLog();
}
}
saveChangesLog(changesLog);
}
}
catch (EOFException ioe)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + ioe.getMessage());
}
}
} | [
"public",
"void",
"incrementalRestore",
"(",
"File",
"incrementalBackupFile",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
",",
"ClassNotFoundException",
",",
"RepositoryException",
"{",
"ObjectInputStream",
"ois",
"=",
"null",
";",
"try",
"{",
"ois",
"... | Perform incremental restore operation.
@param incrementalBackupFile
incremental backup file
@throws FileNotFoundException
@throws IOException
@throws ClassNotFoundException
@throws RepositoryException | [
"Perform",
"incremental",
"restore",
"operation",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/JCRRestore.java#L159-L191 |
136,221 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ChangesItem.java | ChangesItem.getNodeChangedSize | public long getNodeChangedSize(String nodePath)
{
Long delta = calculatedChangedNodesSize.get(nodePath);
return delta == null ? 0 : delta;
} | java | public long getNodeChangedSize(String nodePath)
{
Long delta = calculatedChangedNodesSize.get(nodePath);
return delta == null ? 0 : delta;
} | [
"public",
"long",
"getNodeChangedSize",
"(",
"String",
"nodePath",
")",
"{",
"Long",
"delta",
"=",
"calculatedChangedNodesSize",
".",
"get",
"(",
"nodePath",
")",
";",
"return",
"delta",
"==",
"null",
"?",
"0",
":",
"delta",
";",
"}"
] | Returns node data changed size if exists or zero otherwise. | [
"Returns",
"node",
"data",
"changed",
"size",
"if",
"exists",
"or",
"zero",
"otherwise",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ChangesItem.java#L94-L98 |
136,222 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ChangesItem.java | ChangesItem.merge | public void merge(ChangesItem changesItem)
{
workspaceChangedSize += changesItem.getWorkspaceChangedSize();
for (Entry<String, Long> changesEntry : changesItem.calculatedChangedNodesSize.entrySet())
{
String nodePath = changesEntry.getKey();
Long currentDelta = changesEntry.getValue();
Long oldDelta = calculatedChangedNodesSize.get(nodePath);
Long newDelta = currentDelta + (oldDelta == null ? 0 : oldDelta);
calculatedChangedNodesSize.put(nodePath, newDelta);
}
for (String path : changesItem.unknownChangedNodesSize)
{
unknownChangedNodesSize.add(path);
}
for (String path : changesItem.asyncUpdate)
{
asyncUpdate.add(path);
}
} | java | public void merge(ChangesItem changesItem)
{
workspaceChangedSize += changesItem.getWorkspaceChangedSize();
for (Entry<String, Long> changesEntry : changesItem.calculatedChangedNodesSize.entrySet())
{
String nodePath = changesEntry.getKey();
Long currentDelta = changesEntry.getValue();
Long oldDelta = calculatedChangedNodesSize.get(nodePath);
Long newDelta = currentDelta + (oldDelta == null ? 0 : oldDelta);
calculatedChangedNodesSize.put(nodePath, newDelta);
}
for (String path : changesItem.unknownChangedNodesSize)
{
unknownChangedNodesSize.add(path);
}
for (String path : changesItem.asyncUpdate)
{
asyncUpdate.add(path);
}
} | [
"public",
"void",
"merge",
"(",
"ChangesItem",
"changesItem",
")",
"{",
"workspaceChangedSize",
"+=",
"changesItem",
".",
"getWorkspaceChangedSize",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"Long",
">",
"changesEntry",
":",
"changesItem",
".",
"... | Merges current changes with new one. | [
"Merges",
"current",
"changes",
"with",
"new",
"one",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ChangesItem.java#L147-L171 |
136,223 | exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/ResourceUtil.java | ResourceUtil.isFile | public static boolean isFile(Node node)
{
try
{
if (!node.isNodeType("nt:file"))
return false;
if (!node.getNode("jcr:content").isNodeType("nt:resource"))
return false;
return true;
}
catch (RepositoryException exc)
{
LOG.error(exc.getMessage(), exc);
return false;
}
} | java | public static boolean isFile(Node node)
{
try
{
if (!node.isNodeType("nt:file"))
return false;
if (!node.getNode("jcr:content").isNodeType("nt:resource"))
return false;
return true;
}
catch (RepositoryException exc)
{
LOG.error(exc.getMessage(), exc);
return false;
}
} | [
"public",
"static",
"boolean",
"isFile",
"(",
"Node",
"node",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"node",
".",
"isNodeType",
"(",
"\"nt:file\"",
")",
")",
"return",
"false",
";",
"if",
"(",
"!",
"node",
".",
"getNode",
"(",
"\"jcr:content\"",
")",
... | If the node is file.
@param node node
@return true if node is file false if not | [
"If",
"the",
"node",
"is",
"file",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/ResourceUtil.java#L64-L79 |
136,224 | exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/ResourceUtil.java | ResourceUtil.isVersion | public static boolean isVersion(Node node)
{
try
{
if (node.isNodeType("nt:version"))
return true;
return false;
}
catch (RepositoryException exc)
{
LOG.error(exc.getMessage(), exc);
return false;
}
} | java | public static boolean isVersion(Node node)
{
try
{
if (node.isNodeType("nt:version"))
return true;
return false;
}
catch (RepositoryException exc)
{
LOG.error(exc.getMessage(), exc);
return false;
}
} | [
"public",
"static",
"boolean",
"isVersion",
"(",
"Node",
"node",
")",
"{",
"try",
"{",
"if",
"(",
"node",
".",
"isNodeType",
"(",
"\"nt:version\"",
")",
")",
"return",
"true",
";",
"return",
"false",
";",
"}",
"catch",
"(",
"RepositoryException",
"exc",
... | If the node is version.
@param node node
@return true if node is version false if not | [
"If",
"the",
"node",
"is",
"version",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/ResourceUtil.java#L87-L100 |
136,225 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/NodeTypeDataValidator.java | NodeTypeDataValidator.validateNodeType | private void validateNodeType(NodeTypeData nodeType) throws RepositoryException
{
if (nodeType == null)
{
throw new RepositoryException("NodeType object " + nodeType + " is null");
}
if (nodeType.getName() == null)
{
throw new RepositoryException("NodeType implementation class " + nodeType.getClass().getName()
+ " is not supported in this method");
}
for (InternalQName sname : nodeType.getDeclaredSupertypeNames())
{
if (!nodeType.getName().equals(Constants.NT_BASE) && nodeType.getName().equals(sname))
{
throw new RepositoryException("Invalid super type name" + sname.getAsString());
}
}
for (PropertyDefinitionData pdef : nodeType.getDeclaredPropertyDefinitions())
{
if (!pdef.getDeclaringNodeType().equals(nodeType.getName()))
{
throw new RepositoryException("Invalid declared node type in property definitions with name "
+ pdef.getName().getAsString() + " not registred");
}
// validate default values
try
{
validateValueDefaults(pdef.getRequiredType(), pdef.getDefaultValues());
}
catch (ValueFormatException e)
{
throw new ValueFormatException("Default value is incompatible with Property type "
+ PropertyType.nameFromValue(pdef.getRequiredType()) + " of " + pdef.getName().getAsString()
+ " in nodetype " + nodeType.getName().getAsString(), e);
}
try
{
validateValueConstraints(pdef.getRequiredType(), pdef.getValueConstraints());
}
catch (ValueFormatException e)
{
throw new ValueFormatException("Constraints is incompatible with Property type "
+ PropertyType.nameFromValue(pdef.getRequiredType()) + " of " + pdef.getName().getAsString()
+ " in nodetype " + nodeType.getName().getAsString(), e);
}
}
for (NodeDefinitionData cndef : nodeType.getDeclaredChildNodeDefinitions())
{
if (!cndef.getDeclaringNodeType().equals(nodeType.getName()))
{
throw new RepositoryException("Invalid declared node type in child node definitions with name "
+ cndef.getName().getAsString() + " not registred");
}
}
} | java | private void validateNodeType(NodeTypeData nodeType) throws RepositoryException
{
if (nodeType == null)
{
throw new RepositoryException("NodeType object " + nodeType + " is null");
}
if (nodeType.getName() == null)
{
throw new RepositoryException("NodeType implementation class " + nodeType.getClass().getName()
+ " is not supported in this method");
}
for (InternalQName sname : nodeType.getDeclaredSupertypeNames())
{
if (!nodeType.getName().equals(Constants.NT_BASE) && nodeType.getName().equals(sname))
{
throw new RepositoryException("Invalid super type name" + sname.getAsString());
}
}
for (PropertyDefinitionData pdef : nodeType.getDeclaredPropertyDefinitions())
{
if (!pdef.getDeclaringNodeType().equals(nodeType.getName()))
{
throw new RepositoryException("Invalid declared node type in property definitions with name "
+ pdef.getName().getAsString() + " not registred");
}
// validate default values
try
{
validateValueDefaults(pdef.getRequiredType(), pdef.getDefaultValues());
}
catch (ValueFormatException e)
{
throw new ValueFormatException("Default value is incompatible with Property type "
+ PropertyType.nameFromValue(pdef.getRequiredType()) + " of " + pdef.getName().getAsString()
+ " in nodetype " + nodeType.getName().getAsString(), e);
}
try
{
validateValueConstraints(pdef.getRequiredType(), pdef.getValueConstraints());
}
catch (ValueFormatException e)
{
throw new ValueFormatException("Constraints is incompatible with Property type "
+ PropertyType.nameFromValue(pdef.getRequiredType()) + " of " + pdef.getName().getAsString()
+ " in nodetype " + nodeType.getName().getAsString(), e);
}
}
for (NodeDefinitionData cndef : nodeType.getDeclaredChildNodeDefinitions())
{
if (!cndef.getDeclaringNodeType().equals(nodeType.getName()))
{
throw new RepositoryException("Invalid declared node type in child node definitions with name "
+ cndef.getName().getAsString() + " not registred");
}
}
} | [
"private",
"void",
"validateNodeType",
"(",
"NodeTypeData",
"nodeType",
")",
"throws",
"RepositoryException",
"{",
"if",
"(",
"nodeType",
"==",
"null",
")",
"{",
"throw",
"new",
"RepositoryException",
"(",
"\"NodeType object \"",
"+",
"nodeType",
"+",
"\" is null\""... | Check according the JSR-170 | [
"Check",
"according",
"the",
"JSR",
"-",
"170"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/NodeTypeDataValidator.java#L189-L250 |
136,226 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java | VersionHistoryImpl.version | public Version version(String versionName, boolean pool) throws VersionException, RepositoryException
{
JCRName jcrVersionName = locationFactory.parseJCRName(versionName);
VersionImpl version =
(VersionImpl)dataManager.getItem(nodeData(), new QPathEntry(jcrVersionName.getInternalName(), 1), pool,
ItemType.NODE, false);
if (version == null)
{
throw new VersionException("There are no version with name '" + versionName + "' in the version history "
+ getPath());
}
return version;
} | java | public Version version(String versionName, boolean pool) throws VersionException, RepositoryException
{
JCRName jcrVersionName = locationFactory.parseJCRName(versionName);
VersionImpl version =
(VersionImpl)dataManager.getItem(nodeData(), new QPathEntry(jcrVersionName.getInternalName(), 1), pool,
ItemType.NODE, false);
if (version == null)
{
throw new VersionException("There are no version with name '" + versionName + "' in the version history "
+ getPath());
}
return version;
} | [
"public",
"Version",
"version",
"(",
"String",
"versionName",
",",
"boolean",
"pool",
")",
"throws",
"VersionException",
",",
"RepositoryException",
"{",
"JCRName",
"jcrVersionName",
"=",
"locationFactory",
".",
"parseJCRName",
"(",
"versionName",
")",
";",
"Version... | For internal use. Doesn't check InvalidItemStateException. May return
unpooled Version object. | [
"For",
"internal",
"use",
".",
"Doesn",
"t",
"check",
"InvalidItemStateException",
".",
"May",
"return",
"unpooled",
"Version",
"object",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java#L187-L200 |
136,227 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java | MigrationTool.migrate | void migrate() throws RepositoryException
{
try
{
LOG.info("Migration started.");
moveOldStructure();
service.createStructure();
//Migration order is important due to removal of nodes.
migrateGroups();
migrateMembershipTypes();
migrateUsers();
migrateProfiles();
migrateMemberships();
removeOldStructure();
LOG.info("Migration completed.");
}
catch (Exception e)//NOSONAR
{
throw new RepositoryException("Migration failed", e);
}
} | java | void migrate() throws RepositoryException
{
try
{
LOG.info("Migration started.");
moveOldStructure();
service.createStructure();
//Migration order is important due to removal of nodes.
migrateGroups();
migrateMembershipTypes();
migrateUsers();
migrateProfiles();
migrateMemberships();
removeOldStructure();
LOG.info("Migration completed.");
}
catch (Exception e)//NOSONAR
{
throw new RepositoryException("Migration failed", e);
}
} | [
"void",
"migrate",
"(",
")",
"throws",
"RepositoryException",
"{",
"try",
"{",
"LOG",
".",
"info",
"(",
"\"Migration started.\"",
")",
";",
"moveOldStructure",
"(",
")",
";",
"service",
".",
"createStructure",
"(",
")",
";",
"//Migration order is important due to ... | Method that aggregates all needed migration operations in needed order.
@throws RepositoryException | [
"Method",
"that",
"aggregates",
"all",
"needed",
"migration",
"operations",
"in",
"needed",
"order",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java#L117-L141 |
136,228 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java | MigrationTool.migrationRequired | boolean migrationRequired() throws RepositoryException
{
Session session = service.getStorageSession();
try
{
if (session.itemExists(storagePathOld))
{
return true;
}
try
{
Node node = (Node)session.getItem(service.getStoragePath());
return node.isNodeType(JOS_ORGANIZATION_NODETYPE_OLD);
}
catch (PathNotFoundException e)
{
return false;
}
}
finally
{
session.logout();
}
} | java | boolean migrationRequired() throws RepositoryException
{
Session session = service.getStorageSession();
try
{
if (session.itemExists(storagePathOld))
{
return true;
}
try
{
Node node = (Node)session.getItem(service.getStoragePath());
return node.isNodeType(JOS_ORGANIZATION_NODETYPE_OLD);
}
catch (PathNotFoundException e)
{
return false;
}
}
finally
{
session.logout();
}
} | [
"boolean",
"migrationRequired",
"(",
")",
"throws",
"RepositoryException",
"{",
"Session",
"session",
"=",
"service",
".",
"getStorageSession",
"(",
")",
";",
"try",
"{",
"if",
"(",
"session",
".",
"itemExists",
"(",
"storagePathOld",
")",
")",
"{",
"return",
... | Method to know if migration is need.
@return true if migration is need false otherwise.
@throws RepositoryException | [
"Method",
"to",
"know",
"if",
"migration",
"is",
"need",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java#L148-L173 |
136,229 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java | MigrationTool.moveOldStructure | private void moveOldStructure() throws Exception
{
ExtendedSession session = (ExtendedSession)service.getStorageSession();
try
{
if (session.itemExists(storagePathOld))
{
return;
}
else
{
session.move(service.getStoragePath(), storagePathOld, false);
session.save();
}
}
finally
{
session.logout();
}
} | java | private void moveOldStructure() throws Exception
{
ExtendedSession session = (ExtendedSession)service.getStorageSession();
try
{
if (session.itemExists(storagePathOld))
{
return;
}
else
{
session.move(service.getStoragePath(), storagePathOld, false);
session.save();
}
}
finally
{
session.logout();
}
} | [
"private",
"void",
"moveOldStructure",
"(",
")",
"throws",
"Exception",
"{",
"ExtendedSession",
"session",
"=",
"(",
"ExtendedSession",
")",
"service",
".",
"getStorageSession",
"(",
")",
";",
"try",
"{",
"if",
"(",
"session",
".",
"itemExists",
"(",
"storageP... | Method for moving old storage into temporary location.
@throws Exception | [
"Method",
"for",
"moving",
"old",
"storage",
"into",
"temporary",
"location",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java#L179-L198 |
136,230 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java | MigrationTool.removeOldStructure | private void removeOldStructure() throws RepositoryException
{
ExtendedSession session = (ExtendedSession)service.getStorageSession();
try
{
if (session.itemExists(storagePathOld))
{
NodeIterator usersIter = ((ExtendedNode)session.getItem(usersStorageOld)).getNodesLazily();
while (usersIter.hasNext())
{
Node currentUser = usersIter.nextNode();
currentUser.remove();
session.save();
}
NodeIterator groupsIter = ((ExtendedNode)session.getItem(groupsStorageOld)).getNodesLazily();
while (groupsIter.hasNext())
{
Node currentGroup = groupsIter.nextNode();
currentGroup.remove();
session.save();
}
NodeIterator membershipTypesIter =
((ExtendedNode)session.getItem(membershipTypesStorageOld)).getNodesLazily();
while (membershipTypesIter.hasNext())
{
Node currentMembershipType = membershipTypesIter.nextNode();
currentMembershipType.remove();
session.save();
}
session.getItem(storagePathOld).remove();
session.save();
}
}
finally
{
session.logout();
}
} | java | private void removeOldStructure() throws RepositoryException
{
ExtendedSession session = (ExtendedSession)service.getStorageSession();
try
{
if (session.itemExists(storagePathOld))
{
NodeIterator usersIter = ((ExtendedNode)session.getItem(usersStorageOld)).getNodesLazily();
while (usersIter.hasNext())
{
Node currentUser = usersIter.nextNode();
currentUser.remove();
session.save();
}
NodeIterator groupsIter = ((ExtendedNode)session.getItem(groupsStorageOld)).getNodesLazily();
while (groupsIter.hasNext())
{
Node currentGroup = groupsIter.nextNode();
currentGroup.remove();
session.save();
}
NodeIterator membershipTypesIter =
((ExtendedNode)session.getItem(membershipTypesStorageOld)).getNodesLazily();
while (membershipTypesIter.hasNext())
{
Node currentMembershipType = membershipTypesIter.nextNode();
currentMembershipType.remove();
session.save();
}
session.getItem(storagePathOld).remove();
session.save();
}
}
finally
{
session.logout();
}
} | [
"private",
"void",
"removeOldStructure",
"(",
")",
"throws",
"RepositoryException",
"{",
"ExtendedSession",
"session",
"=",
"(",
"ExtendedSession",
")",
"service",
".",
"getStorageSession",
"(",
")",
";",
"try",
"{",
"if",
"(",
"session",
".",
"itemExists",
"(",... | Method for removing old storage from temporary location.
@throws RepositoryException | [
"Method",
"for",
"removing",
"old",
"storage",
"from",
"temporary",
"location",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java#L204-L244 |
136,231 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java | MigrationTool.migrateUsers | private void migrateUsers() throws Exception
{
Session session = service.getStorageSession();
try
{
if (session.itemExists(usersStorageOld))
{
NodeIterator iterator = ((ExtendedNode)session.getItem(usersStorageOld)).getNodesLazily();
UserHandlerImpl uh = ((UserHandlerImpl)service.getUserHandler());
while (iterator.hasNext())
{
uh.migrateUser(iterator.nextNode());
}
}
}
finally
{
session.logout();
}
} | java | private void migrateUsers() throws Exception
{
Session session = service.getStorageSession();
try
{
if (session.itemExists(usersStorageOld))
{
NodeIterator iterator = ((ExtendedNode)session.getItem(usersStorageOld)).getNodesLazily();
UserHandlerImpl uh = ((UserHandlerImpl)service.getUserHandler());
while (iterator.hasNext())
{
uh.migrateUser(iterator.nextNode());
}
}
}
finally
{
session.logout();
}
} | [
"private",
"void",
"migrateUsers",
"(",
")",
"throws",
"Exception",
"{",
"Session",
"session",
"=",
"service",
".",
"getStorageSession",
"(",
")",
";",
"try",
"{",
"if",
"(",
"session",
".",
"itemExists",
"(",
"usersStorageOld",
")",
")",
"{",
"NodeIterator"... | Method for users migration.
@throws Exception | [
"Method",
"for",
"users",
"migration",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java#L250-L269 |
136,232 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java | MigrationTool.migrateGroups | private void migrateGroups() throws Exception
{
Session session = service.getStorageSession();
try
{
if (session.itemExists(groupsStorageOld))
{
NodeIterator iterator = ((ExtendedNode)session.getItem(groupsStorageOld)).getNodesLazily();
GroupHandlerImpl gh = ((GroupHandlerImpl)service.getGroupHandler());
while (iterator.hasNext())
{
Node oldGroupNode = iterator.nextNode();
gh.migrateGroup(oldGroupNode);
migrateGroups(oldGroupNode);
}
}
}
finally
{
session.logout();
}
} | java | private void migrateGroups() throws Exception
{
Session session = service.getStorageSession();
try
{
if (session.itemExists(groupsStorageOld))
{
NodeIterator iterator = ((ExtendedNode)session.getItem(groupsStorageOld)).getNodesLazily();
GroupHandlerImpl gh = ((GroupHandlerImpl)service.getGroupHandler());
while (iterator.hasNext())
{
Node oldGroupNode = iterator.nextNode();
gh.migrateGroup(oldGroupNode);
migrateGroups(oldGroupNode);
}
}
}
finally
{
session.logout();
}
} | [
"private",
"void",
"migrateGroups",
"(",
")",
"throws",
"Exception",
"{",
"Session",
"session",
"=",
"service",
".",
"getStorageSession",
"(",
")",
";",
"try",
"{",
"if",
"(",
"session",
".",
"itemExists",
"(",
"groupsStorageOld",
")",
")",
"{",
"NodeIterato... | Method for groups migration. Must be run after users and membershipTypes migration.
@throws Exception | [
"Method",
"for",
"groups",
"migration",
".",
"Must",
"be",
"run",
"after",
"users",
"and",
"membershipTypes",
"migration",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java#L275-L296 |
136,233 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java | MigrationTool.migrateGroups | private void migrateGroups(Node startNode) throws Exception
{
NodeIterator iterator = ((ExtendedNode)startNode).getNodesLazily();
GroupHandlerImpl gh = ((GroupHandlerImpl)service.getGroupHandler());
while (iterator.hasNext())
{
Node oldGroupNode = iterator.nextNode();
gh.migrateGroup(oldGroupNode);
migrateGroups(oldGroupNode);
}
} | java | private void migrateGroups(Node startNode) throws Exception
{
NodeIterator iterator = ((ExtendedNode)startNode).getNodesLazily();
GroupHandlerImpl gh = ((GroupHandlerImpl)service.getGroupHandler());
while (iterator.hasNext())
{
Node oldGroupNode = iterator.nextNode();
gh.migrateGroup(oldGroupNode);
migrateGroups(oldGroupNode);
}
} | [
"private",
"void",
"migrateGroups",
"(",
"Node",
"startNode",
")",
"throws",
"Exception",
"{",
"NodeIterator",
"iterator",
"=",
"(",
"(",
"ExtendedNode",
")",
"startNode",
")",
".",
"getNodesLazily",
"(",
")",
";",
"GroupHandlerImpl",
"gh",
"=",
"(",
"(",
"G... | Method for groups migration.
@throws Exception | [
"Method",
"for",
"groups",
"migration",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java#L302-L313 |
136,234 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java | MigrationTool.migrateMembershipTypes | private void migrateMembershipTypes() throws Exception
{
Session session = service.getStorageSession();
try
{
if (session.itemExists(membershipTypesStorageOld))
{
NodeIterator iterator = ((ExtendedNode)session.getItem(membershipTypesStorageOld)).getNodesLazily();
MembershipTypeHandlerImpl mth = ((MembershipTypeHandlerImpl)service.getMembershipTypeHandler());
while (iterator.hasNext())
{
Node oldTypeNode = iterator.nextNode();
mth.migrateMembershipType(oldTypeNode);
}
}
}
finally
{
session.logout();
}
} | java | private void migrateMembershipTypes() throws Exception
{
Session session = service.getStorageSession();
try
{
if (session.itemExists(membershipTypesStorageOld))
{
NodeIterator iterator = ((ExtendedNode)session.getItem(membershipTypesStorageOld)).getNodesLazily();
MembershipTypeHandlerImpl mth = ((MembershipTypeHandlerImpl)service.getMembershipTypeHandler());
while (iterator.hasNext())
{
Node oldTypeNode = iterator.nextNode();
mth.migrateMembershipType(oldTypeNode);
}
}
}
finally
{
session.logout();
}
} | [
"private",
"void",
"migrateMembershipTypes",
"(",
")",
"throws",
"Exception",
"{",
"Session",
"session",
"=",
"service",
".",
"getStorageSession",
"(",
")",
";",
"try",
"{",
"if",
"(",
"session",
".",
"itemExists",
"(",
"membershipTypesStorageOld",
")",
")",
"... | Method for membershipTypes migration.
@throws Exception | [
"Method",
"for",
"membershipTypes",
"migration",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java#L319-L339 |
136,235 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java | MigrationTool.migrateProfiles | private void migrateProfiles() throws Exception
{
Session session = service.getStorageSession();
try
{
if (session.itemExists(usersStorageOld))
{
NodeIterator iterator = ((ExtendedNode)session.getItem(usersStorageOld)).getNodesLazily();
UserProfileHandlerImpl uph = ((UserProfileHandlerImpl)service.getUserProfileHandler());
while (iterator.hasNext())
{
Node oldUserNode = iterator.nextNode();
uph.migrateProfile(oldUserNode);
}
}
}
finally
{
session.logout();
}
} | java | private void migrateProfiles() throws Exception
{
Session session = service.getStorageSession();
try
{
if (session.itemExists(usersStorageOld))
{
NodeIterator iterator = ((ExtendedNode)session.getItem(usersStorageOld)).getNodesLazily();
UserProfileHandlerImpl uph = ((UserProfileHandlerImpl)service.getUserProfileHandler());
while (iterator.hasNext())
{
Node oldUserNode = iterator.nextNode();
uph.migrateProfile(oldUserNode);
}
}
}
finally
{
session.logout();
}
} | [
"private",
"void",
"migrateProfiles",
"(",
")",
"throws",
"Exception",
"{",
"Session",
"session",
"=",
"service",
".",
"getStorageSession",
"(",
")",
";",
"try",
"{",
"if",
"(",
"session",
".",
"itemExists",
"(",
"usersStorageOld",
")",
")",
"{",
"NodeIterat... | Method for profiles migration.
@throws Exception | [
"Method",
"for",
"profiles",
"migration",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java#L345-L366 |
136,236 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java | MigrationTool.migrateMemberships | private void migrateMemberships() throws Exception
{
Session session = service.getStorageSession();
try
{
if (session.itemExists(usersStorageOld))
{
NodeIterator iterator = ((ExtendedNode)session.getItem(usersStorageOld)).getNodesLazily();
MembershipHandlerImpl mh = ((MembershipHandlerImpl)service.getMembershipHandler());
while (iterator.hasNext())
{
Node oldUserNode = iterator.nextNode();
mh.migrateMemberships(oldUserNode);
oldUserNode.remove();
session.save();
}
}
}
finally
{
session.logout();
}
} | java | private void migrateMemberships() throws Exception
{
Session session = service.getStorageSession();
try
{
if (session.itemExists(usersStorageOld))
{
NodeIterator iterator = ((ExtendedNode)session.getItem(usersStorageOld)).getNodesLazily();
MembershipHandlerImpl mh = ((MembershipHandlerImpl)service.getMembershipHandler());
while (iterator.hasNext())
{
Node oldUserNode = iterator.nextNode();
mh.migrateMemberships(oldUserNode);
oldUserNode.remove();
session.save();
}
}
}
finally
{
session.logout();
}
} | [
"private",
"void",
"migrateMemberships",
"(",
")",
"throws",
"Exception",
"{",
"Session",
"session",
"=",
"service",
".",
"getStorageSession",
"(",
")",
";",
"try",
"{",
"if",
"(",
"session",
".",
"itemExists",
"(",
"usersStorageOld",
")",
")",
"{",
"NodeIte... | Method for memberships migration.
@throws Exception | [
"Method",
"for",
"memberships",
"migration",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java#L372-L394 |
136,237 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java | NodeIndexer.addBooleanValue | protected void addBooleanValue(Document doc, String fieldName, Object internalValue)
{
doc.add(createFieldWithoutNorms(fieldName, internalValue.toString(), PropertyType.BOOLEAN));
} | java | protected void addBooleanValue(Document doc, String fieldName, Object internalValue)
{
doc.add(createFieldWithoutNorms(fieldName, internalValue.toString(), PropertyType.BOOLEAN));
} | [
"protected",
"void",
"addBooleanValue",
"(",
"Document",
"doc",
",",
"String",
"fieldName",
",",
"Object",
"internalValue",
")",
"{",
"doc",
".",
"add",
"(",
"createFieldWithoutNorms",
"(",
"fieldName",
",",
"internalValue",
".",
"toString",
"(",
")",
",",
"Pr... | Adds the string representation of the boolean value to the document as
the named field.
@param doc The document to which to add the field
@param fieldName The name of the field to add
@param internalValue The value for the field to add to the document. | [
"Adds",
"the",
"string",
"representation",
"of",
"the",
"boolean",
"value",
"to",
"the",
"document",
"as",
"the",
"named",
"field",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L695-L698 |
136,238 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java | NodeIndexer.addReferenceValue | protected void addReferenceValue(Document doc, String fieldName, Object internalValue)
{
String uuid = internalValue.toString();
doc.add(createFieldWithoutNorms(fieldName, uuid, PropertyType.REFERENCE));
doc.add(new Field(FieldNames.PROPERTIES, FieldNames.createNamedValue(fieldName, uuid), Field.Store.YES,
Field.Index.NO, Field.TermVector.NO));
} | java | protected void addReferenceValue(Document doc, String fieldName, Object internalValue)
{
String uuid = internalValue.toString();
doc.add(createFieldWithoutNorms(fieldName, uuid, PropertyType.REFERENCE));
doc.add(new Field(FieldNames.PROPERTIES, FieldNames.createNamedValue(fieldName, uuid), Field.Store.YES,
Field.Index.NO, Field.TermVector.NO));
} | [
"protected",
"void",
"addReferenceValue",
"(",
"Document",
"doc",
",",
"String",
"fieldName",
",",
"Object",
"internalValue",
")",
"{",
"String",
"uuid",
"=",
"internalValue",
".",
"toString",
"(",
")",
";",
"doc",
".",
"add",
"(",
"createFieldWithoutNorms",
"... | Adds the reference value to the document as the named field. The value's
string representation is added as the reference data. Additionally the
reference data is stored in the index.
@param doc The document to which to add the field
@param fieldName The name of the field to add
@param internalValue The value for the field to add to the document. | [
"Adds",
"the",
"reference",
"value",
"to",
"the",
"document",
"as",
"the",
"named",
"field",
".",
"The",
"value",
"s",
"string",
"representation",
"is",
"added",
"as",
"the",
"reference",
"data",
".",
"Additionally",
"the",
"reference",
"data",
"is",
"stored... | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L790-L796 |
136,239 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java | NodeIndexer.addPathValue | protected void addPathValue(Document doc, String fieldName, Object pathString)
{
doc.add(createFieldWithoutNorms(fieldName, pathString.toString(), PropertyType.PATH));
} | java | protected void addPathValue(Document doc, String fieldName, Object pathString)
{
doc.add(createFieldWithoutNorms(fieldName, pathString.toString(), PropertyType.PATH));
} | [
"protected",
"void",
"addPathValue",
"(",
"Document",
"doc",
",",
"String",
"fieldName",
",",
"Object",
"pathString",
")",
"{",
"doc",
".",
"add",
"(",
"createFieldWithoutNorms",
"(",
"fieldName",
",",
"pathString",
".",
"toString",
"(",
")",
",",
"PropertyTyp... | Adds the path value to the document as the named field. The path
value is converted to an indexable string value using the name space
mappings with which this class has been created.
@param doc The document to which to add the field
@param fieldName The name of the field to add
@param pathString The value for the field to add to the document. | [
"Adds",
"the",
"path",
"value",
"to",
"the",
"document",
"as",
"the",
"named",
"field",
".",
"The",
"path",
"value",
"is",
"converted",
"to",
"an",
"indexable",
"string",
"value",
"using",
"the",
"name",
"space",
"mappings",
"with",
"which",
"this",
"class... | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L807-L811 |
136,240 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java | NodeIndexer.addNameValue | protected void addNameValue(Document doc, String fieldName, Object internalValue)
{
doc.add(createFieldWithoutNorms(fieldName, internalValue.toString(), PropertyType.NAME));
} | java | protected void addNameValue(Document doc, String fieldName, Object internalValue)
{
doc.add(createFieldWithoutNorms(fieldName, internalValue.toString(), PropertyType.NAME));
} | [
"protected",
"void",
"addNameValue",
"(",
"Document",
"doc",
",",
"String",
"fieldName",
",",
"Object",
"internalValue",
")",
"{",
"doc",
".",
"add",
"(",
"createFieldWithoutNorms",
"(",
"fieldName",
",",
"internalValue",
".",
"toString",
"(",
")",
",",
"Prope... | Adds the name value to the document as the named field. The name
value is converted to an indexable string treating the internal value
as a qualified name and mapping the name space using the name space
mappings with which this class has been created.
@param doc The document to which to add the field
@param fieldName The name of the field to add
@param internalValue The value for the field to add to the document. | [
"Adds",
"the",
"name",
"value",
"to",
"the",
"document",
"as",
"the",
"named",
"field",
".",
"The",
"name",
"value",
"is",
"converted",
"to",
"an",
"indexable",
"string",
"treating",
"the",
"internal",
"value",
"as",
"a",
"qualified",
"name",
"and",
"mappi... | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L894-L897 |
136,241 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java | NodeIndexer.getPropertyBoost | protected float getPropertyBoost(InternalQName propertyName)
{
if (indexingConfig == null)
{
return DEFAULT_BOOST;
}
else
{
return indexingConfig.getPropertyBoost(node, propertyName);
}
} | java | protected float getPropertyBoost(InternalQName propertyName)
{
if (indexingConfig == null)
{
return DEFAULT_BOOST;
}
else
{
return indexingConfig.getPropertyBoost(node, propertyName);
}
} | [
"protected",
"float",
"getPropertyBoost",
"(",
"InternalQName",
"propertyName",
")",
"{",
"if",
"(",
"indexingConfig",
"==",
"null",
")",
"{",
"return",
"DEFAULT_BOOST",
";",
"}",
"else",
"{",
"return",
"indexingConfig",
".",
"getPropertyBoost",
"(",
"node",
","... | Returns the boost value for the given property name.
@param propertyName the name of a property.
@return the boost value for the given property name. | [
"Returns",
"the",
"boost",
"value",
"for",
"the",
"given",
"property",
"name",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L997-L1007 |
136,242 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java | NodeIndexer.addNodeName | protected void addNodeName(Document doc, String namespaceURI, String localName) throws RepositoryException
{
String name = mappings.getNamespacePrefixByURI(namespaceURI) + ":" + localName;
doc.add(new Field(FieldNames.LABEL, name, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
// as of version 3, also index combination of namespace URI and local name
if (indexFormatVersion.getVersion() >= IndexFormatVersion.V3.getVersion())
{
doc.add(new Field(FieldNames.NAMESPACE_URI, namespaceURI, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
doc.add(new Field(FieldNames.LOCAL_NAME, localName, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
}
} | java | protected void addNodeName(Document doc, String namespaceURI, String localName) throws RepositoryException
{
String name = mappings.getNamespacePrefixByURI(namespaceURI) + ":" + localName;
doc.add(new Field(FieldNames.LABEL, name, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
// as of version 3, also index combination of namespace URI and local name
if (indexFormatVersion.getVersion() >= IndexFormatVersion.V3.getVersion())
{
doc.add(new Field(FieldNames.NAMESPACE_URI, namespaceURI, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
doc.add(new Field(FieldNames.LOCAL_NAME, localName, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
}
} | [
"protected",
"void",
"addNodeName",
"(",
"Document",
"doc",
",",
"String",
"namespaceURI",
",",
"String",
"localName",
")",
"throws",
"RepositoryException",
"{",
"String",
"name",
"=",
"mappings",
".",
"getNamespacePrefixByURI",
"(",
"namespaceURI",
")",
"+",
"\":... | Depending on the index format version adds one or two fields to the
document for the node name.
@param doc the lucene document.
@param namespaceURI the namespace URI of the node name.
@param localName the local name of the node.
@throws RepositoryException | [
"Depending",
"on",
"the",
"index",
"format",
"version",
"adds",
"one",
"or",
"two",
"fields",
"to",
"the",
"document",
"for",
"the",
"node",
"name",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L1052-L1062 |
136,243 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java | ValueFileIOHelper.writeValue | protected long writeValue(File file, ValueData value) throws IOException
{
if (value.isByteArray())
{
return writeByteArrayValue(file, value);
}
else
{
return writeStreamedValue(file, value);
}
} | java | protected long writeValue(File file, ValueData value) throws IOException
{
if (value.isByteArray())
{
return writeByteArrayValue(file, value);
}
else
{
return writeStreamedValue(file, value);
}
} | [
"protected",
"long",
"writeValue",
"(",
"File",
"file",
",",
"ValueData",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"value",
".",
"isByteArray",
"(",
")",
")",
"{",
"return",
"writeByteArrayValue",
"(",
"file",
",",
"value",
")",
";",
"}",
"... | Write value to a file.
@param file
File
@param value
ValueData
@return size of wrote content
@throws IOException
if error occurs | [
"Write",
"value",
"to",
"a",
"file",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java#L71-L81 |
136,244 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java | ValueFileIOHelper.writeByteArrayValue | protected long writeByteArrayValue(File file, ValueData value) throws IOException
{
OutputStream out = new FileOutputStream(file);
try
{
byte[] data = value.getAsByteArray();
out.write(data);
return data.length;
}
finally
{
out.close();
}
} | java | protected long writeByteArrayValue(File file, ValueData value) throws IOException
{
OutputStream out = new FileOutputStream(file);
try
{
byte[] data = value.getAsByteArray();
out.write(data);
return data.length;
}
finally
{
out.close();
}
} | [
"protected",
"long",
"writeByteArrayValue",
"(",
"File",
"file",
",",
"ValueData",
"value",
")",
"throws",
"IOException",
"{",
"OutputStream",
"out",
"=",
"new",
"FileOutputStream",
"(",
"file",
")",
";",
"try",
"{",
"byte",
"[",
"]",
"data",
"=",
"value",
... | Write value array of bytes to a file.
@param file
File
@param value
ValueData
@return size of wrote content
@throws IOException
if error occurs | [
"Write",
"value",
"array",
"of",
"bytes",
"to",
"a",
"file",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java#L94-L108 |
136,245 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java | ValueFileIOHelper.writeStreamedValue | protected long writeStreamedValue(File file, ValueData value) throws IOException
{
long size;
// stream Value
if (value instanceof StreamPersistedValueData)
{
StreamPersistedValueData streamed = (StreamPersistedValueData)value;
if (streamed.isPersisted())
{
// already persisted in another Value, copy it to this Value
size = copyClose(streamed.getAsStream(), new FileOutputStream(file));
}
else
{
// the Value not yet persisted, i.e. or in client stream or spooled to a temp file
File tempFile;
if ((tempFile = streamed.getTempFile()) != null)
{
// it's spooled Value, try move its file to VS
if (!tempFile.renameTo(file))
{
// not succeeded - copy bytes, temp file will be deleted by transient ValueData
if (LOG.isDebugEnabled())
{
LOG.debug("Value spool file move (rename) to Values Storage is not succeeded. "
+ "Trying bytes copy. Spool file: " + tempFile.getAbsolutePath() + ". Destination: "
+ file.getAbsolutePath());
}
size = copyClose(new FileInputStream(tempFile), new FileOutputStream(file));
}
else
{
size = file.length();
}
}
else
{
// not spooled, use client InputStream
size = copyClose(streamed.getStream(), new FileOutputStream(file));
}
// link this Value to file in VS
streamed.setPersistedFile(file);
}
}
else
{
// copy from Value stream to the file, e.g. from FilePersistedValueData to this Value
size = copyClose(value.getAsStream(), new FileOutputStream(file));
}
return size;
} | java | protected long writeStreamedValue(File file, ValueData value) throws IOException
{
long size;
// stream Value
if (value instanceof StreamPersistedValueData)
{
StreamPersistedValueData streamed = (StreamPersistedValueData)value;
if (streamed.isPersisted())
{
// already persisted in another Value, copy it to this Value
size = copyClose(streamed.getAsStream(), new FileOutputStream(file));
}
else
{
// the Value not yet persisted, i.e. or in client stream or spooled to a temp file
File tempFile;
if ((tempFile = streamed.getTempFile()) != null)
{
// it's spooled Value, try move its file to VS
if (!tempFile.renameTo(file))
{
// not succeeded - copy bytes, temp file will be deleted by transient ValueData
if (LOG.isDebugEnabled())
{
LOG.debug("Value spool file move (rename) to Values Storage is not succeeded. "
+ "Trying bytes copy. Spool file: " + tempFile.getAbsolutePath() + ". Destination: "
+ file.getAbsolutePath());
}
size = copyClose(new FileInputStream(tempFile), new FileOutputStream(file));
}
else
{
size = file.length();
}
}
else
{
// not spooled, use client InputStream
size = copyClose(streamed.getStream(), new FileOutputStream(file));
}
// link this Value to file in VS
streamed.setPersistedFile(file);
}
}
else
{
// copy from Value stream to the file, e.g. from FilePersistedValueData to this Value
size = copyClose(value.getAsStream(), new FileOutputStream(file));
}
return size;
} | [
"protected",
"long",
"writeStreamedValue",
"(",
"File",
"file",
",",
"ValueData",
"value",
")",
"throws",
"IOException",
"{",
"long",
"size",
";",
"// stream Value\r",
"if",
"(",
"value",
"instanceof",
"StreamPersistedValueData",
")",
"{",
"StreamPersistedValueData",
... | Write streamed value to a file.
@param file
File
@param value
ValueData
@return size of wrote content
@throws IOException
if error occurs | [
"Write",
"streamed",
"value",
"to",
"a",
"file",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java#L121-L176 |
136,246 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java | ValueFileIOHelper.writeOutput | protected long writeOutput(OutputStream out, ValueData value) throws IOException
{
if (value.isByteArray())
{
byte[] buff = value.getAsByteArray();
out.write(buff);
return buff.length;
}
else
{
InputStream in;
if (value instanceof StreamPersistedValueData)
{
StreamPersistedValueData streamed = (StreamPersistedValueData)value;
if (streamed.isPersisted())
{
// already persisted in another Value, copy it to this Value
in = streamed.getAsStream();
}
else
{
in = streamed.getStream();
if (in == null)
{
in = new FileInputStream(streamed.getTempFile());
}
}
}
else
{
in = value.getAsStream();
}
try
{
return copy(in, out);
}
finally
{
in.close();
}
}
} | java | protected long writeOutput(OutputStream out, ValueData value) throws IOException
{
if (value.isByteArray())
{
byte[] buff = value.getAsByteArray();
out.write(buff);
return buff.length;
}
else
{
InputStream in;
if (value instanceof StreamPersistedValueData)
{
StreamPersistedValueData streamed = (StreamPersistedValueData)value;
if (streamed.isPersisted())
{
// already persisted in another Value, copy it to this Value
in = streamed.getAsStream();
}
else
{
in = streamed.getStream();
if (in == null)
{
in = new FileInputStream(streamed.getTempFile());
}
}
}
else
{
in = value.getAsStream();
}
try
{
return copy(in, out);
}
finally
{
in.close();
}
}
} | [
"protected",
"long",
"writeOutput",
"(",
"OutputStream",
"out",
",",
"ValueData",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"value",
".",
"isByteArray",
"(",
")",
")",
"{",
"byte",
"[",
"]",
"buff",
"=",
"value",
".",
"getAsByteArray",
"(",
... | Stream value data to the output.
@param out
OutputStream
@param value
ValueData
@throws IOException
if error occurs | [
"Stream",
"value",
"data",
"to",
"the",
"output",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java#L188-L232 |
136,247 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java | ValueFileIOHelper.copy | protected long copy(InputStream in, OutputStream out) throws IOException
{
// compare classes as in Java6 Channels.newChannel(), Java5 has a bug in newChannel().
boolean inFile = in instanceof FileInputStream && FileInputStream.class.equals(in.getClass());
boolean outFile = out instanceof FileOutputStream && FileOutputStream.class.equals(out.getClass());
if (inFile && outFile)
{
// it's user file
FileChannel infch = ((FileInputStream)in).getChannel();
FileChannel outfch = ((FileOutputStream)out).getChannel();
long size = 0;
long r = 0;
do
{
r = outfch.transferFrom(infch, r, infch.size());
size += r;
}
while (r < infch.size());
return size;
}
else
{
// it's user stream (not a file)
ReadableByteChannel inch = inFile ? ((FileInputStream)in).getChannel() : Channels.newChannel(in);
WritableByteChannel outch = outFile ? ((FileOutputStream)out).getChannel() : Channels.newChannel(out);
long size = 0;
int r = 0;
ByteBuffer buff = ByteBuffer.allocate(IOBUFFER_SIZE);
buff.clear();
while ((r = inch.read(buff)) >= 0)
{
buff.flip();
// copy all
do
{
outch.write(buff);
}
while (buff.hasRemaining());
buff.clear();
size += r;
}
if (outFile)
((FileChannel)outch).force(true); // force all data to FS
return size;
}
} | java | protected long copy(InputStream in, OutputStream out) throws IOException
{
// compare classes as in Java6 Channels.newChannel(), Java5 has a bug in newChannel().
boolean inFile = in instanceof FileInputStream && FileInputStream.class.equals(in.getClass());
boolean outFile = out instanceof FileOutputStream && FileOutputStream.class.equals(out.getClass());
if (inFile && outFile)
{
// it's user file
FileChannel infch = ((FileInputStream)in).getChannel();
FileChannel outfch = ((FileOutputStream)out).getChannel();
long size = 0;
long r = 0;
do
{
r = outfch.transferFrom(infch, r, infch.size());
size += r;
}
while (r < infch.size());
return size;
}
else
{
// it's user stream (not a file)
ReadableByteChannel inch = inFile ? ((FileInputStream)in).getChannel() : Channels.newChannel(in);
WritableByteChannel outch = outFile ? ((FileOutputStream)out).getChannel() : Channels.newChannel(out);
long size = 0;
int r = 0;
ByteBuffer buff = ByteBuffer.allocate(IOBUFFER_SIZE);
buff.clear();
while ((r = inch.read(buff)) >= 0)
{
buff.flip();
// copy all
do
{
outch.write(buff);
}
while (buff.hasRemaining());
buff.clear();
size += r;
}
if (outFile)
((FileChannel)outch).force(true); // force all data to FS
return size;
}
} | [
"protected",
"long",
"copy",
"(",
"InputStream",
"in",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"// compare classes as in Java6 Channels.newChannel(), Java5 has a bug in newChannel().\r",
"boolean",
"inFile",
"=",
"in",
"instanceof",
"FileInputStream",
"... | Copy input to output data using NIO.
@param in
InputStream
@param out
OutputStream
@return The number of bytes, possibly zero, that were actually copied
@throws IOException
if error occurs | [
"Copy",
"input",
"to",
"output",
"data",
"using",
"NIO",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java#L245-L296 |
136,248 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java | ValueFileIOHelper.copyClose | protected long copyClose(InputStream in, OutputStream out) throws IOException
{
try
{
try
{
return copy(in, out);
}
finally
{
in.close();
}
}
finally
{
out.close();
}
} | java | protected long copyClose(InputStream in, OutputStream out) throws IOException
{
try
{
try
{
return copy(in, out);
}
finally
{
in.close();
}
}
finally
{
out.close();
}
} | [
"protected",
"long",
"copyClose",
"(",
"InputStream",
"in",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"try",
"{",
"try",
"{",
"return",
"copy",
"(",
"in",
",",
"out",
")",
";",
"}",
"finally",
"{",
"in",
".",
"close",
"(",
")",
"... | Copy input to output data using NIO. Input and output streams will be closed after the
operation.
@param in
InputStream
@param out
OutputStream
@return The number of bytes, possibly zero, that were actually copied
@throws IOException
if error occurs | [
"Copy",
"input",
"to",
"output",
"data",
"using",
"NIO",
".",
"Input",
"and",
"output",
"streams",
"will",
"be",
"closed",
"after",
"the",
"operation",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java#L310-L327 |
136,249 | exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/deltav/ReportCommand.java | ReportCommand.report | public Response report(Session session, String path, HierarchicalProperty body, Depth depth, String baseURI)
{
try
{
Node node = (Node)session.getItem(path);
WebDavNamespaceContext nsContext = new WebDavNamespaceContext(session);
String strUri = baseURI + node.getPath();
URI uri = new URI(TextUtil.escape(strUri, '%', true));
if (!ResourceUtil.isVersioned(node))
{
return Response.status(HTTPStatus.PRECON_FAILED).build();
}
VersionedResource resource;
if (ResourceUtil.isFile(node))
{
resource = new VersionedFileResource(uri, node, nsContext);
}
else
{
resource = new VersionedCollectionResource(uri, node, nsContext);
}
Set<QName> properties = getProperties(body);
VersionTreeResponseEntity response = new VersionTreeResponseEntity(nsContext, resource, properties);
return Response.status(HTTPStatus.MULTISTATUS).entity(response).build();
}
catch (PathNotFoundException exc)
{
return Response.status(HTTPStatus.NOT_FOUND).entity(exc.getMessage()).build();
}
catch (RepositoryException exc)
{
LOG.error(exc.getMessage(), exc);
return Response.serverError().entity(exc.getMessage()).build();
}
catch (Exception exc)
{
LOG.error(exc.getMessage(), exc);
return Response.serverError().entity(exc.getMessage()).build();
}
} | java | public Response report(Session session, String path, HierarchicalProperty body, Depth depth, String baseURI)
{
try
{
Node node = (Node)session.getItem(path);
WebDavNamespaceContext nsContext = new WebDavNamespaceContext(session);
String strUri = baseURI + node.getPath();
URI uri = new URI(TextUtil.escape(strUri, '%', true));
if (!ResourceUtil.isVersioned(node))
{
return Response.status(HTTPStatus.PRECON_FAILED).build();
}
VersionedResource resource;
if (ResourceUtil.isFile(node))
{
resource = new VersionedFileResource(uri, node, nsContext);
}
else
{
resource = new VersionedCollectionResource(uri, node, nsContext);
}
Set<QName> properties = getProperties(body);
VersionTreeResponseEntity response = new VersionTreeResponseEntity(nsContext, resource, properties);
return Response.status(HTTPStatus.MULTISTATUS).entity(response).build();
}
catch (PathNotFoundException exc)
{
return Response.status(HTTPStatus.NOT_FOUND).entity(exc.getMessage()).build();
}
catch (RepositoryException exc)
{
LOG.error(exc.getMessage(), exc);
return Response.serverError().entity(exc.getMessage()).build();
}
catch (Exception exc)
{
LOG.error(exc.getMessage(), exc);
return Response.serverError().entity(exc.getMessage()).build();
}
} | [
"public",
"Response",
"report",
"(",
"Session",
"session",
",",
"String",
"path",
",",
"HierarchicalProperty",
"body",
",",
"Depth",
"depth",
",",
"String",
"baseURI",
")",
"{",
"try",
"{",
"Node",
"node",
"=",
"(",
"Node",
")",
"session",
".",
"getItem",
... | Webdav Report method implementation.
@param session current session
@param path resource path
@param body request bidy
@param depth report depth
@param baseURI base Uri
@return the instance of javax.ws.rs.core.Response | [
"Webdav",
"Report",
"method",
"implementation",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/deltav/ReportCommand.java#L70-L115 |
136,250 | exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/deltav/ReportCommand.java | ReportCommand.getProperties | protected Set<QName> getProperties(HierarchicalProperty body)
{
HashSet<QName> properties = new HashSet<QName>();
HierarchicalProperty prop = body.getChild(new QName("DAV:", "prop"));
if (prop == null)
{
return properties;
}
for (int i = 0; i < prop.getChildren().size(); i++)
{
HierarchicalProperty property = prop.getChild(i);
properties.add(property.getName());
}
return properties;
} | java | protected Set<QName> getProperties(HierarchicalProperty body)
{
HashSet<QName> properties = new HashSet<QName>();
HierarchicalProperty prop = body.getChild(new QName("DAV:", "prop"));
if (prop == null)
{
return properties;
}
for (int i = 0; i < prop.getChildren().size(); i++)
{
HierarchicalProperty property = prop.getChild(i);
properties.add(property.getName());
}
return properties;
} | [
"protected",
"Set",
"<",
"QName",
">",
"getProperties",
"(",
"HierarchicalProperty",
"body",
")",
"{",
"HashSet",
"<",
"QName",
">",
"properties",
"=",
"new",
"HashSet",
"<",
"QName",
">",
"(",
")",
";",
"HierarchicalProperty",
"prop",
"=",
"body",
".",
"g... | Returns the list of properties.
@param body request body
@return the list of properties | [
"Returns",
"the",
"list",
"of",
"properties",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/deltav/ReportCommand.java#L123-L140 |
136,251 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/CNDStreamWriter.java | CNDStreamWriter.write | public void write(List<NodeTypeData> nodeTypes, OutputStream os) throws RepositoryException
{
OutputStreamWriter out = new OutputStreamWriter(os);
try
{
for (NodeTypeData nodeType : nodeTypes)
{
printNamespaces(nodeType, out);
printNodeTypeDeclaration(nodeType, out);
}
out.close();
}
catch (IOException e)
{
throw new RepositoryException(e.getMessage(), e);
}
} | java | public void write(List<NodeTypeData> nodeTypes, OutputStream os) throws RepositoryException
{
OutputStreamWriter out = new OutputStreamWriter(os);
try
{
for (NodeTypeData nodeType : nodeTypes)
{
printNamespaces(nodeType, out);
printNodeTypeDeclaration(nodeType, out);
}
out.close();
}
catch (IOException e)
{
throw new RepositoryException(e.getMessage(), e);
}
} | [
"public",
"void",
"write",
"(",
"List",
"<",
"NodeTypeData",
">",
"nodeTypes",
",",
"OutputStream",
"os",
")",
"throws",
"RepositoryException",
"{",
"OutputStreamWriter",
"out",
"=",
"new",
"OutputStreamWriter",
"(",
"os",
")",
";",
"try",
"{",
"for",
"(",
"... | Write given list of node types to output stream.
@param nodeTypes
List of NodeTypes to write.
@param os
OutputStream to write to.
@throws RepositoryException | [
"Write",
"given",
"list",
"of",
"node",
"types",
"to",
"output",
"stream",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/CNDStreamWriter.java#L82-L99 |
136,252 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/CNDStreamWriter.java | CNDStreamWriter.printNamespaces | private void printNamespaces(NodeTypeData nodeTypeData, OutputStreamWriter out) throws RepositoryException,
IOException
{
/**
* Using set to store all prefixes found in node types to avoid
* duplication
*/
Set<String> namespaces = new HashSet<String>();
/** Scanning nodeType definition for used namespaces */
printNameNamespace(nodeTypeData.getName(), namespaces);
printNameNamespace(nodeTypeData.getPrimaryItemName(), namespaces);
if (nodeTypeData.getDeclaredSupertypeNames() != null)
{
for (InternalQName reqType : nodeTypeData.getDeclaredSupertypeNames())
{
printNameNamespace(reqType, namespaces);
}
}
/** Scanning property definitions for used namespaces */
if (nodeTypeData.getDeclaredPropertyDefinitions() != null)
{
for (PropertyDefinitionData property : nodeTypeData.getDeclaredPropertyDefinitions())
{
printNameNamespace(property.getName(), namespaces);
}
}
/** Scanning child definitions for used namespaces */
if (nodeTypeData.getDeclaredChildNodeDefinitions() != null)
{
for (NodeDefinitionData child : nodeTypeData.getDeclaredChildNodeDefinitions())
{
printNameNamespace(child.getName(), namespaces);
printNameNamespace(child.getDefaultPrimaryType(), namespaces);
if (child.getRequiredPrimaryTypes() != null)
{
for (InternalQName reqType : child.getRequiredPrimaryTypes())
{
printNameNamespace(reqType, namespaces);
}
}
}
}
for (String prefix : namespaces)
{
String uri = namespaceRegistry.getURI(prefix);
out.write("<" + prefix + "='" + uri + "'>\r\n");
}
} | java | private void printNamespaces(NodeTypeData nodeTypeData, OutputStreamWriter out) throws RepositoryException,
IOException
{
/**
* Using set to store all prefixes found in node types to avoid
* duplication
*/
Set<String> namespaces = new HashSet<String>();
/** Scanning nodeType definition for used namespaces */
printNameNamespace(nodeTypeData.getName(), namespaces);
printNameNamespace(nodeTypeData.getPrimaryItemName(), namespaces);
if (nodeTypeData.getDeclaredSupertypeNames() != null)
{
for (InternalQName reqType : nodeTypeData.getDeclaredSupertypeNames())
{
printNameNamespace(reqType, namespaces);
}
}
/** Scanning property definitions for used namespaces */
if (nodeTypeData.getDeclaredPropertyDefinitions() != null)
{
for (PropertyDefinitionData property : nodeTypeData.getDeclaredPropertyDefinitions())
{
printNameNamespace(property.getName(), namespaces);
}
}
/** Scanning child definitions for used namespaces */
if (nodeTypeData.getDeclaredChildNodeDefinitions() != null)
{
for (NodeDefinitionData child : nodeTypeData.getDeclaredChildNodeDefinitions())
{
printNameNamespace(child.getName(), namespaces);
printNameNamespace(child.getDefaultPrimaryType(), namespaces);
if (child.getRequiredPrimaryTypes() != null)
{
for (InternalQName reqType : child.getRequiredPrimaryTypes())
{
printNameNamespace(reqType, namespaces);
}
}
}
}
for (String prefix : namespaces)
{
String uri = namespaceRegistry.getURI(prefix);
out.write("<" + prefix + "='" + uri + "'>\r\n");
}
} | [
"private",
"void",
"printNamespaces",
"(",
"NodeTypeData",
"nodeTypeData",
",",
"OutputStreamWriter",
"out",
")",
"throws",
"RepositoryException",
",",
"IOException",
"{",
"/**\n * Using set to store all prefixes found in node types to avoid\n * duplication\n */",
"... | Print namespaces to stream
@param nodeTypeData
@param out
@throws RepositoryException
@throws IOException | [
"Print",
"namespaces",
"to",
"stream"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/CNDStreamWriter.java#L109-L157 |
136,253 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/CNDStreamWriter.java | CNDStreamWriter.printNodeTypeDeclaration | private void printNodeTypeDeclaration(NodeTypeData nodeTypeData, OutputStreamWriter out) throws RepositoryException,
IOException
{
/** Print name */
out.write("[" + qNameToString(nodeTypeData.getName()) + "] ");
/** Print supertypes */
InternalQName[] superTypes = nodeTypeData.getDeclaredSupertypeNames();
if (superTypes != null && superTypes.length > 0)
{
/** if there is only 1 element and it is NT_BASE then avoid printing it */
if (superTypes.length > 1 || !superTypes[0].equals(Constants.NT_BASE))
{
out.write("> " + qNameToString(superTypes[0]));
for (int i = 1; i < superTypes.length; i++)
{
out.write(", " + qNameToString(superTypes[i]));
}
}
}
/** Print attributes */
StringBuilder attributes = new StringBuilder();
// if (nodeTypeData.isAbstract())
// {
// attributes += "abstract ";
// }
if (nodeTypeData.hasOrderableChildNodes())
{
attributes.append("orderable ");
}
if (nodeTypeData.isMixin())
{
attributes.append("mixin ");
}
// if (!nodeTypeData.isQueryable())
// {
// attributes += "noquery ";
// }
if (nodeTypeData.getPrimaryItemName() != null)
{
attributes.append("primaryitem " + qNameToString(nodeTypeData.getPrimaryItemName()));
}
if (attributes.length() > 0)
{
out.write("\r\n ");
out.write(attributes.toString());
}
/** Print all property definitions */
PropertyDefinitionData[] propertyDefinitions = nodeTypeData.getDeclaredPropertyDefinitions();
if (propertyDefinitions != null)
{
for (PropertyDefinitionData propertyDefinition : propertyDefinitions)
{
printPropertyDeclaration(propertyDefinition, out);
}
}
/** Print all child definitions */
NodeDefinitionData[] nodeDefinitions = nodeTypeData.getDeclaredChildNodeDefinitions();
if (nodeDefinitions != null)
{
for (NodeDefinitionData nodeDefinition : nodeDefinitions)
{
printChildDeclaration(nodeDefinition, out);
}
}
out.write("\r\n");
} | java | private void printNodeTypeDeclaration(NodeTypeData nodeTypeData, OutputStreamWriter out) throws RepositoryException,
IOException
{
/** Print name */
out.write("[" + qNameToString(nodeTypeData.getName()) + "] ");
/** Print supertypes */
InternalQName[] superTypes = nodeTypeData.getDeclaredSupertypeNames();
if (superTypes != null && superTypes.length > 0)
{
/** if there is only 1 element and it is NT_BASE then avoid printing it */
if (superTypes.length > 1 || !superTypes[0].equals(Constants.NT_BASE))
{
out.write("> " + qNameToString(superTypes[0]));
for (int i = 1; i < superTypes.length; i++)
{
out.write(", " + qNameToString(superTypes[i]));
}
}
}
/** Print attributes */
StringBuilder attributes = new StringBuilder();
// if (nodeTypeData.isAbstract())
// {
// attributes += "abstract ";
// }
if (nodeTypeData.hasOrderableChildNodes())
{
attributes.append("orderable ");
}
if (nodeTypeData.isMixin())
{
attributes.append("mixin ");
}
// if (!nodeTypeData.isQueryable())
// {
// attributes += "noquery ";
// }
if (nodeTypeData.getPrimaryItemName() != null)
{
attributes.append("primaryitem " + qNameToString(nodeTypeData.getPrimaryItemName()));
}
if (attributes.length() > 0)
{
out.write("\r\n ");
out.write(attributes.toString());
}
/** Print all property definitions */
PropertyDefinitionData[] propertyDefinitions = nodeTypeData.getDeclaredPropertyDefinitions();
if (propertyDefinitions != null)
{
for (PropertyDefinitionData propertyDefinition : propertyDefinitions)
{
printPropertyDeclaration(propertyDefinition, out);
}
}
/** Print all child definitions */
NodeDefinitionData[] nodeDefinitions = nodeTypeData.getDeclaredChildNodeDefinitions();
if (nodeDefinitions != null)
{
for (NodeDefinitionData nodeDefinition : nodeDefinitions)
{
printChildDeclaration(nodeDefinition, out);
}
}
out.write("\r\n");
} | [
"private",
"void",
"printNodeTypeDeclaration",
"(",
"NodeTypeData",
"nodeTypeData",
",",
"OutputStreamWriter",
"out",
")",
"throws",
"RepositoryException",
",",
"IOException",
"{",
"/** Print name */",
"out",
".",
"write",
"(",
"\"[\"",
"+",
"qNameToString",
"(",
"nod... | Method recursively print to output stream node type definition in cnd
format.
@param nodeTypeData
is nodeType to print
@throws RepositoryException
this exception may be while converting QNames to string
@throws IOException
this exception my be thrown during some operations with streams | [
"Method",
"recursively",
"print",
"to",
"output",
"stream",
"node",
"type",
"definition",
"in",
"cnd",
"format",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/CNDStreamWriter.java#L183-L251 |
136,254 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/CNDStreamWriter.java | CNDStreamWriter.printPropertyDeclaration | private void printPropertyDeclaration(PropertyDefinitionData propertyDefinition, OutputStreamWriter out)
throws IOException, RepositoryException
{
/** Print name */
out.write("\r\n ");
out.write("- " + qNameToString(propertyDefinition.getName()));
out.write(" (" + ExtendedPropertyType.nameFromValue(propertyDefinition.getRequiredType()).toUpperCase() + ")");
/** Print default values */
out.write(listToString(propertyDefinition.getDefaultValues(), "'", "\r\n = ", " "));
/** Print attributes */
StringBuilder attributes = new StringBuilder();
if (propertyDefinition.isAutoCreated())
{
attributes.append("autocreated ");
}
if (propertyDefinition.isMandatory())
{
attributes.append("mandatory ");
}
if (propertyDefinition.isProtected())
{
attributes.append("protected ");
}
if (propertyDefinition.isMultiple())
{
attributes.append("multiple ");
}
// if (!propertyDefinition.isFullTextSearchable())
// {
// attributes += "nofulltext ";
// }
// if (!propertyDefinition.isQueryOrderable())
// {
// attributes += "noqueryorder ";
// }
// /** Print operators avoiding printing all */
// String[] opArray = propertyDefinition.getAvailableQueryOperators();
// /** Using set to avoid duplication */
// Set<String> opSet = new HashSet<String>();
// for (String op : opArray)
// {
// opSet.add(op.toUpperCase());
// }
// /** if not all elements are mentioned in list then print */
// if (opSet.size() < 7 && opSet.size() > 0)
// {
// String opString = opSet.toString();
// // opString="queryops '"+opString.substring(1, opString.length()-1)+"' ";
// opString = listToString(opSet.toArray(new String[opSet.size()]), "", "\r\n queryops '", "' ");
// attributes += opString;
// }
if (propertyDefinition.getOnParentVersion() != OnParentVersionAction.COPY)
{
attributes.append("\r\n " + OnParentVersionAction.nameFromValue(propertyDefinition.getOnParentVersion()) + " ");
}
/** Don't print if all attributes are default */
if (attributes.length() > 0)
{
out.write("\r\n ");
out.write(attributes.toString());
}
out.write(listToString(propertyDefinition.getValueConstraints(), "'", "\r\n < ", " "));
} | java | private void printPropertyDeclaration(PropertyDefinitionData propertyDefinition, OutputStreamWriter out)
throws IOException, RepositoryException
{
/** Print name */
out.write("\r\n ");
out.write("- " + qNameToString(propertyDefinition.getName()));
out.write(" (" + ExtendedPropertyType.nameFromValue(propertyDefinition.getRequiredType()).toUpperCase() + ")");
/** Print default values */
out.write(listToString(propertyDefinition.getDefaultValues(), "'", "\r\n = ", " "));
/** Print attributes */
StringBuilder attributes = new StringBuilder();
if (propertyDefinition.isAutoCreated())
{
attributes.append("autocreated ");
}
if (propertyDefinition.isMandatory())
{
attributes.append("mandatory ");
}
if (propertyDefinition.isProtected())
{
attributes.append("protected ");
}
if (propertyDefinition.isMultiple())
{
attributes.append("multiple ");
}
// if (!propertyDefinition.isFullTextSearchable())
// {
// attributes += "nofulltext ";
// }
// if (!propertyDefinition.isQueryOrderable())
// {
// attributes += "noqueryorder ";
// }
// /** Print operators avoiding printing all */
// String[] opArray = propertyDefinition.getAvailableQueryOperators();
// /** Using set to avoid duplication */
// Set<String> opSet = new HashSet<String>();
// for (String op : opArray)
// {
// opSet.add(op.toUpperCase());
// }
// /** if not all elements are mentioned in list then print */
// if (opSet.size() < 7 && opSet.size() > 0)
// {
// String opString = opSet.toString();
// // opString="queryops '"+opString.substring(1, opString.length()-1)+"' ";
// opString = listToString(opSet.toArray(new String[opSet.size()]), "", "\r\n queryops '", "' ");
// attributes += opString;
// }
if (propertyDefinition.getOnParentVersion() != OnParentVersionAction.COPY)
{
attributes.append("\r\n " + OnParentVersionAction.nameFromValue(propertyDefinition.getOnParentVersion()) + " ");
}
/** Don't print if all attributes are default */
if (attributes.length() > 0)
{
out.write("\r\n ");
out.write(attributes.toString());
}
out.write(listToString(propertyDefinition.getValueConstraints(), "'", "\r\n < ", " "));
} | [
"private",
"void",
"printPropertyDeclaration",
"(",
"PropertyDefinitionData",
"propertyDefinition",
",",
"OutputStreamWriter",
"out",
")",
"throws",
"IOException",
",",
"RepositoryException",
"{",
"/** Print name */",
"out",
".",
"write",
"(",
"\"\\r\\n \"",
")",
";",
... | Prints to output stream property definition in CND format
@param propertyDefinition
@throws IOException
@throws RepositoryException | [
"Prints",
"to",
"output",
"stream",
"property",
"definition",
"in",
"CND",
"format"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/CNDStreamWriter.java#L260-L327 |
136,255 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/CNDStreamWriter.java | CNDStreamWriter.printChildDeclaration | private void printChildDeclaration(NodeDefinitionData nodeDefinition, OutputStreamWriter out) throws IOException,
RepositoryException
{
out.write("\r\n ");
out.write("+ " + qNameToString(nodeDefinition.getName()) + " ");
InternalQName[] requiredTypes = nodeDefinition.getRequiredPrimaryTypes();
if (requiredTypes != null && requiredTypes.length > 0)
{
/** if there is only 1 element and it is NT_BASE then avoid printing it */
if (requiredTypes.length > 1 || !requiredTypes[0].equals(Constants.NT_BASE))
{
out.write("(" + qNameToString(requiredTypes[0]));
for (int i = 1; i < requiredTypes.length; i++)
{
out.write(", " + qNameToString(requiredTypes[i]));
}
out.write(")");
}
}
if (nodeDefinition.getDefaultPrimaryType() != null)
{
out.write("\r\n = " + qNameToString(nodeDefinition.getDefaultPrimaryType()));
}
StringBuilder attributes = new StringBuilder();
if (nodeDefinition.isAutoCreated())
{
attributes.append("autocreated ");
}
if (nodeDefinition.isMandatory())
{
attributes.append("mandatory ");
}
if (nodeDefinition.isProtected())
{
attributes.append("protected ");
}
if (nodeDefinition.isAllowsSameNameSiblings())
{
attributes.append("sns ");
}
if (nodeDefinition.getOnParentVersion() != OnParentVersionAction.COPY)
{
attributes.append("\r\n " + OnParentVersionAction.nameFromValue(nodeDefinition.getOnParentVersion()) + " ");
}
if (attributes.length() > 0)
{
out.write("\r\n ");
out.write(attributes.toString());
}
} | java | private void printChildDeclaration(NodeDefinitionData nodeDefinition, OutputStreamWriter out) throws IOException,
RepositoryException
{
out.write("\r\n ");
out.write("+ " + qNameToString(nodeDefinition.getName()) + " ");
InternalQName[] requiredTypes = nodeDefinition.getRequiredPrimaryTypes();
if (requiredTypes != null && requiredTypes.length > 0)
{
/** if there is only 1 element and it is NT_BASE then avoid printing it */
if (requiredTypes.length > 1 || !requiredTypes[0].equals(Constants.NT_BASE))
{
out.write("(" + qNameToString(requiredTypes[0]));
for (int i = 1; i < requiredTypes.length; i++)
{
out.write(", " + qNameToString(requiredTypes[i]));
}
out.write(")");
}
}
if (nodeDefinition.getDefaultPrimaryType() != null)
{
out.write("\r\n = " + qNameToString(nodeDefinition.getDefaultPrimaryType()));
}
StringBuilder attributes = new StringBuilder();
if (nodeDefinition.isAutoCreated())
{
attributes.append("autocreated ");
}
if (nodeDefinition.isMandatory())
{
attributes.append("mandatory ");
}
if (nodeDefinition.isProtected())
{
attributes.append("protected ");
}
if (nodeDefinition.isAllowsSameNameSiblings())
{
attributes.append("sns ");
}
if (nodeDefinition.getOnParentVersion() != OnParentVersionAction.COPY)
{
attributes.append("\r\n " + OnParentVersionAction.nameFromValue(nodeDefinition.getOnParentVersion()) + " ");
}
if (attributes.length() > 0)
{
out.write("\r\n ");
out.write(attributes.toString());
}
} | [
"private",
"void",
"printChildDeclaration",
"(",
"NodeDefinitionData",
"nodeDefinition",
",",
"OutputStreamWriter",
"out",
")",
"throws",
"IOException",
",",
"RepositoryException",
"{",
"out",
".",
"write",
"(",
"\"\\r\\n \"",
")",
";",
"out",
".",
"write",
"(",
... | Print to output stream child node definition in CND format
@param nodeDefinition
@throws IOException
@throws RepositoryException | [
"Print",
"to",
"output",
"stream",
"child",
"node",
"definition",
"in",
"CND",
"format"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/CNDStreamWriter.java#L336-L392 |
136,256 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingConfigurationImpl.java | IndexingConfigurationImpl.getNodeBoost | public float getNodeBoost(NodeData state)
{
IndexingRule rule = getApplicableIndexingRule(state);
if (rule != null)
{
return rule.getNodeBoost();
}
return DEFAULT_BOOST;
} | java | public float getNodeBoost(NodeData state)
{
IndexingRule rule = getApplicableIndexingRule(state);
if (rule != null)
{
return rule.getNodeBoost();
}
return DEFAULT_BOOST;
} | [
"public",
"float",
"getNodeBoost",
"(",
"NodeData",
"state",
")",
"{",
"IndexingRule",
"rule",
"=",
"getApplicableIndexingRule",
"(",
"state",
")",
";",
"if",
"(",
"rule",
"!=",
"null",
")",
"{",
"return",
"rule",
".",
"getNodeBoost",
"(",
")",
";",
"}",
... | Returns the boost for the node scope fulltext index field.
@param state
the node state.
@return the boost for the node scope fulltext index field. | [
"Returns",
"the",
"boost",
"for",
"the",
"node",
"scope",
"fulltext",
"index",
"field",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingConfigurationImpl.java#L288-L296 |
136,257 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingConfigurationImpl.java | IndexingConfigurationImpl.getCondition | private PathExpression getCondition(Node config) throws IllegalNameException, RepositoryException
{
Node conditionAttr = config.getAttributes().getNamedItem("condition");
if (conditionAttr == null)
{
return null;
}
String conditionString = conditionAttr.getNodeValue();
int idx;
int axis;
InternalQName elementTest = null;
InternalQName nameTest = null;
InternalQName propertyName;
String propertyValue;
// parse axis
if (conditionString.startsWith("ancestor::"))
{
axis = PathExpression.ANCESTOR;
idx = "ancestor::".length();
}
else if (conditionString.startsWith("parent::"))
{
axis = PathExpression.PARENT;
idx = "parent::".length();
}
else if (conditionString.startsWith("@"))
{
axis = PathExpression.SELF;
idx = "@".length();
}
else
{
axis = PathExpression.CHILD;
idx = 0;
}
try
{
if (conditionString.startsWith("element(", idx))
{
int colon = conditionString.indexOf(',', idx + "element(".length());
String name = conditionString.substring(idx + "element(".length(), colon).trim();
if (!name.equals("*"))
{
nameTest = resolver.parseJCRName(ISO9075.decode(name)).getInternalName();
}
idx = conditionString.indexOf(")/@", colon);
String type = conditionString.substring(colon + 1, idx).trim();
elementTest = resolver.parseJCRName(ISO9075.decode(type)).getInternalName();
idx += ")/@".length();
}
else
{
if (axis == PathExpression.ANCESTOR || axis == PathExpression.CHILD || axis == PathExpression.PARENT)
{
// simple name test
String name = conditionString.substring(idx, conditionString.indexOf('/', idx));
if (!name.equals("*"))
{
nameTest = resolver.parseJCRName(ISO9075.decode(name)).getInternalName();
}
idx += name.length() + "/@".length();
}
}
// parse property name
int eq = conditionString.indexOf('=', idx);
String name = conditionString.substring(idx, eq).trim();
propertyName = resolver.parseJCRName(ISO9075.decode(name)).getInternalName();
// parse string value
int quote = conditionString.indexOf('\'', eq) + 1;
propertyValue = conditionString.substring(quote, conditionString.indexOf('\'', quote));
}
catch (IndexOutOfBoundsException e)
{
throw new RepositoryException(conditionString);
}
return new PathExpression(axis, elementTest, nameTest, propertyName, propertyValue);
} | java | private PathExpression getCondition(Node config) throws IllegalNameException, RepositoryException
{
Node conditionAttr = config.getAttributes().getNamedItem("condition");
if (conditionAttr == null)
{
return null;
}
String conditionString = conditionAttr.getNodeValue();
int idx;
int axis;
InternalQName elementTest = null;
InternalQName nameTest = null;
InternalQName propertyName;
String propertyValue;
// parse axis
if (conditionString.startsWith("ancestor::"))
{
axis = PathExpression.ANCESTOR;
idx = "ancestor::".length();
}
else if (conditionString.startsWith("parent::"))
{
axis = PathExpression.PARENT;
idx = "parent::".length();
}
else if (conditionString.startsWith("@"))
{
axis = PathExpression.SELF;
idx = "@".length();
}
else
{
axis = PathExpression.CHILD;
idx = 0;
}
try
{
if (conditionString.startsWith("element(", idx))
{
int colon = conditionString.indexOf(',', idx + "element(".length());
String name = conditionString.substring(idx + "element(".length(), colon).trim();
if (!name.equals("*"))
{
nameTest = resolver.parseJCRName(ISO9075.decode(name)).getInternalName();
}
idx = conditionString.indexOf(")/@", colon);
String type = conditionString.substring(colon + 1, idx).trim();
elementTest = resolver.parseJCRName(ISO9075.decode(type)).getInternalName();
idx += ")/@".length();
}
else
{
if (axis == PathExpression.ANCESTOR || axis == PathExpression.CHILD || axis == PathExpression.PARENT)
{
// simple name test
String name = conditionString.substring(idx, conditionString.indexOf('/', idx));
if (!name.equals("*"))
{
nameTest = resolver.parseJCRName(ISO9075.decode(name)).getInternalName();
}
idx += name.length() + "/@".length();
}
}
// parse property name
int eq = conditionString.indexOf('=', idx);
String name = conditionString.substring(idx, eq).trim();
propertyName = resolver.parseJCRName(ISO9075.decode(name)).getInternalName();
// parse string value
int quote = conditionString.indexOf('\'', eq) + 1;
propertyValue = conditionString.substring(quote, conditionString.indexOf('\'', quote));
}
catch (IndexOutOfBoundsException e)
{
throw new RepositoryException(conditionString);
}
return new PathExpression(axis, elementTest, nameTest, propertyName, propertyValue);
} | [
"private",
"PathExpression",
"getCondition",
"(",
"Node",
"config",
")",
"throws",
"IllegalNameException",
",",
"RepositoryException",
"{",
"Node",
"conditionAttr",
"=",
"config",
".",
"getAttributes",
"(",
")",
".",
"getNamedItem",
"(",
"\"condition\"",
")",
";",
... | Gets the condition expression from the configuration.
@param config
the config node.
@return the condition expression or <code>null</code> if there is no
condition set on the <code>config</code>.
@throws MalformedPathException
if the condition string is malformed.
@throws IllegalNameException
if a name contains illegal characters.
@throws RepositoryException | [
"Gets",
"the",
"condition",
"expression",
"from",
"the",
"configuration",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingConfigurationImpl.java#L533-L614 |
136,258 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/BufferedDecoder.java | BufferedDecoder.remove | public void remove() throws IOException
{
if ((fileBuffer != null) && PrivilegedFileHelper.exists(fileBuffer))
{
if (!PrivilegedFileHelper.delete(fileBuffer))
{
throw new IOException("Cannot remove file " + PrivilegedFileHelper.getAbsolutePath(fileBuffer)
+ " Close all streams.");
}
}
} | java | public void remove() throws IOException
{
if ((fileBuffer != null) && PrivilegedFileHelper.exists(fileBuffer))
{
if (!PrivilegedFileHelper.delete(fileBuffer))
{
throw new IOException("Cannot remove file " + PrivilegedFileHelper.getAbsolutePath(fileBuffer)
+ " Close all streams.");
}
}
} | [
"public",
"void",
"remove",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"(",
"fileBuffer",
"!=",
"null",
")",
"&&",
"PrivilegedFileHelper",
".",
"exists",
"(",
"fileBuffer",
")",
")",
"{",
"if",
"(",
"!",
"PrivilegedFileHelper",
".",
"delete",
"(",
... | Remove buffer.
@throws IOException
if file cannot be removed. | [
"Remove",
"buffer",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/BufferedDecoder.java#L117-L127 |
136,259 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/BufferedDecoder.java | BufferedDecoder.swapBuffers | private void swapBuffers() throws IOException
{
byte[] data = ((ByteArrayOutputStream)out).toByteArray();
fileBuffer = PrivilegedFileHelper.createTempFile("decoderBuffer", ".tmp");
PrivilegedFileHelper.deleteOnExit(fileBuffer);
out = new BufferedOutputStream(PrivilegedFileHelper.fileOutputStream(fileBuffer), bufferSize);
out.write(data);
} | java | private void swapBuffers() throws IOException
{
byte[] data = ((ByteArrayOutputStream)out).toByteArray();
fileBuffer = PrivilegedFileHelper.createTempFile("decoderBuffer", ".tmp");
PrivilegedFileHelper.deleteOnExit(fileBuffer);
out = new BufferedOutputStream(PrivilegedFileHelper.fileOutputStream(fileBuffer), bufferSize);
out.write(data);
} | [
"private",
"void",
"swapBuffers",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"data",
"=",
"(",
"(",
"ByteArrayOutputStream",
")",
"out",
")",
".",
"toByteArray",
"(",
")",
";",
"fileBuffer",
"=",
"PrivilegedFileHelper",
".",
"createTempFile",
... | Swap in-memory buffer with file.
@exception IOException
if an I/O error occurs. | [
"Swap",
"in",
"-",
"memory",
"buffer",
"with",
"file",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/BufferedDecoder.java#L177-L184 |
136,260 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/checker/InspectionReport.java | InspectionReport.logComment | public void logComment(String message) throws IOException
{
if (reportContext.get() != null)
{
reportContext.get().addComment(message);
}
else
{
writeMessage(message);
}
} | java | public void logComment(String message) throws IOException
{
if (reportContext.get() != null)
{
reportContext.get().addComment(message);
}
else
{
writeMessage(message);
}
} | [
"public",
"void",
"logComment",
"(",
"String",
"message",
")",
"throws",
"IOException",
"{",
"if",
"(",
"reportContext",
".",
"get",
"(",
")",
"!=",
"null",
")",
"{",
"reportContext",
".",
"get",
"(",
")",
".",
"addComment",
"(",
"message",
")",
";",
"... | Adds comment to log. | [
"Adds",
"comment",
"to",
"log",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/checker/InspectionReport.java#L118-L128 |
136,261 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/checker/InspectionReport.java | InspectionReport.logDescription | public void logDescription(String description) throws IOException
{
// The ThreadLocal has been initialized so we know that we are in multithreaded mode.
if (reportContext.get() != null)
{
reportContext.get().addComment(description);
}
else
{
writeMessage(description);
}
} | java | public void logDescription(String description) throws IOException
{
// The ThreadLocal has been initialized so we know that we are in multithreaded mode.
if (reportContext.get() != null)
{
reportContext.get().addComment(description);
}
else
{
writeMessage(description);
}
} | [
"public",
"void",
"logDescription",
"(",
"String",
"description",
")",
"throws",
"IOException",
"{",
"// The ThreadLocal has been initialized so we know that we are in multithreaded mode.\r",
"if",
"(",
"reportContext",
".",
"get",
"(",
")",
"!=",
"null",
")",
"{",
"repor... | Adds description to log. | [
"Adds",
"description",
"to",
"log",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/checker/InspectionReport.java#L133-L144 |
136,262 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/checker/InspectionReport.java | InspectionReport.logBrokenObjectAndSetInconsistency | public void logBrokenObjectAndSetInconsistency(String brokenObject) throws IOException
{
setInconsistency();
// The ThreadLocal has been initialized so we know that we are in multithreaded mode.
if (reportContext.get() != null)
{
reportContext.get().addBrokenObject(brokenObject);
}
else
{
writeBrokenObject(brokenObject);
}
} | java | public void logBrokenObjectAndSetInconsistency(String brokenObject) throws IOException
{
setInconsistency();
// The ThreadLocal has been initialized so we know that we are in multithreaded mode.
if (reportContext.get() != null)
{
reportContext.get().addBrokenObject(brokenObject);
}
else
{
writeBrokenObject(brokenObject);
}
} | [
"public",
"void",
"logBrokenObjectAndSetInconsistency",
"(",
"String",
"brokenObject",
")",
"throws",
"IOException",
"{",
"setInconsistency",
"(",
")",
";",
"// The ThreadLocal has been initialized so we know that we are in multithreaded mode.\r",
"if",
"(",
"reportContext",
".",... | Adds detailed event to log. | [
"Adds",
"detailed",
"event",
"to",
"log",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/checker/InspectionReport.java#L155-L167 |
136,263 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/checker/InspectionReport.java | InspectionReport.logExceptionAndSetInconsistency | public void logExceptionAndSetInconsistency(String message, Throwable e) throws IOException
{
setInconsistency();
// The ThreadLocal has been initialized so we know that we are in multithreaded mode.
if (reportContext.get() != null)
{
reportContext.get().addLogException(message, e);
}
else
{
writeException(message, e);
}
} | java | public void logExceptionAndSetInconsistency(String message, Throwable e) throws IOException
{
setInconsistency();
// The ThreadLocal has been initialized so we know that we are in multithreaded mode.
if (reportContext.get() != null)
{
reportContext.get().addLogException(message, e);
}
else
{
writeException(message, e);
}
} | [
"public",
"void",
"logExceptionAndSetInconsistency",
"(",
"String",
"message",
",",
"Throwable",
"e",
")",
"throws",
"IOException",
"{",
"setInconsistency",
"(",
")",
";",
"// The ThreadLocal has been initialized so we know that we are in multithreaded mode.\r",
"if",
"(",
"r... | Adds exception with full stack trace. | [
"Adds",
"exception",
"with",
"full",
"stack",
"trace",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/checker/InspectionReport.java#L179-L191 |
136,264 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNLockTableHandler.java | ISPNLockTableHandler.getIdColumn | private String getIdColumn() throws SQLException
{
try
{
return lockManagerEntry.getParameterValue(ISPNCacheableLockManagerImpl.INFINISPAN_JDBC_CL_ID_COLUMN_NAME);
}
catch (RepositoryConfigurationException e)
{
throw new SQLException(e);
}
} | java | private String getIdColumn() throws SQLException
{
try
{
return lockManagerEntry.getParameterValue(ISPNCacheableLockManagerImpl.INFINISPAN_JDBC_CL_ID_COLUMN_NAME);
}
catch (RepositoryConfigurationException e)
{
throw new SQLException(e);
}
} | [
"private",
"String",
"getIdColumn",
"(",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"return",
"lockManagerEntry",
".",
"getParameterValue",
"(",
"ISPNCacheableLockManagerImpl",
".",
"INFINISPAN_JDBC_CL_ID_COLUMN_NAME",
")",
";",
"}",
"catch",
"(",
"RepositoryConfig... | Returns the column name which contain node identifier. | [
"Returns",
"the",
"column",
"name",
"which",
"contain",
"node",
"identifier",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNLockTableHandler.java#L86-L96 |
136,265 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNLockTableHandler.java | ISPNLockTableHandler.getTableName | protected String getTableName() throws SQLException
{
try
{
String dialect = getDialect();
String quote = "\"";
if (dialect.startsWith(DBConstants.DB_DIALECT_MYSQL))
quote = "`";
return quote + lockManagerEntry.getParameterValue(ISPNCacheableLockManagerImpl.INFINISPAN_JDBC_TABLE_NAME)
+ "_" + "L" + workspaceEntry.getUniqueName().replace("_", "").replace("-", "_") + quote;
}
catch (RepositoryConfigurationException e)
{
throw new SQLException(e);
}
} | java | protected String getTableName() throws SQLException
{
try
{
String dialect = getDialect();
String quote = "\"";
if (dialect.startsWith(DBConstants.DB_DIALECT_MYSQL))
quote = "`";
return quote + lockManagerEntry.getParameterValue(ISPNCacheableLockManagerImpl.INFINISPAN_JDBC_TABLE_NAME)
+ "_" + "L" + workspaceEntry.getUniqueName().replace("_", "").replace("-", "_") + quote;
}
catch (RepositoryConfigurationException e)
{
throw new SQLException(e);
}
} | [
"protected",
"String",
"getTableName",
"(",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"String",
"dialect",
"=",
"getDialect",
"(",
")",
";",
"String",
"quote",
"=",
"\"\\\"\"",
";",
"if",
"(",
"dialect",
".",
"startsWith",
"(",
"DBConstants",
".",
"D... | Returns the name of LOCK table. | [
"Returns",
"the",
"name",
"of",
"LOCK",
"table",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNLockTableHandler.java#L101-L116 |
136,266 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/FileNameProducer.java | FileNameProducer.getNextFile | public File getNextFile()
{
File nextFile = null;
try
{
String sNextName = generateName();
nextFile = new File(backupSetDir.getAbsoluteFile() + File.separator + sNextName);
if (isFullBackup && isDirectoryForFullBackup)
{
if (!PrivilegedFileHelper.exists(nextFile))
{
PrivilegedFileHelper.mkdirs(nextFile);
}
}
else
{
PrivilegedFileHelper.createNewFile(nextFile);
}
}
catch (IOException e)
{
LOG.error("Can nit get next file : " + e.getLocalizedMessage(), e);
}
return nextFile;
} | java | public File getNextFile()
{
File nextFile = null;
try
{
String sNextName = generateName();
nextFile = new File(backupSetDir.getAbsoluteFile() + File.separator + sNextName);
if (isFullBackup && isDirectoryForFullBackup)
{
if (!PrivilegedFileHelper.exists(nextFile))
{
PrivilegedFileHelper.mkdirs(nextFile);
}
}
else
{
PrivilegedFileHelper.createNewFile(nextFile);
}
}
catch (IOException e)
{
LOG.error("Can nit get next file : " + e.getLocalizedMessage(), e);
}
return nextFile;
} | [
"public",
"File",
"getNextFile",
"(",
")",
"{",
"File",
"nextFile",
"=",
"null",
";",
"try",
"{",
"String",
"sNextName",
"=",
"generateName",
"(",
")",
";",
"nextFile",
"=",
"new",
"File",
"(",
"backupSetDir",
".",
"getAbsoluteFile",
"(",
")",
"+",
"File... | Get next file in backup set.
@return
file | [
"Get",
"next",
"file",
"in",
"backup",
"set",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/FileNameProducer.java#L180-L207 |
136,267 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/FileNameProducer.java | FileNameProducer.getStrDate | private String getStrDate(Calendar c)
{
int m = c.get(Calendar.MONTH) + 1;
int d = c.get(Calendar.DATE);
return "" + c.get(Calendar.YEAR) + (m < 10 ? "0" + m : m) + (d < 10 ? "0" + d : d);
} | java | private String getStrDate(Calendar c)
{
int m = c.get(Calendar.MONTH) + 1;
int d = c.get(Calendar.DATE);
return "" + c.get(Calendar.YEAR) + (m < 10 ? "0" + m : m) + (d < 10 ? "0" + d : d);
} | [
"private",
"String",
"getStrDate",
"(",
"Calendar",
"c",
")",
"{",
"int",
"m",
"=",
"c",
".",
"get",
"(",
"Calendar",
".",
"MONTH",
")",
"+",
"1",
";",
"int",
"d",
"=",
"c",
".",
"get",
"(",
"Calendar",
".",
"DATE",
")",
";",
"return",
"\"\"",
... | Returns date as String in format YYYYMMDD. | [
"Returns",
"date",
"as",
"String",
"in",
"format",
"YYYYMMDD",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/FileNameProducer.java#L259-L264 |
136,268 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/FileNameProducer.java | FileNameProducer.getStrTime | private String getStrTime(Calendar c)
{
int h = c.get(Calendar.HOUR);
int m = c.get(Calendar.MINUTE);
int s = c.get(Calendar.SECOND);
return "" + (h < 10 ? "0" + h : h) + (m < 10 ? "0" + m : m) + (s < 10 ? "0" + s : s);
} | java | private String getStrTime(Calendar c)
{
int h = c.get(Calendar.HOUR);
int m = c.get(Calendar.MINUTE);
int s = c.get(Calendar.SECOND);
return "" + (h < 10 ? "0" + h : h) + (m < 10 ? "0" + m : m) + (s < 10 ? "0" + s : s);
} | [
"private",
"String",
"getStrTime",
"(",
"Calendar",
"c",
")",
"{",
"int",
"h",
"=",
"c",
".",
"get",
"(",
"Calendar",
".",
"HOUR",
")",
";",
"int",
"m",
"=",
"c",
".",
"get",
"(",
"Calendar",
".",
"MINUTE",
")",
";",
"int",
"s",
"=",
"c",
".",
... | Returns time as String in format HHMMSS. | [
"Returns",
"time",
"as",
"String",
"in",
"format",
"HHMMSS",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/FileNameProducer.java#L269-L275 |
136,269 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/JCROrganizationServiceImpl.java | JCROrganizationServiceImpl.createStructure | void createStructure() throws RepositoryException
{
Session session = getStorageSession();
try
{
Node storage = session.getRootNode().addNode(storagePath.substring(1), STORAGE_NODETYPE);
storage.addNode(STORAGE_JOS_USERS, STORAGE_JOS_USERS_NODETYPE);
storage.addNode(STORAGE_JOS_GROUPS, STORAGE_JOS_GROUPS_NODETYPE);
Node storageTypesNode = storage.addNode(STORAGE_JOS_MEMBERSHIP_TYPES, STORAGE_JOS_MEMBERSHIP_TYPES_NODETYPE);
Node anyNode = storageTypesNode.addNode(JOS_MEMBERSHIP_TYPE_ANY);
anyNode.setProperty(MembershipTypeHandlerImpl.MembershipTypeProperties.JOS_DESCRIPTION, JOS_DESCRIPTION_TYPE_ANY);
session.save(); // storage done configure
}
finally
{
session.logout();
}
} | java | void createStructure() throws RepositoryException
{
Session session = getStorageSession();
try
{
Node storage = session.getRootNode().addNode(storagePath.substring(1), STORAGE_NODETYPE);
storage.addNode(STORAGE_JOS_USERS, STORAGE_JOS_USERS_NODETYPE);
storage.addNode(STORAGE_JOS_GROUPS, STORAGE_JOS_GROUPS_NODETYPE);
Node storageTypesNode = storage.addNode(STORAGE_JOS_MEMBERSHIP_TYPES, STORAGE_JOS_MEMBERSHIP_TYPES_NODETYPE);
Node anyNode = storageTypesNode.addNode(JOS_MEMBERSHIP_TYPE_ANY);
anyNode.setProperty(MembershipTypeHandlerImpl.MembershipTypeProperties.JOS_DESCRIPTION, JOS_DESCRIPTION_TYPE_ANY);
session.save(); // storage done configure
}
finally
{
session.logout();
}
} | [
"void",
"createStructure",
"(",
")",
"throws",
"RepositoryException",
"{",
"Session",
"session",
"=",
"getStorageSession",
"(",
")",
";",
"try",
"{",
"Node",
"storage",
"=",
"session",
".",
"getRootNode",
"(",
")",
".",
"addNode",
"(",
"storagePath",
".",
"s... | Creates storage structure.
@throws RepositoryException if any Exception is occurred | [
"Creates",
"storage",
"structure",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/JCROrganizationServiceImpl.java#L303-L322 |
136,270 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/JCROrganizationServiceImpl.java | JCROrganizationServiceImpl.getStorageSession | Session getStorageSession() throws RepositoryException
{
try
{
ManageableRepository repository = getWorkingRepository();
String workspaceName = storageWorkspace;
if (workspaceName == null)
{
workspaceName = repository.getConfiguration().getDefaultWorkspaceName();
}
return repository.getSystemSession(workspaceName);
}
catch (RepositoryConfigurationException e)
{
throw new RepositoryException("Can not get system session", e);
}
} | java | Session getStorageSession() throws RepositoryException
{
try
{
ManageableRepository repository = getWorkingRepository();
String workspaceName = storageWorkspace;
if (workspaceName == null)
{
workspaceName = repository.getConfiguration().getDefaultWorkspaceName();
}
return repository.getSystemSession(workspaceName);
}
catch (RepositoryConfigurationException e)
{
throw new RepositoryException("Can not get system session", e);
}
} | [
"Session",
"getStorageSession",
"(",
")",
"throws",
"RepositoryException",
"{",
"try",
"{",
"ManageableRepository",
"repository",
"=",
"getWorkingRepository",
"(",
")",
";",
"String",
"workspaceName",
"=",
"storageWorkspace",
";",
"if",
"(",
"workspaceName",
"==",
"... | Return system Session to org-service storage workspace. For internal use
only.
@return system session
@throws RepositoryException if any Exception is occurred | [
"Return",
"system",
"Session",
"to",
"org",
"-",
"service",
"storage",
"workspace",
".",
"For",
"internal",
"use",
"only",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/JCROrganizationServiceImpl.java#L331-L349 |
136,271 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/JCROrganizationServiceImpl.java | JCROrganizationServiceImpl.getWorkingRepository | protected ManageableRepository getWorkingRepository() throws RepositoryException, RepositoryConfigurationException
{
return repositoryName != null ? repositoryService.getRepository(repositoryName) : repositoryService
.getCurrentRepository();
} | java | protected ManageableRepository getWorkingRepository() throws RepositoryException, RepositoryConfigurationException
{
return repositoryName != null ? repositoryService.getRepository(repositoryName) : repositoryService
.getCurrentRepository();
} | [
"protected",
"ManageableRepository",
"getWorkingRepository",
"(",
")",
"throws",
"RepositoryException",
",",
"RepositoryConfigurationException",
"{",
"return",
"repositoryName",
"!=",
"null",
"?",
"repositoryService",
".",
"getRepository",
"(",
"repositoryName",
")",
":",
... | Returns working repository. If repository name is configured then it will be returned
otherwise the current repository is used. | [
"Returns",
"working",
"repository",
".",
"If",
"repository",
"name",
"is",
"configured",
"then",
"it",
"will",
"be",
"returned",
"otherwise",
"the",
"current",
"repository",
"is",
"used",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/JCROrganizationServiceImpl.java#L391-L395 |
136,272 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/LocationFactory.java | LocationFactory.createJCRPath | public JCRPath createJCRPath(JCRPath parentLoc, String relPath) throws RepositoryException
{
JCRPath addPath = parseNames(relPath, false);
return parentLoc.add(addPath);
} | java | public JCRPath createJCRPath(JCRPath parentLoc, String relPath) throws RepositoryException
{
JCRPath addPath = parseNames(relPath, false);
return parentLoc.add(addPath);
} | [
"public",
"JCRPath",
"createJCRPath",
"(",
"JCRPath",
"parentLoc",
",",
"String",
"relPath",
")",
"throws",
"RepositoryException",
"{",
"JCRPath",
"addPath",
"=",
"parseNames",
"(",
"relPath",
",",
"false",
")",
";",
"return",
"parentLoc",
".",
"add",
"(",
"ad... | Creates JCRPath from parent path and relPath
@param parentLoc parent path
@param relPath related path
@return
@throws RepositoryException | [
"Creates",
"JCRPath",
"from",
"parent",
"path",
"and",
"relPath"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/LocationFactory.java#L90-L94 |
136,273 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/LocationFactory.java | LocationFactory.isNonspace | private boolean isNonspace(String str, char ch) throws RepositoryException
{
if (ch == '|')
{
throw new RepositoryException("Illegal absPath: \"" + str + "\": The path entry contains an illegal char: \"" + ch + "\"");
}
return !((ch == '\t') || (ch == '\n') || (ch == '\f') || (ch == '\r') || (ch == ' ') || (ch == '/')
|| (ch == ':') || (ch == '[') || (ch == ']') || (ch == '*'));
} | java | private boolean isNonspace(String str, char ch) throws RepositoryException
{
if (ch == '|')
{
throw new RepositoryException("Illegal absPath: \"" + str + "\": The path entry contains an illegal char: \"" + ch + "\"");
}
return !((ch == '\t') || (ch == '\n') || (ch == '\f') || (ch == '\r') || (ch == ' ') || (ch == '/')
|| (ch == ':') || (ch == '[') || (ch == ']') || (ch == '*'));
} | [
"private",
"boolean",
"isNonspace",
"(",
"String",
"str",
",",
"char",
"ch",
")",
"throws",
"RepositoryException",
"{",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"{",
"throw",
"new",
"RepositoryException",
"(",
"\"Illegal absPath: \\\"\"",
"+",
"str",
"+",
"\"\\... | Some functions for JCRPath Validation | [
"Some",
"functions",
"for",
"JCRPath",
"Validation"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/LocationFactory.java#L299-L308 |
136,274 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java | QPath.isAbsolute | public boolean isAbsolute()
{
if (names[0].getIndex() == 1 && names[0].getName().length() == 0 && names[0].getNamespace().length() == 0)
return true;
else
return false;
} | java | public boolean isAbsolute()
{
if (names[0].getIndex() == 1 && names[0].getName().length() == 0 && names[0].getNamespace().length() == 0)
return true;
else
return false;
} | [
"public",
"boolean",
"isAbsolute",
"(",
")",
"{",
"if",
"(",
"names",
"[",
"0",
"]",
".",
"getIndex",
"(",
")",
"==",
"1",
"&&",
"names",
"[",
"0",
"]",
".",
"getName",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
"&&",
"names",
"[",
"0",
"]... | Tell if the path is absolute.
@return boolean | [
"Tell",
"if",
"the",
"path",
"is",
"absolute",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java#L88-L94 |
136,275 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java | QPath.getRelPath | public QPathEntry[] getRelPath(int relativeDegree) throws IllegalPathException
{
int len = getLength() - relativeDegree;
if (len < 0)
throw new IllegalPathException("Relative degree " + relativeDegree + " is more than depth for "
+ getAsString());
QPathEntry[] relPath = new QPathEntry[relativeDegree];
System.arraycopy(names, len, relPath, 0, relPath.length);
return relPath;
} | java | public QPathEntry[] getRelPath(int relativeDegree) throws IllegalPathException
{
int len = getLength() - relativeDegree;
if (len < 0)
throw new IllegalPathException("Relative degree " + relativeDegree + " is more than depth for "
+ getAsString());
QPathEntry[] relPath = new QPathEntry[relativeDegree];
System.arraycopy(names, len, relPath, 0, relPath.length);
return relPath;
} | [
"public",
"QPathEntry",
"[",
"]",
"getRelPath",
"(",
"int",
"relativeDegree",
")",
"throws",
"IllegalPathException",
"{",
"int",
"len",
"=",
"getLength",
"(",
")",
"-",
"relativeDegree",
";",
"if",
"(",
"len",
"<",
"0",
")",
"throw",
"new",
"IllegalPathExcep... | Get relative path with degree.
@param relativeDegree
- degree value
@return arrayf of QPathEntry
@throws IllegalPathException
- if the degree is invalid | [
"Get",
"relative",
"path",
"with",
"degree",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java#L132-L144 |
136,276 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java | QPath.getCommonAncestorPath | public static QPath getCommonAncestorPath(QPath firstPath, QPath secondPath) throws PathNotFoundException
{
if (!firstPath.getEntries()[0].equals(secondPath.getEntries()[0]))
{
throw new PathNotFoundException("For the given ways there is no common ancestor.");
}
List<QPathEntry> caEntries = new ArrayList<QPathEntry>();
for (int i = 0; i < firstPath.getEntries().length; i++)
{
if (firstPath.getEntries()[i].equals(secondPath.getEntries()[i]))
{
caEntries.add(firstPath.getEntries()[i]);
}
else
{
break;
}
}
return new QPath(caEntries.toArray(new QPathEntry[caEntries.size()]));
} | java | public static QPath getCommonAncestorPath(QPath firstPath, QPath secondPath) throws PathNotFoundException
{
if (!firstPath.getEntries()[0].equals(secondPath.getEntries()[0]))
{
throw new PathNotFoundException("For the given ways there is no common ancestor.");
}
List<QPathEntry> caEntries = new ArrayList<QPathEntry>();
for (int i = 0; i < firstPath.getEntries().length; i++)
{
if (firstPath.getEntries()[i].equals(secondPath.getEntries()[i]))
{
caEntries.add(firstPath.getEntries()[i]);
}
else
{
break;
}
}
return new QPath(caEntries.toArray(new QPathEntry[caEntries.size()]));
} | [
"public",
"static",
"QPath",
"getCommonAncestorPath",
"(",
"QPath",
"firstPath",
",",
"QPath",
"secondPath",
")",
"throws",
"PathNotFoundException",
"{",
"if",
"(",
"!",
"firstPath",
".",
"getEntries",
"(",
")",
"[",
"0",
"]",
".",
"equals",
"(",
"secondPath",... | Get common ancestor path.
@param firstPath
@param secondPath
@return The common ancestor of two paths.
@throws PathNotFoundException | [
"Get",
"common",
"ancestor",
"path",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java#L211-L233 |
136,277 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java | QPath.getAsString | public String getAsString()
{
if (stringName == null)
{
StringBuilder str = new StringBuilder();
for (int i = 0; i < getLength(); i++)
{
str.append(names[i].getAsString(true));
}
stringName = str.toString();
}
return stringName;
} | java | public String getAsString()
{
if (stringName == null)
{
StringBuilder str = new StringBuilder();
for (int i = 0; i < getLength(); i++)
{
str.append(names[i].getAsString(true));
}
stringName = str.toString();
}
return stringName;
} | [
"public",
"String",
"getAsString",
"(",
")",
"{",
"if",
"(",
"stringName",
"==",
"null",
")",
"{",
"StringBuilder",
"str",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"getLength",
"(",
")",
";",
"i",... | Get String representation.
@return String | [
"Get",
"String",
"representation",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java#L264-L279 |
136,278 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java | QPath.parse | public static QPath parse(String qPath) throws IllegalPathException
{
if (qPath == null)
throw new IllegalPathException("Bad internal path '" + qPath + "'");
if (qPath.length() < 2 || !qPath.startsWith("[]"))
throw new IllegalPathException("Bad internal path '" + qPath + "'");
int uriStart = 0;
List<QPathEntry> entries = new ArrayList<QPathEntry>();
while (uriStart >= 0)
{
uriStart = qPath.indexOf("[", uriStart);
int uriFinish = qPath.indexOf("]", uriStart);
String uri = qPath.substring(uriStart + 1, uriFinish);
int tmp = qPath.indexOf("[", uriFinish); // next token
if (tmp == -1)
{
tmp = qPath.length();
uriStart = -1;
}
else
uriStart = tmp;
String localName = qPath.substring(uriFinish + 1, tmp);
int index = 0;
int ind = localName.indexOf(PREFIX_DELIMITER);
if (ind != -1)
{ // has index
index = Integer.parseInt(localName.substring(ind + 1));
localName = localName.substring(0, ind);
}
else
{
if (uriStart > -1)
throw new IllegalPathException("Bad internal path '" + qPath
+ "' each intermediate name should have index");
}
entries.add(new QPathEntry(uri, localName, index));
}
return new QPath(entries.toArray(new QPathEntry[entries.size()]));
} | java | public static QPath parse(String qPath) throws IllegalPathException
{
if (qPath == null)
throw new IllegalPathException("Bad internal path '" + qPath + "'");
if (qPath.length() < 2 || !qPath.startsWith("[]"))
throw new IllegalPathException("Bad internal path '" + qPath + "'");
int uriStart = 0;
List<QPathEntry> entries = new ArrayList<QPathEntry>();
while (uriStart >= 0)
{
uriStart = qPath.indexOf("[", uriStart);
int uriFinish = qPath.indexOf("]", uriStart);
String uri = qPath.substring(uriStart + 1, uriFinish);
int tmp = qPath.indexOf("[", uriFinish); // next token
if (tmp == -1)
{
tmp = qPath.length();
uriStart = -1;
}
else
uriStart = tmp;
String localName = qPath.substring(uriFinish + 1, tmp);
int index = 0;
int ind = localName.indexOf(PREFIX_DELIMITER);
if (ind != -1)
{ // has index
index = Integer.parseInt(localName.substring(ind + 1));
localName = localName.substring(0, ind);
}
else
{
if (uriStart > -1)
throw new IllegalPathException("Bad internal path '" + qPath
+ "' each intermediate name should have index");
}
entries.add(new QPathEntry(uri, localName, index));
}
return new QPath(entries.toArray(new QPathEntry[entries.size()]));
} | [
"public",
"static",
"QPath",
"parse",
"(",
"String",
"qPath",
")",
"throws",
"IllegalPathException",
"{",
"if",
"(",
"qPath",
"==",
"null",
")",
"throw",
"new",
"IllegalPathException",
"(",
"\"Bad internal path '\"",
"+",
"qPath",
"+",
"\"'\"",
")",
";",
"if",... | Parses string and make internal path from it.
@param qPath
- String to be parsed
@return QPath
@throws IllegalPathException
- if string is invalid | [
"Parses",
"string",
"and",
"make",
"internal",
"path",
"from",
"it",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java#L353-L398 |
136,279 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ConsistencyCheck.java | ConsistencyCheck.repair | void repair(boolean ignoreFailure) throws IOException
{
if (errors.size() == 0)
{
log.info("No errors found.");
return;
}
int notRepairable = 0;
for (Iterator<ConsistencyCheckError> it = errors.iterator(); it.hasNext();)
{
final ConsistencyCheckError error = it.next();
try
{
if (error.repairable())
{
// running in privileged mode
error.repair();
}
else
{
log.warn("Not repairable: " + error);
notRepairable++;
}
}
catch (IOException e)
{
if (ignoreFailure)
{
log.warn("Exception while reparing: " + e);
}
else
{
throw e;
}
}
catch (Exception e)
{
if (ignoreFailure)
{
log.warn("Exception while reparing: " + e);
}
else
{
throw new IOException(e.getMessage(), e);
}
}
}
log.info("Repaired " + (errors.size() - notRepairable) + " errors.");
if (notRepairable > 0)
{
log.warn("" + notRepairable + " error(s) not repairable.");
}
} | java | void repair(boolean ignoreFailure) throws IOException
{
if (errors.size() == 0)
{
log.info("No errors found.");
return;
}
int notRepairable = 0;
for (Iterator<ConsistencyCheckError> it = errors.iterator(); it.hasNext();)
{
final ConsistencyCheckError error = it.next();
try
{
if (error.repairable())
{
// running in privileged mode
error.repair();
}
else
{
log.warn("Not repairable: " + error);
notRepairable++;
}
}
catch (IOException e)
{
if (ignoreFailure)
{
log.warn("Exception while reparing: " + e);
}
else
{
throw e;
}
}
catch (Exception e)
{
if (ignoreFailure)
{
log.warn("Exception while reparing: " + e);
}
else
{
throw new IOException(e.getMessage(), e);
}
}
}
log.info("Repaired " + (errors.size() - notRepairable) + " errors.");
if (notRepairable > 0)
{
log.warn("" + notRepairable + " error(s) not repairable.");
}
} | [
"void",
"repair",
"(",
"boolean",
"ignoreFailure",
")",
"throws",
"IOException",
"{",
"if",
"(",
"errors",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"log",
".",
"info",
"(",
"\"No errors found.\"",
")",
";",
"return",
";",
"}",
"int",
"notRepairable",
... | Repairs detected errors during the consistency check.
@param ignoreFailure if <code>true</code> repair failures are ignored,
the repair continues without throwing an exception. If
<code>false</code> the repair procedure is aborted on the first
repair failure.
@throws IOException if a repair failure occurs. | [
"Repairs",
"detected",
"errors",
"during",
"the",
"consistency",
"check",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ConsistencyCheck.java#L107-L159 |
136,280 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ConsistencyCheck.java | ConsistencyCheck.run | private void run() throws IOException, RepositoryException
{
// UUIDs of multiple nodes in the index
Set<String> multipleEntries = new HashSet<String>();
// collect all documents UUIDs
documentUUIDs = new HashSet<String>();
CachingMultiIndexReader reader = index.getIndexReader();
try
{
for (int i = 0; i < reader.maxDoc(); i++)
{
if (i > 10 && i % (reader.maxDoc() / 5) == 0)
{
long progress = Math.round((100.0 * i) / (reader.maxDoc() * 2f));
log.info("progress: " + progress + "%");
}
if (reader.isDeleted(i))
{
continue;
}
final int currentIndex = i;
Document d = reader.document(currentIndex, FieldSelectors.UUID);
String uuid = d.get(FieldNames.UUID);
if (stateMgr.getItemData(uuid) != null)
{
if (!documentUUIDs.add(uuid))
{
multipleEntries.add(uuid);
}
}
else
{
errors.add(new NodeDeleted(uuid));
}
}
}
finally
{
reader.release();
}
// create multiple entries errors
for (Iterator<String> it = multipleEntries.iterator(); it.hasNext();)
{
errors.add(new MultipleEntries(it.next()));
}
reader = index.getIndexReader();
try
{
// run through documents again and check parent
for (int i = 0; i < reader.maxDoc(); i++)
{
if (i > 10 && i % (reader.maxDoc() / 5) == 0)
{
long progress = Math.round((100.0 * i) / (reader.maxDoc() * 2f));
log.info("progress: " + (progress + 50) + "%");
}
if (reader.isDeleted(i))
{
continue;
}
final int currentIndex = i;
Document d = reader.document(currentIndex, FieldSelectors.UUID_AND_PARENT);
String uuid = d.get(FieldNames.UUID);
String parentUUIDString = d.get(FieldNames.PARENT);
if (parentUUIDString == null || documentUUIDs.contains(parentUUIDString))
{
continue;
}
// parent is missing
//NodeId parentId = new NodeId(parentUUID);
if (stateMgr.getItemData(parentUUIDString) != null)
{
errors.add(new MissingAncestor(uuid, parentUUIDString));
}
else
{
errors.add(new UnknownParent(uuid, parentUUIDString));
}
}
}
finally
{
reader.release();
}
} | java | private void run() throws IOException, RepositoryException
{
// UUIDs of multiple nodes in the index
Set<String> multipleEntries = new HashSet<String>();
// collect all documents UUIDs
documentUUIDs = new HashSet<String>();
CachingMultiIndexReader reader = index.getIndexReader();
try
{
for (int i = 0; i < reader.maxDoc(); i++)
{
if (i > 10 && i % (reader.maxDoc() / 5) == 0)
{
long progress = Math.round((100.0 * i) / (reader.maxDoc() * 2f));
log.info("progress: " + progress + "%");
}
if (reader.isDeleted(i))
{
continue;
}
final int currentIndex = i;
Document d = reader.document(currentIndex, FieldSelectors.UUID);
String uuid = d.get(FieldNames.UUID);
if (stateMgr.getItemData(uuid) != null)
{
if (!documentUUIDs.add(uuid))
{
multipleEntries.add(uuid);
}
}
else
{
errors.add(new NodeDeleted(uuid));
}
}
}
finally
{
reader.release();
}
// create multiple entries errors
for (Iterator<String> it = multipleEntries.iterator(); it.hasNext();)
{
errors.add(new MultipleEntries(it.next()));
}
reader = index.getIndexReader();
try
{
// run through documents again and check parent
for (int i = 0; i < reader.maxDoc(); i++)
{
if (i > 10 && i % (reader.maxDoc() / 5) == 0)
{
long progress = Math.round((100.0 * i) / (reader.maxDoc() * 2f));
log.info("progress: " + (progress + 50) + "%");
}
if (reader.isDeleted(i))
{
continue;
}
final int currentIndex = i;
Document d = reader.document(currentIndex, FieldSelectors.UUID_AND_PARENT);
String uuid = d.get(FieldNames.UUID);
String parentUUIDString = d.get(FieldNames.PARENT);
if (parentUUIDString == null || documentUUIDs.contains(parentUUIDString))
{
continue;
}
// parent is missing
//NodeId parentId = new NodeId(parentUUID);
if (stateMgr.getItemData(parentUUIDString) != null)
{
errors.add(new MissingAncestor(uuid, parentUUIDString));
}
else
{
errors.add(new UnknownParent(uuid, parentUUIDString));
}
}
}
finally
{
reader.release();
}
} | [
"private",
"void",
"run",
"(",
")",
"throws",
"IOException",
",",
"RepositoryException",
"{",
"// UUIDs of multiple nodes in the index",
"Set",
"<",
"String",
">",
"multipleEntries",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"// collect all documents... | Runs the consistency check.
@throws IOException if an error occurs while running the check.
@throws RepositoryException | [
"Runs",
"the",
"consistency",
"check",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ConsistencyCheck.java#L175-L263 |
136,281 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java | RepositoryContainer.getWorkspaceContainer | public WorkspaceContainer getWorkspaceContainer(String workspaceName)
{
Object comp = getComponentInstance(workspaceName);
return comp != null && comp instanceof WorkspaceContainer ? (WorkspaceContainer)comp : null;
} | java | public WorkspaceContainer getWorkspaceContainer(String workspaceName)
{
Object comp = getComponentInstance(workspaceName);
return comp != null && comp instanceof WorkspaceContainer ? (WorkspaceContainer)comp : null;
} | [
"public",
"WorkspaceContainer",
"getWorkspaceContainer",
"(",
"String",
"workspaceName",
")",
"{",
"Object",
"comp",
"=",
"getComponentInstance",
"(",
"workspaceName",
")",
";",
"return",
"comp",
"!=",
"null",
"&&",
"comp",
"instanceof",
"WorkspaceContainer",
"?",
"... | Get workspace Container by name.
@param workspaceName
name
@return WorkspaceContainer | [
"Get",
"workspace",
"Container",
"by",
"name",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java#L316-L320 |
136,282 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java | RepositoryContainer.getWorkspaceEntry | public WorkspaceEntry getWorkspaceEntry(String wsName)
{
for (WorkspaceEntry entry : config.getWorkspaceEntries())
{
if (entry.getName().equals(wsName))
return entry;
}
return null;
} | java | public WorkspaceEntry getWorkspaceEntry(String wsName)
{
for (WorkspaceEntry entry : config.getWorkspaceEntries())
{
if (entry.getName().equals(wsName))
return entry;
}
return null;
} | [
"public",
"WorkspaceEntry",
"getWorkspaceEntry",
"(",
"String",
"wsName",
")",
"{",
"for",
"(",
"WorkspaceEntry",
"entry",
":",
"config",
".",
"getWorkspaceEntries",
"(",
")",
")",
"{",
"if",
"(",
"entry",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"wsN... | Get workspace configuration entry by name.
@param wsName
workspace name
@return WorkspaceEntry | [
"Get",
"workspace",
"configuration",
"entry",
"by",
"name",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java#L329-L337 |
136,283 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java | RepositoryContainer.load | private void load() throws RepositoryException
{
//Namespaces first
NamespaceDataPersister namespacePersister =
(NamespaceDataPersister)this.getComponentInstanceOfType(NamespaceDataPersister.class);
NamespaceRegistryImpl nsRegistry = (NamespaceRegistryImpl)getNamespaceRegistry();
namespacePersister.start();
nsRegistry.start();
//Node types now.
JCRNodeTypeDataPersister nodeTypePersister =
(JCRNodeTypeDataPersister)this.getComponentInstanceOfType(JCRNodeTypeDataPersister.class);
NodeTypeDataManagerImpl ntManager =
(NodeTypeDataManagerImpl)this.getComponentInstanceOfType(NodeTypeDataManagerImpl.class);
nodeTypePersister.start();
ntManager.start();
} | java | private void load() throws RepositoryException
{
//Namespaces first
NamespaceDataPersister namespacePersister =
(NamespaceDataPersister)this.getComponentInstanceOfType(NamespaceDataPersister.class);
NamespaceRegistryImpl nsRegistry = (NamespaceRegistryImpl)getNamespaceRegistry();
namespacePersister.start();
nsRegistry.start();
//Node types now.
JCRNodeTypeDataPersister nodeTypePersister =
(JCRNodeTypeDataPersister)this.getComponentInstanceOfType(JCRNodeTypeDataPersister.class);
NodeTypeDataManagerImpl ntManager =
(NodeTypeDataManagerImpl)this.getComponentInstanceOfType(NodeTypeDataManagerImpl.class);
nodeTypePersister.start();
ntManager.start();
} | [
"private",
"void",
"load",
"(",
")",
"throws",
"RepositoryException",
"{",
"//Namespaces first",
"NamespaceDataPersister",
"namespacePersister",
"=",
"(",
"NamespaceDataPersister",
")",
"this",
".",
"getComponentInstanceOfType",
"(",
"NamespaceDataPersister",
".",
"class",
... | Load namespaces and nodetypes from persistent repository.
<p>
Runs on container start.
@throws RepositoryException | [
"Load",
"namespaces",
"and",
"nodetypes",
"from",
"persistent",
"repository",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java#L846-L866 |
136,284 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/QueryImpl.java | QueryImpl.getSelectProperties | protected InternalQName[] getSelectProperties() throws RepositoryException
{
// get select properties
List<InternalQName> selectProps = new ArrayList<InternalQName>();
selectProps.addAll(Arrays.asList(root.getSelectProperties()));
if (selectProps.size() == 0)
{
// use node type constraint
LocationStepQueryNode[] steps = root.getLocationNode().getPathSteps();
final InternalQName[] ntName = new InternalQName[1];
steps[steps.length - 1].acceptOperands(new DefaultQueryNodeVisitor()
{
public Object visit(AndQueryNode node, Object data) throws RepositoryException
{
return node.acceptOperands(this, data);
}
public Object visit(NodeTypeQueryNode node, Object data)
{
ntName[0] = node.getValue();
return data;
}
}, null);
if (ntName[0] == null)
{
ntName[0] = Constants.NT_BASE;
}
NodeTypeData nt = session.getWorkspace().getNodeTypesHolder().getNodeType(ntName[0]);
PropertyDefinitionData[] propDefs = nt.getDeclaredPropertyDefinitions();
for (int i = 0; i < propDefs.length; i++)
{
PropertyDefinitionData propDef = propDefs[i];
if (!propDef.isResidualSet() && !propDef.isMultiple())
{
selectProps.add(propDef.getName());
}
}
}
// add jcr:path and jcr:score if not selected already
if (!selectProps.contains(Constants.JCR_PATH))
{
selectProps.add(Constants.JCR_PATH);
}
if (!selectProps.contains(Constants.JCR_SCORE))
{
selectProps.add(Constants.JCR_SCORE);
}
return (InternalQName[])selectProps.toArray(new InternalQName[selectProps.size()]);
} | java | protected InternalQName[] getSelectProperties() throws RepositoryException
{
// get select properties
List<InternalQName> selectProps = new ArrayList<InternalQName>();
selectProps.addAll(Arrays.asList(root.getSelectProperties()));
if (selectProps.size() == 0)
{
// use node type constraint
LocationStepQueryNode[] steps = root.getLocationNode().getPathSteps();
final InternalQName[] ntName = new InternalQName[1];
steps[steps.length - 1].acceptOperands(new DefaultQueryNodeVisitor()
{
public Object visit(AndQueryNode node, Object data) throws RepositoryException
{
return node.acceptOperands(this, data);
}
public Object visit(NodeTypeQueryNode node, Object data)
{
ntName[0] = node.getValue();
return data;
}
}, null);
if (ntName[0] == null)
{
ntName[0] = Constants.NT_BASE;
}
NodeTypeData nt = session.getWorkspace().getNodeTypesHolder().getNodeType(ntName[0]);
PropertyDefinitionData[] propDefs = nt.getDeclaredPropertyDefinitions();
for (int i = 0; i < propDefs.length; i++)
{
PropertyDefinitionData propDef = propDefs[i];
if (!propDef.isResidualSet() && !propDef.isMultiple())
{
selectProps.add(propDef.getName());
}
}
}
// add jcr:path and jcr:score if not selected already
if (!selectProps.contains(Constants.JCR_PATH))
{
selectProps.add(Constants.JCR_PATH);
}
if (!selectProps.contains(Constants.JCR_SCORE))
{
selectProps.add(Constants.JCR_SCORE);
}
return (InternalQName[])selectProps.toArray(new InternalQName[selectProps.size()]);
} | [
"protected",
"InternalQName",
"[",
"]",
"getSelectProperties",
"(",
")",
"throws",
"RepositoryException",
"{",
"// get select properties",
"List",
"<",
"InternalQName",
">",
"selectProps",
"=",
"new",
"ArrayList",
"<",
"InternalQName",
">",
"(",
")",
";",
"selectPro... | Returns the select properties for this query.
@return array of select property names.
@throws RepositoryException
if an error occurs. | [
"Returns",
"the",
"select",
"properties",
"for",
"this",
"query",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/QueryImpl.java#L149-L201 |
136,285 | exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java | WebDavServiceImpl.session | protected Session session(String repoName, String wsName, List<String> lockTokens) throws Exception,
NoSuchWorkspaceException
{
// To be cloud compliant we need now to ignore the provided repository name (more details in JCR-2138)
ManageableRepository repo = repositoryService.getCurrentRepository();
if (PropertyManager.isDevelopping() && log.isWarnEnabled())
{
String currentRepositoryName = repo.getConfiguration().getName();
if (!currentRepositoryName.equals(repoName))
{
log.warn("The expected repository was '" + repoName
+ "' but we will use the current repository instead which is '" + currentRepositoryName + "'");
}
}
SessionProvider sp = sessionProviderService.getSessionProvider(null);
if (sp == null)
throw new RepositoryException("SessionProvider is not properly set. Make the application calls"
+ "SessionProviderService.setSessionProvider(..) somewhere before ("
+ "for instance in Servlet Filter for WEB application)");
Session session = sp.getSession(wsName, repo);
if (lockTokens != null)
{
String[] presentLockTokens = session.getLockTokens();
ArrayList<String> presentLockTokensList = new ArrayList<String>();
for (int i = 0; i < presentLockTokens.length; i++)
{
presentLockTokensList.add(presentLockTokens[i]);
}
for (int i = 0; i < lockTokens.size(); i++)
{
String lockToken = lockTokens.get(i);
if (!presentLockTokensList.contains(lockToken))
{
session.addLockToken(lockToken);
}
}
}
return session;
} | java | protected Session session(String repoName, String wsName, List<String> lockTokens) throws Exception,
NoSuchWorkspaceException
{
// To be cloud compliant we need now to ignore the provided repository name (more details in JCR-2138)
ManageableRepository repo = repositoryService.getCurrentRepository();
if (PropertyManager.isDevelopping() && log.isWarnEnabled())
{
String currentRepositoryName = repo.getConfiguration().getName();
if (!currentRepositoryName.equals(repoName))
{
log.warn("The expected repository was '" + repoName
+ "' but we will use the current repository instead which is '" + currentRepositoryName + "'");
}
}
SessionProvider sp = sessionProviderService.getSessionProvider(null);
if (sp == null)
throw new RepositoryException("SessionProvider is not properly set. Make the application calls"
+ "SessionProviderService.setSessionProvider(..) somewhere before ("
+ "for instance in Servlet Filter for WEB application)");
Session session = sp.getSession(wsName, repo);
if (lockTokens != null)
{
String[] presentLockTokens = session.getLockTokens();
ArrayList<String> presentLockTokensList = new ArrayList<String>();
for (int i = 0; i < presentLockTokens.length; i++)
{
presentLockTokensList.add(presentLockTokens[i]);
}
for (int i = 0; i < lockTokens.size(); i++)
{
String lockToken = lockTokens.get(i);
if (!presentLockTokensList.contains(lockToken))
{
session.addLockToken(lockToken);
}
}
}
return session;
} | [
"protected",
"Session",
"session",
"(",
"String",
"repoName",
",",
"String",
"wsName",
",",
"List",
"<",
"String",
">",
"lockTokens",
")",
"throws",
"Exception",
",",
"NoSuchWorkspaceException",
"{",
"// To be cloud compliant we need now to ignore the provided repository na... | Gives access to the current session.
@param repoName repository name
@param wsName workspace name
@param lockTokens Lock tokens
@return current session
@throws Exception {@link Exception} | [
"Gives",
"access",
"to",
"the",
"current",
"session",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java#L1322-L1362 |
136,286 | exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java | WebDavServiceImpl.getRepositoryName | protected String getRepositoryName(String repoName) throws RepositoryException
{
// To be cloud compliant we need now to ignore the provided repository name (more details in JCR-2138)
ManageableRepository repo = repositoryService.getCurrentRepository();
String currentRepositoryName = repo.getConfiguration().getName();
if (PropertyManager.isDevelopping() && log.isWarnEnabled())
{
if (!currentRepositoryName.equals(repoName))
{
log.warn("The expected repository was '" + repoName
+ "' but we will use the current repository instead which is '" + currentRepositoryName + "'");
}
}
return currentRepositoryName;
} | java | protected String getRepositoryName(String repoName) throws RepositoryException
{
// To be cloud compliant we need now to ignore the provided repository name (more details in JCR-2138)
ManageableRepository repo = repositoryService.getCurrentRepository();
String currentRepositoryName = repo.getConfiguration().getName();
if (PropertyManager.isDevelopping() && log.isWarnEnabled())
{
if (!currentRepositoryName.equals(repoName))
{
log.warn("The expected repository was '" + repoName
+ "' but we will use the current repository instead which is '" + currentRepositoryName + "'");
}
}
return currentRepositoryName;
} | [
"protected",
"String",
"getRepositoryName",
"(",
"String",
"repoName",
")",
"throws",
"RepositoryException",
"{",
"// To be cloud compliant we need now to ignore the provided repository name (more details in JCR-2138)\r",
"ManageableRepository",
"repo",
"=",
"repositoryService",
".",
... | Gives the name of the repository to access.
@param repoName the name of the expected repository.
@return the name of the repository to access. | [
"Gives",
"the",
"name",
"of",
"the",
"repository",
"to",
"access",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java#L1370-L1384 |
136,287 | exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java | WebDavServiceImpl.normalizePath | protected String normalizePath(String repoPath)
{
if (repoPath.length() > 0 && repoPath.endsWith("/"))
{
return repoPath.substring(0, repoPath.length() - 1);
}
return repoPath;
} | java | protected String normalizePath(String repoPath)
{
if (repoPath.length() > 0 && repoPath.endsWith("/"))
{
return repoPath.substring(0, repoPath.length() - 1);
}
return repoPath;
} | [
"protected",
"String",
"normalizePath",
"(",
"String",
"repoPath",
")",
"{",
"if",
"(",
"repoPath",
".",
"length",
"(",
")",
">",
"0",
"&&",
"repoPath",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"{",
"return",
"repoPath",
".",
"substring",
"(",
"0",
","... | Normalizes path.
@param repoPath repository path
@return normalized path. | [
"Normalizes",
"path",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java#L1403-L1411 |
136,288 | exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java | WebDavServiceImpl.path | protected String path(String repoPath, boolean withIndex)
{
String path = repoPath.substring(workspaceName(repoPath).length());
if (path.length() > 0)
{
if (!withIndex)
{
return TextUtil.removeIndexFromPath(path);
}
return path;
}
return "/";
} | java | protected String path(String repoPath, boolean withIndex)
{
String path = repoPath.substring(workspaceName(repoPath).length());
if (path.length() > 0)
{
if (!withIndex)
{
return TextUtil.removeIndexFromPath(path);
}
return path;
}
return "/";
} | [
"protected",
"String",
"path",
"(",
"String",
"repoPath",
",",
"boolean",
"withIndex",
")",
"{",
"String",
"path",
"=",
"repoPath",
".",
"substring",
"(",
"workspaceName",
"(",
"repoPath",
")",
".",
"length",
"(",
")",
")",
";",
"if",
"(",
"path",
".",
... | Extracts path from repository path.
@param repoPath repository path
@param withIndex indicates whether the index must be removed or not
@return path | [
"Extracts",
"path",
"from",
"repository",
"path",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java#L1431-L1445 |
136,289 | exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java | WebDavServiceImpl.lockTokens | protected List<String> lockTokens(String lockTokenHeader, String ifHeader)
{
ArrayList<String> lockTokens = new ArrayList<String>();
if (lockTokenHeader != null)
{
if (lockTokenHeader.startsWith("<"))
{
lockTokenHeader = lockTokenHeader.substring(1, lockTokenHeader.length() - 1);
}
if (lockTokenHeader.contains(WebDavConst.Lock.OPAQUE_LOCK_TOKEN))
{
lockTokenHeader = lockTokenHeader.split(":")[1];
}
lockTokens.add(lockTokenHeader);
}
if (ifHeader != null)
{
String headerLockToken = ifHeader.substring(ifHeader.indexOf("("));
headerLockToken = headerLockToken.substring(2, headerLockToken.length() - 2);
if (headerLockToken.contains(WebDavConst.Lock.OPAQUE_LOCK_TOKEN))
{
headerLockToken = headerLockToken.split(":")[1];
}
lockTokens.add(headerLockToken);
}
return lockTokens;
} | java | protected List<String> lockTokens(String lockTokenHeader, String ifHeader)
{
ArrayList<String> lockTokens = new ArrayList<String>();
if (lockTokenHeader != null)
{
if (lockTokenHeader.startsWith("<"))
{
lockTokenHeader = lockTokenHeader.substring(1, lockTokenHeader.length() - 1);
}
if (lockTokenHeader.contains(WebDavConst.Lock.OPAQUE_LOCK_TOKEN))
{
lockTokenHeader = lockTokenHeader.split(":")[1];
}
lockTokens.add(lockTokenHeader);
}
if (ifHeader != null)
{
String headerLockToken = ifHeader.substring(ifHeader.indexOf("("));
headerLockToken = headerLockToken.substring(2, headerLockToken.length() - 2);
if (headerLockToken.contains(WebDavConst.Lock.OPAQUE_LOCK_TOKEN))
{
headerLockToken = headerLockToken.split(":")[1];
}
lockTokens.add(headerLockToken);
}
return lockTokens;
} | [
"protected",
"List",
"<",
"String",
">",
"lockTokens",
"(",
"String",
"lockTokenHeader",
",",
"String",
"ifHeader",
")",
"{",
"ArrayList",
"<",
"String",
">",
"lockTokens",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"if",
"(",
"lockTokenHe... | Creates the list of Lock tokens from Lock-Token and If headers.
@param lockTokenHeader Lock-Token HTTP header
@param ifHeader If HTTP header
@return the list of lock tokens | [
"Creates",
"the",
"list",
"of",
"Lock",
"tokens",
"from",
"Lock",
"-",
"Token",
"and",
"If",
"headers",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java#L1454-L1485 |
136,290 | exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java | WebDavServiceImpl.buildURI | private URI buildURI(String path) throws URISyntaxException
{
try
{
return new URI(path);
}
catch (URISyntaxException e)
{
return new URI(TextUtil.escape(path, '%', true));
}
} | java | private URI buildURI(String path) throws URISyntaxException
{
try
{
return new URI(path);
}
catch (URISyntaxException e)
{
return new URI(TextUtil.escape(path, '%', true));
}
} | [
"private",
"URI",
"buildURI",
"(",
"String",
"path",
")",
"throws",
"URISyntaxException",
"{",
"try",
"{",
"return",
"new",
"URI",
"(",
"path",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"return",
"new",
"URI",
"(",
"TextUtil",
"."... | Build URI from string. | [
"Build",
"URI",
"from",
"string",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java#L1490-L1500 |
136,291 | exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java | WebDavServiceImpl.isAllowedPath | private boolean isAllowedPath(String workspaceName, String path)
{
if(pattern == null)
return true;
Matcher matcher= pattern.matcher(workspaceName+":"+path);
if(!matcher.find())
{
log.warn("Access not allowed to webdav resource {}",path);
return false;
}
return true;
} | java | private boolean isAllowedPath(String workspaceName, String path)
{
if(pattern == null)
return true;
Matcher matcher= pattern.matcher(workspaceName+":"+path);
if(!matcher.find())
{
log.warn("Access not allowed to webdav resource {}",path);
return false;
}
return true;
} | [
"private",
"boolean",
"isAllowedPath",
"(",
"String",
"workspaceName",
",",
"String",
"path",
")",
"{",
"if",
"(",
"pattern",
"==",
"null",
")",
"return",
"true",
";",
"Matcher",
"matcher",
"=",
"pattern",
".",
"matcher",
"(",
"workspaceName",
"+",
"\":\"",
... | Check resource access allowed
@param workspaceName
@param path
@return true if access is allowed otherwise false | [
"Check",
"resource",
"access",
"allowed"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java#L1508-L1519 |
136,292 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/repository/creation/RepositoryCreationServiceImpl.java | RepositoryCreationServiceImpl.createRepositoryInternally | protected void createRepositoryInternally(String backupId, RepositoryEntry rEntry, String rToken,
DBCreationProperties creationProps) throws RepositoryConfigurationException, RepositoryCreationException
{
if (rpcService != null)
{
String stringRepositoryEntry = null;
try
{
JsonGeneratorImpl generatorImpl = new JsonGeneratorImpl();
JsonValue json = generatorImpl.createJsonObject(rEntry);
stringRepositoryEntry = json.toString();
}
catch (JsonException e)
{
throw new RepositoryCreationException("Can not serialize repository entry: " + e.getMessage(), e);
}
// notify coordinator node to create repository
try
{
Object result =
rpcService.executeCommandOnCoordinator(createRepository, true, backupId, stringRepositoryEntry, rToken,
creationProps);
if (result != null)
{
if (result instanceof Throwable)
{
throw new RepositoryCreationException("Can't create repository " + rEntry.getName(),
(Throwable)result);
}
else
{
throw new RepositoryCreationException("createRepository command returned uknown result type.");
}
}
}
catch (RPCException e)
{
Throwable cause = (e).getCause();
if (cause instanceof RepositoryCreationException)
{
throw (RepositoryCreationException)cause;
}
else if (cause instanceof RepositoryConfigurationException)
{
throw (RepositoryConfigurationException)cause;
}
else
{
throw new RepositoryCreationException(e.getMessage(), e);
}
}
// execute startRepository at all cluster nodes (coordinator will ignore this command)
try
{
List<Object> results =
rpcService.executeCommandOnAllNodes(startRepository, true, stringRepositoryEntry, creationProps);
for (Object result : results)
{
if (result != null)
{
if (result instanceof Throwable)
{
throw new RepositoryCreationException("Repository " + rEntry.getName()
+ " created on coordinator, but can not be started at other cluster nodes", ((Throwable)result));
}
else
{
throw new RepositoryCreationException("startRepository command returns uknown result type");
}
}
}
}
catch (RPCException e)
{
throw new RepositoryCreationException("Repository " + rEntry.getName()
+ " created on coordinator, can not be started at other cluster node: " + e.getMessage(), e);
}
}
else
{
try
{
createRepositoryLocally(backupId, rEntry, rToken, creationProps);
}
finally
{
pendingRepositories.remove(rToken);
}
}
} | java | protected void createRepositoryInternally(String backupId, RepositoryEntry rEntry, String rToken,
DBCreationProperties creationProps) throws RepositoryConfigurationException, RepositoryCreationException
{
if (rpcService != null)
{
String stringRepositoryEntry = null;
try
{
JsonGeneratorImpl generatorImpl = new JsonGeneratorImpl();
JsonValue json = generatorImpl.createJsonObject(rEntry);
stringRepositoryEntry = json.toString();
}
catch (JsonException e)
{
throw new RepositoryCreationException("Can not serialize repository entry: " + e.getMessage(), e);
}
// notify coordinator node to create repository
try
{
Object result =
rpcService.executeCommandOnCoordinator(createRepository, true, backupId, stringRepositoryEntry, rToken,
creationProps);
if (result != null)
{
if (result instanceof Throwable)
{
throw new RepositoryCreationException("Can't create repository " + rEntry.getName(),
(Throwable)result);
}
else
{
throw new RepositoryCreationException("createRepository command returned uknown result type.");
}
}
}
catch (RPCException e)
{
Throwable cause = (e).getCause();
if (cause instanceof RepositoryCreationException)
{
throw (RepositoryCreationException)cause;
}
else if (cause instanceof RepositoryConfigurationException)
{
throw (RepositoryConfigurationException)cause;
}
else
{
throw new RepositoryCreationException(e.getMessage(), e);
}
}
// execute startRepository at all cluster nodes (coordinator will ignore this command)
try
{
List<Object> results =
rpcService.executeCommandOnAllNodes(startRepository, true, stringRepositoryEntry, creationProps);
for (Object result : results)
{
if (result != null)
{
if (result instanceof Throwable)
{
throw new RepositoryCreationException("Repository " + rEntry.getName()
+ " created on coordinator, but can not be started at other cluster nodes", ((Throwable)result));
}
else
{
throw new RepositoryCreationException("startRepository command returns uknown result type");
}
}
}
}
catch (RPCException e)
{
throw new RepositoryCreationException("Repository " + rEntry.getName()
+ " created on coordinator, can not be started at other cluster node: " + e.getMessage(), e);
}
}
else
{
try
{
createRepositoryLocally(backupId, rEntry, rToken, creationProps);
}
finally
{
pendingRepositories.remove(rToken);
}
}
} | [
"protected",
"void",
"createRepositoryInternally",
"(",
"String",
"backupId",
",",
"RepositoryEntry",
"rEntry",
",",
"String",
"rToken",
",",
"DBCreationProperties",
"creationProps",
")",
"throws",
"RepositoryConfigurationException",
",",
"RepositoryCreationException",
"{",
... | Create repository internally. serverUrl and connProps contain specific properties for db creation. | [
"Create",
"repository",
"internally",
".",
"serverUrl",
"and",
"connProps",
"contain",
"specific",
"properties",
"for",
"db",
"creation",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/repository/creation/RepositoryCreationServiceImpl.java#L350-L443 |
136,293 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/repository/creation/RepositoryCreationServiceImpl.java | RepositoryCreationServiceImpl.removeRepositoryLocally | protected void removeRepositoryLocally(String repositoryName, boolean forceRemove) throws RepositoryCreationException
{
try
{
// extract list of all datasources
ManageableRepository repositorty = repositoryService.getRepository(repositoryName);
Set<String> datasources = extractDataSourceNames(repositorty.getConfiguration(), false);
// close all opened sessions
for (String workspaceName : repositorty.getWorkspaceNames())
{
WorkspaceContainerFacade wc = repositorty.getWorkspaceContainer(workspaceName);
SessionRegistry sessionRegistry = (SessionRegistry)wc.getComponent(SessionRegistry.class);
sessionRegistry.closeSessions(workspaceName);
}
// remove repository from configuration
repositoryService.removeRepository(repositoryName, forceRemove);
repositoryService.getConfig().retain();
// unbind datasource and close connections
for (String dsName : datasources)
{
try
{
// we suppose that lookup() method returns the same instance of datasource by the same name
DataSource ds = (DataSource)initialContextInitializer.getInitialContext().lookup(dsName);
initialContextInitializer.getInitialContextBinder().unbind(dsName);
// close datasource
if (ds instanceof CloseableDataSource)
{
((CloseableDataSource)ds).close();
}
}
catch (NamingException e)
{
LOG.error("Can't unbind datasource " + dsName, e);
}
catch (FileNotFoundException e)
{
LOG.error("Can't unbind datasource " + dsName, e);
}
catch (XMLStreamException e)
{
LOG.error("Can't unbind datasource " + dsName, e);
}
}
}
catch (RepositoryException e)
{
throw new RepositoryCreationException("Can't remove repository", e);
}
catch (RepositoryConfigurationException e)
{
throw new RepositoryCreationException("Can't remove repository", e);
}
} | java | protected void removeRepositoryLocally(String repositoryName, boolean forceRemove) throws RepositoryCreationException
{
try
{
// extract list of all datasources
ManageableRepository repositorty = repositoryService.getRepository(repositoryName);
Set<String> datasources = extractDataSourceNames(repositorty.getConfiguration(), false);
// close all opened sessions
for (String workspaceName : repositorty.getWorkspaceNames())
{
WorkspaceContainerFacade wc = repositorty.getWorkspaceContainer(workspaceName);
SessionRegistry sessionRegistry = (SessionRegistry)wc.getComponent(SessionRegistry.class);
sessionRegistry.closeSessions(workspaceName);
}
// remove repository from configuration
repositoryService.removeRepository(repositoryName, forceRemove);
repositoryService.getConfig().retain();
// unbind datasource and close connections
for (String dsName : datasources)
{
try
{
// we suppose that lookup() method returns the same instance of datasource by the same name
DataSource ds = (DataSource)initialContextInitializer.getInitialContext().lookup(dsName);
initialContextInitializer.getInitialContextBinder().unbind(dsName);
// close datasource
if (ds instanceof CloseableDataSource)
{
((CloseableDataSource)ds).close();
}
}
catch (NamingException e)
{
LOG.error("Can't unbind datasource " + dsName, e);
}
catch (FileNotFoundException e)
{
LOG.error("Can't unbind datasource " + dsName, e);
}
catch (XMLStreamException e)
{
LOG.error("Can't unbind datasource " + dsName, e);
}
}
}
catch (RepositoryException e)
{
throw new RepositoryCreationException("Can't remove repository", e);
}
catch (RepositoryConfigurationException e)
{
throw new RepositoryCreationException("Can't remove repository", e);
}
} | [
"protected",
"void",
"removeRepositoryLocally",
"(",
"String",
"repositoryName",
",",
"boolean",
"forceRemove",
")",
"throws",
"RepositoryCreationException",
"{",
"try",
"{",
"// extract list of all datasources\r",
"ManageableRepository",
"repositorty",
"=",
"repositoryService"... | Remove repository locally.
@param repositoryName
the repository name
@throws RepositoryCreationException | [
"Remove",
"repository",
"locally",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/repository/creation/RepositoryCreationServiceImpl.java#L879-L937 |
136,294 | exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindResponseEntity.java | PropFindResponseEntity.traverseResources | private void traverseResources(Resource resource, int counter) throws XMLStreamException, RepositoryException,
IllegalResourceTypeException, URISyntaxException, UnsupportedEncodingException
{
xmlStreamWriter.writeStartElement("DAV:", "response");
xmlStreamWriter.writeStartElement("DAV:", "href");
String href = resource.getIdentifier().toASCIIString();
if (resource.isCollection())
{
xmlStreamWriter.writeCharacters(href + "/");
}
else
{
xmlStreamWriter.writeCharacters(href);
}
xmlStreamWriter.writeEndElement();
PropstatGroupedRepresentation propstat =
new PropstatGroupedRepresentation(resource, propertyNames, propertyNamesOnly, session);
PropertyWriteUtil.writePropStats(xmlStreamWriter, propstat.getPropStats());
xmlStreamWriter.writeEndElement();
int d = depth;
if (resource.isCollection())
{
if (counter < d)
{
CollectionResource collection = (CollectionResource)resource;
for (Resource child : collection.getResources())
{
traverseResources(child, counter + 1);
}
}
}
} | java | private void traverseResources(Resource resource, int counter) throws XMLStreamException, RepositoryException,
IllegalResourceTypeException, URISyntaxException, UnsupportedEncodingException
{
xmlStreamWriter.writeStartElement("DAV:", "response");
xmlStreamWriter.writeStartElement("DAV:", "href");
String href = resource.getIdentifier().toASCIIString();
if (resource.isCollection())
{
xmlStreamWriter.writeCharacters(href + "/");
}
else
{
xmlStreamWriter.writeCharacters(href);
}
xmlStreamWriter.writeEndElement();
PropstatGroupedRepresentation propstat =
new PropstatGroupedRepresentation(resource, propertyNames, propertyNamesOnly, session);
PropertyWriteUtil.writePropStats(xmlStreamWriter, propstat.getPropStats());
xmlStreamWriter.writeEndElement();
int d = depth;
if (resource.isCollection())
{
if (counter < d)
{
CollectionResource collection = (CollectionResource)resource;
for (Resource child : collection.getResources())
{
traverseResources(child, counter + 1);
}
}
}
} | [
"private",
"void",
"traverseResources",
"(",
"Resource",
"resource",
",",
"int",
"counter",
")",
"throws",
"XMLStreamException",
",",
"RepositoryException",
",",
"IllegalResourceTypeException",
",",
"URISyntaxException",
",",
"UnsupportedEncodingException",
"{",
"xmlStreamW... | Traverses resources and collects the vales of required properties.
@param resource resource to traverse
@param counter the depth
@throws XMLStreamException {@link XMLStreamException}
@throws RepositoryException {@link RepositoryException}
@throws IllegalResourceTypeException {@link IllegalResourceTypeException}
@throws URISyntaxException {@link URISyntaxException}
@throws UnsupportedEncodingException | [
"Traverses",
"resources",
"and",
"collects",
"the",
"vales",
"of",
"required",
"properties",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindResponseEntity.java#L183-L222 |
136,295 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/WorkspaceQuotaManager.java | WorkspaceQuotaManager.calculateWorkspaceDataSize | private void calculateWorkspaceDataSize()
{
long dataSize;
try
{
dataSize = getWorkspaceDataSizeDirectly();
}
catch (QuotaManagerException e1)
{
throw new IllegalStateException("Can't calculate workspace data size", e1);
}
ChangesItem changesItem = new ChangesItem();
changesItem.updateWorkspaceChangedSize(dataSize);
Runnable task = new ApplyPersistedChangesTask(context, changesItem);
task.run();
} | java | private void calculateWorkspaceDataSize()
{
long dataSize;
try
{
dataSize = getWorkspaceDataSizeDirectly();
}
catch (QuotaManagerException e1)
{
throw new IllegalStateException("Can't calculate workspace data size", e1);
}
ChangesItem changesItem = new ChangesItem();
changesItem.updateWorkspaceChangedSize(dataSize);
Runnable task = new ApplyPersistedChangesTask(context, changesItem);
task.run();
} | [
"private",
"void",
"calculateWorkspaceDataSize",
"(",
")",
"{",
"long",
"dataSize",
";",
"try",
"{",
"dataSize",
"=",
"getWorkspaceDataSizeDirectly",
"(",
")",
";",
"}",
"catch",
"(",
"QuotaManagerException",
"e1",
")",
"{",
"throw",
"new",
"IllegalStateException"... | Calculates and accumulates workspace data size. | [
"Calculates",
"and",
"accumulates",
"workspace",
"data",
"size",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/WorkspaceQuotaManager.java#L519-L536 |
136,296 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/metadata/AddMetadataAction.java | AddMetadataAction.printWarning | private void printWarning(PropertyImpl property, Exception exception) throws RepositoryException
{
if (PropertyManager.isDevelopping())
{
LOG.warn("Binary value reader error, content by path " + property.getPath() + ", property id "
+ property.getData().getIdentifier() + " : " + exception.getMessage(), exception);
}
else
{
LOG.warn("Binary value reader error, content by path " + property.getPath() + ", property id "
+ property.getData().getIdentifier() + " : " + exception.getMessage());
}
} | java | private void printWarning(PropertyImpl property, Exception exception) throws RepositoryException
{
if (PropertyManager.isDevelopping())
{
LOG.warn("Binary value reader error, content by path " + property.getPath() + ", property id "
+ property.getData().getIdentifier() + " : " + exception.getMessage(), exception);
}
else
{
LOG.warn("Binary value reader error, content by path " + property.getPath() + ", property id "
+ property.getData().getIdentifier() + " : " + exception.getMessage());
}
} | [
"private",
"void",
"printWarning",
"(",
"PropertyImpl",
"property",
",",
"Exception",
"exception",
")",
"throws",
"RepositoryException",
"{",
"if",
"(",
"PropertyManager",
".",
"isDevelopping",
"(",
")",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Binary value reader er... | Print warning message on the console
@param property property that has not been read
@param exception the reason for which wasn't read property
@throws RepositoryException | [
"Print",
"warning",
"message",
"on",
"the",
"console"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/metadata/AddMetadataAction.java#L140-L152 |
136,297 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/metadata/AddMetadataAction.java | AddMetadataAction.setJCRProperties | private void setJCRProperties(NodeImpl parent, Properties props) throws Exception
{
if (!parent.isNodeType("dc:elementSet"))
{
parent.addMixin("dc:elementSet");
}
ValueFactory vFactory = parent.getSession().getValueFactory();
LocationFactory lFactory = parent.getSession().getLocationFactory();
for (Entry entry : props.entrySet())
{
QName qname = (QName)entry.getKey();
JCRName jcrName = lFactory.createJCRName(new InternalQName(qname.getNamespace(), qname.getName()));
PropertyDefinitionData definition =
parent
.getSession()
.getWorkspace()
.getNodeTypesHolder()
.getPropertyDefinitions(jcrName.getInternalName(), ((NodeData)parent.getData()).getPrimaryTypeName(),
((NodeData)parent.getData()).getMixinTypeNames()).getAnyDefinition();
if (definition != null)
{
if (definition.isMultiple())
{
Value[] values = {createValue(entry.getValue(), vFactory)};
parent.setProperty(jcrName.getAsString(), values);
}
else
{
Value value = createValue(entry.getValue(), vFactory);
parent.setProperty(jcrName.getAsString(), value);
}
}
}
} | java | private void setJCRProperties(NodeImpl parent, Properties props) throws Exception
{
if (!parent.isNodeType("dc:elementSet"))
{
parent.addMixin("dc:elementSet");
}
ValueFactory vFactory = parent.getSession().getValueFactory();
LocationFactory lFactory = parent.getSession().getLocationFactory();
for (Entry entry : props.entrySet())
{
QName qname = (QName)entry.getKey();
JCRName jcrName = lFactory.createJCRName(new InternalQName(qname.getNamespace(), qname.getName()));
PropertyDefinitionData definition =
parent
.getSession()
.getWorkspace()
.getNodeTypesHolder()
.getPropertyDefinitions(jcrName.getInternalName(), ((NodeData)parent.getData()).getPrimaryTypeName(),
((NodeData)parent.getData()).getMixinTypeNames()).getAnyDefinition();
if (definition != null)
{
if (definition.isMultiple())
{
Value[] values = {createValue(entry.getValue(), vFactory)};
parent.setProperty(jcrName.getAsString(), values);
}
else
{
Value value = createValue(entry.getValue(), vFactory);
parent.setProperty(jcrName.getAsString(), value);
}
}
}
} | [
"private",
"void",
"setJCRProperties",
"(",
"NodeImpl",
"parent",
",",
"Properties",
"props",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"parent",
".",
"isNodeType",
"(",
"\"dc:elementSet\"",
")",
")",
"{",
"parent",
".",
"addMixin",
"(",
"\"dc:elementSe... | Sets metainfo properties as JCR properties to node. | [
"Sets",
"metainfo",
"properties",
"as",
"JCR",
"properties",
"to",
"node",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/metadata/AddMetadataAction.java#L157-L194 |
136,298 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java | DBInitializerHelper.prepareScripts | private static String prepareScripts(String initScriptPath, String itemTableSuffix, String valueTableSuffix,
String refTableSuffix, boolean isolatedDB) throws IOException
{
String scripts = IOUtil.getStreamContentAsString(PrivilegedFileHelper.getResourceAsStream(initScriptPath));
if (isolatedDB)
{
scripts =
scripts.replace("MITEM", itemTableSuffix).replace("MVALUE", valueTableSuffix)
.replace("MREF", refTableSuffix);
}
return scripts;
} | java | private static String prepareScripts(String initScriptPath, String itemTableSuffix, String valueTableSuffix,
String refTableSuffix, boolean isolatedDB) throws IOException
{
String scripts = IOUtil.getStreamContentAsString(PrivilegedFileHelper.getResourceAsStream(initScriptPath));
if (isolatedDB)
{
scripts =
scripts.replace("MITEM", itemTableSuffix).replace("MVALUE", valueTableSuffix)
.replace("MREF", refTableSuffix);
}
return scripts;
} | [
"private",
"static",
"String",
"prepareScripts",
"(",
"String",
"initScriptPath",
",",
"String",
"itemTableSuffix",
",",
"String",
"valueTableSuffix",
",",
"String",
"refTableSuffix",
",",
"boolean",
"isolatedDB",
")",
"throws",
"IOException",
"{",
"String",
"scripts"... | Preparing SQL scripts for database initialization. | [
"Preparing",
"SQL",
"scripts",
"for",
"database",
"initialization",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java#L97-L110 |
136,299 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java | DBInitializerHelper.scriptPath | public static String scriptPath(String dbDialect, boolean multiDb)
{
String suffix = multiDb ? "m" : "s";
String sqlPath = null;
if (dbDialect.startsWith(DBConstants.DB_DIALECT_ORACLE))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.ora.sql";
}
else if (dbDialect.startsWith(DBConstants.DB_DIALECT_PGSQL))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.pgsql.sql";
}
else if (dbDialect.equals(DBConstants.DB_DIALECT_MYSQL))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.mysql.sql";
}
else if (dbDialect.equals(DBConstants.DB_DIALECT_MYSQL_NDB))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.mysql-ndb.sql";
}
else if (dbDialect.equals(DBConstants.DB_DIALECT_MYSQL_NDB_UTF8))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.mysql-ndb-utf8.sql";
}
else if (dbDialect.equals(DBConstants.DB_DIALECT_MYSQL_MYISAM))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.mysql-myisam.sql";
}
else if (dbDialect.equals(DBConstants.DB_DIALECT_MYSQL_UTF8))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.mysql-utf8.sql";
}
else if (dbDialect.equals(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.mysql-myisam-utf8.sql";
}
else if (dbDialect.startsWith(DBConstants.DB_DIALECT_MSSQL))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.mssql.sql";
}
else if (dbDialect.startsWith(DBConstants.DB_DIALECT_DERBY))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.derby.sql";
}
else if (dbDialect.equals(DBConstants.DB_DIALECT_DB2V8))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.db2v8.sql";
}
else if (dbDialect.startsWith(DBConstants.DB_DIALECT_DB2))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.db2.sql";
}
else if (dbDialect.startsWith(DBConstants.DB_DIALECT_SYBASE))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.sybase.sql";
}
else if (dbDialect.startsWith(DBConstants.DB_DIALECT_INGRES))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.ingres.sql";
}
else if (dbDialect.startsWith(DBConstants.DB_DIALECT_H2))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.h2.sql";
}
else if (dbDialect.startsWith(DBConstants.DB_DIALECT_HSQLDB))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.sql";
}
else
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.sql";
}
return sqlPath;
} | java | public static String scriptPath(String dbDialect, boolean multiDb)
{
String suffix = multiDb ? "m" : "s";
String sqlPath = null;
if (dbDialect.startsWith(DBConstants.DB_DIALECT_ORACLE))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.ora.sql";
}
else if (dbDialect.startsWith(DBConstants.DB_DIALECT_PGSQL))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.pgsql.sql";
}
else if (dbDialect.equals(DBConstants.DB_DIALECT_MYSQL))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.mysql.sql";
}
else if (dbDialect.equals(DBConstants.DB_DIALECT_MYSQL_NDB))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.mysql-ndb.sql";
}
else if (dbDialect.equals(DBConstants.DB_DIALECT_MYSQL_NDB_UTF8))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.mysql-ndb-utf8.sql";
}
else if (dbDialect.equals(DBConstants.DB_DIALECT_MYSQL_MYISAM))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.mysql-myisam.sql";
}
else if (dbDialect.equals(DBConstants.DB_DIALECT_MYSQL_UTF8))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.mysql-utf8.sql";
}
else if (dbDialect.equals(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.mysql-myisam-utf8.sql";
}
else if (dbDialect.startsWith(DBConstants.DB_DIALECT_MSSQL))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.mssql.sql";
}
else if (dbDialect.startsWith(DBConstants.DB_DIALECT_DERBY))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.derby.sql";
}
else if (dbDialect.equals(DBConstants.DB_DIALECT_DB2V8))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.db2v8.sql";
}
else if (dbDialect.startsWith(DBConstants.DB_DIALECT_DB2))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.db2.sql";
}
else if (dbDialect.startsWith(DBConstants.DB_DIALECT_SYBASE))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.sybase.sql";
}
else if (dbDialect.startsWith(DBConstants.DB_DIALECT_INGRES))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.ingres.sql";
}
else if (dbDialect.startsWith(DBConstants.DB_DIALECT_H2))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.h2.sql";
}
else if (dbDialect.startsWith(DBConstants.DB_DIALECT_HSQLDB))
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.sql";
}
else
{
sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.sql";
}
return sqlPath;
} | [
"public",
"static",
"String",
"scriptPath",
"(",
"String",
"dbDialect",
",",
"boolean",
"multiDb",
")",
"{",
"String",
"suffix",
"=",
"multiDb",
"?",
"\"m\"",
":",
"\"s\"",
";",
"String",
"sqlPath",
"=",
"null",
";",
"if",
"(",
"dbDialect",
".",
"startsWit... | Returns path where SQL scripts for database initialization is stored. | [
"Returns",
"path",
"where",
"SQL",
"scripts",
"for",
"database",
"initialization",
"is",
"stored",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java#L115-L190 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.