当前位置: 首页>>代码示例>>Java>>正文


Java Resource.getPath方法代码示例

本文整理汇总了Java中org.wso2.carbon.registry.core.Resource.getPath方法的典型用法代码示例。如果您正苦于以下问题:Java Resource.getPath方法的具体用法?Java Resource.getPath怎么用?Java Resource.getPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.wso2.carbon.registry.core.Resource的用法示例。


在下文中一共展示了Resource.getPath方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkout

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
 * See CMIS 1.0 section 2.2.7.1 checkOut
 *
 * @throws CmisRuntimeException
 */
public RegistryPrivateWorkingCopy checkout() {
    Resource node = getNode();
    try {
        if (isCheckedOut(node)) {
            throw new CmisConstraintException("Document is already checked out " + node.getId());
        }

        return getPwc(checkout(getRepository(), node));
    }
    catch (RegistryException e) {
        String msg = "Failed checkout the node with path " + node.getPath();
        log.error(msg, e);
        throw new CmisRuntimeException(msg, e);
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:21,代码来源:RegistryVersionBase.java

示例2: isCheckedOut

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
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"));
    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:18,代码来源:RegistryVersionBase.java

示例3: getGregNode

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
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);
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:10,代码来源:DocumentTypeHandler.java

示例4: getPath

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
   * 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;
  
  }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:18,代码来源:PathManager.java

示例5: getServiceName

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:14,代码来源:CommonUtil.java

示例6: getServiceNamespace

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:14,代码来源:CommonUtil.java

示例7: cancelCheckout

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
private static void cancelCheckout(Registry repository, Resource node) throws RegistryException {
    /*
     *  2.2.7.2 cancelCheckOut
        Description: Reverses the effect of a check-out. Removes the private working copy of the checked-out
        document, allowing other documents in the version series to be checked out again. If the private working
        copy has been created by createDocument, cancelCheckOut MUST delete the created document.
    *
    * TODO Think on this later
    */

    //Remove from tracker
    //Remove checkedOut doc from tracker
    Resource tracker = repository.resourceExists(CMISConstants.GREG_CHECKED_OUT_TRACKER)
            ? repository.get(CMISConstants.GREG_CHECKED_OUT_TRACKER)
            : null;

    if(tracker!=null){
        if(tracker.getProperty(node.getPath())!=null){
            tracker.removeProperty(node.getPath());
            repository.put(tracker.getPath(), tracker);
        } else{
            throw new CmisRuntimeException("Checked out doc not in tracker!");
        }
    } else{
        throw new CmisRuntimeException("Tracker not found");
    }

    if(node.getPath().endsWith(CMISConstants.PWC_SUFFIX)){

        /*
        * Path of original copy     : /abc/def/resourceName
        * Path of checked out copy  : /abc/def/resourceName_pwc
        *
        * node==checked out doc
        * */

        //Get the original copy
        String pathOfPwc = node.getPath();
        String pathOfOriginalCopy = pathOfPwc.substring(0, pathOfPwc.indexOf(CMISConstants.PWC_SUFFIX));

        Resource resource = repository.get(pathOfOriginalCopy);
        //Reset properties
        //Allow the version series to be checked out again
        resource.setProperty(CMISConstants.GREG_IS_CHECKED_OUT, "false");
        if(resource.getProperty(CMISConstants.GREG_CHECKED_OUT_BY)  != null ){
	        resource.removeProperty(CMISConstants.GREG_CHECKED_OUT_BY);
        }
        repository.put(pathOfOriginalCopy, resource);
        //delete the pwc
        repository.delete(node.getPath());

    } else{
        //Document created as a pwc
        repository.delete(node.getPath());
    }

	
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:59,代码来源:RegistryVersionBase.java

示例8: associate

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public void associate(Resource resource, Registry registry) throws RegistryException {
    // Might be interesting to do this as follows:
    //  check for "reviewer" property and fail if not present, or if it doesn't match
    //    an existing registry user
    //  allow the reviewer user to have write permission (required for them to update)
    //  copy the resource into "/people/{reviewer}/to-review/..." (this lets them subscribe
    //    to the feed to get notified of new items in their queue)
    //  set the "approval" property to "in review"
    //
    // If we do it that way, then we need to make sure that we also set an "originalPath"
    // property on the copied resource so that when the reviewer selects approve/reject,
    // we can record the status on the "real" object (and then maybe delete the copy?)
    //
    // We really need symbolic links, which would solve this in a nicer way.
    String reviewer = resource.getProperty(REVIEWER);
    if (reviewer == null) {
        throw new RegistryException("No " + REVIEWER + " property");
    }

    try {
        UserRealm userRealm = CurrentSession.getUserRealm();
        if (!userRealm.getUserStoreManager().isExistingUser(reviewer)) {
            throw new RegistryException("No such user '" + reviewer + "'");
        }
    } catch (UserStoreException e) {
        throw new RegistryException("User Store Exception", e);
    }

    final String path = resource.getPath();
    String name = path;
    int idx = name.lastIndexOf("/");
    name = name.substring(idx + 1, name.length());
    if (name.length() == 0) {
        throw new RegistryException("Can't associate Review to root resource");
    }

    final String newPath = "/people/" + reviewer + "/to-review/" + name;
    registry.copy(path, newPath);
    Resource r = registry.get(newPath);
    registry.addAssociation(newPath, path, "original");

    // Need a better way for this to work 
    r.setProperty("registry.Aspects", "Review");

    registry.put(newPath, r);
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:47,代码来源:ReviewLifecycle.java


注:本文中的org.wso2.carbon.registry.core.Resource.getPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。