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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
135,700 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserProfileHandlerImpl.java | UserProfileHandlerImpl.postSave | private void postSave(UserProfile userProfile, boolean isNew) throws Exception
{
for (UserProfileEventListener listener : listeners)
{
listener.postSave(userProfile, isNew);
}
} | java | private void postSave(UserProfile userProfile, boolean isNew) throws Exception
{
for (UserProfileEventListener listener : listeners)
{
listener.postSave(userProfile, isNew);
}
} | [
"private",
"void",
"postSave",
"(",
"UserProfile",
"userProfile",
",",
"boolean",
"isNew",
")",
"throws",
"Exception",
"{",
"for",
"(",
"UserProfileEventListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"postSave",
"(",
"userProfile",
",",
"isN... | Notifying listeners after profile creation.
@param userProfile
the user profile which is used in save operation
@param isNew
true if we have deal with new profile, otherwise it is false
which mean update operation is in progress
@throws Exception
if any listener failed to handle the event | [
"Notifying",
"listeners",
"after",
"profile",
"creation",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserProfileHandlerImpl.java#L427-L433 |
135,701 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserProfileHandlerImpl.java | UserProfileHandlerImpl.preDelete | private void preDelete(UserProfile userProfile, boolean broadcast) throws Exception
{
for (UserProfileEventListener listener : listeners)
{
listener.preDelete(userProfile);
}
} | java | private void preDelete(UserProfile userProfile, boolean broadcast) throws Exception
{
for (UserProfileEventListener listener : listeners)
{
listener.preDelete(userProfile);
}
} | [
"private",
"void",
"preDelete",
"(",
"UserProfile",
"userProfile",
",",
"boolean",
"broadcast",
")",
"throws",
"Exception",
"{",
"for",
"(",
"UserProfileEventListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"preDelete",
"(",
"userProfile",
")",
... | Notifying listeners before profile deletion.
@param userProfile
the user profile which is used in delete operation
@throws Exception
if any listener failed to handle the event | [
"Notifying",
"listeners",
"before",
"profile",
"deletion",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserProfileHandlerImpl.java#L443-L449 |
135,702 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserProfileHandlerImpl.java | UserProfileHandlerImpl.postDelete | private void postDelete(UserProfile userProfile) throws Exception
{
for (UserProfileEventListener listener : listeners)
{
listener.postDelete(userProfile);
}
} | java | private void postDelete(UserProfile userProfile) throws Exception
{
for (UserProfileEventListener listener : listeners)
{
listener.postDelete(userProfile);
}
} | [
"private",
"void",
"postDelete",
"(",
"UserProfile",
"userProfile",
")",
"throws",
"Exception",
"{",
"for",
"(",
"UserProfileEventListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"postDelete",
"(",
"userProfile",
")",
";",
"}",
"}"
] | Notifying listeners after profile deletion.
@param userProfile
the user profile which is used in delete operation
@throws Exception
if any listener failed to handle the event | [
"Notifying",
"listeners",
"after",
"profile",
"deletion",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserProfileHandlerImpl.java#L459-L465 |
135,703 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java | GroovyScript2RestLoader.addScripts | protected void addScripts()
{
if (loadPlugins == null || loadPlugins.size() == 0)
{
return;
}
for (GroovyScript2RestLoaderPlugin loadPlugin : loadPlugins)
{
// If no one script configured then skip this item,
// there is no reason to do anything.
if (loadPlugin.getXMLConfigs().size() == 0)
{
continue;
}
Session session = null;
try
{
ManageableRepository repository = repositoryService.getRepository(loadPlugin.getRepository());
String workspace = loadPlugin.getWorkspace();
session = repository.getSystemSession(workspace);
String nodeName = loadPlugin.getNode();
Node node = null;
try
{
node = (Node)session.getItem(nodeName);
}
catch (PathNotFoundException e)
{
StringTokenizer tokens = new StringTokenizer(nodeName, "/");
node = session.getRootNode();
while (tokens.hasMoreTokens())
{
String t = tokens.nextToken();
if (node.hasNode(t))
{
node = node.getNode(t);
}
else
{
node = node.addNode(t, "nt:folder");
}
}
}
for (XMLGroovyScript2Rest xg : loadPlugin.getXMLConfigs())
{
String scriptName = xg.getName();
if (node.hasNode(scriptName))
{
LOG.debug("Script {} already created", scriptName);
continue;
}
createScript(node, scriptName, xg.isAutoload(), configurationManager.getInputStream(xg.getPath()));
}
session.save();
}
catch (Exception e)
{
LOG.error("Failed add scripts. ", e);
}
finally
{
if (session != null)
{
session.logout();
}
}
}
} | java | protected void addScripts()
{
if (loadPlugins == null || loadPlugins.size() == 0)
{
return;
}
for (GroovyScript2RestLoaderPlugin loadPlugin : loadPlugins)
{
// If no one script configured then skip this item,
// there is no reason to do anything.
if (loadPlugin.getXMLConfigs().size() == 0)
{
continue;
}
Session session = null;
try
{
ManageableRepository repository = repositoryService.getRepository(loadPlugin.getRepository());
String workspace = loadPlugin.getWorkspace();
session = repository.getSystemSession(workspace);
String nodeName = loadPlugin.getNode();
Node node = null;
try
{
node = (Node)session.getItem(nodeName);
}
catch (PathNotFoundException e)
{
StringTokenizer tokens = new StringTokenizer(nodeName, "/");
node = session.getRootNode();
while (tokens.hasMoreTokens())
{
String t = tokens.nextToken();
if (node.hasNode(t))
{
node = node.getNode(t);
}
else
{
node = node.addNode(t, "nt:folder");
}
}
}
for (XMLGroovyScript2Rest xg : loadPlugin.getXMLConfigs())
{
String scriptName = xg.getName();
if (node.hasNode(scriptName))
{
LOG.debug("Script {} already created", scriptName);
continue;
}
createScript(node, scriptName, xg.isAutoload(), configurationManager.getInputStream(xg.getPath()));
}
session.save();
}
catch (Exception e)
{
LOG.error("Failed add scripts. ", e);
}
finally
{
if (session != null)
{
session.logout();
}
}
}
} | [
"protected",
"void",
"addScripts",
"(",
")",
"{",
"if",
"(",
"loadPlugins",
"==",
"null",
"||",
"loadPlugins",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"for",
"(",
"GroovyScript2RestLoaderPlugin",
"loadPlugin",
":",
"loadPlugins",
")... | Add scripts that specified in configuration. | [
"Add",
"scripts",
"that",
"specified",
"in",
"configuration",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java#L457-L527 |
135,704 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java | GroovyScript2RestLoader.createScript | protected Node createScript(Node parent, String name, boolean autoload, InputStream stream) throws Exception
{
Node scriptFile = parent.addNode(name, "nt:file");
Node script = scriptFile.addNode("jcr:content", getNodeType());
script.setProperty("exo:autoload", autoload);
script.setProperty("jcr:mimeType", "script/groovy");
script.setProperty("jcr:lastModified", Calendar.getInstance());
script.setProperty("jcr:data", stream);
return scriptFile;
} | java | protected Node createScript(Node parent, String name, boolean autoload, InputStream stream) throws Exception
{
Node scriptFile = parent.addNode(name, "nt:file");
Node script = scriptFile.addNode("jcr:content", getNodeType());
script.setProperty("exo:autoload", autoload);
script.setProperty("jcr:mimeType", "script/groovy");
script.setProperty("jcr:lastModified", Calendar.getInstance());
script.setProperty("jcr:data", stream);
return scriptFile;
} | [
"protected",
"Node",
"createScript",
"(",
"Node",
"parent",
",",
"String",
"name",
",",
"boolean",
"autoload",
",",
"InputStream",
"stream",
")",
"throws",
"Exception",
"{",
"Node",
"scriptFile",
"=",
"parent",
".",
"addNode",
"(",
"name",
",",
"\"nt:file\"",
... | Create JCR node.
@param parent parent node
@param name name of node to be created
@param stream data stream for property jcr:data
@return newly created node
@throws Exception if any errors occurs | [
"Create",
"JCR",
"node",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java#L538-L547 |
135,705 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java | GroovyScript2RestLoader.setAttributeSmart | protected void setAttributeSmart(Element element, String attr, String value)
{
if (value == null)
{
element.removeAttribute(attr);
}
else
{
element.setAttribute(attr, value);
}
} | java | protected void setAttributeSmart(Element element, String attr, String value)
{
if (value == null)
{
element.removeAttribute(attr);
}
else
{
element.setAttribute(attr, value);
}
} | [
"protected",
"void",
"setAttributeSmart",
"(",
"Element",
"element",
",",
"String",
"attr",
",",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"element",
".",
"removeAttribute",
"(",
"attr",
")",
";",
"}",
"else",
"{",
"element... | Set attribute value. If value is null the attribute will be removed.
@param element The element to set attribute value
@param attr The attribute name
@param value The value of attribute | [
"Set",
"attribute",
"value",
".",
"If",
"value",
"is",
"null",
"the",
"attribute",
"will",
"be",
"removed",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java#L681-L691 |
135,706 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java | GroovyScript2RestLoader.load | @POST
@Path("load/{repository}/{workspace}/{path:.*}")
@RolesAllowed({"administrators"})
public Response load(@PathParam("repository") String repository, @PathParam("workspace") String workspace,
@PathParam("path") String path, @DefaultValue("true") @QueryParam("state") boolean state,
@QueryParam("sources") List<String> sources, @QueryParam("file") List<String> files,
MultivaluedMap<String, String> properties)
{
try
{
return load(repository, workspace, path, state, properties, createSourceFolders(sources),
createSourceFiles(files));
}
catch (MalformedURLException e)
{
LOG.error(e.getMessage(), e);
return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).type(MediaType.TEXT_PLAIN).build();
}
} | java | @POST
@Path("load/{repository}/{workspace}/{path:.*}")
@RolesAllowed({"administrators"})
public Response load(@PathParam("repository") String repository, @PathParam("workspace") String workspace,
@PathParam("path") String path, @DefaultValue("true") @QueryParam("state") boolean state,
@QueryParam("sources") List<String> sources, @QueryParam("file") List<String> files,
MultivaluedMap<String, String> properties)
{
try
{
return load(repository, workspace, path, state, properties, createSourceFolders(sources),
createSourceFiles(files));
}
catch (MalformedURLException e)
{
LOG.error(e.getMessage(), e);
return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).type(MediaType.TEXT_PLAIN).build();
}
} | [
"@",
"POST",
"@",
"Path",
"(",
"\"load/{repository}/{workspace}/{path:.*}\"",
")",
"@",
"RolesAllowed",
"(",
"{",
"\"administrators\"",
"}",
")",
"public",
"Response",
"load",
"(",
"@",
"PathParam",
"(",
"\"repository\"",
")",
"String",
"repository",
",",
"@",
"... | Deploy groovy script as REST service. If this property set to 'true' then
script will be deployed as REST service if 'false' the script will be
undeployed. NOTE is script already deployed and state is
true script will be re-deployed.
@param repository repository name
@param workspace workspace name
@param path the path to JCR node that contains groovy script to be
deployed
@param state <code>true</code> if resource should be loaded and
<code>false</code> otherwise. If this attribute is not present
in HTTP request then it will be considered as <code>true</code>
@param sources locations (string representation of URL) of source folders
that should be add in class path when compile Groovy script.
NOTE: To be able load Groovy source files from specified
folders the following rules must be observed:
- Groovy source files must be located in folder with respect
to package structure
- Name of Groovy source files must be the same as name of
class located in file
- Groovy source file must have extension '.groovy'
Example: If source stream that we want validate contains the
following code:
package c.b.a
import a.b.c.A
class B extends A {
// Do something.
}
Assume we store dependencies in JCR then URL of folder with
Groovy sources may be like this:
<code>jcr://repository/workspace#/groovy-library</code>. Then
absolute path to JCR node that contains Groovy source must be as
following: <code>/groovy-library/a/b/c/A.groovy</code>
@param files locations (string representation of URL) of source files that
should be add in class path when compile Groovy script. Each
location must point directly to file that contains Groovy
source. Source file can have any name and extension
@param properties optional properties to be applied to loaded resource.
Ignored if <code>state</code> parameter is false
@LevelAPI Provisional | [
"Deploy",
"groovy",
"script",
"as",
"REST",
"service",
".",
"If",
"this",
"property",
"set",
"to",
"true",
"then",
"script",
"will",
"be",
"deployed",
"as",
"REST",
"service",
"if",
"false",
"the",
"script",
"will",
"be",
"undeployed",
".",
"NOTE",
"is",
... | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java#L1143-L1161 |
135,707 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java | GroovyScript2RestLoader.deleteScript | @POST
@Path("delete/{repository}/{workspace}/{path:.*}")
public Response deleteScript(@PathParam("repository") String repository, @PathParam("workspace") String workspace,
@PathParam("path") String path)
{
Session ses = null;
try
{
ses =
sessionProviderService.getSessionProvider(null).getSession(workspace,
repositoryService.getRepository(repository));
ses.getItem("/" + path).remove();
ses.save();
return Response.status(Response.Status.NO_CONTENT).build();
}
catch (PathNotFoundException e)
{
String msg = "Path " + path + " does not exists";
LOG.error(msg);
return Response.status(Response.Status.NOT_FOUND).entity(msg).entity(MediaType.TEXT_PLAIN).build();
}
catch (Exception e)
{
LOG.error(e.getMessage(), e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage())
.type(MediaType.TEXT_PLAIN).build();
}
finally
{
if (ses != null)
{
ses.logout();
}
}
} | java | @POST
@Path("delete/{repository}/{workspace}/{path:.*}")
public Response deleteScript(@PathParam("repository") String repository, @PathParam("workspace") String workspace,
@PathParam("path") String path)
{
Session ses = null;
try
{
ses =
sessionProviderService.getSessionProvider(null).getSession(workspace,
repositoryService.getRepository(repository));
ses.getItem("/" + path).remove();
ses.save();
return Response.status(Response.Status.NO_CONTENT).build();
}
catch (PathNotFoundException e)
{
String msg = "Path " + path + " does not exists";
LOG.error(msg);
return Response.status(Response.Status.NOT_FOUND).entity(msg).entity(MediaType.TEXT_PLAIN).build();
}
catch (Exception e)
{
LOG.error(e.getMessage(), e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage())
.type(MediaType.TEXT_PLAIN).build();
}
finally
{
if (ses != null)
{
ses.logout();
}
}
} | [
"@",
"POST",
"@",
"Path",
"(",
"\"delete/{repository}/{workspace}/{path:.*}\"",
")",
"public",
"Response",
"deleteScript",
"(",
"@",
"PathParam",
"(",
"\"repository\"",
")",
"String",
"repository",
",",
"@",
"PathParam",
"(",
"\"workspace\"",
")",
"String",
"workspa... | Remove node that contains groovy script.
@param repository repository name
@param workspace workspace name
@param path JCR path to node that contains script
@LevelAPI Provisional | [
"Remove",
"node",
"that",
"contains",
"groovy",
"script",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java#L1260-L1294 |
135,708 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java | GroovyScript2RestLoader.getScript | @POST
@Produces({"script/groovy"})
@Path("src/{repository}/{workspace}/{path:.*}")
public Response getScript(@PathParam("repository") String repository, @PathParam("workspace") String workspace,
@PathParam("path") String path)
{
Session ses = null;
try
{
ses =
sessionProviderService.getSessionProvider(null).getSession(workspace,
repositoryService.getRepository(repository));
Node scriptFile = (Node)ses.getItem("/" + path);
return Response.status(Response.Status.OK).entity(
scriptFile.getNode("jcr:content").getProperty("jcr:data").getStream()).type("script/groovy").build();
}
catch (PathNotFoundException e)
{
String msg = "Path " + path + " does not exists";
LOG.error(msg);
return Response.status(Response.Status.NOT_FOUND).entity(msg).entity(MediaType.TEXT_PLAIN).build();
}
catch (Exception e)
{
LOG.error(e.getMessage(), e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage())
.type(MediaType.TEXT_PLAIN).build();
}
finally
{
if (ses != null)
{
ses.logout();
}
}
} | java | @POST
@Produces({"script/groovy"})
@Path("src/{repository}/{workspace}/{path:.*}")
public Response getScript(@PathParam("repository") String repository, @PathParam("workspace") String workspace,
@PathParam("path") String path)
{
Session ses = null;
try
{
ses =
sessionProviderService.getSessionProvider(null).getSession(workspace,
repositoryService.getRepository(repository));
Node scriptFile = (Node)ses.getItem("/" + path);
return Response.status(Response.Status.OK).entity(
scriptFile.getNode("jcr:content").getProperty("jcr:data").getStream()).type("script/groovy").build();
}
catch (PathNotFoundException e)
{
String msg = "Path " + path + " does not exists";
LOG.error(msg);
return Response.status(Response.Status.NOT_FOUND).entity(msg).entity(MediaType.TEXT_PLAIN).build();
}
catch (Exception e)
{
LOG.error(e.getMessage(), e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage())
.type(MediaType.TEXT_PLAIN).build();
}
finally
{
if (ses != null)
{
ses.logout();
}
}
} | [
"@",
"POST",
"@",
"Produces",
"(",
"{",
"\"script/groovy\"",
"}",
")",
"@",
"Path",
"(",
"\"src/{repository}/{workspace}/{path:.*}\"",
")",
"public",
"Response",
"getScript",
"(",
"@",
"PathParam",
"(",
"\"repository\"",
")",
"String",
"repository",
",",
"@",
"P... | Get source code of groovy script.
@param repository repository name
@param workspace workspace name
@param path JCR path to node that contains script
@return groovy script as stream
@response
{code}
"scriptsource" : the source code of groovy script.
{code}
@LevelAPI Provisional | [
"Get",
"source",
"code",
"of",
"groovy",
"script",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java#L1360-L1395 |
135,709 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java | GroovyScript2RestLoader.getScriptMetadata | @POST
@Produces({MediaType.APPLICATION_JSON})
@Path("meta/{repository}/{workspace}/{path:.*}")
public Response getScriptMetadata(@PathParam("repository") String repository,
@PathParam("workspace") String workspace, @PathParam("path") String path)
{
Session ses = null;
try
{
ses =
sessionProviderService.getSessionProvider(null).getSession(workspace,
repositoryService.getRepository(repository));
Node script = ((Node)ses.getItem("/" + path)).getNode("jcr:content");
ResourceId key = new NodeScriptKey(repository, workspace, script);
ScriptMetadata meta = new ScriptMetadata(script.getProperty("exo:autoload").getBoolean(), //
groovyPublisher.isPublished(key), //
script.getProperty("jcr:mimeType").getString(), //
script.getProperty("jcr:lastModified").getDate().getTimeInMillis());
return Response.status(Response.Status.OK).entity(meta).type(MediaType.APPLICATION_JSON).build();
}
catch (PathNotFoundException e)
{
String msg = "Path " + path + " does not exists";
LOG.error(msg);
return Response.status(Response.Status.NOT_FOUND).entity(msg).entity(MediaType.TEXT_PLAIN).build();
}
catch (Exception e)
{
LOG.error(e.getMessage(), e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage())
.type(MediaType.TEXT_PLAIN).build();
}
finally
{
if (ses != null)
{
ses.logout();
}
}
} | java | @POST
@Produces({MediaType.APPLICATION_JSON})
@Path("meta/{repository}/{workspace}/{path:.*}")
public Response getScriptMetadata(@PathParam("repository") String repository,
@PathParam("workspace") String workspace, @PathParam("path") String path)
{
Session ses = null;
try
{
ses =
sessionProviderService.getSessionProvider(null).getSession(workspace,
repositoryService.getRepository(repository));
Node script = ((Node)ses.getItem("/" + path)).getNode("jcr:content");
ResourceId key = new NodeScriptKey(repository, workspace, script);
ScriptMetadata meta = new ScriptMetadata(script.getProperty("exo:autoload").getBoolean(), //
groovyPublisher.isPublished(key), //
script.getProperty("jcr:mimeType").getString(), //
script.getProperty("jcr:lastModified").getDate().getTimeInMillis());
return Response.status(Response.Status.OK).entity(meta).type(MediaType.APPLICATION_JSON).build();
}
catch (PathNotFoundException e)
{
String msg = "Path " + path + " does not exists";
LOG.error(msg);
return Response.status(Response.Status.NOT_FOUND).entity(msg).entity(MediaType.TEXT_PLAIN).build();
}
catch (Exception e)
{
LOG.error(e.getMessage(), e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage())
.type(MediaType.TEXT_PLAIN).build();
}
finally
{
if (ses != null)
{
ses.logout();
}
}
} | [
"@",
"POST",
"@",
"Produces",
"(",
"{",
"MediaType",
".",
"APPLICATION_JSON",
"}",
")",
"@",
"Path",
"(",
"\"meta/{repository}/{workspace}/{path:.*}\"",
")",
"public",
"Response",
"getScriptMetadata",
"(",
"@",
"PathParam",
"(",
"\"repository\"",
")",
"String",
"r... | Get groovy script's meta-information.
@param repository repository name
@param workspace workspace name
@param path JCR path to node that contains script
@return groovy script's meta-information
@response
{code:json}
"scriptList" : the groovy script's meta-information
{code}
@LevelAPI Provisional | [
"Get",
"groovy",
"script",
"s",
"meta",
"-",
"information",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java#L1410-L1450 |
135,710 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java | GroovyScript2RestLoader.list | @POST
@Produces(MediaType.APPLICATION_JSON)
@Path("list/{repository}/{workspace}")
public Response list(@PathParam("repository") String repository, @PathParam("workspace") String workspace,
@QueryParam("name") String name)
{
Session ses = null;
try
{
ses =
sessionProviderService.getSessionProvider(null).getSession(workspace,
repositoryService.getRepository(repository));
String xpath = "//element(*, exo:groovyResourceContainer)";
Query query = ses.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH);
QueryResult result = query.execute();
NodeIterator nodeIterator = result.getNodes();
ArrayList<String> scriptList = new ArrayList<String>();
if (name == null || name.length() == 0)
{
while (nodeIterator.hasNext())
{
Node node = nodeIterator.nextNode();
scriptList.add(node.getParent().getPath());
}
}
else
{
StringBuilder p = new StringBuilder();
// add '.*' pattern at the start
p.append(".*");
for (int i = 0; i < name.length(); i++)
{
char c = name.charAt(i);
if (c == '*' || c == '?')
{
p.append('.');
}
if (".()[]^$|".indexOf(c) != -1)
{
p.append('\\');
}
p.append(c);
}
// add '.*' pattern at he end
p.append(".*");
Pattern pattern = Pattern.compile(p.toString(), Pattern.CASE_INSENSITIVE);
while (nodeIterator.hasNext())
{
Node node = nodeIterator.nextNode();
String scriptName = node.getParent().getPath();
if (pattern.matcher(scriptName).matches())
{
scriptList.add(scriptName);
}
}
}
Collections.sort(scriptList);
return Response.status(Response.Status.OK).entity(new ScriptList(scriptList)).type(MediaType.APPLICATION_JSON)
.build();
}
catch (Exception e)
{
LOG.error(e.getMessage(), e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage())
.type(MediaType.TEXT_PLAIN).build();
}
finally
{
if (ses != null)
{
ses.logout();
}
}
} | java | @POST
@Produces(MediaType.APPLICATION_JSON)
@Path("list/{repository}/{workspace}")
public Response list(@PathParam("repository") String repository, @PathParam("workspace") String workspace,
@QueryParam("name") String name)
{
Session ses = null;
try
{
ses =
sessionProviderService.getSessionProvider(null).getSession(workspace,
repositoryService.getRepository(repository));
String xpath = "//element(*, exo:groovyResourceContainer)";
Query query = ses.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH);
QueryResult result = query.execute();
NodeIterator nodeIterator = result.getNodes();
ArrayList<String> scriptList = new ArrayList<String>();
if (name == null || name.length() == 0)
{
while (nodeIterator.hasNext())
{
Node node = nodeIterator.nextNode();
scriptList.add(node.getParent().getPath());
}
}
else
{
StringBuilder p = new StringBuilder();
// add '.*' pattern at the start
p.append(".*");
for (int i = 0; i < name.length(); i++)
{
char c = name.charAt(i);
if (c == '*' || c == '?')
{
p.append('.');
}
if (".()[]^$|".indexOf(c) != -1)
{
p.append('\\');
}
p.append(c);
}
// add '.*' pattern at he end
p.append(".*");
Pattern pattern = Pattern.compile(p.toString(), Pattern.CASE_INSENSITIVE);
while (nodeIterator.hasNext())
{
Node node = nodeIterator.nextNode();
String scriptName = node.getParent().getPath();
if (pattern.matcher(scriptName).matches())
{
scriptList.add(scriptName);
}
}
}
Collections.sort(scriptList);
return Response.status(Response.Status.OK).entity(new ScriptList(scriptList)).type(MediaType.APPLICATION_JSON)
.build();
}
catch (Exception e)
{
LOG.error(e.getMessage(), e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage())
.type(MediaType.TEXT_PLAIN).build();
}
finally
{
if (ses != null)
{
ses.logout();
}
}
} | [
"@",
"POST",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Path",
"(",
"\"list/{repository}/{workspace}\"",
")",
"public",
"Response",
"list",
"(",
"@",
"PathParam",
"(",
"\"repository\"",
")",
"String",
"repository",
",",
"@",
"PathPara... | Returns the list of all groovy-scripts found in workspace.
@param repository repository name
@param workspace workspace name
@param name additional search parameter. If not empty method returns the
list of script names matching wildcard else returns all the
scripts found in workspace.
@return list of groovy services
@response
{code:json}
"scriptList" : the list of all groovy scripts found in workspace.
{code}
@LevelAPI Provisional | [
"Returns",
"the",
"list",
"of",
"all",
"groovy",
"-",
"scripts",
"found",
"in",
"workspace",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java#L1467-L1546 |
135,711 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java | GroovyScript2RestLoader.getPath | protected static String getPath(String fullPath)
{
int sl = fullPath.lastIndexOf('/');
return sl > 0 ? "/" + fullPath.substring(0, sl) : "/";
} | java | protected static String getPath(String fullPath)
{
int sl = fullPath.lastIndexOf('/');
return sl > 0 ? "/" + fullPath.substring(0, sl) : "/";
} | [
"protected",
"static",
"String",
"getPath",
"(",
"String",
"fullPath",
")",
"{",
"int",
"sl",
"=",
"fullPath",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"return",
"sl",
">",
"0",
"?",
"\"/\"",
"+",
"fullPath",
".",
"substring",
"(",
"0",
",",
"sl"... | Extract path to node's parent from full path.
@param fullPath full path to node
@return node's parent path | [
"Extract",
"path",
"to",
"node",
"s",
"parent",
"from",
"full",
"path",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java#L1622-L1626 |
135,712 | exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java | GroovyScript2RestLoader.getName | protected static String getName(String fullPath)
{
int sl = fullPath.lastIndexOf('/');
return sl >= 0 ? fullPath.substring(sl + 1) : fullPath;
} | java | protected static String getName(String fullPath)
{
int sl = fullPath.lastIndexOf('/');
return sl >= 0 ? fullPath.substring(sl + 1) : fullPath;
} | [
"protected",
"static",
"String",
"getName",
"(",
"String",
"fullPath",
")",
"{",
"int",
"sl",
"=",
"fullPath",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"return",
"sl",
">=",
"0",
"?",
"fullPath",
".",
"substring",
"(",
"sl",
"+",
"1",
")",
":",
... | Extract node's name from full node path.
@param fullPath full path to node
@return node's name | [
"Extract",
"node",
"s",
"name",
"from",
"full",
"node",
"path",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java#L1634-L1638 |
135,713 | exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/HierarchicalProperty.java | HierarchicalProperty.getChild | public HierarchicalProperty getChild(QName name)
{
for (HierarchicalProperty child : children)
{
if (child.getName().equals(name))
return child;
}
return null;
} | java | public HierarchicalProperty getChild(QName name)
{
for (HierarchicalProperty child : children)
{
if (child.getName().equals(name))
return child;
}
return null;
} | [
"public",
"HierarchicalProperty",
"getChild",
"(",
"QName",
"name",
")",
"{",
"for",
"(",
"HierarchicalProperty",
"child",
":",
"children",
")",
"{",
"if",
"(",
"child",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"return",
"child",
"... | retrieves children property by name.
@param name child name
@return property or null if not found | [
"retrieves",
"children",
"property",
"by",
"name",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/HierarchicalProperty.java#L150-L158 |
135,714 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java | Text.md5 | public static String md5(String data, String enc) throws UnsupportedEncodingException
{
try
{
return digest("MD5", data.getBytes(enc));
}
catch (NoSuchAlgorithmException e)
{
throw new InternalError("MD5 digest not available???");
}
} | java | public static String md5(String data, String enc) throws UnsupportedEncodingException
{
try
{
return digest("MD5", data.getBytes(enc));
}
catch (NoSuchAlgorithmException e)
{
throw new InternalError("MD5 digest not available???");
}
} | [
"public",
"static",
"String",
"md5",
"(",
"String",
"data",
",",
"String",
"enc",
")",
"throws",
"UnsupportedEncodingException",
"{",
"try",
"{",
"return",
"digest",
"(",
"\"MD5\"",
",",
"data",
".",
"getBytes",
"(",
"enc",
")",
")",
";",
"}",
"catch",
"... | Calculate an MD5 hash of the string given.
@param data
the data to encode
@param enc
the character encoding to use
@return a hex encoded string of the md5 digested input | [
"Calculate",
"an",
"MD5",
"hash",
"of",
"the",
"string",
"given",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java#L56-L66 |
135,715 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java | Text.explode | public static String[] explode(String str, int ch, boolean respectEmpty)
{
if (str == null || str.length() == 0)
{
return new String[0];
}
ArrayList strings = new ArrayList();
int pos;
int lastpos = 0;
// add snipples
while ((pos = str.indexOf(ch, lastpos)) >= 0)
{
if (pos - lastpos > 0 || respectEmpty)
{
strings.add(str.substring(lastpos, pos));
}
lastpos = pos + 1;
}
// add rest
if (lastpos < str.length())
{
strings.add(str.substring(lastpos));
}
else if (respectEmpty && lastpos == str.length())
{
strings.add("");
}
// return stringarray
return (String[])strings.toArray(new String[strings.size()]);
} | java | public static String[] explode(String str, int ch, boolean respectEmpty)
{
if (str == null || str.length() == 0)
{
return new String[0];
}
ArrayList strings = new ArrayList();
int pos;
int lastpos = 0;
// add snipples
while ((pos = str.indexOf(ch, lastpos)) >= 0)
{
if (pos - lastpos > 0 || respectEmpty)
{
strings.add(str.substring(lastpos, pos));
}
lastpos = pos + 1;
}
// add rest
if (lastpos < str.length())
{
strings.add(str.substring(lastpos));
}
else if (respectEmpty && lastpos == str.length())
{
strings.add("");
}
// return stringarray
return (String[])strings.toArray(new String[strings.size()]);
} | [
"public",
"static",
"String",
"[",
"]",
"explode",
"(",
"String",
"str",
",",
"int",
"ch",
",",
"boolean",
"respectEmpty",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"str",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"new",
"String... | returns an array of strings decomposed of the original string, split at every occurance of
'ch'.
@param str
the string to decompose
@param ch
the character to use a split pattern
@param respectEmpty
if <code>true</code>, empty elements are generated
@return an array of strings | [
"returns",
"an",
"array",
"of",
"strings",
"decomposed",
"of",
"the",
"original",
"string",
"split",
"at",
"every",
"occurance",
"of",
"ch",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java#L165-L197 |
135,716 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java | Text.implode | public static String implode(String[] arr, String delim)
{
StringBuilder buf = new StringBuilder();
for (int i = 0; i < arr.length; i++)
{
if (i > 0)
{
buf.append(delim);
}
buf.append(arr[i]);
}
return buf.toString();
} | java | public static String implode(String[] arr, String delim)
{
StringBuilder buf = new StringBuilder();
for (int i = 0; i < arr.length; i++)
{
if (i > 0)
{
buf.append(delim);
}
buf.append(arr[i]);
}
return buf.toString();
} | [
"public",
"static",
"String",
"implode",
"(",
"String",
"[",
"]",
"arr",
",",
"String",
"delim",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"arr",
".",
"length",
";... | Concatenates all strings in the string array using the specified delimiter.
@param arr
@param delim
@return the concatenated string | [
"Concatenates",
"all",
"strings",
"in",
"the",
"string",
"array",
"using",
"the",
"specified",
"delimiter",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java#L206-L218 |
135,717 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java | Text.encodeIllegalXMLCharacters | public static String encodeIllegalXMLCharacters(String text)
{
if (text == null)
{
throw new IllegalArgumentException("null argument");
}
StringBuilder buf = null;
int length = text.length();
int pos = 0;
for (int i = 0; i < length; i++)
{
int ch = text.charAt(i);
switch (ch)
{
case '<' :
case '>' :
case '&' :
case '"' :
case '\'' :
if (buf == null)
{
buf = new StringBuilder();
}
if (i > 0)
{
buf.append(text.substring(pos, i));
}
pos = i + 1;
break;
default :
continue;
}
if (ch == '<')
{
buf.append("<");
}
else if (ch == '>')
{
buf.append(">");
}
else if (ch == '&')
{
buf.append("&");
}
else if (ch == '"')
{
buf.append(""");
}
else if (ch == '\'')
{
buf.append("'");
}
}
if (buf == null)
{
return text;
}
else
{
if (pos < length)
{
buf.append(text.substring(pos));
}
return buf.toString();
}
} | java | public static String encodeIllegalXMLCharacters(String text)
{
if (text == null)
{
throw new IllegalArgumentException("null argument");
}
StringBuilder buf = null;
int length = text.length();
int pos = 0;
for (int i = 0; i < length; i++)
{
int ch = text.charAt(i);
switch (ch)
{
case '<' :
case '>' :
case '&' :
case '"' :
case '\'' :
if (buf == null)
{
buf = new StringBuilder();
}
if (i > 0)
{
buf.append(text.substring(pos, i));
}
pos = i + 1;
break;
default :
continue;
}
if (ch == '<')
{
buf.append("<");
}
else if (ch == '>')
{
buf.append(">");
}
else if (ch == '&')
{
buf.append("&");
}
else if (ch == '"')
{
buf.append(""");
}
else if (ch == '\'')
{
buf.append("'");
}
}
if (buf == null)
{
return text;
}
else
{
if (pos < length)
{
buf.append(text.substring(pos));
}
return buf.toString();
}
} | [
"public",
"static",
"String",
"encodeIllegalXMLCharacters",
"(",
"String",
"text",
")",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"null argument\"",
")",
";",
"}",
"StringBuilder",
"buf",
"=",
"null",
";... | Replaces illegal XML characters in the given string by their corresponding predefined entity
references.
@param text
text to be escaped
@return a string | [
"Replaces",
"illegal",
"XML",
"characters",
"in",
"the",
"given",
"string",
"by",
"their",
"corresponding",
"predefined",
"entity",
"references",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java#L266-L331 |
135,718 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java | Text.getName | public static String getName(String path)
{
int pos = path.lastIndexOf('/');
return pos >= 0 ? path.substring(pos + 1) : "";
} | java | public static String getName(String path)
{
int pos = path.lastIndexOf('/');
return pos >= 0 ? path.substring(pos + 1) : "";
} | [
"public",
"static",
"String",
"getName",
"(",
"String",
"path",
")",
"{",
"int",
"pos",
"=",
"path",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"return",
"pos",
">=",
"0",
"?",
"path",
".",
"substring",
"(",
"pos",
"+",
"1",
")",
":",
"\"\"",
"... | Returns the name part of the path
@param path
the path
@return the name part | [
"Returns",
"the",
"name",
"part",
"of",
"the",
"path"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java#L619-L623 |
135,719 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java | Text.isSibling | public static boolean isSibling(String p1, String p2)
{
int pos1 = p1.lastIndexOf('/');
int pos2 = p2.lastIndexOf('/');
return (pos1 == pos2 && pos1 >= 0 && p1.regionMatches(0, p2, 0, pos1));
} | java | public static boolean isSibling(String p1, String p2)
{
int pos1 = p1.lastIndexOf('/');
int pos2 = p2.lastIndexOf('/');
return (pos1 == pos2 && pos1 >= 0 && p1.regionMatches(0, p2, 0, pos1));
} | [
"public",
"static",
"boolean",
"isSibling",
"(",
"String",
"p1",
",",
"String",
"p2",
")",
"{",
"int",
"pos1",
"=",
"p1",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"int",
"pos2",
"=",
"p2",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"return",
... | Determines, if two paths denote hierarchical siblins.
@param p1
first path
@param p2
second path
@return true if on same level, false otherwise | [
"Determines",
"if",
"two",
"paths",
"denote",
"hierarchical",
"siblins",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java#L699-L704 |
135,720 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AggregateRuleImpl.java | AggregateRuleImpl.getNodeTypeName | private InternalQName getNodeTypeName(Node config) throws IllegalNameException, RepositoryException
{
String ntString = config.getAttributes().getNamedItem("primaryType").getNodeValue();
return resolver.parseJCRName(ntString).getInternalName();
} | java | private InternalQName getNodeTypeName(Node config) throws IllegalNameException, RepositoryException
{
String ntString = config.getAttributes().getNamedItem("primaryType").getNodeValue();
return resolver.parseJCRName(ntString).getInternalName();
} | [
"private",
"InternalQName",
"getNodeTypeName",
"(",
"Node",
"config",
")",
"throws",
"IllegalNameException",
",",
"RepositoryException",
"{",
"String",
"ntString",
"=",
"config",
".",
"getAttributes",
"(",
")",
".",
"getNamedItem",
"(",
"\"primaryType\"",
")",
".",
... | Reads the node type of the root node of the indexing aggregate.
@param config the configuration.
@return the name of the node type.
@throws IllegalNameException if the node type name contains illegal
characters.
@throws RepositoryException | [
"Reads",
"the",
"node",
"type",
"of",
"the",
"root",
"node",
"of",
"the",
"indexing",
"aggregate",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AggregateRuleImpl.java#L194-L198 |
135,721 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java | SearchIndex.isIndexRecoveryRequired | @SuppressWarnings("unchecked")
private boolean isIndexRecoveryRequired() throws RepositoryException
{
// instantiate filters first, if not initialized
if (recoveryFilters == null)
{
recoveryFilters = new ArrayList<AbstractRecoveryFilter>();
log.info("Initializing RecoveryFilters.");
// add default filter, if none configured.
if (recoveryFilterClasses.isEmpty())
{
this.recoveryFilterClasses.add(DocNumberRecoveryFilter.class.getName());
}
for (String recoveryFilterClassName : recoveryFilterClasses)
{
AbstractRecoveryFilter filter = null;
Class<? extends AbstractRecoveryFilter> filterClass;
try
{
filterClass =
(Class<? extends AbstractRecoveryFilter>)ClassLoading.forName(recoveryFilterClassName, this);
Constructor<? extends AbstractRecoveryFilter> constuctor = filterClass.getConstructor(SearchIndex.class);
filter = constuctor.newInstance(this);
recoveryFilters.add(filter);
}
catch (ClassNotFoundException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (IllegalArgumentException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (InstantiationException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (IllegalAccessException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (InvocationTargetException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (SecurityException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (NoSuchMethodException e)
{
throw new RepositoryException(e.getMessage(), e);
}
}
}
// invoke filters
for (AbstractRecoveryFilter filter : recoveryFilters)
{
if (filter.accept())
{
return true;
}
}
return false;
} | java | @SuppressWarnings("unchecked")
private boolean isIndexRecoveryRequired() throws RepositoryException
{
// instantiate filters first, if not initialized
if (recoveryFilters == null)
{
recoveryFilters = new ArrayList<AbstractRecoveryFilter>();
log.info("Initializing RecoveryFilters.");
// add default filter, if none configured.
if (recoveryFilterClasses.isEmpty())
{
this.recoveryFilterClasses.add(DocNumberRecoveryFilter.class.getName());
}
for (String recoveryFilterClassName : recoveryFilterClasses)
{
AbstractRecoveryFilter filter = null;
Class<? extends AbstractRecoveryFilter> filterClass;
try
{
filterClass =
(Class<? extends AbstractRecoveryFilter>)ClassLoading.forName(recoveryFilterClassName, this);
Constructor<? extends AbstractRecoveryFilter> constuctor = filterClass.getConstructor(SearchIndex.class);
filter = constuctor.newInstance(this);
recoveryFilters.add(filter);
}
catch (ClassNotFoundException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (IllegalArgumentException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (InstantiationException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (IllegalAccessException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (InvocationTargetException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (SecurityException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (NoSuchMethodException e)
{
throw new RepositoryException(e.getMessage(), e);
}
}
}
// invoke filters
for (AbstractRecoveryFilter filter : recoveryFilters)
{
if (filter.accept())
{
return true;
}
}
return false;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"boolean",
"isIndexRecoveryRequired",
"(",
")",
"throws",
"RepositoryException",
"{",
"// instantiate filters first, if not initialized",
"if",
"(",
"recoveryFilters",
"==",
"null",
")",
"{",
"recoveryFilters",
... | Invokes all recovery filters from the set
@return true if any filter requires reindexing | [
"Invokes",
"all",
"recovery",
"filters",
"from",
"the",
"set"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java#L948-L1013 |
135,722 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java | SearchIndex.executeQuery | public MultiColumnQueryHits executeQuery(SessionImpl session, AbstractQueryImpl queryImpl, Query query,
QPath[] orderProps, boolean[] orderSpecs, long resultFetchHint) throws IOException, RepositoryException
{
waitForResuming();
checkOpen();
workingThreads.incrementAndGet();
try
{
FieldComparatorSource scs = queryImpl.isCaseInsensitiveOrder() ? this.sics : this.scs;
Sort sort = new Sort(createSortFields(orderProps, orderSpecs, scs));
final IndexReader reader = getIndexReader(queryImpl.needsSystemTree());
@SuppressWarnings("resource")
JcrIndexSearcher searcher = new JcrIndexSearcher(session, reader, getContext().getItemStateManager());
searcher.setSimilarity(getSimilarity());
return new FilterMultiColumnQueryHits(searcher.execute(query, sort, resultFetchHint,
QueryImpl.DEFAULT_SELECTOR_NAME))
{
@Override
public void close() throws IOException
{
try
{
super.close();
}
finally
{
PerQueryCache.getInstance().dispose();
Util.closeOrRelease(reader);
}
}
};
}
finally
{
workingThreads.decrementAndGet();
if (isSuspended.get() && workingThreads.get() == 0)
{
synchronized (workingThreads)
{
workingThreads.notifyAll();
}
}
}
} | java | public MultiColumnQueryHits executeQuery(SessionImpl session, AbstractQueryImpl queryImpl, Query query,
QPath[] orderProps, boolean[] orderSpecs, long resultFetchHint) throws IOException, RepositoryException
{
waitForResuming();
checkOpen();
workingThreads.incrementAndGet();
try
{
FieldComparatorSource scs = queryImpl.isCaseInsensitiveOrder() ? this.sics : this.scs;
Sort sort = new Sort(createSortFields(orderProps, orderSpecs, scs));
final IndexReader reader = getIndexReader(queryImpl.needsSystemTree());
@SuppressWarnings("resource")
JcrIndexSearcher searcher = new JcrIndexSearcher(session, reader, getContext().getItemStateManager());
searcher.setSimilarity(getSimilarity());
return new FilterMultiColumnQueryHits(searcher.execute(query, sort, resultFetchHint,
QueryImpl.DEFAULT_SELECTOR_NAME))
{
@Override
public void close() throws IOException
{
try
{
super.close();
}
finally
{
PerQueryCache.getInstance().dispose();
Util.closeOrRelease(reader);
}
}
};
}
finally
{
workingThreads.decrementAndGet();
if (isSuspended.get() && workingThreads.get() == 0)
{
synchronized (workingThreads)
{
workingThreads.notifyAll();
}
}
}
} | [
"public",
"MultiColumnQueryHits",
"executeQuery",
"(",
"SessionImpl",
"session",
",",
"AbstractQueryImpl",
"queryImpl",
",",
"Query",
"query",
",",
"QPath",
"[",
"]",
"orderProps",
",",
"boolean",
"[",
"]",
"orderSpecs",
",",
"long",
"resultFetchHint",
")",
"throw... | Executes the query on the search index.
@param session
the session that executes the query.
@param queryImpl
the query impl.
@param query
the lucene query.
@param orderProps
name of the properties for sort order.
@param orderSpecs
the order specs for the sort order properties.
<code>true</code> indicates ascending order,
<code>false</code> indicates descending.
@param resultFetchHint
a hint on how many results should be fetched.
@return the query hits.
@throws IOException
if an error occurs while searching the index.
@throws RepositoryException | [
"Executes",
"the",
"query",
"on",
"the",
"search",
"index",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java#L1528-L1575 |
135,723 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java | SearchIndex.getIndexFormatVersion | public IndexFormatVersion getIndexFormatVersion()
{
if (indexFormatVersion == null)
{
if (getContext().getParentHandler() instanceof SearchIndex)
{
SearchIndex parent = (SearchIndex)getContext().getParentHandler();
if (parent.getIndexFormatVersion().getVersion() < indexRegister.getDefaultIndex().getIndexFormatVersion().getVersion())
{
indexFormatVersion = parent.getIndexFormatVersion();
}
else
{
indexFormatVersion = indexRegister.getDefaultIndex().getIndexFormatVersion();
}
}
else
{
indexFormatVersion = indexRegister.getDefaultIndex().getIndexFormatVersion();
}
}
return indexFormatVersion;
} | java | public IndexFormatVersion getIndexFormatVersion()
{
if (indexFormatVersion == null)
{
if (getContext().getParentHandler() instanceof SearchIndex)
{
SearchIndex parent = (SearchIndex)getContext().getParentHandler();
if (parent.getIndexFormatVersion().getVersion() < indexRegister.getDefaultIndex().getIndexFormatVersion().getVersion())
{
indexFormatVersion = parent.getIndexFormatVersion();
}
else
{
indexFormatVersion = indexRegister.getDefaultIndex().getIndexFormatVersion();
}
}
else
{
indexFormatVersion = indexRegister.getDefaultIndex().getIndexFormatVersion();
}
}
return indexFormatVersion;
} | [
"public",
"IndexFormatVersion",
"getIndexFormatVersion",
"(",
")",
"{",
"if",
"(",
"indexFormatVersion",
"==",
"null",
")",
"{",
"if",
"(",
"getContext",
"(",
")",
".",
"getParentHandler",
"(",
")",
"instanceof",
"SearchIndex",
")",
"{",
"SearchIndex",
"parent",... | Returns the index format version that this search index is able to
support when a query is executed on this index.
@return the index format version for this search index. | [
"Returns",
"the",
"index",
"format",
"version",
"that",
"this",
"search",
"index",
"is",
"able",
"to",
"support",
"when",
"a",
"query",
"is",
"executed",
"on",
"this",
"index",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java#L1690-L1712 |
135,724 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java | SearchIndex.getIndexReader | protected IndexReader getIndexReader(boolean includeSystemIndex) throws IOException
{
// deny query execution if index in offline mode and allowQuery is false
if (!indexRegister.getDefaultIndex().isOnline() && !allowQuery.get())
{
throw new IndexOfflineIOException("Index is offline");
}
QueryHandler parentHandler = getContext().getParentHandler();
CachingMultiIndexReader parentReader = null;
if (parentHandler instanceof SearchIndex && includeSystemIndex)
{
parentReader = ((SearchIndex)parentHandler).indexRegister.getDefaultIndex().getIndexReader();
}
IndexReader reader;
if (parentReader != null)
{
CachingMultiIndexReader[] readers = {indexRegister.getDefaultIndex().getIndexReader(), parentReader};
reader = new CombinedIndexReader(readers);
}
else
{
reader = indexRegister.getDefaultIndex().getIndexReader();
}
return new JcrIndexReader(reader);
} | java | protected IndexReader getIndexReader(boolean includeSystemIndex) throws IOException
{
// deny query execution if index in offline mode and allowQuery is false
if (!indexRegister.getDefaultIndex().isOnline() && !allowQuery.get())
{
throw new IndexOfflineIOException("Index is offline");
}
QueryHandler parentHandler = getContext().getParentHandler();
CachingMultiIndexReader parentReader = null;
if (parentHandler instanceof SearchIndex && includeSystemIndex)
{
parentReader = ((SearchIndex)parentHandler).indexRegister.getDefaultIndex().getIndexReader();
}
IndexReader reader;
if (parentReader != null)
{
CachingMultiIndexReader[] readers = {indexRegister.getDefaultIndex().getIndexReader(), parentReader};
reader = new CombinedIndexReader(readers);
}
else
{
reader = indexRegister.getDefaultIndex().getIndexReader();
}
return new JcrIndexReader(reader);
} | [
"protected",
"IndexReader",
"getIndexReader",
"(",
"boolean",
"includeSystemIndex",
")",
"throws",
"IOException",
"{",
"// deny query execution if index in offline mode and allowQuery is false",
"if",
"(",
"!",
"indexRegister",
".",
"getDefaultIndex",
"(",
")",
".",
"isOnline... | Returns an index reader for this search index. The caller of this method
is responsible for closing the index reader when he is finished using it.
@param includeSystemIndex
if <code>true</code> the index reader will cover the complete
workspace. If <code>false</code> the returned index reader
will not contains any nodes under /jcr:system.
@return an index reader for this search index.
@throws IOException
the index reader cannot be obtained. | [
"Returns",
"an",
"index",
"reader",
"for",
"this",
"search",
"index",
".",
"The",
"caller",
"of",
"this",
"method",
"is",
"responsible",
"for",
"closing",
"the",
"index",
"reader",
"when",
"he",
"is",
"finished",
"using",
"it",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java#L1734-L1759 |
135,725 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java | SearchIndex.createSortFields | protected SortField[] createSortFields(QPath[] orderProps, boolean[] orderSpecs, FieldComparatorSource scs)
throws RepositoryException
{
List<SortField> sortFields = new ArrayList<SortField>();
for (int i = 0; i < orderProps.length; i++)
{
if (orderProps[i].getEntries().length == 1 && Constants.JCR_SCORE.equals(orderProps[i].getName()))
{
// order on jcr:score does not use the natural order as
// implemented in lucene. score ascending in lucene means that
// higher scores are first. JCR specs that lower score values
// are first.
sortFields.add(new SortField(null, SortField.SCORE, orderSpecs[i]));
}
else
{
String jcrPath = npResolver.createJCRPath(orderProps[i]).getAsString(false);
sortFields.add(new SortField(jcrPath, scs, !orderSpecs[i]));
}
}
return sortFields.toArray(new SortField[sortFields.size()]);
} | java | protected SortField[] createSortFields(QPath[] orderProps, boolean[] orderSpecs, FieldComparatorSource scs)
throws RepositoryException
{
List<SortField> sortFields = new ArrayList<SortField>();
for (int i = 0; i < orderProps.length; i++)
{
if (orderProps[i].getEntries().length == 1 && Constants.JCR_SCORE.equals(orderProps[i].getName()))
{
// order on jcr:score does not use the natural order as
// implemented in lucene. score ascending in lucene means that
// higher scores are first. JCR specs that lower score values
// are first.
sortFields.add(new SortField(null, SortField.SCORE, orderSpecs[i]));
}
else
{
String jcrPath = npResolver.createJCRPath(orderProps[i]).getAsString(false);
sortFields.add(new SortField(jcrPath, scs, !orderSpecs[i]));
}
}
return sortFields.toArray(new SortField[sortFields.size()]);
} | [
"protected",
"SortField",
"[",
"]",
"createSortFields",
"(",
"QPath",
"[",
"]",
"orderProps",
",",
"boolean",
"[",
"]",
"orderSpecs",
",",
"FieldComparatorSource",
"scs",
")",
"throws",
"RepositoryException",
"{",
"List",
"<",
"SortField",
">",
"sortFields",
"="... | Creates the SortFields for the order properties.
@param orderProps
the order properties.
@param orderSpecs
the order specs for the properties.
@param scs
{@link FieldComparatorSource} case sensitive or case insensitive comparator
@return an array of sort fields
@throws RepositoryException | [
"Creates",
"the",
"SortFields",
"for",
"the",
"order",
"properties",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java#L1773-L1794 |
135,726 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java | SearchIndex.createNewIndex | public MultiIndex createNewIndex(String suffix) throws IOException {
IndexInfos indexInfos = new IndexInfos();
IndexUpdateMonitor indexUpdateMonitor = new DefaultIndexUpdateMonitor();
IndexerIoModeHandler modeHandler = new IndexerIoModeHandler(IndexerIoMode.READ_WRITE);
MultiIndex newIndex = new MultiIndex(this, getContext().getIndexingTree(), modeHandler,
indexInfos, indexUpdateMonitor, cloneDirectoryManager(this.getDirectoryManager(), suffix));
return newIndex;
} | java | public MultiIndex createNewIndex(String suffix) throws IOException {
IndexInfos indexInfos = new IndexInfos();
IndexUpdateMonitor indexUpdateMonitor = new DefaultIndexUpdateMonitor();
IndexerIoModeHandler modeHandler = new IndexerIoModeHandler(IndexerIoMode.READ_WRITE);
MultiIndex newIndex = new MultiIndex(this, getContext().getIndexingTree(), modeHandler,
indexInfos, indexUpdateMonitor, cloneDirectoryManager(this.getDirectoryManager(), suffix));
return newIndex;
} | [
"public",
"MultiIndex",
"createNewIndex",
"(",
"String",
"suffix",
")",
"throws",
"IOException",
"{",
"IndexInfos",
"indexInfos",
"=",
"new",
"IndexInfos",
"(",
")",
";",
"IndexUpdateMonitor",
"indexUpdateMonitor",
"=",
"new",
"DefaultIndexUpdateMonitor",
"(",
")",
... | Create a new index with the same actual context.
@return MultiIndex the actual index. | [
"Create",
"a",
"new",
"index",
"with",
"the",
"same",
"actual",
"context",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java#L1881-L1891 |
135,727 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java | SearchIndex.cloneDirectoryManager | protected DirectoryManager cloneDirectoryManager(DirectoryManager directoryManager, String suffix) throws IOException
{
try
{
DirectoryManager df = directoryManager.getClass().newInstance();
df.init(this.path + suffix);
return df;
}
catch (IOException e)
{
throw e;
}
catch (Exception e)
{
IOException ex = new IOException();
ex.initCause(e);
throw ex;
}
} | java | protected DirectoryManager cloneDirectoryManager(DirectoryManager directoryManager, String suffix) throws IOException
{
try
{
DirectoryManager df = directoryManager.getClass().newInstance();
df.init(this.path + suffix);
return df;
}
catch (IOException e)
{
throw e;
}
catch (Exception e)
{
IOException ex = new IOException();
ex.initCause(e);
throw ex;
}
} | [
"protected",
"DirectoryManager",
"cloneDirectoryManager",
"(",
"DirectoryManager",
"directoryManager",
",",
"String",
"suffix",
")",
"throws",
"IOException",
"{",
"try",
"{",
"DirectoryManager",
"df",
"=",
"directoryManager",
".",
"getClass",
"(",
")",
".",
"newInstan... | Clone the default Index directory manager
@return an initialized {@link DirectoryManager}.
@throws IOException
if the directory manager cannot be instantiated or an
exception occurs while initializing the manager. | [
"Clone",
"the",
"default",
"Index",
"directory",
"manager"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java#L1991-L2009 |
135,728 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java | SearchIndex.createSynonymProviderConfigResource | protected InputStream createSynonymProviderConfigResource() throws IOException
{
if (synonymProviderConfigPath != null)
{
InputStream fsr;
// simple sanity check
String separator = PrivilegedSystemHelper.getProperty("file.separator");
if (synonymProviderConfigPath.endsWith(PrivilegedSystemHelper.getProperty("file.separator")))
{
throw new IOException("Invalid synonymProviderConfigPath: " + synonymProviderConfigPath);
}
if (cfm == null)
{
int lastSeparator = synonymProviderConfigPath.lastIndexOf(separator);
if (lastSeparator != -1)
{
File root = new File(path, synonymProviderConfigPath.substring(0, lastSeparator));
fsr =
new BufferedInputStream(PrivilegedFileHelper.fileInputStream(new File(root, synonymProviderConfigPath
.substring(lastSeparator + 1))));
}
else
{
fsr = new BufferedInputStream(PrivilegedFileHelper.fileInputStream(new File(synonymProviderConfigPath)));
}
synonymProviderConfigFs = fsr;
}
else
{
try
{
fsr = cfm.getInputStream(synonymProviderConfigPath);
}
catch (Exception e)
{
throw new IOException(e.getLocalizedMessage(), e);
}
}
return fsr;
}
else
{
// path not configured
return null;
}
} | java | protected InputStream createSynonymProviderConfigResource() throws IOException
{
if (synonymProviderConfigPath != null)
{
InputStream fsr;
// simple sanity check
String separator = PrivilegedSystemHelper.getProperty("file.separator");
if (synonymProviderConfigPath.endsWith(PrivilegedSystemHelper.getProperty("file.separator")))
{
throw new IOException("Invalid synonymProviderConfigPath: " + synonymProviderConfigPath);
}
if (cfm == null)
{
int lastSeparator = synonymProviderConfigPath.lastIndexOf(separator);
if (lastSeparator != -1)
{
File root = new File(path, synonymProviderConfigPath.substring(0, lastSeparator));
fsr =
new BufferedInputStream(PrivilegedFileHelper.fileInputStream(new File(root, synonymProviderConfigPath
.substring(lastSeparator + 1))));
}
else
{
fsr = new BufferedInputStream(PrivilegedFileHelper.fileInputStream(new File(synonymProviderConfigPath)));
}
synonymProviderConfigFs = fsr;
}
else
{
try
{
fsr = cfm.getInputStream(synonymProviderConfigPath);
}
catch (Exception e)
{
throw new IOException(e.getLocalizedMessage(), e);
}
}
return fsr;
}
else
{
// path not configured
return null;
}
} | [
"protected",
"InputStream",
"createSynonymProviderConfigResource",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"synonymProviderConfigPath",
"!=",
"null",
")",
"{",
"InputStream",
"fsr",
";",
"// simple sanity check",
"String",
"separator",
"=",
"PrivilegedSystemHel... | Creates a file system resource to the synonym provider configuration.
@return a file system resource or <code>null</code> if no path was
configured.
@throws IOException if an exception occurs accessing the file
system. | [
"Creates",
"a",
"file",
"system",
"resource",
"to",
"the",
"synonym",
"provider",
"configuration",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java#L2019-L2066 |
135,729 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java | SearchIndex.createSpellChecker | protected SpellChecker createSpellChecker()
{
// spell checker config
SpellChecker spCheck = null;
if (spellCheckerClass != null)
{
try
{
spCheck = spellCheckerClass.newInstance();
spCheck.init(SearchIndex.this, spellCheckerMinDistance, spellCheckerMorePopular);
}
catch (IOException e)
{
log.warn("Exception initializing spell checker: " + spellCheckerClass, e);
}
catch (InstantiationException e)
{
log.warn("Exception initializing spell checker: " + spellCheckerClass, e);
}
catch (IllegalAccessException e)
{
log.warn("Exception initializing spell checker: " + spellCheckerClass, e);
}
}
return spCheck;
} | java | protected SpellChecker createSpellChecker()
{
// spell checker config
SpellChecker spCheck = null;
if (spellCheckerClass != null)
{
try
{
spCheck = spellCheckerClass.newInstance();
spCheck.init(SearchIndex.this, spellCheckerMinDistance, spellCheckerMorePopular);
}
catch (IOException e)
{
log.warn("Exception initializing spell checker: " + spellCheckerClass, e);
}
catch (InstantiationException e)
{
log.warn("Exception initializing spell checker: " + spellCheckerClass, e);
}
catch (IllegalAccessException e)
{
log.warn("Exception initializing spell checker: " + spellCheckerClass, e);
}
}
return spCheck;
} | [
"protected",
"SpellChecker",
"createSpellChecker",
"(",
")",
"{",
"// spell checker config",
"SpellChecker",
"spCheck",
"=",
"null",
";",
"if",
"(",
"spellCheckerClass",
"!=",
"null",
")",
"{",
"try",
"{",
"spCheck",
"=",
"spellCheckerClass",
".",
"newInstance",
"... | Creates a spell checker for this query handler.
@return the spell checker or <code>null</code> if none is configured or
an error occurs. | [
"Creates",
"a",
"spell",
"checker",
"for",
"this",
"query",
"handler",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java#L2074-L2099 |
135,730 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java | SearchIndex.doInitErrorLog | public ErrorLog doInitErrorLog(String path) throws IOException
{
File file = new File(new File(path), ERROR_LOG);
return new ErrorLog(file, errorLogfileSize);
} | java | public ErrorLog doInitErrorLog(String path) throws IOException
{
File file = new File(new File(path), ERROR_LOG);
return new ErrorLog(file, errorLogfileSize);
} | [
"public",
"ErrorLog",
"doInitErrorLog",
"(",
"String",
"path",
")",
"throws",
"IOException",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"new",
"File",
"(",
"path",
")",
",",
"ERROR_LOG",
")",
";",
"return",
"new",
"ErrorLog",
"(",
"file",
",",
"errorL... | Initialization error log. | [
"Initialization",
"error",
"log",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java#L3451-L3455 |
135,731 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java | SearchIndex.waitForResuming | void waitForResuming() throws IOException
{
if (isSuspended.get())
{
try
{
latcher.get().await();
}
catch (InterruptedException e)
{
throw new IOException(e);
}
}
} | java | void waitForResuming() throws IOException
{
if (isSuspended.get())
{
try
{
latcher.get().await();
}
catch (InterruptedException e)
{
throw new IOException(e);
}
}
} | [
"void",
"waitForResuming",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isSuspended",
".",
"get",
"(",
")",
")",
"{",
"try",
"{",
"latcher",
".",
"get",
"(",
")",
".",
"await",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")"... | If component is suspended need to wait resuming and not allow
execute query on closed index.
@throws IOException | [
"If",
"component",
"is",
"suspended",
"need",
"to",
"wait",
"resuming",
"and",
"not",
"allow",
"execute",
"query",
"on",
"closed",
"index",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java#L3685-L3698 |
135,732 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java | Utils.getUsersStorageNode | Node getUsersStorageNode(Session session) throws PathNotFoundException, RepositoryException
{
return (Node)session.getItem(service.getStoragePath() + "/" + JCROrganizationServiceImpl.STORAGE_JOS_USERS);
} | java | Node getUsersStorageNode(Session session) throws PathNotFoundException, RepositoryException
{
return (Node)session.getItem(service.getStoragePath() + "/" + JCROrganizationServiceImpl.STORAGE_JOS_USERS);
} | [
"Node",
"getUsersStorageNode",
"(",
"Session",
"session",
")",
"throws",
"PathNotFoundException",
",",
"RepositoryException",
"{",
"return",
"(",
"Node",
")",
"session",
".",
"getItem",
"(",
"service",
".",
"getStoragePath",
"(",
")",
"+",
"\"/\"",
"+",
"JCROrga... | Returns the node where all users are stored. | [
"Returns",
"the",
"node",
"where",
"all",
"users",
"are",
"stored",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java#L131-L134 |
135,733 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java | Utils.getMembershipTypeStorageNode | Node getMembershipTypeStorageNode(Session session) throws PathNotFoundException, RepositoryException
{
return (Node)session.getItem(service.getStoragePath() + "/"
+ JCROrganizationServiceImpl.STORAGE_JOS_MEMBERSHIP_TYPES);
} | java | Node getMembershipTypeStorageNode(Session session) throws PathNotFoundException, RepositoryException
{
return (Node)session.getItem(service.getStoragePath() + "/"
+ JCROrganizationServiceImpl.STORAGE_JOS_MEMBERSHIP_TYPES);
} | [
"Node",
"getMembershipTypeStorageNode",
"(",
"Session",
"session",
")",
"throws",
"PathNotFoundException",
",",
"RepositoryException",
"{",
"return",
"(",
"Node",
")",
"session",
".",
"getItem",
"(",
"service",
".",
"getStoragePath",
"(",
")",
"+",
"\"/\"",
"+",
... | Returns the node where all membership types are stored. | [
"Returns",
"the",
"node",
"where",
"all",
"membership",
"types",
"are",
"stored",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java#L139-L143 |
135,734 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java | Utils.getUserNode | Node getUserNode(Session session, String userName) throws PathNotFoundException, RepositoryException
{
return (Node)session.getItem(getUserNodePath(userName));
} | java | Node getUserNode(Session session, String userName) throws PathNotFoundException, RepositoryException
{
return (Node)session.getItem(getUserNodePath(userName));
} | [
"Node",
"getUserNode",
"(",
"Session",
"session",
",",
"String",
"userName",
")",
"throws",
"PathNotFoundException",
",",
"RepositoryException",
"{",
"return",
"(",
"Node",
")",
"session",
".",
"getItem",
"(",
"getUserNodePath",
"(",
"userName",
")",
")",
";",
... | Returns the node where defined user is stored. | [
"Returns",
"the",
"node",
"where",
"defined",
"user",
"is",
"stored",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java#L148-L151 |
135,735 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java | Utils.getUserNodePath | String getUserNodePath(String userName) throws RepositoryException
{
return service.getStoragePath() + "/" + JCROrganizationServiceImpl.STORAGE_JOS_USERS + "/" + userName;
} | java | String getUserNodePath(String userName) throws RepositoryException
{
return service.getStoragePath() + "/" + JCROrganizationServiceImpl.STORAGE_JOS_USERS + "/" + userName;
} | [
"String",
"getUserNodePath",
"(",
"String",
"userName",
")",
"throws",
"RepositoryException",
"{",
"return",
"service",
".",
"getStoragePath",
"(",
")",
"+",
"\"/\"",
"+",
"JCROrganizationServiceImpl",
".",
"STORAGE_JOS_USERS",
"+",
"\"/\"",
"+",
"userName",
";",
... | Returns the node path where defined user is stored. | [
"Returns",
"the",
"node",
"path",
"where",
"defined",
"user",
"is",
"stored",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java#L156-L159 |
135,736 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java | Utils.getMembershipTypeNode | Node getMembershipTypeNode(Session session, String name) throws PathNotFoundException, RepositoryException
{
return (Node)session.getItem(getMembershipTypeNodePath(name));
} | java | Node getMembershipTypeNode(Session session, String name) throws PathNotFoundException, RepositoryException
{
return (Node)session.getItem(getMembershipTypeNodePath(name));
} | [
"Node",
"getMembershipTypeNode",
"(",
"Session",
"session",
",",
"String",
"name",
")",
"throws",
"PathNotFoundException",
",",
"RepositoryException",
"{",
"return",
"(",
"Node",
")",
"session",
".",
"getItem",
"(",
"getMembershipTypeNodePath",
"(",
"name",
")",
"... | Returns the node where defined membership type is stored. | [
"Returns",
"the",
"node",
"where",
"defined",
"membership",
"type",
"is",
"stored",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java#L164-L167 |
135,737 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java | Utils.getProfileNode | Node getProfileNode(Session session, String userName) throws PathNotFoundException, RepositoryException
{
return (Node)session.getItem(service.getStoragePath() + "/" + JCROrganizationServiceImpl.STORAGE_JOS_USERS + "/"
+ userName + "/" + JCROrganizationServiceImpl.JOS_PROFILE);
} | java | Node getProfileNode(Session session, String userName) throws PathNotFoundException, RepositoryException
{
return (Node)session.getItem(service.getStoragePath() + "/" + JCROrganizationServiceImpl.STORAGE_JOS_USERS + "/"
+ userName + "/" + JCROrganizationServiceImpl.JOS_PROFILE);
} | [
"Node",
"getProfileNode",
"(",
"Session",
"session",
",",
"String",
"userName",
")",
"throws",
"PathNotFoundException",
",",
"RepositoryException",
"{",
"return",
"(",
"Node",
")",
"session",
".",
"getItem",
"(",
"service",
".",
"getStoragePath",
"(",
")",
"+",
... | Returns the node where profile of defined user is stored. | [
"Returns",
"the",
"node",
"where",
"profile",
"of",
"defined",
"user",
"is",
"stored",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java#L172-L176 |
135,738 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java | Utils.getMembershipTypeNodePath | String getMembershipTypeNodePath(String name) throws RepositoryException
{
return service.getStoragePath()
+ "/"
+ JCROrganizationServiceImpl.STORAGE_JOS_MEMBERSHIP_TYPES
+ "/"
+ (name.equals(MembershipTypeHandler.ANY_MEMBERSHIP_TYPE)
? JCROrganizationServiceImpl.JOS_MEMBERSHIP_TYPE_ANY : name);
} | java | String getMembershipTypeNodePath(String name) throws RepositoryException
{
return service.getStoragePath()
+ "/"
+ JCROrganizationServiceImpl.STORAGE_JOS_MEMBERSHIP_TYPES
+ "/"
+ (name.equals(MembershipTypeHandler.ANY_MEMBERSHIP_TYPE)
? JCROrganizationServiceImpl.JOS_MEMBERSHIP_TYPE_ANY : name);
} | [
"String",
"getMembershipTypeNodePath",
"(",
"String",
"name",
")",
"throws",
"RepositoryException",
"{",
"return",
"service",
".",
"getStoragePath",
"(",
")",
"+",
"\"/\"",
"+",
"JCROrganizationServiceImpl",
".",
"STORAGE_JOS_MEMBERSHIP_TYPES",
"+",
"\"/\"",
"+",
"(",... | Returns the path where defined membership type is stored. | [
"Returns",
"the",
"path",
"where",
"defined",
"membership",
"type",
"is",
"stored",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java#L206-L214 |
135,739 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java | Utils.getGroupIds | GroupIds getGroupIds(Node groupNode) throws RepositoryException
{
String storagePath = getGroupStoragePath();
String nodePath = groupNode.getPath();
String groupId = nodePath.substring(storagePath.length());
String parentId = groupId.substring(0, groupId.lastIndexOf("/"));
return new GroupIds(groupId, parentId);
} | java | GroupIds getGroupIds(Node groupNode) throws RepositoryException
{
String storagePath = getGroupStoragePath();
String nodePath = groupNode.getPath();
String groupId = nodePath.substring(storagePath.length());
String parentId = groupId.substring(0, groupId.lastIndexOf("/"));
return new GroupIds(groupId, parentId);
} | [
"GroupIds",
"getGroupIds",
"(",
"Node",
"groupNode",
")",
"throws",
"RepositoryException",
"{",
"String",
"storagePath",
"=",
"getGroupStoragePath",
"(",
")",
";",
"String",
"nodePath",
"=",
"groupNode",
".",
"getPath",
"(",
")",
";",
"String",
"groupId",
"=",
... | Evaluate the group identifier and parent group identifier based on group node path. | [
"Evaluate",
"the",
"group",
"identifier",
"and",
"parent",
"group",
"identifier",
"based",
"on",
"group",
"node",
"path",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java#L219-L228 |
135,740 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java | Utils.splitId | IdComponents splitId(String id) throws IndexOutOfBoundsException
{
String[] membershipIDs = id.split(",");
String groupNodeId = membershipIDs[0];
String userName = membershipIDs[1];
String type = membershipIDs[2];
return new IdComponents(groupNodeId, userName, type);
} | java | IdComponents splitId(String id) throws IndexOutOfBoundsException
{
String[] membershipIDs = id.split(",");
String groupNodeId = membershipIDs[0];
String userName = membershipIDs[1];
String type = membershipIDs[2];
return new IdComponents(groupNodeId, userName, type);
} | [
"IdComponents",
"splitId",
"(",
"String",
"id",
")",
"throws",
"IndexOutOfBoundsException",
"{",
"String",
"[",
"]",
"membershipIDs",
"=",
"id",
".",
"split",
"(",
"\",\"",
")",
";",
"String",
"groupNodeId",
"=",
"membershipIDs",
"[",
"0",
"]",
";",
"String"... | Splits membership identifier into several components. | [
"Splits",
"membership",
"identifier",
"into",
"several",
"components",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java#L233-L242 |
135,741 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/Statistics.java | Statistics.printData | public void printData(PrintWriter pw)
{
long lmin = min.get();
if (lmin == Long.MAX_VALUE)
{
lmin = -1;
}
long lmax = max.get();
long ltotal = total.get();
long ltimes = times.get();
float favg = ltimes == 0 ? 0f : (float)ltotal / ltimes;
pw.print(lmin);
pw.print(',');
pw.print(lmax);
pw.print(',');
pw.print(ltotal);
pw.print(',');
pw.print(favg);
pw.print(',');
pw.print(ltimes);
} | java | public void printData(PrintWriter pw)
{
long lmin = min.get();
if (lmin == Long.MAX_VALUE)
{
lmin = -1;
}
long lmax = max.get();
long ltotal = total.get();
long ltimes = times.get();
float favg = ltimes == 0 ? 0f : (float)ltotal / ltimes;
pw.print(lmin);
pw.print(',');
pw.print(lmax);
pw.print(',');
pw.print(ltotal);
pw.print(',');
pw.print(favg);
pw.print(',');
pw.print(ltimes);
} | [
"public",
"void",
"printData",
"(",
"PrintWriter",
"pw",
")",
"{",
"long",
"lmin",
"=",
"min",
".",
"get",
"(",
")",
";",
"if",
"(",
"lmin",
"==",
"Long",
".",
"MAX_VALUE",
")",
"{",
"lmin",
"=",
"-",
"1",
";",
"}",
"long",
"lmax",
"=",
"max",
... | Print the current snapshot of the metrics and evaluate the average value | [
"Print",
"the",
"current",
"snapshot",
"of",
"the",
"metrics",
"and",
"evaluate",
"the",
"average",
"value"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/Statistics.java#L159-L179 |
135,742 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/Statistics.java | Statistics.reset | public void reset()
{
min.set(Long.MAX_VALUE);
max.set(0);
total.set(0);
times.set(0);
} | java | public void reset()
{
min.set(Long.MAX_VALUE);
max.set(0);
total.set(0);
times.set(0);
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"min",
".",
"set",
"(",
"Long",
".",
"MAX_VALUE",
")",
";",
"max",
".",
"set",
"(",
"0",
")",
";",
"total",
".",
"set",
"(",
"0",
")",
";",
"times",
".",
"set",
"(",
"0",
")",
";",
"}"
] | Reset the statistics | [
"Reset",
"the",
"statistics"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/Statistics.java#L232-L238 |
135,743 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java | ISPNIndexInfos.refreshIndexes | protected void refreshIndexes(Set<String> set)
{
// do nothing if null is passed
if (set == null)
{
return;
}
setNames(set);
// callback multiIndex to refresh lists
try
{
MultiIndex multiIndex = getMultiIndex();
if (multiIndex != null)
{
multiIndex.refreshIndexList();
}
}
catch (IOException e)
{
LOG.error("Failed to update indexes! " + e.getMessage(), e);
}
} | java | protected void refreshIndexes(Set<String> set)
{
// do nothing if null is passed
if (set == null)
{
return;
}
setNames(set);
// callback multiIndex to refresh lists
try
{
MultiIndex multiIndex = getMultiIndex();
if (multiIndex != null)
{
multiIndex.refreshIndexList();
}
}
catch (IOException e)
{
LOG.error("Failed to update indexes! " + e.getMessage(), e);
}
} | [
"protected",
"void",
"refreshIndexes",
"(",
"Set",
"<",
"String",
">",
"set",
")",
"{",
"// do nothing if null is passed\r",
"if",
"(",
"set",
"==",
"null",
")",
"{",
"return",
";",
"}",
"setNames",
"(",
"set",
")",
";",
"// callback multiIndex to refresh lists\... | Update index configuration, when it changes on persistent storage
@param set | [
"Update",
"index",
"configuration",
"when",
"it",
"changes",
"on",
"persistent",
"storage"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java#L231-L252 |
135,744 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataTraversingVisitor.java | ItemDataTraversingVisitor.visitChildProperties | protected void visitChildProperties(NodeData node) throws RepositoryException
{
if (isInterrupted())
return;
for (PropertyData data : dataManager.getChildPropertiesData(node))
{
if (isInterrupted())
return;
data.accept(this);
}
} | java | protected void visitChildProperties(NodeData node) throws RepositoryException
{
if (isInterrupted())
return;
for (PropertyData data : dataManager.getChildPropertiesData(node))
{
if (isInterrupted())
return;
data.accept(this);
}
} | [
"protected",
"void",
"visitChildProperties",
"(",
"NodeData",
"node",
")",
"throws",
"RepositoryException",
"{",
"if",
"(",
"isInterrupted",
"(",
")",
")",
"return",
";",
"for",
"(",
"PropertyData",
"data",
":",
"dataManager",
".",
"getChildPropertiesData",
"(",
... | Visit all child properties. | [
"Visit",
"all",
"child",
"properties",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataTraversingVisitor.java#L111-L121 |
135,745 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataTraversingVisitor.java | ItemDataTraversingVisitor.visitChildNodes | protected void visitChildNodes(NodeData node) throws RepositoryException
{
if (isInterrupted())
return;
for (NodeData data : dataManager.getChildNodesData(node))
{
if (isInterrupted())
return;
data.accept(this);
}
} | java | protected void visitChildNodes(NodeData node) throws RepositoryException
{
if (isInterrupted())
return;
for (NodeData data : dataManager.getChildNodesData(node))
{
if (isInterrupted())
return;
data.accept(this);
}
} | [
"protected",
"void",
"visitChildNodes",
"(",
"NodeData",
"node",
")",
"throws",
"RepositoryException",
"{",
"if",
"(",
"isInterrupted",
"(",
")",
")",
"return",
";",
"for",
"(",
"NodeData",
"data",
":",
"dataManager",
".",
"getChildNodesData",
"(",
"node",
")"... | Visit all child nodes. | [
"Visit",
"all",
"child",
"nodes",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataTraversingVisitor.java#L126-L136 |
135,746 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/LocationStepQueryNode.java | LocationStepQueryNode.getPredicates | public QueryNode[] getPredicates() {
if (operands == null) {
return EMPTY;
} else {
return (QueryNode[]) operands.toArray(new QueryNode[operands.size()]);
}
} | java | public QueryNode[] getPredicates() {
if (operands == null) {
return EMPTY;
} else {
return (QueryNode[]) operands.toArray(new QueryNode[operands.size()]);
}
} | [
"public",
"QueryNode",
"[",
"]",
"getPredicates",
"(",
")",
"{",
"if",
"(",
"operands",
"==",
"null",
")",
"{",
"return",
"EMPTY",
";",
"}",
"else",
"{",
"return",
"(",
"QueryNode",
"[",
"]",
")",
"operands",
".",
"toArray",
"(",
"new",
"QueryNode",
... | Returns the predicate nodes for this location step. This method may
also return a position predicate.
@return the predicate nodes or an empty array if there are no predicates
for this location step. | [
"Returns",
"the",
"predicate",
"nodes",
"for",
"this",
"location",
"step",
".",
"This",
"method",
"may",
"also",
"return",
"a",
"position",
"predicate",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/LocationStepQueryNode.java#L131-L137 |
135,747 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/MappedParametrizedObjectEntry.java | MappedParametrizedObjectEntry.getParameterBoolean | public Boolean getParameterBoolean(String name, Boolean defaultValue)
{
String value = getParameterValue(name, null);
if (value != null)
{
return new Boolean(value);
}
return defaultValue;
} | java | public Boolean getParameterBoolean(String name, Boolean defaultValue)
{
String value = getParameterValue(name, null);
if (value != null)
{
return new Boolean(value);
}
return defaultValue;
} | [
"public",
"Boolean",
"getParameterBoolean",
"(",
"String",
"name",
",",
"Boolean",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"getParameterValue",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"new",
"Bool... | Parse named parameter as Boolean.
@param name
parameter name
@param defaultValue
default value
@return boolean value | [
"Parse",
"named",
"parameter",
"as",
"Boolean",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/MappedParametrizedObjectEntry.java#L349-L358 |
135,748 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBSingleDbJDBCConnection.java | HSQLDBSingleDbJDBCConnection.traverseQPath | @Override
protected QPath traverseQPath(String cpid) throws SQLException, InvalidItemStateException, IllegalNameException
{
return traverseQPathSQ(cpid);
} | java | @Override
protected QPath traverseQPath(String cpid) throws SQLException, InvalidItemStateException, IllegalNameException
{
return traverseQPathSQ(cpid);
} | [
"@",
"Override",
"protected",
"QPath",
"traverseQPath",
"(",
"String",
"cpid",
")",
"throws",
"SQLException",
",",
"InvalidItemStateException",
",",
"IllegalNameException",
"{",
"return",
"traverseQPathSQ",
"(",
"cpid",
")",
";",
"}"
] | Use simple queries since it is much faster | [
"Use",
"simple",
"queries",
"since",
"it",
"is",
"much",
"faster"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBSingleDbJDBCConnection.java#L120-L124 |
135,749 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileValueStorage.java | FileValueStorage.prepareRootDir | protected void prepareRootDir(String rootDirPath) throws IOException, RepositoryConfigurationException
{
this.rootDir = new File(rootDirPath);
if (!rootDir.exists())
{
if (rootDir.mkdirs())
{
LOG.info("Value storage directory created: " + rootDir.getAbsolutePath());
// create internal temp dir
File tempDir = new File(rootDir, TEMP_DIR_NAME);
tempDir.mkdirs();
if (tempDir.exists() && tempDir.isDirectory())
{
// care about storage temp dir cleanup
for (File tmpf : tempDir.listFiles())
if (!tmpf.delete())
LOG.warn("Storage temporary directory contains un-deletable file " + tmpf.getAbsolutePath()
+ ". It's recommended to leave this directory for JCR External Values Storage private use.");
}
else
throw new RepositoryConfigurationException("Cannot create " + TEMP_DIR_NAME
+ " directory under External Value Storage.");
}
else
{
LOG.warn("Directory IS NOT created: " + rootDir.getAbsolutePath());
}
}
else
{
if (!rootDir.isDirectory())
{
throw new RepositoryConfigurationException("File exists but is not a directory " + rootDirPath);
}
}
} | java | protected void prepareRootDir(String rootDirPath) throws IOException, RepositoryConfigurationException
{
this.rootDir = new File(rootDirPath);
if (!rootDir.exists())
{
if (rootDir.mkdirs())
{
LOG.info("Value storage directory created: " + rootDir.getAbsolutePath());
// create internal temp dir
File tempDir = new File(rootDir, TEMP_DIR_NAME);
tempDir.mkdirs();
if (tempDir.exists() && tempDir.isDirectory())
{
// care about storage temp dir cleanup
for (File tmpf : tempDir.listFiles())
if (!tmpf.delete())
LOG.warn("Storage temporary directory contains un-deletable file " + tmpf.getAbsolutePath()
+ ". It's recommended to leave this directory for JCR External Values Storage private use.");
}
else
throw new RepositoryConfigurationException("Cannot create " + TEMP_DIR_NAME
+ " directory under External Value Storage.");
}
else
{
LOG.warn("Directory IS NOT created: " + rootDir.getAbsolutePath());
}
}
else
{
if (!rootDir.isDirectory())
{
throw new RepositoryConfigurationException("File exists but is not a directory " + rootDirPath);
}
}
} | [
"protected",
"void",
"prepareRootDir",
"(",
"String",
"rootDirPath",
")",
"throws",
"IOException",
",",
"RepositoryConfigurationException",
"{",
"this",
".",
"rootDir",
"=",
"new",
"File",
"(",
"rootDirPath",
")",
";",
"if",
"(",
"!",
"rootDir",
".",
"exists",
... | Prepare RootDir.
@param rootDirPath
path
@throws IOException
if error
@throws RepositoryConfigurationException
if confog error | [
"Prepare",
"RootDir",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileValueStorage.java#L85-L123 |
135,750 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java | GroupHandlerImpl.addChild | private void addChild(Session session, GroupImpl parent, GroupImpl child, boolean broadcast) throws Exception
{
Node parentNode = utils.getGroupNode(session, parent);
Node groupNode =
parentNode.addNode(child.getGroupName(), JCROrganizationServiceImpl.JOS_HIERARCHY_GROUP_NODETYPE);
String parentId = parent == null ? null : parent.getId();
child.setParentId(parentId);
child.setInternalId(groupNode.getUUID());
if (broadcast)
{
preSave(child, true);
}
writeGroup(child, groupNode);
session.save();
putInCache(child);
if (broadcast)
{
postSave(child, true);
}
} | java | private void addChild(Session session, GroupImpl parent, GroupImpl child, boolean broadcast) throws Exception
{
Node parentNode = utils.getGroupNode(session, parent);
Node groupNode =
parentNode.addNode(child.getGroupName(), JCROrganizationServiceImpl.JOS_HIERARCHY_GROUP_NODETYPE);
String parentId = parent == null ? null : parent.getId();
child.setParentId(parentId);
child.setInternalId(groupNode.getUUID());
if (broadcast)
{
preSave(child, true);
}
writeGroup(child, groupNode);
session.save();
putInCache(child);
if (broadcast)
{
postSave(child, true);
}
} | [
"private",
"void",
"addChild",
"(",
"Session",
"session",
",",
"GroupImpl",
"parent",
",",
"GroupImpl",
"child",
",",
"boolean",
"broadcast",
")",
"throws",
"Exception",
"{",
"Node",
"parentNode",
"=",
"utils",
".",
"getGroupNode",
"(",
"session",
",",
"parent... | Adds child group. | [
"Adds",
"child",
"group",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L102-L127 |
135,751 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java | GroupHandlerImpl.findGroups | private Collection<Group> findGroups(Session session, Group parent, boolean recursive) throws Exception
{
List<Group> groups = new ArrayList<Group>();
String parentId = parent == null ? "" : parent.getId();
NodeIterator childNodes = utils.getGroupNode(session, parentId).getNodes();
while (childNodes.hasNext())
{
Node groupNode = childNodes.nextNode();
if (!groupNode.getName().startsWith(JCROrganizationServiceImpl.JOS_MEMBERSHIP))
{
Group group = readGroup(groupNode);
groups.add(group);
if (recursive)
{
groups.addAll(findGroups(session, group, recursive));
}
}
}
return groups;
} | java | private Collection<Group> findGroups(Session session, Group parent, boolean recursive) throws Exception
{
List<Group> groups = new ArrayList<Group>();
String parentId = parent == null ? "" : parent.getId();
NodeIterator childNodes = utils.getGroupNode(session, parentId).getNodes();
while (childNodes.hasNext())
{
Node groupNode = childNodes.nextNode();
if (!groupNode.getName().startsWith(JCROrganizationServiceImpl.JOS_MEMBERSHIP))
{
Group group = readGroup(groupNode);
groups.add(group);
if (recursive)
{
groups.addAll(findGroups(session, group, recursive));
}
}
}
return groups;
} | [
"private",
"Collection",
"<",
"Group",
">",
"findGroups",
"(",
"Session",
"session",
",",
"Group",
"parent",
",",
"boolean",
"recursive",
")",
"throws",
"Exception",
"{",
"List",
"<",
"Group",
">",
"groups",
"=",
"new",
"ArrayList",
"<",
"Group",
">",
"(",... | Find children groups. Parent group is not included in result.
@param recursive
if true, the search should be recursive. It means go down to the tree
until bottom will reach | [
"Find",
"children",
"groups",
".",
"Parent",
"group",
"is",
"not",
"included",
"in",
"result",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L284-L307 |
135,752 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java | GroupHandlerImpl.removeGroup | private Group removeGroup(Session session, Group group, boolean broadcast) throws Exception
{
if (group == null)
{
throw new OrganizationServiceException("Can not remove group, since it is null");
}
Node groupNode = utils.getGroupNode(session, group);
// need to minus one because of child "jos:memberships" node
long childrenCount = ((ExtendedNode)groupNode).getNodesLazily(1).getSize() - 1;
if (childrenCount > 0)
{
throw new OrganizationServiceException("Can not remove group till children exist");
}
if (broadcast)
{
preDelete(group);
}
removeMemberships(groupNode, broadcast);
groupNode.remove();
session.save();
removeFromCache(group.getId());
removeAllRelatedFromCache(group.getId());
if (broadcast)
{
postDelete(group);
}
return group;
} | java | private Group removeGroup(Session session, Group group, boolean broadcast) throws Exception
{
if (group == null)
{
throw new OrganizationServiceException("Can not remove group, since it is null");
}
Node groupNode = utils.getGroupNode(session, group);
// need to minus one because of child "jos:memberships" node
long childrenCount = ((ExtendedNode)groupNode).getNodesLazily(1).getSize() - 1;
if (childrenCount > 0)
{
throw new OrganizationServiceException("Can not remove group till children exist");
}
if (broadcast)
{
preDelete(group);
}
removeMemberships(groupNode, broadcast);
groupNode.remove();
session.save();
removeFromCache(group.getId());
removeAllRelatedFromCache(group.getId());
if (broadcast)
{
postDelete(group);
}
return group;
} | [
"private",
"Group",
"removeGroup",
"(",
"Session",
"session",
",",
"Group",
"group",
",",
"boolean",
"broadcast",
")",
"throws",
"Exception",
"{",
"if",
"(",
"group",
"==",
"null",
")",
"{",
"throw",
"new",
"OrganizationServiceException",
"(",
"\"Can not remove ... | Removes group and all related membership entities. Throws exception if children exist. | [
"Removes",
"group",
"and",
"all",
"related",
"membership",
"entities",
".",
"Throws",
"exception",
"if",
"children",
"exist",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L358-L393 |
135,753 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java | GroupHandlerImpl.removeMemberships | private void removeMemberships(Node groupNode, boolean broadcast) throws RepositoryException
{
NodeIterator refUsers = groupNode.getNode(JCROrganizationServiceImpl.JOS_MEMBERSHIP).getNodes();
while (refUsers.hasNext())
{
refUsers.nextNode().remove();
}
} | java | private void removeMemberships(Node groupNode, boolean broadcast) throws RepositoryException
{
NodeIterator refUsers = groupNode.getNode(JCROrganizationServiceImpl.JOS_MEMBERSHIP).getNodes();
while (refUsers.hasNext())
{
refUsers.nextNode().remove();
}
} | [
"private",
"void",
"removeMemberships",
"(",
"Node",
"groupNode",
",",
"boolean",
"broadcast",
")",
"throws",
"RepositoryException",
"{",
"NodeIterator",
"refUsers",
"=",
"groupNode",
".",
"getNode",
"(",
"JCROrganizationServiceImpl",
".",
"JOS_MEMBERSHIP",
")",
".",
... | Remove all membership entities related to current group. | [
"Remove",
"all",
"membership",
"entities",
"related",
"to",
"current",
"group",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L398-L405 |
135,754 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java | GroupHandlerImpl.migrateGroup | void migrateGroup(Node oldGroupNode) throws Exception
{
String groupName = oldGroupNode.getName();
String desc = utils.readString(oldGroupNode, GroupProperties.JOS_DESCRIPTION);
String label = utils.readString(oldGroupNode, GroupProperties.JOS_LABEL);
String parentId = utils.readString(oldGroupNode, MigrationTool.JOS_PARENT_ID);
GroupImpl group = new GroupImpl(groupName, parentId);
group.setDescription(desc);
group.setLabel(label);
Group parentGroup = findGroupById(group.getParentId());
if (findGroupById(group.getId()) != null)
{
removeGroup(group, false);
}
addChild(parentGroup, group, false);
} | java | void migrateGroup(Node oldGroupNode) throws Exception
{
String groupName = oldGroupNode.getName();
String desc = utils.readString(oldGroupNode, GroupProperties.JOS_DESCRIPTION);
String label = utils.readString(oldGroupNode, GroupProperties.JOS_LABEL);
String parentId = utils.readString(oldGroupNode, MigrationTool.JOS_PARENT_ID);
GroupImpl group = new GroupImpl(groupName, parentId);
group.setDescription(desc);
group.setLabel(label);
Group parentGroup = findGroupById(group.getParentId());
if (findGroupById(group.getId()) != null)
{
removeGroup(group, false);
}
addChild(parentGroup, group, false);
} | [
"void",
"migrateGroup",
"(",
"Node",
"oldGroupNode",
")",
"throws",
"Exception",
"{",
"String",
"groupName",
"=",
"oldGroupNode",
".",
"getName",
"(",
")",
";",
"String",
"desc",
"=",
"utils",
".",
"readString",
"(",
"oldGroupNode",
",",
"GroupProperties",
"."... | Method for group migration.
@param oldGroupNode
the node where group properties are stored (from old structure) | [
"Method",
"for",
"group",
"migration",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L443-L462 |
135,755 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java | GroupHandlerImpl.readGroup | private Group readGroup(Node groupNode) throws Exception
{
String groupName = groupNode.getName();
String desc = utils.readString(groupNode, GroupProperties.JOS_DESCRIPTION);
String label = utils.readString(groupNode, GroupProperties.JOS_LABEL);
String parentId = utils.getGroupIds(groupNode).parentId;
GroupImpl group = new GroupImpl(groupName, parentId);
group.setInternalId(groupNode.getUUID());
group.setDescription(desc);
group.setLabel(label);
return group;
} | java | private Group readGroup(Node groupNode) throws Exception
{
String groupName = groupNode.getName();
String desc = utils.readString(groupNode, GroupProperties.JOS_DESCRIPTION);
String label = utils.readString(groupNode, GroupProperties.JOS_LABEL);
String parentId = utils.getGroupIds(groupNode).parentId;
GroupImpl group = new GroupImpl(groupName, parentId);
group.setInternalId(groupNode.getUUID());
group.setDescription(desc);
group.setLabel(label);
return group;
} | [
"private",
"Group",
"readGroup",
"(",
"Node",
"groupNode",
")",
"throws",
"Exception",
"{",
"String",
"groupName",
"=",
"groupNode",
".",
"getName",
"(",
")",
";",
"String",
"desc",
"=",
"utils",
".",
"readString",
"(",
"groupNode",
",",
"GroupProperties",
"... | Read group properties from node.
@param groupNode
the node where group properties are stored
@return {@link Group}
@throws OrganizationServiceException
if unexpected exception is occurred during reading | [
"Read",
"group",
"properties",
"from",
"node",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L473-L486 |
135,756 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java | GroupHandlerImpl.writeGroup | private void writeGroup(Group group, Node node) throws OrganizationServiceException
{
try
{
node.setProperty(GroupProperties.JOS_LABEL, group.getLabel());
node.setProperty(GroupProperties.JOS_DESCRIPTION, group.getDescription());
}
catch (RepositoryException e)
{
throw new OrganizationServiceException("Can not write group properties", e);
}
} | java | private void writeGroup(Group group, Node node) throws OrganizationServiceException
{
try
{
node.setProperty(GroupProperties.JOS_LABEL, group.getLabel());
node.setProperty(GroupProperties.JOS_DESCRIPTION, group.getDescription());
}
catch (RepositoryException e)
{
throw new OrganizationServiceException("Can not write group properties", e);
}
} | [
"private",
"void",
"writeGroup",
"(",
"Group",
"group",
",",
"Node",
"node",
")",
"throws",
"OrganizationServiceException",
"{",
"try",
"{",
"node",
".",
"setProperty",
"(",
"GroupProperties",
".",
"JOS_LABEL",
",",
"group",
".",
"getLabel",
"(",
")",
")",
"... | Write group properties to the node.
@param groupNode
the node where group properties are stored
@return {@link Group}
@throws OrganizationServiceException
if unexpected exception is occurred during writing | [
"Write",
"group",
"properties",
"to",
"the",
"node",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L497-L508 |
135,757 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java | GroupHandlerImpl.getFromCache | private Group getFromCache(String groupId)
{
return (Group)cache.get(groupId, CacheType.GROUP);
} | java | private Group getFromCache(String groupId)
{
return (Group)cache.get(groupId, CacheType.GROUP);
} | [
"private",
"Group",
"getFromCache",
"(",
"String",
"groupId",
")",
"{",
"return",
"(",
"Group",
")",
"cache",
".",
"get",
"(",
"groupId",
",",
"CacheType",
".",
"GROUP",
")",
";",
"}"
] | Reads group from cache. | [
"Reads",
"group",
"from",
"cache",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L513-L516 |
135,758 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java | GroupHandlerImpl.putInCache | private void putInCache(Group group)
{
cache.put(group.getId(), group, CacheType.GROUP);
} | java | private void putInCache(Group group)
{
cache.put(group.getId(), group, CacheType.GROUP);
} | [
"private",
"void",
"putInCache",
"(",
"Group",
"group",
")",
"{",
"cache",
".",
"put",
"(",
"group",
".",
"getId",
"(",
")",
",",
"group",
",",
"CacheType",
".",
"GROUP",
")",
";",
"}"
] | Puts group in cache. | [
"Puts",
"group",
"in",
"cache",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L521-L524 |
135,759 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java | GroupHandlerImpl.removeAllRelatedFromCache | private void removeAllRelatedFromCache(String groupId)
{
cache.remove(CacheHandler.GROUP_PREFIX + groupId, CacheType.MEMBERSHIP);
} | java | private void removeAllRelatedFromCache(String groupId)
{
cache.remove(CacheHandler.GROUP_PREFIX + groupId, CacheType.MEMBERSHIP);
} | [
"private",
"void",
"removeAllRelatedFromCache",
"(",
"String",
"groupId",
")",
"{",
"cache",
".",
"remove",
"(",
"CacheHandler",
".",
"GROUP_PREFIX",
"+",
"groupId",
",",
"CacheType",
".",
"MEMBERSHIP",
")",
";",
"}"
] | Removes related entities from cache. | [
"Removes",
"related",
"entities",
"from",
"cache",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L537-L540 |
135,760 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java | GroupHandlerImpl.preSave | private void preSave(Group group, boolean isNew) throws Exception
{
for (GroupEventListener listener : listeners)
{
listener.preSave(group, isNew);
}
} | java | private void preSave(Group group, boolean isNew) throws Exception
{
for (GroupEventListener listener : listeners)
{
listener.preSave(group, isNew);
}
} | [
"private",
"void",
"preSave",
"(",
"Group",
"group",
",",
"boolean",
"isNew",
")",
"throws",
"Exception",
"{",
"for",
"(",
"GroupEventListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"preSave",
"(",
"group",
",",
"isNew",
")",
";",
"}",
... | Notifying listeners before group creation.
@param group
the group which is used in create operation
@param isNew
true, if we have a deal with new group, otherwise it is false
which mean update operation is in progress
@throws Exception
if any listener failed to handle the event | [
"Notifying",
"listeners",
"before",
"group",
"creation",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L553-L559 |
135,761 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java | GroupHandlerImpl.postSave | private void postSave(Group group, boolean isNew) throws Exception
{
for (GroupEventListener listener : listeners)
{
listener.postSave(group, isNew);
}
} | java | private void postSave(Group group, boolean isNew) throws Exception
{
for (GroupEventListener listener : listeners)
{
listener.postSave(group, isNew);
}
} | [
"private",
"void",
"postSave",
"(",
"Group",
"group",
",",
"boolean",
"isNew",
")",
"throws",
"Exception",
"{",
"for",
"(",
"GroupEventListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"postSave",
"(",
"group",
",",
"isNew",
")",
";",
"}"... | Notifying listeners after group creation.
@param group
the group which is used in create operation
@param isNew
true, if we have a deal with new group, otherwise it is false
which mean update operation is in progress
@throws Exception
if any listener failed to handle the event | [
"Notifying",
"listeners",
"after",
"group",
"creation",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L572-L578 |
135,762 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java | GroupHandlerImpl.preDelete | private void preDelete(Group group) throws Exception
{
for (GroupEventListener listener : listeners)
{
listener.preDelete(group);
}
} | java | private void preDelete(Group group) throws Exception
{
for (GroupEventListener listener : listeners)
{
listener.preDelete(group);
}
} | [
"private",
"void",
"preDelete",
"(",
"Group",
"group",
")",
"throws",
"Exception",
"{",
"for",
"(",
"GroupEventListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"preDelete",
"(",
"group",
")",
";",
"}",
"}"
] | Notifying listeners before group deletion.
@param group
the group which is used in delete operation
@throws Exception
if any listener failed to handle the event | [
"Notifying",
"listeners",
"before",
"group",
"deletion",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L588-L594 |
135,763 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java | GroupHandlerImpl.postDelete | private void postDelete(Group group) throws Exception
{
for (GroupEventListener listener : listeners)
{
listener.postDelete(group);
}
} | java | private void postDelete(Group group) throws Exception
{
for (GroupEventListener listener : listeners)
{
listener.postDelete(group);
}
} | [
"private",
"void",
"postDelete",
"(",
"Group",
"group",
")",
"throws",
"Exception",
"{",
"for",
"(",
"GroupEventListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"postDelete",
"(",
"group",
")",
";",
"}",
"}"
] | Notifying listeners after group deletion.
@param group
the group which is used in delete operation
@throws Exception
if any listener failed to handle the event | [
"Notifying",
"listeners",
"after",
"group",
"deletion",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L604-L610 |
135,764 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DynamicPooledExecutor.java | DynamicPooledExecutor.execute | public void execute(Runnable command) {
adjustPoolSize();
if (numProcessors == 1) {
// if there is only one processor execute with current thread
command.run();
} else {
try {
executor.execute(command);
} catch (InterruptedException e) {
// run with current thread instead
command.run();
}
}
} | java | public void execute(Runnable command) {
adjustPoolSize();
if (numProcessors == 1) {
// if there is only one processor execute with current thread
command.run();
} else {
try {
executor.execute(command);
} catch (InterruptedException e) {
// run with current thread instead
command.run();
}
}
} | [
"public",
"void",
"execute",
"(",
"Runnable",
"command",
")",
"{",
"adjustPoolSize",
"(",
")",
";",
"if",
"(",
"numProcessors",
"==",
"1",
")",
"{",
"// if there is only one processor execute with current thread",
"command",
".",
"run",
"(",
")",
";",
"}",
"else... | Executes the given command. This method will block if all threads in the
pool are busy and return only when the command has been accepted. Care
must be taken, that no deadlock occurs when multiple commands are
scheduled for execution. In general commands should not depend on the
execution of other commands!
@param command the command to execute. | [
"Executes",
"the",
"given",
"command",
".",
"This",
"method",
"will",
"block",
"if",
"all",
"threads",
"in",
"the",
"pool",
"are",
"busy",
"and",
"return",
"only",
"when",
"the",
"command",
"has",
"been",
"accepted",
".",
"Care",
"must",
"be",
"taken",
"... | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DynamicPooledExecutor.java#L73-L86 |
135,765 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DynamicPooledExecutor.java | DynamicPooledExecutor.executeAndWait | public Result[] executeAndWait(Command[] commands) {
Result[] results = new Result[commands.length];
if (numProcessors == 1) {
// optimize for one processor
for (int i = 0; i < commands.length; i++) {
Object obj = null;
InvocationTargetException ex = null;
try {
obj = commands[i].call();
} catch (Exception e) {
ex = new InvocationTargetException(e);
}
results[i] = new Result(obj, ex);
}
} else {
FutureResult[] futures = new FutureResult[commands.length];
for (int i = 0; i < commands.length; i++) {
final Command c = commands[i];
futures[i] = new FutureResult();
Runnable r = futures[i].setter(new Callable() {
public Object call() throws Exception {
return c.call();
}
});
try {
executor.execute(r);
} catch (InterruptedException e) {
// run with current thread instead
r.run();
}
}
// wait for all results
boolean interrupted = false;
for (int i = 0; i < futures.length; i++) {
Object obj = null;
InvocationTargetException ex = null;
for (;;) {
try {
obj = futures[i].get();
} catch (InterruptedException e) {
interrupted = true;
// reset interrupted status and try again
Thread.interrupted();
continue;
} catch (InvocationTargetException e) {
ex = e;
}
results[i] = new Result(obj, ex);
break;
}
}
if (interrupted) {
// restore interrupt status again
Thread.currentThread().interrupt();
}
}
return results;
} | java | public Result[] executeAndWait(Command[] commands) {
Result[] results = new Result[commands.length];
if (numProcessors == 1) {
// optimize for one processor
for (int i = 0; i < commands.length; i++) {
Object obj = null;
InvocationTargetException ex = null;
try {
obj = commands[i].call();
} catch (Exception e) {
ex = new InvocationTargetException(e);
}
results[i] = new Result(obj, ex);
}
} else {
FutureResult[] futures = new FutureResult[commands.length];
for (int i = 0; i < commands.length; i++) {
final Command c = commands[i];
futures[i] = new FutureResult();
Runnable r = futures[i].setter(new Callable() {
public Object call() throws Exception {
return c.call();
}
});
try {
executor.execute(r);
} catch (InterruptedException e) {
// run with current thread instead
r.run();
}
}
// wait for all results
boolean interrupted = false;
for (int i = 0; i < futures.length; i++) {
Object obj = null;
InvocationTargetException ex = null;
for (;;) {
try {
obj = futures[i].get();
} catch (InterruptedException e) {
interrupted = true;
// reset interrupted status and try again
Thread.interrupted();
continue;
} catch (InvocationTargetException e) {
ex = e;
}
results[i] = new Result(obj, ex);
break;
}
}
if (interrupted) {
// restore interrupt status again
Thread.currentThread().interrupt();
}
}
return results;
} | [
"public",
"Result",
"[",
"]",
"executeAndWait",
"(",
"Command",
"[",
"]",
"commands",
")",
"{",
"Result",
"[",
"]",
"results",
"=",
"new",
"Result",
"[",
"commands",
".",
"length",
"]",
";",
"if",
"(",
"numProcessors",
"==",
"1",
")",
"{",
"// optimize... | Executes a set of commands and waits until all commands have been
executed. The results of the commands are returned in the same order as
the commands.
@param commands the commands to execute.
@return the results. | [
"Executes",
"a",
"set",
"of",
"commands",
"and",
"waits",
"until",
"all",
"commands",
"have",
"been",
"executed",
".",
"The",
"results",
"of",
"the",
"commands",
"are",
"returned",
"in",
"the",
"same",
"order",
"as",
"the",
"commands",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DynamicPooledExecutor.java#L96-L153 |
135,766 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DynamicPooledExecutor.java | DynamicPooledExecutor.adjustPoolSize | private void adjustPoolSize() {
if (lastCheck + 1000 < System.currentTimeMillis()) {
int n = Runtime.getRuntime().availableProcessors();
if (numProcessors != n) {
executor.setMaximumPoolSize(n);
numProcessors = n;
}
lastCheck = System.currentTimeMillis();
}
} | java | private void adjustPoolSize() {
if (lastCheck + 1000 < System.currentTimeMillis()) {
int n = Runtime.getRuntime().availableProcessors();
if (numProcessors != n) {
executor.setMaximumPoolSize(n);
numProcessors = n;
}
lastCheck = System.currentTimeMillis();
}
} | [
"private",
"void",
"adjustPoolSize",
"(",
")",
"{",
"if",
"(",
"lastCheck",
"+",
"1000",
"<",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
"{",
"int",
"n",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"availableProcessors",
"(",
")",
";",
"i... | Adjusts the pool size at most once every second. | [
"Adjusts",
"the",
"pool",
"size",
"at",
"most",
"once",
"every",
"second",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DynamicPooledExecutor.java#L158-L167 |
135,767 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java | CacheableWorkspaceDataManager.registerListener | private void registerListener(final ChangesLogWrapper logWrapper, TransactionableResourceManager txResourceManager)
throws RepositoryException
{
try
{
// Why calling the listeners non tx aware has been done like this:
// 1. If we call them in the commit phase and we use Arjuna with ISPN, we get:
// ActionStatus.COMMITTING > is not in a valid state to be invoking cache operations on.
// at org.infinispan.interceptors.TxInterceptor.enlist(TxInterceptor.java:195)
// at org.infinispan.interceptors.TxInterceptor.enlistReadAndInvokeNext(TxInterceptor.java:167)
// at org.infinispan.interceptors.TxInterceptor.visitGetKeyValueCommand(TxInterceptor.java:162)
// at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:64)
// This is due to the fact that ISPN enlist the cache even for a read access and enlistments are not
// allowed in the commit phase
// 2. If we call them in the commit phase, we use Arjuna with ISPN and we suspend the current tx,
// we get deadlocks because we try to acquire locks on cache entries that have been locked by the main tx.
// 3. If we call them in the afterComplete, we use JOTM with ISPN and we suspend and resume the current tx, we get:
// jotm: resume: Invalid Transaction Status:STATUS_COMMITTED (Current.java, line 743)
// javax.transaction.InvalidTransactionException: Invalid resume org.objectweb.jotm.TransactionImpl
// at org.objectweb.jotm.Current.resume(Current.java:744)
// This is due to the fact that it is not allowed to resume a tx when its status is STATUS_COMMITED
txResourceManager.addListener(new TransactionableResourceManagerListener()
{
public void onCommit(boolean onePhase) throws Exception
{
}
public void onAfterCompletion(int status) throws Exception
{
if (status == Status.STATUS_COMMITTED)
{
// Since the tx is successfully committed we can call components non tx aware
// The listeners will need to be executed outside the current tx so we suspend
// the current tx we can face enlistment issues on product like ISPN
transactionManager.suspend();
SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
{
public Void run()
{
notifySaveItems(logWrapper.getChangesLog(), false);
return null;
}
});
// Since the resume method could cause issue with some TM at this stage, we don't resume the tx
}
}
public void onAbort() throws Exception
{
}
});
}
catch (Exception e)
{
throw new RepositoryException("The listener for the components not tx aware could not be added", e);
}
} | java | private void registerListener(final ChangesLogWrapper logWrapper, TransactionableResourceManager txResourceManager)
throws RepositoryException
{
try
{
// Why calling the listeners non tx aware has been done like this:
// 1. If we call them in the commit phase and we use Arjuna with ISPN, we get:
// ActionStatus.COMMITTING > is not in a valid state to be invoking cache operations on.
// at org.infinispan.interceptors.TxInterceptor.enlist(TxInterceptor.java:195)
// at org.infinispan.interceptors.TxInterceptor.enlistReadAndInvokeNext(TxInterceptor.java:167)
// at org.infinispan.interceptors.TxInterceptor.visitGetKeyValueCommand(TxInterceptor.java:162)
// at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:64)
// This is due to the fact that ISPN enlist the cache even for a read access and enlistments are not
// allowed in the commit phase
// 2. If we call them in the commit phase, we use Arjuna with ISPN and we suspend the current tx,
// we get deadlocks because we try to acquire locks on cache entries that have been locked by the main tx.
// 3. If we call them in the afterComplete, we use JOTM with ISPN and we suspend and resume the current tx, we get:
// jotm: resume: Invalid Transaction Status:STATUS_COMMITTED (Current.java, line 743)
// javax.transaction.InvalidTransactionException: Invalid resume org.objectweb.jotm.TransactionImpl
// at org.objectweb.jotm.Current.resume(Current.java:744)
// This is due to the fact that it is not allowed to resume a tx when its status is STATUS_COMMITED
txResourceManager.addListener(new TransactionableResourceManagerListener()
{
public void onCommit(boolean onePhase) throws Exception
{
}
public void onAfterCompletion(int status) throws Exception
{
if (status == Status.STATUS_COMMITTED)
{
// Since the tx is successfully committed we can call components non tx aware
// The listeners will need to be executed outside the current tx so we suspend
// the current tx we can face enlistment issues on product like ISPN
transactionManager.suspend();
SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
{
public Void run()
{
notifySaveItems(logWrapper.getChangesLog(), false);
return null;
}
});
// Since the resume method could cause issue with some TM at this stage, we don't resume the tx
}
}
public void onAbort() throws Exception
{
}
});
}
catch (Exception e)
{
throw new RepositoryException("The listener for the components not tx aware could not be added", e);
}
} | [
"private",
"void",
"registerListener",
"(",
"final",
"ChangesLogWrapper",
"logWrapper",
",",
"TransactionableResourceManager",
"txResourceManager",
")",
"throws",
"RepositoryException",
"{",
"try",
"{",
"// Why calling the listeners non tx aware has been done like this:",
"// 1. If... | This will allow to notify listeners that are not TxAware once the Tx is committed
@param logWrapper
@throws RepositoryException if any error occurs | [
"This",
"will",
"allow",
"to",
"notify",
"listeners",
"that",
"are",
"not",
"TxAware",
"once",
"the",
"Tx",
"is",
"committed"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L1210-L1269 |
135,768 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java | CacheableWorkspaceDataManager.getCachedItemData | protected ItemData getCachedItemData(NodeData parentData, QPathEntry name, ItemType itemType)
throws RepositoryException
{
return cache.isEnabled() ? cache.get(parentData.getIdentifier(), name, itemType) : null;
} | java | protected ItemData getCachedItemData(NodeData parentData, QPathEntry name, ItemType itemType)
throws RepositoryException
{
return cache.isEnabled() ? cache.get(parentData.getIdentifier(), name, itemType) : null;
} | [
"protected",
"ItemData",
"getCachedItemData",
"(",
"NodeData",
"parentData",
",",
"QPathEntry",
"name",
",",
"ItemType",
"itemType",
")",
"throws",
"RepositoryException",
"{",
"return",
"cache",
".",
"isEnabled",
"(",
")",
"?",
"cache",
".",
"get",
"(",
"parentD... | Get cached ItemData.
@param parentData
parent
@param name
Item name
@param itemType
item type
@return ItemData
@throws RepositoryException
error | [
"Get",
"cached",
"ItemData",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L1284-L1288 |
135,769 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java | CacheableWorkspaceDataManager.getCachedItemData | protected ItemData getCachedItemData(String identifier) throws RepositoryException
{
return cache.isEnabled() ? cache.get(identifier) : null;
} | java | protected ItemData getCachedItemData(String identifier) throws RepositoryException
{
return cache.isEnabled() ? cache.get(identifier) : null;
} | [
"protected",
"ItemData",
"getCachedItemData",
"(",
"String",
"identifier",
")",
"throws",
"RepositoryException",
"{",
"return",
"cache",
".",
"isEnabled",
"(",
")",
"?",
"cache",
".",
"get",
"(",
"identifier",
")",
":",
"null",
";",
"}"
] | Returns an item from cache by Identifier or null if the item don't cached.
@param identifier
Item id
@return ItemData
@throws RepositoryException
error | [
"Returns",
"an",
"item",
"from",
"cache",
"by",
"Identifier",
"or",
"null",
"if",
"the",
"item",
"don",
"t",
"cached",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L1344-L1347 |
135,770 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java | CacheableWorkspaceDataManager.getChildNodesData | protected List<NodeData> getChildNodesData(final NodeData nodeData, boolean forcePersistentRead)
throws RepositoryException
{
List<NodeData> childNodes = null;
if (!forcePersistentRead && cache.isEnabled())
{
childNodes = cache.getChildNodes(nodeData);
if (childNodes != null)
{
return childNodes;
}
}
final DataRequest request = new DataRequest(nodeData.getIdentifier(), DataRequest.GET_NODES);
try
{
request.start();
if (!forcePersistentRead && cache.isEnabled())
{
// Try first to get the value from the cache since a
// request could have been launched just before
childNodes = cache.getChildNodes(nodeData);
if (childNodes != null)
{
return childNodes;
}
}
return executeAction(new PrivilegedExceptionAction<List<NodeData>>()
{
public List<NodeData> run() throws RepositoryException
{
List<NodeData> childNodes = CacheableWorkspaceDataManager.super.getChildNodesData(nodeData);
if (cache.isEnabled())
{
cache.addChildNodes(nodeData, childNodes);
}
return childNodes;
}
});
}
finally
{
request.done();
}
} | java | protected List<NodeData> getChildNodesData(final NodeData nodeData, boolean forcePersistentRead)
throws RepositoryException
{
List<NodeData> childNodes = null;
if (!forcePersistentRead && cache.isEnabled())
{
childNodes = cache.getChildNodes(nodeData);
if (childNodes != null)
{
return childNodes;
}
}
final DataRequest request = new DataRequest(nodeData.getIdentifier(), DataRequest.GET_NODES);
try
{
request.start();
if (!forcePersistentRead && cache.isEnabled())
{
// Try first to get the value from the cache since a
// request could have been launched just before
childNodes = cache.getChildNodes(nodeData);
if (childNodes != null)
{
return childNodes;
}
}
return executeAction(new PrivilegedExceptionAction<List<NodeData>>()
{
public List<NodeData> run() throws RepositoryException
{
List<NodeData> childNodes = CacheableWorkspaceDataManager.super.getChildNodesData(nodeData);
if (cache.isEnabled())
{
cache.addChildNodes(nodeData, childNodes);
}
return childNodes;
}
});
}
finally
{
request.done();
}
} | [
"protected",
"List",
"<",
"NodeData",
">",
"getChildNodesData",
"(",
"final",
"NodeData",
"nodeData",
",",
"boolean",
"forcePersistentRead",
")",
"throws",
"RepositoryException",
"{",
"List",
"<",
"NodeData",
">",
"childNodes",
"=",
"null",
";",
"if",
"(",
"!",
... | Get child NodesData.
@param nodeData
parent
@param forcePersistentRead
true if persistent read is required (without cache)
@return List of NodeData
@throws RepositoryException
Repository error | [
"Get",
"child",
"NodesData",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L1377-L1423 |
135,771 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java | CacheableWorkspaceDataManager.getReferencedPropertiesData | protected List<PropertyData> getReferencedPropertiesData(final String identifier) throws RepositoryException
{
List<PropertyData> refProps = null;
if (cache.isEnabled())
{
refProps = cache.getReferencedProperties(identifier);
if (refProps != null)
{
return refProps;
}
}
final DataRequest request = new DataRequest(identifier, DataRequest.GET_REFERENCES);
try
{
request.start();
if (cache.isEnabled())
{
// Try first to get the value from the cache since a
// request could have been launched just before
refProps = cache.getReferencedProperties(identifier);
if (refProps != null)
{
return refProps;
}
}
return executeAction(new PrivilegedExceptionAction<List<PropertyData>>()
{
public List<PropertyData> run() throws RepositoryException
{
List<PropertyData> refProps = CacheableWorkspaceDataManager.super.getReferencesData(identifier, false);
if (cache.isEnabled())
{
cache.addReferencedProperties(identifier, refProps);
}
return refProps;
}
});
}
finally
{
request.done();
}
} | java | protected List<PropertyData> getReferencedPropertiesData(final String identifier) throws RepositoryException
{
List<PropertyData> refProps = null;
if (cache.isEnabled())
{
refProps = cache.getReferencedProperties(identifier);
if (refProps != null)
{
return refProps;
}
}
final DataRequest request = new DataRequest(identifier, DataRequest.GET_REFERENCES);
try
{
request.start();
if (cache.isEnabled())
{
// Try first to get the value from the cache since a
// request could have been launched just before
refProps = cache.getReferencedProperties(identifier);
if (refProps != null)
{
return refProps;
}
}
return executeAction(new PrivilegedExceptionAction<List<PropertyData>>()
{
public List<PropertyData> run() throws RepositoryException
{
List<PropertyData> refProps = CacheableWorkspaceDataManager.super.getReferencesData(identifier, false);
if (cache.isEnabled())
{
cache.addReferencedProperties(identifier, refProps);
}
return refProps;
}
});
}
finally
{
request.done();
}
} | [
"protected",
"List",
"<",
"PropertyData",
">",
"getReferencedPropertiesData",
"(",
"final",
"String",
"identifier",
")",
"throws",
"RepositoryException",
"{",
"List",
"<",
"PropertyData",
">",
"refProps",
"=",
"null",
";",
"if",
"(",
"cache",
".",
"isEnabled",
"... | Get referenced properties data.
@param identifier
referenceable identifier
@return List of PropertyData
@throws RepositoryException
Repository error | [
"Get",
"referenced",
"properties",
"data",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L1626-L1669 |
135,772 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java | CacheableWorkspaceDataManager.getCachedCleanChildPropertiesData | protected List<PropertyData> getCachedCleanChildPropertiesData(NodeData nodeData)
{
if (cache.isEnabled())
{
List<PropertyData> childProperties = cache.getChildProperties(nodeData);
if (childProperties != null)
{
boolean skip = false;
for (PropertyData prop : childProperties)
{
if (prop != null && !(prop instanceof NullPropertyData) && forceLoad(prop))
{
cache.remove(prop.getIdentifier(), prop);
skip = true;
}
}
if (!skip)
{
return childProperties;
}
}
}
return null;
} | java | protected List<PropertyData> getCachedCleanChildPropertiesData(NodeData nodeData)
{
if (cache.isEnabled())
{
List<PropertyData> childProperties = cache.getChildProperties(nodeData);
if (childProperties != null)
{
boolean skip = false;
for (PropertyData prop : childProperties)
{
if (prop != null && !(prop instanceof NullPropertyData) && forceLoad(prop))
{
cache.remove(prop.getIdentifier(), prop);
skip = true;
}
}
if (!skip)
{
return childProperties;
}
}
}
return null;
} | [
"protected",
"List",
"<",
"PropertyData",
">",
"getCachedCleanChildPropertiesData",
"(",
"NodeData",
"nodeData",
")",
"{",
"if",
"(",
"cache",
".",
"isEnabled",
"(",
")",
")",
"{",
"List",
"<",
"PropertyData",
">",
"childProperties",
"=",
"cache",
".",
"getChi... | Gets the list of child properties from the cache and checks if one of them
is incomplete, if everything is ok, it returns the list otherwise it returns
null. | [
"Gets",
"the",
"list",
"of",
"child",
"properties",
"from",
"the",
"cache",
"and",
"checks",
"if",
"one",
"of",
"them",
"is",
"incomplete",
"if",
"everything",
"is",
"ok",
"it",
"returns",
"the",
"list",
"otherwise",
"it",
"returns",
"null",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L1676-L1699 |
135,773 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java | CacheableWorkspaceDataManager.getChildPropertiesData | protected List<PropertyData> getChildPropertiesData(final NodeData nodeData, boolean forcePersistentRead)
throws RepositoryException
{
List<PropertyData> childProperties = null;
if (!forcePersistentRead)
{
childProperties = getCachedCleanChildPropertiesData(nodeData);
if (childProperties != null)
{
return childProperties;
}
}
final DataRequest request = new DataRequest(nodeData.getIdentifier(), DataRequest.GET_PROPERTIES);
try
{
request.start();
if (!forcePersistentRead)
{
// Try first to get the value from the cache since a
// request could have been launched just before
childProperties = getCachedCleanChildPropertiesData(nodeData);
if (childProperties != null)
{
return childProperties;
}
}
return executeAction(new PrivilegedExceptionAction<List<PropertyData>>()
{
public List<PropertyData> run() throws RepositoryException
{
List<PropertyData> childProperties =
CacheableWorkspaceDataManager.super.getChildPropertiesData(nodeData);
if (childProperties.size() > 0 && cache.isEnabled())
{
cache.addChildProperties(nodeData, childProperties);
}
return childProperties;
}
});
}
finally
{
request.done();
}
} | java | protected List<PropertyData> getChildPropertiesData(final NodeData nodeData, boolean forcePersistentRead)
throws RepositoryException
{
List<PropertyData> childProperties = null;
if (!forcePersistentRead)
{
childProperties = getCachedCleanChildPropertiesData(nodeData);
if (childProperties != null)
{
return childProperties;
}
}
final DataRequest request = new DataRequest(nodeData.getIdentifier(), DataRequest.GET_PROPERTIES);
try
{
request.start();
if (!forcePersistentRead)
{
// Try first to get the value from the cache since a
// request could have been launched just before
childProperties = getCachedCleanChildPropertiesData(nodeData);
if (childProperties != null)
{
return childProperties;
}
}
return executeAction(new PrivilegedExceptionAction<List<PropertyData>>()
{
public List<PropertyData> run() throws RepositoryException
{
List<PropertyData> childProperties =
CacheableWorkspaceDataManager.super.getChildPropertiesData(nodeData);
if (childProperties.size() > 0 && cache.isEnabled())
{
cache.addChildProperties(nodeData, childProperties);
}
return childProperties;
}
});
}
finally
{
request.done();
}
} | [
"protected",
"List",
"<",
"PropertyData",
">",
"getChildPropertiesData",
"(",
"final",
"NodeData",
"nodeData",
",",
"boolean",
"forcePersistentRead",
")",
"throws",
"RepositoryException",
"{",
"List",
"<",
"PropertyData",
">",
"childProperties",
"=",
"null",
";",
"i... | Get child PropertyData.
@param nodeData
parent
@param forcePersistentRead
true if persistent read is required (without cache)
@return List of PropertyData
@throws RepositoryException
Repository error | [
"Get",
"child",
"PropertyData",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L1712-L1759 |
135,774 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java | CacheableWorkspaceDataManager.getPersistedItemData | protected ItemData getPersistedItemData(NodeData parentData, QPathEntry name, ItemType itemType)
throws RepositoryException
{
ItemData data = super.getItemData(parentData, name, itemType);
if (cache.isEnabled())
{
if (data == null)
{
if (itemType == ItemType.NODE || itemType == ItemType.UNKNOWN)
{
cache.put(new NullNodeData(parentData, name));
}
else
{
cache.put(new NullPropertyData(parentData, name));
}
}
else
{
cache.put(data);
}
}
return data;
} | java | protected ItemData getPersistedItemData(NodeData parentData, QPathEntry name, ItemType itemType)
throws RepositoryException
{
ItemData data = super.getItemData(parentData, name, itemType);
if (cache.isEnabled())
{
if (data == null)
{
if (itemType == ItemType.NODE || itemType == ItemType.UNKNOWN)
{
cache.put(new NullNodeData(parentData, name));
}
else
{
cache.put(new NullPropertyData(parentData, name));
}
}
else
{
cache.put(data);
}
}
return data;
} | [
"protected",
"ItemData",
"getPersistedItemData",
"(",
"NodeData",
"parentData",
",",
"QPathEntry",
"name",
",",
"ItemType",
"itemType",
")",
"throws",
"RepositoryException",
"{",
"ItemData",
"data",
"=",
"super",
".",
"getItemData",
"(",
"parentData",
",",
"name",
... | Get persisted ItemData.
@param parentData
parent
@param name
Item name
@param itemType
item type
@return ItemData
@throws RepositoryException
error | [
"Get",
"persisted",
"ItemData",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L1975-L1998 |
135,775 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java | CacheableWorkspaceDataManager.initRemoteCommands | private void initRemoteCommands()
{
if (rpcService != null)
{
// register commands
suspend = rpcService.registerCommand(new RemoteCommand()
{
public String getId()
{
return "org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager-suspend-"
+ dataContainer.getUniqueName();
}
public Serializable execute(Serializable[] args) throws Throwable
{
suspendLocally();
return null;
}
});
resume = rpcService.registerCommand(new RemoteCommand()
{
public String getId()
{
return "org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager-resume-"
+ dataContainer.getUniqueName();
}
public Serializable execute(Serializable[] args) throws Throwable
{
resumeLocally();
return null;
}
});
requestForResponsibleForResuming = rpcService.registerCommand(new RemoteCommand()
{
public String getId()
{
return "org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager"
+ "-requestForResponsibilityForResuming-" + dataContainer.getUniqueName();
}
public Serializable execute(Serializable[] args) throws Throwable
{
return isResponsibleForResuming.get();
}
});
}
} | java | private void initRemoteCommands()
{
if (rpcService != null)
{
// register commands
suspend = rpcService.registerCommand(new RemoteCommand()
{
public String getId()
{
return "org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager-suspend-"
+ dataContainer.getUniqueName();
}
public Serializable execute(Serializable[] args) throws Throwable
{
suspendLocally();
return null;
}
});
resume = rpcService.registerCommand(new RemoteCommand()
{
public String getId()
{
return "org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager-resume-"
+ dataContainer.getUniqueName();
}
public Serializable execute(Serializable[] args) throws Throwable
{
resumeLocally();
return null;
}
});
requestForResponsibleForResuming = rpcService.registerCommand(new RemoteCommand()
{
public String getId()
{
return "org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager"
+ "-requestForResponsibilityForResuming-" + dataContainer.getUniqueName();
}
public Serializable execute(Serializable[] args) throws Throwable
{
return isResponsibleForResuming.get();
}
});
}
} | [
"private",
"void",
"initRemoteCommands",
"(",
")",
"{",
"if",
"(",
"rpcService",
"!=",
"null",
")",
"{",
"// register commands",
"suspend",
"=",
"rpcService",
".",
"registerCommand",
"(",
"new",
"RemoteCommand",
"(",
")",
"{",
"public",
"String",
"getId",
"(",... | Initialization remote commands. | [
"Initialization",
"remote",
"commands",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L2274-L2326 |
135,776 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java | CacheableWorkspaceDataManager.unregisterRemoteCommands | private void unregisterRemoteCommands()
{
if (rpcService != null)
{
rpcService.unregisterCommand(suspend);
rpcService.unregisterCommand(resume);
rpcService.unregisterCommand(requestForResponsibleForResuming);
}
} | java | private void unregisterRemoteCommands()
{
if (rpcService != null)
{
rpcService.unregisterCommand(suspend);
rpcService.unregisterCommand(resume);
rpcService.unregisterCommand(requestForResponsibleForResuming);
}
} | [
"private",
"void",
"unregisterRemoteCommands",
"(",
")",
"{",
"if",
"(",
"rpcService",
"!=",
"null",
")",
"{",
"rpcService",
".",
"unregisterCommand",
"(",
"suspend",
")",
";",
"rpcService",
".",
"unregisterCommand",
"(",
"resume",
")",
";",
"rpcService",
".",... | Unregister remote commands. | [
"Unregister",
"remote",
"commands",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L2331-L2340 |
135,777 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java | CacheableWorkspaceDataManager.initACL | private ItemData initACL(NodeData parent, NodeData node) throws RepositoryException
{
return initACL(parent, node, null);
} | java | private ItemData initACL(NodeData parent, NodeData node) throws RepositoryException
{
return initACL(parent, node, null);
} | [
"private",
"ItemData",
"initACL",
"(",
"NodeData",
"parent",
",",
"NodeData",
"node",
")",
"throws",
"RepositoryException",
"{",
"return",
"initACL",
"(",
"parent",
",",
"node",
",",
"null",
")",
";",
"}"
] | Init ACL of the node.
@param parent
- a parent, can be null (get item by id)
@param node
- an item data
@return - an item data with ACL was initialized
@throws RepositoryException | [
"Init",
"ACL",
"of",
"the",
"node",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L2375-L2378 |
135,778 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java | CacheableWorkspaceDataManager.getACL | private NodeData getACL(String identifier, ACLSearch search) throws RepositoryException
{
final ItemData item = getItemData(identifier, false);
return item != null && item.isNode() ? initACL(null, (NodeData)item, search) : null;
} | java | private NodeData getACL(String identifier, ACLSearch search) throws RepositoryException
{
final ItemData item = getItemData(identifier, false);
return item != null && item.isNode() ? initACL(null, (NodeData)item, search) : null;
} | [
"private",
"NodeData",
"getACL",
"(",
"String",
"identifier",
",",
"ACLSearch",
"search",
")",
"throws",
"RepositoryException",
"{",
"final",
"ItemData",
"item",
"=",
"getItemData",
"(",
"identifier",
",",
"false",
")",
";",
"return",
"item",
"!=",
"null",
"&&... | Find Item by identifier to get the missing ACL information.
@param identifier the id of the node that we are looking for to fill the ACL research
@param search the ACL search describing what we are looking for
@return NodeData, data by identifier | [
"Find",
"Item",
"by",
"identifier",
"to",
"get",
"the",
"missing",
"ACL",
"information",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L2536-L2540 |
135,779 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java | CacheableWorkspaceDataManager.getACLHolders | public List<ACLHolder> getACLHolders() throws RepositoryException
{
WorkspaceStorageConnection conn = dataContainer.openConnection();
try
{
return conn.getACLHolders();
}
finally
{
conn.close();
}
} | java | public List<ACLHolder> getACLHolders() throws RepositoryException
{
WorkspaceStorageConnection conn = dataContainer.openConnection();
try
{
return conn.getACLHolders();
}
finally
{
conn.close();
}
} | [
"public",
"List",
"<",
"ACLHolder",
">",
"getACLHolders",
"(",
")",
"throws",
"RepositoryException",
"{",
"WorkspaceStorageConnection",
"conn",
"=",
"dataContainer",
".",
"openConnection",
"(",
")",
";",
"try",
"{",
"return",
"conn",
".",
"getACLHolders",
"(",
"... | Gets the list of all the ACL holders
@throws RepositoryException if an error occurs | [
"Gets",
"the",
"list",
"of",
"all",
"the",
"ACL",
"holders"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L2546-L2557 |
135,780 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java | CacheableWorkspaceDataManager.loadFilters | protected boolean loadFilters(final boolean cleanOnFail, boolean asynchronous)
{
if (!filtersSupported.get())
{
if (LOG.isWarnEnabled())
{
LOG.warn("The bloom filters are not supported therefore they cannot be reloaded");
}
return false;
}
filtersEnabled.set(false);
this.filterPermissions = new BloomFilter<String>(bfProbability, bfElementNumber);
this.filterOwner = new BloomFilter<String>(bfProbability, bfElementNumber);
if (asynchronous)
{
new Thread(new Runnable()
{
public void run()
{
doLoadFilters(cleanOnFail);
}
}, "BloomFilter-Loader-" + dataContainer.getName()).start();
return true;
}
else
{
return doLoadFilters(cleanOnFail);
}
} | java | protected boolean loadFilters(final boolean cleanOnFail, boolean asynchronous)
{
if (!filtersSupported.get())
{
if (LOG.isWarnEnabled())
{
LOG.warn("The bloom filters are not supported therefore they cannot be reloaded");
}
return false;
}
filtersEnabled.set(false);
this.filterPermissions = new BloomFilter<String>(bfProbability, bfElementNumber);
this.filterOwner = new BloomFilter<String>(bfProbability, bfElementNumber);
if (asynchronous)
{
new Thread(new Runnable()
{
public void run()
{
doLoadFilters(cleanOnFail);
}
}, "BloomFilter-Loader-" + dataContainer.getName()).start();
return true;
}
else
{
return doLoadFilters(cleanOnFail);
}
} | [
"protected",
"boolean",
"loadFilters",
"(",
"final",
"boolean",
"cleanOnFail",
",",
"boolean",
"asynchronous",
")",
"{",
"if",
"(",
"!",
"filtersSupported",
".",
"get",
"(",
")",
")",
"{",
"if",
"(",
"LOG",
".",
"isWarnEnabled",
"(",
")",
")",
"{",
"LOG"... | Loads the bloom filters
@param cleanOnFail clean everything if an error occurs
@param asynchronous make the bloom filters loading asynchronous
@return <code>true</code> if the filters could be loaded successfully, <code>false</code> otherwise. | [
"Loads",
"the",
"bloom",
"filters"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L2640-L2670 |
135,781 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java | CacheableWorkspaceDataManager.forceLoad | private boolean forceLoad(PropertyData prop)
{
final List<ValueData> vals = prop.getValues();
for (int i = 0; i < vals.size(); i++)
{
ValueData vd = vals.get(i);
if (!vd.isByteArray())
{
// check if file is correct
FilePersistedValueData fpvd = (FilePersistedValueData)vd;
if (fpvd.getFile() == null)
{
if (fpvd instanceof StreamPersistedValueData && ((StreamPersistedValueData)fpvd).getUrl() != null)
continue;
return true;
}
else if (!PrivilegedFileHelper.exists(fpvd.getFile()))// check if file exist
{
return true;
}
}
}
return false;
} | java | private boolean forceLoad(PropertyData prop)
{
final List<ValueData> vals = prop.getValues();
for (int i = 0; i < vals.size(); i++)
{
ValueData vd = vals.get(i);
if (!vd.isByteArray())
{
// check if file is correct
FilePersistedValueData fpvd = (FilePersistedValueData)vd;
if (fpvd.getFile() == null)
{
if (fpvd instanceof StreamPersistedValueData && ((StreamPersistedValueData)fpvd).getUrl() != null)
continue;
return true;
}
else if (!PrivilegedFileHelper.exists(fpvd.getFile()))// check if file exist
{
return true;
}
}
}
return false;
} | [
"private",
"boolean",
"forceLoad",
"(",
"PropertyData",
"prop",
")",
"{",
"final",
"List",
"<",
"ValueData",
">",
"vals",
"=",
"prop",
".",
"getValues",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"vals",
".",
"size",
"(",
")",
... | Check Property BLOB Values if someone has null file.
@param prop PropertyData
@throws RepositoryException
@return <code>true</code> if the Property BLOB Values has null file, <code>false</code> otherwise. | [
"Check",
"Property",
"BLOB",
"Values",
"if",
"someone",
"has",
"null",
"file",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L2793-L2816 |
135,782 | exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/MoveCommand.java | MoveCommand.move | public Response move(Session session, String srcPath, String destPath)
{
try
{
session.move(srcPath, destPath);
session.save();
// If the source resource was successfully moved
// to a pre-existing destination resource.
if (itemExisted)
{
return Response.status(HTTPStatus.NO_CONTENT).cacheControl(cacheControl).build();
}
// If the source resource was successfully moved,
// and a new resource was created at the destination.
else
{
if (uriBuilder != null)
{
return Response.created(uriBuilder.path(session.getWorkspace().getName()).path(destPath).build())
.cacheControl(cacheControl).build();
}
// to save compatibility if uriBuilder is not provided
return Response.status(HTTPStatus.CREATED).cacheControl(cacheControl).build();
}
}
catch (LockException exc)
{
return Response.status(HTTPStatus.LOCKED).entity(exc.getMessage()).build();
}
catch (PathNotFoundException exc)
{
return Response.status(HTTPStatus.CONFLICT).entity(exc.getMessage()).build();
}
catch (RepositoryException exc)
{
log.error(exc.getMessage(), exc);
return Response.serverError().entity(exc.getMessage()).build();
}
} | java | public Response move(Session session, String srcPath, String destPath)
{
try
{
session.move(srcPath, destPath);
session.save();
// If the source resource was successfully moved
// to a pre-existing destination resource.
if (itemExisted)
{
return Response.status(HTTPStatus.NO_CONTENT).cacheControl(cacheControl).build();
}
// If the source resource was successfully moved,
// and a new resource was created at the destination.
else
{
if (uriBuilder != null)
{
return Response.created(uriBuilder.path(session.getWorkspace().getName()).path(destPath).build())
.cacheControl(cacheControl).build();
}
// to save compatibility if uriBuilder is not provided
return Response.status(HTTPStatus.CREATED).cacheControl(cacheControl).build();
}
}
catch (LockException exc)
{
return Response.status(HTTPStatus.LOCKED).entity(exc.getMessage()).build();
}
catch (PathNotFoundException exc)
{
return Response.status(HTTPStatus.CONFLICT).entity(exc.getMessage()).build();
}
catch (RepositoryException exc)
{
log.error(exc.getMessage(), exc);
return Response.serverError().entity(exc.getMessage()).build();
}
} | [
"public",
"Response",
"move",
"(",
"Session",
"session",
",",
"String",
"srcPath",
",",
"String",
"destPath",
")",
"{",
"try",
"{",
"session",
".",
"move",
"(",
"srcPath",
",",
"destPath",
")",
";",
"session",
".",
"save",
"(",
")",
";",
"// If the sourc... | Webdav Move method implementation.
@param session current session.
@param srcPath source resource path
@param destPath destination resource path
@return the instance of javax.ws.rs.core.Response | [
"Webdav",
"Move",
"method",
"implementation",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/MoveCommand.java#L101-L145 |
135,783 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java | AbstractItemDefinitionAccessProvider.loadPropertyValues | protected List<ValueData> loadPropertyValues(NodeData parentNode, ItemData property , InternalQName propertyName)
throws RepositoryException
{
if(property == null)
{
property = dataManager.getItemData(parentNode, new QPathEntry(propertyName, 1), ItemType.PROPERTY);
}
if (property != null)
{
if (property.isNode())
throw new RepositoryException("Fail to load property " + propertyName + "not found for "
+ parentNode.getQPath().getAsString());
return ((PropertyData)property).getValues();
}
return null;
} | java | protected List<ValueData> loadPropertyValues(NodeData parentNode, ItemData property , InternalQName propertyName)
throws RepositoryException
{
if(property == null)
{
property = dataManager.getItemData(parentNode, new QPathEntry(propertyName, 1), ItemType.PROPERTY);
}
if (property != null)
{
if (property.isNode())
throw new RepositoryException("Fail to load property " + propertyName + "not found for "
+ parentNode.getQPath().getAsString());
return ((PropertyData)property).getValues();
}
return null;
} | [
"protected",
"List",
"<",
"ValueData",
">",
"loadPropertyValues",
"(",
"NodeData",
"parentNode",
",",
"ItemData",
"property",
",",
"InternalQName",
"propertyName",
")",
"throws",
"RepositoryException",
"{",
"if",
"(",
"property",
"==",
"null",
")",
"{",
"property"... | Load values.
@param parentNode
@param propertyName
@return
@throws RepositoryException | [
"Load",
"values",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java#L70-L85 |
135,784 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/QuotaExecutorService.java | QuotaExecutorService.awaitTasksTermination | protected void awaitTasksTermination()
{
delegated.shutdown();
try
{
delegated.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
}
catch (InterruptedException e)
{
LOG.warn("Termination has been interrupted");
}
} | java | protected void awaitTasksTermination()
{
delegated.shutdown();
try
{
delegated.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
}
catch (InterruptedException e)
{
LOG.warn("Termination has been interrupted");
}
} | [
"protected",
"void",
"awaitTasksTermination",
"(",
")",
"{",
"delegated",
".",
"shutdown",
"(",
")",
";",
"try",
"{",
"delegated",
".",
"awaitTermination",
"(",
"Long",
".",
"MAX_VALUE",
",",
"TimeUnit",
".",
"NANOSECONDS",
")",
";",
"}",
"catch",
"(",
"In... | Awaits until all tasks will be done. | [
"Awaits",
"until",
"all",
"tasks",
"will",
"be",
"done",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/QuotaExecutorService.java#L223-L234 |
135,785 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionRegistry.java | SessionRegistry.closeSessions | public int closeSessions(String workspaceName)
{
int closedSessions = 0;
for (SessionImpl session : sessionsMap.values())
{
if (session.getWorkspace().getName().equals(workspaceName))
{
session.logout();
closedSessions++;
}
}
return closedSessions;
} | java | public int closeSessions(String workspaceName)
{
int closedSessions = 0;
for (SessionImpl session : sessionsMap.values())
{
if (session.getWorkspace().getName().equals(workspaceName))
{
session.logout();
closedSessions++;
}
}
return closedSessions;
} | [
"public",
"int",
"closeSessions",
"(",
"String",
"workspaceName",
")",
"{",
"int",
"closedSessions",
"=",
"0",
";",
"for",
"(",
"SessionImpl",
"session",
":",
"sessionsMap",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"session",
".",
"getWorkspace",
"(",... | closeSessions will be closed the all sessions on specific workspace.
@param workspaceName
the workspace name.
@return int
how many sessions was closed. | [
"closeSessions",
"will",
"be",
"closed",
"the",
"all",
"sessions",
"on",
"specific",
"workspace",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionRegistry.java#L222-L236 |
135,786 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java | BufferedISPNCache.commitTransaction | public void commitTransaction()
{
CompressedISPNChangesBuffer changesContainer = getChangesBufferSafe();
final TransactionManager tm = getTransactionManager();
try
{
final List<ChangesContainer> containers = changesContainer.getSortedList();
commitChanges(tm, containers);
}
finally
{
changesList.set(null);
changesContainer = null;
}
} | java | public void commitTransaction()
{
CompressedISPNChangesBuffer changesContainer = getChangesBufferSafe();
final TransactionManager tm = getTransactionManager();
try
{
final List<ChangesContainer> containers = changesContainer.getSortedList();
commitChanges(tm, containers);
}
finally
{
changesList.set(null);
changesContainer = null;
}
} | [
"public",
"void",
"commitTransaction",
"(",
")",
"{",
"CompressedISPNChangesBuffer",
"changesContainer",
"=",
"getChangesBufferSafe",
"(",
")",
";",
"final",
"TransactionManager",
"tm",
"=",
"getTransactionManager",
"(",
")",
";",
"try",
"{",
"final",
"List",
"<",
... | Sort changes and commit data to the cache. | [
"Sort",
"changes",
"and",
"commit",
"data",
"to",
"the",
"cache",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java#L1134-L1148 |
135,787 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java | BufferedISPNCache.setLocal | public void setLocal(boolean local)
{
// start local transaction
if (local && changesList.get() == null)
{
beginTransaction();
}
this.local.set(local);
} | java | public void setLocal(boolean local)
{
// start local transaction
if (local && changesList.get() == null)
{
beginTransaction();
}
this.local.set(local);
} | [
"public",
"void",
"setLocal",
"(",
"boolean",
"local",
")",
"{",
"// start local transaction",
"if",
"(",
"local",
"&&",
"changesList",
".",
"get",
"(",
")",
"==",
"null",
")",
"{",
"beginTransaction",
"(",
")",
";",
"}",
"this",
".",
"local",
".",
"set"... | Creates all ChangesBuffers with given parameter
@param local | [
"Creates",
"all",
"ChangesBuffers",
"with",
"given",
"parameter"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java#L1230-L1238 |
135,788 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java | BufferedISPNCache.getChangesBufferSafe | private CompressedISPNChangesBuffer getChangesBufferSafe()
{
CompressedISPNChangesBuffer changesContainer = changesList.get();
if (changesContainer == null)
{
throw new IllegalStateException("changesContainer should not be empty");
}
return changesContainer;
} | java | private CompressedISPNChangesBuffer getChangesBufferSafe()
{
CompressedISPNChangesBuffer changesContainer = changesList.get();
if (changesContainer == null)
{
throw new IllegalStateException("changesContainer should not be empty");
}
return changesContainer;
} | [
"private",
"CompressedISPNChangesBuffer",
"getChangesBufferSafe",
"(",
")",
"{",
"CompressedISPNChangesBuffer",
"changesContainer",
"=",
"changesList",
".",
"get",
"(",
")",
";",
"if",
"(",
"changesContainer",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateExcep... | Tries to get buffer and if it is null throws an exception otherwise returns buffer.
@return | [
"Tries",
"to",
"get",
"buffer",
"and",
"if",
"it",
"is",
"null",
"throws",
"an",
"exception",
"otherwise",
"returns",
"buffer",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java#L1245-L1253 |
135,789 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/rest/RESTArtifactLoaderService.java | RESTArtifactLoaderService.getResource | @GET
@Path("/{path:.*}/")
public Response getResource(@PathParam("path") String mavenPath, final @Context UriInfo uriInfo,
final @QueryParam("view") String view, final @QueryParam("gadget") String gadget)
{
String resourcePath = mavenRoot + mavenPath; // JCR resource
String shaResourcePath = mavenPath.endsWith(".sha1") ? mavenRoot + mavenPath : mavenRoot + mavenPath + ".sha1";
mavenPath = uriInfo.getBaseUriBuilder().path(getClass()).path(mavenPath).build().toString();
Session ses = null;
try
{
// JCR resource
SessionProvider sp = sessionProviderService.getSessionProvider(null);
if (sp == null)
throw new RepositoryException("Access to JCR Repository denied. SessionProvider is null.");
ses = sp.getSession(workspace, repositoryService.getRepository(repository));
ExtendedNode node = (ExtendedNode)ses.getRootNode().getNode(resourcePath);
if (isFile(node))
{
if (view != null && view.equalsIgnoreCase("true"))
{
ExtendedNode shaNode = null;
try
{
shaNode = (ExtendedNode)ses.getRootNode().getNode(shaResourcePath);
}
catch (RepositoryException e)
{ // no .sh1 file found
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
return getArtifactInfo(node, mavenPath, gadget, shaNode);
}
else
{
return downloadArtifact(node);
}
}
else
{
return browseRepository(node, mavenPath, gadget);
}
}
catch (PathNotFoundException e)
{
if (LOG.isDebugEnabled())
LOG.debug(e.getLocalizedMessage(), e);
return Response.status(Response.Status.NOT_FOUND).build();
}
catch (AccessDeniedException e)
{
if (LOG.isDebugEnabled())
LOG.debug(e.getLocalizedMessage(), e);
if (ses == null || ses.getUserID().equals(IdentityConstants.ANONIM))
return Response.status(Response.Status.UNAUTHORIZED).header(ExtHttpHeaders.WWW_AUTHENTICATE,
"Basic realm=\"" + realmName + "\"").build();
else
return Response.status(Response.Status.FORBIDDEN).build();
}
catch (Exception e)
{
LOG.error("Failed get maven artifact", e);
throw new WebApplicationException(e);
}
finally
{
if (ses != null)
ses.logout();
}
} | java | @GET
@Path("/{path:.*}/")
public Response getResource(@PathParam("path") String mavenPath, final @Context UriInfo uriInfo,
final @QueryParam("view") String view, final @QueryParam("gadget") String gadget)
{
String resourcePath = mavenRoot + mavenPath; // JCR resource
String shaResourcePath = mavenPath.endsWith(".sha1") ? mavenRoot + mavenPath : mavenRoot + mavenPath + ".sha1";
mavenPath = uriInfo.getBaseUriBuilder().path(getClass()).path(mavenPath).build().toString();
Session ses = null;
try
{
// JCR resource
SessionProvider sp = sessionProviderService.getSessionProvider(null);
if (sp == null)
throw new RepositoryException("Access to JCR Repository denied. SessionProvider is null.");
ses = sp.getSession(workspace, repositoryService.getRepository(repository));
ExtendedNode node = (ExtendedNode)ses.getRootNode().getNode(resourcePath);
if (isFile(node))
{
if (view != null && view.equalsIgnoreCase("true"))
{
ExtendedNode shaNode = null;
try
{
shaNode = (ExtendedNode)ses.getRootNode().getNode(shaResourcePath);
}
catch (RepositoryException e)
{ // no .sh1 file found
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
return getArtifactInfo(node, mavenPath, gadget, shaNode);
}
else
{
return downloadArtifact(node);
}
}
else
{
return browseRepository(node, mavenPath, gadget);
}
}
catch (PathNotFoundException e)
{
if (LOG.isDebugEnabled())
LOG.debug(e.getLocalizedMessage(), e);
return Response.status(Response.Status.NOT_FOUND).build();
}
catch (AccessDeniedException e)
{
if (LOG.isDebugEnabled())
LOG.debug(e.getLocalizedMessage(), e);
if (ses == null || ses.getUserID().equals(IdentityConstants.ANONIM))
return Response.status(Response.Status.UNAUTHORIZED).header(ExtHttpHeaders.WWW_AUTHENTICATE,
"Basic realm=\"" + realmName + "\"").build();
else
return Response.status(Response.Status.FORBIDDEN).build();
}
catch (Exception e)
{
LOG.error("Failed get maven artifact", e);
throw new WebApplicationException(e);
}
finally
{
if (ses != null)
ses.logout();
}
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"/{path:.*}/\"",
")",
"public",
"Response",
"getResource",
"(",
"@",
"PathParam",
"(",
"\"path\"",
")",
"String",
"mavenPath",
",",
"final",
"@",
"Context",
"UriInfo",
"uriInfo",
",",
"final",
"@",
"QueryParam",
"(",
"\"view\"... | Return Response with Maven artifact if it is file or HTML page for browsing if requested URL is
folder.
@param mavenPath
the relative part of requested URL.
@param uriInfo
@param view
@param gadget
@return {@link Response}. | [
"Return",
"Response",
"with",
"Maven",
"artifact",
"if",
"it",
"is",
"file",
"or",
"HTML",
"page",
"for",
"browsing",
"if",
"requested",
"URL",
"is",
"folder",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/rest/RESTArtifactLoaderService.java#L164-L244 |
135,790 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/rest/RESTArtifactLoaderService.java | RESTArtifactLoaderService.getRootNodeList | @GET
public Response getRootNodeList(final @Context UriInfo uriInfo, final @QueryParam("view") String view,
final @QueryParam("gadget") String gadget)
{
return getResource("", uriInfo, view, gadget);
} | java | @GET
public Response getRootNodeList(final @Context UriInfo uriInfo, final @QueryParam("view") String view,
final @QueryParam("gadget") String gadget)
{
return getResource("", uriInfo, view, gadget);
} | [
"@",
"GET",
"public",
"Response",
"getRootNodeList",
"(",
"final",
"@",
"Context",
"UriInfo",
"uriInfo",
",",
"final",
"@",
"QueryParam",
"(",
"\"view\"",
")",
"String",
"view",
",",
"final",
"@",
"QueryParam",
"(",
"\"gadget\"",
")",
"String",
"gadget",
")"... | Browsing of root node of Maven repository.
@param uriInfo
@param view
@param gadget
@return {@link Response}. | [
"Browsing",
"of",
"root",
"node",
"of",
"Maven",
"repository",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/rest/RESTArtifactLoaderService.java#L254-L259 |
135,791 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/rest/RESTArtifactLoaderService.java | RESTArtifactLoaderService.isFile | private static boolean isFile(Node node) throws RepositoryException
{
if (!node.isNodeType("nt:file"))
{
return false;
}
if (!node.getNode("jcr:content").isNodeType("nt:resource"))
{
return false;
}
return true;
} | java | private static boolean isFile(Node node) throws RepositoryException
{
if (!node.isNodeType("nt:file"))
{
return false;
}
if (!node.getNode("jcr:content").isNodeType("nt:resource"))
{
return false;
}
return true;
} | [
"private",
"static",
"boolean",
"isFile",
"(",
"Node",
"node",
")",
"throws",
"RepositoryException",
"{",
"if",
"(",
"!",
"node",
".",
"isNodeType",
"(",
"\"nt:file\"",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"node",
".",
"getNode",
... | Check is node represents file.
@param node
the node.
@return true if node represents file false otherwise.
@throws RepositoryException
in JCR errors occur. | [
"Check",
"is",
"node",
"represents",
"file",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/rest/RESTArtifactLoaderService.java#L270-L281 |
135,792 | exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/rest/RESTArtifactLoaderService.java | RESTArtifactLoaderService.downloadArtifact | private Response downloadArtifact(Node node) throws Exception
{
NodeRepresentation nodeRepresentation = nodeRepresentationService.getNodeRepresentation(node, null);
if (node.canAddMixin("exo:mavencounter"))
{
node.addMixin("exo:mavencounter");
node.getSession().save();
}
node.setProperty("exo:downloadcounter", node.getProperty("exo:downloadcounter").getLong() + 1l);
node.getSession().save();
long lastModified = nodeRepresentation.getLastModified();
String contentType = nodeRepresentation.getMediaType();
long contentLength = nodeRepresentation.getContentLenght();
InputStream entity = nodeRepresentation.getInputStream();
Response response =
Response.ok(entity, contentType).header(HttpHeaders.CONTENT_LENGTH, Long.toString(contentLength))
.lastModified(new Date(lastModified)).build();
return response;
} | java | private Response downloadArtifact(Node node) throws Exception
{
NodeRepresentation nodeRepresentation = nodeRepresentationService.getNodeRepresentation(node, null);
if (node.canAddMixin("exo:mavencounter"))
{
node.addMixin("exo:mavencounter");
node.getSession().save();
}
node.setProperty("exo:downloadcounter", node.getProperty("exo:downloadcounter").getLong() + 1l);
node.getSession().save();
long lastModified = nodeRepresentation.getLastModified();
String contentType = nodeRepresentation.getMediaType();
long contentLength = nodeRepresentation.getContentLenght();
InputStream entity = nodeRepresentation.getInputStream();
Response response =
Response.ok(entity, contentType).header(HttpHeaders.CONTENT_LENGTH, Long.toString(contentLength))
.lastModified(new Date(lastModified)).build();
return response;
} | [
"private",
"Response",
"downloadArtifact",
"(",
"Node",
"node",
")",
"throws",
"Exception",
"{",
"NodeRepresentation",
"nodeRepresentation",
"=",
"nodeRepresentationService",
".",
"getNodeRepresentation",
"(",
"node",
",",
"null",
")",
";",
"if",
"(",
"node",
".",
... | Get content of JCR node.
@param node
the node.
@return @see {@link Response}.
@throws Exception
if any errors occurs. | [
"Get",
"content",
"of",
"JCR",
"node",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/rest/RESTArtifactLoaderService.java#L503-L521 |
135,793 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java | JCRStatisticsManager.registerStatistics | public static void registerStatistics(String category, Statistics global, Map<String, Statistics> allStatistics)
{
if (category == null || category.length() == 0)
{
throw new IllegalArgumentException("The category of the statistics cannot be empty");
}
if (allStatistics == null || allStatistics.isEmpty())
{
throw new IllegalArgumentException("The list of statistics " + category + " cannot be empty");
}
PrintWriter pw = null;
if (PERSISTENCE_ENABLED)
{
pw = initWriter(category);
if (pw == null)
{
LOG.warn("Cannot create the print writer for the statistics " + category);
}
}
startIfNeeded();
synchronized (JCRStatisticsManager.class)
{
Map<String, StatisticsContext> tmpContexts = new HashMap<String, StatisticsContext>(CONTEXTS);
StatisticsContext ctx = new StatisticsContext(pw, global, allStatistics);
tmpContexts.put(category, ctx);
if (pw != null)
{
// Define the file header
printHeader(ctx);
}
CONTEXTS = Collections.unmodifiableMap(tmpContexts);
}
} | java | public static void registerStatistics(String category, Statistics global, Map<String, Statistics> allStatistics)
{
if (category == null || category.length() == 0)
{
throw new IllegalArgumentException("The category of the statistics cannot be empty");
}
if (allStatistics == null || allStatistics.isEmpty())
{
throw new IllegalArgumentException("The list of statistics " + category + " cannot be empty");
}
PrintWriter pw = null;
if (PERSISTENCE_ENABLED)
{
pw = initWriter(category);
if (pw == null)
{
LOG.warn("Cannot create the print writer for the statistics " + category);
}
}
startIfNeeded();
synchronized (JCRStatisticsManager.class)
{
Map<String, StatisticsContext> tmpContexts = new HashMap<String, StatisticsContext>(CONTEXTS);
StatisticsContext ctx = new StatisticsContext(pw, global, allStatistics);
tmpContexts.put(category, ctx);
if (pw != null)
{
// Define the file header
printHeader(ctx);
}
CONTEXTS = Collections.unmodifiableMap(tmpContexts);
}
} | [
"public",
"static",
"void",
"registerStatistics",
"(",
"String",
"category",
",",
"Statistics",
"global",
",",
"Map",
"<",
"String",
",",
"Statistics",
">",
"allStatistics",
")",
"{",
"if",
"(",
"category",
"==",
"null",
"||",
"category",
".",
"length",
"(",... | Register a new category of statistics to manage.
@param category the name of the category of statistics to register.
@param global the global statistics.
@param allStatistics the list of all statistics corresponding to the category. | [
"Register",
"a",
"new",
"category",
"of",
"statistics",
"to",
"manage",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java#L105-L137 |
135,794 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java | JCRStatisticsManager.startIfNeeded | private static void startIfNeeded()
{
if (!STARTED)
{
synchronized (JCRStatisticsManager.class)
{
if (!STARTED)
{
addTriggers();
ExoContainer container = ExoContainerContext.getTopContainer();
ManagementContext ctx = null;
if (container != null)
{
ctx = container.getManagementContext();
}
if (ctx == null)
{
LOG.warn("Cannot register the statistics");
}
else
{
ctx.register(new JCRStatisticsManager());
}
STARTED = true;
}
}
}
} | java | private static void startIfNeeded()
{
if (!STARTED)
{
synchronized (JCRStatisticsManager.class)
{
if (!STARTED)
{
addTriggers();
ExoContainer container = ExoContainerContext.getTopContainer();
ManagementContext ctx = null;
if (container != null)
{
ctx = container.getManagementContext();
}
if (ctx == null)
{
LOG.warn("Cannot register the statistics");
}
else
{
ctx.register(new JCRStatisticsManager());
}
STARTED = true;
}
}
}
} | [
"private",
"static",
"void",
"startIfNeeded",
"(",
")",
"{",
"if",
"(",
"!",
"STARTED",
")",
"{",
"synchronized",
"(",
"JCRStatisticsManager",
".",
"class",
")",
"{",
"if",
"(",
"!",
"STARTED",
")",
"{",
"addTriggers",
"(",
")",
";",
"ExoContainer",
"con... | Starts the manager if needed | [
"Starts",
"the",
"manager",
"if",
"needed"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java#L182-L209 |
135,795 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java | JCRStatisticsManager.addTriggers | private static void addTriggers()
{
if (!PERSISTENCE_ENABLED)
{
return;
}
Runtime.getRuntime().addShutdownHook(new Thread("JCRStatisticsManager-Hook")
{
@Override
public void run()
{
printData();
}
});
Thread t = new Thread("JCRStatisticsManager-Writer")
{
@Override
public void run()
{
while (true)
{
try
{
sleep(PERSISTENCE_TIMEOUT);
}
catch (InterruptedException e)
{
LOG.debug("InterruptedException", e);
}
printData();
}
}
};
t.setDaemon(true);
t.start();
} | java | private static void addTriggers()
{
if (!PERSISTENCE_ENABLED)
{
return;
}
Runtime.getRuntime().addShutdownHook(new Thread("JCRStatisticsManager-Hook")
{
@Override
public void run()
{
printData();
}
});
Thread t = new Thread("JCRStatisticsManager-Writer")
{
@Override
public void run()
{
while (true)
{
try
{
sleep(PERSISTENCE_TIMEOUT);
}
catch (InterruptedException e)
{
LOG.debug("InterruptedException", e);
}
printData();
}
}
};
t.setDaemon(true);
t.start();
} | [
"private",
"static",
"void",
"addTriggers",
"(",
")",
"{",
"if",
"(",
"!",
"PERSISTENCE_ENABLED",
")",
"{",
"return",
";",
"}",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"addShutdownHook",
"(",
"new",
"Thread",
"(",
"\"JCRStatisticsManager-Hook\"",
")",
"... | Add all the triggers that will keep the file up to date only if the persistence
is enabled. | [
"Add",
"all",
"the",
"triggers",
"that",
"will",
"keep",
"the",
"file",
"up",
"to",
"date",
"only",
"if",
"the",
"persistence",
"is",
"enabled",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java#L215-L250 |
135,796 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java | JCRStatisticsManager.printData | private static void printData()
{
Map<String, StatisticsContext> tmpContexts = CONTEXTS;
for (StatisticsContext context : tmpContexts.values())
{
printData(context);
}
} | java | private static void printData()
{
Map<String, StatisticsContext> tmpContexts = CONTEXTS;
for (StatisticsContext context : tmpContexts.values())
{
printData(context);
}
} | [
"private",
"static",
"void",
"printData",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"StatisticsContext",
">",
"tmpContexts",
"=",
"CONTEXTS",
";",
"for",
"(",
"StatisticsContext",
"context",
":",
"tmpContexts",
".",
"values",
"(",
")",
")",
"{",
"printData",... | Add one line of data to all the csv files. | [
"Add",
"one",
"line",
"of",
"data",
"to",
"all",
"the",
"csv",
"files",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java#L286-L293 |
135,797 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java | JCRStatisticsManager.printData | private static void printData(StatisticsContext context)
{
if (context.writer == null)
{
return;
}
boolean first = true;
if (context.global != null)
{
context.global.printData(context.writer);
first = false;
}
for (Statistics s : context.allStatistics.values())
{
if (first)
{
first = false;
}
else
{
context.writer.print(',');
}
s.printData(context.writer);
}
context.writer.println();
context.writer.flush();
} | java | private static void printData(StatisticsContext context)
{
if (context.writer == null)
{
return;
}
boolean first = true;
if (context.global != null)
{
context.global.printData(context.writer);
first = false;
}
for (Statistics s : context.allStatistics.values())
{
if (first)
{
first = false;
}
else
{
context.writer.print(',');
}
s.printData(context.writer);
}
context.writer.println();
context.writer.flush();
} | [
"private",
"static",
"void",
"printData",
"(",
"StatisticsContext",
"context",
")",
"{",
"if",
"(",
"context",
".",
"writer",
"==",
"null",
")",
"{",
"return",
";",
"}",
"boolean",
"first",
"=",
"true",
";",
"if",
"(",
"context",
".",
"global",
"!=",
"... | Add one line of data to the csv file related to the given context. | [
"Add",
"one",
"line",
"of",
"data",
"to",
"the",
"csv",
"file",
"related",
"to",
"the",
"given",
"context",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java#L298-L324 |
135,798 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java | JCRStatisticsManager.getContext | private static StatisticsContext getContext(String category)
{
if (category == null)
{
return null;
}
return CONTEXTS.get(category);
} | java | private static StatisticsContext getContext(String category)
{
if (category == null)
{
return null;
}
return CONTEXTS.get(category);
} | [
"private",
"static",
"StatisticsContext",
"getContext",
"(",
"String",
"category",
")",
"{",
"if",
"(",
"category",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"CONTEXTS",
".",
"get",
"(",
"category",
")",
";",
"}"
] | Retrieve statistics context of the given category.
@return the related {@link StatisticsContext}, <code>null</code> otherwise. | [
"Retrieve",
"statistics",
"context",
"of",
"the",
"given",
"category",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java#L330-L337 |
135,799 | exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java | JCRStatisticsManager.formatName | static String formatName(String name)
{
return name == null ? null : name.replaceAll(" ", "").replaceAll("[,;]", ", ");
} | java | static String formatName(String name)
{
return name == null ? null : name.replaceAll(" ", "").replaceAll("[,;]", ", ");
} | [
"static",
"String",
"formatName",
"(",
"String",
"name",
")",
"{",
"return",
"name",
"==",
"null",
"?",
"null",
":",
"name",
".",
"replaceAll",
"(",
"\" \"",
",",
"\"\"",
")",
".",
"replaceAll",
"(",
"\"[,;]\"",
",",
"\", \"",
")",
";",
"}"
] | Format the name of the statistics in the target format
@param name the name of the statistics requested
@return the formated statistics name | [
"Format",
"the",
"name",
"of",
"the",
"statistics",
"in",
"the",
"target",
"format"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java#L344-L347 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.