本文整理汇总了Java中org.wso2.carbon.registry.common.AttributeSearchService类的典型用法代码示例。如果您正苦于以下问题:Java AttributeSearchService类的具体用法?Java AttributeSearchService怎么用?Java AttributeSearchService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AttributeSearchService类属于org.wso2.carbon.registry.common包,在下文中一共展示了AttributeSearchService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAttributeSearchService
import org.wso2.carbon.registry.common.AttributeSearchService; //导入依赖的package包/类
@Reference(
name = "registry.search.component",
service = AttributeSearchService.class,
cardinality = ReferenceCardinality.MANDATORY,
policy = ReferencePolicy.DYNAMIC,
unbind = "unsetAttributeSearchService"
)
protected void setAttributeSearchService(AttributeSearchService searchService) {
if (log.isDebugEnabled()) {
log.debug("Setting Registry Attribute Search Service");
}
attributeSearchService = searchService;
}
示例2: unsetAttributeSearchService
import org.wso2.carbon.registry.common.AttributeSearchService; //导入依赖的package包/类
protected void unsetAttributeSearchService(AttributeSearchService searchService) {
if (log.isDebugEnabled()) {
log.debug("Unsetting Registry Attribute Search Service");
}
attributeSearchService = null;
}
示例3: activate
import org.wso2.carbon.registry.common.AttributeSearchService; //导入依赖的package包/类
protected void activate(ComponentContext context) {
registrations.push(context.getBundleContext().registerService(
ContentSearchService.class.getName(), new ContentSearchServiceImpl(), null));
registrations.push(context.getBundleContext().registerService(
AttributeSearchService.class.getName(), new AttributeSearchServiceImpl(), null));
registrations.push(context.getBundleContext().registerService(
TermsSearchService.class.getName(), new TermsSearchServiceImpl(), null));
registrations.push(context.getBundleContext().registerService(
TermsQuerySearchService.class.getName(), new TermsQuerySearchServiceImpl(), null));
registrations.push(context.getBundleContext().registerService(
WaitBeforeShutdownObserver.class.getName(), new WaitBeforeShutdownObserver() {
boolean status = false;
public void startingShutdown() {
try {
IndexingManager.getInstance().stopIndexing();
} finally {
status = true;
}
}
public boolean isTaskComplete() {
return status;
}
}, null));
TenantDeploymentListenerImpl listener = new TenantDeploymentListenerImpl();
registrations.push(context.getBundleContext().registerService(
Axis2ConfigurationContextObserver.class.getName(), listener, null));
registrations.push(context.getBundleContext().registerService(
TenantIndexingLoader.class.getName(), listener, null));
try {
if (Utils.isIndexingConfigAvailable()) {
IndexingManager.getInstance().startIndexing();
} else {
log.debug("<indexingConfiguration/> not available in registry.xml to start the resource indexing task");
}
} catch (RegistryException e) {
log.error("Failed to start resource indexing task");
}
log.debug("Registry Indexing bundle is activated");
}
示例4: setAttributeSearchService
import org.wso2.carbon.registry.common.AttributeSearchService; //导入依赖的package包/类
protected void setAttributeSearchService(AttributeSearchService searchService) {
if (log.isDebugEnabled()) {
log.debug("Setting ContentBasedSearchService");
}
Util.setAttributeSearchService(searchService);
}
示例5: unsetAttributeSearchService
import org.wso2.carbon.registry.common.AttributeSearchService; //导入依赖的package包/类
protected void unsetAttributeSearchService(AttributeSearchService searchService) {
if (log.isDebugEnabled()) {
log.debug("Unsetting ContentBasedSearchService");
}
Util.setAttributeSearchService(null);
}
示例6: isLifecycleNameInUse
import org.wso2.carbon.registry.common.AttributeSearchService; //导入依赖的package包/类
public static boolean isLifecycleNameInUse(String name, Registry registry, Registry rootRegistry)
throws RegistryException, XMLStreamException {
if (name.contains("<aspect")) {
OMElement element = AXIOMUtil.stringToOM(name);
if (element != null) {
name = element.getAttributeValue(new QName("name"));
boolean aspectFound = false;
String[] aspects = registry.getAvailableAspects();
if(aspects != null){
for (String aspect: aspects) {
if (name.equals(aspect)) {
return true;
}
}
}
return false;
}
else
throw new RegistryException("Lifecycle Configuration does not contain the name attribute");
}
// Execute a search query to find out whether there is any usage in lifecycle.
Map<String, String> parameters = new HashMap<>();
parameters.put("propertyName", "registry.Aspects");
parameters.put("rightPropertyValue", name);
parameters.put("rightOp", "eq");
AttributeSearchService searchService = LifeCycleServiceHolder.getInstance().getAttributeSearchService();
if (searchService != null) {
ResourceData[] resourceData = searchService.search(parameters);
return resourceData.length != 0;
}
return false;
}
示例7: setAttributeSearchService
import org.wso2.carbon.registry.common.AttributeSearchService; //导入依赖的package包/类
protected void setAttributeSearchService(AttributeSearchService searchService){
if (log.isDebugEnabled()) {
log.debug("Setting Attribute Search Service");
}
GovernanceUtils.setAttributeSearchService(searchService);
}
示例8: unsetAttributeSearchService
import org.wso2.carbon.registry.common.AttributeSearchService; //导入依赖的package包/类
protected void unsetAttributeSearchService(AttributeSearchService searchService){
if (log.isDebugEnabled()) {
log.debug("Unsetting Attribute Search Service");
}
GovernanceUtils.setAttributeSearchService(null);
}
示例9: testBuildSearchCriteriaProperty
import org.wso2.carbon.registry.common.AttributeSearchService; //导入依赖的package包/类
/**
* This test case tests the behavior of search with the property.
*/
@SuppressWarnings("unchecked")
public void testBuildSearchCriteriaProperty() throws RegistryException {
registry.put("/uri", createResource());
registry.put("/uri2", createResource());
final GovernanceArtifactConfiguration governanceArtifactConfiguration = GovernanceUtils
.getGovernanceArtifactConfiguration(
getStringFromInputStream(this.getClass().getClassLoader().getResourceAsStream("uri.rxt")));
governanceArtifactConfiguration.setMediaType(GovernanceConstants.GOVERNANCE_ARTIFACT_CONFIGURATION_MEDIA_TYPE);
GovernanceUtils
.loadGovernanceArtifacts((UserRegistry) registry, new ArrayList<GovernanceArtifactConfiguration>() {{
add(governanceArtifactConfiguration);
}});
AttributeSearchService attributeSearchService = Mockito.mock(AttributeSearchService.class);
PaginationContext.init(0, 10, "ASC", "nameAttribute", 100);
// Mocking the search method to return both of the resources as a result.
Mockito.doAnswer(new Answer() {
private int count = 0;
public Object answer(InvocationOnMock invocation) {
if (count == 0) {
count++;
return new ResourceData[0];
} else {
ResourceData resourceData = new ResourceData();
resourceData.setResourcePath("/_system/governance/uri");
ResourceData resourceDataCopy = new ResourceData();
resourceDataCopy.setResourcePath("/_system/governance/uri2");
return new ResourceData[] { resourceData, resourceDataCopy };
}
}
}).when(attributeSearchService).search(Mockito.any(Map.class));
GovernanceUtils.setAttributeSearchService(attributeSearchService);
List<GovernanceArtifact> governanceArtifacts = GovernanceUtils
.findGovernanceArtifacts("name=(SampleURI2 OR " + "SampleURI1)&publisher_roles=(admin)", registry,
governanceArtifactConfiguration.getMediaType());
assertEquals("Some governance artifacts are missing in the property search result", 2,
governanceArtifacts.size());
}
示例10: getAttributeSearchService
import org.wso2.carbon.registry.common.AttributeSearchService; //导入依赖的package包/类
public static AttributeSearchService getAttributeSearchService() {
return attributeSearchService;
}
示例11: getAdvancedSearchResults
import org.wso2.carbon.registry.common.AttributeSearchService; //导入依赖的package包/类
/**
* Method to get Advance search result bean
*
* @param parameters CustomSearchParameterBean
* @return AdvancedSearchResultsBean
* @throws RegistryException
*/
public AdvancedSearchResultsBean getAdvancedSearchResults(CustomSearchParameterBean parameters)
throws RegistryException {
RegistryUtils.recordStatistics(parameters);
AdvancedSearchResultsBean advancedSearchResultsBean;
UserRegistry registry = (UserRegistry) getRootRegistry();
AttributeSearchService attributeSearchService = SearchDataHolder.getInstance().getAttributeIndexingService();
// Get advance search parameter values
String[][] searchParameterValues = parameters.getParameterValues();
ResourceData[] advanceSearchResourceData = new ResourceData[0];
// Map to store advance search attributes values
Map<String, String> advanceSearchAttributes;
// Validating the values sent
String validationErrorMessage = getValidationErrorMessage(searchParameterValues);
if (validationErrorMessage != null && StringUtils.isNotEmpty(validationErrorMessage)) {
return SearchUtils.getEmptyResultBeanWithErrorMsg(validationErrorMessage);
}
// No attribute has provide for search
if (allEmpty) {
return SearchUtils.getEmptyResultBeanWithErrorMsg(SEARCH_ATTRIBUTES_ALL_EMPTY_MESSAGE);
}
// Add search parameter values to advanceSearchAttributes Map
advanceSearchAttributes = getAdvanceSearchValueMap(searchParameterValues);
// Get Advance Search resource data
if (attributeSearchService != null && advanceSearchAttributes.size() > 0) {
if (!(advanceSearchAttributes.size() == 2 && advanceSearchAttributes.containsKey("leftOp")
&& advanceSearchAttributes.get("leftOp").equals("na") && advanceSearchAttributes
.containsKey("rightOp")
&& advanceSearchAttributes.get("rightOp").equals("na"))) {
advanceSearchAttributes.put(IndexingConstants.ADVANCE_SEARCH, "true");
advanceSearchResourceData = attributeSearchService.search(registry, advanceSearchAttributes);
}
}
advancedSearchResultsBean = new AdvancedSearchResultsBean();
if (advanceSearchResourceData != null && advanceSearchResourceData.length > 0) {
advanceSearchResourceData = getSortedSearchResults(advanceSearchResourceData);
advancedSearchResultsBean.setResourceDataList(advanceSearchResourceData);
if (!isEmptyResourceDataList(advancedSearchResultsBean)) {
return getPaginatedResult(advancedSearchResultsBean);
}
}
advancedSearchResultsBean.setResourceDataList(new ResourceData[0]);
return advancedSearchResultsBean;
}
示例12: setAttributeIndexingService
import org.wso2.carbon.registry.common.AttributeSearchService; //导入依赖的package包/类
protected void setAttributeIndexingService(AttributeSearchService attributeIndexingService) {
dataHolder.setAttributeIndexingService(attributeIndexingService);
}
示例13: unsetAttributeIndexingService
import org.wso2.carbon.registry.common.AttributeSearchService; //导入依赖的package包/类
protected void unsetAttributeIndexingService(AttributeSearchService attributeIndexingService) {
dataHolder.setAttributeIndexingService(null);
}
示例14: setAttributeIndexingService
import org.wso2.carbon.registry.common.AttributeSearchService; //导入依赖的package包/类
public void setAttributeIndexingService(AttributeSearchService attributeIndexingService) {
this.attributeIndexingService = attributeIndexingService;
}
示例15: getAttributeIndexingService
import org.wso2.carbon.registry.common.AttributeSearchService; //导入依赖的package包/类
public AttributeSearchService getAttributeIndexingService() {
return attributeIndexingService;
}