http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/metrics/MetricsProvider.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsProvider.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsProvider.java deleted file mode 100644 index 78ad9d8..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsProvider.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2012, Niclas Hedhman. All Rights Reserved. - * - * Licensed 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.metrics; - -/** - * Metrics Provider SPI. - * <p> - * The Zest Runtime will automatically ook for a service that implements the MetricsProvider interdace - * and use it for internal Runtime metrics, such as the UnitOfWork measuring the time from creation to close. - * </p> - * <p> - * The Metrics Library is available to add metric functionality to applications in the same way, and - * will use the same MetricsProvider. - * </p> - * <p> - * Note that the usual visibitlity rules applies, so you might have more than one MetricsProvider server, - * perhaps per layer. - * </p> - */ -public interface MetricsProvider -{ - /** - * Creates a new factory instance. - * - * The instanctiation is done by providing a Metric type, which is one of - * <ul> - * <li>{@link MetricsCounter}</li> - * <li>{@link MetricsGauge}</li> - * <li>{@link MetricsHealthCheck}</li> - * <li>{@link MetricsHistogram}</li> - * <li>{@link MetricsMeter}</li> - * <li>{@link MetricsTimer}</li> - * </ul> - * - * @param factoryType The class of the metric type needed. - * @param <T> The metric type requested. - * - * @return A factory instance - * - * @throws MetricsNotSupportedException when the MetricsProvider is not supporting the factory type requested. - */ - <T extends MetricsFactory> T createFactory( Class<T> factoryType ) - throws MetricsNotSupportedException; -}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimer.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimer.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimer.java deleted file mode 100644 index 2065e6a..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimer.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2012, Niclas Hedhman. All Rights Reserved. - * - * Licensed 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.metrics; - -/** - * Timer Metrics. - */ -public interface MetricsTimer extends Metric -{ - /** - * Start the Timer Metrics. - */ - Context start(); - - /** - * Timer Metrics Context. - */ - public interface Context - { - /** - * Stop the Timer Metrics. - */ - void stop(); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimerFactory.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimerFactory.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimerFactory.java deleted file mode 100644 index 74a7b7f..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimerFactory.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2012, Niclas Hedhman. All Rights Reserved. - * - * Licensed 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.metrics; - -import java.util.concurrent.TimeUnit; - -/** - * Create MetricsTimer instances. - */ -public interface MetricsTimerFactory extends MetricsFactory -{ - /** - * Create a MetricsTimer instance. - * If the same arguments are given twice, the same instance must be returned. - * - * @param origin The class that instantiate the metric - * @param name A human readable, short name of the metric. - * @param duration the scale unit for this timer's duration metrics - * @param rate the scale unit for this timer's rate metrics - * - * @return A Metric instance to be used, OR org.qi4j.spi.metrics.DefaultMetric.NULL if not supported. - * - */ - MetricsTimer createTimer( Class<?> origin, String name, TimeUnit duration, TimeUnit rate ); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/metrics/package.html ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/package.html b/core/api/src/main/java/org/apache/zest/api/metrics/package.html deleted file mode 100644 index d0280bd..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/package.html +++ /dev/null @@ -1,21 +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>Metrics API.</h2> - </body> -</html> http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/mixin/Initializable.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/Initializable.java b/core/api/src/main/java/org/apache/zest/api/mixin/Initializable.java deleted file mode 100644 index be551c2..0000000 --- a/core/api/src/main/java/org/apache/zest/api/mixin/Initializable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2008, Rickard Ãberg. All Rights Reserved. - * - * Licensed 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.mixin; - -/** - * Fragments which want to be initialized can implement - * this callback interface. It will be invoked after - * the fragment has bee instantiated and all injections have been done. - */ -public interface Initializable -{ - /** - * Initialize the fragment - * - * @throws org.apache.zest.api.mixin.InitializationException - * if something went wrong - */ - void initialize() - throws InitializationException; -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/mixin/InitializationException.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/InitializationException.java b/core/api/src/main/java/org/apache/zest/api/mixin/InitializationException.java deleted file mode 100644 index c46c3af..0000000 --- a/core/api/src/main/java/org/apache/zest/api/mixin/InitializationException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2007, Rickard Ãberg. All Rights Reserved. - * Copyright (c) 2007, Niclas Hedhman. All Rights Reserved. - * - * Licensed 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.mixin; - -/** - * Thrown when a Fragment or object could not be instantiated. - */ -public class InitializationException - extends RuntimeException -{ - private static final long serialVersionUID = 1L; - - public InitializationException() - { - } - - public InitializationException( String message ) - { - super( message ); - } - - public InitializationException( String message, Throwable cause ) - { - super( message, cause ); - } - - public InitializationException( Throwable cause ) - { - super( cause ); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/mixin/InvalidMixinException.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/InvalidMixinException.java b/core/api/src/main/java/org/apache/zest/api/mixin/InvalidMixinException.java deleted file mode 100644 index 10a3375..0000000 --- a/core/api/src/main/java/org/apache/zest/api/mixin/InvalidMixinException.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2009 Niclas Hedhman. - * - * Licensed 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.mixin; - -import java.lang.reflect.Method; - -/** - * This exception is thrown if a Mixin is invalid (missing method implementation). - */ -public class InvalidMixinException - extends RuntimeException -{ - public InvalidMixinException( Class mixinClass, Method method ) - { - super( mixinClass.getName() + "does not have a method implementation for " + method ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/mixin/MixinDescriptor.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/MixinDescriptor.java b/core/api/src/main/java/org/apache/zest/api/mixin/MixinDescriptor.java deleted file mode 100644 index 9ae3600..0000000 --- a/core/api/src/main/java/org/apache/zest/api/mixin/MixinDescriptor.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2008, Rickard Ãberg. All Rights Reserved. - * - * Licensed 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.mixin; - -/** - * Mixin Descriptor. - */ -public interface MixinDescriptor -{ - Class<?> mixinClass(); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/mixin/MixinMappingException.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/MixinMappingException.java b/core/api/src/main/java/org/apache/zest/api/mixin/MixinMappingException.java deleted file mode 100644 index 13692a1..0000000 --- a/core/api/src/main/java/org/apache/zest/api/mixin/MixinMappingException.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2008 Niclas Hedhman. All rights Reserved. - * - * Licensed 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.mixin; - -/** - * This Exception is thrown when it is not possible to map the MixinType to a valid - * CompositeType. - */ -public class MixinMappingException - extends RuntimeException -{ - private static final long serialVersionUID = 6843167709252705294L; - - public MixinMappingException( String message ) - { - super( message ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/mixin/Mixins.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/Mixins.java b/core/api/src/main/java/org/apache/zest/api/mixin/Mixins.java deleted file mode 100644 index 1573589..0000000 --- a/core/api/src/main/java/org/apache/zest/api/mixin/Mixins.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2007, Rickard Ãberg. All Rights Reserved. - * Copyright (c) 2007, Niclas Hedhman. All Rights Reserved. - * - * Licensed 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.mixin; - -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 composites to declare mixin implementation classes. - * <p> - * Mixins tells the runtime which implementation class of a Mixin should be - * used. The @Mixins annotation can occur at any level in the composite hierarchy - * and the runtime will match each found Mixin implementation against a Mixins annotation. - * All mixin interfaces must have a Mixin implementation in the composite hierarchy or - * a runtime exception will occur. - * </p> - * <p> - * Example; - * </p> - * <pre><code> - * - * @Mixins( MyBeerOrder.class ) - * public interface BeerOrderComposite extends BeerOrder, Composite - * { - * } - * - * public class MyBeerOrder - * implements BeerOrder - * { - * : - * } - * </code></pre> - * <p> - * Many implementations can be listed, - * </p> - * <pre><code> - * @Mixins( { MyBeerOrder.class, DescriptionImpl.class } ) - * public interface BeerOrderComposite extends BeerOrder, Description, Composite - * { - * } - * </code></pre> - * <p> - * If the Mixins is a class that implements InvocationHandler, it will be - * used for all mixins. To avoid that an invocation handler based implementation - * not service all mixin, use the AppliesTo annotation. - * </p> - * - * <p> - * It is valid to have multiple Mixins for a mixin. The first one found - * will be used. The search order is in the order they are written in the Mixins - * annotation left-to-right, and depth-first recursive search of the super-interfaces again - * left-to-right. - * </p> - * - * @see org.apache.zest.api.common.AppliesTo - */ -@Retention( RetentionPolicy.RUNTIME ) -@Target( ElementType.TYPE ) -@Documented -public @interface Mixins -{ - Class<?>[] value(); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/mixin/NoopMixin.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/NoopMixin.java b/core/api/src/main/java/org/apache/zest/api/mixin/NoopMixin.java deleted file mode 100644 index 86a8a26..0000000 --- a/core/api/src/main/java/org/apache/zest/api/mixin/NoopMixin.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2008, Rickard Ãberg. All Rights Reserved. - * - * Licensed 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.mixin; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; - -/** - * Generic mixin that is a no-op. Can be useful if the functionality - * of a method is mainly provided by concerns and side-effects. - */ -public final class NoopMixin - implements InvocationHandler -{ - private static final Boolean BOOLEAN_DEFAULT = Boolean.FALSE; - private static final Short SHORT_DEFAULT = 0; - private static final Character CHARACTER_DEFAULT = 0; - private static final Integer INTEGER_DEFAULT = 0; - private static final Long LONG_DEFAULT = 0L; - private static final Float FLOAT_DEFAULT = 0f; - private static final Double DOUBLE_DEFAULT = 0.0; - - @Override - public Object invoke( Object object, Method method, Object[] args ) - throws Throwable - { - Class<?> retType = method.getReturnType(); - if( !retType.isPrimitive() ) - { - return null; - } - if( Void.TYPE == retType ) - { - return null; - } - if( Boolean.TYPE == retType ) - { - return BOOLEAN_DEFAULT; - } - if( Short.TYPE == retType ) - { - return SHORT_DEFAULT; - } - if( Character.TYPE == retType ) - { - return CHARACTER_DEFAULT; - } - if( Integer.TYPE == retType ) - { - return INTEGER_DEFAULT; - } - if( Long.TYPE == retType ) - { - return LONG_DEFAULT; - } - if( Float.TYPE == retType ) - { - return FLOAT_DEFAULT; - } - if( Double.TYPE == retType ) - { - return DOUBLE_DEFAULT; - } - return null; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/mixin/package.html ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/package.html b/core/api/src/main/java/org/apache/zest/api/mixin/package.html deleted file mode 100644 index a0ebe07..0000000 --- a/core/api/src/main/java/org/apache/zest/api/mixin/package.html +++ /dev/null @@ -1,21 +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>Mixin API.</h2> - </body> -</html> http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/object/NoSuchObjectException.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/object/NoSuchObjectException.java b/core/api/src/main/java/org/apache/zest/api/object/NoSuchObjectException.java deleted file mode 100644 index 35e2655..0000000 --- a/core/api/src/main/java/org/apache/zest/api/object/NoSuchObjectException.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2008, Niclas Hedhman. All Rights Reserved. - * - * Licensed 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.object; - -import org.apache.zest.api.common.InvalidApplicationException; - -/** - * This exception is thrown if no visible Object of the requested type can be found. - */ -public class NoSuchObjectException - extends InvalidApplicationException -{ - private static final long serialVersionUID = -1121690536365682511L; - - private final String objectType; - private final String moduleName; - - public NoSuchObjectException( String type, String moduleName ) - { - super( "Could not find any visible Object of type [" + type + "] in module [" + - moduleName + "]." ); - this.objectType = type; - this.moduleName = moduleName; - } - - public String objectType() - { - return objectType; - } - - public String moduleName() - { - return moduleName; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/object/ObjectDescriptor.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/object/ObjectDescriptor.java b/core/api/src/main/java/org/apache/zest/api/object/ObjectDescriptor.java deleted file mode 100644 index 00c6363..0000000 --- a/core/api/src/main/java/org/apache/zest/api/object/ObjectDescriptor.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2007, Rickard Ãberg. All Rights Reserved. - * - * Licensed 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.object; - -import org.apache.zest.api.composite.ModelDescriptor; - -/** - * Object Descriptor. - */ -public interface ObjectDescriptor - extends ModelDescriptor -{ -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/object/ObjectFactory.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/object/ObjectFactory.java b/core/api/src/main/java/org/apache/zest/api/object/ObjectFactory.java deleted file mode 100644 index 23b95da..0000000 --- a/core/api/src/main/java/org/apache/zest/api/object/ObjectFactory.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2007, Rickard Ãberg. All Rights Reserved. - * Copyright (c) 2007, Niclas Hedhman. All Rights Reserved. - * - * Licensed 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.object; - -import org.apache.zest.api.common.ConstructionException; - -/** - * This factory creates and injects POJO's. - */ -public interface ObjectFactory -{ - /** - * Create new objects of the given type. - * - * @param type an object class which will be instantiated. - * - * @return new objects. - * - * @throws ConstructionException Thrown if instantiation fails. - * @throws NoSuchObjectException Thrown if {@code type} class is not an object. - */ - <T> T newObject( Class<T> type, Object... uses ) - throws NoSuchObjectException, ConstructionException; - - /** - * Inject an existing instance. Only fields and methods will be called. - * - * @param instance - * - * @throws ConstructionException - */ - void injectTo( Object instance, Object... uses ) - throws ConstructionException; -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/object/package.html ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/object/package.html b/core/api/src/main/java/org/apache/zest/api/object/package.html deleted file mode 100644 index 1e06504..0000000 --- a/core/api/src/main/java/org/apache/zest/api/object/package.html +++ /dev/null @@ -1,21 +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>Object API.</h2> - </body> -</html> http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/package.html ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/package.html b/core/api/src/main/java/org/apache/zest/api/package.html deleted file mode 100644 index ff7d9af..0000000 --- a/core/api/src/main/java/org/apache/zest/api/package.html +++ /dev/null @@ -1,21 +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>Apache Zest⢠API.</h2> - </body> -</html> http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/property/DefaultValues.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/DefaultValues.java b/core/api/src/main/java/org/apache/zest/api/property/DefaultValues.java deleted file mode 100644 index db6545e..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/DefaultValues.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2008, Michael Hunger. All Rights Reserved. - * - * Licensed 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.property; - -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; - -/** - * Default values for various property types - */ -public final class DefaultValues -{ - private static final Map<Type, Object> DEFAULT_VALUES = new HashMap<Type, Object>(); - - static - { - DEFAULT_VALUES.put( Byte.class, 0 ); - DEFAULT_VALUES.put( Short.class, 0 ); - DEFAULT_VALUES.put( Character.class, 0 ); - DEFAULT_VALUES.put( Integer.class, 0 ); - DEFAULT_VALUES.put( Long.class, 0L ); - DEFAULT_VALUES.put( Double.class, 0D ); - DEFAULT_VALUES.put( Float.class, 0F ); - DEFAULT_VALUES.put( Boolean.class, false ); - DEFAULT_VALUES.put( String.class, "" ); - } - - public static Object getDefaultValueOf( Type type ) - { - Object value = DEFAULT_VALUES.get( type ); - if( value != null ) - { - return value; - } - if( type instanceof ParameterizedType ) - { - // List<Foo> -> List - type = ( (ParameterizedType) type ).getRawType(); - } - - if( type instanceof Class ) - { - Class typeAsClass = (Class) type; - if( Set.class.isAssignableFrom( typeAsClass ) ) - { - return new HashSet(); - } - else if( Map.class.isAssignableFrom( typeAsClass ) ) - { - return new LinkedHashMap(); - } - else if( Collection.class.isAssignableFrom( typeAsClass ) ) - { - return new ArrayList(); - } - else if( typeAsClass.isEnum() ) - { - return ( (Class) type ).getEnumConstants()[ 0 ]; - } - } - throw new IllegalArgumentException( "Cannot use @UseDefaults with type " + type.toString() ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/property/GenericPropertyInfo.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/GenericPropertyInfo.java b/core/api/src/main/java/org/apache/zest/api/property/GenericPropertyInfo.java deleted file mode 100644 index 5c8e419..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/GenericPropertyInfo.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2007,2008 Niclas Hedhman. - * - * Licensed 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.property; - -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 Property info utility class. - */ -public final class GenericPropertyInfo -{ - public static Type propertyTypeOf( AccessibleObject accessor ) - { - return toPropertyType( typeOf( accessor ) ); - } - - public static Type toPropertyType( Type methodReturnType ) - { - if( methodReturnType instanceof ParameterizedType ) - { - ParameterizedType parameterizedType = (ParameterizedType) methodReturnType; - if( Property.class.isAssignableFrom( (Class<?>) parameterizedType.getRawType() ) ) - { - return parameterizedType.getActualTypeArguments()[ 0 ]; - } - } - - if( methodReturnType instanceof Class<?> ) - { - Type[] interfaces = ( (Class<?>) methodReturnType ).getGenericInterfaces(); - for( Type anInterface : interfaces ) - { - Type propertyType = toPropertyType( anInterface ); - if( propertyType != null ) - { - return propertyType; - } - } - } - return null; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/property/Immutable.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/Immutable.java b/core/api/src/main/java/org/apache/zest/api/property/Immutable.java deleted file mode 100644 index 5611a5a..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/Immutable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2008, Rickard Ãberg. All Rights Reserved. - * - * Licensed 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.property; - -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 adds Immutability to Types, Properties and Associations - */ -@Retention( RetentionPolicy.RUNTIME ) -@Target( { ElementType.TYPE, ElementType.METHOD } ) -@Documented -public @interface Immutable -{ -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/property/InvalidPropertyTypeException.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/InvalidPropertyTypeException.java b/core/api/src/main/java/org/apache/zest/api/property/InvalidPropertyTypeException.java deleted file mode 100644 index 8d5b87d..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/InvalidPropertyTypeException.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.zest.api.property; - -import java.lang.reflect.AccessibleObject; -import org.apache.zest.api.common.ConstructionException; - -/** - * Thrown when attempting to subclass Property. - */ -public class InvalidPropertyTypeException extends ConstructionException -{ - public InvalidPropertyTypeException( AccessibleObject accessor ) - { - super( createMessage(accessor) ); - } - - private static String createMessage( AccessibleObject accessor ) - { - StringBuilder builder = new StringBuilder(); - builder.append( "Not allowed to subclass " + Property.class.getName() + ". Property accessor " + accessor + " is returning a Property subclass." ); - return builder.toString(); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/property/Numbers.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/Numbers.java b/core/api/src/main/java/org/apache/zest/api/property/Numbers.java deleted file mode 100644 index 2fd39bf..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/Numbers.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2009, Rickard Ãberg. All Rights Reserved. - * - * Licensed 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.property; - -import java.math.BigDecimal; - -/** - * Convenience class for mathematical operations on numerical properties. - * <pre>import static org.qi4j.api.property.Numbers.*; - * ... - * add( object.numberProperty(), 5 );</pre> - */ -public final class Numbers -{ - // Integer operations - - public static Property<Integer> add( Property<Integer> property, int amount ) - { - property.set( property.get() + amount ); - return property; - } - - public static Property<Integer> mult( Property<Integer> property, int amount ) - { - property.set( property.get() * amount ); - return property; - } - - public static Property<Integer> sub( Property<Integer> property, int amount ) - { - property.set( property.get() - amount ); - return property; - } - - public static Property<Integer> div( Property<Integer> property, int amount ) - { - property.set( property.get() / amount ); - return property; - } - - // Long operations - - public static Property<Long> add( Property<Long> property, long amount ) - { - property.set( property.get() + amount ); - return property; - } - - public static Property<Long> mult( Property<Long> property, long amount ) - { - property.set( property.get() * amount ); - return property; - } - - public static Property<Long> sub( Property<Long> property, long amount ) - { - property.set( property.get() - amount ); - return property; - } - - public static Property<Long> div( Property<Long> property, long amount ) - { - property.set( property.get() / amount ); - return property; - } - - // Double operations - - public static Property<Double> add( Property<Double> property, double amount ) - { - property.set( property.get() + amount ); - return property; - } - - public static Property<Double> mult( Property<Double> property, double amount ) - { - property.set( property.get() * amount ); - return property; - } - - public static Property<Double> sub( Property<Double> property, double amount ) - { - property.set( property.get() - amount ); - return property; - } - - public static Property<Double> div( Property<Double> property, double amount ) - { - property.set( property.get() / amount ); - return property; - } - - // Float operations - - public static Property<Float> add( Property<Float> property, float amount ) - { - property.set( property.get() + amount ); - return property; - } - - public static Property<Float> mult( Property<Float> property, float amount ) - { - property.set( property.get() * amount ); - return property; - } - - public static Property<Float> sub( Property<Float> property, float amount ) - { - property.set( property.get() - amount ); - return property; - } - - public static Property<Float> div( Property<Float> property, float amount ) - { - property.set( property.get() / amount ); - return property; - } - - // BigDecimal operations - - public static Property<BigDecimal> add( Property<BigDecimal> property, BigDecimal amount ) - { - property.set( property.get().add( amount ) ); - return property; - } - - public static Property<BigDecimal> mult( Property<BigDecimal> property, BigDecimal amount ) - { - property.set( property.get().multiply( amount ) ); - return property; - } - - public static Property<BigDecimal> sub( Property<BigDecimal> property, BigDecimal amount ) - { - property.set( property.get().subtract( amount ) ); - return property; - } - - public static Property<BigDecimal> div( Property<BigDecimal> property, BigDecimal amount ) - { - property.set( property.get().divide( amount ) ); - return property; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/property/Property.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/Property.java b/core/api/src/main/java/org/apache/zest/api/property/Property.java deleted file mode 100644 index 9721e92..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/Property.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2007-2011, Rickard Ãberg. All Rights Reserved. - * - * Licensed 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.property; - -/** - * Properties are declared in Composite interfaces by using this interface. - * <p> - * It creates a first-class object for the property from which you can get and set the value, and access any - * metadata about it. - * </p> - * <p>The type of the Property can be one of the following:</p> - * <ul> - * <li> A boxed primitive (Long,Integer,Boolean, etc.)</li> - * <li> String</li> - * <li> BigInteger</li> - * <li> BigDecimal</li> - * <li> Date</li> - * <li> DateTime (Joda Time)</li> - * <li> LocalDateTime (Joda Time)</li> - * <li> A serializable</li> - * <li> A ValueComposite</li> - * <li> A List, Set or Collection of any of the above</li> - * </ul> - * - * @param <T> Parameterized type of the Property - */ -public interface Property<T> -{ - /** - * Get the value of the property. - * - * @return the value - */ - T get(); - - /** - * Set the value of the property - * - * @param newValue the new value - * - * @throws IllegalArgumentException if the value has an invalid value - * @throws IllegalStateException if the property is immutable - */ - void set( T newValue ) - throws IllegalArgumentException, IllegalStateException; -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/property/PropertyDescriptor.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/PropertyDescriptor.java b/core/api/src/main/java/org/apache/zest/api/property/PropertyDescriptor.java deleted file mode 100644 index 649b1fc..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/PropertyDescriptor.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2007, Rickard Ãberg. All Rights Reserved. - * - * Licensed 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.property; - -import java.lang.reflect.AccessibleObject; -import java.lang.reflect.Type; -import org.apache.zest.api.common.QualifiedName; -import org.apache.zest.api.structure.MetaInfoHolder; -import org.apache.zest.api.structure.Module; -import org.apache.zest.api.type.ValueType; - -/** - * Property Descriptor. - */ -public interface PropertyDescriptor extends MetaInfoHolder -{ - boolean isImmutable(); - - /** - * Get the qualified name of the property which is equal to: - * <pre><code> - * <interface name>:<method name> - * </code></pre> - * - * @return the qualified name of the property - */ - QualifiedName qualifiedName(); - - /** - * Get the type of the property. If the property is declared - * as Property<X> then X is returned. - * - * @return the property type - */ - Type type(); - - AccessibleObject accessor(); - - Object initialValue( Module module ); - - ValueType valueType(); - - boolean queryable(); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/property/PropertyMixin.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/PropertyMixin.java b/core/api/src/main/java/org/apache/zest/api/property/PropertyMixin.java deleted file mode 100644 index 4e08f5c..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/PropertyMixin.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2007, Rickard Ãberg. All Rights Reserved. - * - * Licensed 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.property; - -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 properties. - */ -// START SNIPPET: actual -@AppliesTo( { PropertyMixin.PropertyFilter.class } ) -public final class PropertyMixin - implements InvocationHandler -{ - @State - private StateHolder state; - - @Override - public Object invoke( Object proxy, Method method, Object[] args ) - throws Throwable - { - return state.propertyFor( method ); - } - - /** - * Filter Property methods to apply generic Property Mixin. - */ - public static class PropertyFilter - implements AppliesToFilter - { - @Override - public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> modifierClass ) - { - return Property.class.isAssignableFrom( method.getReturnType() ); - } - } -} -// END SNIPPET: actual http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/property/PropertyWrapper.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/PropertyWrapper.java b/core/api/src/main/java/org/apache/zest/api/property/PropertyWrapper.java deleted file mode 100644 index f397908..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/PropertyWrapper.java +++ /dev/null @@ -1,71 +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.property; - -/** - * If you want to catch getting and setting properties, then create a GenericConcern - * that wraps the Zest-supplied Property instance with PropertyWrappers. Override - * get() and/or set() to perform your custom code. - */ -public class PropertyWrapper - implements Property<Object> -{ - protected Property<Object> next; - - public PropertyWrapper( Property<Object> next ) - { - this.next = next; - } - - public Property<Object> next() - { - return next; - } - - @Override - public Object get() - { - return next.get(); - } - - @Override - public void set( Object newValue ) - throws IllegalArgumentException, IllegalStateException - { - next.set( newValue ); - } - - @Override - public int hashCode() - { - return next.hashCode(); - } - - @Override - 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/a789141d/core/api/src/main/java/org/apache/zest/api/property/StateHolder.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/StateHolder.java b/core/api/src/main/java/org/apache/zest/api/property/StateHolder.java deleted file mode 100644 index d188d3d..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/StateHolder.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2008, Rickard Ãberg. All Rights Reserved. - * - * Licensed 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.property; - -import java.lang.reflect.AccessibleObject; - -/** - * This represents the state of a composite (properties). - */ -public interface StateHolder -{ - /** - * Get a property for a specific accessor - * - * @param accessor of the property - * - * @return the property - * - * @throws IllegalArgumentException if no property for given accessor exists - */ - <T> Property<T> propertyFor( AccessibleObject accessor ) - throws IllegalArgumentException; - - Iterable<? extends Property<?>> properties(); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/property/package.html ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/package.html b/core/api/src/main/java/org/apache/zest/api/property/package.html deleted file mode 100644 index 8fc2a93..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/package.html +++ /dev/null @@ -1,21 +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>Property API.</h2> - </body> -</html> http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/query/MissingIndexingSystemException.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/query/MissingIndexingSystemException.java b/core/api/src/main/java/org/apache/zest/api/query/MissingIndexingSystemException.java deleted file mode 100644 index aca06c4..0000000 --- a/core/api/src/main/java/org/apache/zest/api/query/MissingIndexingSystemException.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2008, Niclas Hedhman. All Rights Reserved. - * - * Licensed 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.query; - -/** - * This Exception is thrown in <code>QueryBuilderFactory.newQueryBuilder()</code> method if - * no indexing subsystem has been declared in the assembly. - */ -public final class MissingIndexingSystemException - extends QueryException -{ - private static final long serialVersionUID = 5147421865890379209L; - - public MissingIndexingSystemException() - { - super( "No EntityFinder has been declared in the assembly of the application." ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/query/NotQueryableException.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/query/NotQueryableException.java b/core/api/src/main/java/org/apache/zest/api/query/NotQueryableException.java deleted file mode 100644 index 403ba4c..0000000 --- a/core/api/src/main/java/org/apache/zest/api/query/NotQueryableException.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2009 Alin Dreghiciu. - * - * Licensed 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.query; - -import java.lang.reflect.AccessibleObject; -import java.lang.reflect.Member; -import org.apache.zest.api.entity.Queryable; -import org.apache.zest.api.property.GenericPropertyInfo; -import org.apache.zest.api.util.Classes; - -/** - * Thrown in case that a non queryable type or accessor (marked with @Queriable(false)) is used during query building, - * or when non-Property, non-Associations are trying to be queried (possibly can not happen). - */ -public class NotQueryableException - extends QueryException -{ - private static final long serialVersionUID = 1L; - - /** - * Constructor. - * - * @param message exception message - */ - public NotQueryableException( final String message ) - { - super( message ); - } - - /** - * Verify that the provided accessor method has not been marked with a Queryable(false). - * - * @param accessor accessor method - * - * @throws NotQueryableException - If accessor method has been marked as not queryable - */ - public static void throwIfNotQueryable( final AccessibleObject accessor ) - { - Queryable queryable = accessor.getAnnotation( Queryable.class ); - if( queryable != null && !queryable.value() ) - { - throw new NotQueryableException( - String.format( - "%1$s \"%2$s\" (%3$s) is not queryable as has been marked with @Queryable(false)", - Classes.RAW_CLASS.map( GenericPropertyInfo.propertyTypeOf( accessor ) ).getSimpleName(), - ( (Member) accessor ).getName(), - ( (Member) accessor ).getDeclaringClass().getName() - ) - ); - } - } - - /** - * Verify that the provided type has not been marked with a Queryable(false). - * - * @param type a type - * - * @throws NotQueryableException - If type has been marked as not queryable - */ - public static void throwIfNotQueryable( final Class<?> type ) - { - Queryable queryable = type.getAnnotation( Queryable.class ); - if( queryable != null && !queryable.value() ) - { - throw new NotQueryableException( - String.format( - "Type \"%1$s\" is not queryable as has been marked with @Queryable(false)", - type.getName() - ) - ); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/query/Query.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/query/Query.java b/core/api/src/main/java/org/apache/zest/api/query/Query.java deleted file mode 100644 index 84e2c9c..0000000 --- a/core/api/src/main/java/org/apache/zest/api/query/Query.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright 2007 Rickard Ãberg. - * Copyright 2007 Niclas Hedhman. - * Copyright 2008 Alin Dreghiciu. - * - * Licensed 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.query; - -import java.io.Serializable; -import org.apache.zest.api.property.Property; -import org.apache.zest.api.query.grammar.OrderBy; - -/** - * This represents a Query in an indexing system. It is created from a - * {@link QueryBuilder}, which decides the "where" clause in the query. - * <p> - * Additional limitations, such as paging, ordering, and variables, can be set on - * a Query before it is executed by calling one of find(), iterator(), - * or count(). - * </p> - * <p> - * DDD tip: typically Queries are created in the Domain Model and passed to the UI, - * which sets the order and paging before executing it. - * </p> - */ -public interface Query<T> - extends Iterable<T>, Serializable -{ - /** - * Set the ordering rules. If many segments are used for ordering - * then they will be applied in order. - * - * @param segments the segments to order by - * - * @return the Query - */ - Query<T> orderBy( OrderBy... segments ); - - /** - * Append an ordering rule to the existing segments. - * - * @param property the property to order by - * @param order the order to apply - * - * @return the Query - */ - Query<T> orderBy( final Property<?> property, final OrderBy.Order order ); - - /** - * Append an ascending ordering rule to the existing segments. - * - * @param property the property to order by - * - * @return the Query - */ - Query<T> orderBy( Property<?> property ); - - /** - * Set the index of the first result. Default is 0 (zero). - * - * @param firstResult which index to use as the first one - * - * @return the Query - */ - Query<T> firstResult( int firstResult ); - - /** - * Set how many results should be returned. Default is that - * there is no limit set. - * - * @param maxResults that shouldbe returned - * - * @return the query - */ - Query<T> maxResults( int maxResults ); - - /** - * Get the first Entity that matches the criteria. This - * executes the Query. - * - * @return the first found Entity or null if none were found - * - * @throws QueryExecutionException if the query fails - */ - T find() - throws QueryExecutionException; - - /** - * Set the value of a named variable. - * - * @param name of the variable - * @param value of the variable - * - * @return the query - */ - Query<T> setVariable( String name, Object value ); - - /** - * Get the value of a named variable. - * - * @param name of the variable - * - * @return value of the variable - */ - <V> V getVariable( String name ); - - /** - * Get the result type of this Query - * - * @return the result type - */ - Class<T> resultType(); - - /** - * Count how many results would be returned by this Query. - * This executes the Query. - * - * @return result count - * - * @throws QueryExecutionException if the query fails - */ - long count() - throws QueryExecutionException; -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/query/QueryBuilder.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/query/QueryBuilder.java b/core/api/src/main/java/org/apache/zest/api/query/QueryBuilder.java deleted file mode 100644 index 38b010c..0000000 --- a/core/api/src/main/java/org/apache/zest/api/query/QueryBuilder.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2007 Rickard Ãberg. - * Copyright 2008 Alin Dreghiciu. - * - * Licensed 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.query; - -import org.apache.zest.api.composite.Composite; -import org.apache.zest.functional.Specification; - -/** - * QueryBuilders are used to create {@link Query} instances. - * Iteratively add where() clauses to the query, and then use - * {@link org.apache.zest.api.unitofwork.UnitOfWork#newQuery(QueryBuilder)} to instantiate the Query. - * QueryBuilders are immutable, so when adding new where-clauses you get new instances. This - * - * DDD tip: Query objects are not executed immediately, so they - * should be constructed in the domain model and handed over to - * the UI, which can then further constrain it before actual - * execution. - */ -public interface QueryBuilder<T> -{ - /** - * Add a where-clause to the Query. Use {@link QueryExpressions} - * to create the expression. - * - * @param specification the where clause - * - * @return a new builder with the added where-clause - */ - QueryBuilder<T> where( Specification<Composite> specification ); - - /** - * Create a new query with the declared where-clauses that will be evaluated against the iterable entries. - * - * @param iterable collection of objects (composites?) - * - * @return a new Query instance - */ - Query<T> newQuery( Iterable<T> iterable ); -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/query/QueryBuilderFactory.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/query/QueryBuilderFactory.java b/core/api/src/main/java/org/apache/zest/api/query/QueryBuilderFactory.java deleted file mode 100644 index fe40289..0000000 --- a/core/api/src/main/java/org/apache/zest/api/query/QueryBuilderFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2007 Niclas Hedhman. - * - * Licensed 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.query; - -/** - * This is used to create QueryBuilders. - * - * @see QueryBuilder - */ -public interface QueryBuilderFactory -{ - /** - * Create a new QueryBuilder. - * - * @param resultType the type of the result that you want - * - * @return a QueryBuilder - * - * @throws MissingIndexingSystemException if there is no EntityFinder service available - */ - <T> QueryBuilder<T> newQueryBuilder( Class<T> resultType ) - throws MissingIndexingSystemException; -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/query/QueryException.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/query/QueryException.java b/core/api/src/main/java/org/apache/zest/api/query/QueryException.java deleted file mode 100644 index a0bd0f6..0000000 --- a/core/api/src/main/java/org/apache/zest/api/query/QueryException.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2008, Niclas Hedhman. All Rights Reserved. - * - * Licensed 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.query; - -/** - * Base class for Query exceptions. - */ -public abstract class QueryException - extends RuntimeException -{ - private static final long serialVersionUID = -3602596752342902060L; - - public QueryException() - { - } - - public QueryException( final String message ) - { - super( message ); - } - - public QueryException( final String message, final Throwable cause ) - { - super( message, cause ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/query/QueryExecutionException.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/query/QueryExecutionException.java b/core/api/src/main/java/org/apache/zest/api/query/QueryExecutionException.java deleted file mode 100644 index f068843..0000000 --- a/core/api/src/main/java/org/apache/zest/api/query/QueryExecutionException.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2008, Rickard Ãberg. All Rights Reserved. - * - * Licensed 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.query; - -/** - * Throw this exception if a query could not be executed - */ -public final class QueryExecutionException - extends QueryException -{ - private static final long serialVersionUID = 5147421865890379209L; - - public QueryExecutionException( String message ) - { - super( message ); - } - - public QueryExecutionException( String message, Throwable cause ) - { - super( message, cause ); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/core/api/src/main/java/org/apache/zest/api/query/QueryExpressionException.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/query/QueryExpressionException.java b/core/api/src/main/java/org/apache/zest/api/query/QueryExpressionException.java deleted file mode 100644 index 676bed0..0000000 --- a/core/api/src/main/java/org/apache/zest/api/query/QueryExpressionException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2009 Niclas Hedhman. - * - * Licensed 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.query; - -/** - * Throw this exception if a QueryExpression is invalid. - */ -public class QueryExpressionException - extends QueryException -{ - - private static final long serialVersionUID = 1L; - - public QueryExpressionException( String message ) - { - super( message ); - } - -}
