Package org.wso2.carbon.registry.core

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


   * @param keywords keywords to look for
   * @return the result set as a WSCollection
     * @throws org.wso2.carbon.registry.core.exceptions.RegistryException
   */
  public WSCollection WSsearchContent(String keywords) throws RegistryException{
    Collection collection = getRootRegistry().searchContent(keywords);
    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


     * @return child count inside the resource
     * @throws RegistryException
     */
    public int getChildCount(String path) throws RegistryException {
        int count = 0;
        Collection collection = (Collection) getRootRegistry().get(path);
        if (collection != null) {
            count = collection.getChildCount();
        }
        return count;
    }
View Full Code Here

            assertTrue("Resource doesn't exists", registry.resourceExists(QUERY_EPR_BY_PATH));
           
            Map<String, String> parameters = new HashMap<String, String>();
        parameters.put("1", RegistryConstants.SQL_QUERY_MEDIA_TYPE); // media type
        Collection collection = registry.executeQuery(QUERY_EPR_BY_PATH, parameters);
        String[] children = collection.getChildren();
       
        boolean successful = false;
        for (String path : children) {
          if (path.contains(QUERY_EPR_BY_PATH)) successful = true;
        }
View Full Code Here

    }

  }

  public Collection get(String path, int start, int pageSize) throws RegistryException {
    Collection collection;
    try {
      WSCollection wsCollection = stub.wSgetWithPageSize(path,start,pageSize);
      byte[] content = null;
      collection = WSRegistryClientUtils.transformWSCollectiontoCollection(this, wsCollection, content);
      return collection;
View Full Code Here

    public void createOrUpdateServerRegistryJNDI(String qpidJNDIString) throws CSGException{
        org.wso2.carbon.registry.core.Registry registry = getConfigSystemRegistry();
        try {
            if (!registry.resourceExists(CSGConstant.REGISTRY_CSG_RESOURCE_PATH)) {
                Collection collection = registry.newCollection();
                registry.put(CSGConstant.REGISTRY_CSG_RESOURCE_PATH, collection);
            }
            Resource resource = registry.newResource();
            resource.setContent(getFinalJNDIString(qpidJNDIString));
            registry.put(CSGConstant.REGISTRY_JNDI_RESOURCE_PATH + "/" + "jndi.properties",
View Full Code Here

            addAppendersToSet(logger.getAllAppenders(), appenderSet);
            logger.setLevel(systemLevel);
        }

        //Update the logger data according stored in the registry
        Collection loggerCollection = registryManager.getLoggers();
        if (loggerCollection != null) {
            String[] loggerResourcePaths = loggerCollection.getChildren();
            for (String loggerResourcePath : loggerResourcePaths) {
                Logger logger = LogManager.getLogger(loggerResourcePath.substring(LoggingConstants.LOGGERS.length()));
                Resource loggerResource = registryManager.getLogger(loggerResourcePath);
                if (loggerResource != null && logger != null) {
                    loggerResource.setProperty(LoggingConstants.LoggerProperties.LOG_LEVEL, logLevel);
                }
            }
        }

        Layout patternLayout = new PatternLayout(logPattern);
        for(Appender appender:appenderSet){
            if (appender instanceof AppenderSkeleton) {
                AppenderSkeleton appenderSkeleton = (AppenderSkeleton) appender;
                appenderSkeleton.setThreshold(systemLevel);
                appenderSkeleton.setLayout(patternLayout);
                appenderSkeleton.activateOptions();
            }
        }

        // update the appender data stored in the registry
        Collection appenderCollection = registryManager.getAppenders();
        if (appenderCollection != null) {
            String[] appenderResourcePaths = appenderCollection.getChildren();
            for (String appenderResourcePath : appenderResourcePaths) {
                Appender appender = LoggingUtil.getAppenderFromSet(appenderSet, appenderResourcePath.substring(
                        LoggingConstants.APPENDERS.length()));
                Resource appenderResource = registryManager.getAppender(appenderResourcePath);
                if (appenderResource != null && appender != null) {
View Full Code Here

        for (String userId : userIdArray) {    /*for each userId */
            try {
                registry = getRegistry();
                String resourcePath = SocialImplConstants.USER_REGISTRY_ROOT + userId +
                        SocialImplConstants.ACTIVITY_PATH + appId;
                Collection activityCollection;
                if (options == null) {
                    options = new FilterOptionsImpl();
                    options.setMax(0);
                    options.setFirst(0);
                }
                if (registry.resourceExists(resourcePath)) {
                    int max = options.getMax() == 0 ? SocialImplConstants.DEFAULT_RETURN_ARRAY_SIZE : options.getMax();
                    activityCollection = registry.get(resourcePath,
                            options.getFirst(),
                            max);

                    String[] activityResourcePaths = activityCollection.getChildren();
                    for (String path : activityResourcePaths) {   /* for each activity resource */
                        // ../activities/{appId}/<activityId>
                        String activityId = path.substring(
                                path.lastIndexOf(SocialImplConstants.SEPARATOR) + 1);
                        // Checks whether the path is the of the nextActivityId resource
View Full Code Here

    Registry registry;
    public AccessingRegistryAction(Registry registry) {
        this.registry = registry;
    }
    public void execute() throws Exception {
        Collection c;
        if (registry.resourceExists(KEEP_ALIVE_RESOURCE)) {
            c = (Collection)registry.get(KEEP_ALIVE_RESOURCE);
        } else {
            c = registry.newCollection();
        }
        long currentTime = new Date().getTime();
        c.setProperty("currentTime", String.valueOf(currentTime));
        registry.put(KEEP_ALIVE_RESOURCE, c);
    }
View Full Code Here

        String filterPath = "users/" + configUserRegistry.getUserName() + "/searchFilters";

        if (!configUserRegistry.resourceExists(filterPath)) {
            return null;
        }       
        Collection c = (Collection) configUserRegistry.get(filterPath);
        String[] children = c.getChildren();
        for (int i = 0; i < children.length; ++i) {
            children[i] = children[i].substring(children[i].lastIndexOf('/') + 1);
        }
        return children;
View Full Code Here

            registry.put(r6Path, r6);
        } catch (RegistryException e) {

        }

        Collection collection1 = registry.searchContent("r6");
        String[] paths1 = (String[]) collection1.getContent();

        assertEquals("Search should return the relevant path corresponding to the content which includes " +
                "submitted keywords.", "/c1/r6", paths1[0]);

        Collection collection2 = registry.searchContent("non existing");
        String[] paths2 = (String[]) collection2.getContent();

        assertEquals("Search should not return results when non existing keywords are submitted.", 0, paths2.length);

        registry.delete(r6Path);
        Collection collection3 = registry.searchContent("r6");
        String[] paths3 = (String[]) collection3.getContent();

        assertEquals("Search should not return results for a deleted document", 0, paths3.length);

    }
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.