本文整理汇总了Java中org.wso2.carbon.registry.core.Collection.getChildCount方法的典型用法代码示例。如果您正苦于以下问题:Java Collection.getChildCount方法的具体用法?Java Collection.getChildCount怎么用?Java Collection.getChildCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.carbon.registry.core.Collection
的用法示例。
在下文中一共展示了Collection.getChildCount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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);
}
}
示例3: 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(new Date(subscription.getCreatedTime().getTime()));
subscriptionsArray[index++] = subscriptionDetails;
}
}
return subscriptionsArray;
} catch (RegistryException e) {
throw new EventBrokerException("Cannot read the registry resources ", e);
}
}
示例4: getQueues
import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
/**
* Get queues saved in the Registry
*
* @return Array of queues
* @throws RegistryClientException
*/
public static QueueDetails[] getQueues()
throws RegistryClientException {
try {
QueueDetails[] queueDetailsArray = new QueueDetails[0];
RegistryService registryService = CommonsDataHolder.getInstance().getRegistryService();
UserRegistry registry = registryService.getGovernanceSystemRegistry(
CarbonContext.getThreadLocalCarbonContext().getTenantId() <= 0 ?
MultitenantConstants.SUPER_TENANT_ID :
CarbonContext.getThreadLocalCarbonContext().getTenantId()
);
// Get queues
String queuesID = CommonsUtil.getQueuesID();
if (registry.resourceExists(queuesID)) {
Collection queueCollection = (Collection) registry.get(queuesID);
queueDetailsArray = new QueueDetails[queueCollection.getChildCount()];
int index = 0;
for (String queueId : queueCollection.getChildren()) {
Collection queue = (Collection) registry.get(queueId);
QueueDetails queueDetails = new QueueDetails();
queueDetails.setName(queue.getProperty(NAME));
queueDetails.setOwner(queue.getProperty(OWNER));
queueDetails.setCreatedTime(queue.getProperty(CREATED_TIME));
queueDetailsArray[index++] = queueDetails;
}
}
return queueDetailsArray;
} catch (RegistryException e) {
throw new RegistryClientException(e);
}
}
示例5: getSubscriptions
import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
/**
* Get subscriptions saved in the Registry
*
* @param topic Name of the topic
* @return Array of subscriptions
* @throws RegistryClientException
*/
public static SubscriptionDetails[] getSubscriptions(String topic)
throws RegistryClientException {
try {
SubscriptionDetails[] subscriptionDetailsArray = new SubscriptionDetails[0];
RegistryService registryService = CommonsDataHolder.getInstance().getRegistryService();
UserRegistry registry = registryService.getGovernanceSystemRegistry(
CarbonContext.getThreadLocalCarbonContext().getTenantId() <= 0 ?
MultitenantConstants.SUPER_TENANT_ID :
CarbonContext.getThreadLocalCarbonContext().getTenantId()
);
// Get subscriptions
String tenantBasedTopicName = getTenantBasedTopicName(topic);
String subscriptionsID = CommonsUtil.getSubscriptionsID(tenantBasedTopicName);
if (registry.resourceExists(subscriptionsID)) {
Collection subscriptionCollection = (Collection) registry.get(subscriptionsID);
subscriptionDetailsArray =
new SubscriptionDetails[subscriptionCollection.getChildCount()];
int index = 0;
for (String subs : subscriptionCollection.getChildren()) {
Collection subscription = (Collection) registry.get(subs);
SubscriptionDetails subscriptionDetails = new SubscriptionDetails();
subscriptionDetails.setName(subscription.getProperty(NAME));
subscriptionDetails.setOwner(subscription.getProperty(OWNER));
subscriptionDetails.setCreatedTime(subscription.getProperty(CREATED_TIME));
subscriptionDetailsArray[index++] = subscriptionDetails;
}
}
return subscriptionDetailsArray;
} catch (RegistryException e) {
throw new RegistryClientException(e);
}
}