Examples of SchemaException


Examples of com.esri.gpt.catalog.schema.SchemaException

      String loc = Val.chkStr(request.getParameter("loc"));
      if (key.length() > 0) {
        Schemas schemas = context.getCatalogConfiguration().getConfiguredSchemas();
        Schema schema = schemas.get(key);
        if (schema == null) {
          throw new SchemaException("Unsupported schema key.");
        } else {
          definition = schema.getGxeEditorDefinition();
        }
      } else if (loc.length() > 0) {
        definition = new GxeDefinition();
        definition.setFileLocation(loc);
      }
      String sCfg = "";
      if (definition != null) {
        msgBroker = this.getMessageBroker(request,response,context,msgBroker);
        sCfg = this.generateDefinition(request,response,context,msgBroker,definition);
      }
     
      // set the response
      if ((sCfg != null) && (sCfg.length() > 0)) {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        sb.append("\r\n\"cfgDefinition\":").append(sCfg);
        sb.append("\r\n}");
        sResponse = sb.toString();
      } else {
        throw new SchemaException("Unsupported schema type.");
      }

    } catch (Throwable t) {
      if (!(t instanceof SchemaException)) {
        LOGGER.log(Level.WARNING,"Error processing request.",t);
View Full Code Here

Examples of com.esri.gpt.catalog.schema.SchemaException

        sb.append(",\r\n\"xml\":\"").append(
            Val.escapeStrForJson(schema.getActiveDocumentXml())).append("\"");
        sb.append("\r\n}");
        sResponse = sb.toString();
      } else {
        throw new SchemaException("Unsupported XML type.");
      }

    } catch (Throwable t) {
      if (!(t instanceof SchemaException)) {
        LOGGER.log(Level.WARNING,"Error processing request.",t);
View Full Code Here

Examples of com.esri.gpt.catalog.schema.SchemaException

  
  // determine the uuid for the document to open
  String sOpenDocumentUuid = getOpenDocumentUuid();
  if (sOpenDocumentUuid.length() == 0) {
    String sMsg = "Programming error: The openDocumentUuid was not specified.";
    throw new SchemaException(sMsg);
  }
 
  // determine the owner
  ImsMetadataAdminDao adminDao = new ImsMetadataAdminDao(context);
  setOnBehalfOf(adminDao.queryOwnerDN(sOpenDocumentUuid));
View Full Code Here

Examples of com.esri.gpt.catalog.schema.SchemaException

  // find the metadata editor form
  UIViewRoot root = getContextBroker().extractViewRoot();
  UIComponent editorForm = root.findComponent("mdEditor");
  if (editorForm == null) {
    String sMsg = "Programming error: The mdEditor form connot be located.";
    throw new SchemaException(sMsg);
  }
 
  // determine the currently open schema
  String sOpenSchemaKey = getOpenSchemaKey();
  if (sOpenSchemaKey.length() == 0) {
    String sMsg = "Programming error: The openSchemaKey was not specified.";
    throw new SchemaException(sMsg);
  } else {
    MetadataDocument document = new MetadataDocument();
    schema = document.prepareForCreate(context,sOpenSchemaKey);
  }
 
View Full Code Here

Examples of org.apache.wsif.compiler.schema.SchemaException

                        "attributeGroup",
                        ref.getLocalPart(),
                        false),
                    false);
        else {
            throw new SchemaException(
                "Attribute group can only be defined at " + "the top level.");
        }
        file.addField(field);

        return file;
View Full Code Here

Examples of org.apache.wsif.compiler.schema.SchemaException

            // However, it could also be a simpleType in which case we are screwed.

            String javaType = getJavaType(type, targetURI, "complexType");
            file.addField(new ClassField(javaType, name, elm.isArray()));
        } else if (child == null) {
            throw new SchemaException(
                "The type of this element is unknown: '" + name + "'.");
        } else if (child.getElementType() == SchemaType.SIMPLETYPE) {
            file =
                simpleType2Field(
                    name,
                    elm.isArray(),
                    (SchemaSimpleType) child,
                    file);
        } else if (child.getElementType() == SchemaType.COMPLEXTYPE) {
            throw new SchemaException(
                "Inner complex-types are not supported: '" + name + "'.");

            //      String cname = Conventions.schema2JavaName ("element", name, true);
            //      file.addField (new ClassField (cname, name, elm.isArray ()));
            //      file.addInnerClass (complexType2Class (cname, (SchemaComplexType) child));
View Full Code Here

Examples of org.apache.wsif.compiler.schema.SchemaException

                "Argument to 'getJavaType' " + "cannot be null.");

        String type = (String) registry.get(name);

        if (type == null) {
            throw new SchemaException(
                "Basic type '" + name + "' not supported.");

            //      type = getGenericJavaName (name, elementType);
        }
View Full Code Here

Examples of org.apache.wsif.compiler.schema.SchemaException

        for (Iterator it2 = simpleTypeTable.keySet().iterator();
            it2.hasNext();
            ) {
            if (!registry.containsKey((QName) it2.next()))
                throw new SchemaException(
                    "'simpleType' definitions have cyclic " + "dependency.");
        }

        for (int i = 0; i < elements.size(); i++) {
            SchemaType element = (SchemaType) elements.elementAt(i);
View Full Code Here

Examples of org.exolab.castor.xml.schema.SchemaException

            if (schemaLocation.indexOf("\\") != -1) {
                String err = "'" + schemaLocation +
                    "' is not a valid URI as defined by IETF RFC 2396.";
                err += "The URI mustn't contain '\\'.";
                throw new SchemaException(err);
            }

            if (namespace == null) namespace = "";

            try {
                String documentBase = locator.getSystemId();
                if (documentBase != null) {
                    if (!documentBase.endsWith("/"))
                        documentBase = documentBase.substring(0, documentBase.lastIndexOf('/') +1 );
                }
                uri = getURIResolver().resolve(schemaLocation, documentBase);
                if (uri != null) {
                    schemaLocation = uri.getAbsoluteURI();
                }
            }
            catch (URIException urix) {
                throw new XMLException(urix);
            }
        }
        else {
            schemaLocation = namespace;
            try {
                uri = getURIResolver().resolveURN(namespace);
            }
            catch (URIException urix) {
                throw new XMLException(urix);
            }
            if (uri == null) {
                String err = "Unable to resolve Schema corresponding " +
                    "to namespace '" + namespace + "'.";
                throw new SchemaException(err);

            }
        }

        //-- Make sure targetNamespace is not the same as the
        //-- importing schema, see section 4.2.3 in the
        //-- XML Schema Recommendation
        if (namespace.equals(schema.getTargetNamespace()) )
            throw new SchemaException("the 'namespace' attribute in the <import> element cannot be the same of the targetNamespace of the global schema");

        //-- Schema object to hold import schema
        boolean addSchema = false;
        Schema importedSchema = schema.getImportedSchema(namespace, true);

        //-- Have we already imported this XML Schema file?
        if (state.processed(schemaLocation)) {
           if (importedSchema == null)
               schema.addImportedSchema(state.getSchema(schemaLocation));
           return;
        }

        boolean alreadyLoaded = false;
        if (importedSchema == null) {
            if (uri instanceof SchemaLocation) {
                importedSchema = ((SchemaLocation)uri).getSchema();
                schema.addImportedSchema(importedSchema);
                alreadyLoaded = true;
            }
            else {
                importedSchema = new Schema();
                addSchema = true;
            }
        }
        else {
            // check schema location, if different, allow merge
            if (hasLocation) {
                String tmpLocation = importedSchema.getSchemaLocation();
                alreadyLoaded = schemaLocation.equals(tmpLocation) || importedSchema.includeProcessed(schemaLocation);
                //-- keep track of the original schemaLocation as an include
                if(! alreadyLoaded) {
                    importedSchema.addInclude(tmpLocation);
                }
            } else {
                //-- only namespace can be used, no way to distinguish
                //-- multiple imports...mark as alreadyLoaded
                //-- see W3C XML Schema 1.0 Recommendation (part 1)
                //-- section 4.2.3...
                //-- <quote>... Given that the schemaLocation [attribute] is only
                //--   a hint, it is open to applications to ignore all but the
                //--   first <import> for a given namespace, regardless of the
                //--   <em>actual value</em> of schemaLocation, but such a strategy
                //--   risks missing useful information when new schemaLocations
                //--  are offered.</quote>
                alreadyLoaded = true;
            }
        }

        state.markAsProcessed(schemaLocation, importedSchema);

        if (alreadyLoaded) return;

        //-- Parser Schema
        Parser parser = null;
        try {
            parser = getSchemaContext().getParser();
        }
        catch(RuntimeException rte) {}
        if (parser == null) {
            throw new SchemaException("Error failed to create parser for import");
        }
    //-- Create Schema object and setup unmarshaller
    SchemaUnmarshaller schemaUnmarshaller = new SchemaUnmarshaller(getSchemaContext(), state);
          schemaUnmarshaller.setURIResolver(getURIResolver());
    schemaUnmarshaller.setSchema(importedSchema);
    Sax2ComponentReader handler = new Sax2ComponentReader(schemaUnmarshaller);
    parser.setDocumentHandler(handler);
    parser.setErrorHandler(handler);

        try {
            InputSource source = new InputSource(uri.getReader());
            source.setSystemId(uri.getAbsoluteURI());
            parser.parse(source);
        }
        catch(java.io.IOException ioe) {
            throw new SchemaException("Error reading import file '"+schemaLocation+"': "+ ioe);
        }
        catch(org.xml.sax.SAXException sx) {
            throw new SchemaException(sx);
        }

        //-- Add schema to list of imported schemas (if not already present)
        if (addSchema)
        {
View Full Code Here

Examples of org.exolab.castor.xml.schema.SchemaException

        else {
            StringBuffer err = new StringBuffer("illegal element <");
            err.append(name);
            err.append("> found in <group>.");
            throw new SchemaException(err.toString());
        }

    } //-- startElement
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.