Package org.wso2.carbon.registry.core

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


                CurrentSession.removeAttribute(Repository.IS_LOGGING_ACTIVITY);
            }
            resource.discard();
            HandlerManager hm = registryContext.getHandlerManager();

            ResourcePath resourcePath = new ResourcePath(path);
            context.setResourcePath(resourcePath);
            context.setTargetPath(target);
            hm.createLink(context);
            if (!context.isSimulation()) {
                if (!context.isProcessingComplete()) {
View Full Code Here


            }
            resource.discard();

            HandlerManager hm = registryContext.getHandlerManager();

            ResourcePath resourcePath = new ResourcePath(path);
            context.setResourcePath(resourcePath);
            context.setTargetPath(target);
            context.setTargetSubPath(targetSubPath);
            hm.createLink(context);
            if (!context.isSimulation()) {
View Full Code Here

        RequestContext context = new RequestContext(this, repository, versionRepository);
        try {
            // start the transaction
            beginTransaction();

            ResourcePath resourcePath = new ResourcePath(path);
            context.setResourcePath(resourcePath);
            registryContext.getHandlerManager().removeLink(context);

            // we will be removing the symlink handlers to remove
            Handler handlerToRemove = (Handler)context.getProperty(
View Full Code Here

        try {
            // start the transaction
            beginTransaction();

            context.setDumpingReader(reader);
            context.setResourcePath(new ResourcePath(path));
            registryContext.getHandlerManager().restore(context);
            if (!context.isSimulation()) {
                if (!context.isProcessingComplete()) {
                    try {
                        CurrentSession.setAttribute(Repository.IS_LOGGING_ACTIVITY,
View Full Code Here

        RequestContext context = new RequestContext(this, repository, versionRepository);
        try {
            // start the transaction
            beginTransaction();

            context.setResourcePath(new ResourcePath(path));
            context.setDumpingWriter(writer);
            registryContext.getHandlerManager().dump(context);
            if (!context.isSimulation()) {
                if (!context.isProcessingComplete()) {
                    repository.dump(path, writer);
View Full Code Here

        ResourceDAO resourceDAO = registryContext.getDataAccessManager().getDAOManager().
                getResourceDAO();
        RatingsDAO ratingsDAO = registryContext.getDataAccessManager().getDAOManager().
                getRatingsDAO(StaticConfiguration.isVersioningRatings());

        ResourcePath resourcePath = requestContext.getResourcePath();

        String ratedUserName = resourcePath.getParameterValue("ratings");
        if (ratedUserName != null) {
            ResourceImpl resourceImpl = resourceDAO.getResourceMetaData(resourcePath.getPath());

            RatingDO ratingDO = ratingsDAO.getRatingDO(resourceImpl, ratedUserName);
            int rating = ratingDO.getRating();
            Date ratedTime = ratingDO.getRatedTime();

            ResourceImpl resource = new ResourceImpl();
            resource.setMediaType(RegistryConstants.RATING_MEDIA_TYPE);
            resource.setContent(rating);
            resource.setAuthorUserName(ratedUserName);
            resource.setPath(resourcePath.getCompletePath());
            if (ratedTime != null) {
                resource.setCreatedTime(ratedTime);
                resource.setLastModified(ratedTime);
            }
            resource.addProperty("resourcePath", resourcePath.getPath());

            return resource;
        }

        return null;
View Full Code Here

     * @throws RegistryException
     */
    public boolean handleGet(RequestContext requestContext) throws RegistryException {

        // check if the request is for new resource
        ResourcePath resourcePath = requestContext.getResourcePath();
        if (resourcePath.parameterExists("new")) {
            String mediaType = resourcePath.getParameterValue("mediaType");
            return (mediaType != null && (invert != this.mediaType.equals(mediaType)));
        }

        Resource resource = requestContext.getResource();
        if (resource == null) {
View Full Code Here

        if (registryContext == null) {
            registryContext = RegistryContext.getBaseInstance();
        }
        CommentsDAO commentsDAO = registryContext.getDataAccessManager().getDAOManager().
                getCommentsDAO(StaticConfiguration.isVersioningComments());
        ResourcePath resourcePath = requestContext.getResourcePath();

        String commentID = resourcePath.getParameterValue("comments");
        if (commentID != null) {

            long cID;
            try {
                cID = Long.parseLong(commentID);

            } catch (NumberFormatException e) {
                // note that this might NOT be an exceptional scenario. there could be a different
                // URL form, which contains strings after "comment".
                // it is just that it is not the URL we expect here
                return null;
            }

            Comment comment = commentsDAO.getComment(cID, resourcePath.getPath());

            if (comment == null) {
                String msg = "Requested comment with ID: " + cID + " is not available.";
                log.error(msg);
                throw new RegistryException(msg);
View Full Code Here

            registryContext = RegistryContext.getBaseInstance();
        }
        CommentsDAO commentsDAO = registryContext.getDataAccessManager().getDAOManager().
                getCommentsDAO(StaticConfiguration.isVersioningComments());
        requestContext.setProcessingComplete(false);
        ResourcePath resourcePath = requestContext.getResourcePath();

        String commentID = resourcePath.getParameterValue("comments");
        if (commentID != null) {

            long cID;
            try {
                cID = Long.parseLong(commentID);

            } catch (NumberFormatException e) {
                // note that this might not be an exceptional scenario. there could be a different
                // URL form, which contains strings after "comment".
                // it is just that it is not the URL we expect here
                return;
            }

            String userID = CurrentSession.getUser();
            String authorizationPath =
                    AuthorizationUtils.getAuthorizationPath(resourcePath.getPath());
            String commentAuthor;

            Comment comment = commentsDAO.getComment(cID, resourcePath.getPath());
            commentAuthor = comment.getUser();

            // check if the current user has permission to delete this comment.
            // users who have PUT permission on the commented resource can delete any comment on
            // that resource. Any user can delete his own comment.
View Full Code Here

        ResourceDAO resourceDAO = registryContext.getDataAccessManager().getDAOManager().
                getResourceDAO();
        TagsDAO tagsDAO = registryContext.getDataAccessManager().getDAOManager().
                getTagsDAO(StaticConfiguration.isVersioningTags());

        ResourcePath resourcePath = requestContext.getResourcePath();

        String tagDetails = resourcePath.getParameterValue("tags");
        if (tagDetails != null) {

            String[] queries = tagDetails.split(":");

            if (queries.length != 2) {
                return null;
            }

            String path = resourcePath.getPath();
            String tagName = queries[0];
            String userName = queries[1];

            TaggingDO taggingDO = null;
            ResourceIDImpl resourceIDImpl = resourceDAO.getResourceID(path);
            if (resourceIDImpl != null) {
                ResourceImpl resourceImpl = resourceDAO.getResourceMetaData(resourceIDImpl);
                if (resourceImpl != null) {
                    TaggingDO[] taggingDOs = tagsDAO.getTagging(resourceImpl, tagName, userName);
                    taggingDO = taggingDOs[0];
                }
            }


            ResourceImpl resource = new ResourceImpl();
            resource.setMediaType(RegistryConstants.TAG_MEDIA_TYPE);
            resource.setPath(resourcePath.getCompletePath());
            if (taggingDO != null) {
                resource.setContent(taggingDO.getTagName());
                resource.setAuthorUserName(taggingDO.getTaggedUserName());
                final Date taggedTime = taggingDO.getTaggedTime();
                resource.setCreatedTime(taggedTime);
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.core.ResourcePath

Copyright © 2018 www.massapicom. 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.