Repository: polygene-java Updated Branches: refs/heads/develop 4fb01aa37 -> 1adfa5732
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/NotPresentException.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/NotPresentException.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/NotPresentException.java deleted file mode 100644 index 627e346..0000000 --- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/NotPresentException.java +++ /dev/null @@ -1,25 +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.library.restlet.resource; - -public class NotPresentException extends RuntimeException -{ -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/Parameterizer.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/Parameterizer.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/Parameterizer.java deleted file mode 100644 index a10ba88..0000000 --- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/Parameterizer.java +++ /dev/null @@ -1,25 +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.library.restlet.resource; - -public interface Parameterizer -{ -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/ResourceFactory.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/ResourceFactory.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/ResourceFactory.java deleted file mode 100644 index 22c2d24..0000000 --- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/ResourceFactory.java +++ /dev/null @@ -1,31 +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.library.restlet.resource; - -import org.apache.polygene.api.identity.HasIdentity; -import org.restlet.Context; -import org.restlet.Request; -import org.restlet.Response; - -public interface ResourceFactory<K extends HasIdentity, T extends ServerResource<K>> -{ - T create( Class<T> resourceType, Request request, Response response, Context context ); -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/ServerResource.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/ServerResource.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/ServerResource.java deleted file mode 100644 index 14d0697..0000000 --- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/ServerResource.java +++ /dev/null @@ -1,109 +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.library.restlet.resource; - -import org.apache.polygene.api.common.Optional; -import org.apache.polygene.api.identity.HasIdentity; -import org.apache.polygene.api.identity.Identifiable; -import org.apache.polygene.api.identity.Identity; -import org.apache.polygene.api.injection.scope.Service; -import org.apache.polygene.api.injection.scope.This; -import org.apache.polygene.api.mixin.Mixins; -import org.apache.polygene.api.property.Property; -import org.apache.polygene.library.restlet.RestForm; -import org.apache.polygene.library.restlet.RestLink; -import org.apache.polygene.library.restlet.identity.IdentityManager; -import org.restlet.Context; -import org.restlet.Request; -import org.restlet.Response; -import org.restlet.routing.Router; - -@Mixins( { ServerResource.NotPresent.class, ServerResource.IdentityMixin.class } ) -public interface ServerResource<T extends HasIdentity> extends Identifiable -{ - T get(); - - void put( T value ); - - void delete(); - - RestLink post( RestForm form ); - - interface Parameters<T> - { - @Optional - Property<String> id(); - - Property<Class<T>> entityType(); - - Property<Request> request(); - - Property<Response> response(); - - Property<Context> context(); - - Property<Router> router(); - } - - abstract class IdentityMixin<T extends HasIdentity> - implements ServerResource<T> - { - @This - private Parameters<T> parameters; - - @Service - private IdentityManager identityManager; - - @Override - public Identity identity() - { - return identityManager.generate( parameters.entityType().get(), parameters.id().get() ); - } - } - - abstract class NotPresent - implements ServerResource - { - @Override - public HasIdentity get() - { - throw new NotPresentException(); - } - - @Override - public void put( HasIdentity value ) - { - throw new NotPresentException(); - } - - @Override - public void delete() - { - throw new NotPresentException(); - } - - @Override - public RestLink post( RestForm form ) - { - throw new NotPresentException(); - } - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/FormRepresentation.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/FormRepresentation.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/FormRepresentation.java deleted file mode 100644 index fbb9a34..0000000 --- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/FormRepresentation.java +++ /dev/null @@ -1,150 +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.library.restlet.serialization; - -import java.io.IOException; -import java.io.OutputStream; -import java.util.function.Function; -import org.apache.polygene.api.association.AssociationStateHolder; -import org.apache.polygene.api.common.Optional; -import org.apache.polygene.api.injection.scope.Structure; -import org.apache.polygene.api.injection.scope.Uses; -import org.apache.polygene.api.property.PropertyDescriptor; -import org.apache.polygene.api.value.ValueBuilder; -import org.apache.polygene.api.value.ValueBuilderFactory; -import org.apache.polygene.api.value.ValueComposite; -import org.apache.polygene.api.value.ValueDescriptor; -import org.apache.polygene.spi.PolygeneSPI; -import org.restlet.data.Form; -import org.restlet.data.MediaType; -import org.restlet.representation.OutputRepresentation; -import org.restlet.representation.Representation; - -/** - * Representation based of Polygene ValueComposites. It can serialize and deserialize - * automatically in JSON only.<br> - * <br> - */ -public class FormRepresentation<T> extends OutputRepresentation -{ - @Structure - private PolygeneSPI spi; - - @Structure - private ValueBuilderFactory vbf; - - /** - * The (parsed) object to format. - */ - @Optional - private volatile T object; - - /** - * The object class to instantiate. - */ - @Optional - @Uses - private volatile Class<T> objectClass; - - /** - * The representation to parse. - */ - @Optional - @Uses - private volatile Representation representation; - - public FormRepresentation() - { - super( MediaType.APPLICATION_WWW_FORM ); - } - - private T createObject() - { - //noinspection MismatchedQueryAndUpdateOfCollection - final Form form = new Form( representation ); - ValueBuilder<T> builder = this.vbf.newValueBuilderWithState( - objectClass, - descriptor -> form.getFirstValue( descriptor.qualifiedName().name() ), - descriptor -> null, - descriptor -> null, - descriptor -> null - ); - return builder.newInstance(); - } - - /** - * Returns the wrapped object, deserializing the representation with Polygene - * if necessary. - * - * @return The wrapped object. - * - * @throws IOException - */ - public T getObject() - throws IOException - { - if( object == null ) - { - object = createObject(); - } - return object; - } - - /** - * Returns the object class to instantiate. - * - * @return The object class to instantiate. - */ - public Class<T> getObjectClass() - { - return objectClass; - } - - @Override - public void write( OutputStream outputStream ) - throws IOException - { - if( representation != null ) - { - representation.write( outputStream ); - } - else if( object != null ) - { - AssociationStateHolder state = spi.stateOf( (ValueComposite) object ); - ValueDescriptor descriptor = (ValueDescriptor) spi.modelDescriptorFor( object ); - descriptor.state().properties().forEach( property -> { - String name = property.qualifiedName().name(); - String value = state.propertyFor( property.accessor() ).get().toString(); - try - { - outputStream.write( name.getBytes( "UTF-8" ) ); - outputStream.write( "=".getBytes( "UTF-8" ) ); - outputStream.write( value.getBytes( "UTF-8" ) ); - outputStream.write( '\n' ); - } - catch( IOException e ) - { - // TODO; not sure what could happen here. - } - } ); - } - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/JsonRepresentation.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/JsonRepresentation.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/JsonRepresentation.java deleted file mode 100644 index 01947cf..0000000 --- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/JsonRepresentation.java +++ /dev/null @@ -1,135 +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.library.restlet.serialization; - -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; -import org.apache.polygene.api.common.Optional; -import org.apache.polygene.api.injection.scope.Service; -import org.apache.polygene.api.injection.scope.Structure; -import org.apache.polygene.api.injection.scope.Uses; -import org.apache.polygene.api.serialization.Serialization; -import org.apache.polygene.api.serialization.Serializer; -import org.apache.polygene.api.structure.ModuleDescriptor; -import org.apache.polygene.spi.PolygeneSPI; -import org.restlet.data.MediaType; -import org.restlet.engine.application.StatusInfo; -import org.restlet.representation.OutputRepresentation; -import org.restlet.representation.Representation; - -/** - * Representation based of Polygene ValueComposites. It can serialize and deserialize - * automatically in JSON only.<br> - * <br> - */ -public class JsonRepresentation<T> extends OutputRepresentation -{ - - @Structure - private PolygeneSPI spi; - - @Service - private Serialization stateSerialization; - - @Structure - private ModuleDescriptor module; - - /** - * The (parsed) object to format. - */ - @Optional - @Uses - private volatile T object; - - /** - * The object class to instantiate. - */ - @Optional - @Uses - private volatile Class<T> objectClass; - - /** - * The representation to parse. - */ - @Optional - @Uses - private volatile Representation representation; - - public JsonRepresentation() - { - super( MediaType.APPLICATION_JSON ); - } - - /** - * Returns the wrapped object, deserializing the representation with Polygene - * if necessary. - * - * @return The wrapped object. - * - * @throws IOException if there is an underlying I/O problem. - */ - public T getObject() - throws IOException - { - T result = null; - - if( this.object != null ) - { - result = this.object; - } - else if( this.representation != null ) - { - result = stateSerialization.deserialize( module, objectClass, - new InputStreamReader( this.representation.getStream() ) ); - } - return result; - } - - /** - * Returns the object class to instantiate. - * - * @return The object class to instantiate. - */ - public Class<T> getObjectClass() - { - return objectClass; - } - - @Override - public void write( OutputStream outputStream ) - throws IOException - { - if( representation != null ) - { - representation.write( outputStream ); - } - else if( object instanceof StatusInfo ) - { - outputStream.write(((StatusInfo) object).getReasonPhrase().getBytes()); - } - else if( object != null ) - { - stateSerialization.serialize( Serializer.Options.NO_TYPE_INFO, outputStream, object ); - outputStream.write( '\n' ); - } - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/PolygeneConverter.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/PolygeneConverter.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/PolygeneConverter.java deleted file mode 100644 index 5f88257..0000000 --- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/PolygeneConverter.java +++ /dev/null @@ -1,263 +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.library.restlet.serialization; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import org.apache.polygene.api.object.ObjectFactory; -import org.restlet.data.MediaType; -import org.restlet.data.Preference; -import org.restlet.engine.converter.ConverterHelper; -import org.restlet.engine.resource.VariantInfo; -import org.restlet.representation.Representation; -import org.restlet.representation.Variant; -import org.restlet.resource.Resource; - -/** - * Converter between Apache Polygene and JSON. - */ -public class PolygeneConverter extends ConverterHelper -{ - /** - * Variant with media type application/json. - */ - private static final VariantInfo VARIANT_JSON = new VariantInfo( MediaType.APPLICATION_JSON ); - private static final VariantInfo VARIANT_WWW_FORM_URLENCODED = new VariantInfo( MediaType.APPLICATION_WWW_FORM ); - - private final ObjectFactory objectFactory; - - public PolygeneConverter( ObjectFactory objectFactory ) - { - this.objectFactory = objectFactory; - } - - /** - * Creates the marshaling {@link JsonRepresentation}. - * - * @param mediaType The target media type. - * @param source The source object to marshal. - * - * @return The marshaling {@link JsonRepresentation}. - */ - protected <T> Representation create( MediaType mediaType, T source ) - { - //noinspection unchecked - return objectFactory.newObject( JsonRepresentation.class, source ); - } - - /** - * Creates the unmarshaling {@link JsonRepresentation}. - * - * @param source The source representation to unmarshal. - * @param objectClass The object class to instantiate. - * - * @return The unmarshaling {@link JsonRepresentation}. - */ - protected <T> Representation create( Representation source, Class<T> objectClass ) - { - if( VARIANT_WWW_FORM_URLENCODED.isCompatible( source ) ) - { - return objectFactory.newObject( FormRepresentation.class, source, objectClass ); - } - else if( VARIANT_JSON.isCompatible( source ) ) - { - //noinspection unchecked - return objectFactory.newObject( JsonRepresentation.class, source, objectClass ); - } - return null; - } - - public ObjectFactory getObjectFactory() - { - return objectFactory; - } - - @Override - public List<Class<?>> getObjectClasses( Variant source ) - { - List<Class<?>> result = new ArrayList<>(); - - if( isCompatible( source ) ) - { - result = addObjectClass( result, Object.class ); - result = addObjectClass( result, JsonRepresentation.class ); - } - - return result; - } - - @Override - public List<VariantInfo> getVariants( Class<?> source ) - { - List<VariantInfo> result = new ArrayList<>(); - - if( source != null ) - { - result = addVariant( result, VARIANT_JSON ); - result = addVariant( result, VARIANT_WWW_FORM_URLENCODED ); - } - - return result; - } - - /** - * Indicates if the given variant is compatible with the media types - * supported by this converter. - * - * @param variant The variant. - * - * @return True if the given variant is compatible with the media types - * supported by this converter. - */ - protected boolean isCompatible( Variant variant ) - { - //noinspection SimplifiableIfStatement - if( variant == null ) - { - return false; - } - - return VARIANT_JSON.isCompatible( variant ) || - VARIANT_WWW_FORM_URLENCODED.isCompatible( variant ) - ; - } - - @Override - public float score( Object source, Variant target, Resource resource ) - { - float result; - - if( source instanceof JsonRepresentation<?> ) - { - result = 1.0F; - } - else - { - if( target == null ) - { - result = 0.5F; - } - else if( isCompatible( target ) ) - { - result = 0.8F; - } - else - { - result = 0.5F; - } - } - - return result; - } - - @Override - public <T> float score( Representation source, Class<T> target, - Resource resource - ) - { - float result = -1.0F; - - if( source instanceof JsonRepresentation<?> ) - { - result = 1.0F; - } - else if( ( target != null ) - && JsonRepresentation.class.isAssignableFrom( target ) ) - { - result = 1.0F; - } - else if( isCompatible( source ) ) - { - result = 0.8F; - } - - return result; - } - - @SuppressWarnings( "unchecked" ) - @Override - public <T> T toObject( Representation source, Class<T> target, Resource resources ) - throws IOException - { - Object result = null; - - Representation representation = null; - if( isCompatible( source ) ) - { - representation = create( source, target ); - } - - if( representation != null ) - { - // Handle the conversion - if( ( target != null ) - && JsonRepresentation.class.isAssignableFrom( target ) ) - { - result = representation; - } - else - { - if( representation instanceof JsonRepresentation ) - { - result = ( (JsonRepresentation) representation ).getObject(); - } - if( representation instanceof FormRepresentation ) - { - result = ( (FormRepresentation) representation ).getObject(); - } - } - } - - return (T) result; - } - - @Override - public Representation toRepresentation( Object source, Variant target, Resource resource ) - { - Representation result = null; - - if( source instanceof JsonRepresentation ) - { - result = (JsonRepresentation<?>) source; - } - else - { - if( target.getMediaType() == null ) - { - target.setMediaType( MediaType.APPLICATION_JSON ); - } - if( isCompatible( target ) ) - { - result = create( target.getMediaType(), source ); - } - } - - return result; - } - - @Override - public <T> void updatePreferences( List<Preference<MediaType>> preferences, - Class<T> entity - ) - { - updatePreferences( preferences, MediaType.APPLICATION_JSON, 1.0F ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/main/resources/META_INF/services/org.restlet.engine.converter.ConverterHelper ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/main/resources/META_INF/services/org.restlet.engine.converter.ConverterHelper b/libraries/restlet/src/main/resources/META_INF/services/org.restlet.engine.converter.ConverterHelper deleted file mode 100644 index 3a8c7cf..0000000 --- a/libraries/restlet/src/main/resources/META_INF/services/org.restlet.engine.converter.ConverterHelper +++ /dev/null @@ -1,16 +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. - -org.apache.polygene.library.restlet.PolygeneConverter http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/Customer.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/Customer.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/Customer.java deleted file mode 100644 index 4245856..0000000 --- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/Customer.java +++ /dev/null @@ -1,27 +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.library.restlet; - -import org.apache.polygene.api.identity.HasIdentity; - -public interface Customer extends HasIdentity -{ -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/Order.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/Order.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/Order.java deleted file mode 100644 index d37ff5e..0000000 --- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/Order.java +++ /dev/null @@ -1,27 +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.library.restlet; - -import org.apache.polygene.api.identity.HasIdentity; - -public interface Order extends HasIdentity -{ -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/Product.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/Product.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/Product.java deleted file mode 100644 index 91078d0..0000000 --- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/Product.java +++ /dev/null @@ -1,27 +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.library.restlet; - -import org.apache.polygene.api.identity.HasIdentity; - -public interface Product extends HasIdentity -{ -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/TestApplication.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/TestApplication.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/TestApplication.java deleted file mode 100644 index 51d56b4..0000000 --- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/TestApplication.java +++ /dev/null @@ -1,83 +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.library.restlet; - -import java.util.stream.Stream; -import org.apache.polygene.api.common.Visibility; -import org.apache.polygene.api.composite.ModelDescriptor; -import org.apache.polygene.api.structure.Application; -import org.apache.polygene.api.structure.Layer; -import org.apache.polygene.api.structure.ModuleDescriptor; -import org.apache.polygene.api.structure.TypeLookup; -import org.apache.polygene.bootstrap.LayerAssembly; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.library.restlet.assembly.RestApplicationAssembler; -import org.apache.polygene.library.restlet.assembly.configuration.ConfigurationModule; -import org.apache.polygene.library.restlet.assembly.configuration.ConfigurationLayer; -import org.apache.polygene.library.restlet.assembly.connectivity.ConnectivityLayer; -import org.apache.polygene.library.restlet.assembly.domain.DomainLayer; -import org.apache.polygene.library.restlet.assembly.infrastructue.FileStorageModule; -import org.apache.polygene.library.restlet.assembly.infrastructue.InfrastructureLayer; -import org.apache.polygene.library.restlet.assembly.resource.ResourceLayer; - -import static java.util.stream.Stream.concat; - -// START SNIPPET: app -public class TestApplication -{ - private static final String NAME = "Test Application"; - private static final String VERSION = "1.0"; - private static final Application.Mode MODE = Application.Mode.development; - - // END SNIPPET: app - - public static void main( String[] args ) - throws Exception - { - RestApplicationAssembler assembler = new RestApplicationAssembler( NAME, VERSION, MODE, - ConfigurationLayer.class, - InfrastructureLayer.class, - DomainLayer.class, - ResourceLayer.class, - ConnectivityLayer.class - ); - - assembler.initialize(); - assembler.application() - .layers() - .peek( layer -> System.out.println( layer + " uses " + layer.descriptor().usedLayers().toString() ) ) - .flatMap( Layer::modules ) - .peek( module -> System.out.println( " " + module ) ) - .flatMap( module -> { - TypeLookup lookup = module.typeLookup(); - ModuleDescriptor model = module.descriptor(); - return concat( concat( lookup.allServices().filter( service -> model.equals( service.module() ) ), - lookup.allEntities().filter( service -> model.equals( service.module() ) ) ), - lookup.allValues().filter( service -> model.equals( service.module() ) ) ); - } ) - .forEach( composite -> System.out.println( " " + composite + ", visibility:" + composite.visibility().name() ) ); - - assembler.start(); - assembler.addShutdownHook(); - } - // START SNIPPET: app -} -// END SNIPPET: app http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/RestApplicationAssembler.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/RestApplicationAssembler.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/RestApplicationAssembler.java deleted file mode 100644 index e0a46d8..0000000 --- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/RestApplicationAssembler.java +++ /dev/null @@ -1,81 +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.library.restlet.assembly; - -import java.util.LinkedHashMap; -import java.util.function.BinaryOperator; -import org.apache.polygene.api.activation.PassivationException; -import org.apache.polygene.api.structure.Application; -import org.apache.polygene.bootstrap.ApplicationAssembly; -import org.apache.polygene.bootstrap.AssemblyException; -import org.apache.polygene.bootstrap.LayerAssembly; -import org.apache.polygene.bootstrap.layered.LayerAssembler; -import org.apache.polygene.bootstrap.layered.LayeredApplicationAssembler; -import org.apache.polygene.bootstrap.layered.ModuleAssembler; - -public class RestApplicationAssembler extends LayeredApplicationAssembler -{ - private final LinkedHashMap<Class<? extends LayerAssembler>, LayerAssembly> assemblies = new LinkedHashMap<>(); - private Class<? extends LayerAssembler>[] layers; - - @SafeVarargs - public RestApplicationAssembler( String name, String version, Application.Mode mode, Class<? extends LayerAssembler>... layers ) - throws AssemblyException - { - super( name, version, mode ); - this.layers = layers; - } - - @Override - protected void assembleLayers( ApplicationAssembly assembly ) - { - LayerAssembly layerBelow = null; - for( Class<? extends LayerAssembler> layer : layers ) - { - LayerAssembly layerAssembly = createLayer( layer ); - assemblies.put( layer, layerAssembly ); - if( layerBelow != null ) - { - layerAssembly.uses( layerBelow ); - } - layerBelow = layerAssembly; - } - } - - public LayerAssembly layer( Class<? extends LayerAssembler> layerClass ) - { - return assemblies.get( layerClass ); - } - - public void addShutdownHook() - { - Runtime.getRuntime().addShutdownHook( new Thread( () -> { - try - { - stop(); - } - catch( PassivationException e ) - { - e.printStackTrace(); - } - } ) ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationLayer.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationLayer.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationLayer.java deleted file mode 100644 index e615347..0000000 --- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationLayer.java +++ /dev/null @@ -1,45 +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.library.restlet.assembly.configuration; - -import org.apache.polygene.bootstrap.LayerAssembly; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.bootstrap.layered.LayerAssembler; -import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler; - -public class ConfigurationLayer extends LayeredLayerAssembler - implements LayerAssembler -{ - public static final String NAME = "Configuration Layer"; - private ModuleAssembly configModule; - - @Override - public LayerAssembly assemble( LayerAssembly layer ) - { - configModule = createModule( layer, ConfigurationModule.class ); - return layer; - } - - public ModuleAssembly configModule() - { - return configModule; - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationModule.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationModule.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationModule.java deleted file mode 100644 index 48ce3a9..0000000 --- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationModule.java +++ /dev/null @@ -1,40 +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.library.restlet.assembly.configuration; - -import org.apache.polygene.api.common.Visibility; -import org.apache.polygene.bootstrap.LayerAssembly; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.bootstrap.layered.ModuleAssembler; -import org.apache.polygene.entitystore.memory.MemoryEntityStoreService; - -public class ConfigurationModule - implements ModuleAssembler -{ - public static final String NAME = "Configuration Module"; - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - { - module.services( MemoryEntityStoreService.class ).visibleIn( Visibility.layer ); - return module; - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/ConnectivityLayer.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/ConnectivityLayer.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/ConnectivityLayer.java deleted file mode 100644 index c0d45dc..0000000 --- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/ConnectivityLayer.java +++ /dev/null @@ -1,39 +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.library.restlet.assembly.connectivity; - -import org.apache.polygene.bootstrap.LayerAssembly; -import org.apache.polygene.bootstrap.layered.LayerAssembler; -import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler; - -public class ConnectivityLayer extends LayeredLayerAssembler - implements LayerAssembler -{ - public static final String NAME = "Connectivity Layer"; - - @Override - public LayerAssembly assemble( LayerAssembly layer ) - { - createModule( layer, RestModule.class ); - createModule( layer, SecurityModule.class ); - return layer; - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/RestModule.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/RestModule.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/RestModule.java deleted file mode 100644 index 29349f5..0000000 --- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/RestModule.java +++ /dev/null @@ -1,40 +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.library.restlet.assembly.connectivity; - -import org.apache.polygene.bootstrap.LayerAssembly; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.bootstrap.layered.ModuleAssembler; -import org.apache.polygene.library.restlet.assembly.RestletCrudConnectivityAssembler; -import org.apache.polygene.library.restlet.resource.EntryPoint; - -public class RestModule - implements ModuleAssembler -{ - public static final String NAME = "REST Module"; - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - { - new RestletCrudConnectivityAssembler().assemble( module ); - module.values( EntryPoint.class ); - return module; - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/SecurityModule.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/SecurityModule.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/SecurityModule.java deleted file mode 100644 index 02ca63f..0000000 --- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/SecurityModule.java +++ /dev/null @@ -1,35 +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.library.restlet.assembly.connectivity; - -import org.apache.polygene.bootstrap.LayerAssembly; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.bootstrap.layered.ModuleAssembler; - -public class SecurityModule - implements ModuleAssembler -{ - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - { - return module; - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/CrudModule.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/CrudModule.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/CrudModule.java deleted file mode 100644 index 8e79c0a..0000000 --- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/CrudModule.java +++ /dev/null @@ -1,39 +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.library.restlet.assembly.domain; - -import org.apache.polygene.bootstrap.LayerAssembly; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.bootstrap.layered.ModuleAssembler; -import org.apache.polygene.library.restlet.assembly.CrudServiceAssembler; - -public class CrudModule - implements ModuleAssembler -{ - public static final String NAME = "CRUD Module"; - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - { - module.defaultServices(); - new CrudServiceAssembler().assemble( module ); - return module; - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/DomainLayer.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/DomainLayer.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/DomainLayer.java deleted file mode 100644 index 19bf91d..0000000 --- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/DomainLayer.java +++ /dev/null @@ -1,38 +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.library.restlet.assembly.domain; - -import org.apache.polygene.bootstrap.LayerAssembly; -import org.apache.polygene.bootstrap.layered.LayerAssembler; -import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler; - -public class DomainLayer extends LayeredLayerAssembler - implements LayerAssembler -{ - public static final String NAME = "Domain Layer"; - - @Override - public LayerAssembly assemble( LayerAssembly layer ) - { - createModule( layer, CrudModule.class ); - createModule( layer, OrdersModule.class ); - return layer; - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/OrdersModule.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/OrdersModule.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/OrdersModule.java deleted file mode 100644 index 6bbd79f..0000000 --- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/OrdersModule.java +++ /dev/null @@ -1,44 +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.library.restlet.assembly.domain; - -import org.apache.polygene.bootstrap.AssemblyException; -import org.apache.polygene.bootstrap.LayerAssembly; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.bootstrap.layered.ModuleAssembler; -import org.apache.polygene.library.restlet.Customer; -import org.apache.polygene.library.restlet.Order; -import org.apache.polygene.library.restlet.Product; -import org.apache.polygene.library.restlet.assembly.RestletCrudModuleAssembler; - -public class OrdersModule - implements ModuleAssembler -{ - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - throws AssemblyException - { - new RestletCrudModuleAssembler( Order.class ).assemble( module ); - new RestletCrudModuleAssembler( Customer.class ).assemble( module ); - new RestletCrudModuleAssembler( Product.class ).assemble( module ); - return module; - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/FileStorageModule.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/FileStorageModule.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/FileStorageModule.java deleted file mode 100644 index a1ac266..0000000 --- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/FileStorageModule.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.library.restlet.assembly.infrastructue; - -import org.apache.polygene.api.common.Visibility; -import org.apache.polygene.bootstrap.LayerAssembly; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.bootstrap.layered.ModuleAssembler; -import org.apache.polygene.entitystore.file.assembly.FileEntityStoreAssembler; - -public class FileStorageModule - implements ModuleAssembler -{ - public static final String NAME = "Storage Module"; - - private final ModuleAssembly configModule; - - public FileStorageModule( ModuleAssembly configModule ) - { - this.configModule = configModule; - } - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - { - module.defaultServices().visibleIn( Visibility.layer ); - new FileEntityStoreAssembler() - .visibleIn( Visibility.application ) - .withConfig( configModule, Visibility.application ) - .assemble( module ); - return module; - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/IndexingModule.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/IndexingModule.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/IndexingModule.java deleted file mode 100644 index 72997f1..0000000 --- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/IndexingModule.java +++ /dev/null @@ -1,49 +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.library.restlet.assembly.infrastructue; - -import org.apache.polygene.api.common.Visibility; -import org.apache.polygene.bootstrap.LayerAssembly; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.bootstrap.layered.ModuleAssembler; -import org.apache.polygene.index.rdf.assembly.RdfNativeSesameStoreAssembler; -import org.apache.polygene.library.rdf.repository.NativeConfiguration; - -public class IndexingModule - implements ModuleAssembler -{ - public static final String NAME = "Indexing Module"; - private final ModuleAssembly configModule; - - public IndexingModule( ModuleAssembly configModule ) - { - this.configModule = configModule; - } - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - { - new RdfNativeSesameStoreAssembler(Visibility.application, Visibility.module) - .withConfig( configModule, Visibility.application ) - .assemble( module ); - return module; - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/InfrastructureLayer.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/InfrastructureLayer.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/InfrastructureLayer.java deleted file mode 100644 index ac6375f..0000000 --- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/InfrastructureLayer.java +++ /dev/null @@ -1,55 +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.library.restlet.assembly.infrastructue; - -import org.apache.polygene.bootstrap.LayerAssembly; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.bootstrap.layered.LayerAssembler; -import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler; -import org.apache.polygene.library.restlet.assembly.configuration.ConfigurationLayer; -import org.apache.polygene.library.restlet.assembly.configuration.ConfigurationModule; - -public class InfrastructureLayer extends LayeredLayerAssembler - implements LayerAssembler -{ - public static final String NAME = "Infrastructure Layer"; - private final ModuleAssembly configModule; - - public static InfrastructureLayer create( LayerAssembly layer ) - { - ModuleAssembly config = layer.application().layer( ConfigurationLayer.NAME ).module( ConfigurationModule.NAME ); - return new InfrastructureLayer( config ); - } - - private InfrastructureLayer( ModuleAssembly configModule ) - { - this.configModule = configModule; - } - - @Override - public LayerAssembly assemble( LayerAssembly layer ) - { - new FileStorageModule( configModule ).assemble( layer, layer.module( FileStorageModule.NAME ) ); - new IndexingModule( configModule ).assemble( layer, layer.module( IndexingModule.NAME ) ); - new SerializationModule().assemble( layer, layer.module( SerializationModule.NAME ) ); - return layer; - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java deleted file mode 100644 index 85bb76d..0000000 --- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java +++ /dev/null @@ -1,37 +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.library.restlet.assembly.infrastructue; - -import org.apache.polygene.bootstrap.LayerAssembly; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.bootstrap.layered.ModuleAssembler; - -public class SerializationModule - implements ModuleAssembler -{ - public static final String NAME = "Serialization Module"; - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - { - return module; - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/resource/ResourceLayer.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/resource/ResourceLayer.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/resource/ResourceLayer.java deleted file mode 100644 index a209315..0000000 --- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/resource/ResourceLayer.java +++ /dev/null @@ -1,37 +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.library.restlet.assembly.resource; - -import org.apache.polygene.bootstrap.LayerAssembly; -import org.apache.polygene.bootstrap.layered.LayerAssembler; -import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler; - -public class ResourceLayer extends LayeredLayerAssembler - implements LayerAssembler -{ - public static final String NAME = "Resource Layer"; - - @Override - public LayerAssembly assemble( LayerAssembly layer ) - { - return layer; - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3a26d21d/settings.gradle ---------------------------------------------------------------------- diff --git a/settings.gradle b/settings.gradle index d9704ff..e410c6a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -40,7 +40,6 @@ include 'core:api', 'libraries:rest-client', 'libraries:rest-common', 'libraries:rest-server', - 'libraries:restlet', 'libraries:scripting', 'libraries:servlet', 'libraries:shiro-core',
