Package org.wso2.carbon.registry.core

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


                wsdlName = wsdlName.substring(wsdlName.lastIndexOf("/"));
            } else {
                wsdlName = "/" + wsdlName;
            }
            path = path + wsdlName;
            requestContext.setResourcePath(new ResourcePath(path));
            WSDLProcessor wsdlProcessor = new WSDLProcessor(requestContext);
            return wsdlProcessor.addWSDLToRegistry(requestContext, uri, local, false, true,
                    disableWSDLValidation);
        }
        return null;
View Full Code Here


                xsdName = xsdName.substring(xsdName.lastIndexOf("/"));
            } else {
                xsdName = "/" + xsdName;
            }
            path = path + xsdName;
            requestContext.setResourcePath(new ResourcePath(path));
            WSDLValidationInfo validationInfo = null;
            try {
                if (!disableSchemaValidation) {
                    validationInfo = SchemaValidator.validate(new XMLInputSource(null, uri, null));
                }
View Full Code Here

    public void restore(RequestContext requestContext) throws RegistryException {
        checkWriteLock(requestContext.getResourcePath().getPath(), requestContext);
    }

    public void restoreVersion(RequestContext requestContext) throws RegistryException {
        checkWriteLock(new ResourcePath(requestContext.getVersionPath()).getPath(), requestContext);
    }
View Full Code Here

            String path, String assoType, UserRegistry registry)
            throws RegistryException {

        List tmpAssociations = new ArrayList();
        List associations = new ArrayList();
        ResourcePath resourcePath = new ResourcePath(path);
        Resource resource = registry.get(path);
        Association[] asso = CommonUtil.getAssociations(registry, (resourcePath.isCurrentVersion() ?
                resourcePath.getPath() : resourcePath.getPathWithVersion()));

        tmpAssociations.addAll(Arrays.asList(asso));

        Iterator iAssociations = tmpAssociations.iterator();
        while (iAssociations.hasNext()) {
View Full Code Here

public class DependenciesBeanPopulator {

    public static DependenciesBean populate(UserRegistry userRegistry, String path) {

        DependenciesBean dependenciesBean = new DependenciesBean();
        ResourcePath resourcePath = new ResourcePath(path);
        try {
            Association[] asso = CommonUtil.getAssociations(userRegistry,
                    (resourcePath.isCurrentVersion() ?
                            resourcePath.getPath() : resourcePath.getPathWithVersion()));
            Resource resource = userRegistry.get(path);

            AssociationBean[] beans = new AssociationBean[asso.length];
            for (int i = 0; i < beans.length; i++) {
                Association as = asso[i];
                beans[i] = new AssociationBean(as.getSourcePath(), as.getDestinationPath(),
                        as.getAssociationType());

            }
            dependenciesBean.setAssociationBeans(beans);

            dependenciesBean.setVersionView(!resourcePath.isCurrentVersion());
            dependenciesBean.setPathWithVersion(resourcePath.getPathWithVersion());
            List mountPoints = resource.getPropertyValues("registry.mountpoint");
            List targetPoints = resource.getPropertyValues("registry.targetpoint");
//            List paths = resource.getPropertyValues("registry.path");
            List actualPaths = resource.getPropertyValues("registry.actualpath");
            String user = resource.getProperty("registry.user");
View Full Code Here

            handleException("Unable to send notification for Rate Resource Operation", e);
        }
    }

    private String getPathWithoutVersion(String pathWithVersion) {
        ResourcePath path = new ResourcePath(pathWithVersion);
        return path.getPath();
    }
View Full Code Here

        }

        String nextPhase = phases[i + 1];
        String newResourcePath = "/" + nextPhase + originalPath;

        repository.copy(new ResourcePath(resource.getPath()), new ResourcePath(newResourcePath));
        Resource newResource = repository.get(newResourcePath);
        newResource.setProperty(PHASE_PROPERTY, nextPhase);
        repository.put(newResourcePath,  newResource);
    }
View Full Code Here

                for(int i=0; i<instances.length; i++) {
                    instances[i] = ((RemoteConfiguration)remoteInstances.get(i)).getId();
                }
                bean.setRemoteInstances(instances);
            }
            ResourcePath resourcePath = new ResourcePath(path);
            bean.setPathWithVersion(resourcePath.getPathWithVersion());
            bean.setVersionView(!resourcePath.isCurrentVersion());

            return bean;

        } catch (Exception e) {
            String msg = "Failed to get content details of the resource " + path +
View Full Code Here

        return resourceDataList.toArray(new ResourceData[resourceDataList.size()]);
    }

    public static ContentBean getContent(String path, UserRegistry registry) throws Exception {

        ResourcePath resourcePath = new ResourcePath(path);
        ContentBean bean = new ContentBean();

        Resource resource = registry.get(path);
        bean.setMediaType(resource.getMediaType());
        bean.setCollection(resource instanceof Collection);
        bean.setLoggedIn(!RegistryConstants.ANONYMOUS_USER.equals(registry.getUserName()));
        bean.setPathWithVersion(resourcePath.getPathWithVersion());
        bean.setAbsent(resource.getProperty("registry.absent"));
        List mountPoints = resource.getPropertyValues("registry.mountpoint");
        List targetPoints = resource.getPropertyValues("registry.targetpoint");
//        List paths = resource.getPropertyValues("registry.path");
        List actualPaths = resource.getPropertyValues("registry.actualpath");
        String user = resource.getProperty("registry.user");

        if (resource.getProperty("registry.link") != null) {

            if (mountPoints != null && targetPoints != null) {
//                String mountPoint = (String)mountPoints.get(0);
//                String targetPoint = (String)targetPoints.get(0);
//                String tempPath;
//                if (targetPoint.equals(RegistryConstants.PATH_SEPARATOR) && !childPath.equals(mountPoint)) {
//                    tempPath = ((String)paths.get(0)).substring(mountPoint.length());
//                } else {
//                    tempPath = targetPoint + ((String)paths.get(0)).substring(mountPoint.length());
//                }
                String tempPath = (String)actualPaths.get(0);
                bean.setPutAllowed(
                        UserUtil.isPutAllowed(registry.getUserName(), tempPath, registry));
                bean.setRealPath(tempPath);
            } else if (user != null) {
                if (registry.getUserName().equals(user)) {
                    bean.setPutAllowed(true);
                } else {
                    bean.setPutAllowed(
                        UserUtil.isPutAllowed(registry.getUserName(), path, registry));
                }
                // Mounted resources should be accessed via the link, and we need not set
                // the real path.
            }
        } else {
            boolean putAllowed = UserUtil.isPutAllowed(registry.getUserName(), path, registry);
            bean.setPutAllowed(putAllowed);
        }

        bean.setVersionView(!resourcePath.isCurrentVersion());
        bean.setContentPath(resourcePath.getCompletePath());
        resource.discard();
       
        return bean;
    }
View Full Code Here

                comments[i] = comment;
            }

            commentBean.setComments(comments);

            ResourcePath resourcePath = new ResourcePath(path);
            commentBean.setPathWithVersion(resourcePath.getPathWithVersion());
            commentBean.setVersionView(!resourcePath.isCurrentVersion());
            List mountPoints = resource.getPropertyValues("registry.mountpoint");
            List targetPoints = resource.getPropertyValues("registry.targetpoint");
//            List paths = resource.getPropertyValues("registry.path");
            List actualPaths = resource.getPropertyValues("registry.actualpath");
            String user = resource.getProperty("registry.user");
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.