Package org.wso2.carbon.registry.core

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


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

            ResourcePath sourceResourcePath = new ResourcePath(sourcePath);
            ResourcePath targetResourcePath = new ResourcePath(targetPath);
            context.setSourcePath(sourcePath);
            context.setTargetPath(targetPath);
            String copiedPath = registryContext.getHandlerManager().copy(context);
            if (!context.isSimulation()) {
                if (!context.isProcessingComplete()) {
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().createVersion(context);
            if (!context.isSimulation()) {
                if (!context.isProcessingComplete()) {
View Full Code Here

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

            context.setResourcePath(new ResourcePath(path));
            String[] output = registryContext.getHandlerManager().getVersions(context);
            if (!context.isSimulation()) {
                if (!context.isProcessingComplete()) {
                    output = versionRepository.getVersions(path);
                }
View Full Code Here

        try {
            // start the transaction
            beginTransaction();

            context.setVersionPath(versionPath);
            ResourcePath versionedResourcePath = new ResourcePath(versionPath);
            String path = versionedResourcePath.getPath();
            if (repository.resourceExists(path)) {
                context.setOldResource(repository.get(path));
            }
            registryContext.getHandlerManager().restoreVersion(context);
            if (!context.isSimulation()) {
View Full Code Here

            // Source and target of associations may or may not be resources in the registry. If they
            // don't refer to a resource, they can contain any string value. But if they refer to
            // resources, values should be proper resource paths.

            ResourcePath sourceResourcePath = new ResourcePath(sourcePath);
            if (repository.resourceExists(sourceResourcePath.getPath())) {
                sourcePath = sourceResourcePath.getPathWithVersion();
            }

            ResourcePath targetResourcePath = new ResourcePath(targetPath);
            if (repository.resourceExists(targetResourcePath.getPath())) {
                targetPath = targetResourcePath.getPathWithVersion();
            }

            context.setSourcePath(sourcePath);
            context.setTargetPath(targetPath);
            context.setAssociationType(associationType);
View Full Code Here

            // Source and target of associations may or may not be resources in the registry. If they
            // don't refer to a resource, they can contain any string value. But if they refer to
            // resources, values should be proper resource paths.

            ResourcePath sourceResourcePath = new ResourcePath(sourcePath);
            if (repository.resourceExists(sourceResourcePath.getPath())) {
                sourcePath = sourceResourcePath.getPathWithVersion();
            }

            ResourcePath targetResourcePath = new ResourcePath(targetPath);
            if (repository.resourceExists(targetResourcePath.getPath())) {
                targetPath = targetResourcePath.getPathWithVersion();
            }

            context.setSourcePath(sourcePath);
            context.setTargetPath(targetPath);
            context.setAssociationType(associationType);
View Full Code Here

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

        ResourcePath resourcePath = requestContext.getResourcePath();

        if (resourcePath.parameterExists("tags") &&
                resourcePath.getParameterValue("tags") == null) {

            String path = resourcePath.getPath();
            String tagStr = "";

            ResourceIDImpl resourceIDImpl = resourceDAO.getResourceID(path);
            if (resourceIDImpl != null) {
                ResourceImpl resourceImpl = resourceDAO.getResourceMetaData(resourceIDImpl);
                if (resourceImpl != null) {
                    String[] tags = tagsDAO.getTags(resourceImpl);
                    StringBuffer sb = new StringBuffer(tagStr);
                    for (String tag : tags) {
                        sb.append(tag);
                    }
                    tagStr = sb.toString();
                }
            }

            ResourceImpl resource = new ResourceImpl();
            resource.setMediaType(RegistryConstants.TAG_MEDIA_TYPE);
            resource.setContent(tagStr);
            resource.setPath(resourcePath.getCompletePath());
            resource.addProperty("resourcePath", path);

            requestContext.setProcessingComplete(true);
            return resource;
        }
View Full Code Here

*/
public class CommentCollectionURLHandler extends Handler {

    public Resource get(RequestContext requestContext) throws RegistryException {

        ResourcePath resourcePath = requestContext.getResourcePath();

        Comment[] comments = requestContext.getRegistry().getComments(resourcePath.getPath());
        CollectionImpl resource = new CollectionImpl();
        resource.setDescription("Comments for '" + resourcePath.getPath() + "'");
        resource.setPath(resourcePath.getPath());
        resource.setContent(comments);

        requestContext.setProcessingComplete(true);
        return resource;

View Full Code Here

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

        ResourcePath resourcePath = requestContext.getResourcePath();

        if (resourcePath.parameterExists("ratings") &&
                resourcePath.getParameterValue("ratings") == null) {
            ResourceImpl resourceImpl = resourceDAO.getResourceMetaData(resourcePath.getPath());
            String[] ratedUserNames = ratingsDAO.getRatedUserNames(resourceImpl);

            CollectionImpl resource = new CollectionImpl();
            resource.setPath(resourcePath.getCompletePath());
            List<String> ratingPaths = new ArrayList<String>();
            for (String ratedUserName : ratedUserNames) {
                String ratingPath = resourcePath.getPath() + RegistryConstants.URL_SEPARATOR +
                        "ratings:" + ratedUserName;
                ratingPaths.add(ratingPath);
            }

            String[] ratingsContent = ratingPaths.toArray(new String[ratingPaths.size()]);
View Full Code Here

        return true;
    }
   
    public String openGadget(String location)throws RegistryException{
        Registry registry = getConfigSystemRegistry();
        if(!registry.resourceExists(new ResourcePath(location).getPath())){
            return null;
        }
        Resource resource = registry.get(location);
        return new String((byte[])resource.getContent());
    }
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.