Пример #1
0
    static {
      // shared cache attributes
      sharedAttributeResolver.put(CacheResource.BATCHING.getName(), "cache");
      sharedAttributeResolver.put(CacheResource.CACHE_MODULE.getName(), "cache");
      sharedAttributeResolver.put(CacheResource.INDEXING.getName(), "cache");
      sharedAttributeResolver.put(CacheResource.INDEXING_PROPERTIES.getName(), "cache");
      sharedAttributeResolver.put(CacheResource.JNDI_NAME.getName(), "cache");
      sharedAttributeResolver.put(CacheResource.NAME.getName(), "cache");
      sharedAttributeResolver.put(CacheResource.START.getName(), "cache");

      sharedAttributeResolver.put(
          ClusteredCacheResource.ASYNC_MARSHALLING.getName(), "clustered-cache");
      sharedAttributeResolver.put(ClusteredCacheResource.MODE.getName(), "clustered-cache");
      sharedAttributeResolver.put(
          ClusteredCacheResource.QUEUE_FLUSH_INTERVAL.getName(), "clustered-cache");
      sharedAttributeResolver.put(ClusteredCacheResource.QUEUE_SIZE.getName(), "clustered-cache");
      sharedAttributeResolver.put(
          ClusteredCacheResource.REMOTE_TIMEOUT.getName(), "clustered-cache");

      sharedAttributeResolver.put(BaseStoreResource.FETCH_STATE.getName(), "store");
      sharedAttributeResolver.put(BaseStoreResource.PASSIVATION.getName(), "store");
      sharedAttributeResolver.put(BaseStoreResource.PRELOAD.getName(), "store");
      sharedAttributeResolver.put(BaseStoreResource.PURGE.getName(), "store");
      sharedAttributeResolver.put(BaseStoreResource.SHARED.getName(), "store");
      sharedAttributeResolver.put(BaseStoreResource.SINGLETON.getName(), "store");
      sharedAttributeResolver.put(BaseStoreResource.PROPERTY.getName(), "store");
      sharedAttributeResolver.put(BaseStoreResource.PROPERTIES.getName(), "store");

      sharedAttributeResolver.put(BaseJDBCStoreResource.DATA_SOURCE.getName(), "jdbc-store");
      sharedAttributeResolver.put(BaseJDBCStoreResource.BATCH_SIZE.getName(), "jdbc-store");
      sharedAttributeResolver.put(BaseJDBCStoreResource.FETCH_SIZE.getName(), "jdbc-store");
      sharedAttributeResolver.put(BaseJDBCStoreResource.PREFIX.getName(), "jdbc-store");
      sharedAttributeResolver.put(
          BaseJDBCStoreResource.ID_COLUMN.getName() + ".column", "jdbc-store");
      sharedAttributeResolver.put(
          BaseJDBCStoreResource.DATA_COLUMN.getName() + ".column", "jdbc-store");
      sharedAttributeResolver.put(
          BaseJDBCStoreResource.TIMESTAMP_COLUMN.getName() + ".column", "jdbc-store");
      sharedAttributeResolver.put(
          BaseJDBCStoreResource.ENTRY_TABLE.getName() + "table", "jdbc-store");
      sharedAttributeResolver.put(
          BaseJDBCStoreResource.BUCKET_TABLE.getName() + "table", "jdbc-store");

      // shared children - this avoids having to describe the children for each parent resource
      sharedAttributeResolver.put(ModelKeys.TRANSPORT, null);
      sharedAttributeResolver.put(ModelKeys.LOCKING, null);
      sharedAttributeResolver.put(ModelKeys.TRANSACTION, null);
      sharedAttributeResolver.put(ModelKeys.EVICTION, null);
      sharedAttributeResolver.put(ModelKeys.EXPIRATION, null);
      sharedAttributeResolver.put(ModelKeys.STATE_TRANSFER, null);
      sharedAttributeResolver.put(ModelKeys.STORE, null);
      sharedAttributeResolver.put(ModelKeys.FILE_STORE, null);
      sharedAttributeResolver.put(ModelKeys.REMOTE_STORE, null);
      sharedAttributeResolver.put(ModelKeys.STRING_KEYED_JDBC_STORE, null);
      sharedAttributeResolver.put(ModelKeys.BINARY_KEYED_JDBC_STORE, null);
      sharedAttributeResolver.put(ModelKeys.MIXED_KEYED_JDBC_STORE, null);
      sharedAttributeResolver.put(ModelKeys.WRITE_BEHIND, null);
      sharedAttributeResolver.put(ModelKeys.PROPERTY, null);
    }
  private void parseJDBCStoreTable(XMLExtendedStreamReader reader, ModelNode table)
      throws XMLStreamException {
    for (int i = 0; i < reader.getAttributeCount(); i++) {
      String value = reader.getAttributeValue(i);
      Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
      switch (attribute) {
        case PREFIX:
          {
            BaseJDBCStoreResource.PREFIX.parseAndSetParameter(value, table, reader);
            break;
          }
        case FETCH_SIZE:
          {
            BaseJDBCStoreResource.FETCH_SIZE.parseAndSetParameter(value, table, reader);
            break;
          }
        case BATCH_SIZE:
          {
            BaseJDBCStoreResource.BATCH_SIZE.parseAndSetParameter(value, table, reader);
            break;
          }
        default:
          {
            throw ParseUtils.unexpectedAttribute(reader, i);
          }
      }
    }

    while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
      Element element = Element.forName(reader.getLocalName());
      switch (element) {
        case ID_COLUMN:
          {
            this.parseJDBCStoreColumn(reader, table.get(ModelKeys.ID_COLUMN).setEmptyObject());
            break;
          }
        case DATA_COLUMN:
          {
            this.parseJDBCStoreColumn(reader, table.get(ModelKeys.DATA_COLUMN).setEmptyObject());
            break;
          }
        case TIMESTAMP_COLUMN:
          {
            this.parseJDBCStoreColumn(
                reader, table.get(ModelKeys.TIMESTAMP_COLUMN).setEmptyObject());
            break;
          }
        default:
          {
            throw ParseUtils.unexpectedElement(reader);
          }
      }
    }
  }