Ejemplo n.º 1
0
 @SuppressWarnings("unchecked")
 @Override
 protected V getValue(OClass entity, String critery) {
   CustomAttributes custom;
   if ("clusterSelection".equals(critery)) {
     OClusterSelectionStrategy strategy = entity.getClusterSelection();
     return (V) (strategy != null ? strategy.getName() : null);
   } else if (OClassPrototyper.SUPER_CLASSES.equals(critery)) {
     List<OClass> superClasses = entity.getSuperClasses();
     // Additional wrapping to ArrayList is required , because getSuperClasses return unmodifiable
     // list
     return (V)
         (superClasses != null ? new ArrayList<OClass>(superClasses) : new ArrayList<OClass>());
   } else if ((CustomAttributes.ON_CREATE_FIELDS.getName().equals(critery))
       && (custom = CustomAttributes.fromString(critery)) != null) {
     String onCreateFields = custom.getValue(entity);
     return (V)
         (!Strings.isNullOrEmpty(onCreateFields)
             ? Lists.newArrayList(onCreateFields.split(","))
             : new ArrayList<String>());
   } else if ((custom = CustomAttributes.fromString(critery)) != null) {
     return custom.getValue(entity);
   } else {
     return (V) PropertyResolver.getValue(critery, entity);
   }
 }
  @Override
  public Set<String> getInvolvedClusters() {
    if (clazz != null)
      return Collections.singleton(
          getDatabase().getClusterNameById(clazz.getClusterSelection().getCluster(clazz, null)));
    else if (clusterName != null)
      return getInvolvedClustersOfClusters(Collections.singleton(clusterName));

    return Collections.EMPTY_SET;
  }
Ejemplo n.º 3
0
 public void testDrop() {
   Assert.assertTrue(cls.getClusterSelection() instanceof OAutoShardingClusterSelectionStrategy);
   database.getMetadata().getIndexManager().dropIndex(idx.getName());
   cls = database.getMetadata().getSchema().getClass("AutoShardingTest");
   Assert.assertFalse(cls.getClusterSelection() instanceof OAutoShardingClusterSelectionStrategy);
 }