public WireDefinition load(XMLStreamReader reader, IntrospectionContext context) throws XMLStreamException { validateAttributes(reader, context); String source = reader.getAttributeValue(null, "source"); String target = reader.getAttributeValue(null, "target"); LoaderUtil.skipToEndElement(reader); URI sourceURI = helper.getURI(source); URI targetURI = helper.getURI(target); return new WireDefinition(sourceURI, targetURI); }
private boolean processImplementationClass(TimerImplementation implementation, XMLStreamReader reader, IntrospectionContext context) throws XMLStreamException { Location startLocation = reader.getLocation(); String implClass = reader.getAttributeValue(null, "class"); if (implClass == null) { MissingAttribute failure = new MissingAttribute("The class attribute was not specified", startLocation); context.addError(failure); LoaderUtil.skipToEndElement(reader); return false; } implementation.setImplementationClass(implClass); try { Class<?> clazz = context.getClassLoader().loadClass(implClass); if (!(Runnable.class.isAssignableFrom(clazz))) { InvalidTimerInterface failure = new InvalidTimerInterface(clazz, implementation); context.addError(failure); LoaderUtil.skipToEndElement(reader); return false; } } catch (ClassNotFoundException e) { ImplementationArtifactNotFound failure = new ImplementationArtifactNotFound(implClass, e.getMessage(), implementation); context.addError(failure); LoaderUtil.skipToEndElement(reader); return false; } return true; }
MissingAttribute error = new MissingAttribute("Persistence unit name not specified", startLocation); context.addError(error); LoaderUtil.skipToEndElement(reader); return null;
MissingAttribute error = new MissingAttribute("Persistence unit name not specified", startLocation); context.addError(error); LoaderUtil.skipToEndElement(reader); return null;
MissingAttribute error = new MissingAttribute("Persistence unit name not specified", startLocation); context.addError(error); LoaderUtil.skipToEndElement(reader); return null;
public FileBinding load(XMLStreamReader reader, IntrospectionContext context) throws XMLStreamException { Location startLocation = reader.getLocation(); String bindingName = reader.getAttributeValue(null, "name"); String location = reader.getAttributeValue(null, "location"); if (location == null) { MissingAttribute error = new MissingAttribute("The location attribute must be specified", startLocation); context.addError(error); } String archiveLocation = reader.getAttributeValue(null, "archive.location"); Strategy strategy = parseStrategy(reader); if (Strategy.ARCHIVE == strategy && archiveLocation == null) { MissingAttribute error = new MissingAttribute("An archive location must be specified", startLocation); context.addError(error); } String errorLocation = reader.getAttributeValue(null, "error.location"); String adapterClass = reader.getAttributeValue(null, "adapter"); String adapterUri = reader.getAttributeValue(null, "adapter.component"); String pattern = reader.getAttributeValue(null, "pattern"); long delay = parseDelay(reader, context); FileBinding binding = new FileBinding(bindingName, pattern, location, strategy, archiveLocation, errorLocation, adapterClass, adapterUri, delay); validateAttributes(reader, context, binding); LoaderUtil.skipToEndElement(reader); return binding; }
public PropertyValue load(XMLStreamReader reader, IntrospectionContext context) throws XMLStreamException { validateAttributes(reader, context); String name = reader.getAttributeValue(null, "name"); if (name == null || name.length() == 0) { MissingAttribute failure = new MissingAttribute("Missing name attribute", reader); context.addError(failure); return null; } String source = reader.getAttributeValue(null, "source"); String file = reader.getAttributeValue(null, "file"); if (source != null) { LoaderUtil.skipToEndElement(reader); return new PropertyValue(name, source); } else if (file != null) { try { URI uri = new URI(file); if (!uri.isAbsolute()) { uri = context.getSourceBase().toURI().resolve(uri); } LoaderUtil.skipToEndElement(reader); return new PropertyValue(name, uri); } catch (URISyntaxException e) { InvalidValue failure = new InvalidValue("File specified for property " + name + " is invalid: " + file, reader, e); context.addError(failure); return null; } } else { return loadInlinePropertyValue(name, reader, context); } }
public WsdlServiceContract load(XMLStreamReader reader, IntrospectionContext context) throws XMLStreamException { Location startLocation = reader.getLocation(); validateRemotable(reader, startLocation, context); WsdlServiceContract wsdlContract = processInterface(reader, startLocation, context); processCallbackInterface(reader, wsdlContract, context); helper.loadPolicySetsAndIntents(wsdlContract, reader, context); validateAttributes(reader, context, wsdlContract); LoaderUtil.skipToEndElement(reader); return wsdlContract; }
public JavaImplementation load(XMLStreamReader reader, IntrospectionContext introspectionContext) throws XMLStreamException { Location startLocation = reader.getLocation(); JavaImplementation implementation = new JavaImplementation(); validateAttributes(reader, introspectionContext, implementation); String implClass = reader.getAttributeValue(null, "class"); if (implClass == null) { MissingAttribute failure = new MissingAttribute("The class attribute was not specified", startLocation); introspectionContext.addError(failure); LoaderUtil.skipToEndElement(reader); return implementation; } Class<?> clazz; try { clazz = introspectionContext.getClassLoader().loadClass(implClass); } catch (ClassNotFoundException e) { ImplementationArtifactNotFound failure = new ImplementationArtifactNotFound(implClass, e.getMessage(), implementation); introspectionContext.addError(failure); LoaderUtil.skipToEndElement(reader); return null; } LoaderUtil.skipToEndElement(reader); implementation.setImplementationClass(clazz); InjectingComponentType componentType = new InjectingComponentType(clazz); introspector.introspect(componentType, introspectionContext); implementation.setComponentType(componentType); return implementation; }
public OperationDefinition load(XMLStreamReader reader, IntrospectionContext context) throws XMLStreamException { validateAttributes(reader, context); OperationDefinition operationDefinition = new OperationDefinition(); String name = reader.getAttributeValue(null, "name"); if (name == null) { MissingAttribute failure = new MissingAttribute("Operation name not specified", reader); context.addError(failure); } operationDefinition.setName(name); loaderHelper.loadPolicySetsAndIntents(operationDefinition, reader, context); LoaderUtil.skipToEndElement(reader); return operationDefinition; }
public TimerPoolResource load(XMLStreamReader reader, IntrospectionContext context) throws XMLStreamException { Location startLocation = reader.getLocation(); String name = reader.getAttributeValue(null, "name"); if (name == null) { MissingAttribute error = new MissingAttribute("Name not specified for timer pool", startLocation); context.addError(error); return new TimerPoolResource("error"); } String coreSizeAttr = reader.getAttributeValue(null, "size"); TimerPoolResource resource; if (coreSizeAttr == null) { resource = new TimerPoolResource(name); } else { try { int coreSize = Integer.parseInt(coreSizeAttr); resource = new TimerPoolResource(name, coreSize); } catch (NumberFormatException e) { InvalidValue error = new InvalidValue("Invalid core size specified for timer pool", startLocation, e); context.addError(error); return new TimerPoolResource(name); } } validateAttributes(reader, context, resource); LoaderUtil.skipToEndElement(reader); return resource; }
public TimerPoolResource load(XMLStreamReader reader, IntrospectionContext context) throws XMLStreamException { Location startLocation = reader.getLocation(); String name = reader.getAttributeValue(null, "name"); if (name == null) { MissingAttribute error = new MissingAttribute("Name not specified for timer pool", startLocation); context.addError(error); return new TimerPoolResource("error"); } String coreSizeAttr = reader.getAttributeValue(null, "size"); TimerPoolResource resource; if (coreSizeAttr == null) { resource = new TimerPoolResource(name); } else { try { int coreSize = Integer.parseInt(coreSizeAttr); resource = new TimerPoolResource(name, coreSize); } catch (NumberFormatException e) { InvalidValue error = new InvalidValue("Invalid core size specified for timer pool", startLocation, e); context.addError(error); return new TimerPoolResource(name); } } validateAttributes(reader, context, resource); LoaderUtil.skipToEndElement(reader); return resource; }
public WebImplementation load(XMLStreamReader reader, IntrospectionContext context) throws XMLStreamException { Location startLocation = reader.getLocation(); URI uri = parseUri(reader, startLocation, context); WebImplementation impl = new WebImplementation(uri); validateAttributes(reader, context, impl); for (WebImplementationIntrospector introspector : introspectors) { introspector.introspect(impl, context); } try { ComponentType type = impl.getComponentType(); // FIXME we should allow implementation to specify the component type; ComponentType componentType = loadComponentType(context); for (Map.Entry<String, ReferenceDefinition> entry : componentType.getReferences().entrySet()) { type.add(entry.getValue()); } for (Map.Entry<String, Property> entry : componentType.getProperties().entrySet()) { type.add(entry.getValue()); } } catch (LoaderException e) { if (e.getCause() instanceof FileNotFoundException) { // ignore since we allow component types not to be specified in the web app } else { ElementLoadFailure failure = new ElementLoadFailure("Error loading web.componentType", e, startLocation); context.addError(failure); return null; } } LoaderUtil.skipToEndElement(reader); return impl; }
public BindingType load(XMLStreamReader reader, IntrospectionContext context) throws XMLStreamException { validateAttributes(reader, context); String name = reader.getAttributeValue(null, "name"); QName qName = new QName(context.getTargetNamespace(), name); Set<QName> alwaysProvides; try { alwaysProvides = helper.parseListOfQNames(reader, "alwaysProvides"); Set<QName> mayProvide = helper.parseListOfQNames(reader, "mayProvide"); LoaderUtil.skipToEndElement(reader); return new BindingType(qName, alwaysProvides, mayProvide); } catch (InvalidPrefixException e) { String prefix = e.getPrefix(); URI uri = context.getContributionUri(); context.addError(new InvalidQNamePrefix("The prefix " + prefix + " specified in the definitions.xml file in contribution " + uri + " is invalid", reader)); } return null; }
FieldInjectionSite site = new FieldInjectionSite(ConversationalDaoImpl.class.getDeclaredField("entityManager")); pojoComponentType.add(resource, site); LoaderUtil.skipToEndElement(reader);
public SystemImplementation load(XMLStreamReader reader, IntrospectionContext introspectionContext) throws XMLStreamException { Location startLocation = reader.getLocation(); SystemImplementation implementation = new SystemImplementation(); validateAttributes(reader, introspectionContext, implementation); String implClass = reader.getAttributeValue(null, "class"); if (implClass == null) { MissingAttribute failure = new MissingAttribute("Implementation class must be specified using the class attribute", startLocation); introspectionContext.addError(failure); return null; } Class<?> clazz; try { clazz = introspectionContext.getClassLoader().loadClass(implClass); } catch (ClassNotFoundException e) { InvalidValue failure = new InvalidValue("Implementation class not found:" + implClass, startLocation); introspectionContext.addError(failure); return null; } LoaderUtil.skipToEndElement(reader); implementation.setImplementationClass(clazz); InjectingComponentType componentType = new InjectingComponentType(clazz); implementationIntrospector.introspect(componentType, introspectionContext); implementation.setComponentType(componentType); return implementation; }
public ImplementationType load(XMLStreamReader reader, IntrospectionContext context) throws XMLStreamException { validateAttributes(reader, context); try { String name = reader.getAttributeValue(null, "name"); QName qName = helper.createQName(name, reader); Set<QName> alwaysProvides = helper.parseListOfQNames(reader, "alwaysProvides"); Set<QName> mayProvide = helper.parseListOfQNames(reader, "mayProvide"); LoaderUtil.skipToEndElement(reader); return new ImplementationType(qName, alwaysProvides, mayProvide); } catch (InvalidPrefixException e) { String prefix = e.getPrefix(); URI uri = context.getContributionUri(); context.addError(new InvalidQNamePrefix("The prefix " + prefix + " specified in the definitions.xml file in contribution " + uri + " is invalid", reader)); } return null; }
LoaderUtil.skipToEndElement(reader);
LoaderUtil.skipToEndElement(reader);
public TimerImplementation load(XMLStreamReader reader, IntrospectionContext context) throws XMLStreamException { Location startLocation = reader.getLocation(); TimerImplementation implementation = new TimerImplementation(); validateAttributes(reader, context, implementation); if (!processImplementationClass(implementation, reader, context)) { // an error with the implementation class, return a dummy implementation InjectingComponentType type = new InjectingComponentType(null); implementation.setComponentType(type); return implementation; } TimerData data = new TimerData(); implementation.setTimerData(data); String poolName = reader.getAttributeValue(null, "poolName"); if (poolName != null) { data.setPoolName(poolName); } processInitialDelay(data, reader, startLocation, context); processTimeUnit(data, reader, startLocation, context); processIntervalClass(reader, context, implementation); processRepeatInterval(reader, startLocation, context, implementation); processRepeatFixedRate(reader, startLocation, context, implementation); processFireOnce(reader, startLocation, context, implementation); processIntervalMethod(context, implementation); validateData(startLocation, context, data); loaderHelper.loadPolicySetsAndIntents(implementation, reader, context); InjectingComponentType componentType = implementationProcessor.introspect(implementation.getImplementationClass(), context); implementation.setComponentType(componentType); LoaderUtil.skipToEndElement(reader); return implementation; }