List of usage examples for javax.xml.registry UnsupportedCapabilityException UnsupportedCapabilityException
public UnsupportedCapabilityException(Throwable cause)
JAXRException
object initialized with the given Throwable
object. From source file:it.cnr.icar.eric.server.query.QueryManagerImpl.java
/** * submitAdhocQuery/* w ww . j ava 2s . co m*/ */ @SuppressWarnings({ "static-access", "unchecked" }) public AdhocQueryResponse submitAdhocQuery(RequestContext context) throws RegistryException { AdhocQueryResponse ebAdhocQueryResponse = null; context = ServerRequestContext.convert(context); AdhocQueryRequest ebAdhocQueryRequest = (AdhocQueryRequest) ((ServerRequestContext) context) .getCurrentRegistryRequest(); ResponseOptionType ebResponseOptionType = ebAdhocQueryRequest.getResponseOption(); ReturnType returnType = ebResponseOptionType.getReturnType(); UserType user = ((ServerRequestContext) context).getUser(); // The result of the query RegistryObjectListType ebRegistryObjectListType = null; try { ebAdhocQueryResponse = null; // Process request for the case where it is a parameterized // invocation of a stored query processForParameterizedQuery((ServerRequestContext) context); // TODO: May need a better way than checking // getSpecialQueryResults() to know if specialQuery was called. if (((ServerRequestContext) context).getSpecialQueryResults() != null) { ebAdhocQueryResponse = processForSpecialQueryResults((ServerRequestContext) context); } else { // Check if it is a federated query and process it using // FederatedQueryManager if so. boolean isFederated = ebAdhocQueryRequest.isFederated(); if (isFederated) { // Initialize lazily. Otherwise we have an infinite create // loop if (fqm == null) { fqm = FederatedQueryManager.getInstance(); } ebAdhocQueryResponse = fqm.submitAdhocQuery((ServerRequestContext) context); } else { int startIndex = ebAdhocQueryRequest.getStartIndex().intValue(); int maxResults = ebAdhocQueryRequest.getMaxResults().intValue(); IterativeQueryParams paramHolder = new IterativeQueryParams(startIndex, maxResults); org.oasis.ebxml.registry.bindings.rim.AdhocQueryType adhocQuery = ebAdhocQueryRequest .getAdhocQuery(); QueryExpressionType queryExp = adhocQuery.getQueryExpression(); String queryLang = queryExp.getQueryLanguage(); if (queryLang.equals(BindingUtility.CANONICAL_QUERY_LANGUAGE_ID_SQL_92)) { String queryStr = (String) queryExp.getContent().get(0); queryStr = replaceSpecialVariables(user, queryStr); ebRegistryObjectListType = sqlQueryProcessor.executeQuery((ServerRequestContext) context, user, queryStr, ebResponseOptionType, paramHolder); processDepthParameter((ServerRequestContext) context); ebAdhocQueryResponse = BindingUtility.getInstance().queryFac.createAdhocQueryResponse(); ebAdhocQueryResponse.setRegistryObjectList(ebRegistryObjectListType); ebAdhocQueryResponse.setStatus(BindingUtility.CANONICAL_RESPONSE_STATUS_TYPE_ID_Success); ebAdhocQueryResponse.setStartIndex(BigInteger.valueOf(paramHolder.startIndex)); ebAdhocQueryResponse.setTotalResultCount(BigInteger.valueOf(paramHolder.totalResultCount)); } else if (queryLang.equals(BindingUtility.CANONICAL_QUERY_LANGUAGE_ID_ebRSFilterQuery)) { String queryStr = (String) queryExp.getContent().get(0); Unmarshaller unmarshaller = BindingUtility.getInstance().getJAXBContext() .createUnmarshaller(); JAXBElement<FilterQueryType> ebFilterQuery = (JAXBElement<FilterQueryType>) unmarshaller .unmarshal(new StreamSource(new StringReader(queryStr))); // take ComplexType from Element FilterQueryType filterQuery = ebFilterQuery.getValue(); // FilterQueryType filterQuery = (FilterQueryType) queryExp.getContent().get(0); ebRegistryObjectListType = filterQueryProcessor.executeQuery( ((ServerRequestContext) context), user, filterQuery, ebResponseOptionType, paramHolder); ebAdhocQueryResponse = BindingUtility.getInstance().queryFac.createAdhocQueryResponse(); ebAdhocQueryResponse.setRegistryObjectList(ebRegistryObjectListType); ebAdhocQueryResponse.setStatus(BindingUtility.CANONICAL_RESPONSE_STATUS_TYPE_ID_Success); ebAdhocQueryResponse.setStartIndex(BigInteger.valueOf(paramHolder.startIndex)); ebAdhocQueryResponse.setTotalResultCount(BigInteger.valueOf(paramHolder.totalResultCount)); } else { throw new UnsupportedCapabilityException( "Unsupported Query Language: ClassificationNode id: " + queryLang); } } } // fetch child objects if (fetchChildObjsSrv) { HashMap<String, Object> slotsMap = bu.getSlotsFromRequest(ebAdhocQueryRequest); boolean fetchChildObjsClt = Boolean .valueOf((String) slotsMap.get(CanonicalConstants.CANONICAL_SLOT_GET_CHILD_OBJECTS)) .booleanValue(); if (fetchChildObjsClt) { fetchChildObjects(ebAdhocQueryResponse.getRegistryObjectList().getIdentifiable(), (ServerRequestContext) context, ebResponseOptionType); } } // Add repositoryItems to repositoryItemMap if so requested in // responseOption if (returnType == returnType.LEAF_CLASS_WITH_REPOSITORY_ITEM) { addRepositoryItems(ebAdhocQueryResponse.getRegistryObjectList().getIdentifiable(), context); } if (!bypassCMS) { // Now perform any Role-Based Content Filtering on query results ((ServerRequestContext) context).getQueryResults().clear(); ((ServerRequestContext) context).getQueryResults() .addAll(ebAdhocQueryResponse.getRegistryObjectList().getIdentifiable()); cmsm.invokeServices(((ServerRequestContext) context)); ebAdhocQueryResponse.getRegistryObjectList().getIdentifiable().clear(); ebAdhocQueryResponse.getRegistryObjectList().getIdentifiable() .addAll(((ServerRequestContext) context).getQueryResults()); ((ServerRequestContext) context).getQueryResults().clear(); } } catch (RegistryException e) { ((ServerRequestContext) context).rollback(); throw e; } catch (Exception e) { ((ServerRequestContext) context).rollback(); throw new RegistryException(e); } removeObjectsDeniedAccess(((ServerRequestContext) context), ebAdhocQueryResponse.getRegistryObjectList().getIdentifiable()); if (isQueryFilterRequestBeingMade((ServerRequestContext) context)) { // Handle filter query requests processForQueryFilterPlugins((ServerRequestContext) context); // Filter queries produce special query results ebAdhocQueryResponse = processForSpecialQueryResults((ServerRequestContext) context); } ((ServerRequestContext) context).commit(); ebAdhocQueryResponse.setRequestId(ebAdhocQueryRequest.getId()); return ebAdhocQueryResponse; }
From source file:org.apache.ws.scout.registry.BusinessQueryManagerImpl.java
static FindQualifiers mapFindQualifiers(Collection jaxrQualifiers) throws UnsupportedCapabilityException { if (jaxrQualifiers == null) { return null; }//from w w w. j av a2s . com FindQualifiers result = objectFactory.createFindQualifiers(); for (Iterator i = jaxrQualifiers.iterator(); i.hasNext();) { String jaxrQualifier = (String) i.next(); String juddiQualifier = jaxrQualifier; if (juddiQualifier == null) { throw new UnsupportedCapabilityException("jUDDI does not support FindQualifer: " + jaxrQualifier); } result.getFindQualifier().add(juddiQualifier); } return result; }
From source file:org.apache.ws.scout.registry.BusinessQueryManagerV3Impl.java
static FindQualifiers mapFindQualifiers(Collection jaxrQualifiers) throws UnsupportedCapabilityException { FindQualifiers result = objectFactory.createFindQualifiers(); boolean exact = false; if (jaxrQualifiers != null) { for (Iterator i = jaxrQualifiers.iterator(); i.hasNext();) { String jaxrQualifier = (String) i.next(); String juddiQualifier = jaxrQualifier; // SCOUT-111 // If the JAXR qualifier is exactNameMatch, then // set the UDDI v3 qualifier to exactMatch if ("exactNameMatch".equals(jaxrQualifier) || "exactMatch".equals(jaxrQualifier)) { juddiQualifier = "exactMatch"; exact = true;/* www . j a v a2s . c o m*/ } if (juddiQualifier == null) { throw new UnsupportedCapabilityException( "jUDDI does not support FindQualifer: " + jaxrQualifier); } result.getFindQualifier().add(juddiQualifier); } } if (!exact) { //Making it backwards compatible with UDDIv2, so the JAXR tests don't get confused. result.getFindQualifier().add("approximateMatch"); } return result; }
From source file:org.freebxml.omar.server.query.QueryManagerImpl.java
/** * submitAdhocQuery/*from ww w . j av a 2 s . c om*/ */ public AdhocQueryResponseType submitAdhocQuery(RequestContext context) throws RegistryException { org.oasis.ebxml.registry.bindings.query.AdhocQueryResponse ahqr = null; context = ServerRequestContext.convert(context); AdhocQueryRequestType req = (AdhocQueryRequestType) ((ServerRequestContext) context) .getCurrentRegistryRequest(); org.oasis.ebxml.registry.bindings.query.ResponseOptionType responseOption = req.getResponseOption(); ReturnType returnType = responseOption.getReturnType(); UserType user = ((ServerRequestContext) context).getUser(); //The result of the query RegistryObjectListType rolt = null; try { HashMap slotsMap = bu.getSlotsFromRequest(req); ahqr = null; //Process request for the case where it is a parameterized invocation of a stored query processForParameterizedQuery((ServerRequestContext) context); //TODO: May need a better way than checking getSpecialQueryResults() to know if specialQuery was called. if (((ServerRequestContext) context).getSpecialQueryResults() != null) { ahqr = processForSpecialQueryResults((ServerRequestContext) context); } else { //Check if it is a federated query and process it using FederatedQueryManager if so. /* HIEOS/BHT: REMOVED boolean isFederated = req.isFederated(); if (isFederated) { //Initialize lazily. Otherwise we have an infinite create loop if (fqm == null) { fqm = FederatedQueryManager.getInstance(); } ahqr = fqm.submitAdhocQuery((ServerRequestContext)context); } else */ { int startIndex = req.getStartIndex().intValue(); int maxResults = req.getMaxResults().intValue(); IterativeQueryParams paramHolder = new IterativeQueryParams(startIndex, maxResults); org.oasis.ebxml.registry.bindings.rim.AdhocQueryType adhocQuery = req.getAdhocQuery(); HashMap querySlotsMap = bu.getSlotsFromRegistryObject(adhocQuery); QueryExpressionType queryExp = adhocQuery.getQueryExpression(); String queryLang = queryExp.getQueryLanguage(); if (queryLang.equals(BindingUtility.CANONICAL_QUERY_LANGUAGE_ID_SQL_92)) { String queryStr = (String) queryExp.getContent().get(0); queryStr = replaceSpecialVariables(user, queryStr); //See if query slot specifies bypassSQLParser boolean bypassSQLParserForQuery = false; String bypassSQLParserForQueryStr = (String) querySlotsMap .get("org.freebxml.omar.server.query.sql.SQLQueryProcessor.bypassSQLParser"); if (bypassSQLParserForQueryStr != null) { bypassSQLParserForQuery = Boolean.valueOf(bypassSQLParserForQueryStr).booleanValue(); } rolt = sqlQueryProcessor.executeQuery((ServerRequestContext) context, user, queryStr, responseOption, paramHolder, bypassSQLParserForQuery); processDepthParameter((ServerRequestContext) context); ahqr = BindingUtility.getInstance().queryFac.createAdhocQueryResponse(); ahqr.setRegistryObjectList(rolt); ahqr.setStatus(BindingUtility.CANONICAL_RESPONSE_STATUS_TYPE_ID_Success); ahqr.setStartIndex(BigInteger.valueOf(paramHolder.startIndex)); ahqr.setTotalResultCount(BigInteger.valueOf(paramHolder.totalResultCount)); } else if (queryLang.equals(BindingUtility.CANONICAL_QUERY_LANGUAGE_ID_ebRSFilterQuery)) { FilterQueryType filterQuery = (FilterQueryType) queryExp.getContent().get(0); rolt = filterQueryProcessor.executeQuery(((ServerRequestContext) context), user, filterQuery, responseOption, paramHolder); ahqr = BindingUtility.getInstance().queryFac.createAdhocQueryResponse(); ahqr.setRegistryObjectList(rolt); ahqr.setStatus(BindingUtility.CANONICAL_RESPONSE_STATUS_TYPE_ID_Success); ahqr.setStartIndex(BigInteger.valueOf(paramHolder.startIndex)); ahqr.setTotalResultCount(BigInteger.valueOf(paramHolder.totalResultCount)); } else { throw new UnsupportedCapabilityException( "Unsupported Query Language: ClassificationNode id: " + queryLang); } } } // fetch child objects if (fetchChildObjsSrv) { boolean fetchChildObjsClt = Boolean .valueOf((String) slotsMap.get(CanonicalConstants.CANONICAL_SLOT_GET_CHILD_OBJECTS)) .booleanValue(); if (fetchChildObjsClt) { fetchChildObjects(ahqr.getRegistryObjectList().getIdentifiable(), (ServerRequestContext) context, responseOption); } } /** HIEOS/BHT (REMOVED): //Add repositoryItems to repositoryItemMap if so requested in responseOption if (returnType == returnType.LEAF_CLASS_WITH_REPOSITORY_ITEM) { addRepositoryItems(ahqr.getRegistryObjectList().getIdentifiable(), context); } if (!bypassCMS) { //Now perform any Role-Based Content Filtering on query results ((ServerRequestContext)context).getQueryResults().clear(); ((ServerRequestContext)context).getQueryResults().addAll(ahqr.getRegistryObjectList().getIdentifiable()); cmsm.invokeServices(((ServerRequestContext)context)); ahqr.getRegistryObjectList().getIdentifiable().clear(); ahqr.getRegistryObjectList().getIdentifiable().addAll(((ServerRequestContext)context).getQueryResults()); ((ServerRequestContext)context).getQueryResults().clear(); } */ } catch (RegistryException e) { ((ServerRequestContext) context).rollback(); throw e; } catch (Exception e) { ((ServerRequestContext) context).rollback(); throw new RegistryException(e); } removeObjectsDeniedAccess(((ServerRequestContext) context), ahqr.getRegistryObjectList().getIdentifiable()); if (isQueryFilterRequestBeingMade((ServerRequestContext) context)) { // Handle filter query requests processForQueryFilterPlugins((ServerRequestContext) context); // Filter queries produce special query results ahqr = processForSpecialQueryResults((ServerRequestContext) context); } ((ServerRequestContext) context).commit(); ahqr.setRequestId(req.getId()); return ahqr; }