http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreMixin.java b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreMixin.java deleted file mode 100644 index 3198347..0000000 --- a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreMixin.java +++ /dev/null @@ -1,658 +0,0 @@ -/* - * 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.polygene.entitystore.prefs; - -import java.time.Instant; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.prefs.BackingStoreException; -import java.util.prefs.Preferences; -import java.util.stream.Stream; -import org.apache.polygene.api.cache.CacheOptions; -import org.apache.polygene.api.common.QualifiedName; -import org.apache.polygene.api.entity.EntityDescriptor; -import org.apache.polygene.api.entity.EntityReference; -import org.apache.polygene.api.identity.Identity; -import org.apache.polygene.api.identity.IdentityGenerator; -import org.apache.polygene.api.injection.scope.Service; -import org.apache.polygene.api.injection.scope.Structure; -import org.apache.polygene.api.injection.scope.This; -import org.apache.polygene.api.injection.scope.Uses; -import org.apache.polygene.api.property.PropertyDescriptor; -import org.apache.polygene.api.service.ServiceActivation; -import org.apache.polygene.api.service.ServiceDescriptor; -import org.apache.polygene.api.service.qualifier.Tagged; -import org.apache.polygene.api.structure.Application; -import org.apache.polygene.api.structure.ModuleDescriptor; -import org.apache.polygene.api.time.SystemTime; -import org.apache.polygene.api.type.CollectionType; -import org.apache.polygene.api.type.EnumType; -import org.apache.polygene.api.type.MapType; -import org.apache.polygene.api.type.ValueCompositeType; -import org.apache.polygene.api.type.ValueType; -import org.apache.polygene.api.unitofwork.NoSuchEntityException; -import org.apache.polygene.api.unitofwork.NoSuchEntityTypeException; -import org.apache.polygene.api.usecase.Usecase; -import org.apache.polygene.api.usecase.UsecaseBuilder; -import org.apache.polygene.api.value.ValueSerialization; -import org.apache.polygene.api.value.ValueSerializationException; -import org.apache.polygene.spi.PolygeneSPI; -import org.apache.polygene.spi.entity.EntityState; -import org.apache.polygene.spi.entity.EntityStatus; -import org.apache.polygene.spi.entitystore.DefaultEntityStoreUnitOfWork; -import org.apache.polygene.spi.entitystore.EntityStore; -import org.apache.polygene.spi.entitystore.EntityStoreException; -import org.apache.polygene.spi.entitystore.EntityStoreSPI; -import org.apache.polygene.spi.entitystore.EntityStoreUnitOfWork; -import org.apache.polygene.spi.entitystore.StateCommitter; -import org.apache.polygene.spi.entitystore.helpers.DefaultEntityState; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Implementation of EntityStore that is backed by the Preferences API. - * - * <p>@see Preferences</p> - * <p> - * Associations are stored as the reference of the referenced Entity, ManyAssociations are stored as multi-line strings - * (one reference per line), and NamedAssociations are stored as multi-line strings (one name on a line, reference on the - * next line). - * </p> - * <p>Nested ValuesComposites, Collections and Maps are stored using available ValueSerialization service.</p> - */ -public class PreferencesEntityStoreMixin - implements ServiceActivation, EntityStore, EntityStoreSPI -{ - @Structure - private PolygeneSPI spi; - - @This - private EntityStoreSPI entityStoreSpi; - - @Uses - private ServiceDescriptor descriptor; - - @Structure - private Application application; - - @Service - @Tagged( ValueSerialization.Formats.JSON ) - private ValueSerialization valueSerialization; - - private Preferences root; - - public Logger logger; - - public ScheduledThreadPoolExecutor reloadExecutor; - - @Service - private IdentityGenerator identityGenerator; - - @Override - public void activateService() - throws Exception - { - root = getApplicationRoot(); - logger = LoggerFactory.getLogger( PreferencesEntityStoreService.class.getName() ); - logger.info( "Preferences store:" + root.absolutePath() ); - - // Reload underlying store every 60 seconds - reloadExecutor = new ScheduledThreadPoolExecutor( 1 ); - reloadExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy( false ); - reloadExecutor.scheduleAtFixedRate( () -> { - try - { - //noinspection SynchronizeOnNonFinalField - synchronized( root ) - { - root.sync(); - } - } - catch( BackingStoreException e ) - { - logger.warn( "Could not reload preferences", e ); - } - }, 0, 60, TimeUnit.SECONDS ); - } - - private Preferences getApplicationRoot() - { - PreferencesEntityStoreInfo storeInfo = descriptor.metaInfo( PreferencesEntityStoreInfo.class ); - - Preferences preferences; - if( storeInfo == null ) - { - // Default to use system root + application name - preferences = Preferences.systemRoot(); - String name = application.name(); - preferences = preferences.node( name ); - } - else - { - preferences = storeInfo.rootNode(); - } - - return preferences; - } - - @Override - public void passivateService() - throws Exception - { - reloadExecutor.shutdown(); - reloadExecutor.awaitTermination( 10, TimeUnit.SECONDS ); - } - - @Override - public EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecase, Instant currentTime ) - { - return new DefaultEntityStoreUnitOfWork( module, entityStoreSpi, newUnitOfWorkId(), usecase, currentTime ); - } - - @Override - public Stream<EntityState> entityStates( final ModuleDescriptor module ) - { - UsecaseBuilder builder = UsecaseBuilder.buildUsecase( "polygene.entitystore.preferences.visit" ); - Usecase visitUsecase = builder.withMetaInfo( CacheOptions.NEVER ).newUsecase(); - EntityStoreUnitOfWork uow = newUnitOfWork( module, visitUsecase, SystemTime.now() ); - - try - { - return Stream.of( root.childrenNames() ) - .map( EntityReference::parseEntityReference ) - .map( ref -> uow.entityStateOf( module, ref ) ) - .onClose( uow::discard ); - } - catch( BackingStoreException e ) - { - throw new EntityStoreException( e ); - } - } - - @Override - public EntityState newEntityState( EntityStoreUnitOfWork unitOfWork, - EntityReference reference, - EntityDescriptor entityDescriptor - ) - { - return new DefaultEntityState( unitOfWork.currentTime(), reference, entityDescriptor ); - } - - @Override - public EntityState entityStateOf( EntityStoreUnitOfWork unitOfWork, - ModuleDescriptor module, - EntityReference reference - ) - { - try - { - if( !root.nodeExists( reference.identity().toString() ) ) - { - throw new NoSuchEntityException( reference, UnknownType.class, unitOfWork.usecase() ); - } - - Preferences entityPrefs = root.node( reference.identity().toString() ); - - String type = entityPrefs.get( "type", null ); - EntityStatus status = EntityStatus.LOADED; - - EntityDescriptor entityDescriptor = module.entityDescriptor( type ); - if( entityDescriptor == null ) - { - throw new NoSuchEntityTypeException( type, module.name(), module.typeLookup() ); - } - - Map<QualifiedName, Object> properties = new HashMap<>(); - final Preferences propsPrefs = entityPrefs.node( "properties" ); - entityDescriptor.state().properties().forEach( - persistentPropertyDescriptor -> - { - if( persistentPropertyDescriptor.qualifiedName().name().equals( "reference" ) ) - { - // Fake reference property - properties.put( persistentPropertyDescriptor.qualifiedName(), reference.identity().toString() ); - } - else - { - ValueType propertyType = persistentPropertyDescriptor.valueType(); - Class<?> primaryType = propertyType.primaryType(); - if( Number.class.isAssignableFrom( primaryType ) ) - { - if( primaryType.equals( Long.class ) ) - { - properties.put( persistentPropertyDescriptor.qualifiedName(), - this.getNumber( propsPrefs, module, persistentPropertyDescriptor, LONG_PARSER ) ); - } - else if( primaryType.equals( Integer.class ) ) - { - properties.put( persistentPropertyDescriptor.qualifiedName(), - this.getNumber( propsPrefs, module, persistentPropertyDescriptor, INT_PARSER ) ); - } - else if( primaryType.equals( Double.class ) ) - { - properties.put( persistentPropertyDescriptor.qualifiedName(), - this.getNumber( propsPrefs, module, persistentPropertyDescriptor, DOUBLE_PARSER ) ); - } - else if( primaryType.equals( Float.class ) ) - { - properties.put( persistentPropertyDescriptor.qualifiedName(), - this.getNumber( propsPrefs, module, persistentPropertyDescriptor, FLOAT_PARSER ) ); - } - else - { - // Load as string even though it's a number - String json = propsPrefs.get( persistentPropertyDescriptor.qualifiedName() - .name(), null ); - Object value; - if( json == null ) - { - value = null; - } - else - { - value = valueSerialization.deserialize( module, persistentPropertyDescriptor.valueType(), json ); - } - properties.put( persistentPropertyDescriptor.qualifiedName(), value ); - } - } - else if( primaryType.equals( Boolean.class ) ) - { - Boolean initialValue = (Boolean) persistentPropertyDescriptor.resolveInitialValue(module); - properties.put( persistentPropertyDescriptor.qualifiedName(), - propsPrefs.getBoolean( persistentPropertyDescriptor.qualifiedName().name(), - initialValue == null ? false : initialValue ) ); - } - else if( propertyType instanceof ValueCompositeType - || propertyType instanceof MapType - || propertyType instanceof CollectionType - || propertyType instanceof EnumType ) - { - String json = propsPrefs.get( persistentPropertyDescriptor.qualifiedName().name(), null ); - Object value; - if( json == null ) - { - value = null; - } - else - { - value = valueSerialization.deserialize( module, persistentPropertyDescriptor.valueType(), json ); - } - properties.put( persistentPropertyDescriptor.qualifiedName(), value ); - } - else - { - String json = propsPrefs.get( persistentPropertyDescriptor.qualifiedName().name(), null ); - if( json == null ) - { - if( persistentPropertyDescriptor.resolveInitialValue( module ) != null ) - { - properties.put( persistentPropertyDescriptor.qualifiedName(), - persistentPropertyDescriptor.resolveInitialValue( module ) ); - } - else - { - properties.put( persistentPropertyDescriptor.qualifiedName(), null ); - } - } - else - { - Object value = valueSerialization.deserialize( module, propertyType, json ); - properties.put( persistentPropertyDescriptor.qualifiedName(), value ); - } - } - } - } ); - - // Associations - Map<QualifiedName, EntityReference> associations = new HashMap<>(); - final Preferences assocs = entityPrefs.node( "associations" ); - entityDescriptor.state().associations().forEach( associationType -> { - String associatedEntity = assocs.get( associationType.qualifiedName().name(), null ); - EntityReference value = associatedEntity == null - ? null - : EntityReference.parseEntityReference( associatedEntity ); - associations.put( associationType.qualifiedName(), value ); - } ); - - // ManyAssociations - Map<QualifiedName, List<EntityReference>> manyAssociations = new HashMap<>(); - Preferences manyAssocs = entityPrefs.node( "manyassociations" ); - entityDescriptor.state().manyAssociations().forEach( manyAssociationType -> { - List<EntityReference> references = new ArrayList<>(); - String entityReferences = manyAssocs.get( manyAssociationType - .qualifiedName() - .name(), null ); - if( entityReferences == null ) - { - // ManyAssociation not found, default to empty one - manyAssociations.put( manyAssociationType.qualifiedName(), references ); - } - else - { - String[] refs = entityReferences.split( "\n" ); - for( String ref : refs ) - { - EntityReference value = ref == null - ? null - : EntityReference.parseEntityReference( ref ); - references.add( value ); - } - manyAssociations.put( manyAssociationType.qualifiedName(), references ); - } - } ); - - // NamedAssociations - Map<QualifiedName, Map<String, EntityReference>> namedAssociations = new HashMap<>(); - Preferences namedAssocs = entityPrefs.node( "namedassociations" ); - entityDescriptor.state().namedAssociations().forEach( namedAssociationType -> { - Map<String, EntityReference> references = new LinkedHashMap<>(); - String entityReferences = namedAssocs.get( namedAssociationType.qualifiedName().name(), null ); - if( entityReferences == null ) - { - // NamedAssociation not found, default to empty one - namedAssociations.put( namedAssociationType.qualifiedName(), references ); - } - else - { - String[] namedRefs = entityReferences.split( "\n" ); - if( namedRefs.length % 2 != 0 ) - { - throw new EntityStoreException( "Invalid NamedAssociation storage format" ); - } - for( int idx = 0; idx < namedRefs.length; idx += 2 ) - { - String name = namedRefs[ idx ]; - String ref = namedRefs[ idx + 1 ]; - references.put( name, EntityReference.parseEntityReference( ref ) ); - } - namedAssociations.put( namedAssociationType.qualifiedName(), references ); - } - } ); - - return new DefaultEntityState( entityPrefs.get( "version", "" ), - Instant.ofEpochMilli(entityPrefs.getLong( "modified", unitOfWork.currentTime().toEpochMilli() )), - reference, - status, - entityDescriptor, - properties, - associations, - manyAssociations, - namedAssociations - ); - } - catch( ValueSerializationException | BackingStoreException e ) - { - throw new EntityStoreException( e ); - } - } - - @Override - public String versionOf( EntityStoreUnitOfWork unitOfWork, EntityReference reference ) - { - try - { - if( !root.nodeExists( reference.identity().toString() ) ) - { - throw new NoSuchEntityException( reference, UnknownType.class, unitOfWork.usecase() ); - } - - Preferences entityPrefs = root.node( reference.identity().toString() ); - return entityPrefs.get( "version", "" ); - } - catch( BackingStoreException e ) - { - throw new EntityStoreException( e ); - } - } - - @Override - public StateCommitter applyChanges( final EntityStoreUnitOfWork unitofwork, final Iterable<EntityState> state ) - { - return new StateCommitter() - { - @SuppressWarnings( "SynchronizeOnNonFinalField" ) - @Override - public void commit() - { - try - { - synchronized( root ) - { - for( EntityState entityState : state ) - { - DefaultEntityState state = (DefaultEntityState) entityState; - if( state.status().equals( EntityStatus.NEW ) ) - { - Preferences entityPrefs = root.node( state.entityReference().identity().toString() ); - writeEntityState( state, entityPrefs, unitofwork.identity(), unitofwork.currentTime() ); - } - else if( state.status().equals( EntityStatus.UPDATED ) ) - { - Preferences entityPrefs = root.node( state.entityReference().identity().toString() ); - writeEntityState( state, entityPrefs, unitofwork.identity(), unitofwork.currentTime() ); - } - else if( state.status().equals( EntityStatus.REMOVED ) ) - { - root.node( state.entityReference().identity().toString() ).removeNode(); - } - } - root.flush(); - } - } - catch( BackingStoreException e ) - { - throw new EntityStoreException( e ); - } - } - - @Override - public void cancel() - { - } - }; - } - - protected void writeEntityState( DefaultEntityState state, - Preferences entityPrefs, - Identity identity, - Instant lastModified - ) - throws EntityStoreException - { - try - { - // Store into Preferences API - entityPrefs.put( "type", state.entityDescriptor().types().findFirst().get().getName() ); - entityPrefs.put( "version", identity.toString() ); - entityPrefs.putLong( "modified", lastModified.toEpochMilli() ); - - // Properties - Preferences propsPrefs = entityPrefs.node( "properties" ); - state.entityDescriptor().state().properties() - .filter( property -> !property.qualifiedName().name().equals( "reference" ) ) - .forEach( persistentProperty -> - { - Object value = state.properties().get( persistentProperty.qualifiedName() ); - - if( value == null ) - { - propsPrefs.remove( persistentProperty.qualifiedName().name() ); - } - else - { - ValueType valueType = persistentProperty.valueType(); - Class<?> primaryType = valueType.primaryType(); - if( Number.class.isAssignableFrom( primaryType ) ) - { - if( primaryType.equals( Long.class ) ) - { - propsPrefs.putLong( persistentProperty.qualifiedName().name(), (Long) value ); - } - else if( primaryType.equals( Integer.class ) ) - { - propsPrefs.putInt( persistentProperty.qualifiedName() - .name(), (Integer) value ); - } - else if( primaryType.equals( Double.class ) ) - { - propsPrefs.putDouble( persistentProperty.qualifiedName() - .name(), (Double) value ); - } - else if( primaryType.equals( Float.class ) ) - { - propsPrefs.putFloat( persistentProperty.qualifiedName() - .name(), (Float) value ); - } - else - { - // Store as string even though it's a number - String jsonString = valueSerialization.serialize( value ); - propsPrefs.put( persistentProperty.qualifiedName().name(), jsonString ); - } - } - else if( primaryType.equals( Boolean.class ) ) - { - propsPrefs.putBoolean( persistentProperty.qualifiedName() - .name(), (Boolean) value ); - } - else if( valueType instanceof ValueCompositeType - || valueType instanceof MapType - || valueType instanceof CollectionType - || valueType instanceof EnumType ) - { - String jsonString = valueSerialization.serialize( value ); - propsPrefs.put( persistentProperty.qualifiedName().name(), jsonString ); - } - else - { - String jsonString = valueSerialization.serialize( value ); - propsPrefs.put( persistentProperty.qualifiedName().name(), jsonString ); - } - } - } ); - - // Associations - if( !state.associations().isEmpty() ) - { - Preferences assocsPrefs = entityPrefs.node( "associations" ); - for( Map.Entry<QualifiedName, EntityReference> association : state.associations().entrySet() ) - { - if( association.getValue() == null ) - { - assocsPrefs.remove( association.getKey().name() ); - } - else - { - assocsPrefs.put( association.getKey().name(), association.getValue().identity().toString() ); - } - } - } - - // ManyAssociations - if( !state.manyAssociations().isEmpty() ) - { - Preferences manyAssocsPrefs = entityPrefs.node( "manyassociations" ); - for( Map.Entry<QualifiedName, List<EntityReference>> manyAssociation : state.manyAssociations() - .entrySet() ) - { - StringBuilder manyAssocs = new StringBuilder(); - for( EntityReference entityReference : manyAssociation.getValue() ) - { - if( manyAssocs.length() > 0 ) - { - manyAssocs.append( "\n" ); - } - manyAssocs.append( entityReference.identity().toString() ); - } - if( manyAssocs.length() > 0 ) - { - manyAssocsPrefs.put( manyAssociation.getKey().name(), manyAssocs.toString() ); - } - } - } - - // NamedAssociations - if( !state.namedAssociations().isEmpty() ) - { - Preferences namedAssocsPrefs = entityPrefs.node( "namedassociations" ); - for( Map.Entry<QualifiedName, Map<String, EntityReference>> namedAssociation : state.namedAssociations() - .entrySet() ) - { - StringBuilder namedAssocs = new StringBuilder(); - for( Map.Entry<String, EntityReference> namedRef : namedAssociation.getValue().entrySet() ) - { - if( namedAssocs.length() > 0 ) - { - namedAssocs.append( "\n" ); - } - namedAssocs.append( namedRef.getKey() ).append( "\n" ).append( namedRef.getValue().identity().toString() ); - } - if( namedAssocs.length() > 0 ) - { - namedAssocsPrefs.put( namedAssociation.getKey().name(), namedAssocs.toString() ); - } - } - } - } - catch( ValueSerializationException e ) - { - throw new EntityStoreException( "Could not store EntityState", e ); - } - } - - protected Identity newUnitOfWorkId() - { - return identityGenerator.generate(EntityStore.class); - } - - private interface NumberParser<T> - { - T parse( String str ); - } - - private static final NumberParser<Long> LONG_PARSER = Long::parseLong; - - private static final NumberParser<Integer> INT_PARSER = Integer::parseInt; - - private static final NumberParser<Double> DOUBLE_PARSER = Double::parseDouble; - - private static final NumberParser<Float> FLOAT_PARSER = Float::parseFloat; - - private <T> T getNumber( Preferences prefs, ModuleDescriptor module, PropertyDescriptor pDesc, NumberParser<T> parser ) - { - Object initialValue = pDesc.resolveInitialValue( module ); - String str = prefs.get( pDesc.qualifiedName().name(), initialValue == null ? null : initialValue.toString() ); - T result = null; - if( str != null ) - { - result = parser.parse( str ); - } - return result; - } - - private static class UnknownType - { - } -}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreService.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreService.java b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreService.java deleted file mode 100644 index a3801de..0000000 --- a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreService.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.polygene.entitystore.prefs; - -import org.apache.polygene.api.concern.Concerns; -import org.apache.polygene.api.mixin.Mixins; -import org.apache.polygene.api.service.ServiceActivation; -import org.apache.polygene.api.service.ServiceComposite; -import org.apache.polygene.spi.entitystore.ConcurrentModificationCheckConcern; -import org.apache.polygene.spi.entitystore.EntityStateVersions; -import org.apache.polygene.spi.entitystore.EntityStore; - -/** - * EntityStore backed by Preferences API. - * <p> - * A root node is created in the System preferences, whose name - * is the same as the Application name (default:"Application"). - * </p> - * <p> - * Each entity is stored under its identity name. - * </p> - * <p> - * Property types are converted to native Preferences API types - * as much as possible. All others will be serialized to a string using JSON. - * </p> - * <p> - * Associations are stored as the identity of the referenced Entity, ManyAssociations are stored as multi-line strings - * (one reference per line), and NamedAssociations are stored as multi-line strings (one name on a line, reference on the - * next line). - * </p> - * <p> - * The main use of the EntityStore is for storage of ConfigurationComposites for ServiceComposites. - * </p> - * @see org.apache.polygene.api.service.ServiceComposite - * @see org.apache.polygene.api.configuration.Configuration - */ -@Concerns( ConcurrentModificationCheckConcern.class ) -@Mixins( PreferencesEntityStoreMixin.class ) -public interface PreferencesEntityStoreService - extends EntityStore, ServiceComposite, EntityStateVersions, ServiceActivation -{ -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/assembly/PreferenceEntityStoreAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/assembly/PreferenceEntityStoreAssembler.java b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/assembly/PreferenceEntityStoreAssembler.java deleted file mode 100644 index 4371047..0000000 --- a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/assembly/PreferenceEntityStoreAssembler.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.polygene.entitystore.prefs.assembly; - -import java.util.prefs.Preferences; -import org.apache.polygene.bootstrap.Assemblers; -import org.apache.polygene.bootstrap.AssemblyException; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.bootstrap.ServiceDeclaration; -import org.apache.polygene.entitystore.prefs.PreferencesEntityStoreInfo; -import org.apache.polygene.entitystore.prefs.PreferencesEntityStoreService; - -public class PreferenceEntityStoreAssembler - extends Assemblers.VisibilityIdentity<PreferenceEntityStoreAssembler> -{ - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - String applicationName = module.layer().application().name(); - - Preferences root = Preferences.userRoot(); - Preferences node = root.node( applicationName ); - PreferencesEntityStoreInfo info = new PreferencesEntityStoreInfo( node ); - ServiceDeclaration service = module.services( PreferencesEntityStoreService.class ) - .setMetaInfo( info ) - .visibleIn( visibility() ) - .instantiateOnStartup(); - if( hasIdentity() ) - { - service.identifiedBy( identity() ); - } - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/assembly/package.html ---------------------------------------------------------------------- diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/assembly/package.html b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/assembly/package.html deleted file mode 100644 index 564de79..0000000 --- a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/assembly/package.html +++ /dev/null @@ -1,24 +0,0 @@ -<!-- - ~ 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. - ~ - ~ - --> -<html> - <body> - <h2>Preferences EntityStore Assembly.</h2> - </body> -</html> http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/package.html ---------------------------------------------------------------------- diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/package.html b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/package.html deleted file mode 100644 index 8e39337..0000000 --- a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/package.html +++ /dev/null @@ -1,24 +0,0 @@ -<!-- - ~ 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. - ~ - ~ - --> -<html> - <body> - <h2>Preferences EntityStore.</h2> - </body> -</html> http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/DocumentationSupport.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/DocumentationSupport.java b/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/DocumentationSupport.java index 7715f9e..53f049a 100644 --- a/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/DocumentationSupport.java +++ b/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/DocumentationSupport.java @@ -21,7 +21,7 @@ package org.apache.polygene.entitystore; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.entitystore.prefs.assembly.PreferenceEntityStoreAssembler; +import org.apache.polygene.entitystore.preferences.assembly.PreferencesEntityStoreAssembler; import org.apache.polygene.test.AbstractPolygeneTest; public class DocumentationSupport @@ -32,7 +32,7 @@ public class DocumentationSupport public void assemble( ModuleAssembly module ) throws AssemblyException { - new PreferenceEntityStoreAssembler().assemble( module ); + new PreferencesEntityStoreAssembler().assemble( module ); } // END SNIPPET: assembly http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/PreferencesEntityStoreTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/PreferencesEntityStoreTest.java b/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/PreferencesEntityStoreTest.java index f2cf4e4..10be81e 100644 --- a/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/PreferencesEntityStoreTest.java +++ b/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/PreferencesEntityStoreTest.java @@ -22,8 +22,8 @@ package org.apache.polygene.entitystore; import java.util.prefs.Preferences; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.entitystore.prefs.PreferencesEntityStoreInfo; -import org.apache.polygene.entitystore.prefs.PreferencesEntityStoreService; +import org.apache.polygene.entitystore.preferences.PreferencesEntityStoreInfo; +import org.apache.polygene.entitystore.preferences.PreferencesEntityStoreService; import org.apache.polygene.test.entity.AbstractEntityStoreTest; import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler; import org.junit.Rule; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLEntityStoreAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLEntityStoreAssembler.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLEntityStoreAssembler.java new file mode 100644 index 0000000..1477c6b --- /dev/null +++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLEntityStoreAssembler.java @@ -0,0 +1,28 @@ +/* + * 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.polygene.entitystore.sql.assembly; + +/** + * This is a dummy Assembler to support the Yeoman Polygene Generator, which require naming conventions for + * the systems that it supports. + */ +public class SQLEntityStoreAssembler extends H2SQLEntityStoreAssembler +{} + http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-elasticsearch/build.gradle ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/build.gradle b/extensions/indexing-elasticsearch/build.gradle index fac6eec..faa63b8 100644 --- a/extensions/indexing-elasticsearch/build.gradle +++ b/extensions/indexing-elasticsearch/build.gradle @@ -34,6 +34,7 @@ dependencies { runtimeOnly polygene.core.runtime testImplementation polygene.core.testsupport + testImplementation polygene.extension( 'valueserialization-jackson' ) testRuntimeOnly libraries.logback } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java index 6b6feab..ecd35fb 100644 --- a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java +++ b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java @@ -30,6 +30,7 @@ import org.apache.polygene.library.fileconfig.FileConfigurationOverride; import org.apache.polygene.test.EntityTestAssembler; import org.apache.polygene.test.indexing.AbstractQueryTest; import org.apache.polygene.test.util.NotYetImplemented; +import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler; import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Rule; @@ -78,6 +79,9 @@ public class ElasticSearchQueryTest extends AbstractQueryTest testName.getMethodName() ) ); esConfig.indexNonAggregatedAssociations().set( Boolean.TRUE ); + // Serialization + new JacksonValueSerializationAssembler().assemble( module ); + // FileConfig new FileConfigurationAssembler() .withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) ) http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-rdf/build.gradle ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/build.gradle b/extensions/indexing-rdf/build.gradle index 2eb52e9..ad465a4 100644 --- a/extensions/indexing-rdf/build.gradle +++ b/extensions/indexing-rdf/build.gradle @@ -33,7 +33,7 @@ dependencies { runtimeOnly polygene.core.runtime testImplementation polygene.core.testsupport - testImplementation polygene.extension( 'valueserialization-orgjson' ) + testImplementation polygene.extension( 'valueserialization-jackson' ) testImplementation polygene.extension( 'entitystore-preferences' ) testImplementation polygene.extension( 'entitystore-jdbm' ) http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/query/RdfQueryParserFactory.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/query/RdfQueryParserFactory.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/query/RdfQueryParserFactory.java index 8f11649..fa2c6ae 100644 --- a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/query/RdfQueryParserFactory.java +++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/query/RdfQueryParserFactory.java @@ -43,6 +43,7 @@ public interface RdfQueryParserFactory { @Structure private PolygeneSPI spi; + @Service @Tagged( ValueSerialization.Formats.JSON ) private ValueSerializer valueSerializer; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryMultimoduleTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryMultimoduleTest.java b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryMultimoduleTest.java index 23c8f13..21f5d46 100644 --- a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryMultimoduleTest.java +++ b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryMultimoduleTest.java @@ -27,6 +27,7 @@ import org.apache.polygene.bootstrap.ModuleAssembly; import org.apache.polygene.bootstrap.unitofwork.DefaultUnitOfWorkAssembler; import org.apache.polygene.index.rdf.assembly.RdfMemoryStoreAssembler; import org.apache.polygene.test.EntityTestAssembler; +import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler; public class RdfNamedQueryMultimoduleTest extends RdfNamedQueryTest @@ -47,6 +48,7 @@ public class RdfNamedQueryMultimoduleTest ModuleAssembly indexModule = layer.module( "index" ); new DefaultUnitOfWorkAssembler().assemble( indexModule ); new RdfMemoryStoreAssembler( Visibility.layer, Visibility.module ).assemble( indexModule ); + new JacksonValueSerializationAssembler().assemble( indexModule ); } } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java index e327387..6ebbee8 100644 --- a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java +++ b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java @@ -27,6 +27,8 @@ import org.apache.polygene.bootstrap.ModuleAssembly; import org.apache.polygene.index.rdf.assembly.RdfMemoryStoreAssembler; import org.apache.polygene.index.rdf.query.SesameExpressions; import org.apache.polygene.test.indexing.AbstractNamedQueryTest; +import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler; +import org.slf4j.LoggerFactory; public class RdfNamedQueryTest extends AbstractNamedQueryTest { http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfQueryMultimoduleTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfQueryMultimoduleTest.java b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfQueryMultimoduleTest.java index 0ed4774..d9d0cf1 100644 --- a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfQueryMultimoduleTest.java +++ b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfQueryMultimoduleTest.java @@ -28,6 +28,7 @@ import org.apache.polygene.bootstrap.unitofwork.DefaultUnitOfWorkAssembler; import org.apache.polygene.index.rdf.assembly.RdfNativeSesameStoreAssembler; import org.apache.polygene.library.rdf.repository.NativeConfiguration; import org.apache.polygene.test.EntityTestAssembler; +import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler; import org.junit.Rule; import org.junit.rules.TemporaryFolder; @@ -53,6 +54,7 @@ public class RdfQueryMultimoduleTest ModuleAssembly indexModule = layer.module( "index" ); new RdfNativeSesameStoreAssembler( Visibility.layer, Visibility.module ).assemble( indexModule ); new DefaultUnitOfWorkAssembler().assemble( indexModule ); + new JacksonValueSerializationAssembler().assemble( indexModule ); LayerAssembly configLayer = module.layer().application().layer( "config" ); module.layer().uses( configLayer ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java index 1d57ef0..9dd94b7 100644 --- a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java +++ b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import org.apache.polygene.bootstrap.unitofwork.DefaultUnitOfWorkAssembler; +import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler; import org.junit.Rule; import org.junit.Test; import org.apache.polygene.api.common.Visibility; @@ -43,7 +44,6 @@ import org.apache.polygene.index.rdf.assembly.RdfMemoryStoreAssembler; import org.apache.polygene.index.rdf.assembly.RdfNativeSesameStoreAssembler; import org.apache.polygene.library.rdf.repository.NativeConfiguration; import org.apache.polygene.test.EntityTestAssembler; -import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler; import org.junit.rules.TemporaryFolder; import static org.junit.Assert.assertTrue; @@ -221,6 +221,7 @@ public class Qi95IssueTest public ModuleAssembly buildModuleAssembly( LayerAssembly layer, String name ) throws AssemblyException { + addModule( layer, name, new JacksonValueSerializationAssembler() ); return addModule( layer, name, new RdfNativeSesameStoreAssembler() ); } }; @@ -241,6 +242,7 @@ public class Qi95IssueTest public ModuleAssembly buildModuleAssembly( LayerAssembly layer, String name ) throws AssemblyException { + addModule( layer, name, new JacksonValueSerializationAssembler() ); return addModule( layer, name, new RdfMemoryStoreAssembler() ); } }; @@ -322,7 +324,7 @@ public class Qi95IssueTest public void assemble( ModuleAssembly module ) throws AssemblyException { - new OrgJsonValueSerializationAssembler().assemble( module ); + new JacksonValueSerializationAssembler().assemble( module ); new JdbmEntityStoreAssembler().visibleIn( Visibility.application ).assemble( module ); new DefaultUnitOfWorkAssembler().assemble( module ); } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-solr/build.gradle ---------------------------------------------------------------------- diff --git a/extensions/indexing-solr/build.gradle b/extensions/indexing-solr/build.gradle index 608bec3..fd991f6 100644 --- a/extensions/indexing-solr/build.gradle +++ b/extensions/indexing-solr/build.gradle @@ -34,6 +34,7 @@ dependencies { runtimeOnly polygene.core.runtime testImplementation polygene.core.testsupport + testImplementation polygene.extension( 'valueserialization-jackson' ) testRuntimeOnly libraries.logback testRuntimeOnly libraries.servlet_api http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrAssembler.java b/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrAssembler.java deleted file mode 100644 index 38b97e3..0000000 --- a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrAssembler.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.polygene.index.solr.assembly; - -import org.apache.polygene.api.value.ValueSerialization; -import org.apache.polygene.bootstrap.Assemblers; -import org.apache.polygene.bootstrap.AssemblyException; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.bootstrap.ServiceDeclaration; -import org.apache.polygene.index.solr.EmbeddedSolrService; -import org.apache.polygene.index.solr.SolrQueryService; -import org.apache.polygene.library.rdf.entity.EntityStateSerializer; -import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService; - -public class SolrAssembler extends Assemblers.VisibilityIdentity -{ - @Override - public void assemble( ModuleAssembly module ) throws AssemblyException - { - module.services( EmbeddedSolrService.class ).identifiedBy( "solr" ).instantiateOnStartup(); - ServiceDeclaration queryService = module.services( SolrQueryService.class ); - queryService. - taggedWith( "solr", "search", "indexing", "query" ). - identifiedBy( identity() ). - visibleIn( visibility() ). - instantiateOnStartup(); - module.services( OrgJsonValueSerializationService.class ).taggedWith( ValueSerialization.Formats.JSON ); - module.objects( EntityStateSerializer.class ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrIndexingAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrIndexingAssembler.java b/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrIndexingAssembler.java new file mode 100644 index 0000000..fa6b59c --- /dev/null +++ b/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrIndexingAssembler.java @@ -0,0 +1,47 @@ +/* + * 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.polygene.index.solr.assembly; + +import org.apache.polygene.api.value.ValueSerialization; +import org.apache.polygene.bootstrap.Assemblers; +import org.apache.polygene.bootstrap.AssemblyException; +import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.bootstrap.ServiceDeclaration; +import org.apache.polygene.index.solr.EmbeddedSolrService; +import org.apache.polygene.index.solr.SolrQueryService; +import org.apache.polygene.library.rdf.entity.EntityStateSerializer; +import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService; + +public class SolrIndexingAssembler extends Assemblers.VisibilityIdentityConfig<SolrIndexingAssembler> +{ + @Override + public void assemble( ModuleAssembly module ) throws AssemblyException + { + module.services( EmbeddedSolrService.class ).identifiedBy( "solr" ).instantiateOnStartup(); + ServiceDeclaration queryService = module.services( SolrQueryService.class ); + queryService. + taggedWith( "solr", "search", "indexing", "query" ). + identifiedBy( identity() ). + visibleIn( visibility() ). + instantiateOnStartup(); + module.objects( EntityStateSerializer.class ); + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java index d51ca13..c67e70b 100644 --- a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java +++ b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java @@ -21,7 +21,7 @@ package org.apache.polygene.index.solr; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.index.solr.assembly.SolrAssembler; +import org.apache.polygene.index.solr.assembly.SolrIndexingAssembler; import org.apache.polygene.library.fileconfig.FileConfigurationAssembler; import org.apache.polygene.library.fileconfig.FileConfigurationOverride; import org.apache.polygene.test.indexing.AbstractEntityFinderTest; @@ -44,6 +44,6 @@ public class SolrEntityFinderTest new FileConfigurationAssembler() .withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) ) .assemble( module ); - new SolrAssembler().assemble( module ); + new SolrIndexingAssembler().assemble( module ); } } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java index fab66ac..daba9b3 100644 --- a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java +++ b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java @@ -23,7 +23,7 @@ import java.util.function.Predicate; import org.apache.polygene.api.composite.Composite; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.index.solr.assembly.SolrAssembler; +import org.apache.polygene.index.solr.assembly.SolrIndexingAssembler; import org.apache.polygene.library.fileconfig.FileConfigurationAssembler; import org.apache.polygene.library.fileconfig.FileConfigurationOverride; import org.apache.polygene.test.indexing.AbstractNamedQueryTest; @@ -46,7 +46,7 @@ public class SolrNamedQueryTest new FileConfigurationAssembler() .withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) ) .assemble( module ); - new SolrAssembler().assemble( module ); + new SolrIndexingAssembler().assemble( module ); } @Override http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java index c5b06f9..01d3440 100644 --- a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java +++ b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java @@ -21,7 +21,7 @@ package org.apache.polygene.index.solr; import java.util.ArrayList; import java.util.List; -import org.apache.polygene.index.solr.assembly.SolrAssembler; +import org.apache.polygene.index.solr.assembly.SolrIndexingAssembler; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.common.SolrDocument; import org.apache.solr.common.SolrDocumentList; @@ -64,7 +64,7 @@ public class SolrQueryServiceTest new EntityTestAssembler().assemble( module ); // START SNIPPET: assembly - new SolrAssembler().assemble( module ); + new SolrIndexingAssembler().assemble( module ); // END SNIPPET: assembly module.entities( TestEntity.class ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java index 376574c..f61b665 100644 --- a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java +++ b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java @@ -21,7 +21,7 @@ package org.apache.polygene.index.solr; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.index.solr.assembly.SolrAssembler; +import org.apache.polygene.index.solr.assembly.SolrIndexingAssembler; import org.apache.polygene.library.fileconfig.FileConfigurationAssembler; import org.apache.polygene.library.fileconfig.FileConfigurationOverride; import org.apache.polygene.test.indexing.AbstractQueryTest; @@ -44,6 +44,6 @@ public class SolrQueryTest new FileConfigurationAssembler() .withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) ) .assemble( module ); - new SolrAssembler().assemble( module ); + new SolrIndexingAssembler().assemble( module ); } } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-sql/build.gradle ---------------------------------------------------------------------- diff --git a/extensions/indexing-sql/build.gradle b/extensions/indexing-sql/build.gradle index e0e50e8..0c8a21e 100644 --- a/extensions/indexing-sql/build.gradle +++ b/extensions/indexing-sql/build.gradle @@ -38,6 +38,7 @@ dependencies { testImplementation polygene.internals.testsupport testImplementation polygene.library( 'sql-dbcp' ) + testImplementation polygene.extension( 'valueserialization-jackson' ) testRuntimeOnly libraries.logback testRuntimeOnly libraries.derby http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/SQLIndexingAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/SQLIndexingAssembler.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/SQLIndexingAssembler.java new file mode 100644 index 0000000..af137de --- /dev/null +++ b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/SQLIndexingAssembler.java @@ -0,0 +1,24 @@ +/* + * 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.polygene.index.sql.assembly; + +public class SQLIndexingAssembler extends PostgreSQLIndexQueryAssembler +{ +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/assembly/CodahaleMetricsAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/assembly/CodahaleMetricsAssembler.java b/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/assembly/CodahaleMetricsAssembler.java index 7e9b843..a737c06 100644 --- a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/assembly/CodahaleMetricsAssembler.java +++ b/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/assembly/CodahaleMetricsAssembler.java @@ -36,7 +36,7 @@ import org.apache.polygene.bootstrap.ServiceDeclaration; import org.apache.polygene.metrics.codahale.CodahaleMetricsProvider; public class CodahaleMetricsAssembler - extends Assemblers.VisibilityIdentity<CodahaleMetricsAssembler> + extends Assemblers.VisibilityIdentityConfig<CodahaleMetricsAssembler> { private final CodahaleMetricsDeclaration declaration = new CodahaleMetricsDeclaration(); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-jackson/src/main/java/org/apache/polygene/valueserialization/jackson/JacksonValueSerializationAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/valueserialization-jackson/src/main/java/org/apache/polygene/valueserialization/jackson/JacksonValueSerializationAssembler.java b/extensions/valueserialization-jackson/src/main/java/org/apache/polygene/valueserialization/jackson/JacksonValueSerializationAssembler.java deleted file mode 100644 index 8f6421d..0000000 --- a/extensions/valueserialization-jackson/src/main/java/org/apache/polygene/valueserialization/jackson/JacksonValueSerializationAssembler.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.polygene.valueserialization.jackson; - -import org.apache.polygene.api.value.ValueSerialization; -import org.apache.polygene.bootstrap.Assemblers; -import org.apache.polygene.bootstrap.AssemblyException; -import org.apache.polygene.bootstrap.ModuleAssembly; - -/** - * Assemble a ValueSerialization Service producing and consuming JSON documents. - */ -public class JacksonValueSerializationAssembler - extends Assemblers.Visibility<JacksonValueSerializationAssembler> -{ - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.services( JacksonValueSerializationService.class ). - visibleIn( visibility() ). - taggedWith( ValueSerialization.Formats.JSON ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-jackson/src/main/java/org/apache/polygene/valueserialization/jackson/assembly/JacksonValueSerializationAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/valueserialization-jackson/src/main/java/org/apache/polygene/valueserialization/jackson/assembly/JacksonValueSerializationAssembler.java b/extensions/valueserialization-jackson/src/main/java/org/apache/polygene/valueserialization/jackson/assembly/JacksonValueSerializationAssembler.java new file mode 100644 index 0000000..7bff000 --- /dev/null +++ b/extensions/valueserialization-jackson/src/main/java/org/apache/polygene/valueserialization/jackson/assembly/JacksonValueSerializationAssembler.java @@ -0,0 +1,42 @@ +/* + * 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.polygene.valueserialization.jackson.assembly; + +import org.apache.polygene.api.value.ValueSerialization; +import org.apache.polygene.bootstrap.Assemblers; +import org.apache.polygene.bootstrap.AssemblyException; +import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.valueserialization.jackson.JacksonValueSerializationService; + +/** + * Assemble a ValueSerialization Service producing and consuming JSON documents. + */ +public class JacksonValueSerializationAssembler + extends Assemblers.Visibility<JacksonValueSerializationAssembler> +{ + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.services( JacksonValueSerializationService.class ) + .visibleIn( visibility() ) + .taggedWith( ValueSerialization.Formats.JSON ); + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonCollectionSerializationTest.java ---------------------------------------------------------------------- diff --git a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonCollectionSerializationTest.java b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonCollectionSerializationTest.java index 8160c55..f4069c3 100644 --- a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonCollectionSerializationTest.java +++ b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonCollectionSerializationTest.java @@ -22,6 +22,7 @@ package org.apache.polygene.valueserialization.jackson; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; import org.apache.polygene.test.value.AbstractCollectionSerializationTest; +import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler; public class JacksonCollectionSerializationTest extends AbstractCollectionSerializationTest http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonConfigurationDeserializationTest.java ---------------------------------------------------------------------- diff --git a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonConfigurationDeserializationTest.java b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonConfigurationDeserializationTest.java index fb59e8e..1948d62 100644 --- a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonConfigurationDeserializationTest.java +++ b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonConfigurationDeserializationTest.java @@ -23,6 +23,7 @@ package org.apache.polygene.valueserialization.jackson; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; import org.apache.polygene.test.entity.AbstractConfigurationDeserializationTest; +import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler; public class JacksonConfigurationDeserializationTest extends AbstractConfigurationDeserializationTest http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonJsonDateFormatTest.java ---------------------------------------------------------------------- diff --git a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonJsonDateFormatTest.java b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonJsonDateFormatTest.java index 78f27b0..bbc141d 100644 --- a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonJsonDateFormatTest.java +++ b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonJsonDateFormatTest.java @@ -22,6 +22,7 @@ package org.apache.polygene.valueserialization.jackson; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; import org.apache.polygene.test.value.AbstractJsonDateFormatTest; +import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler; public class JacksonJsonDateFormatTest extends AbstractJsonDateFormatTest http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonPlainValueSerializationTest.java ---------------------------------------------------------------------- diff --git a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonPlainValueSerializationTest.java b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonPlainValueSerializationTest.java index b4ad6a4..cdcce17 100644 --- a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonPlainValueSerializationTest.java +++ b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonPlainValueSerializationTest.java @@ -21,6 +21,7 @@ package org.apache.polygene.valueserialization.jackson; import org.apache.polygene.bootstrap.ModuleAssembly; import org.apache.polygene.test.value.AbstractPlainValueSerializationTest; +import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler; public class JacksonPlainValueSerializationTest extends AbstractPlainValueSerializationTest http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonValueCompositeSerializationTest.java ---------------------------------------------------------------------- diff --git a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonValueCompositeSerializationTest.java b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonValueCompositeSerializationTest.java index 49f7eba..2a757ab 100644 --- a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonValueCompositeSerializationTest.java +++ b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonValueCompositeSerializationTest.java @@ -22,6 +22,7 @@ package org.apache.polygene.valueserialization.jackson; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; import org.apache.polygene.test.value.AbstractValueCompositeSerializationTest; +import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler; public class JacksonValueCompositeSerializationTest extends AbstractValueCompositeSerializationTest http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-stax/src/main/java/org/apache/polygene/valueserialization/stax/StaxValueSerializationAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/valueserialization-stax/src/main/java/org/apache/polygene/valueserialization/stax/StaxValueSerializationAssembler.java b/extensions/valueserialization-stax/src/main/java/org/apache/polygene/valueserialization/stax/StaxValueSerializationAssembler.java deleted file mode 100644 index e972acb..0000000 --- a/extensions/valueserialization-stax/src/main/java/org/apache/polygene/valueserialization/stax/StaxValueSerializationAssembler.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.polygene.valueserialization.stax; - -import org.apache.polygene.api.value.ValueSerialization; -import org.apache.polygene.bootstrap.Assemblers; -import org.apache.polygene.bootstrap.AssemblyException; -import org.apache.polygene.bootstrap.ModuleAssembly; - -/** - * Assemble a ValueSerialization Service producing and consuming XML documents. - */ -public class StaxValueSerializationAssembler - extends Assemblers.Visibility<StaxValueSerializationAssembler> -{ - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.services( StaxValueSerializationService.class ). - visibleIn( visibility() ). - taggedWith( ValueSerialization.Formats.XML ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-stax/src/main/java/org/apache/polygene/valueserialization/stax/assembly/StaxValueSerializationAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/valueserialization-stax/src/main/java/org/apache/polygene/valueserialization/stax/assembly/StaxValueSerializationAssembler.java b/extensions/valueserialization-stax/src/main/java/org/apache/polygene/valueserialization/stax/assembly/StaxValueSerializationAssembler.java new file mode 100644 index 0000000..8eaede4 --- /dev/null +++ b/extensions/valueserialization-stax/src/main/java/org/apache/polygene/valueserialization/stax/assembly/StaxValueSerializationAssembler.java @@ -0,0 +1,42 @@ +/* + * 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.polygene.valueserialization.stax.assembly; + +import org.apache.polygene.api.value.ValueSerialization; +import org.apache.polygene.bootstrap.Assemblers; +import org.apache.polygene.bootstrap.AssemblyException; +import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.valueserialization.stax.StaxValueSerializationService; + +/** + * Assemble a ValueSerialization Service producing and consuming XML documents. + */ +public class StaxValueSerializationAssembler + extends Assemblers.Visibility<StaxValueSerializationAssembler> +{ + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.services( StaxValueSerializationService.class ) + .visibleIn( visibility() ) + .taggedWith( ValueSerialization.Formats.XML ); + } +}
