Package org.wso2.carbon.registry.core

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


            if (!registry.resourceExists(minorVersionPath)) {
                String majorVersionPath = RegistryUtils.getParentPath(minorVersionPath);
                if (!registry.resourceExists(majorVersionPath)) {
                    String versionCollectionPath = RegistryUtils.getParentPath(majorVersionPath);
                    if (!registry.resourceExists(versionCollectionPath)) {
                        Collection collection = registry.newCollection();
                        collection.setMediaType(
                                CommonConstants.PROCESS_VERSION_COLLECTION_MEDIA_TYPE);
                        registry.put(versionCollectionPath, collection);
                        for (String key : smartLifecycleLinks) {
                            Resource linkResource = registry.newResource();
                            linkResource.setMediaType(
                                    CommonConstants.SMART_LIFECYCLE_LINK_MEDIA_TYPE);
                            registry.put(versionCollectionPath +
                                    RegistryConstants.PATH_SEPARATOR + key, linkResource);
                        }
                    }
                    Collection collection = registry.newCollection();
                    collection.setMediaType(CommonConstants.PROCESS_MAJOR_VERSION_MEDIA_TYPE);
                    registry.put(majorVersionPath, collection);
                }
                Collection collection = registry.newCollection();
                collection.setMediaType(CommonConstants.PROCESS_MINOR_VERSION_MEDIA_TYPE);
                registry.put(minorVersionPath, collection);
            }
            Collection collection = registry.newCollection();
            collection.setMediaType(CommonConstants.PROCESS_PATCH_VERSION_MEDIA_TYPE);
            registry.put(patchVersionPath, collection);
        }
        registry.put(processVersionPath, resource);
    }
View Full Code Here


        }
       

        String[] totalPaths = totalPathsArr.toArray(new String[totalPathsArr.size()]);

        Collection c = registry.newCollection();
        c.setContent(totalPaths);

        return c;
    }
View Full Code Here

                String filename = file.getName();
                String fileRegistryPath = registryPath + RegistryConstants.PATH_SEPARATOR + filename;
                if (!file.isFile()) {
                    // This is a Directory add a new collection
                    // This path is used to store the file resource under registry
                    Collection newCollection = registry.newCollection();
                    registry.put(fileRegistryPath, newCollection);

                    // recur
                    transferAllThemesToRegistry(file, registry, fileRegistryPath);
                } else {
View Full Code Here

        Registry systemRegistry = registryService.getGovernanceSystemRegistry();
        if (!systemRegistry.resourceExists(StratosConstants.ALL_THEMES_PATH)) {
            log.info("The theme root path: " + StratosConstants.ALL_THEMES_PATH + " doesn't exist.");
            return new String[0];
        }
        Collection c = (Collection)systemRegistry.get(StratosConstants.ALL_THEMES_PATH);
        String[] childPaths = c.getChildren();
        for (int i = 0; i < childPaths.length; i ++) {
            childPaths[i] = RegistryUtils.getResourceName(childPaths[i]);
        }
        return childPaths;
    }
View Full Code Here

        // will use a stack in place of calling recurssion

       
        ArrayList<String> paths = new ArrayList<String>();
        Stack<Collection> parentCollections = new Stack<Collection>();
        Collection rootCollection = (Collection)registry.get("/");
        parentCollections.push(rootCollection);
        while (!parentCollections.empty()) {
            Collection parentCollection = parentCollections.pop();
            String[] childs = parentCollection.getChildren();
            for (String childPath: childs) {
                String pathToAdd = childPath.substring(1);
                paths.add(pathToAdd);
                Resource resource = registry.get(childPath);
                if (resource instanceof Collection) {
                    Collection c = (Collection)resource;
                    parentCollections.push(c);
                }
            }
        }
        return paths.toArray(new String[paths.size()]);
View Full Code Here

        for (PermissionConfig permissionConfig : permissionConfigs) {
            String path = permissionConfig.getPath();
            String name = permissionConfig.getName();
            if (active) {
                if (!configRegistry.resourceExists(path)) {
                    Collection collection = configRegistry.newCollection();
                    collection.setProperty(UserMgtConstants.DISPLAY_NAME, name);
                    configRegistry.put(path, collection);
                }
            } else {
                if (configRegistry.resourceExists(path)) {
                    configRegistry.delete(path);
View Full Code Here

   *
   * @return WSResource instance
   * @throws RegistryException
   */
  public WSCollection WSnewCollection()throws RegistryException{
    Collection collection = getRootRegistry().newCollection();
    return CommonUtil.newCollectiontoWSCollection(collection);
  }
View Full Code Here

   * @throws RegistryException if the resource is not found, or if the path does not
   *                           reference a Collection, or if the start index is greater than
   *                           the number of children.
   */
  public WSCollection WSgetWithPageSize(String path, int start, int pageSize) throws RegistryException{
    Collection collection = getRootRegistry().get(path,start,pageSize);
    DataHandler dataHandler = null;
//    try {
//      dataHandler = CommonUtil.makeDataHandler(collection, tempFile);
//    } catch (IOException e) {
//      log.error("WSGet failed - Unable to generate temp file", e);
View Full Code Here

//    }
    return CommonUtil.transformCollectiontoWSCollection(collection, dataHandler);
  }

  public WSCollection WSgetChildCollection(String path, int start, int pageSize) throws RegistryException{
    Collection collection = getRootRegistry().get(path,start,pageSize);
    DataHandler dataHandler = null;
//    try {
//      dataHandler = CommonUtil.makeDataHandler(collection, tempFile);
//    } catch (IOException e) {
//      log.error("WSGet failed - Unable to generate temp file", e);
View Full Code Here

   * @param value an array of String containing value parameters to the corresponding key parameters (key -> value)
   * @return a Collection containing any resource paths which match the query
   * @throws RegistryException depends on the implementation.
   */
  public WSCollection WSexecuteQuery(String path, String[] key,String[] value) throws RegistryException{
    Collection collection = getRootRegistry().executeQuery(path, CommonUtil.createMap(key,value));
    DataHandler dataHandler = null;
//    try {
//      dataHandler = CommonUtil.makeDataHandler(collection, tempFile);
//    } catch (IOException e) {
//      log.error("WSGet failed - Unable to generate temp file", e);
//    }
        WSCollection wsCollection =
                CommonUtil.transformCollectiontoWSCollection(collection, dataHandler);
        wsCollection.setChildCount(collection.getChildCount());
        wsCollection.setChildren(collection.getChildren());
        return wsCollection;
  }
View Full Code Here

TOP

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

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.