/** * Sets a property for the datastore of the given class */ private static<D extends DataStore<K,T>, K, T extends Persistent> void setProperty(Properties properties, Class<D> dataStoreClass, String baseKey, String value) { properties.setProperty(GORA+"."+org.apache.gora.util.StringUtils.getClassname(dataStoreClass)+"."+baseKey, value); }
public static String join(String[] strs) { return join(new StringBuilder(), strs).toString(); }
/** * Add our own serializer (obtained via the {@link PersistentSerialization} * wrapper) to any other <code>io.serializations</code> which may be specified * within existing Hadoop configuration. * * @param conf the Hadoop configuration object * @param reuseObjects boolean parameter to reuse objects */ public static void setIOSerializations(Configuration conf, boolean reuseObjects) { String serializationClass = PersistentSerialization.class.getCanonicalName(); String[] serializations = StringUtils.joinStringArrays( conf.getStrings("io.serializations"), "org.apache.hadoop.io.serializer.WritableSerialization", StringSerialization.class.getCanonicalName(), serializationClass); conf.setStrings("io.serializations", serializations); }
String binary = intToBinary(i, elements);
public static void testGetEmployeeWithFields(DataStore<String, Employee> dataStore) throws Exception { Employee employee = DataStoreTestUtil.createEmployee(); WebPage webpage = createWebPage(); employee.setWebpage(webpage); Employee boss = createBoss(); employee.setBoss(boss); String ssn = employee.getSsn().toString(); dataStore.put(ssn, employee); dataStore.flush(); String[] fields = AvroUtils.getPersistentFieldNames(employee); for(Set<String> subset : StringUtils.powerset(fields)) { if(subset.isEmpty()) continue; Employee after = dataStore.get(ssn, subset.toArray(new String[subset.size()])); Employee expected = Employee.newBuilder().build(); for(String field:subset) { int index = expected.getSchema().getField(field).pos(); expected.put(index, employee.get(index)); } assertEqualEmployeeObjects(expected, after); } }
String binary = intToBinary(i, elements);
/** * Sets a property for the datastore of the given class */ private static<D extends DataStore<K,T>, K, T extends Persistent> void setProperty(Properties properties, Class<D> dataStoreClass, String baseKey, String value) { properties.setProperty(GORA+"."+org.apache.gora.util.StringUtils.getClassname(dataStoreClass)+"."+baseKey, value); }
public static String join(String[] strs) { return join(new StringBuilder(), strs).toString(); }
/** * Add our own serializer (obtained via the {@link PersistentSerialization} * wrapper) to any other <code>io.serializations</code> which may be specified * within existing Hadoop configuration. * * @param conf the Hadoop configuration object * @param reuseObjects boolean parameter to reuse objects */ public static void setIOSerializations(Configuration conf, boolean reuseObjects) { String serializationClass = PersistentSerialization.class.getCanonicalName(); String[] serializations = StringUtils.joinStringArrays( conf.getStrings("io.serializations"), "org.apache.hadoop.io.serializer.WritableSerialization", StringSerialization.class.getCanonicalName(), serializationClass); conf.setStrings("io.serializations", serializations); }
/** * Sets a property for the datastore of the given class */ private static<D extends DataStore<K,T>, K, T extends Persistent> void setProperty(Properties properties, Class<D> dataStoreClass, String baseKey, String value) { properties.setProperty(GORA+"."+org.apache.gora.util.StringUtils.getClassname(dataStoreClass)+"."+baseKey, value); }
public static String join(List<String> strs) { return join(new StringBuilder(), strs).toString(); }
/** * Returns the name of the class without the package name. * * @param clazz Class type instance which name is to be returned. * @return class name string. */ public static String getClassname(Class<?> clazz) { return getClassname(clazz.getName()); }
public static String join(List<String> strs) { return join(new StringBuilder(), strs).toString(); }
/** * Sets a property for the datastore of the given class */ private static<D extends DataStore<K,T>, K, T extends Persistent> void setProperty(Properties properties, Class<D> dataStoreClass, String baseKey, String value) { properties.setProperty(GORA+"."+org.apache.gora.util.StringUtils.getClassname(dataStoreClass)+"."+baseKey, value); }
/** * Returns the name of the class without the package name. * * @param clazz Class type instance which name is to be returned. * @return class name string. */ public static String getClassname(Class<?> clazz) { return getClassname(clazz.getName()); }
/** * Returns the name of the schema to use for the persistent class. * * First the schema name in the defined properties is returned. If null then * the provided mappingSchemaName is returned. If this is null too, * the class name, without the package, of the persistent class is returned. * @param mappingSchemaName the name of the schema as read from the mapping file * @param persistentClass persistent class */ protected String getSchemaName(String mappingSchemaName, Class<?> persistentClass) { String schemaName = WSDataStoreFactory.getDefaultSchemaName(properties, this); if(schemaName != null) { return schemaName; } if(mappingSchemaName != null) { return mappingSchemaName; } return StringUtils.getClassname(persistentClass); }
/** * Returns the name of the schema to use for the persistent class. * * First the schema name in the defined properties is returned. If null then * the provided mappingSchemaName is returned. If this is null too, * the class name, without the package, of the persistent class is returned. * @param mappingSchemaName the name of the schema as read from the mapping file * @param persistentClass persistent class */ protected String getSchemaName(String mappingSchemaName, Class<?> persistentClass) { String schemaName = WSDataStoreFactory.getDefaultSchemaName(properties, this); if(schemaName != null) { return schemaName; } if(mappingSchemaName != null) { return mappingSchemaName; } return StringUtils.getClassname(persistentClass); }
String fullKey = GORA + "." + org.apache.gora.util.StringUtils.getClassname(clazz).toLowerCase(Locale.getDefault()) + "." + baseKey; String value = getProperty(properties, fullKey); if(value != null) {
String fullKey = GORA + "." + org.apache.gora.util.StringUtils.getClassname(clazz).toLowerCase(Locale.getDefault()) + "." + baseKey; String value = getProperty(properties, fullKey); if(value != null) {
/** * Returns the name of the schema to use for the persistent class. * * First the schema name in the {@link Configuration} is used. If null, * the schema name in the defined properties is returned. If null then * the provided mappingSchemaName is returned. If this is null too, * the class name, without the package, of the persistent class is returned. * * @param mappingSchemaName the name of the schema as read from the mapping file * @param persistentClass persistent class * @return String */ protected String getSchemaName(String mappingSchemaName, Class<?> persistentClass) { String confSchemaName = getOrCreateConf().get("preferred.schema.name"); if (confSchemaName != null) { return confSchemaName; } String schemaName = DataStoreFactory.getDefaultSchemaName(properties, this); if(schemaName != null) { return schemaName; } if(mappingSchemaName != null) { return mappingSchemaName; } return StringUtils.getClassname(persistentClass); } }