Package org.wso2.carbon.registry.core

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


        }
        return null;
    }

    public static String[] getHandlerList(Registry configSystemRegistry) throws RegistryException{
        Collection collection;
        try {
            collection = (Collection)configSystemRegistry.get(getContextRoot());
        } catch (Exception e) {
            return null;
        }

        if (collection == null) {
            CollectionImpl handlerCollection = new CollectionImpl();
            configSystemRegistry.put(getContextRoot(), handlerCollection);
            return null;
        }
        else {
            if (collection.getChildCount() == 0) {
                return null;
            }

            String[] childrenList = collection.getChildren();
            String[] handlerNameList = new String[collection.getChildCount()];
            for (int i = 0; i < childrenList.length; i++) {
                String path = childrenList[i];
                handlerNameList[i] = path.substring(
                        path.lastIndexOf(RegistryConstants.PATH_SEPARATOR) + 1);
            }
View Full Code Here


    public static boolean addDefaultHandlersIfNotAvailable(Registry configSystemRegistry)
            throws RegistryException, FileNotFoundException, XMLStreamException {

        if (!configSystemRegistry.resourceExists(RegistryConstants.HANDLER_CONFIGURATION_PATH)) {
            Collection handlerConfigurationCollection = new CollectionImpl();
            String description = "Handler configurations are stored here.";
            handlerConfigurationCollection.setDescription(description);
            configSystemRegistry.put(RegistryConstants.HANDLER_CONFIGURATION_PATH,
                    handlerConfigurationCollection);
            // We don't have any default handler configuration as in lifecycles.
        }
        else {
            // configue all handlers
            Resource handlerRoot = configSystemRegistry.get(getContextRoot());
            if (!(handlerRoot instanceof Collection)) {
                String msg = "Failed to continue as the handler configuration root: " +
                        getContextRoot() + " is not a collection.";
                log.error(msg);
                throw new RegistryException(msg);
            }
            Collection handlerRootCol = (Collection)handlerRoot;
            String[] handlerConfigPaths = handlerRootCol.getChildren();
            if (handlerConfigPaths != null) {
                for (String handlerConfigPath: handlerConfigPaths) {
                    generateHandler(configSystemRegistry, handlerConfigPath);
                }
            }
View Full Code Here

        String parentCollectionPath = CEPConstants.CEP_CONF_ELE_CEP_BUCKETS + CEPConstants.CEP_REGISTRY_BS;
        try {
            if (registry.resourceExists(parentCollectionPath)) {
                if (registry.get(parentCollectionPath) instanceof Collection) {
                    Collection cepBucketsCollection = (Collection) registry.get(parentCollectionPath);
                    buckets = new Bucket[cepBucketsCollection.getChildCount()];
                    int bucketCount = 0;
                    for (String bucketName : cepBucketsCollection.getChildren()) {
                        Bucket bucket = new Bucket();
                        if (registry.get(bucketName) instanceof Collection) {
                            Collection bucketDetailsCollection = (Collection) registry.get(bucketName);
                            for (String attirbute : bucketDetailsCollection.getChildren()) {
                                if (registry.get(attirbute) instanceof Collection) {
                                    Input input;
                                    Query query;
                                    Collection attributeCollection = (Collection) registry.get(attirbute);
                                    for (String names : attributeCollection.getChildren()) {
                                        if (registry.get(names) instanceof Collection) {
                                            if ((CEPConstants.CEP_REGISTRY_BS + CEPConstants.CEP_REGISTRY_INPUTS)
                                                    .equals(attirbute.substring(attirbute.lastIndexOf(CEPConstants.CEP_REGISTRY_BS)))) {
                                                input = new Input();
                                                Collection collection3 = (Collection) registry.get(names);
                                                for (String names2 : collection3.getChildren()) {
                                                    if (registry.get(names2) instanceof Collection) {
                                                        Collection mappingCollection = (Collection) registry.get(names2);
                                                        Mapping mapping = new Mapping();
                                                        for (String mappingChild : mappingCollection.getChildren()) {
                                                            if (registry.get(mappingChild) instanceof Collection) {
                                                                Collection mapCollection = (Collection) registry.get(mappingChild);
                                                                if ((CEPConstants.CEP_REGISTRY_BS + CEPConstants.CEP_REGISTRY_XPATH_DEFS)
                                                                        .equals(mappingChild.substring(mappingChild.lastIndexOf(CEPConstants.CEP_REGISTRY_BS)))) {
                                                                    for (String defs : mapCollection.getChildren()) {
                                                                        Resource xpathDefResource = registry.get(defs);
                                                                        Hashtable propertiesHashtable = xpathDefResource.getProperties();
                                                                        Enumeration e = propertiesHashtable.keys();
                                                                        while (e.hasMoreElements()) {
                                                                            String key = (String) e.nextElement();
                                                                            ArrayList values = (ArrayList) propertiesHashtable.get(key);
                                                                            XpathDefinition xpathDefinition = new XpathDefinition();
                                                                            xpathDefinition.setPrefix(key);
                                                                            xpathDefinition.setNamespace(values.get(0).toString());
                                                                            mapping.addXpathDefinition(xpathDefinition);
                                                                        }
                                                                    }
                                                                } else if (
                                                                        (CEPConstants.CEP_REGISTRY_BS + CEPConstants.CEP_REGISTRY_PROPERTIES)
                                                                                .equals(mappingChild.substring(mappingChild.lastIndexOf(CEPConstants.CEP_REGISTRY_BS)))) {
                                                                    for (String defs : mapCollection.getChildren()) {
                                                                        Resource xpathDefResource = registry.get(defs);
                                                                        Hashtable propertiesHashtable = xpathDefResource.getProperties();
                                                                        Enumeration e = propertiesHashtable.keys();
                                                                        Property property = new Property();
                                                                        while (e.hasMoreElements()) {
                                                                            String key = (String) e.nextElement();
                                                                            ArrayList values = (ArrayList) propertiesHashtable.get(key);
                                                                            if (CEPConstants.CEP_REGISTRY_NAME.equals(key)) {
                                                                                property.setName(values.get(0).toString());
                                                                            } else if (CEPConstants.CEP_REGISTRY_TYPE.equals(key)) {
                                                                                property.setType(values.get(0).toString());
                                                                            } else if (CEPConstants.CEP_REGISTRY_XPATH.equals(key)) {
                                                                                property.setXpath(values.get(0).toString());
                                                                            }
                                                                        }
                                                                        mapping.addProperty(property);
                                                                    }
                                                                }
                                                            } else {
                                                                Resource resource = registry.get(mappingChild);
                                                                Hashtable propertiesHashtable = resource.getProperties();
                                                                Enumeration e = propertiesHashtable.keys();
                                                                while (e.hasMoreElements()) {
                                                                    String key = (String) e.nextElement();
                                                                    ArrayList values = (ArrayList) propertiesHashtable.get(key);
                                                                    if (CEPConstants.CEP_REGISTRY_STREAM.equals(key)) {
                                                                        mapping.setStream(values.get(0).toString());
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        input.setMapping(mapping);
                                                    } else {
                                                        if ((CEPConstants.CEP_REGISTRY_BS + CEPConstants.CEP_REGISTRY_DETAILS)
                                                                .equals(names2.substring(names2.lastIndexOf(CEPConstants.CEP_REGISTRY_BS)))) {
                                                            Resource resource = registry.get(names2);
                                                            Hashtable propertiesHashtable = resource.getProperties();
                                                            Enumeration e = propertiesHashtable.keys();
                                                            while (e.hasMoreElements()) {
                                                                String key = (String) e.nextElement();
                                                                ArrayList values = (ArrayList) propertiesHashtable.get(key);
                                                                if (CEPConstants.CEP_REGISTRY_TOPIC.equals(key)) {
                                                                    input.setTopic(values.get(0).toString());
                                                                } else if (CEPConstants.CEP_CONF_ELE_BROKER_NAME.equals(key)) {
                                                                    input.setBrokerName(values.get(0).toString());
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                bucket.addInput(input);
                                            } else if ((CEPConstants.CEP_REGISTRY_BS + CEPConstants.CEP_REGISTRY_QUERIES)
                                                    .equals(attirbute.substring(attirbute.lastIndexOf(CEPConstants.CEP_REGISTRY_BS)))) {
                                                query = new Query();
                                                Expression expression = new Expression();
                                                Output output = new Output();
                                                Collection collection3 = (Collection) registry.get(names);
                                                for (String names2 : collection3.getChildren()) {
                                                    if (registry.get(names2) instanceof Collection) {
                                                        Collection outputCollection = (Collection) registry.get(names2);
                                                        for (String outputS : outputCollection.getChildren()) {
                                                            if (registry.get(outputS) instanceof Collection) {
                                                                Collection outputMapping = (Collection) registry.get(outputS);
                                                                if ((CEPConstants.CEP_REGISTRY_BS + CEPConstants.CEP_REGISTRY_ELEMENT_MAPPING)
                                                                        .equals(outputS.substring(outputS.lastIndexOf(CEPConstants.CEP_REGISTRY_BS)))) {
                                                                    ElementMapping elementMapping = new ElementMapping();
                                                                    for (String mappingName : outputMapping.getChildren()) {
                                                                        if (registry.get(mappingName) instanceof Collection) {
                                                                            Collection propertyCollection = (Collection) registry.get(mappingName);
                                                                            for (String propertyName : propertyCollection.getChildren()) {
                                                                                Resource propertyResource = registry.get(propertyName);
                                                                                Hashtable propertiesHashtable = propertyResource.getProperties();
                                                                                Enumeration e = propertiesHashtable.keys();
                                                                                Property property = new Property();
                                                                                while (e.hasMoreElements()) {
View Full Code Here

            ByteArrayOutputStream byteOut = new ByteArrayOutputStream();

            if (zipentry.isDirectory()) {
                //if the entry is a directory creating a collection
                Collection col = sysRegistry.newCollection();
                sysRegistry.put(DashboardConstants.GS_REGISTRY_ROOT +
                                DashboardConstants.GADGET_PATH + gadgetName
                                + RegistryConstants.PATH_SEPARATOR + entryName, col);
            } else {
                //if a file, creating a resource
View Full Code Here

        UserRegistry govRegistry = SecurityServiceHolder.getRegistryService().
                getGovernanceSystemRegistry(tenantId);
        try {
            KeyStoreManager keyMan = KeyStoreManager.getInstance(govRegistry);
            if (govRegistry.resourceExists(SecurityConstants.KEY_STORES)) {
                Collection collection = (Collection) govRegistry.get(SecurityConstants.KEY_STORES);
                String[] ks = collection.getChildren();

                for (int i = 0; i < ks.length; i++) {

                    String fullname = ks[i];
                    //get the primary keystore, only if it is super tenant.
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(null, map);

            String[] qPaths = (String[]) qResults.getContent();
            ArrayList gadgetUrlsList = new ArrayList();

            for (String qPath : qPaths) {
                if (registry.resourceExists(qPath)) {
                    Resource tempRes = registry.get(qPath);
View Full Code Here

        parameters.put("query", sql);
        parameters.put("1", RegistryUtils.getAbsolutePath(registryContext, serviceStoredPath) + "%");
        parameters.put("2", serviceMediaType1);
        parameters.put("3", serviceMediaType2);
//        Collection result = registry.executeQuery(searchServicesQuery, parameters);
        Collection result = registry.executeQuery(null, parameters);

        String[] servicePaths = result.getChildren();

        Map<String, LifecycleInfoBean> lifecycleInfoBeanMap = new HashMap<String, LifecycleInfoBean>();
        Map<String, List<LifecycleStageInfoBean>> lifecycleStagesMap = new HashMap<String, List<LifecycleStageInfoBean>>();
        for (String servicePath: servicePaths) {
            Resource serviceResource = registry.get(servicePath);
View Full Code Here

            String rootPath = rootDirectory.getAbsolutePath();

            UserRegistry registry = DashboardPopulatorContext.getRegistry();

            // Creating the default gadget collection resource
            Collection defaultGadgetCollection = registry.newCollection();

            // Set permission for annonymous read
            AuthorizationManager accessControlAdmin =
                    registry.getUserRealm().getAuthorizationManager();
           
View Full Code Here

                    // This is a Directory add a new collection
                    // This path is used to store the file resource under registry
                    String directoryRegistryPath =
                            SYSTEM_GADGETS_PATH + file.getAbsolutePath()
                                    .substring(rootPath.length()).replaceAll("[/\\\\]+", "/");
                    Collection newCollection = registry.newCollection();
                    registry.put(directoryRegistryPath, newCollection);

                    // recurse
                    transferDirectoryContentToRegistry(file, registry, rootPath);
                } else {
View Full Code Here

  public KeyStoreData[] getKeyStores() throws SecurityConfigException {
    KeyStoreData[] names = new KeyStoreData[0];
    try {
      if (registry.resourceExists(SecurityConstants.KEY_STORES)) {
        Collection collection = (Collection) registry.get(SecurityConstants.KEY_STORES);
        String[] ks = collection.getChildren();
        List<KeyStoreData> lst = new ArrayList<KeyStoreData>();
        for (int i = 0; i < ks.length; i++) {
          String fullname = ks[i];

          if (RegistryResources.SecurityManagement.PRIMARY_KEYSTORE_PHANTOM_RESOURCE
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.