public OperationSelectorJMSUserProp read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException { OperationSelectorJMSUserProp opSelector = new OperationSelectorJMSUserProp(); String propertyName = reader.getAttributeValue(null, OperationSelectorJMSUserProp.OPERATION_SELECTOR_JMS_USERPROP_ATTR); if (propertyName != null && propertyName.length() > 0) { opSelector.setPropertyName(propertyName); } else { throw new ContributionReadException(OperationSelectorJMSUserProp.OPERATION_SELECTOR_JMS_USERPROP_QNAME.toString() + ": " + OperationSelectorJMSUserProp.OPERATION_SELECTOR_JMS_USERPROP_ATTR + " is a required attribute."); } return opSelector; }
public OperationSelectorJMSUserProp read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException { OperationSelectorJMSUserProp opSelector = new OperationSelectorJMSUserProp(); String propertyName = reader.getAttributeValue(null, OperationSelectorJMSUserProp.OPERATION_SELECTOR_JMS_USERPROP_ATTR); if (propertyName != null && propertyName.length() > 0) { opSelector.setPropertyName(propertyName); } else { throw new ContributionReadException(OperationSelectorJMSUserProp.OPERATION_SELECTOR_JMS_USERPROP_QNAME.toString() + ": " + OperationSelectorJMSUserProp.OPERATION_SELECTOR_JMS_USERPROP_ATTR + " is a required attribute."); } return opSelector; }
/** * Produces a location URL for a given artifact in the contribution * * @param contribution * @param artifact * @return * @throws ContributionReadException */ private static URL getArtifactURL(Contribution contribution, String artifact) throws ContributionReadException { try { URL url; if (contribution.toString().startsWith("jar:")) { url = new URL(new URL(contribution.getLocation()), artifact.toString()); } else { url = new URL("jar:" + contribution.getLocation() + "!/" + artifact); } return url; } catch (MalformedURLException e) { throw new ContributionReadException(e); } } }
public WireFormatJMSObject read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException { WireFormatJMSObject wireFormat = new WireFormatJMSObject(); String wrappedSingleInput = reader.getAttributeValue(null, WireFormatJMSObject.WIRE_FORMAT_JMS_OBJECT_WRAP_SINGLE_ATTR); if (wrappedSingleInput != null && wrappedSingleInput.length() > 0) { if ("true".equalsIgnoreCase(wrappedSingleInput)) { wireFormat.setWrappedSingleInput(true); } else if ("false".equalsIgnoreCase(wrappedSingleInput)) { wireFormat.setWrappedSingleInput(false); } else { throw new ContributionReadException(WireFormatJMSObject.WIRE_FORMAT_JMS_BYTES_QNAME.toString() + ": " + wrappedSingleInput + " is not a valid attribute value for " + WireFormatJMSObject.WIRE_FORMAT_JMS_OBJECT_WRAP_SINGLE_ATTR); } } return wireFormat; }
public WireFormatJMSDefault read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException { WireFormatJMSDefault wireFormat = new WireFormatJMSDefault(); String sendFormat = reader.getAttributeValue(null, WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_FORMAT_ATTR); if (sendFormat != null && sendFormat.length() > 0) { if (WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_TEXT_FORMAT_VAL.equalsIgnoreCase(sendFormat)) { wireFormat.setUseBytesMessage(false); }else if (WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_BYTES_FORMAT_VAL.equalsIgnoreCase(sendFormat)) { wireFormat.setUseBytesMessage(true); }else{ throw new ContributionReadException(WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_QNAME.toString() +" " +sendFormat + " is not a valid attribute value for " + WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_FORMAT_ATTR); } } return wireFormat; }
public WireFormatJMSDefault read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException { WireFormatJMSDefault wireFormat = new WireFormatJMSDefault(); String sendFormat = reader.getAttributeValue(null, WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_FORMAT_ATTR); if (sendFormat != null && sendFormat.length() > 0) { if (WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_TEXT_FORMAT_VAL.equalsIgnoreCase(sendFormat)) { wireFormat.setUseBytesMessage(false); }else if (WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_BYTES_FORMAT_VAL.equalsIgnoreCase(sendFormat)) { wireFormat.setUseBytesMessage(true); }else{ throw new ContributionReadException(WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_QNAME.toString() +" " +sendFormat + " is not a valid attribute value for " + WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_FORMAT_ATTR); } } return wireFormat; }
public WireFormatJMSObject read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException { WireFormatJMSObject wireFormat = new WireFormatJMSObject(); String wrappedSingleInput = reader.getAttributeValue(null, WireFormatJMSObject.WIRE_FORMAT_JMS_OBJECT_WRAP_SINGLE_ATTR); if (wrappedSingleInput != null && wrappedSingleInput.length() > 0) { if ("true".equalsIgnoreCase(wrappedSingleInput)) { wireFormat.setWrappedSingleInput(true); } else if ("false".equalsIgnoreCase(wrappedSingleInput)) { wireFormat.setWrappedSingleInput(false); } else { throw new ContributionReadException(WireFormatJMSObject.WIRE_FORMAT_JMS_BYTES_QNAME.toString() + ": " + wrappedSingleInput + " is not a valid attribute value for " + WireFormatJMSObject.WIRE_FORMAT_JMS_OBJECT_WRAP_SINGLE_ATTR); } } return wireFormat; }
/** * Scan the contribution to retrieve all artifact uris * * @param contribution * @return * @throws ContributionReadException */ private List<String> scanContributionArtifacts(Contribution contribution) throws ContributionReadException { File directory = directory(contribution); List<String> artifacts = new ArrayList<String>(); // [rfeng] There are cases that the folder contains symbolic links that point to the same physical directory Set<File> visited = new HashSet<File>(); try { traverse(artifacts, directory, directory, visited); } catch (IOException e) { throw new ContributionReadException(e); } return artifacts; }
/** * Scan the contribution to retrieve all artifact uris * * @param contribution * @return * @throws ContributionReadException */ private List<String> scanContributionArtifacts(Contribution contribution) throws ContributionReadException { File directory = directory(contribution); List<String> artifacts = new ArrayList<String>(); // [rfeng] There are cases that the folder contains symbolic links that point to the same physical directory Set<File> visited = new HashSet<File>(); try { traverse(artifacts, directory, directory, visited); } catch (IOException e) { throw new ContributionReadException(e); } return artifacts; }
public List<Artifact> scan(Contribution contribution) throws ContributionReadException { File directory = directory(contribution); List<Artifact> artifacts = new ArrayList<Artifact>(); List<String> artifactURIs = scanContributionArtifacts(contribution); for(String uri : artifactURIs) { try { File file = new File(directory, uri); Artifact artifact = contributionFactory.createArtifact(); artifact.setURI(uri); artifact.setLocation(file.toURI().toURL().toString()); artifacts.add(artifact); } catch (MalformedURLException e) { throw new ContributionReadException(e); } } contribution.getTypes().add(getContributionType()); return artifacts; }
public XSDefinition read(URL contributionURL, URI artifactURI, URL artifactURL, ProcessorContext context) throws ContributionReadException { try { return indexRead(artifactURL); } catch (Exception e) { ContributionReadException ce = new ContributionReadException(e); error(context.getMonitor(), "ContributionReadException", artifactURL, ce); throw ce; } }
public List<Artifact> scan(Contribution contribution) throws ContributionReadException { File directory = directory(contribution); List<Artifact> artifacts = new ArrayList<Artifact>(); List<String> artifactURIs = scanContributionArtifacts(contribution); for(String uri : artifactURIs) { try { File file = new File(directory, uri); Artifact artifact = contributionFactory.createArtifact(); artifact.setURI(uri); artifact.setLocation(file.toURI().toURL().toString()); artifacts.add(artifact); } catch (MalformedURLException e) { throw new ContributionReadException(e); } } contribution.getTypes().add(getContributionType()); return artifacts; }
public XSDefinition read(URL contributionURL, URI artifactURI, URL artifactURL, ProcessorContext context) throws ContributionReadException { try { return indexRead(artifactURL); } catch (Exception e) { ContributionReadException ce = new ContributionReadException(e); error(context.getMonitor(), "ContributionReadException", artifactURL, ce); throw ce; } }
public WSDLDefinition read(URL contributionURL, URI artifactURI, URL artifactURL, ProcessorContext context) throws ContributionReadException { try { WSDLDefinition definition = indexRead(artifactURL); definition.setURI(artifactURI); return definition; } catch (Exception e) { ContributionReadException ce = new ContributionReadException(e); error(context.getMonitor(), "ContributionReadException", artifactURL, ce); //throw ce; return null; } }
public WSDLDefinition read(URL contributionURL, URI artifactURI, URL artifactURL, ProcessorContext context) throws ContributionReadException { try { WSDLDefinition definition = indexRead(artifactURL); definition.setURI(artifactURI); return definition; } catch (Exception e) { ContributionReadException ce = new ContributionReadException(e); error(context.getMonitor(), "ContributionReadException", artifactURL, ce); //throw ce; return null; } }
/** * Read the BPEL Process definition file from the location identified by an artifact URL * @param contributionURL - URL of the Contribution containing the Process definition * @param artifactURI - URI of the artifact containing the BPEL Process definition * @param artifactURL - URL of the artifact containing the BPEL Process definition * @return BPELProcessDefinition - SCA model of the BPEL Process */ public BPELProcessDefinition read(URL contributionURL, URI artifactURI, URL artifactURL, ProcessorContext context) throws ContributionReadException { BPELProcessDefinition processDefinition = null; try { processDefinition = readProcessDefinition(artifactURL, context.getMonitor()); processDefinition.setURI(artifactURI.toString()); processDefinition.setUnresolved(true); } catch (Exception e) { ContributionReadException ce = new ContributionReadException(e); error(context.getMonitor(), "ContributionReadException", artifactURL, ce); } return processDefinition; }
/** * Read the BPEL Process definition file from the location identified by an artifact URL * @param contributionURL - URL of the Contribution containing the Process definition * @param artifactURI - URI of the artifact containing the BPEL Process definition * @param artifactURL - URL of the artifact containing the BPEL Process definition * @return BPELProcessDefinition - SCA model of the BPEL Process */ public BPELProcessDefinition read(URL contributionURL, URI artifactURI, URL artifactURL, ProcessorContext context) throws ContributionReadException { BPELProcessDefinition processDefinition = null; try { processDefinition = readProcessDefinition(artifactURL, context.getMonitor()); processDefinition.setURI(artifactURI.toString()); processDefinition.setUnresolved(true); } catch (Exception e) { ContributionReadException ce = new ContributionReadException(e); error(context.getMonitor(), "ContributionReadException", artifactURL, ce); } return processDefinition; }
/** * Base method which loads the component type from the application-context attached to the * Spring implementation * */ public void load(SpringImplementation implementation, ModelResolver resolver, ProcessorContext context) throws ContributionReadException { //System.out.println("Spring TypeLoader - load method start"); ComponentType componentType = implementation.getComponentType(); /* Check that there is a component type object already set */ if (componentType == null) { throw new ContributionReadException("SpringXMLLoader load: implementation has no ComponentType object"); } if (componentType.isUnresolved()) { /* Fetch the location of the application-context file from the implementation */ loadFromXML(implementation, resolver, context); if (!componentType.isUnresolved()) implementation.setUnresolved(false); } // end if //System.out.println("Spring TypeLoader - load method complete"); } // end method load
private void readAttachTo(ExternalAttachment attachment, XMLStreamReader reader, ProcessorContext context) { Monitor monitor = context.getMonitor(); String attachTo = reader.getAttributeValue(null, ATTACH_TO); if ( attachTo != null ) { try { XPath path = xpathHelper.newXPath(); NamespaceContext nsContext = xpathHelper.getNamespaceContext(attachTo, reader.getNamespaceContext()); path.setXPathFunctionResolver(new PolicyXPathFunctionResolver(nsContext)); attachTo = PolicyXPathFunction.normalize(attachTo,getSCAPrefix(nsContext)); XPathExpression expression = xpathHelper.compile(path, nsContext, attachTo); attachment.setAttachTo(attachTo); attachment.setAttachToXPathExpression(expression); } catch (XPathExpressionException e) { ContributionReadException ce = new ContributionReadException(e); error(monitor, "ContributionReadException", attachment, ce); } } }
private void readAttachTo(ExternalAttachment attachment, XMLStreamReader reader, ProcessorContext context) { Monitor monitor = context.getMonitor(); String attachTo = reader.getAttributeValue(null, ATTACH_TO); if ( attachTo != null ) { try { XPath path = xpathHelper.newXPath(); NamespaceContext nsContext = xpathHelper.getNamespaceContext(attachTo, reader.getNamespaceContext()); path.setXPathFunctionResolver(new PolicyXPathFunctionResolver(nsContext)); attachTo = PolicyXPathFunction.normalize(attachTo,getSCAPrefix(nsContext)); XPathExpression expression = xpathHelper.compile(path, nsContext, attachTo); attachment.setAttachTo(attachTo); attachment.setAttachToXPathExpression(expression); } catch (XPathExpressionException e) { ContributionReadException ce = new ContributionReadException(e); error(monitor, "ContributionReadException", attachment, ce); } } }