本文整理了Java中javax.jcr.Session.exportSystemView()
方法的一些代码示例,展示了Session.exportSystemView()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Session.exportSystemView()
方法的具体详情如下:
包路径:javax.jcr.Session
类名称:Session
方法名:exportSystemView
[英]Serializes the node (and if noRecurse
is false
, the whole subgraph) at absPath
as an XML stream and outputs it to the supplied OutputStream
. The resulting XML is in the system view form. Note that absPath
must be the path of a node, not a property.
If skipBinary
is true then any properties of PropertyType.BINARY
will be serialized as if they are empty. That is, the existence of the property will be serialized, but its content will not appear in the serialized output (the <sv:value>
element will have no content). Note that in the case of multi-value BINARY
properties, the number of values in the property will be reflected in the serialized output, though they will all be empty. If skipBinary
is false then the actual value(s) of each BINARY
property is recorded using Base64 encoding.
If noRecurse
is true then only the node at absPath
and its properties, but not its child nodes, are serialized. If noRecurse
is false
then the entire subgraph rooted at absPath
is serialized.
If the user lacks read access to some subsection of the specified tree, that section simply does not get serialized, since, from the user's point of view, it is not there.
The serialized output will reflect the state of the current workspace as modified by the state of this Session
. This means that pending changes (regardless of whether they are valid according to node type constraints) and all namespace mappings in the namespace registry, as modified by the current session-mappings, are reflected in the output.
The output XML will be encoded in UTF-8.
It is the responsibility of the caller to close the passed OutputStream
.
[中]将absPath
处的节点(如果noRecurse
是false
,则整个子图)序列化为XML流,并将其输出到提供的OutputStream
。生成的XML是系统视图形式。请注意absPath
必须是节点的路径,而不是属性。
如果skipBinary
为真,则PropertyType.BINARY
的任何属性都将被序列化,就像它们是空的一样。也就是说,属性的存在将被序列化,但其内容不会出现在序列化的输出中(<sv:value>
元素将没有内容)。请注意,在多值BINARY
属性的情况下,属性中的值数将反映在序列化输出中,尽管它们都是空的。如果skipBinary
为false,则使用Base64编码记录每个BINARY
属性的实际值。
如果noRecurse
为true,则只序列化absPath
处的节点及其属性,而不序列化其子节点。如果noRecurse
为false
,则以absPath
为根的整个子图将被序列化。
如果用户缺乏对指定树的某个子部分的读取权限,该部分就不会被序列化,因为从用户的角度来看,它不在那里。
序列化输出将反映当前工作区的状态,该状态由该Session
的状态修改。这意味着挂起的更改(无论根据节点类型约束这些更改是否有效)和命名空间注册表中由当前会话映射修改的所有命名空间映射都会反映在输出中。
输出XML将以UTF-8编码。
来电者有责任关闭已通过的OutputStream
。
代码示例来源:origin: net.adamcin.oakpal/oakpal-core
@Override
public void exportSystemView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse)
throws SAXException, RepositoryException {
delegate.exportSystemView(absPath, contentHandler, skipBinary, noRecurse);
}
代码示例来源:origin: apache/jackrabbit
/** {@inheritDoc} */
public byte[] exportSystemView(
String path, boolean binaryAsLink, boolean noRecurse)
throws IOException, RepositoryException, RemoteException {
try {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
session.exportSystemView(path, buffer, binaryAsLink, noRecurse);
return buffer.toByteArray();
} catch (RepositoryException ex) {
throw getRepositoryException(ex);
}
}
代码示例来源:origin: com.geeoz.atom/atom-api
@Override
public void exportXML(final String workspace, final OutputStream stream)
throws RepositoryException, IOException {
final Session session = login(workspace);
session.exportSystemView(
Workspace.PATH_WORKSPACE_ROOT, stream, false, false);
session.logout();
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jca
/**
* Export system view.
*/
public void exportSystemView(String arg0, ContentHandler arg1, boolean arg2, boolean arg3)
throws PathNotFoundException, SAXException, RepositoryException {
getSession().exportSystemView(arg0, arg1, arg2, arg3);
}
代码示例来源:origin: apache/jackrabbit
/**
* @throws RepositoryException
* @throws SAXException
* @throws IOException
*/
public void doTestWithHandler(boolean skipBinary, boolean noRecurse)
throws RepositoryException, SAXException, IOException {
ContentHandler contentHandler = new SysViewContentHandler(testPath, session, skipBinary, noRecurse);
session.exportSystemView(testPath, contentHandler, skipBinary, noRecurse);
}
代码示例来源:origin: org.chtijbug.drools/guvnor-repository
public byte[] dumpModuleFromRepositoryXml(String moduleName) throws PathNotFoundException,
IOException,
RepositoryException {
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
session.refresh(false);
session.exportSystemView("/" + RULES_REPOSITORY_NAME + "/" + MODULE_AREA + "/" + moduleName,
byteOut,
false,
false);
return byteOut.toByteArray();
}
代码示例来源:origin: brix-cms/brix-cms
public void exportSystemView(String absPath, OutputStream out, boolean skipBinary,
boolean noRecurse) throws IOException, RepositoryException {
getDelegate().exportSystemView(absPath, out, skipBinary, noRecurse);
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
@Override
default void exportSystemView(final String absPath,
final OutputStream out,
final boolean skipBinary,
final boolean noRecurse)
throws IOException, PathNotFoundException, RepositoryException {
unwrapSession().exportSystemView(absPath, out, skipBinary, noRecurse);
}
代码示例来源:origin: apache/jackrabbit
/**
* Export system view.
*/
public void exportSystemView(String arg0, OutputStream arg1, boolean arg2, boolean arg3)
throws IOException, PathNotFoundException, RepositoryException {
getSession().exportSystemView(arg0, arg1, arg2, arg3);
}
代码示例来源:origin: apache/jackrabbit
/**
* Export system view.
*/
public void exportSystemView(String arg0, ContentHandler arg1, boolean arg2, boolean arg3)
throws PathNotFoundException, SAXException, RepositoryException {
getSession().exportSystemView(arg0, arg1, arg2, arg3);
}
代码示例来源:origin: ModeShape/modeshape
@Override
public void exportSystemView( String string,
ContentHandler ch,
boolean bln,
boolean bln1 ) throws PathNotFoundException, SAXException, RepositoryException {
session().exportSystemView(string, ch, bln, bln1);
}
代码示例来源:origin: org.drools/guvnor-repository
public byte[] dumpModuleFromRepositoryXml(String moduleName) throws PathNotFoundException,
IOException,
RepositoryException {
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
session.refresh(false);
session.exportSystemView("/" + RULES_REPOSITORY_NAME + "/" + MODULE_AREA + "/" + moduleName,
byteOut,
false,
false);
return byteOut.toByteArray();
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jca
/**
* Export system view.
*/
public void exportSystemView(String arg0, OutputStream arg1, boolean arg2, boolean arg3)
throws IOException, PathNotFoundException, RepositoryException {
getSession().exportSystemView(arg0, arg1, arg2, arg3);
}
代码示例来源:origin: stackoverflow.com
Session securitySession = session.getRepository().login(new SimpleCredentials("admin", "XXX".toCharArray()), "security");
OutputStream output = new FileOutputStream("d:\\bk.xml");
securitySession.exportSystemView("/rep:security", output, false, false);
output.flush();
output.close();
代码示例来源:origin: org.apache.jackrabbit.vault/org.apache.jackrabbit.vault
private Node sysCopy(Node src, Node dstParent, String dstName) throws RepositoryException {
try {
ContentHandler handler = dstParent.getSession().getImportContentHandler(dstParent.getPath(), ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
src.getSession().exportSystemView(src.getPath(), handler, true, false);
return dstParent.getNode(dstName);
} catch (SAXException e) {
throw new RepositoryException("Unable to perform sysview copy", e);
}
}
代码示例来源:origin: net.adamcin.recap/net.adamcin.recap.core
private Node sysCopy(Node src, Node dstParent, String dstName)
throws RepositoryException {
try {
ContentHandler handler = dstParent.getSession().getImportContentHandler(dstParent.getPath(), 0);
src.getSession().exportSystemView(src.getPath(), handler, true, false);
return dstParent.getNode(dstName);
} catch (SAXException e) {
throw new RepositoryException("Unable to perform sysview copy", e);
}
}
代码示例来源:origin: com.bstek.urule/urule-console
public void exportXml(String projectPath, OutputStream outputStream) throws Exception{
if(!permissionService.isAdmin()){
throw new NoPermissionException();
}
session.exportSystemView(projectPath, outputStream, false, false);
}
代码示例来源:origin: apache/jackrabbit-oak
private InputStream getImportStream() throws RepositoryException, IOException {
OutputStream out = new ByteArrayOutputStream();
superuser.exportSystemView(path, out, true, false);
return new ByteArrayInputStream(out.toString().getBytes());
}
代码示例来源:origin: apache/jackrabbit-oak
private InputStream getImportStream() throws RepositoryException, IOException {
OutputStream out = new ByteArrayOutputStream();
superuser.exportSystemView(path, out, true, false);
return new ByteArrayInputStream(out.toString().getBytes());
}
代码示例来源:origin: org.chtijbug.drools/guvnor-repository
@Test
public void testSimpleImportExport() throws PathNotFoundException, IOException, RepositoryException {
RulesRepository repo = getRepo();
byte[] repository_backup;
ByteArrayOutputStream bout = new ByteArrayOutputStream();
Session session = getRepo().getSession();
session.refresh( false );
session.exportSystemView( "/" + "drools:repository", bout, false, false );
repository_backup = bout.toByteArray();
repo.importRulesRepositoryFromStream(new ByteArrayInputStream(
repository_backup));
}
内容来源于网络,如有侵权,请联系作者删除!