Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MODE-1474 - Fixed AS7 subsystem support for passing down to the repos…

…itory custom <indexing/> attributes. Also, validated that with the current version of Hibernate Search it's possible to use a custom configured analyzer.
  • Loading branch information...
commit e02f7e6f6d58a5c12a5e75cc2a888701ac0e13b4 1 parent b9c6632
Horia Chiorean hchiorean authored rhauch committed
1  deploy/jbossas/kit/jboss-as71/standalone/configuration/standalone-modeshape.xml
View
@@ -334,6 +334,7 @@
<node-type>custom.cnd</node-type>
</node-types>
<cache-index-storage cache-container="index-cache-container" data-cache-name="index-data"/>
+ <indexing analyzer-classname="org.apache.lucene.analysis.standard.ClassicAnalyzer"/>
</repository>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
19 deploy/jbossas/modeshape-jbossas-subsystem/src/main/java/org/modeshape/jboss/service/IndexStorage.java
View
@@ -24,7 +24,6 @@
package org.modeshape.jboss.service;
import org.infinispan.manager.CacheContainer;
-import org.infinispan.schematic.Schematic;
import org.infinispan.schematic.document.EditableDocument;
import org.modeshape.jcr.RepositoryConfiguration;
@@ -43,24 +42,26 @@
this.queryConfig = queryConfig;
}
- static IndexStorage defaultStorage(String repositoryName, String dataDirPath) {
- EditableDocument query = Schematic.newDocument();
+ void setDefaultValues( String dataDirPath ) {
+ queryConfig.set(RepositoryConfiguration.FieldName.REBUILD_UPON_STARTUP, RepositoryConfiguration.QueryRebuild.IF_MISSING.toString().toLowerCase());
- EditableDocument indexing = query.getOrCreateDocument(RepositoryConfiguration.FieldName.INDEXING);
- EditableDocument indexStorage = query.getOrCreateDocument(RepositoryConfiguration.FieldName.INDEX_STORAGE);
+ EditableDocument indexing = queryConfig.getOrCreateDocument(RepositoryConfiguration.FieldName.INDEXING);
EditableDocument backend = indexing.getOrCreateDocument(RepositoryConfiguration.FieldName.INDEXING_BACKEND);
- query.set(RepositoryConfiguration.FieldName.REBUILD_UPON_STARTUP, RepositoryConfiguration.QueryRebuild.IF_MISSING.toString().toLowerCase());
backend.set(RepositoryConfiguration.FieldName.TYPE, RepositoryConfiguration.FieldValue.INDEXING_BACKEND_TYPE_LUCENE);
+
+ EditableDocument indexStorage = queryConfig.getOrCreateDocument(RepositoryConfiguration.FieldName.INDEX_STORAGE);
indexStorage.set(RepositoryConfiguration.FieldName.TYPE, RepositoryConfiguration.FieldValue.INDEX_STORAGE_FILESYSTEM);
- indexStorage.set(RepositoryConfiguration.FieldName.INDEX_STORAGE_LOCATION, dataDirPath + "/" + repositoryName + "/indexes");
+ indexStorage.set(RepositoryConfiguration.FieldName.INDEX_STORAGE_LOCATION, dataDirPath + "/indexes");
+ }
- return new IndexStorage(query);
+ boolean useDefaultValues() {
+ return !queryConfig.containsField(RepositoryConfiguration.FieldName.INDEX_STORAGE);
}
/**
* @return the repository's query configuration
*/
- EditableDocument getQueryConfiguration() {
+ public EditableDocument getQueryConfiguration() {
return queryConfig;
}
20 ...y/jbossas/modeshape-jbossas-subsystem/src/main/java/org/modeshape/jboss/service/IndexStorageService.java
View
@@ -39,16 +39,8 @@
private final InjectedValue<CacheContainer> cacheContainerInjectedValue = new InjectedValue<CacheContainer>();
private final IndexStorage indexStorage;
- private final String repositoryName;
- public IndexStorageService( String repositoryName ) {
- this.indexStorage = null;
- this.repositoryName = repositoryName;
- }
-
- public IndexStorageService( String repositoryName,
- EditableDocument queryConfig ) {
- this.repositoryName = repositoryName;
+ public IndexStorageService( EditableDocument queryConfig ) {
this.indexStorage = new IndexStorage(queryConfig);
}
@@ -97,10 +89,12 @@ private String appendDirDelim( String value ) {
@Override
public IndexStorage getValue() throws IllegalStateException, IllegalArgumentException {
- IndexStorage result = indexStorage == null ? IndexStorage.defaultStorage(this.repositoryName, dataDirectoryPathInjector
- .getValue()) : indexStorage;
- result.setCacheContainer(cacheContainerInjectedValue.getOptionalValue());
- return result;
+ if (indexStorage.useDefaultValues()) {
+ //use optional value because this service is dynamically queried from AbstractAddIndexStorage
+ indexStorage.setDefaultValues(dataDirectoryPathInjector.getOptionalValue());
+ }
+ indexStorage.setCacheContainer(cacheContainerInjectedValue.getOptionalValue());
+ return indexStorage;
}
@Override
35 ...sas/modeshape-jbossas-subsystem/src/main/java/org/modeshape/jboss/subsystem/AbstractAddIndexStorage.java
View
@@ -23,9 +23,7 @@
*/
package org.modeshape.jboss.subsystem;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
import java.util.List;
-import org.infinispan.schematic.Schematic;
import org.infinispan.schematic.document.EditableDocument;
import org.jboss.as.controller.AbstractAddStepHandler;
import org.jboss.as.controller.AttributeDefinition;
@@ -42,6 +40,7 @@
import org.modeshape.jboss.service.IndexStorageService;
import org.modeshape.jcr.RepositoryConfiguration.FieldName;
import org.modeshape.jcr.RepositoryConfiguration.FieldValue;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
public abstract class AbstractAddIndexStorage extends AbstractAddStepHandler {
@@ -73,37 +72,37 @@ protected void performRuntime( final OperationContext context,
final ModelNode address = operation.require(OP_ADDR);
final PathAddress pathAddress = PathAddress.pathAddress(address);
final String repositoryName = pathAddress.getElement(1).getValue();
- // final String storageName = pathAddress.getLastElement().getValue();
-
- // Get the type of the storage (this is required) ...
- // final String storageType = storage.get(ModelKeys.INDEX_STORAGE_TYPE).asString();
-
- // Build the 'query' document (except for the extractors) ...
- EditableDocument query = Schematic.newDocument();
- String rebuild = ModelAttributes.REBUILD_INDEXES_UPON_STARTUP.resolveModelAttribute(context, storage).asString().toLowerCase();
- query.set(FieldName.REBUILD_UPON_STARTUP, rebuild);
+ ServiceName indexStorageServiceName = ModeShapeServiceNames.indexStorageServiceName(repositoryName);
+
+ //get the default service registered by "AddRepository
+ IndexStorageService existingService = (IndexStorageService)context.getServiceRegistry(false).getService(indexStorageServiceName).getService();
+ //get the query instance from the existing service, so that any indexing attributes set via "AddRepository" are not lost
+ EditableDocument query = existingService.getValue().getQueryConfiguration();
+ if (!query.containsField(FieldName.REBUILD_UPON_STARTUP)) {
+ String rebuild = ModelAttributes.REBUILD_INDEXES_UPON_STARTUP.resolveModelAttribute(context, storage).asString().toLowerCase();
+ query.set(FieldName.REBUILD_UPON_STARTUP, rebuild);
+ }
// Build the 'query/indexing' nested document ...
EditableDocument indexing = query.getOrCreateDocument(FieldName.INDEXING);
writeIndexingConfiguration(context, storage, indexing);
- // Build the 'query/indexingStorage' nested document ...
- EditableDocument indexStorage = query.getOrCreateDocument(FieldName.INDEX_STORAGE);
+ // Build the 'query/indexingStorage' nested document from scratch
+ EditableDocument indexStorage = query.setDocument(FieldName.INDEX_STORAGE);
writeIndexStorageConfiguration(context, storage, indexStorage);
// Build the 'query/indexing/backend' nested document ...
EditableDocument backend = indexing.getOrCreateDocument(FieldName.INDEXING_BACKEND);
writeIndexingBackendConfiguration(context, storage, backend);
- IndexStorageService service = new IndexStorageService(repositoryName, query);
- ServiceName serviceName = ModeShapeServiceNames.indexStorageServiceName(repositoryName);
- ServiceBuilder<IndexStorage> indexBuilder = target.addService(serviceName, service);
+ IndexStorageService service = new IndexStorageService(query);
+ ServiceBuilder<IndexStorage> indexBuilder = target.addService(indexStorageServiceName, service);
indexBuilder.setInitialMode(ServiceController.Mode.ACTIVE);
addControllersAndDependencies(repositoryName, service, newControllers, indexBuilder, target);
- //A default index service should've already been added by AddRepository, so we remove it here
- context.removeService(serviceName);
+ //remove the default service added by "AddRepository"
+ context.removeService(indexStorageServiceName);
newControllers.add(indexBuilder.install());
}
261 deploy/jbossas/modeshape-jbossas-subsystem/src/main/java/org/modeshape/jboss/subsystem/AddRepository.java
View
@@ -62,7 +62,6 @@
import org.modeshape.jcr.ModeShapeEngine;
import org.modeshape.jcr.RepositoryConfiguration;
import org.modeshape.jcr.RepositoryConfiguration.FieldName;
-import org.modeshape.jcr.RepositoryConfiguration.FieldValue;
public class AddRepository extends AbstractAddStepHandler {
@@ -121,113 +120,30 @@ protected void performRuntime( final OperationContext context,
configDoc.set(FieldName.JNDI_NAME, "");// always set to empty string, since we'll register in JNDI here ...
final String jndiName = ModeShapeJndiNames.JNDI_BASE_NAME + repositoryName;
String jndiAlias = ModeShapeJndiNames.jndiNameFrom(model, repositoryName);
- if (jndiName.equals(jndiAlias)) jndiAlias = null;
+ if (jndiName.equals(jndiAlias)) {
+ jndiAlias = null;
+ }
// Always enable monitoring ...
- EditableDocument monitoring = configDoc.getOrCreateDocument(FieldName.MONITORING);
- monitoring.set(FieldName.MONITORING_ENABLED, enableMonitoring);
+ enableMonitoring(enableMonitoring, configDoc);
// Initial node-types if configured
- if (model.hasDefined(ModelKeys.NODE_TYPES)) {
- EditableArray nodeTypesArray = configDoc.getOrCreateArray(FieldName.NODE_TYPES);
- for (ModelNode nodeType : model.get(ModelKeys.NODE_TYPES).asList()) {
- nodeTypesArray.add(nodeType.asString());
- }
- }
+ parseCustomNodeTypes(model, configDoc);
// Workspace information is on the repository model node (unlike the XML) ...
- EditableDocument workspacesDoc = configDoc.getOrCreateDocument(FieldName.WORKSPACES);
- boolean allowWorkspaceCreation = attribute(context, model, ModelAttributes.ALLOW_WORKSPACE_CREATION).asBoolean();
- String defaultWorkspaceName = attribute(context, model, ModelAttributes.DEFAULT_WORKSPACE).asString();
- workspacesDoc.set(FieldName.ALLOW_CREATION, allowWorkspaceCreation);
- workspacesDoc.set(FieldName.DEFAULT, defaultWorkspaceName);
- if (model.hasDefined(ModelKeys.PREDEFINED_WORKSPACE_NAMES)) {
- for (ModelNode name : model.get(ModelKeys.PREDEFINED_WORKSPACE_NAMES).asList()) {
- workspacesDoc.getOrCreateArray(FieldName.PREDEFINED).add(name.asString());
- }
-
- if (model.hasDefined(ModelKeys.WORKSPACES_INITIAL_CONTENT)) {
- EditableDocument initialContentDocument = workspacesDoc.getOrCreateDocument(FieldName.INITIAL_CONTENT);
- List<ModelNode> workspacesInitialContent = model.get(ModelKeys.WORKSPACES_INITIAL_CONTENT).asList();
- for (ModelNode initialContent : workspacesInitialContent) {
- Property initialContentProperty = initialContent.asProperty();
- initialContentDocument.set(initialContentProperty.getName(), initialContentProperty.getValue().asString());
- }
- }
- }
- if (model.hasDefined(ModelKeys.DEFAULT_INITIAL_CONTENT)) {
- EditableDocument initialContentDocument = workspacesDoc.getOrCreateDocument(FieldName.INITIAL_CONTENT);
- initialContentDocument.set(FieldName.DEFAULT_INITIAL_CONTENT, model.get(ModelKeys.DEFAULT_INITIAL_CONTENT).asString());
- }
+ EditableDocument workspacesDoc = parseWorkspaces(context, model, configDoc);
// Set the storage information (that was set on the repository ModelNode) ...
- EditableDocument storage = configDoc.getOrCreateDocument(FieldName.STORAGE);
- storage.set(FieldName.CACHE_NAME, cacheName);
- storage.set(FieldName.CACHE_TRANSACTION_MANAGER_LOOKUP, JBossTransactionManagerLookup.class.getName());
- // The proper container will be injected into the RepositoryService, so use the fixed container name ...
- storage.set(FieldName.CACHE_CONFIGURATION, RepositoryService.CONTENT_CONTAINER_NAME);
-
- EditableDocument security = configDoc.getOrCreateDocument(FieldName.SECURITY);
+ parseStorage(cacheName, configDoc);
// Indexing ...
- EditableDocument query = configDoc.getOrCreateDocument(FieldName.QUERY);
- EditableDocument indexing = query.getOrCreateDocument(FieldName.INDEXING);
- String analyzerClassname = ModelAttributes.ANALYZER_CLASSNAME.resolveModelAttribute(context, model).asString();
- String analyzerClasspath = ModelAttributes.ANALYZER_MODULE.resolveModelAttribute(context, model).asString();
- String indexThreadPool = ModelAttributes.THREAD_POOL.resolveModelAttribute(context, model).asString();
- int indexBatchSize = ModelAttributes.BATCH_SIZE.resolveModelAttribute(context, model).asInt();
- String indexReaderStrategy = ModelAttributes.READER_STRATEGY.resolveModelAttribute(context, model).asString();
- String indexMode = ModelAttributes.MODE.resolveModelAttribute(context, model).asString();
- String systemContentIndexingMode = ModelAttributes.SYSTEM_CONTENT_MODE.resolveModelAttribute(context, model).asString();
- int indexAsyncThreadPoolSize = ModelAttributes.ASYNC_THREAD_POOL_SIZE.resolveModelAttribute(context, model).asInt();
- int indexAsyncMaxQueueSize = ModelAttributes.ASYNC_MAX_QUEUE_SIZE.resolveModelAttribute(context, model).asInt();
-
- indexing.set(FieldName.INDEXING_ANALYZER, analyzerClassname);
- if (analyzerClasspath != null) {
- indexing.set(FieldName.INDEXING_ANALYZER_CLASSPATH, analyzerClasspath);
- }
- indexing.set(FieldName.THREAD_POOL, indexThreadPool);
- indexing.set(FieldName.INDEXING_BATCH_SIZE, indexBatchSize);
- indexing.set(FieldName.INDEXING_READER_STRATEGY, indexReaderStrategy);
- indexing.set(FieldName.INDEXING_MODE, indexMode);
- indexing.set(FieldName.INDEXING_MODE_SYSTEM_CONTENT, systemContentIndexingMode);
- indexing.set(FieldName.INDEXING_ASYNC_THREAD_POOL_SIZE, indexAsyncThreadPoolSize);
- indexing.set(FieldName.INDEXING_ASYNC_MAX_QUEUE_SIZE, indexAsyncMaxQueueSize);
- for (String key : model.keys()) {
- if (key.startsWith("hibernate")) {
- indexing.set(key, model.get(key).asString());
- }
- }
+ EditableDocument query = parseIndexing(context, model, configDoc);
- // JAAS ...
- EditableDocument jaas = security.getOrCreateDocument(FieldName.JAAS);
- String securityDomain = attribute(context, model, ModelAttributes.SECURITY_DOMAIN).asString();
- jaas.set(FieldName.JAAS_POLICY_NAME, securityDomain);
-
- // Anonymous ...
- EditableDocument anon = security.getOrCreateDocument(FieldName.ANONYMOUS);
- String anonUsername = attribute(context, model, ModelAttributes.ANONYMOUS_USERNAME).asString();
- boolean useAnonIfFailed = attribute(context, model, ModelAttributes.USE_ANONYMOUS_IF_AUTH_FAILED).asBoolean();
- anon.set(FieldName.ANONYMOUS_USERNAME, anonUsername);
- anon.set(FieldName.USE_ANONYMOUS_ON_FAILED_LOGINS, useAnonIfFailed);
- if (model.hasDefined(ModelKeys.ANONYMOUS_ROLES)) {
- for (ModelNode roleNode : model.get(ModelKeys.ANONYMOUS_ROLES).asList()) {
- anon.getOrCreateArray(FieldName.ANONYMOUS_ROLES).addString(roleNode.asString());
- }
- }
-
- // Servlet authenticator ...
- EditableArray providers = security.getOrCreateArray(FieldName.PROVIDERS);
- EditableDocument servlet = Schematic.newDocument();
- servlet.set(FieldName.CLASSNAME, "servlet");
- servlet.set(FieldName.NAME, "Authenticator that uses the Servlet context");
- providers.add(servlet);
+ //security
+ parseSecurity(context, model, configDoc);
// Clustering and the JGroups channel ...
- if (clusterChannelName != null) {
- EditableDocument clustering = configDoc.getOrCreateDocument(FieldName.CLUSTERING);
- clustering.setString(FieldName.CLUSTER_NAME, clusterChannelName);
- }
+ parseClustering(clusterChannelName, configDoc);
// Now create the repository service that manages the lifecycle of the JcrRepository instance ...
RepositoryConfiguration repositoryConfig = new RepositoryConfiguration(configDoc, repositoryName);
@@ -313,14 +229,15 @@ protected void performRuntime( final OperationContext context,
// Add dependency to the data directory ...
ServiceName dataDirServiceName = ModeShapeServiceNames.dataDirectoryServiceName(repositoryName);
- newControllers.add(RelativePathService.addService(dataDirServiceName,
- "modeshape/" + repositoryName,
- ModeShapeExtension.DATA_DIR_VARIABLE,
- target));
+ ServiceController<String> dataDirServiceController = RelativePathService.addService(dataDirServiceName,
+ "modeshape/" + repositoryName,
+ ModeShapeExtension.DATA_DIR_VARIABLE,
+ target);
+ newControllers.add(dataDirServiceController);
builder.addDependency(dataDirServiceName, String.class, repositoryService.getDataDirectoryPathInjector());
// Add the default index storage service which will provide the indexing configuration
- IndexStorageService defaultIndexService = new IndexStorageService(repositoryName);
+ IndexStorageService defaultIndexService = new IndexStorageService(query);
ServiceBuilder<IndexStorage> indexBuilder = target.addService(ModeShapeServiceNames.indexStorageServiceName(repositoryName),
defaultIndexService);
indexBuilder.addDependency(dataDirServiceName, String.class, defaultIndexService.getDataDirectoryPathInjector());
@@ -342,16 +259,138 @@ protected void performRuntime( final OperationContext context,
newControllers.add(binaryStorageBuilder.install());
}
- protected void writeIndexingBackendConfiguration( final OperationContext context,
- final ModelNode storage,
- EditableDocument backend,
- String type ) throws OperationFailedException {
- // Set the type of indexing backend ...
- backend.set(FieldName.TYPE, type);
- backend.set(FieldName.TYPE, FieldValue.INDEXING_BACKEND_TYPE_JMS_MASTER);
- String connJndi = attribute(context, storage, ModelAttributes.CONNECTION_FACTORY_JNDI_NAME).asString();
- String queueJndi = attribute(context, storage, ModelAttributes.QUEUE_JNDI_NAME).asString();
- backend.set(FieldName.INDEXING_BACKEND_JMS_CONNECTION_FACTORY_JNDI_NAME, connJndi);
- backend.set(FieldName.INDEXING_BACKEND_JMS_QUEUE_JNDI_NAME, queueJndi);
+ private void parseClustering( String clusterChannelName,
+ EditableDocument configDoc ) {
+ if (clusterChannelName != null) {
+ EditableDocument clustering = configDoc.getOrCreateDocument(FieldName.CLUSTERING);
+ clustering.setString(FieldName.CLUSTER_NAME, clusterChannelName);
+ }
+ }
+
+ private void parseSecurity( OperationContext context,
+ ModelNode model,
+ EditableDocument configDoc ) throws OperationFailedException {
+ // JAAS ...
+ EditableDocument security = configDoc.getOrCreateDocument(FieldName.SECURITY);
+
+ EditableDocument jaas = security.getOrCreateDocument(FieldName.JAAS);
+ String securityDomain = attribute(context, model, ModelAttributes.SECURITY_DOMAIN).asString();
+ jaas.set(FieldName.JAAS_POLICY_NAME, securityDomain);
+
+ // Anonymous ...
+ EditableDocument anon = security.getOrCreateDocument(FieldName.ANONYMOUS);
+ String anonUsername = attribute(context, model, ModelAttributes.ANONYMOUS_USERNAME).asString();
+ boolean useAnonIfFailed = attribute(context, model, ModelAttributes.USE_ANONYMOUS_IF_AUTH_FAILED).asBoolean();
+ anon.set(FieldName.ANONYMOUS_USERNAME, anonUsername);
+ anon.set(FieldName.USE_ANONYMOUS_ON_FAILED_LOGINS, useAnonIfFailed);
+ if (model.hasDefined(ModelKeys.ANONYMOUS_ROLES)) {
+ for (ModelNode roleNode : model.get(ModelKeys.ANONYMOUS_ROLES).asList()) {
+ anon.getOrCreateArray(FieldName.ANONYMOUS_ROLES).addString(roleNode.asString());
+ }
+ }
+
+ // Servlet authenticator ...
+ EditableArray providers = security.getOrCreateArray(FieldName.PROVIDERS);
+ EditableDocument servlet = Schematic.newDocument();
+ servlet.set(FieldName.CLASSNAME, "servlet");
+ servlet.set(FieldName.NAME, "Authenticator that uses the Servlet context");
+ providers.add(servlet);
+ }
+
+ private EditableDocument parseIndexing( OperationContext context,
+ ModelNode model,
+ EditableDocument configDoc ) throws OperationFailedException {
+ EditableDocument query = configDoc.getOrCreateDocument(FieldName.QUERY);
+ EditableDocument indexing = query.getOrCreateDocument(FieldName.INDEXING);
+
+ String analyzerClassname = ModelAttributes.ANALYZER_CLASSNAME.resolveModelAttribute(context, model).asString();
+ indexing.set(FieldName.INDEXING_ANALYZER, analyzerClassname);
+
+ if (model.hasDefined(ModelKeys.ANALYZER_MODULE)) {
+ String analyzerClasspath = ModelAttributes.ANALYZER_MODULE.resolveModelAttribute(context, model).asString();
+ indexing.set(FieldName.INDEXING_ANALYZER_CLASSPATH, analyzerClasspath);
+ }
+
+ String indexThreadPool = ModelAttributes.THREAD_POOL.resolveModelAttribute(context, model).asString();
+ indexing.set(FieldName.THREAD_POOL, indexThreadPool);
+
+ int indexBatchSize = ModelAttributes.BATCH_SIZE.resolveModelAttribute(context, model).asInt();
+ indexing.set(FieldName.INDEXING_BATCH_SIZE, indexBatchSize);
+
+ String indexReaderStrategy = ModelAttributes.READER_STRATEGY.resolveModelAttribute(context, model).asString();
+ indexing.set(FieldName.INDEXING_READER_STRATEGY, indexReaderStrategy);
+
+ String indexMode = ModelAttributes.MODE.resolveModelAttribute(context, model).asString();
+ indexing.set(FieldName.INDEXING_MODE, indexMode);
+
+ String systemContentIndexingMode = ModelAttributes.SYSTEM_CONTENT_MODE.resolveModelAttribute(context, model).asString();
+ indexing.set(FieldName.INDEXING_MODE_SYSTEM_CONTENT, systemContentIndexingMode);
+
+ int indexAsyncThreadPoolSize = ModelAttributes.ASYNC_THREAD_POOL_SIZE.resolveModelAttribute(context, model).asInt();
+ indexing.set(FieldName.INDEXING_ASYNC_THREAD_POOL_SIZE, indexAsyncThreadPoolSize);
+
+ int indexAsyncMaxQueueSize = ModelAttributes.ASYNC_MAX_QUEUE_SIZE.resolveModelAttribute(context, model).asInt();
+ indexing.set(FieldName.INDEXING_ASYNC_MAX_QUEUE_SIZE, indexAsyncMaxQueueSize);
+
+ for (String key : model.keys()) {
+ if (key.startsWith("hibernate")) {
+ indexing.set(key, model.get(key).asString());
+ }
+ }
+ return query;
+ }
+
+ private void parseStorage( String cacheName,
+ EditableDocument configDoc ) {
+ EditableDocument storage = configDoc.getOrCreateDocument(FieldName.STORAGE);
+ storage.set(FieldName.CACHE_NAME, cacheName);
+ storage.set(FieldName.CACHE_TRANSACTION_MANAGER_LOOKUP, JBossTransactionManagerLookup.class.getName());
+ // The proper container will be injected into the RepositoryService, so use the fixed container name ...
+ storage.set(FieldName.CACHE_CONFIGURATION, RepositoryService.CONTENT_CONTAINER_NAME);
+ }
+
+ private EditableDocument parseWorkspaces( OperationContext context,
+ ModelNode model,
+ EditableDocument configDoc ) throws OperationFailedException {
+ EditableDocument workspacesDoc = configDoc.getOrCreateDocument(FieldName.WORKSPACES);
+ boolean allowWorkspaceCreation = attribute(context, model, ModelAttributes.ALLOW_WORKSPACE_CREATION).asBoolean();
+ String defaultWorkspaceName = attribute(context, model, ModelAttributes.DEFAULT_WORKSPACE).asString();
+ workspacesDoc.set(FieldName.ALLOW_CREATION, allowWorkspaceCreation);
+ workspacesDoc.set(FieldName.DEFAULT, defaultWorkspaceName);
+ if (model.hasDefined(ModelKeys.PREDEFINED_WORKSPACE_NAMES)) {
+ for (ModelNode name : model.get(ModelKeys.PREDEFINED_WORKSPACE_NAMES).asList()) {
+ workspacesDoc.getOrCreateArray(FieldName.PREDEFINED).add(name.asString());
+ }
+
+ if (model.hasDefined(ModelKeys.WORKSPACES_INITIAL_CONTENT)) {
+ EditableDocument initialContentDocument = workspacesDoc.getOrCreateDocument(FieldName.INITIAL_CONTENT);
+ List<ModelNode> workspacesInitialContent = model.get(ModelKeys.WORKSPACES_INITIAL_CONTENT).asList();
+ for (ModelNode initialContent : workspacesInitialContent) {
+ Property initialContentProperty = initialContent.asProperty();
+ initialContentDocument.set(initialContentProperty.getName(), initialContentProperty.getValue().asString());
+ }
+ }
+ }
+ if (model.hasDefined(ModelKeys.DEFAULT_INITIAL_CONTENT)) {
+ EditableDocument initialContentDocument = workspacesDoc.getOrCreateDocument(FieldName.INITIAL_CONTENT);
+ initialContentDocument.set(FieldName.DEFAULT_INITIAL_CONTENT, model.get(ModelKeys.DEFAULT_INITIAL_CONTENT).asString());
+ }
+ return workspacesDoc;
+ }
+
+ private void parseCustomNodeTypes( ModelNode model,
+ EditableDocument configDoc ) {
+ if (model.hasDefined(ModelKeys.NODE_TYPES)) {
+ EditableArray nodeTypesArray = configDoc.getOrCreateArray(FieldName.NODE_TYPES);
+ for (ModelNode nodeType : model.get(ModelKeys.NODE_TYPES).asList()) {
+ nodeTypesArray.add(nodeType.asString());
+ }
+ }
+ }
+
+ private void enableMonitoring( boolean enableMonitoring,
+ EditableDocument configDoc ) {
+ EditableDocument monitoring = configDoc.getOrCreateDocument(FieldName.MONITORING);
+ monitoring.set(FieldName.MONITORING_ENABLED, enableMonitoring);
}
}
4 deploy/jbossas/modeshape-jbossas-subsystem/src/main/java/org/modeshape/jboss/subsystem/ModelAttributes.java
View
@@ -196,7 +196,7 @@ public void validateParameter( String parameterName,
ModelType.INT).setXmlName(Attribute.ASYNC_MAX_QUEUE_SIZE.getLocalName())
.setAllowExpression(true)
.setAllowNull(true)
- .setDefaultValue(new ModelNode().set(0))
+ .setDefaultValue(new ModelNode().set(1))
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.build();
@@ -643,7 +643,7 @@ public void validateParameter( String parameterName,
ModelType.STRING).setXmlName(Attribute.THREAD_POOL.getLocalName())
.setAllowExpression(true)
.setAllowNull(true)
- .setDefaultValue(new ModelNode().set("modeshape-workers"))
+ .setDefaultValue(new ModelNode().set("modeshape-indexing-workers"))
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.build();
Please sign in to comment.
Something went wrong with that request. Please try again.