Skip to content

Commit

Permalink
# IGNITE-32: Refactored types metadata to cache package from.
Browse files Browse the repository at this point in the history
  • Loading branch information
akuznetsov-gridgain committed Feb 3, 2015
1 parent 8e5c0a8 commit ed2af98
Show file tree
Hide file tree
Showing 22 changed files with 516 additions and 966 deletions.
Expand Up @@ -344,6 +344,9 @@ public class CacheConfiguration extends MutableConfiguration {
*/ */
private boolean readFromBackup = DFLT_READ_FROM_BACKUP; private boolean readFromBackup = DFLT_READ_FROM_BACKUP;


/** Collection of type metadata. */
private Collection<CacheTypeMetadata> typeMeta;

/** Empty constructor (all values are initialized to their defaults). */ /** Empty constructor (all values are initialized to their defaults). */
public CacheConfiguration() { public CacheConfiguration() {
/* No-op. */ /* No-op. */
Expand Down Expand Up @@ -427,6 +430,7 @@ public CacheConfiguration(CompleteConfiguration cfg) {
writeBehindFlushSize = cc.getWriteBehindFlushSize(); writeBehindFlushSize = cc.getWriteBehindFlushSize();
writeBehindFlushThreadCnt = cc.getWriteBehindFlushThreadCount(); writeBehindFlushThreadCnt = cc.getWriteBehindFlushThreadCount();
writeSync = cc.getWriteSynchronizationMode(); writeSync = cc.getWriteSynchronizationMode();
typeMeta = cc.getTypeMetadata();
} }


/** /**
Expand Down Expand Up @@ -1750,6 +1754,25 @@ public void setKeepPortableInStore(boolean keepPortableInStore) {
this.keepPortableInStore = keepPortableInStore; this.keepPortableInStore = keepPortableInStore;
} }


/**
* Gets collection of type metadata objects.
*
* @return Collection of type metadata.
*/
public Collection<CacheTypeMetadata> getTypeMetadata() {
return typeMeta;
}

/**
* Sets collection of type metadata objects.
*
* @param typeMeta Collection of type metadata.
*/
public void setTypeMetadata(Collection<CacheTypeMetadata> typeMeta) {
this.typeMeta = typeMeta;
}


/** /**
* Gets query configuration. Query configuration defines which fields should be indexed for objects * Gets query configuration. Query configuration defines which fields should be indexed for objects
* without annotations or portable objects. * without annotations or portable objects.
Expand Down
Expand Up @@ -15,14 +15,14 @@
* limitations under the License. * limitations under the License.
*/ */


package org.apache.ignite.cache.query; package org.apache.ignite.cache;


import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.util.typedef.internal.*;


/** /**
* Database table column metadata. * Type field metadata.
*/ */
public class CacheQueryTableColumnMetadata { public class CacheTypeFieldMetadata {
/** Column name in database. */ /** Column name in database. */
private String dbName; private String dbName;


Expand All @@ -38,17 +38,19 @@ public class CacheQueryTableColumnMetadata {
/** /**
* Default constructor. * Default constructor.
*/ */
public CacheQueryTableColumnMetadata() { public CacheTypeFieldMetadata() {
// No-op. // No-op.
} }


/** /**
* Full constructor.
*
* @param dbName Column name in database. * @param dbName Column name in database.
* @param dbType Column JDBC type in database. * @param dbType Column JDBC type in database.
* @param javaName Field name in java object. * @param javaName Field name in java object.
* @param javaType Field java type. * @param javaType Field java type.
*/ */
public CacheQueryTableColumnMetadata(String javaName, Class<?> javaType, String dbName, int dbType) { public CacheTypeFieldMetadata(String javaName, Class<?> javaType, String dbName, int dbType) {
this.dbName = dbName; this.dbName = dbName;
this.dbType = dbType; this.dbType = dbType;
this.javaName = javaName; this.javaName = javaName;
Expand Down Expand Up @@ -116,10 +118,10 @@ public void setJavaType(Class<?> javaType) {
if (this == o) if (this == o)
return true; return true;


if (!(o instanceof CacheQueryTableColumnMetadata)) if (!(o instanceof CacheTypeFieldMetadata))
return false; return false;


CacheQueryTableColumnMetadata that = (CacheQueryTableColumnMetadata)o; CacheTypeFieldMetadata that = (CacheTypeFieldMetadata)o;


return javaName.equals(that.javaName) && dbName.equals(that.dbName) && return javaName.equals(that.javaName) && dbName.equals(that.dbName) &&
javaType == that.javaType && dbType == that.dbType; javaType == that.javaType && dbType == that.dbType;
Expand All @@ -138,6 +140,6 @@ public void setJavaType(Class<?> javaType) {


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override public String toString() { @Override public String toString() {
return S.toString(CacheQueryTableColumnMetadata.class, this); return S.toString(CacheTypeFieldMetadata.class, this);
} }
} }
@@ -0,0 +1,156 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.ignite.cache;

import org.apache.ignite.internal.util.tostring.*;

import java.util.*;

/**
* Type metadata.
*/
public class CacheTypeMetadata {
/** Schema name in database. */
private String dbSchema;

/** Table name in database. */
private String dbTbl;

/** Key class used to store key in cache. */
private String keyType;

/** Value class used to store value in cache. */
private String valType;

/** Key fields. */
@GridToStringInclude
private Collection<CacheTypeFieldMetadata> keyFields;

/** Value fields . */
@GridToStringInclude
private Collection<CacheTypeFieldMetadata> valFields;

/**
* Gets database schema name.
*
* @return Schema name.
*/
public String getDatabaseSchema() {
return dbSchema;
}

/**
* Sets database schema name.
*
* @param dbSchema Schema name.
*/
public void setDatabaseSchema(String dbSchema) {
this.dbSchema = dbSchema;
}

/**
* Gets table name in database.
*
* @return Table name in database.
*/
public String getDatabaseTable() {
return dbTbl;
}

/**
* Table name in database.
*
* @param dbTbl Table name in database.
*/
public void setDatabaseTable(String dbTbl) {
this.dbTbl = dbTbl;
}

/**
* Gets key type.
*
* @return Key type.
*/
public String getKeyType() {
return keyType;
}

/**
* Sets key type.
*
* @param keyType Key type.
*/
public void setKeyType(String keyType) {
this.keyType = keyType;
}


/**
* Gets value type.
*
* @return Key type.
*/
public String getValueType() {
return valType;
}

/**
* Sets value type.
*
* @param valType Value type.
*/
public void setValueType(String valType) {
this.valType = valType;
}

/**
* Gets key fields.
*
* @return Key fields.
*/
public Collection<CacheTypeFieldMetadata> getKeyFields() {
return keyFields;
}

/**
* Sets key fields.
*
* @param keyFields New key fields.
*/
public void setKeyFields(Collection<CacheTypeFieldMetadata> keyFields) {
this.keyFields = keyFields;
}

/**
* Gets value fields.
*
* @return Value fields.
*/
public Collection<CacheTypeFieldMetadata> getValueFields() {
return valFields;
}

/**
* Sets value fields.
*
* @param valFields New value fields.
*/
public void setValueFields(Collection<CacheTypeFieldMetadata> valFields) {
this.valFields = valFields;
}
}

This file was deleted.

0 comments on commit ed2af98

Please sign in to comment.