You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2016/12/17 10:28:13 UTC
[37/81] [abbrv] [partial] zest-java git commit: ZEST-195 ;
Replace all "zest" with "polygene"
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/value/ValueDeserializer.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/value/ValueDeserializer.java b/core/api/src/main/java/org/apache/polygene/api/value/ValueDeserializer.java
new file mode 100644
index 0000000..5f2628c
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/value/ValueDeserializer.java
@@ -0,0 +1,166 @@
+/*
+ * 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.api.value;
+
+import java.io.InputStream;
+import java.util.function.Function;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.type.ValueType;
+
+/**
+ * Use a ValueDeserializer to create new values instances from serialized state.
+ *
+ * <p>
+ * Serialized state must be one of:
+ * </p>
+ * <ul>
+ * <li>a ValueComposite,</li>
+ * <li>an EntityReference,</li>
+ * <li>a Collection,</li>
+ * <li>a Map,</li>
+ * <li>a Plain Value.</li>
+ * </ul>
+ * <p>
+ * Nested plain values, EntityReferences, Collections, Maps, ValueComposites are supported.
+ * EntityReferences are deserialized as their reference string.
+ * </p>
+ * <p>
+ * Plain values can be one of:
+ * </p>
+ * <ul>
+ * <li>String,</li>
+ * <li>Character or char,</li>
+ * <li>Boolean or boolean,</li>
+ * <li>Integer or int,</li>
+ * <li>Long or long,</li>
+ * <li>Short or short,</li>
+ * <li>Byte or byte,</li>
+ * <li>Float or float,</li>
+ * <li>Double or double,</li>
+ * <li>BigInteger,</li>
+ * <li>BigDecimal,</li>
+ * <li>Date,</li>
+ * <li>DateTime (JodaTime),</li>
+ * <li>LocalDateTime (JodaTime),</li>
+ * <li>LocalDate (JodaTime).</li>
+ * </ul>
+ * <p>
+ * Values of unknown types and all arrays are considered as {@link java.io.Serializable} and by so are deserialized
+ * from base64 encoded bytes using pure Java serialization. If it happens that the input is invalid, a
+ * ValueSerializationException is thrown.
+ * </p>
+ * <p>
+ * Having type information in the serialized payload allows to keep actual ValueComposite types and by so
+ * circumvent {@link org.apache.polygene.api.composite.AmbiguousTypeException} when deserializing.
+ * </p>
+ */
+public interface ValueDeserializer
+{
+
+ /**
+ * Factory method for a typed deserialize function.
+ *
+ * <p>The returned Function may throw {@link ValueSerializationException}.</p>
+ *
+ * @param type the value type
+ * @param <T> the parametrized function return type
+ *
+ * @return a deserialization function
+ */
+ <T> Function<String, T> deserialize( ModuleDescriptor module, Class<T> type );
+
+ /**
+ * Factory method for a typed deserialize function.
+ *
+ * <p>The returned Function may throw {@link ValueSerializationException}.</p>
+ *
+ * @param valueType the value type
+ * @param <T> the parametrized function return type
+ *
+ * @return a deserialization function
+ */
+ <T> Function<String, T> deserialize( ModuleDescriptor module, ValueType valueType );
+
+ /**
+ * Factory method for an untyped deserialize function.
+ *
+ * <p>The returned Function may throw {@link ValueSerializationException}.</p>
+ *
+ * @param <T> the parametrized function return type
+ * @return a deserialization function
+ */
+// <T> BiFunction<ValueType, String, T> deserialize();
+
+ /**
+ * Deserialize a value from a state.
+ *
+ * @param <T> the parametrized returned type
+ * @param type the value type
+ * @param input the state
+ *
+ * @return the value
+ *
+ * @throws ValueSerializationException if the deserialization failed
+ */
+ <T> T deserialize( ModuleDescriptor module, Class<?> type, String input )
+ throws ValueSerializationException;
+
+ /**
+ * Deserialize a value from a state.
+ *
+ * @param <T> the parametrized returned type
+ * @param valueType the value type
+ * @param input the state
+ *
+ * @return the value
+ *
+ * @throws ValueSerializationException if the deserialization failed
+ */
+ <T> T deserialize( ModuleDescriptor module, ValueType valueType, String input )
+ throws ValueSerializationException;
+
+ /**
+ * Deserialize a value from a state.
+ *
+ * @param <T> the parametrized returned type
+ * @param type the value type
+ * @param input the state stream
+ *
+ * @return the value
+ *
+ * @throws ValueSerializationException if the deserialization failed
+ */
+ <T> T deserialize( ModuleDescriptor module, Class<?> type, InputStream input )
+ throws ValueSerializationException;
+
+ /**
+ * Deserialize a value from a state.
+ *
+ * @param <T> the parametrized returned type
+ * @param valueType the value type
+ * @param input the state stream
+ *
+ * @return the value
+ *
+ * @throws ValueSerializationException if the deserialization failed
+ */
+ <T> T deserialize( ModuleDescriptor module, ValueType valueType, InputStream input )
+ throws ValueSerializationException;
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/value/ValueSerialization.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/value/ValueSerialization.java b/core/api/src/main/java/org/apache/polygene/api/value/ValueSerialization.java
new file mode 100644
index 0000000..91c1081
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/value/ValueSerialization.java
@@ -0,0 +1,56 @@
+/*
+ * 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.api.value;
+
+/**
+ * ValueSerialization API.
+ *
+ * See {@link ValueSerializer} and {@link ValueDeserializer}.
+ */
+public interface ValueSerialization
+ extends ValueSerializer, ValueDeserializer
+{
+
+ /**
+ * Serialization format @Service tags.
+ *
+ * <p>
+ * ValueSerialization implementations should be tagged with theses at assembly time so that consumers can
+ * specify which format they need.
+ * </p>
+ */
+ interface Formats
+ {
+
+ /**
+ * Tag a ValueSerialization service that support the JSON format.
+ */
+ String JSON = "json";
+ /**
+ * Tag a ValueSerialization service that support the XML format.
+ */
+ String XML = "xml";
+ /**
+ * Tag a ValueSerialization service that support the YAML format.
+ */
+ String YAML = "yaml";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/value/ValueSerializationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/value/ValueSerializationException.java b/core/api/src/main/java/org/apache/polygene/api/value/ValueSerializationException.java
new file mode 100644
index 0000000..62faa75
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/value/ValueSerializationException.java
@@ -0,0 +1,50 @@
+/*
+ * 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.api.value;
+
+/**
+ * Thrown when an error occur during value state (de)serialization.
+ */
+public class ValueSerializationException
+ extends RuntimeException
+{
+
+ private static final long serialVersionUID = 1L;
+
+ public ValueSerializationException()
+ {
+ super();
+ }
+
+ public ValueSerializationException( String message )
+ {
+ super( message );
+ }
+
+ public ValueSerializationException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+ public ValueSerializationException( Throwable cause )
+ {
+ super( cause.getClass().getName() + ": " + cause.getMessage(), cause );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/value/ValueSerializer.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/value/ValueSerializer.java b/core/api/src/main/java/org/apache/polygene/api/value/ValueSerializer.java
new file mode 100644
index 0000000..f2c6138
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/value/ValueSerializer.java
@@ -0,0 +1,327 @@
+/*
+ * 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.api.value;
+
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Function;
+import org.apache.polygene.api.composite.AmbiguousTypeException;
+
+/**
+ * Use a ValueSerializer to serialize values state.
+ *
+ * <p>
+ * Serialized object must be one of:
+ * </p>
+ * <ul>
+ * <li>a ValueComposite,</li>
+ * <li>an EntityComposite or EntityReference,</li>
+ * <li>an Iterable,</li>
+ * <li>a Map,</li>
+ * <li>a Plain Value.</li>
+ * </ul>
+ * <p>
+ * Nested plain values, EntityReferences, Iterables, Maps, ValueComposites and EntityComposites are supported.
+ * EntityComposites and EntityReferences are serialized as their reference string.
+ * </p>
+ * <p>
+ * Plain values can be one of:
+ * </p>
+ * <ul>
+ * <li>String,</li>
+ * <li>Character or char,</li>
+ * <li>Boolean or boolean,</li>
+ * <li>Integer or int,</li>
+ * <li>Long or long,</li>
+ * <li>Short or short,</li>
+ * <li>Byte or byte,</li>
+ * <li>Float or float,</li>
+ * <li>Double or double,</li>
+ * <li>BigInteger,</li>
+ * <li>BigDecimal,</li>
+ * <li>Date,</li>
+ * <li>DateTime (JodaTime),</li>
+ * <li>LocalDateTime (JodaTime),</li>
+ * <li>LocalDate (JodaTime).</li>
+ * </ul>
+ * <p>
+ * Values of unknown types and all arrays are considered as {@link java.io.Serializable} and by so are serialized to
+ * base64 encoded bytes using pure Java serialization. If it happens that the value is not Serializable, a
+ * ValueSerializationException is thrown.
+ * </p>
+ * <p>
+ * Having type information in the serialized payload allows to keep actual ValueComposite types and by so
+ * circumvent {@link AmbiguousTypeException} when deserializing.
+ * </p>
+ */
+public interface ValueSerializer
+{
+
+ /**
+ * Factory method for a serialize function.
+ *
+ * @param <T> the parametrized function input type
+ * @return a serialization function.
+ */
+ <T> Function<T, String> serialize();
+
+ /**
+ * Factory method for a serialize function.
+ *
+ * @param <T> the parametrized function input type
+ * @param options ValueSerializer Options
+ * @return a serialization function.
+ */
+ <T> Function<T, String> serialize( Options options );
+
+ /**
+ * Factory method for a serialize function.
+ *
+ * @param <T> the parametrized function input type
+ * @param includeTypeInfo if type information should be included in the output
+ * @return a serialization function.
+ */
+ @Deprecated
+ <T> Function<T, String> serialize( boolean includeTypeInfo );
+
+ /**
+ * Serialize the state of a value with type information.
+ *
+ * @param object an Object to serialize
+ * @return the state
+ * @throws ValueSerializationException if the Value serialization failed
+ */
+ String serialize( Object object )
+ throws ValueSerializationException;
+
+ /**
+ * Serialize the state of a value.
+ *
+ * @param options ValueSerializer Options
+ * @param object an Object to serialize
+ * @return the state
+ * @throws ValueSerializationException if the Value serialization failed
+ */
+ String serialize( Options options, Object object )
+ throws ValueSerializationException;
+
+ /**
+ * Serialize the state of a value.
+ *
+ * @param object an Object to serialize
+ * @param includeTypeInfo if type information should be included in the output
+ * @return the state
+ * @throws ValueSerializationException if the Value serialization failed
+ */
+ @Deprecated
+ String serialize( Object object, boolean includeTypeInfo )
+ throws ValueSerializationException;
+
+ /**
+ * Serialize the state of a value with type information.
+ *
+ * @param object an Object to serialize
+ * @param output that will be used as output
+ * @throws ValueSerializationException if the Value serialization failed
+ */
+ void serialize( Object object, OutputStream output )
+ throws ValueSerializationException;
+
+ /**
+ * Serialize the state of a value.
+ *
+ * @param options ValueSerializer Options
+ * @param object an Object to serialize
+ * @param output that will be used as output
+ * @throws ValueSerializationException if the Value serialization failed
+ */
+ void serialize( Options options, Object object, OutputStream output )
+ throws ValueSerializationException;
+
+ /**
+ * Serialize the state of a value.
+ *
+ * @param object an Object to serialize
+ * @param output that will be used as output
+ * @param includeTypeInfo if type information should be included in the output
+ * @throws ValueSerializationException if the Value serialization failed
+ */
+ @Deprecated
+ void serialize( Object object, OutputStream output, boolean includeTypeInfo )
+ throws ValueSerializationException;
+
+ /**
+ * Serialization options.
+ */
+ final class Options
+ {
+ /**
+ * Boolean flag to include type information.
+ * Default to TRUE.
+ */
+ public static final String INCLUDE_TYPE_INFO = "includeTypeInfo";
+ public static final String MAP_ENTRIES_AS_OBJECTS = "mapentriesasobjects";
+ private final Map<String, String> options = new HashMap<>();
+
+ /**
+ * Create new default ValueSerializer Options.
+ */
+ public Options()
+ {
+ this.options.put( INCLUDE_TYPE_INFO, "true" );
+ this.options.put( MAP_ENTRIES_AS_OBJECTS, "false" );
+ }
+
+ /**
+ * Set {@link #INCLUDE_TYPE_INFO} option to TRUE.
+ * @return This
+ */
+ public Options withTypeInfo()
+ {
+ return put( INCLUDE_TYPE_INFO, true );
+ }
+
+ /**
+ * Set {@link #INCLUDE_TYPE_INFO} option to FALSE.
+ * @return This
+ */
+ public Options withoutTypeInfo()
+ {
+ return put( INCLUDE_TYPE_INFO, false );
+ }
+
+ public Options withMapEntriesAsObjects()
+ {
+ return put( MAP_ENTRIES_AS_OBJECTS, true );
+ }
+
+ public Options withMapEntriesAsKeyValuePairs()
+ {
+ return put( MAP_ENTRIES_AS_OBJECTS, false );
+ }
+
+ /**
+ * Get Boolean option value.
+ * @param option The option
+ * @return The boolean value of the option, or null if absent
+ */
+ public Boolean getBoolean( String option )
+ {
+ if( !options.containsKey( option ) )
+ {
+ return null;
+ }
+ return Boolean.valueOf( options.get( option ) );
+ }
+
+ /**
+ * Get Integer option value.
+ * @param option The option
+ * @return The integer value of the option, or null if absent
+ */
+ public Integer getInteger( String option )
+ {
+ if( !options.containsKey( option ) )
+ {
+ return null;
+ }
+ return Integer.valueOf( options.get( option ) );
+ }
+
+ /**
+ * Get String option value.
+ * @param option The option
+ * @return The string value of the option, or null if absent
+ */
+ public String getString( String option )
+ {
+ return options.get( option );
+ }
+
+ /**
+ * Put an option String value.
+ * @param option The option
+ * @param value The value
+ * @return This Options instance
+ */
+ public Options put( String option, String value )
+ {
+ if( value == null )
+ {
+ return remove( option );
+ }
+ options.put( option, value );
+ return this;
+ }
+
+ /**
+ * Put an option boolean value.
+ * @param option The option
+ * @param value The value
+ * @return This Options instance
+ */
+ public Options put( String option, Boolean value )
+ {
+ if( value == null )
+ {
+ return remove( option );
+ }
+ options.put( option, Boolean.toString( value ) );
+ return this;
+ }
+
+ /**
+ * Put an option Integer value.
+ * @param option The option
+ * @param value The value
+ * @return This Options instance
+ */
+ public Options put( String option, Integer value )
+ {
+ if( value == null )
+ {
+ return remove( option );
+ }
+ options.put( option, value.toString() );
+ return this;
+ }
+
+ /**
+ * Remove an option value.
+ * @param option The option
+ * @return This Options instance
+ */
+ public Options remove( String option )
+ {
+ options.remove( option );
+ return this;
+ }
+
+ /**
+ * Get all defined options as a Map.
+ * @return All defined options in a new Map
+ */
+ public Map<String, String> toMap()
+ {
+ return new HashMap<>( options );
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/value/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/value/package.html b/core/api/src/main/java/org/apache/polygene/api/value/package.html
new file mode 100644
index 0000000..def90fa
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/value/package.html
@@ -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.
+ ~
+ ~
+ -->
+<html>
+ <body>
+ <h2>Value API.</h2>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/ZestAPI.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/ZestAPI.java b/core/api/src/main/java/org/apache/zest/api/ZestAPI.java
deleted file mode 100644
index 953e4c5..0000000
--- a/core/api/src/main/java/org/apache/zest/api/ZestAPI.java
+++ /dev/null
@@ -1,188 +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.zest.api;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Proxy;
-import java.util.function.Function;
-import org.apache.zest.api.association.AbstractAssociation;
-import org.apache.zest.api.association.AssociationDescriptor;
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.composite.CompositeDescriptor;
-import org.apache.zest.api.composite.CompositeInstance;
-import org.apache.zest.api.composite.InvalidCompositeException;
-import org.apache.zest.api.composite.ModelDescriptor;
-import org.apache.zest.api.composite.TransientDescriptor;
-import org.apache.zest.api.entity.EntityDescriptor;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.property.PropertyDescriptor;
-import org.apache.zest.api.service.ServiceDescriptor;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.api.value.ValueDescriptor;
-
-/**
- * Encapsulation of the Polygene API.
- */
-public interface PolygeneAPI
-{
- /**
- * If a Modifier gets a reference to the Composite using @This,
- * then that reference must be dereferenced using this method
- * before handing it out for others to use.
- *
- * @param <T> Parameterized type of the Composite
- * @param composite instance reference injected in Modified using @This
- *
- * @return the dereferenced Composite
- */
- <T> T dereference( T composite );
-
- /**
- * Returns the Module or UnitOfWork where the Composite belongs.
- *
- * @param compositeOrUow The Composite (Service, Value, Entity or Transient) or UnitOfWork to lookup the Module it
- * belongs to.
- *
- * @return The Module instance where the Composite or UnitOfWork belongs to.
- */
- ModuleDescriptor moduleOf( Object compositeOrUow );
-
- /**
- * Returns the ModelDescriptor of the Composite.
- *
- * @param compositeOrServiceReference The Composite (Service, Value, Entity or Transient) for which to lookup the
- * ModelDescriptor
- *
- * @return The ModelDescriptor of the Composite
- */
- ModelDescriptor modelDescriptorFor( Object compositeOrServiceReference );
-
- /**
- * Returns the CompositeDescriptor of the Composite.
- *
- * @param compositeOrServiceReference The Composite (Service, Value, Entity or Transient) for which to lookup the
- * CompositeDescriptor
- *
- * @return The CompositeDescriptor of the Composite
- */
- CompositeDescriptor compositeDescriptorFor( Object compositeOrServiceReference );
-
- /**
- * Returns the TransientDescriptor of the TransientComposite.
- *
- * @param transsient The TransientComposite for which to lookup the TransientDescriptor
- *
- * @return The TransientDescriptor of the TransientComposite
- */
- TransientDescriptor transientDescriptorFor( Object transsient );
-
- /**
- * Returns the EntityDescriptor of the EntityComposite.
- *
- * @param entity The EntityComposite for which to lookup the EntityDescriptor
- *
- * @return The EntityDescriptor of the EntityComposite
- */
- EntityDescriptor entityDescriptorFor( Object entity );
-
- /**
- * Returns the ValueDescriptor of the ValueComposite.
- *
- * @param value The ValueComposite for which to lookup the ValueDescriptor
- *
- * @return The ValueDescriptor of the ValueComposite
- */
- ValueDescriptor valueDescriptorFor( Object value );
-
- /**
- * Returns the ServiceDescriptor of the ServiceComposite.
- *
- * @param service The ServiceComposite for which to lookup the ServiceDescriptor
- *
- * @return The ServiceDescriptor of the ServiceComposite
- */
- ServiceDescriptor serviceDescriptorFor( Object service );
-
- /**
- * Returns the PropertyDescriptor of the Property.
- *
- * @param property The Property for which to lookup the PropertyDescriptor
- *
- * @return The PropertyDescriptor of the Property
- */
- PropertyDescriptor propertyDescriptorFor( Property<?> property );
-
- /**
- * Returns the AssociationDescriptor of the Association.
- *
- * @param association The Association for which to lookup the AssociationDescriptor
- *
- * @return The AssociationDescriptor of the Association
- */
- AssociationDescriptor associationDescriptorFor( AbstractAssociation association );
-
- /**
- * Function that returns the CompositeDescriptor of a Composite.
- */
- Function<Composite, CompositeDescriptor> FUNCTION_DESCRIPTOR_FOR = composite -> {
- if( composite instanceof Proxy )
- {
- InvocationHandler invocationHandler = Proxy.getInvocationHandler( composite );
- return ( (CompositeInstance) invocationHandler ).descriptor();
- }
- try
- {
- Class<? extends Composite> compositeClass = composite.getClass();
- Field instanceField = compositeClass.getField( "_instance" );
- Object instance = instanceField.get( composite );
- return ( (CompositeInstance) instance ).descriptor();
- }
- catch( Exception e )
- {
- InvalidCompositeException exception = new InvalidCompositeException( "Could not get _instance field" );
- exception.initCause( e );
- throw exception;
- }
- };
-
- /**
- * Function that returns the CompositeInstance of a Composite.
- */
- Function<Composite, CompositeInstance> FUNCTION_COMPOSITE_INSTANCE_OF = composite -> {
- if( composite instanceof Proxy )
- {
- return ( (CompositeInstance) Proxy.getInvocationHandler( composite ) );
- }
- try
- {
- Class<? extends Composite> compositeClass = composite.getClass();
- Field instanceField = compositeClass.getField( "_instance" );
- Object instance = instanceField.get( composite );
- return (CompositeInstance) instance;
- }
- catch( Exception e )
- {
- InvalidCompositeException exception = new InvalidCompositeException( "Could not get _instance field" );
- exception.initCause( e );
- throw exception;
- }
- };
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/Activation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/Activation.java b/core/api/src/main/java/org/apache/zest/api/activation/Activation.java
deleted file mode 100644
index 3130421..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/Activation.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.zest.api.activation;
-
-/**
- * Interface used by Structure elements and Services that can be activated and passivated.
- * <p>Application and Layer expose this interface so you can activate and passivate them.</p>
- * <p>Module and ServiceComposite activation/passivation is handled by the Polygene runtime.</p>
- */
-@SuppressWarnings("JavaDoc")
-public interface Activation
-{
- /**
- * Activate.
- * <p>Fail fast execution order is:</p>
- * <ul>
- * <li>Fire {@link ActivationEvent.EventType#ACTIVATING}</li>
- * <li>Call {@link Activator#beforeActivation(java.lang.Object)} on each Activator</li>
- * <li>Call {@link #activate()} children</li>
- * <li>Call {@link Activator#afterActivation(java.lang.Object)} on each Activator</li>
- * <li>Fire {@link ActivationEvent.EventType#ACTIVATED}</li>
- * </ul>
- * <p>If an Exception is thrown, already activated nodes are passivated.</p>
- * @throws ActivationException with first Exception of activation plus the PassivationException if any
- */
- void activate()
- throws ActivationException;
-
- /**
- * Passivate.
- * <p>Fail safe execution order is:</p>
- * <ul>
- * <li>Fire {@link ActivationEvent.EventType#PASSIVATING}</li>
- * <li>Call {@link Activator#beforePassivation(java.lang.Object)} on each Activator</li>
- * <li>Call {@link #passivate()} children</li>
- * <li>Call {@link Activator#afterPassivation(java.lang.Object)} on each Activator</li>
- * <li>Fire {@link ActivationEvent.EventType#PASSIVATED}</li>
- * </ul>
- * @throws PassivationException after passivation with all Exceptions of passivation if any
- */
- void passivate()
- throws PassivationException;
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/ActivationEvent.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/ActivationEvent.java b/core/api/src/main/java/org/apache/zest/api/activation/ActivationEvent.java
deleted file mode 100644
index 344f720..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/ActivationEvent.java
+++ /dev/null
@@ -1,99 +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.zest.api.activation;
-
-import java.time.Instant;
-import org.apache.zest.api.time.SystemTime;
-
-/**
- * ActivationEvents are fired during activation and passivation of instances in Polygene.
- */
-public final class ActivationEvent
-{
- public enum EventType
- {
- ACTIVATING, ACTIVATED, PASSIVATING, PASSIVATED
- }
-
- private final Instant timestamp;
- private final Object source;
- private final EventType type;
-
- public ActivationEvent( Object source, EventType type )
- {
- this.timestamp = SystemTime.now();
- this.source = source;
- this.type = type;
- }
-
- /**
- * @return the source of the Activation event
- */
- public Object source()
- {
- return source;
- }
-
- /**
- * @return the type of the Activation event
- */
- public EventType type()
- {
- return type;
- }
-
-
- /**
- *
- * @return The instant that this event was created.
- */
- public Instant eventTime()
- {
- return timestamp;
- }
-
- /**
- * @return an informative message describing the event
- */
- public String message()
- {
- switch( type )
- {
- case ACTIVATING:
- return "Activating " + source;
- case ACTIVATED:
- return "Activated " + source;
- case PASSIVATING:
- return "Passivating " + source;
- case PASSIVATED:
- return "Passivated " + source;
- }
- return "";
- }
-
- /**
- * @see #message()
- */
- @Override
- public String toString()
- {
- return message() + "@" + timestamp;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/ActivationEventListener.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/ActivationEventListener.java b/core/api/src/main/java/org/apache/zest/api/activation/ActivationEventListener.java
deleted file mode 100644
index 53febcc..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/ActivationEventListener.java
+++ /dev/null
@@ -1,29 +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.zest.api.activation;
-
-/**
- * Listener for ActivationEvent events
- */
-public interface ActivationEventListener
-{
- void onEvent( ActivationEvent event )
- throws Exception;
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/ActivationEventListenerRegistration.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/ActivationEventListenerRegistration.java b/core/api/src/main/java/org/apache/zest/api/activation/ActivationEventListenerRegistration.java
deleted file mode 100644
index 7a13520..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/ActivationEventListenerRegistration.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.zest.api.activation;
-
-/**
- * Use this to register listeners for ActivationEvents.
- *
- * This is implemented by Application, Layer, Module, for example.
- */
-public interface ActivationEventListenerRegistration
-{
- /**
- * @param listener will be notified when Activation events occur
- */
- void registerActivationEventListener( ActivationEventListener listener );
-
- /**
- * @param listener will not be notified when Activation events occur anymore
- */
- void deregisterActivationEventListener( ActivationEventListener listener );
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/ActivationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/ActivationException.java b/core/api/src/main/java/org/apache/zest/api/activation/ActivationException.java
deleted file mode 100644
index 293f3cb..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/ActivationException.java
+++ /dev/null
@@ -1,32 +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.zest.api.activation;
-
-/**
- * Thrown when unable to activate.
- */
-public class ActivationException extends Exception
-{
- private static final long serialVersionUID = 1L;
- public ActivationException( String message, Throwable cause )
- {
- super( message, cause );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/Activator.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/Activator.java b/core/api/src/main/java/org/apache/zest/api/activation/Activator.java
deleted file mode 100644
index c2da2f2..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/Activator.java
+++ /dev/null
@@ -1,72 +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.zest.api.activation;
-
-/**
- * Assemble Activators to hook Services Activation.
- *
- * @param <ActivateeType> Type of the activatee.
- *
- * @see ActivatorAdapter
- * @see org.apache.zest.api.service.ServiceActivation
- */
-public interface Activator<ActivateeType>
-{
-
- /**
- * Called before activatee activation.
- *
- * @param activating The instance that is about to be activated.
- *
- * @throws Exception Allowed to throw Exception which will be wrapped in an ActivationException
- */
- void beforeActivation( ActivateeType activating )
- throws Exception;
-
- /**
- * Called after activatee activation.
- *
- * @param activated The instance that has just been activated.
- *
- * @throws Exception Allowed to throw Exception which will be wrapped in an ActivationException
- */
- void afterActivation( ActivateeType activated )
- throws Exception;
-
- /**
- * Called before activatee passivation.
- *
- * @param passivating The instance that is about to be passivated.
- *
- * @throws Exception Allowed to throw Exception which will be wrapped in an PassivationException
- */
- void beforePassivation( ActivateeType passivating )
- throws Exception;
-
- /**
- * Called after activatee passivation.
- *
- * @param passivated The instance that has just been passivated.
- *
- * @throws Exception Allowed to throw Exception which will be wrapped in an PassivationException
- */
- void afterPassivation( ActivateeType passivated )
- throws Exception;
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/ActivatorAdapter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/ActivatorAdapter.java b/core/api/src/main/java/org/apache/zest/api/activation/ActivatorAdapter.java
deleted file mode 100644
index 68baab6..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/ActivatorAdapter.java
+++ /dev/null
@@ -1,70 +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.zest.api.activation;
-
-/**
- * Adapter for Activator.
- * <p>If you are thinking about Service activation, see {@link org.apache.zest.api.service.ServiceActivatorAdapter}.</p>
- *
- * @param <ActivateeType> Type of the activatee.
- */
-public class ActivatorAdapter<ActivateeType>
- implements Activator<ActivateeType>
-{
- /**
- * Called before activatee activation.
- * @param activating Activating activatee
- */
- @Override
- public void beforeActivation( ActivateeType activating )
- throws Exception
- {
- }
-
- /**
- * Called after activatee activation.
- * @param activated Activating activatee
- */
- @Override
- public void afterActivation( ActivateeType activated )
- throws Exception
- {
- }
-
- /**
- * Called before activatee passivation.
- * @param passivating Passivating activatee
- */
- @Override
- public void beforePassivation( ActivateeType passivating )
- throws Exception
- {
- }
-
- /**
- * Called after activatee passivation.
- * @param passivated Passivated activatee
- */
- @Override
- public void afterPassivation( ActivateeType passivated )
- throws Exception
- {
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/ActivatorDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/ActivatorDescriptor.java b/core/api/src/main/java/org/apache/zest/api/activation/ActivatorDescriptor.java
deleted file mode 100644
index 7adcc30..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/ActivatorDescriptor.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.zest.api.activation;
-
-/**
- * Activator Descriptor.
- */
-public interface ActivatorDescriptor
-{
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/Activators.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/Activators.java b/core/api/src/main/java/org/apache/zest/api/activation/Activators.java
deleted file mode 100644
index 9b12f59..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/Activators.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.zest.api.activation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * This annotation is used in ServiceComposites to declare Activator implementation classes.
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( ElementType.TYPE )
-@Documented
-public @interface Activators
-{
-
- /**
- * @return Activator implementation classes.
- */
- Class<? extends Activator<?>>[] value();
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/ApplicationPassivationThread.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/ApplicationPassivationThread.java b/core/api/src/main/java/org/apache/zest/api/activation/ApplicationPassivationThread.java
deleted file mode 100644
index 0923e67..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/ApplicationPassivationThread.java
+++ /dev/null
@@ -1,114 +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.zest.api.activation;
-
-import java.io.PrintStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.apache.zest.api.structure.Application;
-
-/**
- * Application Passivation Thread to use as a Shutdown Hook.
- * <pre>Runtime.getRuntime().addShutdownHook( new ApplicationPassivationThread( application ) );</pre>
- */
-public final class ApplicationPassivationThread
- extends Thread
-{
- /**
- * Create a new Application Passivation Thread that output errors to STDERR.
- * @param application The Application to passivate
- */
- @SuppressWarnings("unused")
- public ApplicationPassivationThread(final Application application )
- {
- this( application, null, null );
- }
-
- /**
- * Create a new Application Passivation Thread that output errors to a Logger.
- * @param application The Application to passivate
- * @param logger Logger for errors
- */
- @SuppressWarnings("unused")
- public ApplicationPassivationThread(Application application, Logger logger )
- {
- this( application, null, logger );
- }
-
- /**
- * Create a new Application Passivation Thread that output errors to a PrintStream.
- * @param application The Application to passivate
- * @param output PrintStream for errors
- */
- public ApplicationPassivationThread( Application application, PrintStream output )
- {
- this( application, output, null );
- }
-
- private ApplicationPassivationThread( Application application, PrintStream output, Logger logger )
- {
- super( new ApplicationPassivation( application, output, logger ),
- application.name() + " Passivation Thread" );
- }
-
- private static class ApplicationPassivation
- implements Runnable
- {
-
- private final Application application;
- private final PrintStream output;
- private final Logger logger;
-
- private ApplicationPassivation( Application application, PrintStream output, Logger logger )
- {
- this.application = application;
- this.output = output;
- this.logger = logger;
- }
-
- @Override
- public void run()
- {
- try
- {
- application.passivate();
- }
- catch( PassivationException ex )
- {
- String message = application.name() + " " + ex.getMessage();
- if( logger != null )
- {
- logger.log( Level.SEVERE, message, ex );
- }
- else if( output != null )
- {
- output.println( message );
- ex.printStackTrace( output );
- }
- else
- {
- ex.printStackTrace();
- }
- }
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/PassivationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/PassivationException.java b/core/api/src/main/java/org/apache/zest/api/activation/PassivationException.java
deleted file mode 100644
index fd212da..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/PassivationException.java
+++ /dev/null
@@ -1,57 +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.zest.api.activation;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Thrown when unable to passivate.
- *
- * Printed StackTrace contains all causes in order as suppressed exceptions.
- */
-public final class PassivationException
- extends Exception
-{
-
- private static final long serialVersionUID = 1L;
- private final List<Exception> causes;
-
- /**
- * Create new PassivationException.
- * @param exceptions All exceptions encountered during passivation, in order
- */
- public PassivationException( Collection<Exception> exceptions )
- {
- super( "Passivation Exception - [has " + exceptions.size() + " cause(s)]" );
- exceptions.forEach( this::addSuppressed );
- this.causes = new ArrayList<>( exceptions );
- }
-
- /**
- * @return All exceptions encountered during passivation, in order
- */
- public List<Exception> causes()
- {
- return causes;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/package.html b/core/api/src/main/java/org/apache/zest/api/activation/package.html
deleted file mode 100644
index c11d85f..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/package.html
+++ /dev/null
@@ -1,29 +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>Activation API.</h2>
- <p>
- The Activation API package contains types used by client code to integrate with the Polygene\u2122 Runtime activation
- mechanism. In assembly, client code can easily listen to Structure (Application, Layers and Modules) and
- Services activation events, or, declare Structure and Service Activators.
- </p>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/AbstractAssociation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/AbstractAssociation.java b/core/api/src/main/java/org/apache/zest/api/association/AbstractAssociation.java
deleted file mode 100644
index 59e4347..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/AbstractAssociation.java
+++ /dev/null
@@ -1,28 +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.zest.api.association;
-
-/**
- * Base interface for all associations.
- */
-public interface AbstractAssociation
-{
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/Association.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/Association.java b/core/api/src/main/java/org/apache/zest/api/association/Association.java
deleted file mode 100644
index 5b5a62a..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/Association.java
+++ /dev/null
@@ -1,52 +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.zest.api.association;
-
-import org.apache.zest.api.entity.EntityReference;
-
-/**
- * Association to a single EntityComposite.
- */
-public interface Association<T> extends AbstractAssociation
-{
- /**
- * Get the associated entity.
- *
- * @return the associated entity
- */
- T get();
-
- /**
- * Set the associated entity.
- *
- * @param associated the entity
- *
- * @throws IllegalArgumentException thrown if the entity is not a valid reference for this association
- * @throws IllegalStateException thrown if association is immutable
- */
- void set( T associated )
- throws IllegalArgumentException, IllegalStateException;
-
- /**
- * @return the the reference of the associated entity.
- */
- EntityReference reference();
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/AssociationDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/AssociationDescriptor.java b/core/api/src/main/java/org/apache/zest/api/association/AssociationDescriptor.java
deleted file mode 100644
index 7eeb241..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/AssociationDescriptor.java
+++ /dev/null
@@ -1,69 +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.zest.api.association;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Type;
-import org.apache.zest.api.common.QualifiedName;
-import org.apache.zest.api.structure.MetaInfoHolder;
-
-/**
- * Association Descriptor.
- */
-public interface AssociationDescriptor extends MetaInfoHolder
-{
- /**
- * Get the qualified name of the association. This is constructed by
- * concatenating the name of the declaring interface with the name
- * of the method, using ":" as separator.
- * <p>
- * Example:
- * </p>
- * <p>
- * com.somecompany.MyInterface with association method
- * </p>
- * <pre><code>
- * Association<String> someAssociation();
- * </code></pre>
- * will have the qualified name:
- * <pre><code>
- * com.somecompany.MyInterface:someAssociation
- * </code></pre>
- *
- * @return the qualified name of the association
- */
- QualifiedName qualifiedName();
-
- /**
- * Get the type of the associated Entities
- *
- * @return the type of the associated Entities
- */
- Type type();
-
- boolean isImmutable();
-
- boolean isAggregated();
-
- AccessibleObject accessor();
-
- boolean queryable();
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/AssociationMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/AssociationMixin.java b/core/api/src/main/java/org/apache/zest/api/association/AssociationMixin.java
deleted file mode 100644
index 0cbd3da..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/AssociationMixin.java
+++ /dev/null
@@ -1,58 +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.zest.api.association;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import org.apache.zest.api.common.AppliesTo;
-import org.apache.zest.api.common.AppliesToFilter;
-import org.apache.zest.api.injection.scope.State;
-
-/**
- * Generic mixin for associations.
- */
-@AppliesTo( { AssociationMixin.AssociationFilter.class } )
-public final class AssociationMixin
- implements InvocationHandler
-{
- @State
- private AssociationStateHolder associations;
-
- @Override
- public Object invoke( Object proxy, Method method, Object[] args )
- throws Throwable
- {
- return associations.associationFor( method );
- }
-
- /**
- * Associations generic mixin AppliesToFilter.
- */
- static class AssociationFilter
- implements AppliesToFilter
- {
- @Override
- public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> modifierClass )
- {
- return Association.class.isAssignableFrom( method.getReturnType() );
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/AssociationStateDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/AssociationStateDescriptor.java b/core/api/src/main/java/org/apache/zest/api/association/AssociationStateDescriptor.java
deleted file mode 100644
index 2e9c522..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/AssociationStateDescriptor.java
+++ /dev/null
@@ -1,54 +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.zest.api.association;
-
-import java.util.stream.Stream;
-import org.apache.zest.api.common.QualifiedName;
-import org.apache.zest.api.composite.StateDescriptor;
-
-/**
- * Associations State Descriptor.
- */
-public interface AssociationStateDescriptor extends StateDescriptor
-{
- AssociationDescriptor getAssociationByName( String name )
- throws IllegalArgumentException;
-
- AssociationDescriptor getAssociationByQualifiedName( QualifiedName name )
- throws IllegalArgumentException;
-
- AssociationDescriptor getManyAssociationByName( String name )
- throws IllegalArgumentException;
-
- AssociationDescriptor getManyAssociationByQualifiedName( QualifiedName name )
- throws IllegalArgumentException;
-
- AssociationDescriptor getNamedAssociationByName( String name )
- throws IllegalArgumentException;
-
- AssociationDescriptor getNamedAssociationByQualifiedName( QualifiedName name )
- throws IllegalArgumentException;
-
- Stream<? extends AssociationDescriptor> associations();
-
- Stream<? extends AssociationDescriptor> manyAssociations();
-
- Stream<? extends AssociationDescriptor> namedAssociations();
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/AssociationStateHolder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/AssociationStateHolder.java b/core/api/src/main/java/org/apache/zest/api/association/AssociationStateHolder.java
deleted file mode 100644
index b2e999d..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/AssociationStateHolder.java
+++ /dev/null
@@ -1,79 +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.zest.api.association;
-
-import java.lang.reflect.AccessibleObject;
-import java.util.stream.Stream;
-import org.apache.zest.api.property.StateHolder;
-
-/**
- * This represents the state of a entity (properties+associations).
- */
-public interface AssociationStateHolder
- extends StateHolder
-{
- /**
- * Get an association for a specific accessor method.
- *
- * @param associationMethod for the association
- *
- * @return the association
- */
- <T> Association<T> associationFor( AccessibleObject associationMethod );
-
- /**
- * Get all associations.
- *
- * @return stream of associations
- */
- Stream<? extends Association<?>> allAssociations();
-
- /**
- * Get a many-association for a specific accessor method.
- *
- * @param manyassociationMethod for the many-association
- *
- * @return the association
- */
- <T> ManyAssociation<T> manyAssociationFor( AccessibleObject manyassociationMethod );
-
- /**
- * Get all ManyAssociations.
- *
- * @return stream of many-associations
- */
- Stream<? extends ManyAssociation<?>> allManyAssociations();
-
- /**
- * Get a named-association for a specific accessor method.
- *
- * @param namedassociationMethod for the named-association
- *
- * @return the association
- */
- <T> NamedAssociation<T> namedAssociationFor( AccessibleObject namedassociationMethod );
-
- /**
- * Get all named-associations.
- *
- * @return stream of named-associations
- */
- Stream<? extends NamedAssociation<?>> allNamedAssociations();
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/AssociationWrapper.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/AssociationWrapper.java b/core/api/src/main/java/org/apache/zest/api/association/AssociationWrapper.java
deleted file mode 100644
index b6b7e50..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/AssociationWrapper.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.zest.api.association;
-
-import org.apache.zest.api.entity.EntityReference;
-
-/**
- * If you want to catch getting and setting association, then create a GenericConcern
- * that wraps the Polygene-supplied Association instance with AssociationWrappers. Override
- * get() and/or set() to perform your custom code.
- */
-public class AssociationWrapper
- implements Association<Object>
-{
- protected Association<Object> next;
-
- public AssociationWrapper( Association<Object> next )
- {
- this.next = next;
- }
-
- public Association<Object> next()
- {
- return next;
- }
-
- @Override
- public Object get()
- {
- return next.get();
- }
-
- @Override
- public void set( Object associated )
- throws IllegalArgumentException
- {
- next.set( associated );
- }
-
- @Override
- public EntityReference reference()
- {
- return next.reference();
- }
-
- @Override
- public int hashCode()
- {
- return next.hashCode();
- }
-
- @Override
- @SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
- public boolean equals( Object obj )
- {
- return next.equals( obj );
- }
-
- @Override
- public String toString()
- {
- return next.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/GenericAssociationInfo.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/GenericAssociationInfo.java b/core/api/src/main/java/org/apache/zest/api/association/GenericAssociationInfo.java
deleted file mode 100644
index 2d53bc7..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/GenericAssociationInfo.java
+++ /dev/null
@@ -1,63 +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.zest.api.association;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-
-import static org.apache.zest.api.util.Classes.typeOf;
-
-/**
- * Generic Association info.
- */
-public final class GenericAssociationInfo
-{
- public static Type associationTypeOf( AccessibleObject accessor )
- {
- return toAssociationType( typeOf( accessor ) );
- }
-
- public static Type toAssociationType( Type methodReturnType )
- {
- if( methodReturnType instanceof ParameterizedType )
- {
- ParameterizedType parameterizedType = (ParameterizedType) methodReturnType;
- if( AbstractAssociation.class.isAssignableFrom( (Class<?>) parameterizedType.getRawType() ) )
- {
- return parameterizedType.getActualTypeArguments()[ 0 ];
- }
- }
- if (!(methodReturnType instanceof Class))
- {
- throw new IllegalArgumentException( "Unable to make an association with " + methodReturnType );
- }
- Type[] interfaces = ((Class<?>) methodReturnType).getGenericInterfaces();
- for (Type anInterface : interfaces)
- {
- Type associationType = toAssociationType(anInterface);
- if (associationType != null)
- {
- return associationType;
- }
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/ManyAssociation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/ManyAssociation.java b/core/api/src/main/java/org/apache/zest/api/association/ManyAssociation.java
deleted file mode 100644
index 0283d62..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/ManyAssociation.java
+++ /dev/null
@@ -1,58 +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.zest.api.association;
-
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Stream;
-import org.apache.zest.api.entity.EntityReference;
-
-/**
- * Association to a collection of entities.
- */
-public interface ManyAssociation<T> extends Iterable<T>, AbstractAssociation
-{
- /**
- * Returns the number of references in this association.
- * @return the number of references in this association.
- */
- int count();
-
- boolean contains( T entity );
-
- boolean add( int i, T entity );
-
- boolean add( T entity );
-
- boolean remove( T entity );
-
- T get( int i );
-
- List<T> toList();
-
- Set<T> toSet();
-
- /**
- * Returns a stream of the references to the associated entities.
- * @return the references to the associated entities.
- */
- Stream<EntityReference> references();
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/ManyAssociationMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/ManyAssociationMixin.java b/core/api/src/main/java/org/apache/zest/api/association/ManyAssociationMixin.java
deleted file mode 100644
index a948b55..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/ManyAssociationMixin.java
+++ /dev/null
@@ -1,58 +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.zest.api.association;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import org.apache.zest.api.common.AppliesTo;
-import org.apache.zest.api.common.AppliesToFilter;
-import org.apache.zest.api.injection.scope.State;
-
-/**
- * Generic mixin for associations.
- */
-@AppliesTo( { ManyAssociationMixin.AssociationFilter.class } )
-public final class ManyAssociationMixin
- implements InvocationHandler
-{
- @State
- private AssociationStateHolder associations;
-
- @Override
- public Object invoke( Object proxy, Method method, Object[] args )
- throws Throwable
- {
- return associations.manyAssociationFor( method );
- }
-
- /**
- * ManyAssociations generic mixin AppliesToFilter.
- */
- static class AssociationFilter
- implements AppliesToFilter
- {
- @Override
- public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> modifierClass )
- {
- return ManyAssociation.class.isAssignableFrom( method.getReturnType() );
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/ManyAssociationWrapper.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/ManyAssociationWrapper.java b/core/api/src/main/java/org/apache/zest/api/association/ManyAssociationWrapper.java
deleted file mode 100644
index b23aff9..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/ManyAssociationWrapper.java
+++ /dev/null
@@ -1,126 +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.zest.api.association;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Stream;
-import org.apache.zest.api.entity.EntityReference;
-
-/**
- * If you want to catch calls to ManyAssociations, then create a GenericConcern
- * that wraps the Polygene-supplied ManyAssociation instance with ManyAssociationWrappers. Override
- * methods to perform your custom code.
- */
-public class ManyAssociationWrapper
- implements ManyAssociation<Object>
-{
- protected ManyAssociation<Object> next;
-
- public ManyAssociationWrapper( ManyAssociation<Object> next )
- {
- this.next = next;
- }
-
- public ManyAssociation<Object> next()
- {
- return next;
- }
-
- @Override
- public int count()
- {
- return next.count();
- }
-
- @Override
- public boolean contains( Object entity )
- {
- return next.contains( entity );
- }
-
- @Override
- public boolean add( int i, Object entity )
- {
- return next.add( i, entity );
- }
-
- @Override
- public boolean add( Object entity )
- {
- return next.add( entity );
- }
-
- @Override
- public boolean remove( Object entity )
- {
- return next.remove( entity );
- }
-
- @Override
- public Object get( int i )
- {
- return next.get( i );
- }
-
- @Override
- public List<Object> toList()
- {
- return next.toList();
- }
-
- @Override
- public Set<Object> toSet()
- {
- return next.toSet();
- }
-
- @Override
- public Stream<EntityReference> references()
- {
- return next.references();
- }
-
- @Override
- public Iterator<Object> iterator()
- {
- return next.iterator();
- }
-
- @Override
- public int hashCode()
- {
- return next.hashCode();
- }
-
- @Override
- @SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
- public boolean equals( Object obj )
- {
- return next.equals( obj );
- }
-
- @Override
- public String toString()
- {
- return next.toString();
- }
-}