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,800
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java
JCRStatisticsManager.getStatistics
private static Statistics getStatistics(String category, String name) { StatisticsContext context = getContext(category); if (context == null) { return null; } // Format the name name = formatName(name); if (name == null) { return null; } Statistics statistics; if (GLOBAL_STATISTICS_NAME.equalsIgnoreCase(name)) { statistics = context.global; } else { statistics = context.allStatistics.get(name); } return statistics; }
java
private static Statistics getStatistics(String category, String name) { StatisticsContext context = getContext(category); if (context == null) { return null; } // Format the name name = formatName(name); if (name == null) { return null; } Statistics statistics; if (GLOBAL_STATISTICS_NAME.equalsIgnoreCase(name)) { statistics = context.global; } else { statistics = context.allStatistics.get(name); } return statistics; }
[ "private", "static", "Statistics", "getStatistics", "(", "String", "category", ",", "String", "name", ")", "{", "StatisticsContext", "context", "=", "getContext", "(", "category", ")", ";", "if", "(", "context", "==", "null", ")", "{", "return", "null", ";",...
Retrieve statistics of the given category and name. @return the related {@link Statistics}, <code>null</code> otherwise.
[ "Retrieve", "statistics", "of", "the", "given", "category", "and", "name", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java#L353-L376
135,801
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java
JCRStatisticsManager.resetAll
@Managed @ManagedDescription("Reset all the statistics.") public static void resetAll( @ManagedDescription("The name of the category of the statistics") @ManagedName("categoryName") String category) { StatisticsContext context = getContext(category); if (context != null) { context.reset(); } }
java
@Managed @ManagedDescription("Reset all the statistics.") public static void resetAll( @ManagedDescription("The name of the category of the statistics") @ManagedName("categoryName") String category) { StatisticsContext context = getContext(category); if (context != null) { context.reset(); } }
[ "@", "Managed", "@", "ManagedDescription", "(", "\"Reset all the statistics.\"", ")", "public", "static", "void", "resetAll", "(", "@", "ManagedDescription", "(", "\"The name of the category of the statistics\"", ")", "@", "ManagedName", "(", "\"categoryName\"", ")", "Str...
Allows to reset all the statistics corresponding to the given category. @param category
[ "Allows", "to", "reset", "all", "the", "statistics", "corresponding", "to", "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#L482-L493
135,802
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/misc/MatchResult.java
MatchResult.getRemainder
public QPath getRemainder() { if (matchPos + matchLength >= pathLength) { return null; } else { try { throw new RepositoryException("Not implemented"); //return path.subPath(matchPos + matchLength, pathLength); } catch (RepositoryException e) { throw (IllegalStateException)new IllegalStateException("Path not normalized").initCause(e); } } }
java
public QPath getRemainder() { if (matchPos + matchLength >= pathLength) { return null; } else { try { throw new RepositoryException("Not implemented"); //return path.subPath(matchPos + matchLength, pathLength); } catch (RepositoryException e) { throw (IllegalStateException)new IllegalStateException("Path not normalized").initCause(e); } } }
[ "public", "QPath", "getRemainder", "(", ")", "{", "if", "(", "matchPos", "+", "matchLength", ">=", "pathLength", ")", "{", "return", "null", ";", "}", "else", "{", "try", "{", "throw", "new", "RepositoryException", "(", "\"Not implemented\"", ")", ";", "//...
Returns the remaining path after the matching part. @return The remaining path after the matching part such that the path constructed from {@link #getMatch()} followed by {@link #getRemainder()} is the original path or <code>null</code> if {@link #isFullMatch()} is <code>true</code>.
[ "Returns", "the", "remaining", "path", "after", "the", "matching", "part", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/misc/MatchResult.java#L54-L72
135,803
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MatchAllScorer.java
MatchAllScorer.calculateDocFilter
private void calculateDocFilter() throws IOException { PerQueryCache cache = PerQueryCache.getInstance(); @SuppressWarnings("unchecked") Map<String, BitSet> readerCache = (Map<String, BitSet>)cache.get(MatchAllScorer.class, reader); if (readerCache == null) { readerCache = new HashMap<String, BitSet>(); cache.put(MatchAllScorer.class, reader, readerCache); } // get BitSet for field docFilter = (BitSet)readerCache.get(field); if (docFilter != null) { // use cached BitSet; return; } // otherwise calculate new docFilter = new BitSet(reader.maxDoc()); // we match all terms String namedValue = FieldNames.createNamedValue(field, ""); TermEnum terms = reader.terms(new Term(FieldNames.PROPERTIES, namedValue)); try { TermDocs docs = reader.termDocs(); try { while (terms.term() != null && terms.term().field() == FieldNames.PROPERTIES && terms.term().text().startsWith(namedValue)) { docs.seek(terms); while (docs.next()) { docFilter.set(docs.doc()); } terms.next(); } } finally { docs.close(); } } finally { terms.close(); } // put BitSet into cache readerCache.put(field, docFilter); }
java
private void calculateDocFilter() throws IOException { PerQueryCache cache = PerQueryCache.getInstance(); @SuppressWarnings("unchecked") Map<String, BitSet> readerCache = (Map<String, BitSet>)cache.get(MatchAllScorer.class, reader); if (readerCache == null) { readerCache = new HashMap<String, BitSet>(); cache.put(MatchAllScorer.class, reader, readerCache); } // get BitSet for field docFilter = (BitSet)readerCache.get(field); if (docFilter != null) { // use cached BitSet; return; } // otherwise calculate new docFilter = new BitSet(reader.maxDoc()); // we match all terms String namedValue = FieldNames.createNamedValue(field, ""); TermEnum terms = reader.terms(new Term(FieldNames.PROPERTIES, namedValue)); try { TermDocs docs = reader.termDocs(); try { while (terms.term() != null && terms.term().field() == FieldNames.PROPERTIES && terms.term().text().startsWith(namedValue)) { docs.seek(terms); while (docs.next()) { docFilter.set(docs.doc()); } terms.next(); } } finally { docs.close(); } } finally { terms.close(); } // put BitSet into cache readerCache.put(field, docFilter); }
[ "private", "void", "calculateDocFilter", "(", ")", "throws", "IOException", "{", "PerQueryCache", "cache", "=", "PerQueryCache", ".", "getInstance", "(", ")", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Map", "<", "String", ",", "BitSet", ">", "r...
Calculates a BitSet filter that includes all the nodes that have content in properties according to the field name passed in the constructor of this MatchAllScorer. @throws IOException if an error occurs while reading from the search index.
[ "Calculates", "a", "BitSet", "filter", "that", "includes", "all", "the", "nodes", "that", "have", "content", "in", "properties", "according", "to", "the", "field", "name", "passed", "in", "the", "constructor", "of", "this", "MatchAllScorer", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MatchAllScorer.java#L148-L201
135,804
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/synonym/SynonymMap.java
SynonymMap.getSynonyms
public String[] getSynonyms(String word) { String[] synonyms = table.get(word); if (synonyms == null) return EMPTY; String[] copy = new String[synonyms.length]; // copy for guaranteed immutability System.arraycopy(synonyms, 0, copy, 0, synonyms.length); return copy; }
java
public String[] getSynonyms(String word) { String[] synonyms = table.get(word); if (synonyms == null) return EMPTY; String[] copy = new String[synonyms.length]; // copy for guaranteed immutability System.arraycopy(synonyms, 0, copy, 0, synonyms.length); return copy; }
[ "public", "String", "[", "]", "getSynonyms", "(", "String", "word", ")", "{", "String", "[", "]", "synonyms", "=", "table", ".", "get", "(", "word", ")", ";", "if", "(", "synonyms", "==", "null", ")", "return", "EMPTY", ";", "String", "[", "]", "co...
Returns the synonym set for the given word, sorted ascending. @param word the word to lookup (must be in lowercase). @return the synonyms; a set of zero or more words, sorted ascending, each word containing lowercase characters that satisfy <code>Character.isLetter()</code>.
[ "Returns", "the", "synonym", "set", "for", "the", "given", "word", "sorted", "ascending", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/synonym/SynonymMap.java#L119-L125
135,805
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java
PropertyWriteUtil.writePropStats
public static void writePropStats(XMLStreamWriter xmlStreamWriter, Map<String, Set<HierarchicalProperty>> propStatuses) throws XMLStreamException { for (Map.Entry<String, Set<HierarchicalProperty>> stat : propStatuses.entrySet()) { xmlStreamWriter.writeStartElement("DAV:", "propstat"); xmlStreamWriter.writeStartElement("DAV:", "prop"); for (HierarchicalProperty prop : propStatuses.get(stat.getKey())) { writeProperty(xmlStreamWriter, prop); } xmlStreamWriter.writeEndElement(); xmlStreamWriter.writeStartElement("DAV:", "status"); xmlStreamWriter.writeCharacters(stat.getKey()); xmlStreamWriter.writeEndElement(); // D:propstat xmlStreamWriter.writeEndElement(); } }
java
public static void writePropStats(XMLStreamWriter xmlStreamWriter, Map<String, Set<HierarchicalProperty>> propStatuses) throws XMLStreamException { for (Map.Entry<String, Set<HierarchicalProperty>> stat : propStatuses.entrySet()) { xmlStreamWriter.writeStartElement("DAV:", "propstat"); xmlStreamWriter.writeStartElement("DAV:", "prop"); for (HierarchicalProperty prop : propStatuses.get(stat.getKey())) { writeProperty(xmlStreamWriter, prop); } xmlStreamWriter.writeEndElement(); xmlStreamWriter.writeStartElement("DAV:", "status"); xmlStreamWriter.writeCharacters(stat.getKey()); xmlStreamWriter.writeEndElement(); // D:propstat xmlStreamWriter.writeEndElement(); } }
[ "public", "static", "void", "writePropStats", "(", "XMLStreamWriter", "xmlStreamWriter", ",", "Map", "<", "String", ",", "Set", "<", "HierarchicalProperty", ">", ">", "propStatuses", ")", "throws", "XMLStreamException", "{", "for", "(", "Map", ".", "Entry", "<",...
Writes the statuses of properties into XML. @param xmlStreamWriter XML writer @param propStatuses properties statuses @throws XMLStreamException {@link XMLStreamException}
[ "Writes", "the", "statuses", "of", "properties", "into", "XML", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java#L49-L70
135,806
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java
PropertyWriteUtil.writeProperty
public static void writeProperty(XMLStreamWriter xmlStreamWriter, HierarchicalProperty prop) throws XMLStreamException { String uri = prop.getName().getNamespaceURI(); String prefix = xmlStreamWriter.getNamespaceContext().getPrefix(uri); if (prefix == null) { prefix = ""; } String local = prop.getName().getLocalPart(); if (prop.getValue() == null) { if (prop.getChildren().size() != 0) { xmlStreamWriter.writeStartElement(prefix, local, uri); if (!uri.equalsIgnoreCase("DAV:")) { xmlStreamWriter.writeNamespace(prefix, uri); } writeAttributes(xmlStreamWriter, prop); for (int i = 0; i < prop.getChildren().size(); i++) { HierarchicalProperty property = prop.getChildren().get(i); writeProperty(xmlStreamWriter, property); } xmlStreamWriter.writeEndElement(); } else { xmlStreamWriter.writeEmptyElement(prefix, local, uri); if (!uri.equalsIgnoreCase("DAV:")) { xmlStreamWriter.writeNamespace(prefix, uri); } writeAttributes(xmlStreamWriter, prop); } } else { xmlStreamWriter.writeStartElement(prefix, local, uri); if (!uri.equalsIgnoreCase("DAV:")) { xmlStreamWriter.writeNamespace(prefix, uri); } writeAttributes(xmlStreamWriter, prop); xmlStreamWriter.writeCharacters(prop.getValue()); xmlStreamWriter.writeEndElement(); } }
java
public static void writeProperty(XMLStreamWriter xmlStreamWriter, HierarchicalProperty prop) throws XMLStreamException { String uri = prop.getName().getNamespaceURI(); String prefix = xmlStreamWriter.getNamespaceContext().getPrefix(uri); if (prefix == null) { prefix = ""; } String local = prop.getName().getLocalPart(); if (prop.getValue() == null) { if (prop.getChildren().size() != 0) { xmlStreamWriter.writeStartElement(prefix, local, uri); if (!uri.equalsIgnoreCase("DAV:")) { xmlStreamWriter.writeNamespace(prefix, uri); } writeAttributes(xmlStreamWriter, prop); for (int i = 0; i < prop.getChildren().size(); i++) { HierarchicalProperty property = prop.getChildren().get(i); writeProperty(xmlStreamWriter, property); } xmlStreamWriter.writeEndElement(); } else { xmlStreamWriter.writeEmptyElement(prefix, local, uri); if (!uri.equalsIgnoreCase("DAV:")) { xmlStreamWriter.writeNamespace(prefix, uri); } writeAttributes(xmlStreamWriter, prop); } } else { xmlStreamWriter.writeStartElement(prefix, local, uri); if (!uri.equalsIgnoreCase("DAV:")) { xmlStreamWriter.writeNamespace(prefix, uri); } writeAttributes(xmlStreamWriter, prop); xmlStreamWriter.writeCharacters(prop.getValue()); xmlStreamWriter.writeEndElement(); } }
[ "public", "static", "void", "writeProperty", "(", "XMLStreamWriter", "xmlStreamWriter", ",", "HierarchicalProperty", "prop", ")", "throws", "XMLStreamException", "{", "String", "uri", "=", "prop", ".", "getName", "(", ")", ".", "getNamespaceURI", "(", ")", ";", ...
Writes the statuses of property into XML. @param xmlStreamWriter XML writer @param prop property @throws XMLStreamException {@link XMLStreamException}
[ "Writes", "the", "statuses", "of", "property", "into", "XML", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java#L79-L139
135,807
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java
PropertyWriteUtil.writeAttributes
public static void writeAttributes(XMLStreamWriter xmlStreamWriter, HierarchicalProperty property) throws XMLStreamException { Map<String, String> attributes = property.getAttributes(); Iterator<String> keyIter = attributes.keySet().iterator(); while (keyIter.hasNext()) { String attrName = keyIter.next(); String attrValue = attributes.get(attrName); xmlStreamWriter.writeAttribute(attrName, attrValue); } }
java
public static void writeAttributes(XMLStreamWriter xmlStreamWriter, HierarchicalProperty property) throws XMLStreamException { Map<String, String> attributes = property.getAttributes(); Iterator<String> keyIter = attributes.keySet().iterator(); while (keyIter.hasNext()) { String attrName = keyIter.next(); String attrValue = attributes.get(attrName); xmlStreamWriter.writeAttribute(attrName, attrValue); } }
[ "public", "static", "void", "writeAttributes", "(", "XMLStreamWriter", "xmlStreamWriter", ",", "HierarchicalProperty", "property", ")", "throws", "XMLStreamException", "{", "Map", "<", "String", ",", "String", ">", "attributes", "=", "property", ".", "getAttributes", ...
Writes property attributes into XML. @param xmlStreamWriter XML writer @param property property @throws XMLStreamException {@link XMLStreamException}
[ "Writes", "property", "attributes", "into", "XML", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java#L148-L159
135,808
exoplatform/jcr
applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/ClientTransportImpl.java
ClientTransportImpl.getRealm
private String getRealm(String sUrl) throws IOException, ModuleException { AuthorizationHandler ah = AuthorizationInfo.getAuthHandler(); try { URL url = new URL(sUrl); HTTPConnection connection = new HTTPConnection(url); connection.removeModule(CookieModule.class); AuthorizationInfo.setAuthHandler(null); HTTPResponse resp = connection.Get(url.getFile()); String authHeader = resp.getHeader("WWW-Authenticate"); if (authHeader == null) { return null; } String realm = authHeader.split("=")[1]; realm = realm.substring(1, realm.length() - 1); return realm; } finally { AuthorizationInfo.setAuthHandler(ah); } }
java
private String getRealm(String sUrl) throws IOException, ModuleException { AuthorizationHandler ah = AuthorizationInfo.getAuthHandler(); try { URL url = new URL(sUrl); HTTPConnection connection = new HTTPConnection(url); connection.removeModule(CookieModule.class); AuthorizationInfo.setAuthHandler(null); HTTPResponse resp = connection.Get(url.getFile()); String authHeader = resp.getHeader("WWW-Authenticate"); if (authHeader == null) { return null; } String realm = authHeader.split("=")[1]; realm = realm.substring(1, realm.length() - 1); return realm; } finally { AuthorizationInfo.setAuthHandler(ah); } }
[ "private", "String", "getRealm", "(", "String", "sUrl", ")", "throws", "IOException", ",", "ModuleException", "{", "AuthorizationHandler", "ah", "=", "AuthorizationInfo", ".", "getAuthHandler", "(", ")", ";", "try", "{", "URL", "url", "=", "new", "URL", "(", ...
Get realm by URL. @param sUrl URL string. @return realm name or null. @throws IOException transport exception. @throws ModuleException ModuleException.
[ "Get", "realm", "by", "URL", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/ClientTransportImpl.java#L109-L139
135,809
exoplatform/jcr
exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/CRCGenerator.java
CRCGenerator.getChecksum
public static String getChecksum(InputStream in, String algo) throws NoSuchAlgorithmException, IOException { MessageDigest md = MessageDigest.getInstance(algo); DigestInputStream digestInputStream = new DigestInputStream(in, md); digestInputStream.on(true); while (digestInputStream.read() > -1) { digestInputStream.read(); } byte[] bytes = digestInputStream.getMessageDigest().digest(); return generateString(bytes); }
java
public static String getChecksum(InputStream in, String algo) throws NoSuchAlgorithmException, IOException { MessageDigest md = MessageDigest.getInstance(algo); DigestInputStream digestInputStream = new DigestInputStream(in, md); digestInputStream.on(true); while (digestInputStream.read() > -1) { digestInputStream.read(); } byte[] bytes = digestInputStream.getMessageDigest().digest(); return generateString(bytes); }
[ "public", "static", "String", "getChecksum", "(", "InputStream", "in", ",", "String", "algo", ")", "throws", "NoSuchAlgorithmException", ",", "IOException", "{", "MessageDigest", "md", "=", "MessageDigest", ".", "getInstance", "(", "algo", ")", ";", "DigestInputSt...
Generates checksum for the InputStream. @param in stream to generate CheckSum @param algo algorithm name according to the {@literal <a href= "http://java.sun.com/j2se/1.4.2/docs/guide/security/CryptoSpec.html#AppA"> Java Cryptography Architecture API Specification & Reference </a> } @return hexadecimal string checksun representation @throws NoSuchAlgorithmException @throws IOException
[ "Generates", "checksum", "for", "the", "InputStream", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/CRCGenerator.java#L52-L66
135,810
exoplatform/jcr
exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/CRCGenerator.java
CRCGenerator.generateString
private static String generateString(byte[] bytes) { StringBuffer sb = new StringBuffer(); for (byte b : bytes) { int v = b & 0xFF; sb.append((char) HEX.charAt(v >> 4)); sb.append((char) HEX.charAt(v & 0x0f)); } return sb.toString(); }
java
private static String generateString(byte[] bytes) { StringBuffer sb = new StringBuffer(); for (byte b : bytes) { int v = b & 0xFF; sb.append((char) HEX.charAt(v >> 4)); sb.append((char) HEX.charAt(v & 0x0f)); } return sb.toString(); }
[ "private", "static", "String", "generateString", "(", "byte", "[", "]", "bytes", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "byte", "b", ":", "bytes", ")", "{", "int", "v", "=", "b", "&", "0xFF", ";", "sb...
Converts the array of bytes into a HEX string. @param bytes byte array @return HEX string
[ "Converts", "the", "array", "of", "bytes", "into", "a", "HEX", "string", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/CRCGenerator.java#L75-L88
135,811
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
DBCleanService.cleanWorkspaceData
public static void cleanWorkspaceData(WorkspaceEntry wsEntry) throws DBCleanException { SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION); Connection jdbcConn = getConnection(wsEntry); String dialect = resolveDialect(jdbcConn, wsEntry); boolean autoCommit = dialect.startsWith(DialectConstants.DB_DIALECT_SYBASE); try { jdbcConn.setAutoCommit(autoCommit); DBCleanerTool dbCleaner = getWorkspaceDBCleaner(jdbcConn, wsEntry); doClean(dbCleaner); } catch (SQLException e) { throw new DBCleanException(e); } finally { try { jdbcConn.close(); } catch (SQLException e) { LOG.error("Can not close connection", e); } } }
java
public static void cleanWorkspaceData(WorkspaceEntry wsEntry) throws DBCleanException { SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION); Connection jdbcConn = getConnection(wsEntry); String dialect = resolveDialect(jdbcConn, wsEntry); boolean autoCommit = dialect.startsWith(DialectConstants.DB_DIALECT_SYBASE); try { jdbcConn.setAutoCommit(autoCommit); DBCleanerTool dbCleaner = getWorkspaceDBCleaner(jdbcConn, wsEntry); doClean(dbCleaner); } catch (SQLException e) { throw new DBCleanException(e); } finally { try { jdbcConn.close(); } catch (SQLException e) { LOG.error("Can not close connection", e); } } }
[ "public", "static", "void", "cleanWorkspaceData", "(", "WorkspaceEntry", "wsEntry", ")", "throws", "DBCleanException", "{", "SecurityHelper", ".", "validateSecurityPermission", "(", "JCRRuntimePermissions", ".", "MANAGE_REPOSITORY_PERMISSION", ")", ";", "Connection", "jdbcC...
Cleans workspace data from database. @param wsEntry workspace configuration @throws DBCleanException
[ "Cleans", "workspace", "data", "from", "database", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java#L64-L94
135,812
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
DBCleanService.cleanRepositoryData
public static void cleanRepositoryData(RepositoryEntry rEntry) throws DBCleanException { SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION); WorkspaceEntry wsEntry = rEntry.getWorkspaceEntries().get(0); boolean multiDB = getMultiDbParameter(wsEntry); if (multiDB) { for (WorkspaceEntry entry : rEntry.getWorkspaceEntries()) { cleanWorkspaceData(entry); } } else { Connection jdbcConn = getConnection(wsEntry); String dialect = resolveDialect(jdbcConn, wsEntry); boolean autoCommit = dialect.startsWith(DialectConstants.DB_DIALECT_SYBASE); try { jdbcConn.setAutoCommit(autoCommit); DBCleanerTool dbCleaner = getRepositoryDBCleaner(jdbcConn, rEntry); doClean(dbCleaner); } catch (SQLException e) { throw new DBCleanException(e); } finally { try { jdbcConn.close(); } catch (SQLException e) { LOG.error("Can not close connection", e); } } } }
java
public static void cleanRepositoryData(RepositoryEntry rEntry) throws DBCleanException { SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION); WorkspaceEntry wsEntry = rEntry.getWorkspaceEntries().get(0); boolean multiDB = getMultiDbParameter(wsEntry); if (multiDB) { for (WorkspaceEntry entry : rEntry.getWorkspaceEntries()) { cleanWorkspaceData(entry); } } else { Connection jdbcConn = getConnection(wsEntry); String dialect = resolveDialect(jdbcConn, wsEntry); boolean autoCommit = dialect.startsWith(DialectConstants.DB_DIALECT_SYBASE); try { jdbcConn.setAutoCommit(autoCommit); DBCleanerTool dbCleaner = getRepositoryDBCleaner(jdbcConn, rEntry); doClean(dbCleaner); } catch (SQLException e) { throw new DBCleanException(e); } finally { try { jdbcConn.close(); } catch (SQLException e) { LOG.error("Can not close connection", e); } } } }
[ "public", "static", "void", "cleanRepositoryData", "(", "RepositoryEntry", "rEntry", ")", "throws", "DBCleanException", "{", "SecurityHelper", ".", "validateSecurityPermission", "(", "JCRRuntimePermissions", ".", "MANAGE_REPOSITORY_PERMISSION", ")", ";", "WorkspaceEntry", "...
Cleans repository data from database. @param rEntry the repository configuration @throws DBCleanException
[ "Cleans", "repository", "data", "from", "database", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java#L103-L146
135,813
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
DBCleanService.getRepositoryDBCleaner
public static DBCleanerTool getRepositoryDBCleaner(Connection jdbcConn, RepositoryEntry rEntry) throws DBCleanException { SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION); WorkspaceEntry wsEntry = rEntry.getWorkspaceEntries().get(0); boolean multiDb = getMultiDbParameter(wsEntry); if (multiDb) { throw new DBCleanException( "It is not possible to create cleaner with common connection for multi database repository configuration"); } String dialect = resolveDialect(jdbcConn, wsEntry); boolean autoCommit = dialect.startsWith(DialectConstants.DB_DIALECT_SYBASE); DBCleaningScripts scripts = DBCleaningScriptsFactory.prepareScripts(dialect, rEntry); return new DBCleanerTool(jdbcConn, autoCommit, scripts.getCleaningScripts(), scripts.getCommittingScripts(), scripts.getRollbackingScripts()); }
java
public static DBCleanerTool getRepositoryDBCleaner(Connection jdbcConn, RepositoryEntry rEntry) throws DBCleanException { SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION); WorkspaceEntry wsEntry = rEntry.getWorkspaceEntries().get(0); boolean multiDb = getMultiDbParameter(wsEntry); if (multiDb) { throw new DBCleanException( "It is not possible to create cleaner with common connection for multi database repository configuration"); } String dialect = resolveDialect(jdbcConn, wsEntry); boolean autoCommit = dialect.startsWith(DialectConstants.DB_DIALECT_SYBASE); DBCleaningScripts scripts = DBCleaningScriptsFactory.prepareScripts(dialect, rEntry); return new DBCleanerTool(jdbcConn, autoCommit, scripts.getCleaningScripts(), scripts.getCommittingScripts(), scripts.getRollbackingScripts()); }
[ "public", "static", "DBCleanerTool", "getRepositoryDBCleaner", "(", "Connection", "jdbcConn", ",", "RepositoryEntry", "rEntry", ")", "throws", "DBCleanException", "{", "SecurityHelper", ".", "validateSecurityPermission", "(", "JCRRuntimePermissions", ".", "MANAGE_REPOSITORY_P...
Returns database cleaner for repository. @param jdbcConn database connection which need to use @param rEntry repository configuration @return DBCleanerTool @throws DBCleanException
[ "Returns", "database", "cleaner", "for", "repository", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java#L158-L179
135,814
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
DBCleanService.getWorkspaceDBCleaner
public static DBCleanerTool getWorkspaceDBCleaner(Connection jdbcConn, WorkspaceEntry wsEntry) throws DBCleanException { SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION); String dialect = resolveDialect(jdbcConn, wsEntry); boolean autoCommit = dialect.startsWith(DialectConstants.DB_DIALECT_SYBASE); DBCleaningScripts scripts = DBCleaningScriptsFactory.prepareScripts(dialect, wsEntry); return new DBCleanerTool(jdbcConn, autoCommit, scripts.getCleaningScripts(), scripts.getCommittingScripts(), scripts.getRollbackingScripts()); }
java
public static DBCleanerTool getWorkspaceDBCleaner(Connection jdbcConn, WorkspaceEntry wsEntry) throws DBCleanException { SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION); String dialect = resolveDialect(jdbcConn, wsEntry); boolean autoCommit = dialect.startsWith(DialectConstants.DB_DIALECT_SYBASE); DBCleaningScripts scripts = DBCleaningScriptsFactory.prepareScripts(dialect, wsEntry); return new DBCleanerTool(jdbcConn, autoCommit, scripts.getCleaningScripts(), scripts.getCommittingScripts(), scripts.getRollbackingScripts()); }
[ "public", "static", "DBCleanerTool", "getWorkspaceDBCleaner", "(", "Connection", "jdbcConn", ",", "WorkspaceEntry", "wsEntry", ")", "throws", "DBCleanException", "{", "SecurityHelper", ".", "validateSecurityPermission", "(", "JCRRuntimePermissions", ".", "MANAGE_REPOSITORY_PE...
Returns database cleaner for workspace. @param jdbcConn database connection which need to use @param wsEntry workspace configuration @return DBCleanerTool @throws DBCleanException
[ "Returns", "database", "cleaner", "for", "workspace", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java#L191-L202
135,815
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
DBCleanService.getConnection
private static Connection getConnection(WorkspaceEntry wsEntry) throws DBCleanException { String dsName = getSourceNameParameter(wsEntry); DataSource ds; try { ds = (DataSource)new InitialContext().lookup(dsName); } catch (NamingException e) { throw new DBCleanException(e); } if (ds == null) { throw new DBCleanException("Data source " + dsName + " not found"); } final DataSource dsF = ds; Connection jdbcConn; try { jdbcConn = SecurityHelper.doPrivilegedSQLExceptionAction(new PrivilegedExceptionAction<Connection>() { public Connection run() throws Exception { return dsF.getConnection(); } }); } catch (SQLException e) { throw new DBCleanException(e); } return jdbcConn; }
java
private static Connection getConnection(WorkspaceEntry wsEntry) throws DBCleanException { String dsName = getSourceNameParameter(wsEntry); DataSource ds; try { ds = (DataSource)new InitialContext().lookup(dsName); } catch (NamingException e) { throw new DBCleanException(e); } if (ds == null) { throw new DBCleanException("Data source " + dsName + " not found"); } final DataSource dsF = ds; Connection jdbcConn; try { jdbcConn = SecurityHelper.doPrivilegedSQLExceptionAction(new PrivilegedExceptionAction<Connection>() { public Connection run() throws Exception { return dsF.getConnection(); } }); } catch (SQLException e) { throw new DBCleanException(e); } return jdbcConn; }
[ "private", "static", "Connection", "getConnection", "(", "WorkspaceEntry", "wsEntry", ")", "throws", "DBCleanException", "{", "String", "dsName", "=", "getSourceNameParameter", "(", "wsEntry", ")", ";", "DataSource", "ds", ";", "try", "{", "ds", "=", "(", "DataS...
Opens connection to database underlying a workspace.
[ "Opens", "connection", "to", "database", "underlying", "a", "workspace", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java#L232-L270
135,816
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/distribution/impl/DataDistributionByHash.java
DataDistributionByHash.hash
private String hash(String dataId) { try { MessageDigest digest = MessageDigest.getInstance(hashAlgorithm); digest.update(dataId.getBytes("UTF-8")); return new BigInteger(1, digest.digest()).toString(32); } catch (NumberFormatException e) { throw new RuntimeException("Could not generate the hash code of '" + dataId + "' with the algorithm '" + hashAlgorithm + "'", e); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Could not generate the hash code of '" + dataId + "' with the algorithm '" + hashAlgorithm + "'", e); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Could not generate the hash code of '" + dataId + "' with the algorithm '" + hashAlgorithm + "'", e); } }
java
private String hash(String dataId) { try { MessageDigest digest = MessageDigest.getInstance(hashAlgorithm); digest.update(dataId.getBytes("UTF-8")); return new BigInteger(1, digest.digest()).toString(32); } catch (NumberFormatException e) { throw new RuntimeException("Could not generate the hash code of '" + dataId + "' with the algorithm '" + hashAlgorithm + "'", e); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Could not generate the hash code of '" + dataId + "' with the algorithm '" + hashAlgorithm + "'", e); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Could not generate the hash code of '" + dataId + "' with the algorithm '" + hashAlgorithm + "'", e); } }
[ "private", "String", "hash", "(", "String", "dataId", ")", "{", "try", "{", "MessageDigest", "digest", "=", "MessageDigest", ".", "getInstance", "(", "hashAlgorithm", ")", ";", "digest", ".", "update", "(", "dataId", ".", "getBytes", "(", "\"UTF-8\"", ")", ...
Gives the hash code of the given data id @param dataId The id of the data to hash @return The hash code of the value of the given data id in base 32
[ "Gives", "the", "hash", "code", "of", "the", "given", "data", "id" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/distribution/impl/DataDistributionByHash.java#L74-L97
135,817
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/itemfilters/AbstractNamePatternFilter.java
AbstractNamePatternFilter.parsePatternQPathEntry
private QPathEntry parsePatternQPathEntry(String namePattern, SessionImpl session) throws RepositoryException { int colonIndex = namePattern.indexOf(':'); int bracketIndex = namePattern.lastIndexOf('['); String namespaceURI; String localName; int index = getDefaultIndex(); if (bracketIndex != -1) { int rbracketIndex = namePattern.lastIndexOf(']'); if (rbracketIndex < bracketIndex) { throw new RepositoryException("Malformed pattern expression " + namePattern); } index = Integer.parseInt(namePattern.substring(bracketIndex + 1, rbracketIndex)); } if (colonIndex == -1) { namespaceURI = ""; localName = (bracketIndex == -1) ? namePattern : namePattern.substring(0, bracketIndex); } else { String prefix = namePattern.substring(0, colonIndex); localName = (bracketIndex == -1) ? namePattern.substring(colonIndex + 1) : namePattern.substring(0, bracketIndex); if (prefix.indexOf("*") != -1) { namespaceURI = "*"; } else { namespaceURI = session.getNamespaceURI(prefix); } } return new PatternQPathEntry(namespaceURI, localName, index); }
java
private QPathEntry parsePatternQPathEntry(String namePattern, SessionImpl session) throws RepositoryException { int colonIndex = namePattern.indexOf(':'); int bracketIndex = namePattern.lastIndexOf('['); String namespaceURI; String localName; int index = getDefaultIndex(); if (bracketIndex != -1) { int rbracketIndex = namePattern.lastIndexOf(']'); if (rbracketIndex < bracketIndex) { throw new RepositoryException("Malformed pattern expression " + namePattern); } index = Integer.parseInt(namePattern.substring(bracketIndex + 1, rbracketIndex)); } if (colonIndex == -1) { namespaceURI = ""; localName = (bracketIndex == -1) ? namePattern : namePattern.substring(0, bracketIndex); } else { String prefix = namePattern.substring(0, colonIndex); localName = (bracketIndex == -1) ? namePattern.substring(colonIndex + 1) : namePattern.substring(0, bracketIndex); if (prefix.indexOf("*") != -1) { namespaceURI = "*"; } else { namespaceURI = session.getNamespaceURI(prefix); } } return new PatternQPathEntry(namespaceURI, localName, index); }
[ "private", "QPathEntry", "parsePatternQPathEntry", "(", "String", "namePattern", ",", "SessionImpl", "session", ")", "throws", "RepositoryException", "{", "int", "colonIndex", "=", "namePattern", ".", "indexOf", "(", "'", "'", ")", ";", "int", "bracketIndex", "=",...
Parse QPathEntry from string namePattern. NamePattern may contain wildcard symbols in namespace and local name. And may not contain index, which means look all samename siblings. So ordinary QPathEntry parser is not acceptable. @param namePattern string pattern @param session session used to fetch namespace URI @return PatternQPathEntry @throws RepositoryException if namePattern is malformed or there is some namespace problem.
[ "Parse", "QPathEntry", "from", "string", "namePattern", ".", "NamePattern", "may", "contain", "wildcard", "symbols", "in", "namespace", "and", "local", "name", ".", "And", "may", "not", "contain", "index", "which", "means", "look", "all", "samename", "siblings",...
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/itemfilters/AbstractNamePatternFilter.java#L293-L333
135,818
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ApplyPersistedChangesTask.java
ApplyPersistedChangesTask.accumulatePersistedNodesChanges
protected void accumulatePersistedNodesChanges(Map<String, Long> calculatedChangedNodesSize) throws QuotaManagerException { for (Entry<String, Long> entry : calculatedChangedNodesSize.entrySet()) { String nodePath = entry.getKey(); long delta = entry.getValue(); try { long dataSize = delta + quotaPersister.getNodeDataSize(rName, wsName, nodePath); quotaPersister.setNodeDataSizeIfQuotaExists(rName, wsName, nodePath, dataSize); } catch (UnknownDataSizeException e) { calculateNodeDataSizeTool.getAndSetNodeDataSize(nodePath); } } }
java
protected void accumulatePersistedNodesChanges(Map<String, Long> calculatedChangedNodesSize) throws QuotaManagerException { for (Entry<String, Long> entry : calculatedChangedNodesSize.entrySet()) { String nodePath = entry.getKey(); long delta = entry.getValue(); try { long dataSize = delta + quotaPersister.getNodeDataSize(rName, wsName, nodePath); quotaPersister.setNodeDataSizeIfQuotaExists(rName, wsName, nodePath, dataSize); } catch (UnknownDataSizeException e) { calculateNodeDataSizeTool.getAndSetNodeDataSize(nodePath); } } }
[ "protected", "void", "accumulatePersistedNodesChanges", "(", "Map", "<", "String", ",", "Long", ">", "calculatedChangedNodesSize", ")", "throws", "QuotaManagerException", "{", "for", "(", "Entry", "<", "String", ",", "Long", ">", "entry", ":", "calculatedChangedNode...
Update nodes data size.
[ "Update", "nodes", "data", "size", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ApplyPersistedChangesTask.java#L133-L151
135,819
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ApplyPersistedChangesTask.java
ApplyPersistedChangesTask.accumulatePersistedWorkspaceChanges
protected void accumulatePersistedWorkspaceChanges(long delta) throws QuotaManagerException { long dataSize = 0; try { dataSize = quotaPersister.getWorkspaceDataSize(rName, wsName); } catch (UnknownDataSizeException e) { if (LOG.isTraceEnabled()) { LOG.trace(e.getMessage(), e); } } long newDataSize = Math.max(dataSize + delta, 0); // avoid possible inconsistency quotaPersister.setWorkspaceDataSize(rName, wsName, newDataSize); }
java
protected void accumulatePersistedWorkspaceChanges(long delta) throws QuotaManagerException { long dataSize = 0; try { dataSize = quotaPersister.getWorkspaceDataSize(rName, wsName); } catch (UnknownDataSizeException e) { if (LOG.isTraceEnabled()) { LOG.trace(e.getMessage(), e); } } long newDataSize = Math.max(dataSize + delta, 0); // avoid possible inconsistency quotaPersister.setWorkspaceDataSize(rName, wsName, newDataSize); }
[ "protected", "void", "accumulatePersistedWorkspaceChanges", "(", "long", "delta", ")", "throws", "QuotaManagerException", "{", "long", "dataSize", "=", "0", ";", "try", "{", "dataSize", "=", "quotaPersister", ".", "getWorkspaceDataSize", "(", "rName", ",", "wsName",...
Update workspace data size.
[ "Update", "workspace", "data", "size", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ApplyPersistedChangesTask.java#L156-L173
135,820
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ApplyPersistedChangesTask.java
ApplyPersistedChangesTask.accumulatePersistedRepositoryChanges
protected void accumulatePersistedRepositoryChanges(long delta) { long dataSize = 0; try { dataSize = quotaPersister.getRepositoryDataSize(rName); } catch (UnknownDataSizeException e) { if (LOG.isTraceEnabled()) { LOG.trace(e.getMessage(), e); } } long newDataSize = Math.max(dataSize + delta, 0); // to avoid possible inconsistency quotaPersister.setRepositoryDataSize(rName, newDataSize); }
java
protected void accumulatePersistedRepositoryChanges(long delta) { long dataSize = 0; try { dataSize = quotaPersister.getRepositoryDataSize(rName); } catch (UnknownDataSizeException e) { if (LOG.isTraceEnabled()) { LOG.trace(e.getMessage(), e); } } long newDataSize = Math.max(dataSize + delta, 0); // to avoid possible inconsistency quotaPersister.setRepositoryDataSize(rName, newDataSize); }
[ "protected", "void", "accumulatePersistedRepositoryChanges", "(", "long", "delta", ")", "{", "long", "dataSize", "=", "0", ";", "try", "{", "dataSize", "=", "quotaPersister", ".", "getRepositoryDataSize", "(", "rName", ")", ";", "}", "catch", "(", "UnknownDataSi...
Update repository data size.
[ "Update", "repository", "data", "size", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ApplyPersistedChangesTask.java#L178-L195
135,821
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ApplyPersistedChangesTask.java
ApplyPersistedChangesTask.accumulatePersistedGlobalChanges
private void accumulatePersistedGlobalChanges(long delta) { long dataSize = 0; try { dataSize = quotaPersister.getGlobalDataSize(); } catch (UnknownDataSizeException e) { if (LOG.isTraceEnabled()) { LOG.trace(e.getMessage(), e); } } long newDataSize = Math.max(dataSize + delta, 0); // to avoid possible inconsistency quotaPersister.setGlobalDataSize(newDataSize); }
java
private void accumulatePersistedGlobalChanges(long delta) { long dataSize = 0; try { dataSize = quotaPersister.getGlobalDataSize(); } catch (UnknownDataSizeException e) { if (LOG.isTraceEnabled()) { LOG.trace(e.getMessage(), e); } } long newDataSize = Math.max(dataSize + delta, 0); // to avoid possible inconsistency quotaPersister.setGlobalDataSize(newDataSize); }
[ "private", "void", "accumulatePersistedGlobalChanges", "(", "long", "delta", ")", "{", "long", "dataSize", "=", "0", ";", "try", "{", "dataSize", "=", "quotaPersister", ".", "getGlobalDataSize", "(", ")", ";", "}", "catch", "(", "UnknownDataSizeException", "e", ...
Update global data size.
[ "Update", "global", "data", "size", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ApplyPersistedChangesTask.java#L200-L217
135,822
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
ItemImpl.parent
protected NodeImpl parent(final boolean pool) throws RepositoryException { NodeImpl parent = (NodeImpl)dataManager.getItemByIdentifier(getParentIdentifier(), pool); if (parent == null) { throw new ItemNotFoundException("FATAL: Parent is null for " + getPath() + " parent UUID: " + getParentIdentifier()); } return parent; }
java
protected NodeImpl parent(final boolean pool) throws RepositoryException { NodeImpl parent = (NodeImpl)dataManager.getItemByIdentifier(getParentIdentifier(), pool); if (parent == null) { throw new ItemNotFoundException("FATAL: Parent is null for " + getPath() + " parent UUID: " + getParentIdentifier()); } return parent; }
[ "protected", "NodeImpl", "parent", "(", "final", "boolean", "pool", ")", "throws", "RepositoryException", "{", "NodeImpl", "parent", "=", "(", "NodeImpl", ")", "dataManager", ".", "getItemByIdentifier", "(", "getParentIdentifier", "(", ")", ",", "pool", ")", ";"...
Get parent node item. @param pool - take a parent from session pool @return parent item @throws RepositoryException if parent item is null
[ "Get", "parent", "node", "item", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java#L772-L781
135,823
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
ItemImpl.parentData
public NodeData parentData() throws RepositoryException { checkValid(); NodeData parent = (NodeData)dataManager.getItemData(getData().getParentIdentifier()); if (parent == null) { throw new ItemNotFoundException("FATAL: Parent is null for " + getPath() + " parent UUID: " + getData().getParentIdentifier()); } return parent; }
java
public NodeData parentData() throws RepositoryException { checkValid(); NodeData parent = (NodeData)dataManager.getItemData(getData().getParentIdentifier()); if (parent == null) { throw new ItemNotFoundException("FATAL: Parent is null for " + getPath() + " parent UUID: " + getData().getParentIdentifier()); } return parent; }
[ "public", "NodeData", "parentData", "(", ")", "throws", "RepositoryException", "{", "checkValid", "(", ")", ";", "NodeData", "parent", "=", "(", "NodeData", ")", "dataManager", ".", "getItemData", "(", "getData", "(", ")", ".", "getParentIdentifier", "(", ")",...
Get and return parent node data. @return parent node data @throws RepositoryException if parent item is null
[ "Get", "and", "return", "parent", "node", "data", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java#L789-L800
135,824
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
ItemImpl.getLocation
public JCRPath getLocation() throws RepositoryException { if (this.location == null) { this.location = session.getLocationFactory().createJCRPath(qpath); } return this.location; }
java
public JCRPath getLocation() throws RepositoryException { if (this.location == null) { this.location = session.getLocationFactory().createJCRPath(qpath); } return this.location; }
[ "public", "JCRPath", "getLocation", "(", ")", "throws", "RepositoryException", "{", "if", "(", "this", ".", "location", "==", "null", ")", "{", "this", ".", "location", "=", "session", ".", "getLocationFactory", "(", ")", ".", "createJCRPath", "(", "qpath", ...
Get item JCRPath location. @return item JCRPath
[ "Get", "item", "JCRPath", "location", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java#L829-L837
135,825
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindRequestEntity.java
PropFindRequestEntity.getType
public String getType() { if (input == null) { return "allprop"; } if (input.getChild(PropertyConstants.DAV_ALLPROP_INCLUDE) != null) { return "include"; } QName name = input.getChild(0).getName(); if (name.getNamespaceURI().equals("DAV:")) return name.getLocalPart(); else return null; }
java
public String getType() { if (input == null) { return "allprop"; } if (input.getChild(PropertyConstants.DAV_ALLPROP_INCLUDE) != null) { return "include"; } QName name = input.getChild(0).getName(); if (name.getNamespaceURI().equals("DAV:")) return name.getLocalPart(); else return null; }
[ "public", "String", "getType", "(", ")", "{", "if", "(", "input", "==", "null", ")", "{", "return", "\"allprop\"", ";", "}", "if", "(", "input", ".", "getChild", "(", "PropertyConstants", ".", "DAV_ALLPROP_INCLUDE", ")", "!=", "null", ")", "{", "return",...
Returns the type of request. @return request type
[ "Returns", "the", "type", "of", "request", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindRequestEntity.java#L56-L74
135,826
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/transaction/ActionNonTxAware.java
ActionNonTxAware.run
public R run(A... arg) throws E { final TransactionManager tm = getTransactionManager(); Transaction tx = null; try { if (tm != null) { try { tx = tm.suspend(); } catch (SystemException e) { LOG.warn("Cannot suspend the current transaction", e); } } return execute(arg); } finally { if (tx != null) { try { tm.resume(tx); } catch (Exception e) { LOG.warn("Cannot resume the current transaction", e); } } } }
java
public R run(A... arg) throws E { final TransactionManager tm = getTransactionManager(); Transaction tx = null; try { if (tm != null) { try { tx = tm.suspend(); } catch (SystemException e) { LOG.warn("Cannot suspend the current transaction", e); } } return execute(arg); } finally { if (tx != null) { try { tm.resume(tx); } catch (Exception e) { LOG.warn("Cannot resume the current transaction", e); } } } }
[ "public", "R", "run", "(", "A", "...", "arg", ")", "throws", "E", "{", "final", "TransactionManager", "tm", "=", "getTransactionManager", "(", ")", ";", "Transaction", "tx", "=", "null", ";", "try", "{", "if", "(", "tm", "!=", "null", ")", "{", "try"...
Executes the action outside the context of the current tx @param arg the argument to use to execute the action @return the result of the action @throws E if an error occurs while executing the action
[ "Executes", "the", "action", "outside", "the", "context", "of", "the", "current", "tx" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/transaction/ActionNonTxAware.java#L49-L82
135,827
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/transaction/ActionNonTxAware.java
ActionNonTxAware.execute
protected R execute(A... arg) throws E { if (arg == null || arg.length == 0) { return execute((A)null); } return execute(arg[0]); }
java
protected R execute(A... arg) throws E { if (arg == null || arg.length == 0) { return execute((A)null); } return execute(arg[0]); }
[ "protected", "R", "execute", "(", "A", "...", "arg", ")", "throws", "E", "{", "if", "(", "arg", "==", "null", "||", "arg", ".", "length", "==", "0", ")", "{", "return", "execute", "(", "(", "A", ")", "null", ")", ";", "}", "return", "execute", ...
Executes the action @param arg the argument to use to execute the action @return the result of the action @throws E if an error occurs while executing the action
[ "Executes", "the", "action" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/transaction/ActionNonTxAware.java#L102-L109
135,828
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/resource/NodeRepresentationService.java
NodeRepresentationService.getNodeRepresentation
public NodeRepresentation getNodeRepresentation(Node node, String mediaTypeHint) throws RepositoryException { NodeRepresentationFactory factory = factory(node); if (factory != null) return factory.createNodeRepresentation(node, mediaTypeHint); else return new DocumentViewNodeRepresentation(node); }
java
public NodeRepresentation getNodeRepresentation(Node node, String mediaTypeHint) throws RepositoryException { NodeRepresentationFactory factory = factory(node); if (factory != null) return factory.createNodeRepresentation(node, mediaTypeHint); else return new DocumentViewNodeRepresentation(node); }
[ "public", "NodeRepresentation", "getNodeRepresentation", "(", "Node", "node", ",", "String", "mediaTypeHint", ")", "throws", "RepositoryException", "{", "NodeRepresentationFactory", "factory", "=", "factory", "(", "node", ")", ";", "if", "(", "factory", "!=", "null"...
Get NodeRepresentation for given node. String mediaTypeHint can be used as external information for representation. By default node will be represented as doc-view. @param node the jcr node. @param mediaTypeHint the mimetype hint or null if not known. @return the NodeRepresentation. @throws RepositoryException
[ "Get", "NodeRepresentation", "for", "given", "node", ".", "String", "mediaTypeHint", "can", "be", "used", "as", "external", "information", "for", "representation", ".", "By", "default", "node", "will", "be", "represented", "as", "doc", "-", "view", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/resource/NodeRepresentationService.java#L87-L95
135,829
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/SwapFile.java
SwapFile.spoolDone
public void spoolDone() { final CountDownLatch sl = this.spoolLatch.get(); this.spoolLatch.set(null); sl.countDown(); }
java
public void spoolDone() { final CountDownLatch sl = this.spoolLatch.get(); this.spoolLatch.set(null); sl.countDown(); }
[ "public", "void", "spoolDone", "(", ")", "{", "final", "CountDownLatch", "sl", "=", "this", ".", "spoolLatch", ".", "get", "(", ")", ";", "this", ".", "spoolLatch", ".", "set", "(", "null", ")", ";", "sl", ".", "countDown", "(", ")", ";", "}" ]
Mark the file ready for read.
[ "Mark", "the", "file", "ready", "for", "read", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/SwapFile.java#L201-L206
135,830
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.getItemData
public ItemData getItemData(NodeData parent, QPathEntry[] relPathEntries, ItemType itemType) throws RepositoryException { ItemData item = parent; for (int i = 0; i < relPathEntries.length; i++) { if (i == relPathEntries.length - 1) { item = getItemData(parent, relPathEntries[i], itemType); } else { item = getItemData(parent, relPathEntries[i], ItemType.UNKNOWN); } if (item == null) { break; } if (item.isNode()) { parent = (NodeData)item; } else if (i < relPathEntries.length - 1) { throw new IllegalPathException("Path can not contains a property as the intermediate element"); } } return item; }
java
public ItemData getItemData(NodeData parent, QPathEntry[] relPathEntries, ItemType itemType) throws RepositoryException { ItemData item = parent; for (int i = 0; i < relPathEntries.length; i++) { if (i == relPathEntries.length - 1) { item = getItemData(parent, relPathEntries[i], itemType); } else { item = getItemData(parent, relPathEntries[i], ItemType.UNKNOWN); } if (item == null) { break; } if (item.isNode()) { parent = (NodeData)item; } else if (i < relPathEntries.length - 1) { throw new IllegalPathException("Path can not contains a property as the intermediate element"); } } return item; }
[ "public", "ItemData", "getItemData", "(", "NodeData", "parent", ",", "QPathEntry", "[", "]", "relPathEntries", ",", "ItemType", "itemType", ")", "throws", "RepositoryException", "{", "ItemData", "item", "=", "parent", ";", "for", "(", "int", "i", "=", "0", "...
Return item data by parent NodeDada and relPathEntries If relpath is JCRPath.THIS_RELPATH = '.' it return itself @param parent @param relPathEntries - array of QPathEntry which represents the relation path to the searched item @param itemType - item type @return existed item data or null if not found @throws RepositoryException
[ "Return", "item", "data", "by", "parent", "NodeDada", "and", "relPathEntries", "If", "relpath", "is", "JCRPath", ".", "THIS_RELPATH", "=", ".", "it", "return", "itself" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L179-L209
135,831
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.getItemData
public ItemData getItemData(String identifier,boolean checkChangesLogOnly) throws RepositoryException { ItemData data = null; // 1. Try in transient changes ItemState state = changesLog.getItemState(identifier); if (state == null) { // 2. Try from txdatamanager data = transactionableManager.getItemData(identifier,checkChangesLogOnly); data = updatePathIfNeeded(data); } else if (!state.isDeleted()) { data = state.getData(); } return data; }
java
public ItemData getItemData(String identifier,boolean checkChangesLogOnly) throws RepositoryException { ItemData data = null; // 1. Try in transient changes ItemState state = changesLog.getItemState(identifier); if (state == null) { // 2. Try from txdatamanager data = transactionableManager.getItemData(identifier,checkChangesLogOnly); data = updatePathIfNeeded(data); } else if (!state.isDeleted()) { data = state.getData(); } return data; }
[ "public", "ItemData", "getItemData", "(", "String", "identifier", ",", "boolean", "checkChangesLogOnly", ")", "throws", "RepositoryException", "{", "ItemData", "data", "=", "null", ";", "// 1. Try in transient changes", "ItemState", "state", "=", "changesLog", ".", "g...
Return item data by identifier in this transient storage then in workspace container. @param identifier @param checkChangesLogOnly @return existed item data or null if not found @throws RepositoryException @see org.exoplatform.services.jcr.dataflow.ItemDataConsumer#getItemData(java.lang.String)
[ "Return", "item", "data", "by", "identifier", "in", "this", "transient", "storage", "then", "in", "workspace", "container", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L316-L332
135,832
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.getItem
public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool, ItemType itemType) throws RepositoryException { return getItem(parent, name, pool, itemType, true); }
java
public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool, ItemType itemType) throws RepositoryException { return getItem(parent, name, pool, itemType, true); }
[ "public", "ItemImpl", "getItem", "(", "NodeData", "parent", ",", "QPathEntry", "name", ",", "boolean", "pool", ",", "ItemType", "itemType", ")", "throws", "RepositoryException", "{", "return", "getItem", "(", "parent", ",", "name", ",", "pool", ",", "itemType"...
Return Item by parent NodeDada and the name of searched item. @param parent - parent of the searched item @param name - item name @param itemType - item type @param pool - indicates does the item fall in pool @return existed item or null if not found @throws RepositoryException
[ "Return", "Item", "by", "parent", "NodeDada", "and", "the", "name", "of", "searched", "item", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L361-L365
135,833
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.getItem
public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool, ItemType itemType, boolean apiRead, boolean createNullItemData) throws RepositoryException { long start = 0; if (LOG.isDebugEnabled()) { start = System.currentTimeMillis(); LOG.debug("getItem(" + parent.getQPath().getAsString() + " + " + name.getAsString() + " ) >>>>>"); } ItemImpl item = null; try { return item = readItem(getItemData(parent, name, itemType, createNullItemData), parent, pool, apiRead); } finally { if (LOG.isDebugEnabled()) { LOG.debug("getItem(" + parent.getQPath().getAsString() + " + " + name.getAsString() + ") --> " + (item != null ? item.getPath() : "null") + " <<<<< " + ((System.currentTimeMillis() - start) / 1000d) + "sec"); } } }
java
public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool, ItemType itemType, boolean apiRead, boolean createNullItemData) throws RepositoryException { long start = 0; if (LOG.isDebugEnabled()) { start = System.currentTimeMillis(); LOG.debug("getItem(" + parent.getQPath().getAsString() + " + " + name.getAsString() + " ) >>>>>"); } ItemImpl item = null; try { return item = readItem(getItemData(parent, name, itemType, createNullItemData), parent, pool, apiRead); } finally { if (LOG.isDebugEnabled()) { LOG.debug("getItem(" + parent.getQPath().getAsString() + " + " + name.getAsString() + ") --> " + (item != null ? item.getPath() : "null") + " <<<<< " + ((System.currentTimeMillis() - start) / 1000d) + "sec"); } } }
[ "public", "ItemImpl", "getItem", "(", "NodeData", "parent", ",", "QPathEntry", "name", ",", "boolean", "pool", ",", "ItemType", "itemType", ",", "boolean", "apiRead", ",", "boolean", "createNullItemData", ")", "throws", "RepositoryException", "{", "long", "start",...
For internal use. Return Item by parent NodeDada and the name of searched item. @param parent - parent of the searched item @param name - item name @param itemType - item type @param pool - indicates does the item fall in pool @param apiRead - if true will call postRead Action and check permissions @param createNullItemData - defines if there is a need to create NullItemData @return existed item or null if not found @throws RepositoryException
[ "For", "internal", "use", ".", "Return", "Item", "by", "parent", "NodeDada", "and", "the", "name", "of", "searched", "item", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L408-L433
135,834
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.getItem
public ItemImpl getItem(NodeData parent, QPathEntry[] relPath, boolean pool, ItemType itemType) throws RepositoryException { long start = 0; if (LOG.isDebugEnabled()) { start = System.currentTimeMillis(); StringBuilder debugPath = new StringBuilder(); for (QPathEntry rp : relPath) { debugPath.append(rp.getAsString()); } LOG.debug("getItem(" + parent.getQPath().getAsString() + " + " + debugPath + " ) >>>>>"); } ItemImpl item = null; try { return item = readItem(getItemData(parent, relPath, itemType), pool); } finally { if (LOG.isDebugEnabled()) { StringBuilder debugPath = new StringBuilder(); for (QPathEntry rp : relPath) { debugPath.append(rp.getAsString()); } LOG.debug("getItem(" + parent.getQPath().getAsString() + " + " + debugPath + ") --> " + (item != null ? item.getPath() : "null") + " <<<<< " + ((System.currentTimeMillis() - start) / 1000d) + "sec"); } } }
java
public ItemImpl getItem(NodeData parent, QPathEntry[] relPath, boolean pool, ItemType itemType) throws RepositoryException { long start = 0; if (LOG.isDebugEnabled()) { start = System.currentTimeMillis(); StringBuilder debugPath = new StringBuilder(); for (QPathEntry rp : relPath) { debugPath.append(rp.getAsString()); } LOG.debug("getItem(" + parent.getQPath().getAsString() + " + " + debugPath + " ) >>>>>"); } ItemImpl item = null; try { return item = readItem(getItemData(parent, relPath, itemType), pool); } finally { if (LOG.isDebugEnabled()) { StringBuilder debugPath = new StringBuilder(); for (QPathEntry rp : relPath) { debugPath.append(rp.getAsString()); } LOG.debug("getItem(" + parent.getQPath().getAsString() + " + " + debugPath + ") --> " + (item != null ? item.getPath() : "null") + " <<<<< " + ((System.currentTimeMillis() - start) / 1000d) + "sec"); } } }
[ "public", "ItemImpl", "getItem", "(", "NodeData", "parent", ",", "QPathEntry", "[", "]", "relPath", ",", "boolean", "pool", ",", "ItemType", "itemType", ")", "throws", "RepositoryException", "{", "long", "start", "=", "0", ";", "if", "(", "LOG", ".", "isDe...
Return Item by parent NodeDada and array of QPathEntry which represent a relative path to the searched item @param parent - parent of the searched item @param relPath - array of QPathEntry which represents the relation path to the searched item @param pool - indicates does the item fall in pool @param itemType - item type @return existed item or null if not found @throws RepositoryException
[ "Return", "Item", "by", "parent", "NodeDada", "and", "array", "of", "QPathEntry", "which", "represent", "a", "relative", "path", "to", "the", "searched", "item" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L500-L534
135,835
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.getItem
public ItemImpl getItem(QPath path, boolean pool) throws RepositoryException { long start = 0; if (LOG.isDebugEnabled()) { start = System.currentTimeMillis(); LOG.debug("getItem(" + path.getAsString() + " ) >>>>>"); } ItemImpl item = null; try { return item = readItem(getItemData(path), pool); } finally { if (LOG.isDebugEnabled()) { LOG.debug("getItem(" + path.getAsString() + ") --> " + (item != null ? item.getPath() : "null") + " <<<<< " + ((System.currentTimeMillis() - start) / 1000d) + "sec"); } } }
java
public ItemImpl getItem(QPath path, boolean pool) throws RepositoryException { long start = 0; if (LOG.isDebugEnabled()) { start = System.currentTimeMillis(); LOG.debug("getItem(" + path.getAsString() + " ) >>>>>"); } ItemImpl item = null; try { return item = readItem(getItemData(path), pool); } finally { if (LOG.isDebugEnabled()) { LOG.debug("getItem(" + path.getAsString() + ") --> " + (item != null ? item.getPath() : "null") + " <<<<< " + ((System.currentTimeMillis() - start) / 1000d) + "sec"); } } }
[ "public", "ItemImpl", "getItem", "(", "QPath", "path", ",", "boolean", "pool", ")", "throws", "RepositoryException", "{", "long", "start", "=", "0", ";", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "start", "=", "System", ".", "currentTi...
Return item by absolute path in this transient storage then in workspace container. @param path - absolute path to the searched item @param pool - indicates does the item fall in pool @return existed item or null if not found @throws RepositoryException
[ "Return", "item", "by", "absolute", "path", "in", "this", "transient", "storage", "then", "in", "workspace", "container", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L546-L568
135,836
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.readItem
protected ItemImpl readItem(ItemData itemData, boolean pool) throws RepositoryException { return readItem(itemData, null, pool, true); }
java
protected ItemImpl readItem(ItemData itemData, boolean pool) throws RepositoryException { return readItem(itemData, null, pool, true); }
[ "protected", "ItemImpl", "readItem", "(", "ItemData", "itemData", ",", "boolean", "pool", ")", "throws", "RepositoryException", "{", "return", "readItem", "(", "itemData", ",", "null", ",", "pool", ",", "true", ")", ";", "}" ]
Read ItemImpl of given ItemData. Will call postRead Action and check permissions. @param itemData ItemData @param pool boolean, if true will reload pooled ItemImpl @return ItemImpl @throws RepositoryException if errro occurs
[ "Read", "ItemImpl", "of", "given", "ItemData", ".", "Will", "call", "postRead", "Action", "and", "check", "permissions", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L579-L582
135,837
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.readItem
protected ItemImpl readItem(ItemData itemData, NodeData parent, boolean pool, boolean apiRead) throws RepositoryException { if (!apiRead) { // Need privileges SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(JCRRuntimePermissions.INVOKE_INTERNAL_API_PERMISSION); } } if (itemData != null) { ItemImpl item; ItemImpl pooledItem; if (pool && (pooledItem = itemsPool.get(itemData, parent)) != null) { // use pooled & reloaded item = pooledItem; } else { // create new item = itemFactory.createItem(itemData, parent); } if (apiRead) { if (!item.hasPermission(PermissionType.READ)) { throw new AccessDeniedException("Access denied " + itemData.getQPath().getAsString() + " for " + session.getUserID()); } session.getActionHandler().postRead(item); } return item; } else { return null; } }
java
protected ItemImpl readItem(ItemData itemData, NodeData parent, boolean pool, boolean apiRead) throws RepositoryException { if (!apiRead) { // Need privileges SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(JCRRuntimePermissions.INVOKE_INTERNAL_API_PERMISSION); } } if (itemData != null) { ItemImpl item; ItemImpl pooledItem; if (pool && (pooledItem = itemsPool.get(itemData, parent)) != null) { // use pooled & reloaded item = pooledItem; } else { // create new item = itemFactory.createItem(itemData, parent); } if (apiRead) { if (!item.hasPermission(PermissionType.READ)) { throw new AccessDeniedException("Access denied " + itemData.getQPath().getAsString() + " for " + session.getUserID()); } session.getActionHandler().postRead(item); } return item; } else { return null; } }
[ "protected", "ItemImpl", "readItem", "(", "ItemData", "itemData", ",", "NodeData", "parent", ",", "boolean", "pool", ",", "boolean", "apiRead", ")", "throws", "RepositoryException", "{", "if", "(", "!", "apiRead", ")", "{", "// Need privileges", "SecurityManager",...
Create or reload pooled ItemImpl with the given ItemData. @param itemData ItemData, data to create ItemImpl @param parent NodeData, this item parent data, can be null. Not null used for getChildXXX() @param pool boolean, if true will reload pooled ItemImpl @param apiRead boolean, if true will call postRead Action and check permissions @return ItemImpl @throws RepositoryException if error occurs
[ "Create", "or", "reload", "pooled", "ItemImpl", "with", "the", "given", "ItemData", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L594-L638
135,838
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.getItemByIdentifier
public ItemImpl getItemByIdentifier(String identifier, boolean pool) throws RepositoryException { return getItemByIdentifier(identifier, pool, true); }
java
public ItemImpl getItemByIdentifier(String identifier, boolean pool) throws RepositoryException { return getItemByIdentifier(identifier, pool, true); }
[ "public", "ItemImpl", "getItemByIdentifier", "(", "String", "identifier", ",", "boolean", "pool", ")", "throws", "RepositoryException", "{", "return", "getItemByIdentifier", "(", "identifier", ",", "pool", ",", "true", ")", ";", "}" ]
Return item by identifier in this transient storage then in workspace container. @param identifier - identifier of searched item @param pool - indicates does the item fall in pool @return existed item data or null if not found @throws RepositoryException
[ "Return", "item", "by", "identifier", "in", "this", "transient", "storage", "then", "in", "workspace", "container", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L650-L653
135,839
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.getItemByIdentifier
public ItemImpl getItemByIdentifier(String identifier, boolean pool, boolean apiRead) throws RepositoryException { long start = 0; if (LOG.isDebugEnabled()) { start = System.currentTimeMillis(); LOG.debug("getItemByIdentifier(" + identifier + " ) >>>>>"); } ItemImpl item = null; try { return item = readItem(getItemData(identifier), null, pool, apiRead); } finally { if (LOG.isDebugEnabled()) { LOG.debug("getItemByIdentifier(" + identifier + ") --> " + (item != null ? item.getPath() : "null") + " <<<<< " + ((System.currentTimeMillis() - start) / 1000d) + "sec"); } } }
java
public ItemImpl getItemByIdentifier(String identifier, boolean pool, boolean apiRead) throws RepositoryException { long start = 0; if (LOG.isDebugEnabled()) { start = System.currentTimeMillis(); LOG.debug("getItemByIdentifier(" + identifier + " ) >>>>>"); } ItemImpl item = null; try { return item = readItem(getItemData(identifier), null, pool, apiRead); } finally { if (LOG.isDebugEnabled()) { LOG.debug("getItemByIdentifier(" + identifier + ") --> " + (item != null ? item.getPath() : "null") + " <<<<< " + ((System.currentTimeMillis() - start) / 1000d) + "sec"); } } }
[ "public", "ItemImpl", "getItemByIdentifier", "(", "String", "identifier", ",", "boolean", "pool", ",", "boolean", "apiRead", ")", "throws", "RepositoryException", "{", "long", "start", "=", "0", ";", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{...
For internal use, required privileges. Return item by identifier in this transient storage then in workspace container. @param identifier - identifier of searched item @param pool - indicates does the item fall in pool @param apiRead - if true will call postRead Action and check permissions @return existed item data or null if not found @throws RepositoryException
[ "For", "internal", "use", "required", "privileges", ".", "Return", "item", "by", "identifier", "in", "this", "transient", "storage", "then", "in", "workspace", "container", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L667-L689
135,840
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.getACL
public AccessControlList getACL(QPath path) throws RepositoryException { long start = 0; if (LOG.isDebugEnabled()) { start = System.currentTimeMillis(); LOG.debug("getACL(" + path.getAsString() + " ) >>>>>"); } try { NodeData parent = (NodeData)getItemData(Constants.ROOT_UUID); if (path.equals(Constants.ROOT_PATH)) { return parent.getACL(); } ItemData item = null; QPathEntry[] relPathEntries = path.getRelPath(path.getDepth()); for (int i = 0; i < relPathEntries.length; i++) { if (i == relPathEntries.length - 1) { item = getItemData(parent, relPathEntries[i], ItemType.NODE); } else { item = getItemData(parent, relPathEntries[i], ItemType.UNKNOWN); } if (item == null) { break; } if (item.isNode()) { parent = (NodeData)item; } else if (i < relPathEntries.length - 1) { throw new IllegalPathException("Get ACL. Path can not contains a property as the intermediate element"); } } if (item != null && item.isNode()) { // node ACL return ((NodeData)item).getACL(); } else { // item not found or it's a property - return parent ACL return parent.getACL(); } } finally { if (LOG.isDebugEnabled()) { LOG.debug("getACL(" + path.getAsString() + ") <<<<< " + ((System.currentTimeMillis() - start) / 1000d) + "sec"); } } }
java
public AccessControlList getACL(QPath path) throws RepositoryException { long start = 0; if (LOG.isDebugEnabled()) { start = System.currentTimeMillis(); LOG.debug("getACL(" + path.getAsString() + " ) >>>>>"); } try { NodeData parent = (NodeData)getItemData(Constants.ROOT_UUID); if (path.equals(Constants.ROOT_PATH)) { return parent.getACL(); } ItemData item = null; QPathEntry[] relPathEntries = path.getRelPath(path.getDepth()); for (int i = 0; i < relPathEntries.length; i++) { if (i == relPathEntries.length - 1) { item = getItemData(parent, relPathEntries[i], ItemType.NODE); } else { item = getItemData(parent, relPathEntries[i], ItemType.UNKNOWN); } if (item == null) { break; } if (item.isNode()) { parent = (NodeData)item; } else if (i < relPathEntries.length - 1) { throw new IllegalPathException("Get ACL. Path can not contains a property as the intermediate element"); } } if (item != null && item.isNode()) { // node ACL return ((NodeData)item).getACL(); } else { // item not found or it's a property - return parent ACL return parent.getACL(); } } finally { if (LOG.isDebugEnabled()) { LOG.debug("getACL(" + path.getAsString() + ") <<<<< " + ((System.currentTimeMillis() - start) / 1000d) + "sec"); } } }
[ "public", "AccessControlList", "getACL", "(", "QPath", "path", ")", "throws", "RepositoryException", "{", "long", "start", "=", "0", ";", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "start", "=", "System", ".", "currentTimeMillis", "(", ")...
Return the ACL of the location. A session pending changes will be searched too. Item path will be traversed from the root node to a last existing item. @param path - path of an ACL @return - an item or its parent ancestor ACL @throws RepositoryException
[ "Return", "the", "ACL", "of", "the", "location", ".", "A", "session", "pending", "changes", "will", "be", "searched", "too", ".", "Item", "path", "will", "be", "traversed", "from", "the", "root", "node", "to", "a", "last", "existing", "item", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L1107-L1171
135,841
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.reindexSameNameSiblings
protected List<ItemState> reindexSameNameSiblings(NodeData cause, ItemDataConsumer dataManager) throws RepositoryException { List<ItemState> changes = new ArrayList<ItemState>(); NodeData parentNodeData = (NodeData)dataManager.getItemData(cause.getParentIdentifier()); NodeData nextSibling = (NodeData)dataManager.getItemData(parentNodeData, new QPathEntry(cause.getQPath().getName(), cause.getQPath() .getIndex() + 1), ItemType.NODE); String reindexedId = null; // repeat till next sibling exists and it's not a caused Node (deleted or moved to) or just // reindexed while (nextSibling != null && !nextSibling.getIdentifier().equals(cause.getIdentifier()) && !nextSibling.getIdentifier().equals(reindexedId)) { QPath siblingOldPath = QPath.makeChildPath(nextSibling.getQPath().makeParentPath(), nextSibling.getQPath().getName(), nextSibling .getQPath().getIndex()); // update with new index QPath siblingPath = QPath.makeChildPath(nextSibling.getQPath().makeParentPath(), nextSibling.getQPath().getName(), nextSibling .getQPath().getIndex() - 1); NodeData reindexed = new TransientNodeData(siblingPath, nextSibling.getIdentifier(), nextSibling.getPersistedVersion(), nextSibling.getPrimaryTypeName(), nextSibling.getMixinTypeNames(), nextSibling.getOrderNumber(), nextSibling.getParentIdentifier(), nextSibling.getACL()); reindexedId = reindexed.getIdentifier(); ItemState reindexedState = ItemState.createUpdatedState(reindexed); changes.add(reindexedState); itemsPool.reload(reindexed); reloadDescendants(siblingOldPath, siblingPath); // next... nextSibling = (NodeData)dataManager.getItemData(parentNodeData, new QPathEntry(nextSibling.getQPath().getName(), nextSibling.getQPath().getIndex() + 1), ItemType.NODE); } return changes; }
java
protected List<ItemState> reindexSameNameSiblings(NodeData cause, ItemDataConsumer dataManager) throws RepositoryException { List<ItemState> changes = new ArrayList<ItemState>(); NodeData parentNodeData = (NodeData)dataManager.getItemData(cause.getParentIdentifier()); NodeData nextSibling = (NodeData)dataManager.getItemData(parentNodeData, new QPathEntry(cause.getQPath().getName(), cause.getQPath() .getIndex() + 1), ItemType.NODE); String reindexedId = null; // repeat till next sibling exists and it's not a caused Node (deleted or moved to) or just // reindexed while (nextSibling != null && !nextSibling.getIdentifier().equals(cause.getIdentifier()) && !nextSibling.getIdentifier().equals(reindexedId)) { QPath siblingOldPath = QPath.makeChildPath(nextSibling.getQPath().makeParentPath(), nextSibling.getQPath().getName(), nextSibling .getQPath().getIndex()); // update with new index QPath siblingPath = QPath.makeChildPath(nextSibling.getQPath().makeParentPath(), nextSibling.getQPath().getName(), nextSibling .getQPath().getIndex() - 1); NodeData reindexed = new TransientNodeData(siblingPath, nextSibling.getIdentifier(), nextSibling.getPersistedVersion(), nextSibling.getPrimaryTypeName(), nextSibling.getMixinTypeNames(), nextSibling.getOrderNumber(), nextSibling.getParentIdentifier(), nextSibling.getACL()); reindexedId = reindexed.getIdentifier(); ItemState reindexedState = ItemState.createUpdatedState(reindexed); changes.add(reindexedState); itemsPool.reload(reindexed); reloadDescendants(siblingOldPath, siblingPath); // next... nextSibling = (NodeData)dataManager.getItemData(parentNodeData, new QPathEntry(nextSibling.getQPath().getName(), nextSibling.getQPath().getIndex() + 1), ItemType.NODE); } return changes; }
[ "protected", "List", "<", "ItemState", ">", "reindexSameNameSiblings", "(", "NodeData", "cause", ",", "ItemDataConsumer", "dataManager", ")", "throws", "RepositoryException", "{", "List", "<", "ItemState", ">", "changes", "=", "new", "ArrayList", "<", "ItemState", ...
Reindex same-name siblings of the node Reindex is actual for remove, move only. If node is added then its index always is a last in list of childs. @param cause a node caused reindexing, i.e. deleted or moved node.
[ "Reindex", "same", "-", "name", "siblings", "of", "the", "node", "Reindex", "is", "actual", "for", "remove", "move", "only", ".", "If", "node", "is", "added", "then", "its", "index", "always", "is", "a", "last", "in", "list", "of", "childs", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L1452-L1499
135,842
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.getReferencesData
public List<PropertyData> getReferencesData(String identifier, boolean skipVersionStorage) throws RepositoryException { List<PropertyData> persisted = transactionableManager.getReferencesData(identifier, skipVersionStorage); List<PropertyData> sessionTransient = new ArrayList<PropertyData>(); for (PropertyData p : persisted) { sessionTransient.add(p); } return sessionTransient; }
java
public List<PropertyData> getReferencesData(String identifier, boolean skipVersionStorage) throws RepositoryException { List<PropertyData> persisted = transactionableManager.getReferencesData(identifier, skipVersionStorage); List<PropertyData> sessionTransient = new ArrayList<PropertyData>(); for (PropertyData p : persisted) { sessionTransient.add(p); } return sessionTransient; }
[ "public", "List", "<", "PropertyData", ">", "getReferencesData", "(", "String", "identifier", ",", "boolean", "skipVersionStorage", ")", "throws", "RepositoryException", "{", "List", "<", "PropertyData", ">", "persisted", "=", "transactionableManager", ".", "getRefere...
Returns all REFERENCE properties that refer to this node. @see org.exoplatform.services.jcr.dataflow.ItemDataConsumer#getReferencesData(String, boolean)
[ "Returns", "all", "REFERENCE", "properties", "that", "refer", "to", "this", "node", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L1618-L1628
135,843
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.validate
private void validate(QPath path) throws RepositoryException, AccessDeniedException, ReferentialIntegrityException { List<ItemState> changes = changesLog.getAllStates(); for (ItemState itemState : changes) { if (itemState.isInternallyCreated()) { // skip internally created if (itemState.isMixinChanged()) { // ...except of check of ACL correct size for internally created // items. // If no permissions in the list throw exception. if (itemState.isDescendantOf(path)) { if (((NodeData)itemState.getData()).getACL().getPermissionsSize() < 1) { throw new RepositoryException("Node " + itemState.getData().getQPath().getAsString() + " has wrong formed ACL."); } } validateMandatoryItem(itemState); } } else { if (itemState.isDescendantOf(path)) { validateAccessPermissions(itemState); validateMandatoryItem(itemState); } if (path.isDescendantOf(itemState.getAncestorToSave())) { throw new ConstraintViolationException(path.getAsString() + " is the same or descendant of either Session.move()'s destination or source node only " + path.getAsString()); } } } }
java
private void validate(QPath path) throws RepositoryException, AccessDeniedException, ReferentialIntegrityException { List<ItemState> changes = changesLog.getAllStates(); for (ItemState itemState : changes) { if (itemState.isInternallyCreated()) { // skip internally created if (itemState.isMixinChanged()) { // ...except of check of ACL correct size for internally created // items. // If no permissions in the list throw exception. if (itemState.isDescendantOf(path)) { if (((NodeData)itemState.getData()).getACL().getPermissionsSize() < 1) { throw new RepositoryException("Node " + itemState.getData().getQPath().getAsString() + " has wrong formed ACL."); } } validateMandatoryItem(itemState); } } else { if (itemState.isDescendantOf(path)) { validateAccessPermissions(itemState); validateMandatoryItem(itemState); } if (path.isDescendantOf(itemState.getAncestorToSave())) { throw new ConstraintViolationException(path.getAsString() + " is the same or descendant of either Session.move()'s destination or source node only " + path.getAsString()); } } } }
[ "private", "void", "validate", "(", "QPath", "path", ")", "throws", "RepositoryException", ",", "AccessDeniedException", ",", "ReferentialIntegrityException", "{", "List", "<", "ItemState", ">", "changes", "=", "changesLog", ".", "getAllStates", "(", ")", ";", "fo...
Validate all user created changes saves like access permeations, mandatory items, value constraint. @param path @throws RepositoryException @throws AccessDeniedException @throws ReferentialIntegrityException
[ "Validate", "all", "user", "created", "changes", "saves", "like", "access", "permeations", "mandatory", "items", "value", "constraint", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L1639-L1681
135,844
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.validateAccessPermissions
private void validateAccessPermissions(ItemState changedItem) throws RepositoryException, AccessDeniedException { if (changedItem.isAddedAutoCreatedNodes()) { validateAddNodePermission(changedItem); } else if (changedItem.isDeleted()) { validateRemoveAccessPermission(changedItem); } else if (changedItem.isMixinChanged()) { validateMixinChangedPermission(changedItem); } else { NodeData parent = (NodeData)getItemData(changedItem.getData().getParentIdentifier()); if (parent != null) { if (changedItem.getData().isNode()) { // add node if (changedItem.isAdded()) { if (!accessManager.hasPermission(parent.getACL(), new String[]{PermissionType.ADD_NODE}, session .getUserState().getIdentity())) { throw new AccessDeniedException("Access denied: ADD_NODE " + changedItem.getData().getQPath().getAsString() + " for: " + session.getUserID() + " item owner " + parent.getACL().getOwner()); } } } else if (changedItem.isAdded() || changedItem.isUpdated()) { // add or update property if (!accessManager.hasPermission(parent.getACL(), new String[]{PermissionType.SET_PROPERTY}, session .getUserState().getIdentity())) { throw new AccessDeniedException("Access denied: SET_PROPERTY " + changedItem.getData().getQPath().getAsString() + " for: " + session.getUserID() + " item owner " + parent.getACL().getOwner()); } } } // else - parent not found, deleted in this session or from another } }
java
private void validateAccessPermissions(ItemState changedItem) throws RepositoryException, AccessDeniedException { if (changedItem.isAddedAutoCreatedNodes()) { validateAddNodePermission(changedItem); } else if (changedItem.isDeleted()) { validateRemoveAccessPermission(changedItem); } else if (changedItem.isMixinChanged()) { validateMixinChangedPermission(changedItem); } else { NodeData parent = (NodeData)getItemData(changedItem.getData().getParentIdentifier()); if (parent != null) { if (changedItem.getData().isNode()) { // add node if (changedItem.isAdded()) { if (!accessManager.hasPermission(parent.getACL(), new String[]{PermissionType.ADD_NODE}, session .getUserState().getIdentity())) { throw new AccessDeniedException("Access denied: ADD_NODE " + changedItem.getData().getQPath().getAsString() + " for: " + session.getUserID() + " item owner " + parent.getACL().getOwner()); } } } else if (changedItem.isAdded() || changedItem.isUpdated()) { // add or update property if (!accessManager.hasPermission(parent.getACL(), new String[]{PermissionType.SET_PROPERTY}, session .getUserState().getIdentity())) { throw new AccessDeniedException("Access denied: SET_PROPERTY " + changedItem.getData().getQPath().getAsString() + " for: " + session.getUserID() + " item owner " + parent.getACL().getOwner()); } } } // else - parent not found, deleted in this session or from another } }
[ "private", "void", "validateAccessPermissions", "(", "ItemState", "changedItem", ")", "throws", "RepositoryException", ",", "AccessDeniedException", "{", "if", "(", "changedItem", ".", "isAddedAutoCreatedNodes", "(", ")", ")", "{", "validateAddNodePermission", "(", "cha...
Validate ItemState for access permeations @param changedItem @throws RepositoryException @throws AccessDeniedException
[ "Validate", "ItemState", "for", "access", "permeations" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L1690-L1736
135,845
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.validateMandatoryItem
private void validateMandatoryItem(ItemState changedItem) throws ConstraintViolationException, AccessDeniedException { if (changedItem.getData().isNode() && (changedItem.isAdded() || changedItem.isMixinChanged()) && !changesLog.getItemState(changedItem.getData().getQPath()).isDeleted()) { // Node not in delete state. It might be a wrong if (!changesLog.getItemState(changedItem.getData().getIdentifier()).isDeleted()) { NodeData nData = (NodeData)changedItem.getData(); try { validateMandatoryChildren(nData); } catch (ConstraintViolationException e) { throw e; } catch (AccessDeniedException e) { throw e; } catch (RepositoryException e) { LOG.warn("Unexpected exception. Probable wrong data. Exception message:" + e.getLocalizedMessage()); } } } }
java
private void validateMandatoryItem(ItemState changedItem) throws ConstraintViolationException, AccessDeniedException { if (changedItem.getData().isNode() && (changedItem.isAdded() || changedItem.isMixinChanged()) && !changesLog.getItemState(changedItem.getData().getQPath()).isDeleted()) { // Node not in delete state. It might be a wrong if (!changesLog.getItemState(changedItem.getData().getIdentifier()).isDeleted()) { NodeData nData = (NodeData)changedItem.getData(); try { validateMandatoryChildren(nData); } catch (ConstraintViolationException e) { throw e; } catch (AccessDeniedException e) { throw e; } catch (RepositoryException e) { LOG.warn("Unexpected exception. Probable wrong data. Exception message:" + e.getLocalizedMessage()); } } } }
[ "private", "void", "validateMandatoryItem", "(", "ItemState", "changedItem", ")", "throws", "ConstraintViolationException", ",", "AccessDeniedException", "{", "if", "(", "changedItem", ".", "getData", "(", ")", ".", "isNode", "(", ")", "&&", "(", "changedItem", "....
Validate ItemState which represents the add node, for it's all mandatory items @param changedItem @throws ConstraintViolationException @throws AccessDeniedException
[ "Validate", "ItemState", "which", "represents", "the", "add", "node", "for", "it", "s", "all", "mandatory", "items" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L1791-L1818
135,846
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.rollback
void rollback(ItemData item) throws InvalidItemStateException, RepositoryException { // remove from changes log (Session pending changes) PlainChangesLog slog = changesLog.pushLog(item.getQPath()); SessionChangesLog changes = new SessionChangesLog(slog.getAllStates(), session); for (Iterator<ItemImpl> removedIter = invalidated.iterator(); removedIter.hasNext();) { ItemImpl removed = removedIter.next(); QPath removedPath = removed.getLocation().getInternalPath(); ItemState rstate = changes.getItemState(removedPath); if (rstate != null) { if (rstate.isRenamed() || rstate.isPathChanged()) { // find DELETED rstate = changes.findItemState(rstate.getData().getIdentifier(), false, new int[]{ItemState.DELETED}); if (rstate == null) { continue; } } NodeData parent = (NodeData)transactionableManager.getItemData(rstate.getData().getParentIdentifier()); if (parent != null) { ItemData persisted = transactionableManager.getItemData(parent, rstate.getData().getQPath().getEntries()[rstate.getData() .getQPath().getEntries().length - 1], ItemType.getItemType(rstate.getData())); if (persisted != null) { // reload item data removed.loadData(persisted); } } // else it's transient item } else if (removed.getData() != null) { // No states for items left usecase ItemData persisted = transactionableManager.getItemData(removed.getData().getIdentifier()); if (persisted != null) { // reload item data removed.loadData(persisted); } } removedIter.remove(); } }
java
void rollback(ItemData item) throws InvalidItemStateException, RepositoryException { // remove from changes log (Session pending changes) PlainChangesLog slog = changesLog.pushLog(item.getQPath()); SessionChangesLog changes = new SessionChangesLog(slog.getAllStates(), session); for (Iterator<ItemImpl> removedIter = invalidated.iterator(); removedIter.hasNext();) { ItemImpl removed = removedIter.next(); QPath removedPath = removed.getLocation().getInternalPath(); ItemState rstate = changes.getItemState(removedPath); if (rstate != null) { if (rstate.isRenamed() || rstate.isPathChanged()) { // find DELETED rstate = changes.findItemState(rstate.getData().getIdentifier(), false, new int[]{ItemState.DELETED}); if (rstate == null) { continue; } } NodeData parent = (NodeData)transactionableManager.getItemData(rstate.getData().getParentIdentifier()); if (parent != null) { ItemData persisted = transactionableManager.getItemData(parent, rstate.getData().getQPath().getEntries()[rstate.getData() .getQPath().getEntries().length - 1], ItemType.getItemType(rstate.getData())); if (persisted != null) { // reload item data removed.loadData(persisted); } } // else it's transient item } else if (removed.getData() != null) { // No states for items left usecase ItemData persisted = transactionableManager.getItemData(removed.getData().getIdentifier()); if (persisted != null) { // reload item data removed.loadData(persisted); } } removedIter.remove(); } }
[ "void", "rollback", "(", "ItemData", "item", ")", "throws", "InvalidItemStateException", ",", "RepositoryException", "{", "// remove from changes log (Session pending changes)", "PlainChangesLog", "slog", "=", "changesLog", ".", "pushLog", "(", "item", ".", "getQPath", "(...
Removes all pending changes of this item @param item @throws RepositoryException
[ "Removes", "all", "pending", "changes", "of", "this", "item" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L1846-L1899
135,847
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.mergeList
protected List<? extends ItemData> mergeList(ItemData rootData, DataManager dataManager, boolean deep, int action) throws RepositoryException { // 1 get all transient descendants List<ItemState> transientDescendants = new ArrayList<ItemState>(); traverseTransientDescendants(rootData, action, transientDescendants); if (deep || !transientDescendants.isEmpty()) { // 2 get ALL persisted descendants Map<String, ItemData> descendants = new LinkedHashMap<String, ItemData>(); traverseStoredDescendants(rootData, dataManager, action, descendants, true, transientDescendants); // merge data for (ItemState state : transientDescendants) { ItemData data = state.getData(); if (!state.isDeleted()) { descendants.put(data.getIdentifier(), data); } else { descendants.remove(data.getIdentifier()); } } Collection<ItemData> desc = descendants.values(); List<ItemData> retval; if (deep) { int size = desc.size(); retval = new ArrayList<ItemData>(size < 10 ? 10 : size); for (ItemData itemData : desc) { retval.add(itemData); if (deep && itemData.isNode()) { retval.addAll(mergeList(itemData, dataManager, true, action)); } } } else { retval = new ArrayList<ItemData>(desc); } return retval; } else { return getStoredDescendants(rootData, dataManager, action); } }
java
protected List<? extends ItemData> mergeList(ItemData rootData, DataManager dataManager, boolean deep, int action) throws RepositoryException { // 1 get all transient descendants List<ItemState> transientDescendants = new ArrayList<ItemState>(); traverseTransientDescendants(rootData, action, transientDescendants); if (deep || !transientDescendants.isEmpty()) { // 2 get ALL persisted descendants Map<String, ItemData> descendants = new LinkedHashMap<String, ItemData>(); traverseStoredDescendants(rootData, dataManager, action, descendants, true, transientDescendants); // merge data for (ItemState state : transientDescendants) { ItemData data = state.getData(); if (!state.isDeleted()) { descendants.put(data.getIdentifier(), data); } else { descendants.remove(data.getIdentifier()); } } Collection<ItemData> desc = descendants.values(); List<ItemData> retval; if (deep) { int size = desc.size(); retval = new ArrayList<ItemData>(size < 10 ? 10 : size); for (ItemData itemData : desc) { retval.add(itemData); if (deep && itemData.isNode()) { retval.addAll(mergeList(itemData, dataManager, true, action)); } } } else { retval = new ArrayList<ItemData>(desc); } return retval; } else { return getStoredDescendants(rootData, dataManager, action); } }
[ "protected", "List", "<", "?", "extends", "ItemData", ">", "mergeList", "(", "ItemData", "rootData", ",", "DataManager", "dataManager", ",", "boolean", "deep", ",", "int", "action", ")", "throws", "RepositoryException", "{", "// 1 get all transient descendants", "Li...
Merge a list of nodes and properties of root data. NOTE. Properties in the list will have empty value data. I.e. for operations not changes properties content. USED FOR DELETE. @param rootData @param dataManager @param deep @param action @return @throws RepositoryException
[ "Merge", "a", "list", "of", "nodes", "and", "properties", "of", "root", "data", ".", "NOTE", ".", "Properties", "in", "the", "list", "will", "have", "empty", "value", "data", ".", "I", ".", "e", ".", "for", "operations", "not", "changes", "properties", ...
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L2182-L2235
135,848
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.traverseStoredDescendants
private void traverseStoredDescendants(ItemData parent, DataManager dataManager, int action, Map<String, ItemData> ret, boolean listOnly, Collection<ItemState> transientDescendants) throws RepositoryException { if (parent.isNode() && !isNew(parent.getIdentifier())) { if (action != MERGE_PROPS) { List<NodeData> childNodes = dataManager.getChildNodesData((NodeData)parent); for (int i = 0, length = childNodes.size(); i < length; i++) { NodeData childNode = childNodes.get(i); ret.put(childNode.getIdentifier(), childNode); } } if (action != MERGE_NODES) { List<PropertyData> childProps = listOnly ? dataManager.listChildPropertiesData((NodeData)parent) : dataManager .getChildPropertiesData((NodeData)parent); outer : for (int i = 0, length = childProps.size(); i < length; i++) { PropertyData childProp = childProps.get(i); for (ItemState transientState : transientDescendants) { if (!transientState.isNode() && !transientState.isDeleted() && transientState.getData().getQPath().getDepth() == childProp.getQPath().getDepth() && transientState.getData().getQPath().getName().equals(childProp.getQPath().getName())) { continue outer; } } if (!childProp.getQPath().isDescendantOf(parent.getQPath(), true)) { // In case we get the data from the cache, we need to set the correct path QPath qpath = QPath.makeChildPath(parent.getQPath(), childProp.getQPath().getName()); childProp = new PersistedPropertyData(childProp.getIdentifier(), qpath, childProp.getParentIdentifier(), childProp.getPersistedVersion(), childProp.getType(), childProp.isMultiValued(), childProp.getValues(), new SimplePersistedSize( ((PersistedPropertyData)childProp).getPersistedSize())); } ret.put(childProp.getIdentifier(), childProp); } } } }
java
private void traverseStoredDescendants(ItemData parent, DataManager dataManager, int action, Map<String, ItemData> ret, boolean listOnly, Collection<ItemState> transientDescendants) throws RepositoryException { if (parent.isNode() && !isNew(parent.getIdentifier())) { if (action != MERGE_PROPS) { List<NodeData> childNodes = dataManager.getChildNodesData((NodeData)parent); for (int i = 0, length = childNodes.size(); i < length; i++) { NodeData childNode = childNodes.get(i); ret.put(childNode.getIdentifier(), childNode); } } if (action != MERGE_NODES) { List<PropertyData> childProps = listOnly ? dataManager.listChildPropertiesData((NodeData)parent) : dataManager .getChildPropertiesData((NodeData)parent); outer : for (int i = 0, length = childProps.size(); i < length; i++) { PropertyData childProp = childProps.get(i); for (ItemState transientState : transientDescendants) { if (!transientState.isNode() && !transientState.isDeleted() && transientState.getData().getQPath().getDepth() == childProp.getQPath().getDepth() && transientState.getData().getQPath().getName().equals(childProp.getQPath().getName())) { continue outer; } } if (!childProp.getQPath().isDescendantOf(parent.getQPath(), true)) { // In case we get the data from the cache, we need to set the correct path QPath qpath = QPath.makeChildPath(parent.getQPath(), childProp.getQPath().getName()); childProp = new PersistedPropertyData(childProp.getIdentifier(), qpath, childProp.getParentIdentifier(), childProp.getPersistedVersion(), childProp.getType(), childProp.isMultiValued(), childProp.getValues(), new SimplePersistedSize( ((PersistedPropertyData)childProp).getPersistedSize())); } ret.put(childProp.getIdentifier(), childProp); } } } }
[ "private", "void", "traverseStoredDescendants", "(", "ItemData", "parent", ",", "DataManager", "dataManager", ",", "int", "action", ",", "Map", "<", "String", ",", "ItemData", ">", "ret", ",", "boolean", "listOnly", ",", "Collection", "<", "ItemState", ">", "t...
Calculate all stored descendants for the given parent node @param parent @param dataManager @param action @param ret @throws RepositoryException
[ "Calculate", "all", "stored", "descendants", "for", "the", "given", "parent", "node" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L2246-L2293
135,849
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.getStoredDescendants
private List<? extends ItemData> getStoredDescendants(ItemData parent, DataManager dataManager, int action) throws RepositoryException { if (parent.isNode()) { List<ItemData> childItems = null; List<NodeData> childNodes = dataManager.getChildNodesData((NodeData)parent); if (action != MERGE_NODES) { childItems = new ArrayList<ItemData>(childNodes); } else { return childNodes; } List<PropertyData> childProps = dataManager.getChildPropertiesData((NodeData)parent); if (action != MERGE_PROPS) { childItems.addAll(childProps); } else { return childProps; } return childItems; } return null; }
java
private List<? extends ItemData> getStoredDescendants(ItemData parent, DataManager dataManager, int action) throws RepositoryException { if (parent.isNode()) { List<ItemData> childItems = null; List<NodeData> childNodes = dataManager.getChildNodesData((NodeData)parent); if (action != MERGE_NODES) { childItems = new ArrayList<ItemData>(childNodes); } else { return childNodes; } List<PropertyData> childProps = dataManager.getChildPropertiesData((NodeData)parent); if (action != MERGE_PROPS) { childItems.addAll(childProps); } else { return childProps; } return childItems; } return null; }
[ "private", "List", "<", "?", "extends", "ItemData", ">", "getStoredDescendants", "(", "ItemData", "parent", ",", "DataManager", "dataManager", ",", "int", "action", ")", "throws", "RepositoryException", "{", "if", "(", "parent", ".", "isNode", "(", ")", ")", ...
Get all stored descendants for the given parent node @param parent @param dataManager @param action @throws RepositoryException
[ "Get", "all", "stored", "descendants", "for", "the", "given", "parent", "node" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L2303-L2333
135,850
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.traverseTransientDescendants
private void traverseTransientDescendants(ItemData parent, int action, List<ItemState> ret) throws RepositoryException { if (parent.isNode()) { if (action != MERGE_PROPS) { Collection<ItemState> childNodes = changesLog.getLastChildrenStates(parent, true); for (ItemState childNode : childNodes) { ret.add(childNode); } } if (action != MERGE_NODES) { Collection<ItemState> childProps = changesLog.getLastChildrenStates(parent, false); for (ItemState childProp : childProps) { ret.add(childProp); } } } }
java
private void traverseTransientDescendants(ItemData parent, int action, List<ItemState> ret) throws RepositoryException { if (parent.isNode()) { if (action != MERGE_PROPS) { Collection<ItemState> childNodes = changesLog.getLastChildrenStates(parent, true); for (ItemState childNode : childNodes) { ret.add(childNode); } } if (action != MERGE_NODES) { Collection<ItemState> childProps = changesLog.getLastChildrenStates(parent, false); for (ItemState childProp : childProps) { ret.add(childProp); } } } }
[ "private", "void", "traverseTransientDescendants", "(", "ItemData", "parent", ",", "int", "action", ",", "List", "<", "ItemState", ">", "ret", ")", "throws", "RepositoryException", "{", "if", "(", "parent", ".", "isNode", "(", ")", ")", "{", "if", "(", "ac...
Calculate all transient descendants for the given parent node @param parent @param action @param ret @throws RepositoryException
[ "Calculate", "all", "transient", "descendants", "for", "the", "given", "parent", "node" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L2343-L2366
135,851
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.reloadDescendants
private void reloadDescendants(QPath parentOld, QPath parent) throws RepositoryException { List<ItemImpl> items = itemsPool.getDescendats(parentOld); for (ItemImpl item : items) { ItemData oldItemData = item.getData(); ItemData newItemData = updatePath(parentOld, parent, oldItemData); ItemImpl reloadedItem = reloadItem(newItemData); if (reloadedItem != null) { invalidated.add(reloadedItem); } } }
java
private void reloadDescendants(QPath parentOld, QPath parent) throws RepositoryException { List<ItemImpl> items = itemsPool.getDescendats(parentOld); for (ItemImpl item : items) { ItemData oldItemData = item.getData(); ItemData newItemData = updatePath(parentOld, parent, oldItemData); ItemImpl reloadedItem = reloadItem(newItemData); if (reloadedItem != null) { invalidated.add(reloadedItem); } } }
[ "private", "void", "reloadDescendants", "(", "QPath", "parentOld", ",", "QPath", "parent", ")", "throws", "RepositoryException", "{", "List", "<", "ItemImpl", ">", "items", "=", "itemsPool", ".", "getDescendats", "(", "parentOld", ")", ";", "for", "(", "ItemIm...
Reload item's descendants in item reference pool @param parentOld old item's QPath to get descendants out of item reference pool @param parent new item's QPath to set for reloaded descendants @throws RepositoryException
[ "Reload", "item", "s", "descendants", "in", "item", "reference", "pool" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L2375-L2391
135,852
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.updatePathIfNeeded
private ItemData updatePathIfNeeded(ItemData data) throws IllegalPathException { if (data == null || changesLog.getAllPathsChanged() == null) return data; List<ItemState> states = changesLog.getAllPathsChanged(); for (int i = 0, length = states.size(); i < length; i++) { ItemState state = states.get(i); if (data.getQPath().isDescendantOf(state.getOldPath())) { data = updatePath(state.getOldPath(), state.getData().getQPath(), data); } } return data; }
java
private ItemData updatePathIfNeeded(ItemData data) throws IllegalPathException { if (data == null || changesLog.getAllPathsChanged() == null) return data; List<ItemState> states = changesLog.getAllPathsChanged(); for (int i = 0, length = states.size(); i < length; i++) { ItemState state = states.get(i); if (data.getQPath().isDescendantOf(state.getOldPath())) { data = updatePath(state.getOldPath(), state.getData().getQPath(), data); } } return data; }
[ "private", "ItemData", "updatePathIfNeeded", "(", "ItemData", "data", ")", "throws", "IllegalPathException", "{", "if", "(", "data", "==", "null", "||", "changesLog", ".", "getAllPathsChanged", "(", ")", "==", "null", ")", "return", "data", ";", "List", "<", ...
Updates the path if needed and gives the updated item data if an update was needed or the provided item data otherwise @throws IllegalPathException
[ "Updates", "the", "path", "if", "needed", "and", "gives", "the", "updated", "item", "data", "if", "an", "update", "was", "needed", "or", "the", "provided", "item", "data", "otherwise" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L2398-L2412
135,853
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.updatePath
private ItemData updatePath(QPath parentOld, QPath parent, ItemData oldItemData) throws IllegalPathException { int relativeDegree = oldItemData.getQPath().getDepth() - parentOld.getDepth(); QPath newQPath = QPath.makeChildPath(parent, oldItemData.getQPath().getRelPath(relativeDegree)); ItemData newItemData; if (oldItemData.isNode()) { NodeData oldNodeData = (NodeData)oldItemData; newItemData = new TransientNodeData(newQPath, oldNodeData.getIdentifier(), oldNodeData.getPersistedVersion(), oldNodeData.getPrimaryTypeName(), oldNodeData.getMixinTypeNames(), oldNodeData.getOrderNumber(), oldNodeData.getParentIdentifier(), oldNodeData.getACL()); } else { PropertyData oldPropertyData = (PropertyData)oldItemData; newItemData = new TransientPropertyData(newQPath, oldPropertyData.getIdentifier(), oldPropertyData.getPersistedVersion(), oldPropertyData.getType(), oldPropertyData.getParentIdentifier(), oldPropertyData.isMultiValued(), oldPropertyData.getValues()); } return newItemData; }
java
private ItemData updatePath(QPath parentOld, QPath parent, ItemData oldItemData) throws IllegalPathException { int relativeDegree = oldItemData.getQPath().getDepth() - parentOld.getDepth(); QPath newQPath = QPath.makeChildPath(parent, oldItemData.getQPath().getRelPath(relativeDegree)); ItemData newItemData; if (oldItemData.isNode()) { NodeData oldNodeData = (NodeData)oldItemData; newItemData = new TransientNodeData(newQPath, oldNodeData.getIdentifier(), oldNodeData.getPersistedVersion(), oldNodeData.getPrimaryTypeName(), oldNodeData.getMixinTypeNames(), oldNodeData.getOrderNumber(), oldNodeData.getParentIdentifier(), oldNodeData.getACL()); } else { PropertyData oldPropertyData = (PropertyData)oldItemData; newItemData = new TransientPropertyData(newQPath, oldPropertyData.getIdentifier(), oldPropertyData.getPersistedVersion(), oldPropertyData.getType(), oldPropertyData.getParentIdentifier(), oldPropertyData.isMultiValued(), oldPropertyData.getValues()); } return newItemData; }
[ "private", "ItemData", "updatePath", "(", "QPath", "parentOld", ",", "QPath", "parent", ",", "ItemData", "oldItemData", ")", "throws", "IllegalPathException", "{", "int", "relativeDegree", "=", "oldItemData", ".", "getQPath", "(", ")", ".", "getDepth", "(", ")",...
Updates the path of the item data and gives the updated objects @param parentOld the path of the old ancestor @param parent the path of the new ancestor @param oldItemData the old item data @return the {@link ItemData} with the updated path @throws IllegalPathException if the relative path could not be retrieved
[ "Updates", "the", "path", "of", "the", "item", "data", "and", "gives", "the", "updated", "objects" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L2422-L2445
135,854
exoplatform/jcr
exo.jcr.component.statistics/src/main/java/org/exoplatform/services/jcr/statistics/JCRAPIAspect.java
JCRAPIAspect.getStatistics
private static Statistics getStatistics(Class<?> target, String signature) { initIfNeeded(); Statistics statistics = MAPPING.get(signature); if (statistics == null) { synchronized (JCRAPIAspect.class) { Class<?> interfaceClass = findInterface(target); if (interfaceClass != null) { Map<String, Statistics> allStatistics = ALL_STATISTICS.get(interfaceClass.getSimpleName()); if (allStatistics != null) { int index1 = signature.indexOf('('); int index = signature.substring(0, index1).lastIndexOf('.'); String name = signature.substring(index + 1); statistics = allStatistics.get(name); } } if (statistics == null) { statistics = UNKNOWN; } Map<String, Statistics> tempMapping = new HashMap<String, Statistics>(MAPPING); tempMapping.put(signature, statistics); MAPPING = Collections.unmodifiableMap(tempMapping); } } if (statistics == UNKNOWN) // NOSONAR { return null; } return statistics; }
java
private static Statistics getStatistics(Class<?> target, String signature) { initIfNeeded(); Statistics statistics = MAPPING.get(signature); if (statistics == null) { synchronized (JCRAPIAspect.class) { Class<?> interfaceClass = findInterface(target); if (interfaceClass != null) { Map<String, Statistics> allStatistics = ALL_STATISTICS.get(interfaceClass.getSimpleName()); if (allStatistics != null) { int index1 = signature.indexOf('('); int index = signature.substring(0, index1).lastIndexOf('.'); String name = signature.substring(index + 1); statistics = allStatistics.get(name); } } if (statistics == null) { statistics = UNKNOWN; } Map<String, Statistics> tempMapping = new HashMap<String, Statistics>(MAPPING); tempMapping.put(signature, statistics); MAPPING = Collections.unmodifiableMap(tempMapping); } } if (statistics == UNKNOWN) // NOSONAR { return null; } return statistics; }
[ "private", "static", "Statistics", "getStatistics", "(", "Class", "<", "?", ">", "target", ",", "String", "signature", ")", "{", "initIfNeeded", "(", ")", ";", "Statistics", "statistics", "=", "MAPPING", ".", "get", "(", "signature", ")", ";", "if", "(", ...
Gives the corresponding statistics for the given target class and AspectJ signature @param target the target {@link Class} @param signature the AspectJ signature @return the related {@link Statistics} or <code>null</code> if it cannot be found
[ "Gives", "the", "corresponding", "statistics", "for", "the", "given", "target", "class", "and", "AspectJ", "signature" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.statistics/src/main/java/org/exoplatform/services/jcr/statistics/JCRAPIAspect.java#L128-L162
135,855
exoplatform/jcr
exo.jcr.component.statistics/src/main/java/org/exoplatform/services/jcr/statistics/JCRAPIAspect.java
JCRAPIAspect.initIfNeeded
private static void initIfNeeded() { if (!INITIALIZED) { synchronized (JCRAPIAspect.class) { if (!INITIALIZED) { ExoContainer container = ExoContainerContext.getTopContainer(); JCRAPIAspectConfig config = null; if (container != null) { config = (JCRAPIAspectConfig)container.getComponentInstanceOfType(JCRAPIAspectConfig.class); } if (config == null) { TARGET_INTERFACES = new Class<?>[]{}; LOG.warn("No interface to monitor could be found"); } else { TARGET_INTERFACES = config.getTargetInterfaces(); for (Class<?> c : TARGET_INTERFACES) { Statistics global = new Statistics(null, "global"); Map<String, Statistics> statistics = new TreeMap<String, Statistics>(); Method[] methods = c.getMethods(); for (Method m : methods) { String name = getStatisticsName(m); statistics.put(name, new Statistics(global, name)); } JCRStatisticsManager.registerStatistics(c.getSimpleName(), global, statistics); ALL_STATISTICS.put(c.getSimpleName(), statistics); } } INITIALIZED = true; } } } }
java
private static void initIfNeeded() { if (!INITIALIZED) { synchronized (JCRAPIAspect.class) { if (!INITIALIZED) { ExoContainer container = ExoContainerContext.getTopContainer(); JCRAPIAspectConfig config = null; if (container != null) { config = (JCRAPIAspectConfig)container.getComponentInstanceOfType(JCRAPIAspectConfig.class); } if (config == null) { TARGET_INTERFACES = new Class<?>[]{}; LOG.warn("No interface to monitor could be found"); } else { TARGET_INTERFACES = config.getTargetInterfaces(); for (Class<?> c : TARGET_INTERFACES) { Statistics global = new Statistics(null, "global"); Map<String, Statistics> statistics = new TreeMap<String, Statistics>(); Method[] methods = c.getMethods(); for (Method m : methods) { String name = getStatisticsName(m); statistics.put(name, new Statistics(global, name)); } JCRStatisticsManager.registerStatistics(c.getSimpleName(), global, statistics); ALL_STATISTICS.put(c.getSimpleName(), statistics); } } INITIALIZED = true; } } } }
[ "private", "static", "void", "initIfNeeded", "(", ")", "{", "if", "(", "!", "INITIALIZED", ")", "{", "synchronized", "(", "JCRAPIAspect", ".", "class", ")", "{", "if", "(", "!", "INITIALIZED", ")", "{", "ExoContainer", "container", "=", "ExoContainerContext"...
Initializes the aspect if needed
[ "Initializes", "the", "aspect", "if", "needed" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.statistics/src/main/java/org/exoplatform/services/jcr/statistics/JCRAPIAspect.java#L195-L235
135,856
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/DBCleaningScriptsFactory.java
DBCleaningScriptsFactory.prepareScripts
public static DBCleaningScripts prepareScripts(String dialect, WorkspaceEntry wsEntry) throws DBCleanException { if (dialect.startsWith(DialectConstants.DB_DIALECT_MYSQL)) { return new MySQLCleaningScipts(dialect, wsEntry); } else if (dialect.startsWith(DialectConstants.DB_DIALECT_DB2)) { return new DB2CleaningScipts(dialect, wsEntry); } else if (dialect.startsWith(DialectConstants.DB_DIALECT_MSSQL)) { return new MSSQLCleaningScipts(dialect, wsEntry); } else if (dialect.startsWith(DialectConstants.DB_DIALECT_PGSQL)) { return new PgSQLCleaningScipts(dialect, wsEntry); } else if (dialect.startsWith(DialectConstants.DB_DIALECT_SYBASE)) { return new SybaseCleaningScipts(dialect, wsEntry); } else if (dialect.startsWith(DialectConstants.DB_DIALECT_HSQLDB)) { return new HSQLDBCleaningScipts(dialect, wsEntry); } else if (dialect.startsWith(DialectConstants.DB_DIALECT_H2)) { return new H2CleaningScipts(dialect, wsEntry); } else if (dialect.startsWith(DialectConstants.DB_DIALECT_ORACLE)) { return new OracleCleaningScipts(dialect, wsEntry); } else { throw new DBCleanException("Unsupported dialect " + dialect); } }
java
public static DBCleaningScripts prepareScripts(String dialect, WorkspaceEntry wsEntry) throws DBCleanException { if (dialect.startsWith(DialectConstants.DB_DIALECT_MYSQL)) { return new MySQLCleaningScipts(dialect, wsEntry); } else if (dialect.startsWith(DialectConstants.DB_DIALECT_DB2)) { return new DB2CleaningScipts(dialect, wsEntry); } else if (dialect.startsWith(DialectConstants.DB_DIALECT_MSSQL)) { return new MSSQLCleaningScipts(dialect, wsEntry); } else if (dialect.startsWith(DialectConstants.DB_DIALECT_PGSQL)) { return new PgSQLCleaningScipts(dialect, wsEntry); } else if (dialect.startsWith(DialectConstants.DB_DIALECT_SYBASE)) { return new SybaseCleaningScipts(dialect, wsEntry); } else if (dialect.startsWith(DialectConstants.DB_DIALECT_HSQLDB)) { return new HSQLDBCleaningScipts(dialect, wsEntry); } else if (dialect.startsWith(DialectConstants.DB_DIALECT_H2)) { return new H2CleaningScipts(dialect, wsEntry); } else if (dialect.startsWith(DialectConstants.DB_DIALECT_ORACLE)) { return new OracleCleaningScipts(dialect, wsEntry); } else { throw new DBCleanException("Unsupported dialect " + dialect); } }
[ "public", "static", "DBCleaningScripts", "prepareScripts", "(", "String", "dialect", ",", "WorkspaceEntry", "wsEntry", ")", "throws", "DBCleanException", "{", "if", "(", "dialect", ".", "startsWith", "(", "DialectConstants", ".", "DB_DIALECT_MYSQL", ")", ")", "{", ...
Prepare SQL scripts for cleaning workspace data from database. @param wsEntry workspace configuration @param dialect database dialect which is used, since {@link JDBCWorkspaceDataContainer#DB_DIALECT} parameter can contain {@link DialectConstants#DB_DIALECT_AUTO} value it is necessary to resolve dialect before based on database connection.
[ "Prepare", "SQL", "scripts", "for", "cleaning", "workspace", "data", "from", "database", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/DBCleaningScriptsFactory.java#L43-L81
135,857
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/RsyncIndexInfos.java
RsyncIndexInfos.triggerRSyncSynchronization
private void triggerRSyncSynchronization() { // Call RSync to retrieve actual index from coordinator if (modeHandler.getMode() == IndexerIoMode.READ_ONLY) { EmbeddedCacheManager cacheManager = cache.getCacheManager(); if (cacheManager.getCoordinator() instanceof JGroupsAddress && cacheManager.getTransport() instanceof JGroupsTransport) { JGroupsTransport transport = (JGroupsTransport)cacheManager.getTransport(); // Coordinator's address org.jgroups.Address jgAddress = ((JGroupsAddress)cacheManager.getCoordinator()).getJGroupsAddress(); // if jgAddress is UUID address, not the physical one, then retrieve via channel if (!(jgAddress instanceof IpAddress)) { // this is the only way of getting physical address. Channel channel = transport.getChannel(); jgAddress = (org.jgroups.Address)channel.down(new Event(Event.GET_PHYSICAL_ADDRESS, jgAddress)); } if (jgAddress instanceof IpAddress) { String address = ((IpAddress)jgAddress).getIpAddress().getHostAddress(); RSyncJob rSyncJob = new RSyncJob(String.format(urlFormatString, address), indexPath, rsyncUserName, rsyncPassword); try { // synchronizing access to RSync Job. // No parallel jobs allowed synchronized (this) { rSyncJob.execute(); } } catch (IOException e) { LOG.error("Failed to retrieve index using RSYNC", e); } } else { LOG.error("Error triggering RSync synchronization, skipped. Unsupported Address object : " + jgAddress.getClass().getName()); } } else { LOG.error("Error triggering RSync synchronization, skipped. Unsupported Address object : " + cacheManager.getCoordinator().getClass().getName()); } } }
java
private void triggerRSyncSynchronization() { // Call RSync to retrieve actual index from coordinator if (modeHandler.getMode() == IndexerIoMode.READ_ONLY) { EmbeddedCacheManager cacheManager = cache.getCacheManager(); if (cacheManager.getCoordinator() instanceof JGroupsAddress && cacheManager.getTransport() instanceof JGroupsTransport) { JGroupsTransport transport = (JGroupsTransport)cacheManager.getTransport(); // Coordinator's address org.jgroups.Address jgAddress = ((JGroupsAddress)cacheManager.getCoordinator()).getJGroupsAddress(); // if jgAddress is UUID address, not the physical one, then retrieve via channel if (!(jgAddress instanceof IpAddress)) { // this is the only way of getting physical address. Channel channel = transport.getChannel(); jgAddress = (org.jgroups.Address)channel.down(new Event(Event.GET_PHYSICAL_ADDRESS, jgAddress)); } if (jgAddress instanceof IpAddress) { String address = ((IpAddress)jgAddress).getIpAddress().getHostAddress(); RSyncJob rSyncJob = new RSyncJob(String.format(urlFormatString, address), indexPath, rsyncUserName, rsyncPassword); try { // synchronizing access to RSync Job. // No parallel jobs allowed synchronized (this) { rSyncJob.execute(); } } catch (IOException e) { LOG.error("Failed to retrieve index using RSYNC", e); } } else { LOG.error("Error triggering RSync synchronization, skipped. Unsupported Address object : " + jgAddress.getClass().getName()); } } else { LOG.error("Error triggering RSync synchronization, skipped. Unsupported Address object : " + cacheManager.getCoordinator().getClass().getName()); } } }
[ "private", "void", "triggerRSyncSynchronization", "(", ")", "{", "// Call RSync to retrieve actual index from coordinator", "if", "(", "modeHandler", ".", "getMode", "(", ")", "==", "IndexerIoMode", ".", "READ_ONLY", ")", "{", "EmbeddedCacheManager", "cacheManager", "=", ...
Call to system RSync binary implementation,
[ "Call", "to", "system", "RSync", "binary", "implementation" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/RsyncIndexInfos.java#L101-L152
135,858
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java
SessionProvider.createAnonimProvider
public static SessionProvider createAnonimProvider() { Identity id = new Identity(IdentityConstants.ANONIM, new HashSet<MembershipEntry>()); return new SessionProvider(new ConversationState(id)); }
java
public static SessionProvider createAnonimProvider() { Identity id = new Identity(IdentityConstants.ANONIM, new HashSet<MembershipEntry>()); return new SessionProvider(new ConversationState(id)); }
[ "public", "static", "SessionProvider", "createAnonimProvider", "(", ")", "{", "Identity", "id", "=", "new", "Identity", "(", "IdentityConstants", ".", "ANONIM", ",", "new", "HashSet", "<", "MembershipEntry", ">", "(", ")", ")", ";", "return", "new", "SessionPr...
Helper for creating Anonymous session provider. @return an anonymous session provider
[ "Helper", "for", "creating", "Anonymous", "session", "provider", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java#L128-L132
135,859
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java
SessionProvider.getSession
public synchronized Session getSession(String workspaceName, ManageableRepository repository) throws LoginException, NoSuchWorkspaceException, RepositoryException { if (closed) { throw new IllegalStateException("Session provider already closed"); } if (workspaceName == null) { throw new IllegalArgumentException("Workspace Name is null"); } ExtendedSession session = cache.get(key(repository, workspaceName)); // create and cache new session if (session == null) { if (conversationState != null) { session = (ExtendedSession) repository.getDynamicSession(workspaceName, conversationState.getIdentity() .getMemberships()); } else if (!isSystem) { session = (ExtendedSession)repository.login(workspaceName); } else { session = (ExtendedSession)repository.getSystemSession(workspaceName); } session.registerLifecycleListener(this); cache.put(key(repository, workspaceName), session); } return session; }
java
public synchronized Session getSession(String workspaceName, ManageableRepository repository) throws LoginException, NoSuchWorkspaceException, RepositoryException { if (closed) { throw new IllegalStateException("Session provider already closed"); } if (workspaceName == null) { throw new IllegalArgumentException("Workspace Name is null"); } ExtendedSession session = cache.get(key(repository, workspaceName)); // create and cache new session if (session == null) { if (conversationState != null) { session = (ExtendedSession) repository.getDynamicSession(workspaceName, conversationState.getIdentity() .getMemberships()); } else if (!isSystem) { session = (ExtendedSession)repository.login(workspaceName); } else { session = (ExtendedSession)repository.getSystemSession(workspaceName); } session.registerLifecycleListener(this); cache.put(key(repository, workspaceName), session); } return session; }
[ "public", "synchronized", "Session", "getSession", "(", "String", "workspaceName", ",", "ManageableRepository", "repository", ")", "throws", "LoginException", ",", "NoSuchWorkspaceException", ",", "RepositoryException", "{", "if", "(", "closed", ")", "{", "throw", "ne...
Gets the session from an internal cache if a similar session has already been used or creates a new session and puts it into the internal cache. @param workspaceName the workspace name @param repository the repository instance @return a session corresponding to the given repository and workspace @throws LoginException if an error occurs while trying to login to the workspace @throws NoSuchWorkspaceException if the requested workspace doesn't exist @throws RepositoryException if any error occurs
[ "Gets", "the", "session", "from", "an", "internal", "cache", "if", "a", "similar", "session", "has", "already", "been", "used", "or", "creates", "a", "new", "session", "and", "puts", "it", "into", "the", "internal", "cache", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java#L171-L211
135,860
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java
SessionProvider.key
private String key(ManageableRepository repository, String workspaceName) { String repositoryName = repository.getConfiguration().getName(); return repositoryName + workspaceName; }
java
private String key(ManageableRepository repository, String workspaceName) { String repositoryName = repository.getConfiguration().getName(); return repositoryName + workspaceName; }
[ "private", "String", "key", "(", "ManageableRepository", "repository", ",", "String", "workspaceName", ")", "{", "String", "repositoryName", "=", "repository", ".", "getConfiguration", "(", ")", ".", "getName", "(", ")", ";", "return", "repositoryName", "+", "wo...
Key generator for sessions cache. @param repository the repository instance @param workspaceName the workspace name @return
[ "Key", "generator", "for", "sessions", "cache", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java#L256-L260
135,861
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/PathPatternUtils.java
PathPatternUtils.extractCommonAncestor
public static String extractCommonAncestor(String pattern, String absPath) { pattern = normalizePath(pattern); absPath = normalizePath(absPath); String[] patterEntries = pattern.split("/"); String[] pathEntries = absPath.split("/"); StringBuilder ancestor = new StringBuilder(); int count = Math.min(pathEntries.length, patterEntries.length); for (int i = 1; i < count; i++) { if (acceptName(patterEntries[i], pathEntries[i])) { ancestor.append("/"); ancestor.append(pathEntries[i]); } else { break; } } return ancestor.length() == 0 ? JCRPath.ROOT_PATH : ancestor.toString(); }
java
public static String extractCommonAncestor(String pattern, String absPath) { pattern = normalizePath(pattern); absPath = normalizePath(absPath); String[] patterEntries = pattern.split("/"); String[] pathEntries = absPath.split("/"); StringBuilder ancestor = new StringBuilder(); int count = Math.min(pathEntries.length, patterEntries.length); for (int i = 1; i < count; i++) { if (acceptName(patterEntries[i], pathEntries[i])) { ancestor.append("/"); ancestor.append(pathEntries[i]); } else { break; } } return ancestor.length() == 0 ? JCRPath.ROOT_PATH : ancestor.toString(); }
[ "public", "static", "String", "extractCommonAncestor", "(", "String", "pattern", ",", "String", "absPath", ")", "{", "pattern", "=", "normalizePath", "(", "pattern", ")", ";", "absPath", "=", "normalizePath", "(", "absPath", ")", ";", "String", "[", "]", "pa...
Returns common ancestor for paths represented by absolute path and pattern.
[ "Returns", "common", "ancestor", "for", "paths", "represented", "by", "absolute", "path", "and", "pattern", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/PathPatternUtils.java#L98-L123
135,862
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexerChangesFilter.java
IndexerChangesFilter.doUpdateIndex
protected void doUpdateIndex(Set<String> removedNodes, Set<String> addedNodes, Set<String> parentRemovedNodes, Set<String> parentAddedNodes) { ChangesHolder changes = searchManager.getChanges(removedNodes, addedNodes); ChangesHolder parentChanges = parentSearchManager.getChanges(parentRemovedNodes, parentAddedNodes); if (changes == null && parentChanges == null) { return; } try { doUpdateIndex(new ChangesFilterListsWrapper(changes, parentChanges)); } catch (RuntimeException e) { if (isTXAware()) { // The indexing is part of the global tx so the error needs to be thrown to // allow to roll back other resources throw e; } getLogger().error(e.getLocalizedMessage(), e); logErrorChanges(handler, removedNodes, addedNodes); logErrorChanges(parentHandler, parentRemovedNodes, parentAddedNodes); } }
java
protected void doUpdateIndex(Set<String> removedNodes, Set<String> addedNodes, Set<String> parentRemovedNodes, Set<String> parentAddedNodes) { ChangesHolder changes = searchManager.getChanges(removedNodes, addedNodes); ChangesHolder parentChanges = parentSearchManager.getChanges(parentRemovedNodes, parentAddedNodes); if (changes == null && parentChanges == null) { return; } try { doUpdateIndex(new ChangesFilterListsWrapper(changes, parentChanges)); } catch (RuntimeException e) { if (isTXAware()) { // The indexing is part of the global tx so the error needs to be thrown to // allow to roll back other resources throw e; } getLogger().error(e.getLocalizedMessage(), e); logErrorChanges(handler, removedNodes, addedNodes); logErrorChanges(parentHandler, parentRemovedNodes, parentAddedNodes); } }
[ "protected", "void", "doUpdateIndex", "(", "Set", "<", "String", ">", "removedNodes", ",", "Set", "<", "String", ">", "addedNodes", ",", "Set", "<", "String", ">", "parentRemovedNodes", ",", "Set", "<", "String", ">", "parentAddedNodes", ")", "{", "ChangesHo...
Update index. @param removedNodes @param addedNodes
[ "Update", "index", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexerChangesFilter.java#L218-L245
135,863
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingWorkspaceRestore.java
JobExistingWorkspaceRestore.forceCloseSession
private int forceCloseSession(String repositoryName, String workspaceName) throws RepositoryException, RepositoryConfigurationException { ManageableRepository mr = repositoryService.getRepository(repositoryName); WorkspaceContainerFacade wc = mr.getWorkspaceContainer(workspaceName); SessionRegistry sessionRegistry = (SessionRegistry)wc.getComponent(SessionRegistry.class); return sessionRegistry.closeSessions(workspaceName); }
java
private int forceCloseSession(String repositoryName, String workspaceName) throws RepositoryException, RepositoryConfigurationException { ManageableRepository mr = repositoryService.getRepository(repositoryName); WorkspaceContainerFacade wc = mr.getWorkspaceContainer(workspaceName); SessionRegistry sessionRegistry = (SessionRegistry)wc.getComponent(SessionRegistry.class); return sessionRegistry.closeSessions(workspaceName); }
[ "private", "int", "forceCloseSession", "(", "String", "repositoryName", ",", "String", "workspaceName", ")", "throws", "RepositoryException", ",", "RepositoryConfigurationException", "{", "ManageableRepository", "mr", "=", "repositoryService", ".", "getRepository", "(", "...
Close sessions on specific workspace. @param repositoryName repository name @param workspaceName workspace name @return int return the how many sessions was closed @throws RepositoryConfigurationException will be generate RepositoryConfigurationException @throws RepositoryException will be generate RepositoryException
[ "Close", "sessions", "on", "specific", "workspace", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingWorkspaceRestore.java#L131-L140
135,864
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ErrorLog.java
ErrorLog.readList
public List<String> readList() throws IOException { InputStream in = PrivilegedFileHelper.fileInputStream(logFile); try { List<String> list = new ArrayList<String>(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String line; while ((line = reader.readLine()) != null) { if (!line.matches("\\x00++")) { list.add(line); } } return list; } finally { if (in != null) { try { in.close(); } catch (IOException e) { LOG.warn("Exception while closing error log: " + e.toString()); } } } }
java
public List<String> readList() throws IOException { InputStream in = PrivilegedFileHelper.fileInputStream(logFile); try { List<String> list = new ArrayList<String>(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String line; while ((line = reader.readLine()) != null) { if (!line.matches("\\x00++")) { list.add(line); } } return list; } finally { if (in != null) { try { in.close(); } catch (IOException e) { LOG.warn("Exception while closing error log: " + e.toString()); } } } }
[ "public", "List", "<", "String", ">", "readList", "(", ")", "throws", "IOException", "{", "InputStream", "in", "=", "PrivilegedFileHelper", ".", "fileInputStream", "(", "logFile", ")", ";", "try", "{", "List", "<", "String", ">", "list", "=", "new", "Array...
Reads the log file . @throws IOException if an error occurs while reading from the log file.
[ "Reads", "the", "log", "file", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ErrorLog.java#L196-L228
135,865
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChainLog.java
BackupChainLog.addJobEntry
public void addJobEntry(BackupJob job) { // jobEntries try { JobEntryInfo info = new JobEntryInfo(); info.setDate(Calendar.getInstance()); info.setType(job.getType()); info.setState(job.getState()); info.setURL(job.getStorageURL()); logWriter.write(info, config); } catch (IOException e) { logger.error("Can't add job", e); } catch (XMLStreamException e) { logger.error("Can't add job", e); } catch (BackupOperationException e) { logger.error("Can't add job", e); } }
java
public void addJobEntry(BackupJob job) { // jobEntries try { JobEntryInfo info = new JobEntryInfo(); info.setDate(Calendar.getInstance()); info.setType(job.getType()); info.setState(job.getState()); info.setURL(job.getStorageURL()); logWriter.write(info, config); } catch (IOException e) { logger.error("Can't add job", e); } catch (XMLStreamException e) { logger.error("Can't add job", e); } catch (BackupOperationException e) { logger.error("Can't add job", e); } }
[ "public", "void", "addJobEntry", "(", "BackupJob", "job", ")", "{", "// jobEntries\r", "try", "{", "JobEntryInfo", "info", "=", "new", "JobEntryInfo", "(", ")", ";", "info", ".", "setDate", "(", "Calendar", ".", "getInstance", "(", ")", ")", ";", "info", ...
Adding the the backup job. @param job BackupJob, the backup job
[ "Adding", "the", "the", "backup", "job", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChainLog.java#L285-L310
135,866
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChainLog.java
BackupChainLog.getJobEntryStates
public Collection<JobEntryInfo> getJobEntryStates() { HashMap<Integer, JobEntryInfo> infos = new HashMap<Integer, JobEntryInfo>(); for (JobEntryInfo jobEntry : jobEntries) { infos.put(jobEntry.getID(), jobEntry); } return infos.values(); }
java
public Collection<JobEntryInfo> getJobEntryStates() { HashMap<Integer, JobEntryInfo> infos = new HashMap<Integer, JobEntryInfo>(); for (JobEntryInfo jobEntry : jobEntries) { infos.put(jobEntry.getID(), jobEntry); } return infos.values(); }
[ "public", "Collection", "<", "JobEntryInfo", ">", "getJobEntryStates", "(", ")", "{", "HashMap", "<", "Integer", ",", "JobEntryInfo", ">", "infos", "=", "new", "HashMap", "<", "Integer", ",", "JobEntryInfo", ">", "(", ")", ";", "for", "(", "JobEntryInfo", ...
Getting the states for jobs. @return Collection return the collection of states for jobs
[ "Getting", "the", "states", "for", "jobs", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChainLog.java#L397-L405
135,867
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/MkColCommand.java
MkColCommand.mkCol
public Response mkCol(Session session, String path, String nodeType, List<String> mixinTypes, List<String> tokens) { Node node; try { nullResourceLocks.checkLock(session, path, tokens); node = session.getRootNode().addNode(TextUtil.relativizePath(path), nodeType); // We set the new path path = node.getPath(); if (mixinTypes != null) { addMixins(node, mixinTypes); } session.save(); } catch (ItemExistsException exc) { return Response.status(HTTPStatus.METHOD_NOT_ALLOWED).entity(exc.getMessage()).build(); } catch (PathNotFoundException exc) { return Response.status(HTTPStatus.CONFLICT).entity(exc.getMessage()).build(); } catch (AccessDeniedException exc) { return Response.status(HTTPStatus.FORBIDDEN).entity(exc.getMessage()).build(); } catch (LockException exc) { return Response.status(HTTPStatus.LOCKED).entity(exc.getMessage()).build(); } catch (RepositoryException exc) { log.error(exc.getMessage(), exc); return Response.serverError().entity(exc.getMessage()).build(); } if (uriBuilder != null) { return Response.created(uriBuilder.path(session.getWorkspace().getName()).path(path).build()).build(); } // to save compatibility if uriBuilder is not provided return Response.status(HTTPStatus.CREATED).build(); }
java
public Response mkCol(Session session, String path, String nodeType, List<String> mixinTypes, List<String> tokens) { Node node; try { nullResourceLocks.checkLock(session, path, tokens); node = session.getRootNode().addNode(TextUtil.relativizePath(path), nodeType); // We set the new path path = node.getPath(); if (mixinTypes != null) { addMixins(node, mixinTypes); } session.save(); } catch (ItemExistsException exc) { return Response.status(HTTPStatus.METHOD_NOT_ALLOWED).entity(exc.getMessage()).build(); } catch (PathNotFoundException exc) { return Response.status(HTTPStatus.CONFLICT).entity(exc.getMessage()).build(); } catch (AccessDeniedException exc) { return Response.status(HTTPStatus.FORBIDDEN).entity(exc.getMessage()).build(); } catch (LockException exc) { return Response.status(HTTPStatus.LOCKED).entity(exc.getMessage()).build(); } catch (RepositoryException exc) { log.error(exc.getMessage(), exc); return Response.serverError().entity(exc.getMessage()).build(); } if (uriBuilder != null) { return Response.created(uriBuilder.path(session.getWorkspace().getName()).path(path).build()).build(); } // to save compatibility if uriBuilder is not provided return Response.status(HTTPStatus.CREATED).build(); }
[ "public", "Response", "mkCol", "(", "Session", "session", ",", "String", "path", ",", "String", "nodeType", ",", "List", "<", "String", ">", "mixinTypes", ",", "List", "<", "String", ">", "tokens", ")", "{", "Node", "node", ";", "try", "{", "nullResource...
Webdav Mkcol method implementation. @param session current session @param path resource path @param nodeType folder node type @param mixinTypes mixin types @param tokens tokens @return the instance of javax.ws.rs.core.Response
[ "Webdav", "Mkcol", "method", "implementation", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/MkColCommand.java#L97-L150
135,868
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/MkColCommand.java
MkColCommand.addMixins
private void addMixins(Node node, List<String> mixinTypes) { for (int i = 0; i < mixinTypes.size(); i++) { String curMixinType = mixinTypes.get(i); try { node.addMixin(curMixinType); } catch (Exception exc) { log.error("Can't add mixin [" + curMixinType + "]", exc); } } }
java
private void addMixins(Node node, List<String> mixinTypes) { for (int i = 0; i < mixinTypes.size(); i++) { String curMixinType = mixinTypes.get(i); try { node.addMixin(curMixinType); } catch (Exception exc) { log.error("Can't add mixin [" + curMixinType + "]", exc); } } }
[ "private", "void", "addMixins", "(", "Node", "node", ",", "List", "<", "String", ">", "mixinTypes", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "mixinTypes", ".", "size", "(", ")", ";", "i", "++", ")", "{", "String", "curMixinType", ...
Adds mixins to node. @param node node. @param mixinTypes mixin types.
[ "Adds", "mixins", "to", "node", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/MkColCommand.java#L158-L172
135,869
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/UnLockCommand.java
UnLockCommand.unLock
public Response unLock(Session session, String path, List<String> tokens) { try { try { Node node = (Node)session.getItem(path); if (node.isLocked()) { node.unlock(); session.save(); } return Response.status(HTTPStatus.NO_CONTENT).build(); } catch (PathNotFoundException exc) { if (nullResourceLocks.isLocked(session, path)) { nullResourceLocks.checkLock(session, path, tokens); nullResourceLocks.removeLock(session, path); return Response.status(HTTPStatus.NO_CONTENT).build(); } return Response.status(HTTPStatus.NOT_FOUND).entity(exc.getMessage()).build(); } } catch (LockException exc) { return Response.status(HTTPStatus.LOCKED).entity(exc.getMessage()).build(); } catch (Exception exc) { log.error(exc.getMessage(), exc); return Response.serverError().entity(exc.getMessage()).build(); } }
java
public Response unLock(Session session, String path, List<String> tokens) { try { try { Node node = (Node)session.getItem(path); if (node.isLocked()) { node.unlock(); session.save(); } return Response.status(HTTPStatus.NO_CONTENT).build(); } catch (PathNotFoundException exc) { if (nullResourceLocks.isLocked(session, path)) { nullResourceLocks.checkLock(session, path, tokens); nullResourceLocks.removeLock(session, path); return Response.status(HTTPStatus.NO_CONTENT).build(); } return Response.status(HTTPStatus.NOT_FOUND).entity(exc.getMessage()).build(); } } catch (LockException exc) { return Response.status(HTTPStatus.LOCKED).entity(exc.getMessage()).build(); } catch (Exception exc) { log.error(exc.getMessage(), exc); return Response.serverError().entity(exc.getMessage()).build(); } }
[ "public", "Response", "unLock", "(", "Session", "session", ",", "String", "path", ",", "List", "<", "String", ">", "tokens", ")", "{", "try", "{", "try", "{", "Node", "node", "=", "(", "Node", ")", "session", ".", "getItem", "(", "path", ")", ";", ...
Webdav Unlock method implementation. @param session current seesion @param path resource path @param tokens tokens @return the instance of javax.ws.rs.core.Response
[ "Webdav", "Unlock", "method", "implementation", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/UnLockCommand.java#L72-L111
135,870
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/GenericResource.java
GenericResource.lockDiscovery
public static HierarchicalProperty lockDiscovery(String token, String lockOwner, String timeOut) { HierarchicalProperty lockDiscovery = new HierarchicalProperty(new QName("DAV:", "lockdiscovery")); HierarchicalProperty activeLock = lockDiscovery.addChild(new HierarchicalProperty(new QName("DAV:", "activelock"))); HierarchicalProperty lockType = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "locktype"))); lockType.addChild(new HierarchicalProperty(new QName("DAV:", "write"))); HierarchicalProperty lockScope = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "lockscope"))); lockScope.addChild(new HierarchicalProperty(new QName("DAV:", "exclusive"))); HierarchicalProperty depth = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "depth"))); depth.setValue("Infinity"); if (lockOwner != null) { HierarchicalProperty owner = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "owner"))); owner.setValue(lockOwner); } HierarchicalProperty timeout = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "timeout"))); timeout.setValue("Second-" + timeOut); if (token != null) { HierarchicalProperty lockToken = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "locktoken"))); HierarchicalProperty lockHref = lockToken.addChild(new HierarchicalProperty(new QName("DAV:", "href"))); lockHref.setValue(token); } return lockDiscovery; }
java
public static HierarchicalProperty lockDiscovery(String token, String lockOwner, String timeOut) { HierarchicalProperty lockDiscovery = new HierarchicalProperty(new QName("DAV:", "lockdiscovery")); HierarchicalProperty activeLock = lockDiscovery.addChild(new HierarchicalProperty(new QName("DAV:", "activelock"))); HierarchicalProperty lockType = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "locktype"))); lockType.addChild(new HierarchicalProperty(new QName("DAV:", "write"))); HierarchicalProperty lockScope = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "lockscope"))); lockScope.addChild(new HierarchicalProperty(new QName("DAV:", "exclusive"))); HierarchicalProperty depth = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "depth"))); depth.setValue("Infinity"); if (lockOwner != null) { HierarchicalProperty owner = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "owner"))); owner.setValue(lockOwner); } HierarchicalProperty timeout = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "timeout"))); timeout.setValue("Second-" + timeOut); if (token != null) { HierarchicalProperty lockToken = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "locktoken"))); HierarchicalProperty lockHref = lockToken.addChild(new HierarchicalProperty(new QName("DAV:", "href"))); lockHref.setValue(token); } return lockDiscovery; }
[ "public", "static", "HierarchicalProperty", "lockDiscovery", "(", "String", "token", ",", "String", "lockOwner", ",", "String", "timeOut", ")", "{", "HierarchicalProperty", "lockDiscovery", "=", "new", "HierarchicalProperty", "(", "new", "QName", "(", "\"DAV:\"", ",...
Returns the information about lock. @param token lock token @param lockOwner lockowner @param timeOut lock timeout @return lock information
[ "Returns", "the", "information", "about", "lock", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/GenericResource.java#L146-L179
135,871
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/GenericResource.java
GenericResource.supportedLock
protected HierarchicalProperty supportedLock() { HierarchicalProperty supportedLock = new HierarchicalProperty(new QName("DAV:", "supportedlock")); HierarchicalProperty lockEntry = new HierarchicalProperty(new QName("DAV:", "lockentry")); supportedLock.addChild(lockEntry); HierarchicalProperty lockScope = new HierarchicalProperty(new QName("DAV:", "lockscope")); lockScope.addChild(new HierarchicalProperty(new QName("DAV:", "exclusive"))); lockEntry.addChild(lockScope); HierarchicalProperty lockType = new HierarchicalProperty(new QName("DAV:", "locktype")); lockType.addChild(new HierarchicalProperty(new QName("DAV:", "write"))); lockEntry.addChild(lockType); return supportedLock; }
java
protected HierarchicalProperty supportedLock() { HierarchicalProperty supportedLock = new HierarchicalProperty(new QName("DAV:", "supportedlock")); HierarchicalProperty lockEntry = new HierarchicalProperty(new QName("DAV:", "lockentry")); supportedLock.addChild(lockEntry); HierarchicalProperty lockScope = new HierarchicalProperty(new QName("DAV:", "lockscope")); lockScope.addChild(new HierarchicalProperty(new QName("DAV:", "exclusive"))); lockEntry.addChild(lockScope); HierarchicalProperty lockType = new HierarchicalProperty(new QName("DAV:", "locktype")); lockType.addChild(new HierarchicalProperty(new QName("DAV:", "write"))); lockEntry.addChild(lockType); return supportedLock; }
[ "protected", "HierarchicalProperty", "supportedLock", "(", ")", "{", "HierarchicalProperty", "supportedLock", "=", "new", "HierarchicalProperty", "(", "new", "QName", "(", "\"DAV:\"", ",", "\"supportedlock\"", ")", ")", ";", "HierarchicalProperty", "lockEntry", "=", "...
The information about supported locks. @return information about supported locks
[ "The", "information", "about", "supported", "locks", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/GenericResource.java#L186-L202
135,872
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/GenericResource.java
GenericResource.supportedMethodSet
protected HierarchicalProperty supportedMethodSet() { HierarchicalProperty supportedMethodProp = new HierarchicalProperty(SUPPORTEDMETHODSET); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "PROPFIND"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "OPTIONS"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "DELETE"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "PROPPATCH"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "CHECKIN"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "CHECKOUT"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "REPORT"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "UNCHECKOUT"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "PUT"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "GET"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "HEAD"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "COPY"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "MOVE"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "VERSION-CONTROL"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "LABEL"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "LOCK"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "UNLOCK"); return supportedMethodProp; }
java
protected HierarchicalProperty supportedMethodSet() { HierarchicalProperty supportedMethodProp = new HierarchicalProperty(SUPPORTEDMETHODSET); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "PROPFIND"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "OPTIONS"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "DELETE"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "PROPPATCH"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "CHECKIN"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "CHECKOUT"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "REPORT"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "UNCHECKOUT"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "PUT"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "GET"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "HEAD"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "COPY"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "MOVE"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "VERSION-CONTROL"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "LABEL"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "LOCK"); supportedMethodProp.addChild(new HierarchicalProperty(new QName("DAV:", "supported-method"))).setAttribute( "name", "UNLOCK"); return supportedMethodProp; }
[ "protected", "HierarchicalProperty", "supportedMethodSet", "(", ")", "{", "HierarchicalProperty", "supportedMethodProp", "=", "new", "HierarchicalProperty", "(", "SUPPORTEDMETHODSET", ")", ";", "supportedMethodProp", ".", "addChild", "(", "new", "HierarchicalProperty", "(",...
The information about supported methods. @return information about supported methods
[ "The", "information", "about", "supported", "methods", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/GenericResource.java#L209-L250
135,873
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java
PutCommand.updateVersion
private void updateVersion(Node fileNode, InputStream inputStream, String autoVersion, List<String> mixins) throws RepositoryException { if (!fileNode.isCheckedOut()) { fileNode.checkout(); fileNode.getSession().save(); } if (CHECKOUT.equals(autoVersion)) { updateContent(fileNode, inputStream, mixins); } else if (CHECKOUT_CHECKIN.equals(autoVersion)) { updateContent(fileNode, inputStream, mixins); fileNode.getSession().save(); fileNode.checkin(); } fileNode.getSession().save(); }
java
private void updateVersion(Node fileNode, InputStream inputStream, String autoVersion, List<String> mixins) throws RepositoryException { if (!fileNode.isCheckedOut()) { fileNode.checkout(); fileNode.getSession().save(); } if (CHECKOUT.equals(autoVersion)) { updateContent(fileNode, inputStream, mixins); } else if (CHECKOUT_CHECKIN.equals(autoVersion)) { updateContent(fileNode, inputStream, mixins); fileNode.getSession().save(); fileNode.checkin(); } fileNode.getSession().save(); }
[ "private", "void", "updateVersion", "(", "Node", "fileNode", ",", "InputStream", "inputStream", ",", "String", "autoVersion", ",", "List", "<", "String", ">", "mixins", ")", "throws", "RepositoryException", "{", "if", "(", "!", "fileNode", ".", "isCheckedOut", ...
Updates the content of the versionable file according to auto-version value. @param fileNode Node to update @param inputStream input stream that contains the content of file @param autoVersion auto-version value @param mixins list of mixins @throws RepositoryException {@link RepositoryException}
[ "Updates", "the", "content", "of", "the", "versionable", "file", "according", "to", "auto", "-", "version", "value", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java#L420-L439
135,874
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DocNumberCache.java
DocNumberCache.put
void put(String uuid, CachingIndexReader reader, int n) { LRUMap cacheSegment = docNumbers[getSegmentIndex(uuid.charAt(0))]; //UUID key = UUID.fromString(uuid); String key = uuid; synchronized (cacheSegment) { Entry e = (Entry)cacheSegment.get(key); if (e != null) { // existing entry // ignore if reader is older than the one in entry if (reader.getCreationTick() <= e.creationTick) { if (log.isDebugEnabled()) { log.debug("Ignoring put(). New entry is not from a newer reader. " + "existing: " + e.creationTick + ", new: " + reader.getCreationTick()); } e = null; } } else { // entry did not exist e = new Entry(reader.getCreationTick(), n); } if (e != null) { cacheSegment.put(key, e); } } }
java
void put(String uuid, CachingIndexReader reader, int n) { LRUMap cacheSegment = docNumbers[getSegmentIndex(uuid.charAt(0))]; //UUID key = UUID.fromString(uuid); String key = uuid; synchronized (cacheSegment) { Entry e = (Entry)cacheSegment.get(key); if (e != null) { // existing entry // ignore if reader is older than the one in entry if (reader.getCreationTick() <= e.creationTick) { if (log.isDebugEnabled()) { log.debug("Ignoring put(). New entry is not from a newer reader. " + "existing: " + e.creationTick + ", new: " + reader.getCreationTick()); } e = null; } } else { // entry did not exist e = new Entry(reader.getCreationTick(), n); } if (e != null) { cacheSegment.put(key, e); } } }
[ "void", "put", "(", "String", "uuid", ",", "CachingIndexReader", "reader", ",", "int", "n", ")", "{", "LRUMap", "cacheSegment", "=", "docNumbers", "[", "getSegmentIndex", "(", "uuid", ".", "charAt", "(", "0", ")", ")", "]", ";", "//UUID key = UUID.fromString...
Puts a document number into the cache using a uuid as key. An entry is only overwritten if the according reader is younger than the reader associated with the existing entry. @param uuid the key. @param reader the index reader from where the document number was read. @param n the document number.
[ "Puts", "a", "document", "number", "into", "the", "cache", "using", "a", "uuid", "as", "key", ".", "An", "entry", "is", "only", "overwritten", "if", "the", "according", "reader", "is", "younger", "than", "the", "reader", "associated", "with", "the", "exist...
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DocNumberCache.java#L98-L131
135,875
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java
ValueFactoryImpl.createValue
public Value createValue(JCRName value) throws RepositoryException { if (value == null) return null; try { return new NameValue(value.getInternalName(), locationFactory); } catch (IOException e) { throw new RepositoryException("Cannot create NAME Value from JCRName", e); } }
java
public Value createValue(JCRName value) throws RepositoryException { if (value == null) return null; try { return new NameValue(value.getInternalName(), locationFactory); } catch (IOException e) { throw new RepositoryException("Cannot create NAME Value from JCRName", e); } }
[ "public", "Value", "createValue", "(", "JCRName", "value", ")", "throws", "RepositoryException", "{", "if", "(", "value", "==", "null", ")", "return", "null", ";", "try", "{", "return", "new", "NameValue", "(", "value", ".", "getInternalName", "(", ")", ",...
Create Value from JCRName. @param value JCRName @return Value @throws RepositoryException if error
[ "Create", "Value", "from", "JCRName", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java#L304-L316
135,876
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java
ValueFactoryImpl.createValue
public Value createValue(JCRPath value) throws RepositoryException { if (value == null) return null; try { return new PathValue(value.getInternalPath(), locationFactory); } catch (IOException e) { throw new RepositoryException("Cannot create PATH Value from JCRPath", e); } }
java
public Value createValue(JCRPath value) throws RepositoryException { if (value == null) return null; try { return new PathValue(value.getInternalPath(), locationFactory); } catch (IOException e) { throw new RepositoryException("Cannot create PATH Value from JCRPath", e); } }
[ "public", "Value", "createValue", "(", "JCRPath", "value", ")", "throws", "RepositoryException", "{", "if", "(", "value", "==", "null", ")", "return", "null", ";", "try", "{", "return", "new", "PathValue", "(", "value", ".", "getInternalPath", "(", ")", ",...
Create Value from JCRPath. @param value JCRPath @return Value @throws RepositoryException if error
[ "Create", "Value", "from", "JCRPath", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java#L327-L339
135,877
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java
ValueFactoryImpl.createValue
public Value createValue(Identifier value) { if (value == null) return null; try { return new ReferenceValue(value); } catch (IOException e) { LOG.warn("Cannot create REFERENCE Value from Identifier " + value, e); return null; } }
java
public Value createValue(Identifier value) { if (value == null) return null; try { return new ReferenceValue(value); } catch (IOException e) { LOG.warn("Cannot create REFERENCE Value from Identifier " + value, e); return null; } }
[ "public", "Value", "createValue", "(", "Identifier", "value", ")", "{", "if", "(", "value", "==", "null", ")", "return", "null", ";", "try", "{", "return", "new", "ReferenceValue", "(", "value", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{"...
Create Value from Id. @param value Identifier @return Value Reference
[ "Create", "Value", "from", "Id", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java#L348-L361
135,878
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java
ValueFactoryImpl.loadValue
public Value loadValue(ValueData data, int type) throws RepositoryException { try { switch (type) { case PropertyType.STRING : return new StringValue(data); case PropertyType.BINARY : return new BinaryValue(data, spoolConfig); case PropertyType.BOOLEAN : return new BooleanValue(data); case PropertyType.LONG : return new LongValue(data); case PropertyType.DOUBLE : return new DoubleValue(data); case PropertyType.DATE : return new DateValue(data); case PropertyType.PATH : return new PathValue(data, locationFactory); case PropertyType.NAME : return new NameValue(data, locationFactory); case PropertyType.REFERENCE : return new ReferenceValue(data, true); case PropertyType.UNDEFINED : return null; case ExtendedPropertyType.PERMISSION : return new PermissionValue(data); default : throw new ValueFormatException("unknown type " + type); } } catch (IOException e) { throw new RepositoryException(e); } }
java
public Value loadValue(ValueData data, int type) throws RepositoryException { try { switch (type) { case PropertyType.STRING : return new StringValue(data); case PropertyType.BINARY : return new BinaryValue(data, spoolConfig); case PropertyType.BOOLEAN : return new BooleanValue(data); case PropertyType.LONG : return new LongValue(data); case PropertyType.DOUBLE : return new DoubleValue(data); case PropertyType.DATE : return new DateValue(data); case PropertyType.PATH : return new PathValue(data, locationFactory); case PropertyType.NAME : return new NameValue(data, locationFactory); case PropertyType.REFERENCE : return new ReferenceValue(data, true); case PropertyType.UNDEFINED : return null; case ExtendedPropertyType.PERMISSION : return new PermissionValue(data); default : throw new ValueFormatException("unknown type " + type); } } catch (IOException e) { throw new RepositoryException(e); } }
[ "public", "Value", "loadValue", "(", "ValueData", "data", ",", "int", "type", ")", "throws", "RepositoryException", "{", "try", "{", "switch", "(", "type", ")", "{", "case", "PropertyType", ".", "STRING", ":", "return", "new", "StringValue", "(", "data", "...
Creates new Value object using ValueData @param data ValueData @param type int @return Value @throws RepositoryException if error
[ "Creates", "new", "Value", "object", "using", "ValueData" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java#L374-L410
135,879
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/AbstractLockTableHandler.java
AbstractLockTableHandler.openConnection
protected Connection openConnection() throws SQLException { return SecurityHelper.doPrivilegedSQLExceptionAction(new PrivilegedExceptionAction<Connection>() { public Connection run() throws SQLException { return ds.getConnection(); } }); }
java
protected Connection openConnection() throws SQLException { return SecurityHelper.doPrivilegedSQLExceptionAction(new PrivilegedExceptionAction<Connection>() { public Connection run() throws SQLException { return ds.getConnection(); } }); }
[ "protected", "Connection", "openConnection", "(", ")", "throws", "SQLException", "{", "return", "SecurityHelper", ".", "doPrivilegedSQLExceptionAction", "(", "new", "PrivilegedExceptionAction", "<", "Connection", ">", "(", ")", "{", "public", "Connection", "run", "(",...
Opens connection to database.
[ "Opens", "connection", "to", "database", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/AbstractLockTableHandler.java#L122-L131
135,880
exoplatform/jcr
exo.jcr.framework.web/src/main/java/org/exoplatform/frameworks/jcr/web/fckeditor/FCKeditorConfigurations.java
FCKeditorConfigurations.getUrlParams
public String getUrlParams() { StringBuffer osParams = new StringBuffer(); for (Iterator i = this.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry)i.next(); if (entry.getValue() != null) osParams.append("&" + encodeConfig(entry.getKey().toString()) + "=" + encodeConfig(entry.getValue().toString())); } return osParams.toString(); }
java
public String getUrlParams() { StringBuffer osParams = new StringBuffer(); for (Iterator i = this.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry)i.next(); if (entry.getValue() != null) osParams.append("&" + encodeConfig(entry.getKey().toString()) + "=" + encodeConfig(entry.getValue().toString())); } return osParams.toString(); }
[ "public", "String", "getUrlParams", "(", ")", "{", "StringBuffer", "osParams", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "Iterator", "i", "=", "this", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "i", ".", "hasNext", "(", "...
Generate the url parameter sequence used to pass this configuration to the editor. @return html endocode sequence of configuration parameters
[ "Generate", "the", "url", "parameter", "sequence", "used", "to", "pass", "this", "configuration", "to", "the", "editor", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.framework.web/src/main/java/org/exoplatform/frameworks/jcr/web/fckeditor/FCKeditorConfigurations.java#L47-L59
135,881
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/lock/NullResourceLocksHolder.java
NullResourceLocksHolder.addLock
public String addLock(Session session, String path) throws LockException { String repoPath = session.getRepository().hashCode() + "/" + session.getWorkspace().getName() + "/" + path; if (!nullResourceLocks.containsKey(repoPath)) { String newLockToken = IdGenerator.generate(); session.addLockToken(newLockToken); nullResourceLocks.put(repoPath, newLockToken); return newLockToken; } // check if lock owned by this session String currentToken = nullResourceLocks.get(repoPath); for (String t : session.getLockTokens()) { if (t.equals(currentToken)) return t; } throw new LockException("Resource already locked " + repoPath); }
java
public String addLock(Session session, String path) throws LockException { String repoPath = session.getRepository().hashCode() + "/" + session.getWorkspace().getName() + "/" + path; if (!nullResourceLocks.containsKey(repoPath)) { String newLockToken = IdGenerator.generate(); session.addLockToken(newLockToken); nullResourceLocks.put(repoPath, newLockToken); return newLockToken; } // check if lock owned by this session String currentToken = nullResourceLocks.get(repoPath); for (String t : session.getLockTokens()) { if (t.equals(currentToken)) return t; } throw new LockException("Resource already locked " + repoPath); }
[ "public", "String", "addLock", "(", "Session", "session", ",", "String", "path", ")", "throws", "LockException", "{", "String", "repoPath", "=", "session", ".", "getRepository", "(", ")", ".", "hashCode", "(", ")", "+", "\"/\"", "+", "session", ".", "getWo...
Locks the node. @param session current session @param path node path @return thee lock token key @throws LockException {@link LockException}
[ "Locks", "the", "node", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/lock/NullResourceLocksHolder.java#L60-L81
135,882
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/lock/NullResourceLocksHolder.java
NullResourceLocksHolder.removeLock
public void removeLock(Session session, String path) { String repoPath = session.getRepository().hashCode() + "/" + session.getWorkspace().getName() + "/" + path; String token = nullResourceLocks.get(repoPath); session.removeLockToken(token); nullResourceLocks.remove(repoPath); }
java
public void removeLock(Session session, String path) { String repoPath = session.getRepository().hashCode() + "/" + session.getWorkspace().getName() + "/" + path; String token = nullResourceLocks.get(repoPath); session.removeLockToken(token); nullResourceLocks.remove(repoPath); }
[ "public", "void", "removeLock", "(", "Session", "session", ",", "String", "path", ")", "{", "String", "repoPath", "=", "session", ".", "getRepository", "(", ")", ".", "hashCode", "(", ")", "+", "\"/\"", "+", "session", ".", "getWorkspace", "(", ")", ".",...
Removes lock from the node. @param session current session @param path nodepath
[ "Removes", "lock", "from", "the", "node", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/lock/NullResourceLocksHolder.java#L89-L95
135,883
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/lock/NullResourceLocksHolder.java
NullResourceLocksHolder.isLocked
public boolean isLocked(Session session, String path) { String repoPath = session.getRepository().hashCode() + "/" + session.getWorkspace().getName() + "/" + path; if (nullResourceLocks.get(repoPath) != null) { return true; } return false; }
java
public boolean isLocked(Session session, String path) { String repoPath = session.getRepository().hashCode() + "/" + session.getWorkspace().getName() + "/" + path; if (nullResourceLocks.get(repoPath) != null) { return true; } return false; }
[ "public", "boolean", "isLocked", "(", "Session", "session", ",", "String", "path", ")", "{", "String", "repoPath", "=", "session", ".", "getRepository", "(", ")", ".", "hashCode", "(", ")", "+", "\"/\"", "+", "session", ".", "getWorkspace", "(", ")", "."...
Checks if the node is locked. @param session current session @param path node path @return true if the node is locked false if not
[ "Checks", "if", "the", "node", "is", "locked", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/lock/NullResourceLocksHolder.java#L104-L113
135,884
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/lock/NullResourceLocksHolder.java
NullResourceLocksHolder.checkLock
public void checkLock(Session session, String path, List<String> tokens) throws LockException { String repoPath = session.getRepository().hashCode() + "/" + session.getWorkspace().getName() + "/" + path; String currentToken = nullResourceLocks.get(repoPath); if (currentToken == null) { return; } if (tokens != null) { for (String token : tokens) { if (token.equals(currentToken)) { return; } } } throw new LockException("Resource already locked " + repoPath); }
java
public void checkLock(Session session, String path, List<String> tokens) throws LockException { String repoPath = session.getRepository().hashCode() + "/" + session.getWorkspace().getName() + "/" + path; String currentToken = nullResourceLocks.get(repoPath); if (currentToken == null) { return; } if (tokens != null) { for (String token : tokens) { if (token.equals(currentToken)) { return; } } } throw new LockException("Resource already locked " + repoPath); }
[ "public", "void", "checkLock", "(", "Session", "session", ",", "String", "path", ",", "List", "<", "String", ">", "tokens", ")", "throws", "LockException", "{", "String", "repoPath", "=", "session", ".", "getRepository", "(", ")", ".", "hashCode", "(", ")"...
Checks if the node can be unlocked using current tokens. @param session current session @param path node path @param tokens tokens @throws LockException {@link LockException}
[ "Checks", "if", "the", "node", "can", "be", "unlocked", "using", "current", "tokens", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/lock/NullResourceLocksHolder.java#L123-L146
135,885
exoplatform/jcr
applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java
BackupClientImpl.getObject
private Object getObject(Class cl, byte[] data) throws Exception { JsonHandler jsonHandler = new JsonDefaultHandler(); JsonParser jsonParser = new JsonParserImpl(); InputStream inputStream = new ByteArrayInputStream(data); jsonParser.parse(inputStream, jsonHandler); JsonValue jsonValue = jsonHandler.getJsonObject(); return new BeanBuilder().createObject(cl, jsonValue); }
java
private Object getObject(Class cl, byte[] data) throws Exception { JsonHandler jsonHandler = new JsonDefaultHandler(); JsonParser jsonParser = new JsonParserImpl(); InputStream inputStream = new ByteArrayInputStream(data); jsonParser.parse(inputStream, jsonHandler); JsonValue jsonValue = jsonHandler.getJsonObject(); return new BeanBuilder().createObject(cl, jsonValue); }
[ "private", "Object", "getObject", "(", "Class", "cl", ",", "byte", "[", "]", "data", ")", "throws", "Exception", "{", "JsonHandler", "jsonHandler", "=", "new", "JsonDefaultHandler", "(", ")", ";", "JsonParser", "jsonParser", "=", "new", "JsonParserImpl", "(", ...
Will be created the Object from JSON binary data. @param cl Class @param data binary data (JSON) @return Object @throws Exception will be generated Exception
[ "Will", "be", "created", "the", "Object", "from", "JSON", "binary", "data", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java#L1008-L1017
135,886
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PropPatchCommand.java
PropPatchCommand.propPatch
public Response propPatch(Session session, String path, HierarchicalProperty body, List<String> tokens, String baseURI) { try { lockHolder.checkLock(session, path, tokens); Node node = (Node)session.getItem(path); WebDavNamespaceContext nsContext = new WebDavNamespaceContext(session); URI uri = new URI(TextUtil.escape(baseURI + node.getPath(), '%', true)); List<HierarchicalProperty> setList = Collections.emptyList(); if (body.getChild(new QName("DAV:", "set")) != null) { setList = setList(body); } List<HierarchicalProperty> removeList = Collections.emptyList(); if (body.getChild(new QName("DAV:", "remove")) != null) { removeList = removeList(body); } PropPatchResponseEntity entity = new PropPatchResponseEntity(nsContext, node, uri, setList, removeList); return Response.status(HTTPStatus.MULTISTATUS).entity(entity).type(MediaType.TEXT_XML).build(); } catch (PathNotFoundException exc) { return Response.status(HTTPStatus.NOT_FOUND).entity(exc.getMessage()).build(); } catch (LockException exc) { return Response.status(HTTPStatus.LOCKED).entity(exc.getMessage()).build(); } catch (Exception exc) { log.error(exc.getMessage(), exc); return Response.serverError().entity(exc.getMessage()).build(); } }
java
public Response propPatch(Session session, String path, HierarchicalProperty body, List<String> tokens, String baseURI) { try { lockHolder.checkLock(session, path, tokens); Node node = (Node)session.getItem(path); WebDavNamespaceContext nsContext = new WebDavNamespaceContext(session); URI uri = new URI(TextUtil.escape(baseURI + node.getPath(), '%', true)); List<HierarchicalProperty> setList = Collections.emptyList(); if (body.getChild(new QName("DAV:", "set")) != null) { setList = setList(body); } List<HierarchicalProperty> removeList = Collections.emptyList(); if (body.getChild(new QName("DAV:", "remove")) != null) { removeList = removeList(body); } PropPatchResponseEntity entity = new PropPatchResponseEntity(nsContext, node, uri, setList, removeList); return Response.status(HTTPStatus.MULTISTATUS).entity(entity).type(MediaType.TEXT_XML).build(); } catch (PathNotFoundException exc) { return Response.status(HTTPStatus.NOT_FOUND).entity(exc.getMessage()).build(); } catch (LockException exc) { return Response.status(HTTPStatus.LOCKED).entity(exc.getMessage()).build(); } catch (Exception exc) { log.error(exc.getMessage(), exc); return Response.serverError().entity(exc.getMessage()).build(); } }
[ "public", "Response", "propPatch", "(", "Session", "session", ",", "String", "path", ",", "HierarchicalProperty", "body", ",", "List", "<", "String", ">", "tokens", ",", "String", "baseURI", ")", "{", "try", "{", "lockHolder", ".", "checkLock", "(", "session...
Webdav Proppatch method method implementation. @param session current session @param path resource path @param body request body @param tokens tokens @param baseURI base uri @return the instance of javax.ws.rs.core.Response
[ "Webdav", "Proppatch", "method", "method", "implementation", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PropPatchCommand.java#L82-L126
135,887
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PropPatchCommand.java
PropPatchCommand.setList
public List<HierarchicalProperty> setList(HierarchicalProperty request) { HierarchicalProperty set = request.getChild(new QName("DAV:", "set")); HierarchicalProperty prop = set.getChild(new QName("DAV:", "prop")); List<HierarchicalProperty> setList = prop.getChildren(); return setList; }
java
public List<HierarchicalProperty> setList(HierarchicalProperty request) { HierarchicalProperty set = request.getChild(new QName("DAV:", "set")); HierarchicalProperty prop = set.getChild(new QName("DAV:", "prop")); List<HierarchicalProperty> setList = prop.getChildren(); return setList; }
[ "public", "List", "<", "HierarchicalProperty", ">", "setList", "(", "HierarchicalProperty", "request", ")", "{", "HierarchicalProperty", "set", "=", "request", ".", "getChild", "(", "new", "QName", "(", "\"DAV:\"", ",", "\"set\"", ")", ")", ";", "HierarchicalPro...
List of properties to set. @param request request body @return list of properties to set.
[ "List", "of", "properties", "to", "set", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PropPatchCommand.java#L134-L140
135,888
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PropPatchCommand.java
PropPatchCommand.removeList
public List<HierarchicalProperty> removeList(HierarchicalProperty request) { HierarchicalProperty remove = request.getChild(new QName("DAV:", "remove")); HierarchicalProperty prop = remove.getChild(new QName("DAV:", "prop")); List<HierarchicalProperty> removeList = prop.getChildren(); return removeList; }
java
public List<HierarchicalProperty> removeList(HierarchicalProperty request) { HierarchicalProperty remove = request.getChild(new QName("DAV:", "remove")); HierarchicalProperty prop = remove.getChild(new QName("DAV:", "prop")); List<HierarchicalProperty> removeList = prop.getChildren(); return removeList; }
[ "public", "List", "<", "HierarchicalProperty", ">", "removeList", "(", "HierarchicalProperty", "request", ")", "{", "HierarchicalProperty", "remove", "=", "request", ".", "getChild", "(", "new", "QName", "(", "\"DAV:\"", ",", "\"remove\"", ")", ")", ";", "Hierar...
List of properties to remove. @param request request body @return list of properties to remove.
[ "List", "of", "properties", "to", "remove", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PropPatchCommand.java#L148-L154
135,889
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/OrderPatchCommand.java
OrderPatchCommand.orderPatch
public Response orderPatch(Session session, String path, HierarchicalProperty body, String baseURI) { try { Node node = (Node)session.getItem(path); List<OrderMember> members = getMembers(body); WebDavNamespaceContext nsContext = new WebDavNamespaceContext(session); URI uri = new URI(TextUtil.escape(baseURI + node.getPath(), '%', true)); if (doOrder(node, members)) { return Response.ok().build(); } OrderPatchResponseEntity orderPatchEntity = new OrderPatchResponseEntity(nsContext, uri, node, members); return Response.status(HTTPStatus.MULTISTATUS).entity(orderPatchEntity).build(); } catch (PathNotFoundException exc) { return Response.status(HTTPStatus.NOT_FOUND).entity(exc.getMessage()).build(); } catch (LockException exc) { return Response.status(HTTPStatus.LOCKED).entity(exc.getMessage()).build(); } catch (Exception exc) { LOG.error(exc.getMessage(), exc); return Response.serverError().entity(exc.getMessage()).build(); } }
java
public Response orderPatch(Session session, String path, HierarchicalProperty body, String baseURI) { try { Node node = (Node)session.getItem(path); List<OrderMember> members = getMembers(body); WebDavNamespaceContext nsContext = new WebDavNamespaceContext(session); URI uri = new URI(TextUtil.escape(baseURI + node.getPath(), '%', true)); if (doOrder(node, members)) { return Response.ok().build(); } OrderPatchResponseEntity orderPatchEntity = new OrderPatchResponseEntity(nsContext, uri, node, members); return Response.status(HTTPStatus.MULTISTATUS).entity(orderPatchEntity).build(); } catch (PathNotFoundException exc) { return Response.status(HTTPStatus.NOT_FOUND).entity(exc.getMessage()).build(); } catch (LockException exc) { return Response.status(HTTPStatus.LOCKED).entity(exc.getMessage()).build(); } catch (Exception exc) { LOG.error(exc.getMessage(), exc); return Response.serverError().entity(exc.getMessage()).build(); } }
[ "public", "Response", "orderPatch", "(", "Session", "session", ",", "String", "path", ",", "HierarchicalProperty", "body", ",", "String", "baseURI", ")", "{", "try", "{", "Node", "node", "=", "(", "Node", ")", "session", ".", "getItem", "(", "path", ")", ...
Webdav OrderPatch method implementation. @param session current session @param path resource path @param body responce body @param baseURI base uri @return the instance of javax.ws.rs.core.Response
[ "Webdav", "OrderPatch", "method", "implementation", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/OrderPatchCommand.java#L74-L107
135,890
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/OrderPatchCommand.java
OrderPatchCommand.getMembers
protected List<OrderMember> getMembers(HierarchicalProperty body) { ArrayList<OrderMember> members = new ArrayList<OrderMember>(); List<HierarchicalProperty> childs = body.getChildren(); for (int i = 0; i < childs.size(); i++) { OrderMember member = new OrderMember(childs.get(i)); members.add(member); } return members; }
java
protected List<OrderMember> getMembers(HierarchicalProperty body) { ArrayList<OrderMember> members = new ArrayList<OrderMember>(); List<HierarchicalProperty> childs = body.getChildren(); for (int i = 0; i < childs.size(); i++) { OrderMember member = new OrderMember(childs.get(i)); members.add(member); } return members; }
[ "protected", "List", "<", "OrderMember", ">", "getMembers", "(", "HierarchicalProperty", "body", ")", "{", "ArrayList", "<", "OrderMember", ">", "members", "=", "new", "ArrayList", "<", "OrderMember", ">", "(", ")", ";", "List", "<", "HierarchicalProperty", ">...
Get oder members. @param body request body. @return list of members
[ "Get", "oder", "members", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/OrderPatchCommand.java#L115-L125
135,891
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/OrderPatchCommand.java
OrderPatchCommand.doOrder
protected boolean doOrder(Node parentNode, List<OrderMember> members) { boolean success = true; for (int i = 0; i < members.size(); i++) { OrderMember member = members.get(i); int status = HTTPStatus.OK; try { parentNode.getSession().refresh(false); String positionedNodeName = null; if (!parentNode.hasNode(member.getSegment())) { throw new PathNotFoundException(); } if (!new QName("DAV:", "last").equals(member.getPosition())) { NodeIterator nodeIter = parentNode.getNodes(); boolean finded = false; while (nodeIter.hasNext()) { Node curNode = nodeIter.nextNode(); if (new QName("DAV:", "first").equals(member.getPosition())) { positionedNodeName = curNode.getName(); finded = true; break; } if (new QName("DAV:", "before").equals(member.getPosition()) && curNode.getName().equals(member.getPositionSegment())) { positionedNodeName = curNode.getName(); finded = true; break; } if (new QName("DAV:", "after").equals(member.getPosition()) && curNode.getName().equals(member.getPositionSegment())) { if (nodeIter.hasNext()) { positionedNodeName = nodeIter.nextNode().getName(); } finded = true; break; } } if (!finded) { throw new AccessDeniedException(); } } parentNode.getSession().refresh(false); parentNode.orderBefore(member.getSegment(), positionedNodeName); parentNode.getSession().save(); } catch (LockException exc) { status = HTTPStatus.LOCKED; } catch (PathNotFoundException exc) { status = HTTPStatus.FORBIDDEN; } catch (AccessDeniedException exc) { status = HTTPStatus.FORBIDDEN; } catch (RepositoryException exc) { LOG.error(exc.getMessage(), exc); status = HTTPStatus.INTERNAL_ERROR; } member.setStatus(status); if (status != HTTPStatus.OK) { success = false; } } return success; }
java
protected boolean doOrder(Node parentNode, List<OrderMember> members) { boolean success = true; for (int i = 0; i < members.size(); i++) { OrderMember member = members.get(i); int status = HTTPStatus.OK; try { parentNode.getSession().refresh(false); String positionedNodeName = null; if (!parentNode.hasNode(member.getSegment())) { throw new PathNotFoundException(); } if (!new QName("DAV:", "last").equals(member.getPosition())) { NodeIterator nodeIter = parentNode.getNodes(); boolean finded = false; while (nodeIter.hasNext()) { Node curNode = nodeIter.nextNode(); if (new QName("DAV:", "first").equals(member.getPosition())) { positionedNodeName = curNode.getName(); finded = true; break; } if (new QName("DAV:", "before").equals(member.getPosition()) && curNode.getName().equals(member.getPositionSegment())) { positionedNodeName = curNode.getName(); finded = true; break; } if (new QName("DAV:", "after").equals(member.getPosition()) && curNode.getName().equals(member.getPositionSegment())) { if (nodeIter.hasNext()) { positionedNodeName = nodeIter.nextNode().getName(); } finded = true; break; } } if (!finded) { throw new AccessDeniedException(); } } parentNode.getSession().refresh(false); parentNode.orderBefore(member.getSegment(), positionedNodeName); parentNode.getSession().save(); } catch (LockException exc) { status = HTTPStatus.LOCKED; } catch (PathNotFoundException exc) { status = HTTPStatus.FORBIDDEN; } catch (AccessDeniedException exc) { status = HTTPStatus.FORBIDDEN; } catch (RepositoryException exc) { LOG.error(exc.getMessage(), exc); status = HTTPStatus.INTERNAL_ERROR; } member.setStatus(status); if (status != HTTPStatus.OK) { success = false; } } return success; }
[ "protected", "boolean", "doOrder", "(", "Node", "parentNode", ",", "List", "<", "OrderMember", ">", "members", ")", "{", "boolean", "success", "=", "true", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "members", ".", "size", "(", ")", ";", ...
Order members. @param parentNode parent node @param members members @return true if can order
[ "Order", "members", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/OrderPatchCommand.java#L134-L230
135,892
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBRestore.java
DBRestore.spoolInputStream
private InputStream spoolInputStream(ObjectReader in, long contentLen) throws IOException { byte[] buffer = new byte[0]; byte[] tmpBuff; long readLen = 0; File sf = null; OutputStream sfout = null; try { while (true) { int needToRead = contentLen - readLen > 2048 ? 2048 : (int)(contentLen - readLen); tmpBuff = new byte[needToRead]; if (needToRead == 0) { break; } in.readFully(tmpBuff); if (sfout != null) { sfout.write(tmpBuff); } else if (readLen + needToRead > maxBufferSize && fileCleaner != null) { sf = PrivilegedFileHelper.createTempFile("jcrvd", null, tempDir); sfout = PrivilegedFileHelper.fileOutputStream(sf); sfout.write(buffer); sfout.write(tmpBuff); buffer = null; } else { // reallocate new buffer and spool old buffer contents byte[] newBuffer = new byte[(int)(readLen + needToRead)]; System.arraycopy(buffer, 0, newBuffer, 0, (int)readLen); System.arraycopy(tmpBuff, 0, newBuffer, (int)readLen, needToRead); buffer = newBuffer; } readLen += needToRead; } if (buffer != null) { return new ByteArrayInputStream(buffer); } else { return PrivilegedFileHelper.fileInputStream(sf); } } finally { if (sfout != null) { sfout.close(); } if (sf != null) { spoolFileList.add(sf); } } }
java
private InputStream spoolInputStream(ObjectReader in, long contentLen) throws IOException { byte[] buffer = new byte[0]; byte[] tmpBuff; long readLen = 0; File sf = null; OutputStream sfout = null; try { while (true) { int needToRead = contentLen - readLen > 2048 ? 2048 : (int)(contentLen - readLen); tmpBuff = new byte[needToRead]; if (needToRead == 0) { break; } in.readFully(tmpBuff); if (sfout != null) { sfout.write(tmpBuff); } else if (readLen + needToRead > maxBufferSize && fileCleaner != null) { sf = PrivilegedFileHelper.createTempFile("jcrvd", null, tempDir); sfout = PrivilegedFileHelper.fileOutputStream(sf); sfout.write(buffer); sfout.write(tmpBuff); buffer = null; } else { // reallocate new buffer and spool old buffer contents byte[] newBuffer = new byte[(int)(readLen + needToRead)]; System.arraycopy(buffer, 0, newBuffer, 0, (int)readLen); System.arraycopy(tmpBuff, 0, newBuffer, (int)readLen, needToRead); buffer = newBuffer; } readLen += needToRead; } if (buffer != null) { return new ByteArrayInputStream(buffer); } else { return PrivilegedFileHelper.fileInputStream(sf); } } finally { if (sfout != null) { sfout.close(); } if (sf != null) { spoolFileList.add(sf); } } }
[ "private", "InputStream", "spoolInputStream", "(", "ObjectReader", "in", ",", "long", "contentLen", ")", "throws", "IOException", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "0", "]", ";", "byte", "[", "]", "tmpBuff", ";", "long", "readLen", ...
Spool input stream.
[ "Spool", "input", "stream", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBRestore.java#L639-L707
135,893
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataRemoveVisitor.java
ItemDataRemoveVisitor.copyItemDataDelete
protected TransientItemData copyItemDataDelete(final ItemData item) throws RepositoryException { if (item == null) { return null; } // make a copy if (item.isNode()) { final NodeData node = (NodeData)item; // the node ACL can't be are null as ACL manager does care about this final AccessControlList acl = node.getACL(); if (acl == null) { throw new RepositoryException("Node ACL is null. " + node.getQPath().getAsString() + " " + node.getIdentifier()); } return new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(), node.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(), node.getParentIdentifier(), acl); } // else - property final PropertyData prop = (PropertyData)item; // make a copy, value wil be null for deleting items TransientPropertyData newData = new TransientPropertyData(prop.getQPath(), prop.getIdentifier(), prop.getPersistedVersion(), prop.getType(), prop.getParentIdentifier(), prop.isMultiValued()); return newData; }
java
protected TransientItemData copyItemDataDelete(final ItemData item) throws RepositoryException { if (item == null) { return null; } // make a copy if (item.isNode()) { final NodeData node = (NodeData)item; // the node ACL can't be are null as ACL manager does care about this final AccessControlList acl = node.getACL(); if (acl == null) { throw new RepositoryException("Node ACL is null. " + node.getQPath().getAsString() + " " + node.getIdentifier()); } return new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(), node.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(), node.getParentIdentifier(), acl); } // else - property final PropertyData prop = (PropertyData)item; // make a copy, value wil be null for deleting items TransientPropertyData newData = new TransientPropertyData(prop.getQPath(), prop.getIdentifier(), prop.getPersistedVersion(), prop.getType(), prop.getParentIdentifier(), prop.isMultiValued()); return newData; }
[ "protected", "TransientItemData", "copyItemDataDelete", "(", "final", "ItemData", "item", ")", "throws", "RepositoryException", "{", "if", "(", "item", "==", "null", ")", "{", "return", "null", ";", "}", "// make a copy", "if", "(", "item", ".", "isNode", "(",...
Copy ItemData for Delete operation. @param item ItemData @return TransientItemData @throws RepositoryException if error occurs
[ "Copy", "ItemData", "for", "Delete", "operation", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataRemoveVisitor.java#L309-L343
135,894
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/AbstractItemDataCopyVisitor.java
AbstractItemDataCopyVisitor.copyValues
protected List<ValueData> copyValues(PropertyData property) throws RepositoryException { List<ValueData> src = property.getValues(); List<ValueData> copy = new ArrayList<ValueData>(src.size()); try { for (ValueData vd : src) { copy.add(ValueDataUtil.createTransientCopy(vd)); } } catch (IOException e) { throw new RepositoryException("Error of Value copy " + property.getQPath().getAsString(), e); } return copy; }
java
protected List<ValueData> copyValues(PropertyData property) throws RepositoryException { List<ValueData> src = property.getValues(); List<ValueData> copy = new ArrayList<ValueData>(src.size()); try { for (ValueData vd : src) { copy.add(ValueDataUtil.createTransientCopy(vd)); } } catch (IOException e) { throw new RepositoryException("Error of Value copy " + property.getQPath().getAsString(), e); } return copy; }
[ "protected", "List", "<", "ValueData", ">", "copyValues", "(", "PropertyData", "property", ")", "throws", "RepositoryException", "{", "List", "<", "ValueData", ">", "src", "=", "property", ".", "getValues", "(", ")", ";", "List", "<", "ValueData", ">", "copy...
Do actual copy of the property ValueDatas. @param property PropertyData @return List of ValueData @throws RepositoryException if I/O error occurs
[ "Do", "actual", "copy", "of", "the", "property", "ValueDatas", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/AbstractItemDataCopyVisitor.java#L58-L75
135,895
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/NodeTypeDataBuilder.java
NodeTypeDataBuilder.build
public NodeTypeData build() { if (nodeDefinitionDataBuilders.size() > 0) { childNodeDefinitions = new NodeDefinitionData[nodeDefinitionDataBuilders.size()]; for (int i = 0; i < childNodeDefinitions.length; i++) { childNodeDefinitions[i] = nodeDefinitionDataBuilders.get(i).build(); } } if (propertyDefinitionDataBuilders.size() > 0) { propertyDefinitions = new PropertyDefinitionData[propertyDefinitionDataBuilders.size()]; for (int i = 0; i < propertyDefinitions.length; i++) { propertyDefinitions[i] = propertyDefinitionDataBuilders.get(i).build(); } } return new NodeTypeDataImpl(name, primaryItemName, isMixin, isOrderable, supertypes, propertyDefinitions, childNodeDefinitions); }
java
public NodeTypeData build() { if (nodeDefinitionDataBuilders.size() > 0) { childNodeDefinitions = new NodeDefinitionData[nodeDefinitionDataBuilders.size()]; for (int i = 0; i < childNodeDefinitions.length; i++) { childNodeDefinitions[i] = nodeDefinitionDataBuilders.get(i).build(); } } if (propertyDefinitionDataBuilders.size() > 0) { propertyDefinitions = new PropertyDefinitionData[propertyDefinitionDataBuilders.size()]; for (int i = 0; i < propertyDefinitions.length; i++) { propertyDefinitions[i] = propertyDefinitionDataBuilders.get(i).build(); } } return new NodeTypeDataImpl(name, primaryItemName, isMixin, isOrderable, supertypes, propertyDefinitions, childNodeDefinitions); }
[ "public", "NodeTypeData", "build", "(", ")", "{", "if", "(", "nodeDefinitionDataBuilders", ".", "size", "(", ")", ">", "0", ")", "{", "childNodeDefinitions", "=", "new", "NodeDefinitionData", "[", "nodeDefinitionDataBuilders", ".", "size", "(", ")", "]", ";", ...
Creates instance of NodeTypeData using parameters stored in this object. @return NodeTypeData
[ "Creates", "instance", "of", "NodeTypeData", "using", "parameters", "stored", "in", "this", "object", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/NodeTypeDataBuilder.java#L378-L398
135,896
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/utils/VersionHistoryUtils.java
VersionHistoryUtils.createVersion
public static void createVersion(Node nodeVersioning) throws Exception { if(!nodeVersioning.isNodeType(NT_FILE)) { if(log.isDebugEnabled()){ log.debug("Version history is not impact with non-nt:file documents, there'is not any version created."); } return; } if(!nodeVersioning.isNodeType(MIX_VERSIONABLE)){ if(nodeVersioning.canAddMixin(MIX_VERSIONABLE)) { nodeVersioning.addMixin(MIX_VERSIONABLE); nodeVersioning.save(); } return; } if (!nodeVersioning.isCheckedOut()) { nodeVersioning.checkout(); } else { nodeVersioning.checkin(); nodeVersioning.checkout(); } if(maxAllowVersion!= DOCUMENT_AUTO_DEFAULT_VERSION_MAX || maxLiveTime != DOCUMENT_AUTO_DEFAULT_VERSION_EXPIRED) { removeRedundant(nodeVersioning); } nodeVersioning.save(); }
java
public static void createVersion(Node nodeVersioning) throws Exception { if(!nodeVersioning.isNodeType(NT_FILE)) { if(log.isDebugEnabled()){ log.debug("Version history is not impact with non-nt:file documents, there'is not any version created."); } return; } if(!nodeVersioning.isNodeType(MIX_VERSIONABLE)){ if(nodeVersioning.canAddMixin(MIX_VERSIONABLE)) { nodeVersioning.addMixin(MIX_VERSIONABLE); nodeVersioning.save(); } return; } if (!nodeVersioning.isCheckedOut()) { nodeVersioning.checkout(); } else { nodeVersioning.checkin(); nodeVersioning.checkout(); } if(maxAllowVersion!= DOCUMENT_AUTO_DEFAULT_VERSION_MAX || maxLiveTime != DOCUMENT_AUTO_DEFAULT_VERSION_EXPIRED) { removeRedundant(nodeVersioning); } nodeVersioning.save(); }
[ "public", "static", "void", "createVersion", "(", "Node", "nodeVersioning", ")", "throws", "Exception", "{", "if", "(", "!", "nodeVersioning", ".", "isNodeType", "(", "NT_FILE", ")", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", ...
Create new version and clear redundant versions @param nodeVersioning
[ "Create", "new", "version", "and", "clear", "redundant", "versions" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/utils/VersionHistoryUtils.java#L75-L105
135,897
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/utils/VersionHistoryUtils.java
VersionHistoryUtils.removeRedundant
private static void removeRedundant(Node nodeVersioning) throws Exception{ VersionHistory versionHistory = nodeVersioning.getVersionHistory(); String baseVersion = nodeVersioning.getBaseVersion().getName(); String rootVersion = nodeVersioning.getVersionHistory().getRootVersion().getName(); VersionIterator versions = versionHistory.getAllVersions(); Date currentDate = new Date(); Map<String, String> lstVersions = new HashMap<String, String>(); List<String> lstVersionTime = new ArrayList<String>(); while (versions.hasNext()) { Version version = versions.nextVersion(); if(rootVersion.equals(version.getName()) || baseVersion.equals(version.getName())) continue; if (maxLiveTime!= DOCUMENT_AUTO_DEFAULT_VERSION_EXPIRED && currentDate.getTime() - version.getCreated().getTime().getTime() > maxLiveTime) { versionHistory.removeVersion(version.getName()); } else { lstVersions.put(String.valueOf(version.getCreated().getTimeInMillis()), version.getName()); lstVersionTime.add(String.valueOf(version.getCreated().getTimeInMillis())); } } if (maxAllowVersion <= lstVersionTime.size() && maxAllowVersion!= DOCUMENT_AUTO_DEFAULT_VERSION_MAX) { Collections.sort(lstVersionTime); String[] lsts = lstVersionTime.toArray(new String[lstVersionTime.size()]); for (int j = 0; j <= lsts.length - maxAllowVersion; j++) { versionHistory.removeVersion(lstVersions.get(lsts[j])); } } }
java
private static void removeRedundant(Node nodeVersioning) throws Exception{ VersionHistory versionHistory = nodeVersioning.getVersionHistory(); String baseVersion = nodeVersioning.getBaseVersion().getName(); String rootVersion = nodeVersioning.getVersionHistory().getRootVersion().getName(); VersionIterator versions = versionHistory.getAllVersions(); Date currentDate = new Date(); Map<String, String> lstVersions = new HashMap<String, String>(); List<String> lstVersionTime = new ArrayList<String>(); while (versions.hasNext()) { Version version = versions.nextVersion(); if(rootVersion.equals(version.getName()) || baseVersion.equals(version.getName())) continue; if (maxLiveTime!= DOCUMENT_AUTO_DEFAULT_VERSION_EXPIRED && currentDate.getTime() - version.getCreated().getTime().getTime() > maxLiveTime) { versionHistory.removeVersion(version.getName()); } else { lstVersions.put(String.valueOf(version.getCreated().getTimeInMillis()), version.getName()); lstVersionTime.add(String.valueOf(version.getCreated().getTimeInMillis())); } } if (maxAllowVersion <= lstVersionTime.size() && maxAllowVersion!= DOCUMENT_AUTO_DEFAULT_VERSION_MAX) { Collections.sort(lstVersionTime); String[] lsts = lstVersionTime.toArray(new String[lstVersionTime.size()]); for (int j = 0; j <= lsts.length - maxAllowVersion; j++) { versionHistory.removeVersion(lstVersions.get(lsts[j])); } } }
[ "private", "static", "void", "removeRedundant", "(", "Node", "nodeVersioning", ")", "throws", "Exception", "{", "VersionHistory", "versionHistory", "=", "nodeVersioning", ".", "getVersionHistory", "(", ")", ";", "String", "baseVersion", "=", "nodeVersioning", ".", "...
Remove redundant version - Remove versions has been expired - Remove versions over max allow @param nodeVersioning @throws Exception
[ "Remove", "redundant", "version", "-", "Remove", "versions", "has", "been", "expired", "-", "Remove", "versions", "over", "max", "allow" ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/utils/VersionHistoryUtils.java#L114-L141
135,898
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
ISPNCacheWorkspaceStorageCache.getChildProps
protected List<PropertyData> getChildProps(String parentId, boolean withValue) { return getChildProps.run(parentId, withValue); }
java
protected List<PropertyData> getChildProps(String parentId, boolean withValue) { return getChildProps.run(parentId, withValue); }
[ "protected", "List", "<", "PropertyData", ">", "getChildProps", "(", "String", "parentId", ",", "boolean", "withValue", ")", "{", "return", "getChildProps", ".", "run", "(", "parentId", ",", "withValue", ")", ";", "}" ]
Internal get child properties. @param parentId String @param withValue boolean, if true only "full" Propeties can be returned @return List of PropertyData
[ "Internal", "get", "child", "properties", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java#L1244-L1247
135,899
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
ISPNCacheWorkspaceStorageCache.putItem
protected ItemData putItem(ItemData item) { if (item.isNode()) { return putNode((NodeData)item, ModifyChildOption.MODIFY); } else { return putProperty((PropertyData)item, ModifyChildOption.MODIFY); } }
java
protected ItemData putItem(ItemData item) { if (item.isNode()) { return putNode((NodeData)item, ModifyChildOption.MODIFY); } else { return putProperty((PropertyData)item, ModifyChildOption.MODIFY); } }
[ "protected", "ItemData", "putItem", "(", "ItemData", "item", ")", "{", "if", "(", "item", ".", "isNode", "(", ")", ")", "{", "return", "putNode", "(", "(", "NodeData", ")", "item", ",", "ModifyChildOption", ".", "MODIFY", ")", ";", "}", "else", "{", ...
Internal put Item. @param item ItemData, new data to put in the cache @return ItemData, previous data or null
[ "Internal", "put", "Item", "." ]
3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java#L1287-L1297