本文整理了Java中org.alfresco.repo.virtual.ref.ZeroReferenceParser
类的一些代码示例,展示了ZeroReferenceParser
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZeroReferenceParser
类的具体详情如下:
包路径:org.alfresco.repo.virtual.ref.ZeroReferenceParser
类名称:ZeroReferenceParser
暂无
代码示例来源:origin: org.alfresco/alfresco-repository
if (resourceEncoding == PATH_CODE)
resource = new RepositoryResource(parseRepositoryPath(cursor));
resource = new RepositoryResource(parseRepositoryNode(cursor));
resource = parseClasspathResource(cursor);
代码示例来源:origin: org.alfresco/alfresco-repository
/**
* Creates a {@link ReferenceParameter} reference from the cursor's tokens up
* to the * token which signifies the end of the current
* {@link ReferenceParameter}.
*
* @param cursor
* @return A {@link ReferenceParameter} reference.
*/
private ReferenceParameter parseReferenceParameter(Cursor cursor) throws ReferenceParseException
{
Reference reference = parseReference(cursor);
ReferenceParameter parameter = new ReferenceParameter(reference);
return parameter;
}
}
代码示例来源:origin: org.alfresco/alfresco-repository
parameters.add(parseResourceParameter(cursor));
parameters.add(parseStringParameter(cursor));
parameters.add(parseReferenceParameter(cursor));
代码示例来源:origin: Alfresco/alfresco-repository
private void compress(String referenceString, Encoding uncompressedEnc, Encoding compressedEnc, String trueMessage,
String debugMessage) throws Exception
{
Reference ref = new ZeroReferenceParser().parse(referenceString);
double testRatio = this.compressionRatio(ref,
uncompressedEnc,
compressedEnc);
if (logger.isDebugEnabled())
{
logger.debug(testRatio + debugMessage);
}
assertTrue(trueMessage,
testRatio < 100);
}
代码示例来源:origin: Alfresco/alfresco-repository
final Resource resource = parseResource(protocolResourceEncoding,
cursor);
final List<Parameter> parameters = parseParameters(cursor);
代码示例来源:origin: org.alfresco/alfresco-repository
/**
* Parses a {@link Resource} reference which is an instance of
* {@link RepositoryResource} or {@link ClasspathResource}, depending on the
* {@link ZeroEncoding#RESOURCE_PARAMETER}
*
* @param cursor
* @return A {@link Resource} reference.
* @throws ReferenceParseException
*/
private Resource parseResource(Cursor cursor) throws ReferenceParseException
{
return this.parseResource(Byte.parseByte(cursor.tokens[cursor.i - 1]),
cursor);
}
代码示例来源:origin: Alfresco/alfresco-repository
@Test
public void testParseRepositoryPath() throws Exception
{
Reference reference = new ZeroReferenceParser().parse("3:/Foo/Bar");
assertEquals(reference,
new Reference(Encodings.ZERO.encoding,
Protocols.VIRTUAL.protocol,
new RepositoryResource(new RepositoryPath("/Foo/Bar"))));
}
代码示例来源:origin: org.alfresco/alfresco-repository
final Resource resource = parseResource(protocolResourceEncoding,
cursor);
final List<Parameter> parameters = parseParameters(cursor);
代码示例来源:origin: Alfresco/alfresco-repository
/**
* Parses a {@link Resource} reference which is an instance of
* {@link RepositoryResource} or {@link ClasspathResource}, depending on the
* {@link ZeroEncoding#RESOURCE_PARAMETER}
*
* @param cursor
* @return A {@link Resource} reference.
* @throws ReferenceParseException
*/
private Resource parseResource(Cursor cursor) throws ReferenceParseException
{
return this.parseResource(Byte.parseByte(cursor.tokens[cursor.i - 1]),
cursor);
}
代码示例来源:origin: Alfresco/alfresco-repository
@Test
public void testParseRepositoryNodeRef() throws Exception
{
Reference reference = new ZeroReferenceParser().parse("4:0029-222-333-444");
assertEquals(reference,
new Reference(Encodings.ZERO.encoding,
Protocols.VIRTUAL.protocol,
new RepositoryResource(new RepositoryNodeRef(new NodeRef("workspace://SpacesStore/0029-222-333-444")))));
}
代码示例来源:origin: Alfresco/alfresco-repository
if (resourceEncoding == PATH_CODE)
resource = new RepositoryResource(parseRepositoryPath(cursor));
resource = new RepositoryResource(parseRepositoryNode(cursor));
resource = parseClasspathResource(cursor);
代码示例来源:origin: Alfresco/alfresco-repository
parameters.add(parseResourceParameter(cursor));
parameters.add(parseStringParameter(cursor));
parameters.add(parseReferenceParameter(cursor));
代码示例来源:origin: Alfresco/alfresco-repository
/**
* Creates a {@link Parameter} reference that is an instance of
* {@link ResourceParameter} by parsing the resource given by the cursor's
* current token.
*
* @param cursor
* @return a {@link Parameter} reference that is instance of
* {@link ResourceParameter} from the cursor parameter
* @throws ReferenceParseException
*/
private Parameter parseResourceParameter(Cursor cursor) throws ReferenceParseException
{
Resource resource = parseResource(cursor);
return new ResourceParameter(resource);
}
代码示例来源:origin: Alfresco/alfresco-repository
/**
* Creates a {@link ReferenceParameter} reference from the cursor's tokens up
* to the * token which signifies the end of the current
* {@link ReferenceParameter}.
*
* @param cursor
* @return A {@link ReferenceParameter} reference.
*/
private ReferenceParameter parseReferenceParameter(Cursor cursor) throws ReferenceParseException
{
Reference reference = parseReference(cursor);
ReferenceParameter parameter = new ReferenceParameter(reference);
return parameter;
}
}
代码示例来源:origin: Alfresco/alfresco-repository
Reference reference = new ZeroReferenceParser().parse("7:0029-222-333-444:1:0029-122-333-0023");
reference = new ZeroReferenceParser().parse("7:0029-222-333-444:0:/Foo/Bar");
reference = new ZeroReferenceParser().parse("7:0029-222-333-444:0:/Foo/Bar:s:smf_smartFolder");
代码示例来源:origin: org.alfresco/alfresco-repository
/**
* Creates a {@link Parameter} reference that is an instance of
* {@link ResourceParameter} by parsing the resource given by the cursor's
* current token.
*
* @param cursor
* @return a {@link Parameter} reference that is instance of
* {@link ResourceParameter} from the cursor parameter
* @throws ReferenceParseException
*/
private Parameter parseResourceParameter(Cursor cursor) throws ReferenceParseException
{
Resource resource = parseResource(cursor);
return new ResourceParameter(resource);
}
代码示例来源:origin: org.alfresco/alfresco-repository
/**
* Parses a String representation of a {@link Reference} and returns the
* corresponding {@link Reference}. Parsing is done with the help of the
* {@link Cursor} class, which keeps track of the String elements that make
* up the {@link Reference} String representation. This method instantiates
* and initiates the cursor and checks the validity of the referenceString
* and relies upon the {@link ZeroReferenceParser#parseReference} for the
* actual parsing.
*
* @param referenceString the String representation of a {@link Reference}.
* @return the newly created {@link Reference}
* @throws ReferenceParseException
*/
@Override
public Reference parse(String referenceString) throws ReferenceParseException
{
String[] referenceTokens = referenceString.split(DELIMITER);
final Cursor cursor = new Cursor(referenceTokens,
0);
if (referenceTokens.length < 2)
{
throw new ReferenceParseException("Invalid reference " + referenceString);
}
return this.parseReference(cursor);
}
代码示例来源:origin: Alfresco/alfresco-repository
@Test
public void testReferenceDelimiter()
Reference parsedRef = new ZeroReferenceParser()
.parse("6:/Company Home/Data Dictionary/:r:2:/org/alfresco/repo/virtual/node/vanilla.js:s:/6:1:67c8f11d-0936-4295-88a0-12b85764c76f:1:6428d7cc-feaa-4e32-a983-0b357439a994:*");
List<Parameter> params = Arrays
.<Parameter> asList(new StringParameter("/6"),
createdRef);
Reference parsedRef1 = new ZeroReferenceParser()
.parse("6:/Company Home/Data Dictionary/:r:2:/org/alfresco/repo/virtual/node/vanilla.js:s:/6:1:67c8f11d-0936-4295-88a0-12b85764c76f:1:6428d7cc-feaa-4e32-a983-0b357439a994:*:r:2:/org/alfresco/repo/virtual/node/vanilla.js:s:/6:1:67c8f11d-0936-4295-88a0-12b85764c76f:1:6428d7cc-feaa-4e32-a983-0b357439a994:*");
List<Parameter> params1 = Arrays
.<Parameter> asList(new StringParameter("/6"),
createdRef1);
Reference parsedRef2 = new ZeroReferenceParser()
.parse("6:/Company Home/Data Dictionary/:r:2:/org/alfresco/repo/virtual/node/vanilla.js:s:/6:1:67c8f11d-0936-4295-88a0-12b85764c76f:1:6428d7cc-feaa-4e32-a983-0b357439a994:*:s:test:s:exit:r:2:/org/alfresco/repo/virtual/node/vanilla.js:s:/6:1:67c8f11d-0936-4295-88a0-12b85764c76f:1:6428d7cc-feaa-4e32-a983-0b357439a994:*:s:roro");
List<Parameter> prms2 = Arrays.<Parameter> asList(new ReferenceParameter(innerRef1),
new StringParameter("test"),
代码示例来源:origin: Alfresco/alfresco-repository
/**
* Parses a String representation of a {@link Reference} and returns the
* corresponding {@link Reference}. Parsing is done with the help of the
* {@link Cursor} class, which keeps track of the String elements that make
* up the {@link Reference} String representation. This method instantiates
* and initiates the cursor and checks the validity of the referenceString
* and relies upon the {@link ZeroReferenceParser#parseReference} for the
* actual parsing.
*
* @param referenceString the String representation of a {@link Reference}.
* @return the newly created {@link Reference}
* @throws ReferenceParseException
*/
@Override
public Reference parse(String referenceString) throws ReferenceParseException
{
String[] referenceTokens = referenceString.split(DELIMITER);
final Cursor cursor = new Cursor(referenceTokens,
0);
if (referenceTokens.length < 2)
{
throw new ReferenceParseException("Invalid reference " + referenceString);
}
return this.parseReference(cursor);
}
内容来源于网络,如有侵权,请联系作者删除!