Examples of Schema


Examples of liquibase.structure.core.Schema


    @Override
    protected DatabaseObject snapshotObject(DatabaseObject example, DatabaseSnapshot snapshot) throws DatabaseException {
        Database database = snapshot.getDatabase();
        Schema schema = example.getSchema();

        List<CachedRow> viewsMetadataRs = null;
        try {
            viewsMetadataRs = ((JdbcDatabaseSnapshot) snapshot).getMetaData().getViews(((AbstractJdbcDatabase) database).getJdbcCatalogName(schema), ((AbstractJdbcDatabase) database).getJdbcSchemaName(schema), example.getName());
            if (viewsMetadataRs.size() > 0) {
                CachedRow row = viewsMetadataRs.get(0);
                String rawViewName = row.getString("TABLE_NAME");
                String rawSchemaName = StringUtils.trimToNull(row.getString("TABLE_SCHEM"));
                String rawCatalogName = StringUtils.trimToNull(row.getString("TABLE_CAT"));
                String remarks = row.getString("REMARKS");
                if (remarks != null) {
                    remarks = remarks.replace("''", "'"); //come back escaped sometimes
                }

                View view = new View().setName(cleanNameFromDatabase(rawViewName, database));
                view.setRemarks(remarks);

                CatalogAndSchema schemaFromJdbcInfo = ((AbstractJdbcDatabase) database).getSchemaFromJdbcInfo(rawCatalogName, rawSchemaName);
                view.setSchema(new Schema(schemaFromJdbcInfo.getCatalogName(), schemaFromJdbcInfo.getSchemaName()));

                try {
                    String definition = database.getViewDefinition(schemaFromJdbcInfo, view.getName());

                    if (definition.startsWith("FULL_DEFINITION: ")) {
View Full Code Here

Examples of mondrian.olap.Schema

    MondrianCatalogComplementInfo catalogComplementInfo =
      MondrianCatalogHelper.getInstance().getCatalogComplementInfoMap( catalog );

    try {

      Schema schema = connection.getSchema();
      if ( schema == null ) {
        Logger
          .error(
            "MondrianModelComponent", Messages.getInstance()
            .getErrorString( "MondrianModel.ERROR_0002_INVALID_SCHEMA",
              connection.getConnectString() ) ); //$NON-NLS-1$ //$NON-NLS-2$
        return null;
      }

      Cube[] cubes = schema.getCubes();
      if ( ( cubes == null ) || ( cubes.length == 0 ) ) {
        Logger
          .error(
            "MondrianModelComponent", Messages.getInstance()
            .getErrorString( "MondrianModel.ERROR_0003_NO_CUBES",
View Full Code Here

Examples of nexj.core.meta.integration.format.xml.schema.Schema

   {
      SchemaUniverse universe = new SchemaUniverse();
      XSDSchemaExporter xsdExporter = new XSDSchemaExporter(universe);
      MessageSchemaConverter schemaExporter = new MessageSchemaConverter(universe);
      Message msg = m_context.getMetadata().getMessage("XML_Inherit_Schema_Reference");
      Schema schema = schemaExporter.add(msg).getSchema();

      xsdExporter.exportSchema(schema, m_resultWriter);

      assertEquals(
         "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
View Full Code Here

Examples of org.apache.ambari.server.controller.spi.Schema

    public void process(Request request, TreeNode<Resource> resultNode, String href) {
      Resource r = resultNode.getObject();
      TreeNode<Resource> parent = resultNode.getParent();

      if (parent.getName() != null) {
        Schema schema = getClusterController().getSchema(r.getType());
        Object id = r.getPropertyValue(schema.getKeyPropertyId(r.getType()));

        int i = href.indexOf("?");
        if (i != -1) {
          href = href.substring(0, i);
        }
View Full Code Here

Examples of org.apache.avro.Schema

  protected Schema createSchema(Type type, Map<String,Schema> names) {
    if (type instanceof GenericArrayType) {                  // generic array
      Type component = ((GenericArrayType)type).getGenericComponentType();
      if (component == Byte.TYPE)                            // byte array
        return Schema.create(Schema.Type.BYTES);          
      Schema result = Schema.createArray(createSchema(component, names));
      setElement(result, component);
      return result;
    } else if (type instanceof ParameterizedType) {
      ParameterizedType ptype = (ParameterizedType)type;
      Class raw = (Class)ptype.getRawType();
      Type[] params = ptype.getActualTypeArguments();
      if (Map.class.isAssignableFrom(raw)) {                 // Map
        Schema schema = Schema.createMap(createSchema(params[1], names));
        Class key = (Class)params[0];
        if (isStringable(key)) {                             // Stringable key
          schema.addProp(KEY_CLASS_PROP, key.getName());
        } else if (key != String.class) {
          throw new AvroTypeException("Map key class not String: "+key);
        }
        return schema;
      } else if (Collection.class.isAssignableFrom(raw)) {   // Collection
        if (params.length != 1)
          throw new AvroTypeException("No array type specified.");
        Schema schema = Schema.createArray(createSchema(params[0], names));
        schema.addProp(CLASS_PROP, raw.getName());
        return schema;
      }
    } else if ((type == Byte.class) || (type == Byte.TYPE)) {
      Schema result = Schema.create(Schema.Type.INT);
      result.addProp(CLASS_PROP, Byte.class.getName());
      return result;
    } else if ((type == Short.class) || (type == Short.TYPE)) {
      Schema result = Schema.create(Schema.Type.INT);
      result.addProp(CLASS_PROP, Short.class.getName());
      return result;
    } else if ((type == Character.class) || (type == Character.TYPE)) {
        Schema result = Schema.create(Schema.Type.INT);
        result.addProp(CLASS_PROP, Character.class.getName());
        return result;
    } else if (type instanceof Class) {                      // Class
      Class<?> c = (Class<?>)type;
      if (c.isPrimitive() ||                                 // primitives
          c == Void.class || c == Boolean.class ||
          c == Integer.class || c == Long.class ||
          c == Float.class || c == Double.class ||
          c == Byte.class || c == Short.class ||
          c == Character.class)
        return super.createSchema(type, names);
      if (c.isArray()) {                                     // array
        Class component = c.getComponentType();
        if (component == Byte.TYPE) {                        // byte array
          Schema result = Schema.create(Schema.Type.BYTES);
          result.addProp(CLASS_PROP, c.getName());
          return result;
        }
        Schema result = Schema.createArray(createSchema(component, names));
        result.addProp(CLASS_PROP, c.getName());
        setElement(result, component);
        return result;
      }
      AvroSchema explicit = c.getAnnotation(AvroSchema.class);
      if (explicit != null)                                  // explicit schema
        return Schema.parse(explicit.value());
      if (CharSequence.class.isAssignableFrom(c))            // String
        return Schema.create(Schema.Type.STRING);
      if (ByteBuffer.class.isAssignableFrom(c))              // bytes
        return Schema.create(Schema.Type.BYTES);
      if (Collection.class.isAssignableFrom(c))              // array
        throw new AvroRuntimeException("Can't find element type of Collection");
      String fullName = c.getName();
      Schema schema = names.get(fullName);
      if (schema == null) {
        String name = c.getSimpleName();
        String space = c.getPackage() == null ? "" : c.getPackage().getName();
        if (c.getEnclosingClass() != null)                   // nested class
          space = c.getEnclosingClass().getName() + "$";
        Union union = c.getAnnotation(Union.class);
        if (union != null) {                                 // union annotated
          return getAnnotatedUnion(union, names);
        } else if (isStringable(c)) {                        // Stringable
          Schema result = Schema.create(Schema.Type.STRING);
          result.addProp(CLASS_PROP, c.getName());
          return result;
        } else if (c.isEnum()) {                             // Enum
          List<String> symbols = new ArrayList<String>();
          Enum[] constants = (Enum[])c.getEnumConstants();
          for (int i = 0; i < constants.length; i++)
            symbols.add(constants[i].name());
          schema = Schema.createEnum(name, null /* doc */, space, symbols);
          consumeAvroAliasAnnotation(c, schema);
        } else if (GenericFixed.class.isAssignableFrom(c)) { // fixed
          int size = c.getAnnotation(FixedSize.class).value();
          schema = Schema.createFixed(name, null /* doc */, space, size);
          consumeAvroAliasAnnotation(c, schema);
        } else if (IndexedRecord.class.isAssignableFrom(c)) { // specific
          return super.createSchema(type, names);
        } else {                                             // record
          List<Schema.Field> fields = new ArrayList<Schema.Field>();
          boolean error = Throwable.class.isAssignableFrom(c);
          schema = Schema.createRecord(name, null /* doc */, space, error);
          consumeAvroAliasAnnotation(c, schema);
          names.put(c.getName(), schema);
          for (Field field : getCachedFields(c))
            if ((field.getModifiers()&(Modifier.TRANSIENT|Modifier.STATIC))==0
                && !field.isAnnotationPresent(AvroIgnore.class)) {
              Schema fieldSchema = createFieldSchema(field, names);
              AvroDefault defaultAnnotation
                = field.getAnnotation(AvroDefault.class);
              JsonNode defaultValue = (defaultAnnotation == null)
                ? null
                : Schema.parseJson(defaultAnnotation.value());
             
              if (defaultValue == null
                  && fieldSchema.getType() == Schema.Type.UNION) {
                Schema defaultType = fieldSchema.getTypes().get(0);
                if (defaultType.getType() == Schema.Type.NULL) {
                  defaultValue = NullNode.getInstance();
                }
              }
              AvroName annotatedName = field.getAnnotation(AvroName.class);       // Rename fields
              String fieldName = (annotatedName != null)           
View Full Code Here

Examples of org.apache.beehive.wsm.wsdl.Schema

     * @return
     * @throws Exception
     */
    private void writeSchemaForDocType(SchemaType docType, Types types)
            throws Exception {
        Schema mySchema = Utilities.findtSchemaDocument(docType);

        QName q = docType.getName();

        XmlObject typeNodeInWSDL = mySchema.getTypeNode(q);

        if (null == typeNodeInWSDL)
            throw new RuntimeException(
                    "Type for object not found in the assigned WSDL file. "
                            + docType.getName() + " schema in: "
View Full Code Here

Examples of org.apache.blur.thrift.generated.Schema

  }

  public Schema schema(String table) throws IOException {
    TableContext tableContext = getTableContext(table);
    FieldManager fieldManager = tableContext.getFieldManager();
    Schema schema = new Schema().setTable(table);
    schema.setFamilies(new HashMap<String, Map<String, ColumnDefinition>>());
    Set<String> fieldNames = fieldManager.getFieldNames();
    INNER: for (String fieldName : fieldNames) {
      FieldTypeDefinition fieldTypeDefinition = fieldManager.getFieldTypeDefinition(fieldName);
      if (fieldTypeDefinition == null) {
        continue INNER;
      }
      String columnName = fieldTypeDefinition.getColumnName();
      String columnFamily = fieldTypeDefinition.getFamily();
      String subColumnName = fieldTypeDefinition.getSubColumnName();
      Map<String, ColumnDefinition> map = schema.getFamilies().get(columnFamily);
      if (map == null) {
        map = new HashMap<String, ColumnDefinition>();
        schema.putToFamilies(columnFamily, map);
      }
      if (subColumnName == null) {
        map.put(columnName, getColumnDefinition(fieldTypeDefinition));
      } else {
        map.put(columnName + "." + subColumnName, getColumnDefinition(fieldTypeDefinition));
View Full Code Here

Examples of org.apache.cocoon.components.validation.Schema

            Source schemaSrc = getSourceResolver().resolveURI(schDoc);

            try {
                InputSource is = SourceUtil.getInputSource(schemaSrc);
                SchemaFactory schf = SchemaFactory.lookup(schNS);
                Schema sch = schf.compileSchema(is);

                return sch.newValidator();
            } finally {
                getSourceResolver().release(schemaSrc);
            }
        } catch (Exception e) {
            // couldn't load the validator
View Full Code Here

Examples of org.apache.cocoon.validation.Schema

      File file = new File( args[0] );
      if ( !file.exists () ) throw new Exception("Error: schema file not found !");
     InputStream istrm = new FileInputStream ( file );
     InputSource is = new InputSource ( istrm );
     SchemaFactory schf = SchemaFactory.lookup( SchemaFactory.NAMESPACE_SCHEMATRON );
     Schema sch = schf.compileSchema( is );
     Validator validator = sch.newValidator();

     // set preprocessor parameters
      if (args.length > 1)
         validator.setProperty("phase", new String(args[1]));
View Full Code Here

Examples of org.apache.directory.api.converter.schema.Schema


    private String transform( String name ) throws ParserException, IOException
    {
        List<Schema> schemas = new ArrayList<Schema>();
        Schema schema = new Schema();
        schema.setName( name );
        schema.setInput( getClass().getResourceAsStream( name + ".schema" ) );

        Writer out = new StringWriter( 2048 );
        schema.setOutput( out );
        schemas.add( schema );

        SchemaToLdif.transform( schemas );

        String res = out.toString();
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.