protected void readProfile()

in taverna-scufl2-wfbundle/src/main/java/org/apache/taverna/scufl2/rdfxml/ProfileParser.java [317:355]


	protected void readProfile(URI profileUri, URI source,
			InputStream bundleStream) throws ReaderException, IOException {
		JAXBElement<ProfileDocument> elem;
		try {
			elem = (JAXBElement<ProfileDocument>) unmarshaller
					.unmarshal(bundleStream);
		} catch (JAXBException e) {
			throw new ReaderException("Can't parse profile document " + source,
					e);
		}

		URI base = getParserState().getLocation().resolve(source);
		if (elem.getValue().getBase() != null)
			base = base.resolve(elem.getValue().getBase());

		getParserState().setCurrentBase(base);

		org.apache.taverna.scufl2.xml.Profile profileElem = null;
		for (Object any : elem.getValue().getAny())
			if (any instanceof org.apache.taverna.scufl2.xml.Profile) {
				if (profileElem != null)
					throw new ReaderException("More than one <Profile> found");
				profileElem = (org.apache.taverna.scufl2.xml.Profile) any;
				parseProfile(profileElem, profileUri);
			} else if (any instanceof org.apache.taverna.scufl2.xml.Activity) {
				if (profileElem == null)
					throw new ReaderException("No <Profile> found");
				parseActivity((org.apache.taverna.scufl2.xml.Activity) any);
			} else if (any instanceof org.apache.taverna.scufl2.xml.ProcessorBinding) {
				if (profileElem == null)
					throw new ReaderException("No <Profile> found");
				parseProcessorBinding((org.apache.taverna.scufl2.xml.ProcessorBinding) any);
			} else if (any instanceof org.apache.taverna.scufl2.xml.Configuration) {
				if (profileElem == null)
					throw new ReaderException("No <Profile> found");
				parseConfiguration((org.apache.taverna.scufl2.xml.Configuration) any);
			}
		parseProfileSecond(profileElem);
	}