Examples of ResourceData


Examples of org.wso2.carbon.registry.common.ResourceData

                if (childPath == null || childPath.length() == 0) {
                    continue;
                }
                Resource child = registry.get(childPath);

                ResourceData resourceData = new ResourceData();
                resourceData.setResourcePath(childPath); // + RegistryConstants.VIEW_ACTION);

                String[] parts = childPath.split(RegistryConstants.PATH_SEPARATOR);
                if (parts.length > 0) {
                    resourceData.setName(parts[parts.length - 1]);
                }

                resourceData.setResourceType(child instanceof Collection ?
                        CommonConstants.COLLECTION : CommonConstants.RESOURCE);
                resourceData.setAuthorUserName(child.getAuthorUserName());
                resourceData.setDescription(child.getDescription());
                resourceData.setAverageRating(registry.getAverageRating(child.getPath()));
                Calendar createDateTime = Calendar.getInstance();
                createDateTime.setTime(child.getCreatedTime());
                resourceData.setCreatedOn(createDateTime);
                List mountPoints = child.getPropertyValues("registry.mountpoint");
                List targetPoints = child.getPropertyValues("registry.targetpoint");
//                List paths = child.getPropertyValues("registry.path");
                List actualPaths = child.getPropertyValues("registry.actualpath");
                String user = child.getProperty("registry.user");
                if (child.getProperty("registry.mount") != null) {
                    resourceData.setMounted(true);
                }
                if (child.getProperty("registry.link") != null) {
                    resourceData.setLink(true);

                    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);
                        resourceData.setPutAllowed(
                        UserUtil.isPutAllowed(registry.getUserName(), tempPath, registry));
                        resourceData.setDeleteAllowed(UserUtil.isDeleteAllowed(registry.getUserName(),
                                 tempPath, registry));
                        resourceData.setGetAllowed(UserUtil.isGetAllowed(registry.getUserName(), tempPath, registry));
                        resourceData.setRealPath(tempPath);
                    } else if (user != null) {
                        if (registry.getUserName().equals(user)) {
                            resourceData.setPutAllowed(true);
                            resourceData.setDeleteAllowed(true);
                            resourceData.setGetAllowed(true);
                        } else {
                            resourceData.setPutAllowed(
                        UserUtil.isPutAllowed(registry.getUserName(), childPath, registry));
                            resourceData.setDeleteAllowed(
                        UserUtil.isDeleteAllowed(registry.getUserName(), childPath, registry));
                            resourceData.setGetAllowed(
                        UserUtil.isGetAllowed(registry.getUserName(), childPath, registry));
                        }
                        // Mounted resources should be accessed via the link, and we need not set
                        // the real path.
                    }
                } else {
                    resourceData.setPutAllowed(
                        UserUtil.isPutAllowed(registry.getUserName(), childPath, registry));
                    resourceData.setDeleteAllowed(
                        UserUtil.isDeleteAllowed(registry.getUserName(), childPath, registry));
                    resourceData.setGetAllowed(
                        UserUtil.isGetAllowed(registry.getUserName(), childPath, registry));
                }

                calculateAverageStars(resourceData);

                if(child.getProperty("registry.externalLink") != null) {
                    resourceData.setExternalLink(true);
                }
                if(child.getProperty("registry.absent") != null){
                    resourceData.setAbsent(child.getProperty("registry.absent"));
                }
                resourceDataList.add(resourceData);

            } catch (AuthorizationFailedException ignore) {
                // if we get an auth failed exception while accessing a child, we simply skip it.
View Full Code Here

Examples of xregistry.generated.ResourceData

          xregistryURL.toString());
      ResourceData[] datas = xregistryClient.findResource("");

      int index = 0;
      while (maxNum > 0 && datas.length > index) {
        ResourceData data = datas[index];
        QName qName = data.getName();
        results.addResult(new SearchResult(new URI(qName
            .getNamespaceURI()), qName.getLocalPart(), index));
        index++;
        maxNum--;
      }
View Full Code Here

Examples of xregistry.generated.ResourceData

       
        FindResourceResponseDocument responseDocument = FindResourceResponseDocument.Factory.newInstance();
        FindResourceResponse findResourceResponse = responseDocument.addNewFindResourceResponse();
        if(list != null){
            for(DocData data:list){
                ResourceData resourceData = findResourceResponse.addNewResource();
                copyResourceData(data, resourceData);
            }
        }
        log.info("Response " + responseDocument.xmlText());
        return responseDocument;
View Full Code Here

Examples of xregistry.generated.ResourceData

            return null;
        }
        List<DocData> results = new ArrayList<DocData>();
        for(int i = 0;i<resourceData.length;i++){
            try {
          ResourceData host = resourceData[i];
            DocData data = new DocData(host.getName(),host.getOwner());
            data.allowedAction = host.getAllowedAction();
            data.resourceID = host.getName();
            data.resourcename = host.getResourceID();
            results.add(data);
            } catch (XmlValueOutOfRangeException e) {
         log.severe("Problem with retrieving object : " + e.getLocalizedMessage(), e);
       }  
        }
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.