Package org.wso2.carbon.registry.core

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


        // getting the gadget data
        try {
            registry = getConfigSystemRegistry();
            if (registry.resourceExists(nextGadgetIdPath)) {

                Collection gadgets = (Collection) registry.get(gadgetRepoPath);

                int gadgetCount = gadgets.getChildCount();
                String[] gadgetPaths = gadgets.getChildren();

                for (int i = 0; i < gadgetCount; i++) {
                    if (registry.resourceExists(gadgetPaths[i])) {
                        Resource tempRes = registry.get(gadgetPaths[i]);
                        resList.add(tempRes);
View Full Code Here


            // beginning registry transactions
            registry.beginTransaction();

            // if resource is not available create a repository collection
            if (!registry.resourceExists(gadgetRootPath)) {
                Collection gadgetCol = registry.newCollection();
                registry.put(gadgetRepoPath, gadgetCol);
            }

            // resource for storing next unique gadget id; if resource is not
            // available create new with id=0
View Full Code Here

     */
    public Boolean userHasGadget(String gadgetPath) {
        String userName = (String) getHttpSession().getAttribute(ServerConstants.USER_LOGGED_IN);
        try {
            Registry registry = getConfigSystemRegistry();
            Collection gadgetCol;

            Resource addedGadget = registry.get(gadgetPath);
            String gadgetUrl = addedGadget.getProperty("gadgetUrl");

            String pathToUserGadgets = DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT
                    + userName
                    + DashboardConstants.REGISTRY_PRODUCT_ID_PATH
                    + DashboardConstants.GADGET_PATH;

            gadgetCol = (Collection) registry.get(pathToUserGadgets);

            String[] gadgets = gadgetCol.getChildren();

            for (String gPath : gadgets) {
                Resource gadget = registry.get(gPath);
                if (gadgetUrl.equals(gadget.getProperty("gadgetUrl"))) {
                    return true;
View Full Code Here

        String gadgetRootPath = DashboardConstants.SYSTEM_GADGETREPO_REGISTRY_ROOT;
        String gadgetRepoPath = gadgetRootPath + DashboardConstants.GADGETS_COL;
        try {
            registry = getConfigSystemRegistry();
            if (registry.resourceExists(gadgetRepoPath)) {
                Collection gadgetCol = (Collection) registry
                        .get(gadgetRepoPath);
                return gadgetCol.getChildCount();
            } else {
                return null;
            }
        } catch (Exception e) {
            log.error(e.getMessage(), e);
View Full Code Here

        try {
            registry = getConfigSystemRegistry();
            if (registry.resourceExists(nextGadgetIdPath)) {

                // Get all the gadgets
                Collection gadgets = (Collection) registry.get(gadgetRepoPath);
                int gadgetCount = gadgets.getChildCount();
                String[] gadgetPaths = gadgets.getChildren();

                // Put all gadgets to a List and avoid nextGadgetId resource
                for (int i = 0; i < gadgetCount; i++) {
                    if (registry.resourceExists(gadgetPaths[i])) {
                        Resource tempRes = registry.get(gadgetPaths[i]);
View Full Code Here

                    + "P.REG_ID=RP.REG_PROPERTY_ID AND "
                    + "PA.REG_PATH_ID=R.REG_PATH_ID";

            HashMap<String, String> map = new HashMap<String, String>();
            map.put("query", sql);
            Collection qResults = registry.executeQuery(
                    DashboardConstants.SQL_STATEMENTS_PATH + "/query3", map);

            String[] qPaths = (String[]) qResults.getContent();

            String[] urls = new String[qPaths.length];

            for (int i = 0; i < qPaths.length; i++) {
                if (registry.resourceExists(qPaths[i])) {
View Full Code Here

            params.put("1", newUrl.trim());
            params.put("query", sql);


            Collection qResults = registry.executeQuery(
                    DashboardConstants.SQL_STATEMENTS_PATH + "/query4", params);

            String[] qPaths = (String[]) qResults.getContent();

            return (qPaths.length != 0);
        } catch (Exception e) {
            log.error("Backend server error - could validate the url for duplicates", e);
            return false;
View Full Code Here

            // beginning registry transactions
            registry.beginTransaction();

            // if resource is not available create a repository collection
            if (!registry.resourceExists(gadgetRootPath)) {
                Collection gadgetCol = registry.newCollection();
                registry.put(gadgetRepoPath, gadgetCol);
            }

            // resource for storing next unique gadget id; if resource is not
            // available create new with id=0
View Full Code Here

        MessageCollection[] resultArray = new MessageCollectionImpl[0];
        String messageCollectionPath = SocialImplConstants.USER_REGISTRY_ROOT + userId +
                                       SocialImplConstants.MESSAGES_PATH;
        try {
            registry = getRegistry();
            Collection messageCollections;
            if (registry.resourceExists(messageCollectionPath)) {

                // Using the FilterOptions
                if (options != null && options.getMax() > 0) {
                    messageCollections = registry.get(messageCollectionPath,
                                                      options.getFirst(), options.getMax());
                } else {
                    messageCollections = registry.get(messageCollectionPath, 0,
                                                      SocialImplConstants.DEFAULT_RETURN_ARRAY_SIZE);
                }
                String[] childResourcePath = messageCollections.getChildren();
                List<MessageCollection> resultList = new ArrayList<MessageCollection>();
                for (String path : childResourcePath) {       // Creates MessageCollection objects for each child resource
                    if (registry.resourceExists(path)) {
                        resultList.add(getPropertiesAddedMessageCollectionObj(
                                registry.get(path), fields));
View Full Code Here

        }
      }
    }

    // Update the logger data according to the data stored in the registry.
    Collection loggerCollection = registryManager.getLoggers();
    if (loggerCollection != null) {
      String[] loggerResourcePaths = loggerCollection.getChildren();
      for (String loggerResourcePath : loggerResourcePaths) {
        String loggerName = loggerResourcePath.substring(LoggingConstants.LOGGERS.length());
        Logger logger = LogManager.getLogger(loggerName);
        Resource loggerResource = registryManager.getLogger(loggerName);
        if (loggerResource != null && logger != null) {
          logger.setLevel(Level.toLevel(loggerResource
              .getProperty(LoggingConstants.LoggerProperties.LOG_LEVEL)));
          logger.setAdditivity(Boolean.parseBoolean(loggerResource
              .getProperty(LoggingConstants.LoggerProperties.ADDITIVITY)));
        }
      }
    }

    // update the appender data according to data stored in database
    Collection appenderCollection = registryManager.getAppenders();
    if (appenderCollection != null) {
      String[] appenderResourcePaths = appenderCollection.getChildren();
      for (String appenderResourcePath : appenderResourcePaths) {
        String appenderName = appenderResourcePath.substring(LoggingConstants.APPENDERS
            .length());
        Appender appender = getAppenderFromSet(appenderSet, appenderName);
        Resource appenderResource = registryManager.getAppender(appenderName);
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.