protected void parseConfiguration()

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


	protected void parseConfiguration(Configuration original)
			throws ReaderException {
		org.apache.taverna.scufl2.api.configurations.Configuration config = new org.apache.taverna.scufl2.api.configurations.Configuration();

		boolean ignoreConfig = false;
		
		if (original.getType() != null) {
			URI type = resolve(original.getType().getResource());
			if (! INTERNAL_DISPATCH_PREFIX.relativize(type).isAbsolute()) {
                logger.fine("Ignoring unsupported Dispatch stack configuration (SCUFL2-130)");
                logger.finest(original.getAbout());
                ignoreConfig = true;
			}
            config.setType(type);
		}

		if (original.getName() != null)
			config.setName(original.getName());

		if (!ignoreConfig) {
			mapBean(original.getAbout(), config);

			if (original.getConfigure() != null) {
				Configurable configurable = resolveBeanUri(original
						.getConfigure().getResource(), Configurable.class);
				config.setConfigures(configurable);
			}
			config.setParent(getParserState().getCurrent(
					org.apache.taverna.scufl2.api.profiles.Profile.class));
		}

		getParserState().push(config);

		if (original.getSeeAlso() != null) {
			String about = original.getSeeAlso().getResource();
    		if (about != null) {
    		    URI resource = resolve(about);
    		    URI bundleBase = parserState .get().getLocation();
    		    URI path = uriTools.relativePath(bundleBase, resource);    		    
    		    if (ignoreConfig) {
    		        logger.finest("Deleting " + path + " (SCUFL2-130)");
    		        parserState.get().getUcfPackage().removeResource(path.getRawPath());
    		    } else {
        		    try {
        		        // TODO: Should the path in the UCF Package be %-escaped or not?
        		        // See TestRDFXMLWriter.awkwardFilenames
                        config.setJson(parserState.get().getUcfPackage().getResourceAsString(path.getRawPath()));
                    } catch (IllegalArgumentException e) {
                        logger.log(Level.WARNING, "Could not parse JSON configuration " + path, e);
        		    } catch (IOException e) {
                        logger.log(Level.WARNING, "Could not load JSON configuration " + path, e);
                    }
    		    }
    		}
		}
		
		for (Object o : original.getAny()) {
		    // Legacy SCUFL2 <= 0.11.0  PropertyResource configuration
		    // Just ignoring it for now :(
		    // 
		    // TODO: Parse and represent as JSON-LD?
		    logger.warning("Ignoring unsupported PropertyResource (from wfbundle 0.2.0 or older) for " + config + " " + o);
		}
		
		getParserState().pop();
	}