Package org.openquark.util.xml

Examples of org.openquark.util.xml.BadXMLDocumentException


       
        // Check that the number of reflected inputs is the same as the number of reflector inputs.
        int nReflectedInputs = reflectedInputs.size();
        if (nReflectedInputs != getNInputs()) {
            // What to do?
            throw new BadXMLDocumentException(null,
                                              "Number of loaded reflector arguments is inconsistent: " + nReflectedInputs + " != " + getNInputs());
        }
       
        // Populate the inputToReflectedInput map
        for (int i = 0; i < nReflectedInputs; i++) {
View Full Code Here


               
            } else if (typeString.equals(LocalizedResourceName.LOCALIZED_RESOURCE_NAME_TYPE)) {
                return LocalizedResourceName.makeFromXML(name, it);

            } else {
                throw new BadXMLDocumentException(parentNode, "unknown resource name type: " + typeString);
            }

        } catch (BadXMLDocumentException e) {
            return null;
        }
View Full Code Here

           
            } else if (typeString.equals(ARGUMENT.getTypeName())) {
                type = ARGUMENT;
           
            } else {
                throw new BadXMLDocumentException(parentNode, "unknown feature name type: " + typeString);
            }

            return new CALFeatureName(type, name);

        } catch (BadXMLDocumentException e) {
View Full Code Here

            }


            // sanity test..
            if (GemCutterPersistenceHelper.isDisplayedGemElement(childNode)) {
                BadXMLDocumentException bxde = new BadXMLDocumentException(childNode, "Gem elements must appear before connection elements.");
                loadStatus.add(new Status(Status.Severity.ERROR, GemCutter.getResourceString("SOM_InvalidXMLstructure"), bxde));
            }

        } finally {
            // Try to recover from unexpected exceptions..
View Full Code Here

            } else if (gemClass == RecordCreationGem.class) {
                loadedGem = RecordCreationGem.getFromXML(gemElement, gemContext, loadInfo);

            } else {
                throw new BadXMLDocumentException(gemElement, "Unhandled gem class: " + gemClass);
            }

            return createDisplayedGem(loadedGem, location);

        } catch (BadXMLDocumentException bxde) {
View Full Code Here

        XMLPersistenceHelper.checkTag(moduleDescriptionElement, WorkspacePersistenceConstants.MODULE_TAG);
       
        String moduleNameString = moduleDescriptionElement.getAttribute(WorkspacePersistenceConstants.MODULE_NAME_ATTR);
        if (moduleNameString.equals("")) {
            String errorString = "Could not obtain module from workspace description.";
            throw new BadXMLDocumentException(moduleDescriptionElement, errorString);
        }
       
        ModuleName moduleName = ModuleName.make(moduleNameString);
       
        List<Element> childElems = XMLPersistenceHelper.getChildElements(moduleDescriptionElement);
        int nChildElems = childElems.size();

        // Get the vault info element.
        Element vaultElement = (nChildElems < 1) ? null : childElems.get(0);
        XMLPersistenceHelper.checkIsElement(vaultElement);

        // Get the module revision.
        Element moduleRevisionElement = (nChildElems < 2) ? null : childElems.get(1);
        XMLPersistenceHelper.checkTag(moduleRevisionElement, WorkspacePersistenceConstants.MODULE_REVISION_TAG);
        Integer moduleRevisionNum = XMLPersistenceHelper.getElementIntegerValue(moduleRevisionElement);
       
        if (moduleRevisionNum == null) {
            throw new BadXMLDocumentException(moduleRevisionElement, "No module revision found.");
        }
       
        // Get resource info.
        Element revisionInfoElement = (nChildElems < 3) ? null : childElems.get(2);
        XMLPersistenceHelper.checkIsElement(revisionInfoElement);
View Full Code Here

               Element featureRevisionNumElement = (nFeatureChildElems < 2) ? null : featureChildElems.get(1);
               XMLPersistenceHelper.checkIsElement(featureRevisionNumElement);
               final Long featureRevisionNum = XMLPersistenceHelper.getElementLongValue(featureRevisionNumElement);
              
               if (featureRevisionNum == null) {
                   throw new BadXMLDocumentException(featureRevisionNumElement, "No feature revision found.");
               }
              
               ResourceRevision metadataRevision =
                       new ResourceRevision(new ResourceIdentifier(resourceType, resourceName), featureRevisionNum.longValue());
               revisionList.add(metadataRevision);
              
               // sync time
               Element featureSyncTimeElement = (nFeatureChildElems < 3) ? null : featureChildElems.get(2);
               XMLPersistenceHelper.checkIsElement(featureSyncTimeElement);
               final Long featureSyncTimeNum = XMLPersistenceHelper.getElementLongValue(featureSyncTimeElement);
              
               if (featureSyncTimeNum == null) {
                   throw new BadXMLDocumentException(featureSyncTimeElement, "No feature sync time found.");
               }

               WorkspaceResource.SyncTime syncTime = new WorkspaceResource.SyncTime(new ResourceIdentifier(resourceType, resourceName), featureSyncTimeNum.longValue());
               syncTimeList.add(syncTime);
           }
View Full Code Here

        Iterator<Element> it = elements.iterator();
       
        Node element = it.next();       
        ResourceName persistedResourceName = ResourceName.getResourceNameWithCALFeatureNameFromXML(element);
        if (!persistedResourceName.getFeatureName().equals(getFeatureName())) {
            throw new BadXMLDocumentException(element, "CAL feature name " + getFeatureName() + " does not match the persisted feature name");
        }
       
        element = it.next();
        XMLPersistenceHelper.checkIsTagElement(element, MetadataPersistenceConstants.DISPLAY_NAME_TAG);
        displayName = XMLPersistenceHelper.getElementStringValue(element);
View Full Code Here

            Gem inputGem = gemContext.getGem(inputInfo.fst());
            int inputIndex = (inputInfo.snd()).intValue();
           
            if (inputGem == null) {
                throw new BadXMLDocumentException(null, "Argument gem not found.");
            }
           
            Gem.PartInput targetingInput = inputGem.getInputPart(inputIndex);
           
            targetingArgumentSet.add(targetingInput);
View Full Code Here

        XMLPersistenceHelper.checkIsElement(fieldNamesElement);

        List<Element> fieldsChildElems = XMLPersistenceHelper.getChildElements(fieldNamesElement);

        if (fieldsChildElems.size() != nArgumentsChildElems) {
            throw new BadXMLDocumentException(null, "Number of fields and inputs do not correspond.");
        }

        // Erase the default fields
        fields.clear();
View Full Code Here

TOP

Related Classes of org.openquark.util.xml.BadXMLDocumentException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.