本文整理了Java中org.wso2.carbon.registry.core.Resource.getPath
方法的一些代码示例,展示了Resource.getPath
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.getPath
方法的具体详情如下:
包路径:org.wso2.carbon.registry.core.Resource
类名称:Resource
方法名:getPath
暂无
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.cmis
@Override
public String toString() {
return resource.getPath();
}
代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.mashup.javascript.hostobjects.registry
public String jsGet_path() {
return this.resource.getPath();
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.cmis
/**
* Determines whether a Registry <code>Node</code> is the root node wrt. to this
* <code>PathManager</code> instance. That is, whether the path of the node is
* equal to this instance's Registry root path.
*
* @param node
* @return <code>true</code> iff <code>node</code> is the root node wrt. to
* this <code>PathManager</code> instance.
*/
public boolean isRoot(Resource node) {
return node.getPath().equals(gregRootPath);
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.cmis
protected String getVersionSeriesId() throws RegistryException {
//TODO Think on this later
String path = resource.getPath();
if(path.endsWith(CMISConstants.PWC_SUFFIX)){
int endIndex = path.indexOf(CMISConstants.PWC_SUFFIX);
return path.substring(0, endIndex);
} else if(path.contains(";")){
int endIndex = path.indexOf(';');
return path.substring(0, endIndex);
}
return resource.getPath();
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.cmis
/**
* Determine the CMIS path given a Registry <code>Node</code>.
*
* @param node
* @return
* @throws IllegalArgumentException when <code>node</code> is not part of the hierarchy
*/
public String getPath(Resource node) {
if (gregRootPath.length() > node.getPath().length()) {
throw new IllegalArgumentException("Node is not part of the hierarchy: " + node.getPath());
}
String path = node.getPath().substring(gregRootPath.length());
return path.startsWith("/") ? path
: '/' + path;
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.cmis
public RegistryDocument getGregNode(Resource node) throws RegistryException {
String version = node.getPath();
String[] versions = repository.getVersions(node.getPath());
if(versions !=null && versions.length != 0){
version = versions[0];
}
return new RegistryVersion(repository, node, version, typeManager, pathManager);
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.cmis
@Override
protected boolean isLatestVersion() throws RegistryException {
String[] versions = getRepository().getVersions(getNode().getPath());
if(versions.length != 0) {
return versions[0].equals(version);
} else {
return getNode().getPath().equals(version);
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.cmis
private boolean isCheckedOut(Resource node){
if(node.getPath().endsWith(CMISConstants.PWC_SUFFIX)){
String path = node.getPath();
try {
node = getRepository().get( path.substring(0, path.indexOf(CMISConstants.PWC_SUFFIX)));
} catch (RegistryException e) {
String msg = "Failed to retrieve the resource at " + path;
log.error(msg, e);
throw new CmisObjectNotFoundException(msg, e);
}
}
String property = node.getProperty(CMISConstants.GREG_IS_CHECKED_OUT);
return (property != null && property.equals("true"));
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.cmis
/**
* See CMIS 1.0 section 2.2.4.14 deleteObject
*
* @throws CmisRuntimeException
*/
public void delete(boolean allVersions, boolean isPwc) {
try {
String path = resource.getPath();
repository.delete(path);
}
catch (RegistryException e) {
String msg = "Failed to delete the object ";
log.error(msg, e);
throw new CmisRuntimeException(msg, e);
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.cmis
/**
* @return Id of the version representing the base of this versions series
* @throws RegistryException
*/
protected String getBaseNodeId() throws RegistryException {
String[] versions = getRepository().getVersions(getNode().getPath());
return (versions.length != 0 ? versions[versions.length-1] : getNode().getPath());
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.cmis
@Override
protected RegistryObject create(Resource resource) {
DocumentTypeHandler documentTypeHandler = new DocumentTypeHandler(getRepository(), pathManager, typeManager);
try {
return documentTypeHandler.getGregNode(resource);
} catch (RegistryException e) {
log.error("Cannot create the object for the path " + resource.getPath(), e);
}
return null;
}
代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.list
public static String getServiceNamespace(Resource resource) throws RegistryException {
String serviceInfo = convertContentToString(resource);
try {
XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(serviceInfo));
StAXOMBuilder builder = new StAXOMBuilder(reader);
OMElement serviceInfoElement = builder.getDocumentElement();
return getNamespaceFromContent(serviceInfoElement);
} catch (Exception e) {
String msg = "Error in getting the service namespace. service path: " + resource.getPath() + ".";
log.error(msg, e);
throw new RegistryException(msg, e);
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.cmis
private boolean isPrivateWorkingCopy(RegistryObject node) {
String checkedOutProperty = node.getNode().getProperty(CMISConstants.GREG_IS_CHECKED_OUT);
String createdAsPwcProperty = node.getNode().getProperty(CMISConstants.GREG_CREATED_AS_PWC);
boolean checkedOut = checkedOutProperty != null && checkedOutProperty.equals("true");
boolean createdAsPwc = createdAsPwcProperty != null && createdAsPwcProperty.equals("true");
boolean endsWithPwc = node.getNode().getPath().endsWith(CMISConstants.PWC_SUFFIX);
return (checkedOut || createdAsPwc || endsWithPwc);
}
代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.list
public static String getServiceName(Resource resource) throws RegistryException {
String serviceInfo = convertContentToString(resource);
try {
XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(serviceInfo));
StAXOMBuilder builder = new StAXOMBuilder(reader);
OMElement serviceInfoElement = builder.getDocumentElement();
return getNameFromContent(serviceInfoElement);
} catch (Exception e) {
String msg = "Error in getting the service name. service path: " + resource.getPath() + ".";
log.error(msg, e);
throw new RegistryException(msg, e);
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.cmis
/**
* Get the private working copy of the versions series or throw an exception if not checked out.
*
* @return a {@link RegistryPrivateWorkingCopy} instance
* @throws CmisObjectNotFoundException if not checked out
* @throws CmisRuntimeException
*/
public RegistryPrivateWorkingCopy getPwc(Resource node) {
if (node.getPath().endsWith("_pwc")) {
return new RegistryPrivateWorkingCopy(getRepository(), node, typeManager, pathManager);
} else {
throw new CmisObjectNotFoundException("Not checked out document has no private working copy");
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.cmis
/**
* @return <code>true</code> iff <code>versionName</code> is the name of private working copy.
* @see RegistryPrivateWorkingCopy#PWC_NAME
*/
public static boolean denotesPwc(Registry registry, String versionName) {
try {
Resource resource = registry.get(versionName);
String property = resource.getProperty(CMISConstants.GREG_CREATED_AS_PWC);
String checkedOut = resource.getProperty(CMISConstants.GREG_IS_CHECKED_OUT);
if(resource.getPath().endsWith(CMISConstants.PWC_SUFFIX) || ( property != null && property.equals("true") )
|| ( checkedOut != null && checkedOut.equals("true") )){
return true;
}
} catch (RegistryException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
return false;
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions
private void encodeProperty(Resource resource, String propKey) {
try {
if (resource.getProperty(propKey) != null) {
resource.setProperty(propKey,
CryptoUtil.getDefaultCryptoUtil().encryptAndBase64Encode(
resource.getProperty(propKey).getBytes()));
}
} catch (CryptoException e) {
log.error("Unable to encrypt property key: " + propKey + " for resource " +
"path: " + resource.getPath(), e);
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions
private void decodeProperty(Resource resource, String propKey) {
try {
if(resource.getProperty(propKey)!=null){
resource.setProperty(propKey,
new String(CryptoUtil.getDefaultCryptoUtil().base64DecodeAndDecrypt(
resource.getProperty(propKey))));
}
} catch (CryptoException e) {
log.error("Unable to decrypt property key: " + propKey + " for resource " +
"path: " + resource.getPath(), e);
}
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.cmis
/**
* Remove a property from a GREG node
*/
public static void removeProperty(Registry repository,Resource resource, PropertyData<?> propertyData) throws RegistryException {
String id = propertyData.getId();
if(resource.getPropertyValues(id) != null ){ //has property
resource.removeProperty(id);
repository.put(resource.getPath(), resource);
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr
public static void removeRetentionPolicies(RegistrySession session) throws RepositoryException {
try {
if(session.getUserRegistry().resourceExists("/jcr_system/workspaces/default_workspace/testroot")) {
Resource r = session.getUserRegistry().get("/jcr_system/workspaces/default_workspace/testroot");
r.removeProperty("org.wso2.carbon.registry.jcr.retention.policy");
r.removeProperty("org.wso2.carbon.registry.jcr.retention.holds");
session.getUserRegistry().put(r.getPath(),r);
}
} catch (RegistryException e) {
throw new RepositoryException("Unable to remove TCK retention test data");
}
}
}
内容来源于网络,如有侵权,请联系作者删除!