You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@onami.apache.org by ra...@apache.org on 2013/03/14 19:21:23 UTC
svn commit: r1456588 - in /incubator/onami/trunk/lifecycle: ./ warmup/
warmup/main/ warmup/main/java/ warmup/main/java/org/
warmup/main/java/org/apache/ warmup/main/java/org/apache/onami/
warmup/main/java/org/apache/onami/lifecycle/ warmup/main/java/or...
Author: randgalt
Date: Thu Mar 14 18:21:23 2013
New Revision: 1456588
URL: http://svn.apache.org/r1456588
Log:
wip
Added:
incubator/onami/trunk/lifecycle/warmup/
incubator/onami/trunk/lifecycle/warmup/main/
incubator/onami/trunk/lifecycle/warmup/main/java/
incubator/onami/trunk/lifecycle/warmup/main/java/org/
incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/
incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/
incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/
incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/
incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUp.java (with props)
incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUpModule.java (with props)
incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUper.java (with props)
incubator/onami/trunk/lifecycle/warmup/pom.xml (with props)
Modified:
incubator/onami/trunk/lifecycle/pom.xml
Modified: incubator/onami/trunk/lifecycle/pom.xml
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/lifecycle/pom.xml?rev=1456588&r1=1456587&r2=1456588&view=diff
==============================================================================
--- incubator/onami/trunk/lifecycle/pom.xml (original)
+++ incubator/onami/trunk/lifecycle/pom.xml Thu Mar 14 18:21:23 2013
@@ -38,6 +38,7 @@
<modules>
<module>core</module>
<module>standard</module>
+ <module>warmup</module>
</modules>
<scm>
Added: incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUp.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUp.java?rev=1456588&view=auto
==============================================================================
--- incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUp.java (added)
+++ incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUp.java Thu Mar 14 18:21:23 2013
@@ -0,0 +1,35 @@
+package org.apache.onami.lifecycle.warmup;
+
+/*
+ * 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.
+ */
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Documented
+@Retention(RUNTIME)
+@Target(METHOD)
+public @interface WarmUp
+{
+
+}
Propchange: incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUp.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUp.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUp.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUpModule.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUpModule.java?rev=1456588&view=auto
==============================================================================
--- incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUpModule.java (added)
+++ incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUpModule.java Thu Mar 14 18:21:23 2013
@@ -0,0 +1,64 @@
+package org.apache.onami.lifecycle.warmup;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.TypeLiteral;
+import com.google.inject.matcher.Matcher;
+import org.apache.onami.lifecycle.core.LifeCycleStageModule;
+
+import java.lang.annotation.Annotation;
+
+import static com.google.inject.matcher.Matchers.any;
+
+public class WarmUpModule<A extends Annotation>
+ extends AbstractModule
+{
+ private final LifeCycleStageModule<A> lifeCycleStageModule;
+
+ public WarmUpModule( Class<A> stage )
+ {
+ this( stage, any() );
+ }
+
+ /**
+ * Creates a new module which register methods annotated with input annotation on methods
+ * in types filtered by the input matcher.
+ *
+ * @param stage the <i>Dispose</i> annotation to be searched.
+ * @param typeMatcher the filter for injectee types.
+ */
+ public WarmUpModule( Class<A> stage, Matcher<? super TypeLiteral<?>> typeMatcher )
+ {
+ WarmUper<A> stager = new WarmUper<A>( stage );
+ lifeCycleStageModule =
+ LifeCycleStageModule.builder( stage ).withTypeMatcher( typeMatcher ).withStager( stager ).withTypeMapper(
+ stager ).build();
+ }
+
+ public static WarmUpModule<WarmUp> newWarmUpModule()
+ {
+ return new WarmUpModule<WarmUp>( WarmUp.class );
+ }
+
+ public static WarmUpModule<WarmUp> newWarmUpModule( Matcher<? super TypeLiteral<?>> typeMatcher )
+ {
+ return new WarmUpModule<WarmUp>( WarmUp.class, typeMatcher );
+ }
+
+ public static LifeCycleStageModule.Builder<WarmUp> builder()
+ {
+ WarmUper<WarmUp> stager = new WarmUper<WarmUp>( WarmUp.class );
+ return LifeCycleStageModule.builder( WarmUp.class ).withStager( stager ).withTypeMapper( stager );
+ }
+
+ public static <A extends Annotation> LifeCycleStageModule.Builder<A> builder( Class<A> stage )
+ {
+ WarmUper<A> stager = new WarmUper<A>( stage );
+ return LifeCycleStageModule.builder( stage ).withStager( stager ).withTypeMapper( stager );
+ }
+
+ @Override
+ protected void configure()
+ {
+ binder().install( lifeCycleStageModule );
+ }
+}
Propchange: incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUpModule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUpModule.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUpModule.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUper.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUper.java?rev=1456588&view=auto
==============================================================================
--- incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUper.java (added)
+++ incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUper.java Thu Mar 14 18:21:23 2013
@@ -0,0 +1,77 @@
+package org.apache.onami.lifecycle.warmup;
+
+/*
+ * 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.
+ */
+
+import com.google.inject.TypeLiteral;
+import org.apache.onami.lifecycle.core.NoOpStageHandler;
+import org.apache.onami.lifecycle.core.StageHandler;
+import org.apache.onami.lifecycle.core.Stageable;
+import org.apache.onami.lifecycle.core.StageableTypeMapper;
+import org.apache.onami.lifecycle.core.Stager;
+import sun.java2d.Disposer;
+
+import java.lang.annotation.Annotation;
+import java.util.Map;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+/**
+ * Default {@link Disposer} implementation.
+ *
+ * @since 0.2.0
+ */
+public class WarmUper<A extends Annotation>
+ implements Stager<A>, StageableTypeMapper<A>
+{
+ private final Queue<Stageable> stageables = new ConcurrentLinkedQueue<Stageable>();
+ private final Map<Stageable, TypeLiteral<?>> types = new ConcurrentHashMap<Stageable, TypeLiteral<?>>();
+
+ private final Class<A> stage;
+
+ public WarmUper( Class<A> stage )
+ {
+ this.stage = stage;
+ }
+
+ public <I> void registerType( Stageable stageable, TypeLiteral<I> parentType )
+ {
+ types.put( stageable, parentType );
+ }
+
+ public void register( Stageable stageable )
+ {
+ stageables.add( stageable );
+ }
+
+ public void stage()
+ {
+ stage( new NoOpStageHandler() );
+ }
+
+ public void stage( StageHandler stageHandler )
+ {
+ }
+
+ public Class<A> getStage()
+ {
+ return stage;
+ }
+}
\ No newline at end of file
Propchange: incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUper.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/onami/trunk/lifecycle/warmup/main/java/org/apache/onami/lifecycle/warmup/WarmUper.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/onami/trunk/lifecycle/warmup/pom.xml
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/lifecycle/warmup/pom.xml?rev=1456588&view=auto
==============================================================================
--- incubator/onami/trunk/lifecycle/warmup/pom.xml (added)
+++ incubator/onami/trunk/lifecycle/warmup/pom.xml Thu Mar 14 18:21:23 2013
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.onami</groupId>
+ <artifactId>org.apache.onami.lifecycle</artifactId>
+ <version>0.2.0-incubating-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.apache.onami.lifecycle.warmup</artifactId>
+
+ <dependencies>
+ <dependency>
+ <!-- if you are using Java 7 you can remove this and switch to the JDK version -->
+ <groupId>org.codehaus.jsr166-mirror</groupId>
+ <artifactId>jsr166y</artifactId>
+ <version>1.7.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.onami</groupId>
+ <artifactId>org.apache.onami.lifecycle.core</artifactId>
+ <version>0.2.0-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Propchange: incubator/onami/trunk/lifecycle/warmup/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/onami/trunk/lifecycle/warmup/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: incubator/onami/trunk/lifecycle/warmup/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml