Java Code Examples for org.apache.axiom.om.OMNamespace#getNamespaceURI()

The following examples show how to use org.apache.axiom.om.OMNamespace#getNamespaceURI() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RepositoryBopt.java    From openxds with Apache License 2.0 6 votes vote down vote up
public OMElement RetrieveDocumentSetRequest(OMElement rdsr) {
	try {
		OMElement startup_error = beginTransaction("RET.b", rdsr, AppendixV.REPOSITORY_ACTOR);
		if (startup_error != null)
			return startup_error;
		log_message.setTestMessage("RET.b");

		OMNamespace ns = rdsr.getNamespace();
		String ns_uri =  ns.getNamespaceURI();
		if (ns_uri == null || ! ns_uri.equals(MetadataSupport.xdsB.getNamespaceURI())) {
			OMElement res = this.start_up_error(rdsr, "RepositoryB.java", AppendixV.REPOSITORY_ACTOR, "Invalid namespace on RetrieveDocumentSetRequest (" + ns_uri + ")", true);
			endTransaction(false);
			return res;
		}

		RetrieveDocumentSet s = new RetrieveDocumentSet(log_message, XdsCommon.xds_b, getMessageContext());
		
		OMElement result = s.retrieveDocumentSet(rdsr, this, true /* optimize */, this);
		endTransaction(s.getStatus());
		return result;
	} catch (Exception e) {
		return endTransaction(rdsr, e, AppendixV.REPOSITORY_ACTOR, "");
	}
}
 
Example 2
Source File: RegistryA.java    From openxds with Apache License 2.0 6 votes vote down vote up
protected void validateQueryTransaction(OMElement ahqr) throws XdsValidationException {
	OMNamespace ns = ahqr.getNamespace();
	String ns_uri =  ns.getNamespaceURI();
	if (ns_uri == null || ! 
			( ns_uri.equals(MetadataSupport.ebQns3.getNamespaceURI())  ||
					ns_uri.equals(MetadataSupport.ebQns2.getNamespaceURI())	 )) {
		throw new XdsValidationException("Invalid namespace on AdhocQueryRequest (" + ns_uri + ")");
	}


	String type = getRTransactionName(ahqr);


	if (type.startsWith("Unknown")) 
		throw new XdsValidationException("WS:Action indicates a Query, neither AdhocQuery or SQLQuery request found");
	if (type.startsWith("SubmitObjectsRequest")) 
		throw new XdsValidationException("WS:Action indicates a Query, SubmitObjectsRequest found");
	if (type.startsWith("SQL") &&
			!ns_uri.equals(MetadataSupport.ebQns2.getNamespaceURI()))
		throw new XdsValidationException("SQL query must have namespace " + MetadataSupport.ebQns2.getNamespaceURI());

	if (type.startsWith("SQ"))
		new StoredQueryRequestSoapValidator(getXdsVersion(), getMessageContext()).runWithException();
}
 
Example 3
Source File: RepositoryA.java    From openxds with Apache License 2.0 5 votes vote down vote up
protected void validatePnRTransaction(OMElement sor)
		throws XdsValidationException {
	OMNamespace ns = sor.getNamespace();
	String ns_uri =  ns.getNamespaceURI();
	if (ns_uri == null || ! ns_uri.equals(MetadataSupport.ebRSns2.getNamespaceURI())) 
		throw new XdsValidationException("Invalid namespace on " + sor.getLocalName() + " (" + ns_uri + ")");
}
 
Example 4
Source File: RegistryA.java    From openxds with Apache License 2.0 5 votes vote down vote up
protected void validateSubmitTransaction(OMElement sor)
throws XdsValidationException {
	OMNamespace ns = sor.getNamespace();
	String ns_uri =  ns.getNamespaceURI();
	if (ns_uri == null || ! ns_uri.equals(MetadataSupport.ebRSns2.getNamespaceURI())) {
		throw new XdsValidationException("Invalid namespace on SubmitObjectsRequest (" + ns_uri + ")");
	}

}
 
Example 5
Source File: RepositoryB.java    From openxds with Apache License 2.0 5 votes vote down vote up
protected void validatePnRTransaction(OMElement sor) throws XdsValidationException {
	forceForcedError();
	OMNamespace ns = sor.getNamespace();
	String ns_uri =  ns.getNamespaceURI();
	if (ns_uri == null || ! ns_uri.equals(MetadataSupport.xdsB.getNamespaceURI())) 
		throw new XdsValidationException("Invalid namespace on " + sor.getLocalName() + " (" + ns_uri + ")");
}
 
Example 6
Source File: RepositoryB.java    From openxds with Apache License 2.0 5 votes vote down vote up
protected void validateRetTransaction(OMElement rds) throws XdsValidationException {
	forceForcedError();
	OMNamespace ns = rds.getNamespace();
	String ns_uri =  ns.getNamespaceURI();
	if (ns_uri == null || ! ns_uri.equals(MetadataSupport.xdsB.getNamespaceURI())) 
		throw new XdsValidationException("Invalid namespace on " + rds.getLocalName() + " (" + ns_uri + ")");
}
 
Example 7
Source File: RegistryB.java    From openxds with Apache License 2.0 5 votes vote down vote up
protected void validateSubmitTransaction(OMElement sor)
throws XdsValidationException {
	forceForcedError();
	OMNamespace ns = sor.getNamespace();
	String ns_uri =  ns.getNamespaceURI();
	if (ns_uri == null || ! ns_uri.equals(MetadataSupport.ebLcm3.getNamespaceURI())) 
		throw new XdsValidationException("Invalid namespace on " + sor.getLocalName() + " (" + ns_uri + ")");

	String type = getRTransactionName(sor);

	if (!type.startsWith("SubmitObjectsRequest"))
		throw new XdsValidationException("Only SubmitObjectsRequest is acceptable on this endpoint, found " + sor.getLocalName());
}
 
Example 8
Source File: RegistryB.java    From openxds with Apache License 2.0 5 votes vote down vote up
protected void validateQueryTransaction(OMElement sor)
throws XdsValidationException, MetadataValidationException, XdsInternalException {
	forceForcedError();
	OMNamespace ns = sor.getNamespace();
	String ns_uri =  ns.getNamespaceURI();
	if (ns_uri == null || ! ns_uri.equals(MetadataSupport.ebQns3.getNamespaceURI())) 
		throw new XdsValidationException("Invalid namespace on " + sor.getLocalName() + " (" + ns_uri + ")");

	String type = getRTransactionName(sor);

	if (!this.isSQ(sor))
		throw new XdsValidationException("Only StoredQuery is acceptable on this endpoint");
	
	SoapHeader sh = new SoapHeader(getMessageContext());
	ParamParser pp = new ParamParser(sor);
	if (MetadataSupport.SQ_action.equals(sh.getActionValue())) {
		if ( !MetadataSupport.isSQId(pp.getQueryid())) {
			throw new XdsValidationException("WS:Action is [" + sh.getActionValue() + 
					"] but query id [" + pp.getQueryid() + "] is not a Stored Query query id");
		}
	} else if (MetadataSupport.MPQ_action.equals(sh.getActionValue())) {
		if ( !MetadataSupport.isMPQId(pp.getQueryid())) {
			throw new XdsValidationException("WS:Action is [" + sh.getActionValue() + 
					"] but query id [" + pp.getQueryid() + "] is not a MPQ query id");
		}
	}

	new StoredQueryRequestSoapValidator(getXdsVersion(), getMessageContext()).runWithException();

}
 
Example 9
Source File: Metadata.java    From openxds with Apache License 2.0 5 votes vote down vote up
private void detect_metadata_version() throws MetadataException {
	if (wrapper == null) {
		version2 = true;
	} else {
		OMNamespace namespace = wrapper.getNamespace();
		String namespace_uri = (namespace != null) ? namespace
				.getNamespaceURI() : "";

		detect_metadata_version(namespace_uri);
	}
}
 
Example 10
Source File: XMLTranscriptionOutput.java    From cougar with Apache License 2.0 5 votes vote down vote up
/**
 * Create an XMLTranscriptionOutput which will write transcibable objects to the specified
 * element with the specified namespace.
 * @param currentNode the XML element to transcribe the object to
 * @param ns the namespace that should be used
 * @param factory
 */
public XMLTranscriptionOutput(OMElement currentNode, OMNamespace ns, OMFactory factory) {
	this.ns = ns;
	this.factory = factory;
	this.currentNode = currentNode;
	entryElementName = new QName(ns.getNamespaceURI(), "entry", ns.getPrefix());
	xsiNamespace = factory.createOMNamespace(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "xsi");
}
 
Example 11
Source File: AbstractRepository.java    From openxds with Apache License 2.0 4 votes vote down vote up
public OMElement RetrieveDocumentSetRequest(OMElement rdsr) throws AxisFault {
	try {
		OMElement startup_error = beginTransaction(getRetTransactionName(), rdsr, AppendixV.REPOSITORY_ACTOR);
		if (startup_error != null)
			return startup_error;
		log_message.setTestMessage(getRetTransactionName());
		
		validateWS();
		
		mustBeMTOM();

		validateRetTransaction(rdsr);
		
		OMNamespace ns = rdsr.getNamespace();
		String ns_uri =  ns.getNamespaceURI();
		if (ns_uri == null || ! ns_uri.equals(MetadataSupport.xdsB.getNamespaceURI())) {
			OMElement res = this.start_up_error(rdsr, "AbstractRepository.java", AppendixV.REPOSITORY_ACTOR, "Invalid namespace on RetrieveDocumentSetRequest (" + ns_uri + ")", true);
			endTransaction(false);
			return res;
		}
		
		RegistryErrorList rel = new RegistryErrorList(RegistryErrorList.version_3,  true /* log */);
		
		validateRequest(rdsr, rel);
		
		if (rel.has_errors()) {
			OMElement response = new RetrieveDocumentSetResponse(new RegistryResponse(RegistryErrorList.version_3, rel)).getResponse();
			addOther("Response", response.toString());
			endTransaction(false);
			return response;
		}


		RetrieveDocumentSet s = new RetrieveDocumentSet(log_message, XdsCommon.xds_b, getMessageContext());
		
		OMElement result = processRetrieveDocumentSet(s, rdsr);
		
		endTransaction(s.getStatus());
		return result;
	} catch (Exception e) {
		return endTransaction(rdsr, e, AppendixV.REPOSITORY_ACTOR, "");
	}
}