Examples of ResourceIDImpl


Examples of org.wso2.carbon.registry.core.ResourceIDImpl

    public String moveRecursively(ResourceIDImpl sourceID,
                                  String targetPath,
                                  ResourceIDImpl targetParentResourceID) throws RegistryException {
        prepareMove(sourceID.getPath(), targetPath);

        ResourceIDImpl targetID = resourceDAO.getResourceID(targetPath, sourceID.isCollection());
        if (targetID == null) {
            targetID = resourceDAO
                    .createResourceID(targetPath, targetParentResourceID, sourceID.isCollection());
        }
View Full Code Here

Examples of org.wso2.carbon.registry.core.ResourceIDImpl

            log.warn(msg);
            throw new AuthorizationFailedException(msg);
        }

        // check for existence of target path, if target exist delete them
        ResourceIDImpl targetExistingResourceID = resourceDAO.getResourceID(targetPath);
        ResourceDO targetExistingResourceDO;
        if (targetExistingResourceID != null) {
            targetExistingResourceDO = resourceDAO.getResourceDO(targetExistingResourceID);
            if (targetExistingResourceDO == null && targetExistingResourceID.isCollection()) {
                // we have to check the possibility non collection having this path
                targetExistingResourceID = resourceDAO.getResourceID(targetPath, false);
                if (targetExistingResourceID != null) {
                    targetExistingResourceDO = resourceDAO.getResourceDO(targetExistingResourceID);
                }
View Full Code Here

Examples of org.wso2.carbon.registry.core.ResourceIDImpl

        String parentPath = RegistryUtils.getParentPath(path);

        // first, let's check if there is a parent for this resource. we do this to speed up the
        // common use case where new resources are added to an existing parent.

        ResourceIDImpl parentResourceID = resourceDAO.getResourceID(parentPath, true);
        if (parentResourceID == null || !resourceDAO.resourceExists(parentResourceID)) {
            addEmptyCollection(parentPath);
            if (parentResourceID == null) {
                parentResourceID = resourceDAO.getResourceID(parentPath, true);
            }
View Full Code Here

Examples of org.wso2.carbon.registry.core.ResourceIDImpl

     * @throws RegistryException If any ancestor of the given path is a resource.
     */
    private void addEmptyCollection(String path) throws RegistryException {
        // first need to check whether there is a resource (non-collection)
        // where it is asking to create a collection
        ResourceIDImpl assumedResourceID = resourceDAO.getResourceID(path, false);
        if (assumedResourceID != null && resourceDAO.resourceExists(assumedResourceID)) {
            String msg = "Failed to add new Collection " + path + "There already exist " +
                    "non collection resource.";
            log.error(msg);
            throw new RegistryException(msg);
        }

        String parentPath = RegistryUtils.getParentPath(path);
        ResourceIDImpl parentResourceID = null;
        if (parentPath != null) {
            parentResourceID = resourceDAO.getResourceID(parentPath, true);
            if (parentResourceID == null || !resourceDAO.resourceExists(parentResourceID)) {
                addEmptyCollection(parentPath);
                if (parentResourceID == null) {
View Full Code Here

Examples of org.wso2.carbon.registry.core.ResourceIDImpl

                }
            }
        }

        // creating the resourceID
        ResourceIDImpl resourceID = resourceDAO.getResourceID(path, isCollection);
        if (resourceID == null) {
            // need to create a resourceID
            String parentPath = RegistryUtils.getParentPath(path);

            ResourceIDImpl parentResourceID = resourceDAO.getResourceID(parentPath, true);
            if (parentResourceID == null || !resourceDAO.resourceExists(parentResourceID)) {
                addEmptyCollection(parentPath);
                if (parentResourceID == null) {
                    parentResourceID = resourceDAO.getResourceID(parentPath, true);
                }
View Full Code Here

Examples of org.wso2.carbon.registry.core.ResourceIDImpl

        // archiving the old root resource
        createVersionForResource(resourceImpl, isRenewing, keepProperties);

        long version = resourceImpl.getVersionNumber();
        boolean isCollection = resourceImpl instanceof CollectionImpl;
        ResourceIDImpl rootResourceID = resourceImpl.getResourceIDImpl();
        ArrayList<Long> versionList = new ArrayList<Long>();
        versionList.add(version);
        if (isCollection) {
            // for collection we have to iterate through children
            addDescendants(rootResourceID, versionList, isRenewing, keepProperties);
        }
        // wrap the array list into stream
        InputStream versionsInputStream = new VersionInputStream(versionList);

        int pathId = rootResourceID.getPathID();
        String resourceName = rootResourceID.getName();
        long snapshotID =
                resourceVersionDAO.createSnapshot(pathId, resourceName, versionsInputStream);
        // Associations can be created only once we have created the snapshot, since we need to know
        // the snapshotID.
        if (snapshotID != -1) {
View Full Code Here

Examples of org.wso2.carbon.registry.core.ResourceIDImpl

        }

        String path = resourcePath.getPath();
        path = RegistryUtils.getPureResourcePath(path);

        ResourceIDImpl resourceID = resourceDAO.getResourceID(path);
        if (resourceID == null) {
            String msg = "Failed to get resource id to create a snapshot to the resource " +
                    path + ". ";
            throw new RegistryException(msg);
View Full Code Here

Examples of org.wso2.carbon.registry.core.ResourceIDImpl

     *
     * @return Resource referred by the given path. Resource can be a file or a collection.
     * @throws RegistryException if the operation failed.
     */
    public Resource getMetaData(VersionedPath versionedPath) throws RegistryException {
        ResourceIDImpl resourceID = resourceDAO.getResourceID(versionedPath.getPath());

        if (!AuthorizationUtils.authorize(versionedPath.getPath(), ActionConstants.GET)) {
            String msg = "User " + CurrentSession.getUser() + " is not authorized to " +
                    "read the resource " + versionedPath + ".";
            log.warn(msg);
View Full Code Here

Examples of org.wso2.carbon.registry.core.ResourceIDImpl

     *
     * @return true if a resource exists in the given path. false otherwise.
     * @throws RegistryException if the operation failed.
     */
    public boolean resourceExists(VersionedPath versionedPath) throws RegistryException {
        ResourceIDImpl resourceID = resourceDAO.getResourceID(versionedPath.getPath());

        long snapshotID = versionedPath.getVersion();
        return resourceVersionDAO.resourceExists(resourceID, snapshotID);
    }
View Full Code Here

Examples of org.wso2.carbon.registry.core.ResourceIDImpl

     *
     * @return Resource referred by the given path. Resource can be a file or a collection.
     * @throws RegistryException if the operation failed.
     */
    public Resource get(VersionedPath versionedPath) throws RegistryException {
        ResourceIDImpl resourceID = resourceDAO.getResourceID(versionedPath.getPath());

        if (!AuthorizationUtils.authorize(versionedPath.getPath(), ActionConstants.GET)) {
            String msg = "User " + CurrentSession.getUser() + " is not authorized to " +
                    "read the resource " + versionedPath + ".";
            log.warn(msg);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.