本文整理汇总了Java中org.wso2.carbon.registry.core.Collection.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java Collection.getChildren方法的具体用法?Java Collection.getChildren怎么用?Java Collection.getChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.carbon.registry.core.Collection
的用法示例。
在下文中一共展示了Collection.getChildren方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findDescendantResources
import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
@Override
public Set<String> findDescendantResources(String parentResourceId, EvaluationCtx context) throws Exception {
Set<String> resourceSet = new HashSet<String>();
registry = EntitlementServiceComponent.getRegistryService().getSystemRegistry(CarbonContext.
getThreadLocalCarbonContext().getTenantId());
if (registry.resourceExists(parentResourceId)) {
Resource resource = registry.get(parentResourceId);
if (resource instanceof Collection) {
Collection collection = (Collection) resource;
String[] resources = collection.getChildren();
for (String res : resources) {
resourceSet.add(res);
getChildResources(res, resourceSet);
}
} else {
return null;
}
}
return resourceSet;
}
示例2: getChildResources
import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
/**
* This helps to find resources un a recursive manner
*
* @param node attribute value node
* @param parentResource parent resource Name
* @return child resource set
* @throws RegistryException throws
*/
private EntitlementTreeNodeDTO getChildResources(EntitlementTreeNodeDTO node,
String parentResource) throws RegistryException {
if (registry.resourceExists(parentResource)) {
String[] resourcePath = parentResource.split("/");
EntitlementTreeNodeDTO childNode =
new EntitlementTreeNodeDTO(resourcePath[resourcePath.length - 1]);
node.addChildNode(childNode);
Resource root = registry.get(parentResource);
if (root instanceof Collection) {
Collection collection = (Collection) root;
String[] resources = collection.getChildren();
for (String resource : resources) {
getChildResources(childNode, resource);
}
}
}
return node;
}
示例3: buildUIPermissionNodeAllSelected
import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
private void buildUIPermissionNodeAllSelected(Collection parent, UIPermissionNode parentNode,
Registry registry, Registry tenantRegistry) throws RegistryException,
UserStoreException {
String[] children = parent.getChildren();
UIPermissionNode[] childNodes = new UIPermissionNode[children.length];
for (int i = 0; i < children.length; i++) {
String child = children[i];
Resource resource = null;
if (registry.resourceExists(child)) {
resource = registry.get(child);
} else if (tenantRegistry != null) {
resource = tenantRegistry.get(child);
} else {
throw new RegistryException("Permission resource not found in the registry.");
}
childNodes[i] = getUIPermissionNode(resource, true);
if (resource instanceof Collection) {
buildUIPermissionNodeAllSelected((Collection) resource, childNodes[i], registry,
tenantRegistry);
}
}
parentNode.setNodeList(childNodes);
}
示例4: getPaginatedTopicTree
import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public TopicNode getPaginatedTopicTree(String topicPath, int startIndex, int numberOfTopicsPerRound) throws
EventBrokerException {
try {
UserRegistry userRegistry =
this.registryService.getGovernanceSystemRegistry(EventBrokerHolder.getInstance().getTenantId());
if (!userRegistry.resourceExists(topicPath)) {
userRegistry.put(topicPath, userRegistry.newCollection());
}
Collection collection = (Collection) userRegistry.get(topicPath);
String[] paths = collection.getChildren(startIndex, numberOfTopicsPerRound);
TopicNode rootTopic = new TopicNode("/", "/");
buildTopicTree(rootTopic, paths);
return rootTopic;
} catch (RegistryException e) {
throw new EventBrokerException(e.getMessage(), e);
}
}
示例5: getSavedReports
import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
public ReportConfigurationBean[] getSavedReports()
throws RegistryException, CryptoException, TaskException {
Registry registry = getConfigSystemRegistry();
List<ReportConfigurationBean> output = new LinkedList<ReportConfigurationBean>();
if (registry.resourceExists(REPORTING_CONFIG_PATH)) {
Collection collection = (Collection) registry.get(REPORTING_CONFIG_PATH);
String[] children = collection.getChildren();
for (String child : children) {
ReportConfigurationBean bean = getConfigurationBean(child);
Registry rootRegistry1 = getRootRegistry();
if (!rootRegistry1.resourceExists(bean.getTemplate())) {
log.warn("Report template " + bean.getTemplate() + " doesn't exist");
}
try {
RegistryUtils.loadClass(bean.getReportClass());
} catch (ClassNotFoundException e) {
log.warn("Report class not found " + bean.getReportClass());
}
output.add(bean);
}
}
return output.toArray(new ReportConfigurationBean[output.size()]);
}
示例6: initTaxonomyStorage
import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
/**
* This method will initialize taxonomy maps with all taxonomy data.
*
* @throws UserStoreException throws while getting RealmConfigurations
* @throws RegistryException throws getting files from registry
* @throws IOException throws when reading file
* @throws SAXException throws when parsing content stream
* @throws ParserConfigurationException
*/
@Override
public void initTaxonomyStorage()
throws UserStoreException, RegistryException, IOException, SAXException, ParserConfigurationException {
String TAXONOMY_PATH = GOVERNANCE_COMPONENT_PATH + "/taxonomy";
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
String adminName = ServiceHolder.getRealmService().getTenantUserRealm(tenantId).getRealmConfiguration()
.getAdminUserName();
Registry registry = ServiceHolder.getRegistryService().getGovernanceUserRegistry(adminName, tenantId);
if (registry.resourceExists(TAXONOMY_PATH)) {
Collection collection = (Collection) registry.get(TAXONOMY_PATH);
String[] childrenList = collection.getChildren();
for (String child : childrenList) {
String myString = IOUtils.toString(registry.get(child).getContentStream(), "UTF-8");
TaxonomyBean taxonomyDocumentBean = CommonUtils.documentBeanBuilder(myString);
addTaxonomy(taxonomyDocumentBean);
}
}
}
示例7: getChildResources
import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
/**
* This helps to find resources un a recursive manner
*
* @param parentResource parent resource Name
* @param childResources child resource set
* @return child resource set
* @throws RegistryException throws
*/
private Set<String> getChildResources(String parentResource, Set<String> childResources)
throws RegistryException {
Resource resource = registry.get(parentResource);
if (resource instanceof Collection) {
Collection collection = (Collection) resource;
String[] resources = collection.getChildren();
for (String res : resources) {
childResources.add(res);
getChildResources(res, childResources);
}
}
return childResources;
}
示例8: retrieveSubscriberIds
import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
public String[] retrieveSubscriberIds(String searchString) throws EntitlementException {
try {
if (registry.resourceExists(PDPConstants.ENTITLEMENT_POLICY_PUBLISHER +
RegistryConstants.PATH_SEPARATOR)) {
Resource resource = registry.get(PDPConstants.ENTITLEMENT_POLICY_PUBLISHER +
RegistryConstants.PATH_SEPARATOR);
Collection collection = (Collection) resource;
List<String> list = new ArrayList<String>();
if (collection.getChildCount() > 0) {
searchString = searchString.replace("*", ".*");
Pattern pattern = Pattern.compile(searchString, Pattern.CASE_INSENSITIVE);
for (String path : collection.getChildren()) {
String id = path.substring(path.lastIndexOf(RegistryConstants.PATH_SEPARATOR) + 1);
Matcher matcher = pattern.matcher(id);
if (!matcher.matches()) {
continue;
}
Resource childResource = registry.get(path);
if (childResource != null && childResource.getProperty(SUBSCRIBER_ID) != null) {
list.add(childResource.getProperty(SUBSCRIBER_ID));
}
}
}
return list.toArray(new String[list.size()]);
}
} catch (RegistryException e) {
log.error("Error while retrieving subscriber of ids", e);
throw new EntitlementException("Error while retrieving subscriber ids", e);
}
return null;
}
示例9: getAllChallengeQuestions
import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
/**
* @return
* @throws IdentityException
*/
public List<ChallengeQuestionDTO> getAllChallengeQuestions() throws IdentityException {
List<ChallengeQuestionDTO> questionDTOs = new ArrayList<ChallengeQuestionDTO>();
try {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
Registry registry = IdentityMgtServiceComponent.getRegistryService().
getConfigSystemRegistry(tenantId);
if (registry.resourceExists(IdentityMgtConstants.IDENTITY_MANAGEMENT_QUESTIONS)) {
Collection collection = (Collection) registry.
get(IdentityMgtConstants.IDENTITY_MANAGEMENT_QUESTIONS);
String[] children = collection.getChildren();
for (String child : children) {
Resource resource = registry.get(child);
String question = resource.getProperty("question");
String isPromoteQuestion = resource.getProperty("isPromoteQuestion");
String questionSetId = resource.getProperty("questionSetId");
if (question != null) {
ChallengeQuestionDTO questionDTO = new ChallengeQuestionDTO();
questionDTO.setQuestion(question);
if (isPromoteQuestion != null) {
questionDTO.setPromoteQuestion(Boolean.parseBoolean(isPromoteQuestion));
}
if (questionSetId != null) {
questionDTO.setQuestionSetId(questionSetId);
}
questionDTO.setPromoteQuestion(false);
questionDTOs.add(questionDTO);
}
}
}
} catch (RegistryException e) {
throw IdentityException.error(e.getMessage(), e);
}
return questionDTOs;
}
示例10: buildUIPermissionNodeNotAllSelected
import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
private void buildUIPermissionNodeNotAllSelected(Collection parent, UIPermissionNode parentNode,
Registry registry, Registry tenantRegistry,
AuthorizationManager authMan, String roleName, String userName)
throws RegistryException, UserStoreException {
String[] children = parent.getChildren();
UIPermissionNode[] childNodes = new UIPermissionNode[children.length];
for (int i = 0; i < children.length; i++) {
String child = children[i];
Resource resource = null;
if (tenantRegistry != null && child.startsWith("/permission/applications")) {
resource = tenantRegistry.get(child);
} else if (registry.resourceExists(child)) {
resource = registry.get(child);
} else {
throw new RegistryException("Permission resource not found in the registry.");
}
boolean isSelected = false;
if (roleName != null) {
isSelected = authMan.isRoleAuthorized(roleName, child,
UserMgtConstants.EXECUTE_ACTION);
} else if (userName != null) {
isSelected = authMan.isUserAuthorized(userName, child,
UserMgtConstants.EXECUTE_ACTION);
}
childNodes[i] = getUIPermissionNode(resource, isSelected);
if (resource instanceof Collection) {
buildUIPermissionNodeNotAllSelected((Collection) resource, childNodes[i],
registry, tenantRegistry, authMan, roleName, userName);
}
}
parentNode.setNodeList(childNodes);
}
示例11: getTenantSpecificMappingsFromRegistry
import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
public MappingData[] getTenantSpecificMappingsFromRegistry(String tenantDomain) throws Exception {
Collection mappings = getHostsFromRegistry();
List<MappingData> mappingList = new ArrayList<MappingData>();
if (mappings != null) {
String[] mappingNames = mappings.getChildren();
for (String mappingName : mappingNames) {
mappingName = mappingName.replace(UrlMapperConstants.HostProperties.FILE_SERPERATOR
+ UrlMapperConstants.HostProperties.HOSTINFO , "");
Resource resource = getMappingFromRegistry(mappingName);
if (resource != null) {
MappingData mappingData = new MappingData();
mappingData.setMappingName(resource
.getProperty(UrlMapperConstants.HostProperties.HOST_NAME));
mappingData.setTenantDomain(resource
.getProperty(UrlMapperConstants.HostProperties.TENANT_DOMAIN));
if (resource.getProperty(UrlMapperConstants.HostProperties.SERVICE_EPR) != null) {
mappingData.setServiceMapping(true);
mappingData.setUrl(resource
.getProperty(UrlMapperConstants.HostProperties.SERVICE_EPR));
} else {
mappingData.setUrl(resource
.getProperty(UrlMapperConstants.HostProperties.WEB_APP));
}
if (tenantDomain == null || tenantDomain.equals("")) {
mappingList.add(mappingData);
} else if (tenantDomain.equals(mappingData.getTenantDomain())) {
mappingList.add(mappingData);
}
}
}
return mappingList.toArray(new MappingData[mappingList.size()]);
}
return null;
}
示例12: getJMSSubscriptions
import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Subscription[] getJMSSubscriptions(String topicName) throws EventBrokerException {
try {
Subscription[] subscriptionsArray = new Subscription[0];
UserRegistry userRegistry =
this.registryService.getGovernanceSystemRegistry(EventBrokerHolder.getInstance().getTenantId());
String resourcePath = JavaUtil.getResourcePath(topicName, this.topicStoragePath);
if (!resourcePath.endsWith("/")) {
resourcePath = resourcePath + "/";
}
resourcePath = resourcePath + EventBrokerConstants.EB_CONF_JMS_SUBSCRIPTION_COLLECTION_NAME;
// Get subscriptions
if (userRegistry.resourceExists(resourcePath)) {
Collection subscriptionCollection = (Collection) userRegistry.get(resourcePath);
subscriptionsArray =
new Subscription[subscriptionCollection.getChildCount()];
int index = 0;
for (String subs : subscriptionCollection.getChildren()) {
Collection subscription = (Collection) userRegistry.get(subs);
Subscription subscriptionDetails = new Subscription();
subscriptionDetails.setId(subscription.getProperty("Name"));
subscriptionDetails.setOwner(subscription.getProperty("Owner"));
subscriptionDetails.setCreatedTime(ConverterUtil.convertToDate(subscription.getProperty("createdTime")));
subscriptionsArray[index++] = subscriptionDetails;
}
}
return subscriptionsArray;
} catch (RegistryException e) {
throw new EventBrokerException("Cannot read the registry resources ", e);
}
}
示例13: getInstalledRXTs
import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
public List<InstalledRxt> getInstalledRXTs(String cookie, ServletConfig config, HttpSession session) throws Exception {
List<InstalledRxt> listInstalledRxts = new ArrayList<InstalledRxt>();
String user = (String) session.getAttribute("logged-user");
String tenantDomain = (String) session.getAttribute("tenantDomain");
String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
String adminCookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
WSRegistryServiceClient registry = new WSRegistryServiceClient(backendServerURL, adminCookie);
RealmService realmService = registry.getRegistryContext().getRealmService();
String configurationPath = RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH +
RegistryConstants.GOVERNANCE_COMPONENT_PATH +
"/types/";
if (realmService.getTenantUserRealm(realmService.getTenantManager().getTenantId(tenantDomain))
.getAuthorizationManager().isUserAuthorized(user, configurationPath, ActionConstants.GET)) {
Collection collection = (Collection) registry.get(configurationPath);
String[] resources = collection.getChildren();
for (int i = 0; i < resources.length; i++) {
if (resources[i] != null && resources[i].contains("/")) {
String rxt = resources[i].substring(resources[i].lastIndexOf("/") + 1).split("\\.")[0];
InstalledRxt rxtObj = new InstalledRxt();
rxtObj.setRxt(rxt);
if (realmService.getTenantUserRealm(realmService.getTenantManager().getTenantId(tenantDomain))
.getAuthorizationManager()
.isUserAuthorized(user, resources[i], ActionConstants.GET)) {
rxtObj.setDeleteAllowed();
}
listInstalledRxts.add(rxtObj);
}
}
}
if (listInstalledRxts.size() > 1) {
Collections.sort(listInstalledRxts, InstalledRxt.installedRxtComparator);
}
return listInstalledRxts;
}
示例14: getAllMappingsFromRegistry
import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
public MappingData[] getAllMappingsFromRegistry() throws Exception {
Collection mappings = getHostsFromRegistry();
List<MappingData> mappingList = new ArrayList<MappingData>();
if (mappings != null) {
String[] mappingNames = mappings.getChildren();
for (String mappingName : mappingNames) {
mappingName = mappingName.replace(UrlMapperConstants.HostProperties.FILE_SERPERATOR
+ UrlMapperConstants.HostProperties.HOSTINFO , "");
Resource resource = getMappingFromRegistry(mappingName);
if (resource != null) {
MappingData mappingData = new MappingData();
mappingData.setMappingName(resource
.getProperty(UrlMapperConstants.HostProperties.HOST_NAME));
mappingData.setTenantDomain(resource
.getProperty(UrlMapperConstants.HostProperties.TENANT_DOMAIN));
if (resource.getProperty(UrlMapperConstants.HostProperties.SERVICE_EPR) != null) {
mappingData.setServiceMapping(true);
mappingData.setUrl(resource
.getProperty(UrlMapperConstants.HostProperties.SERVICE_EPR));
} else {
mappingData.setUrl(resource
.getProperty(UrlMapperConstants.HostProperties.WEB_APP));
}
mappingList.add(mappingData);
}
}
return mappingList.toArray(new MappingData[mappingList.size()]);
}
return null;
}
示例15: buildTopicTree
import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
/**
* Building the topic tree
*
* @param topicNode node of the topic
* @param resource the resource that holds child topics
* @param userRegistry user registry
* @throws EventBrokerException
*/
private void buildTopicTree(TopicNode topicNode, Collection resource, UserRegistry userRegistry)
throws EventBrokerException {
try {
String[] children = resource.getChildren();
if (children != null) {
List<TopicNode> nodes = new ArrayList<TopicNode>();
for (String childTopic : children) {
Resource childResource = userRegistry.get(childTopic);
if (childResource instanceof Collection) {
if (childTopic.endsWith("/")) {
childTopic = childTopic.substring(0, childTopic.length() - 2);
}
String nodeName = childTopic.substring(childTopic.lastIndexOf("/") + 1);
if (!nodeName.equals(EventBrokerConstants.EB_CONF_WS_SUBSCRIPTION_COLLECTION_NAME) &&
!nodeName.equals(EventBrokerConstants.EB_CONF_JMS_SUBSCRIPTION_COLLECTION_NAME)) {
childTopic =
childTopic.substring(childTopic.indexOf(this.topicStoragePath)
+ this.topicStoragePath.length() + 1);
TopicNode childNode = new TopicNode(nodeName, childTopic);
nodes.add(childNode);
buildTopicTree(childNode, (Collection) childResource, userRegistry);
}
}
}
topicNode.setChildren(nodes.toArray(new TopicNode[nodes.size()]));
}
} catch (RegistryException e) {
throw new EventBrokerException(e.getMessage(), e);
}
}