You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@onami.apache.org by da...@apache.org on 2012/12/07 01:11:37 UTC
svn commit: r1418140 [4/8] - in /incubator/onami/trunk/autobind:
aop/src/main/java/org/apache/ aop/src/main/java/org/nnsoft/
aop/src/test/java/org/apache/ aop/src/test/java/org/apache/onami/
aop/src/test/java/org/nnsoft/ configuration/src/main/java/org...
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/general/ExampleApp.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/general/ExampleApp.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/general/ExampleApp.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/general/ExampleApp.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,60 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.configuration.example.map.general;
+
+import org.apache.onami.autobind.annotations.Bind;
+import org.apache.onami.autobind.annotations.GuiceModule;
+import org.apache.onami.autobind.configuration.StartupModule;
+import org.apache.onami.autobind.configuration.features.ConfigurationFeature;
+import org.apache.onami.autobind.example.starter.ExampleApplication;
+import org.apache.onami.autobind.scanner.ClasspathScanner;
+import org.apache.onami.autobind.scanner.PackageFilter;
+import org.apache.onami.autobind.scanner.ScannerModule;
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+
+/**
+ * Example Application, which creates a new Injector with the help of the
+ * provided {@link StartupModule}. It passes the {@link ASMClasspathScanner}
+ * class for the {@link ClasspathScanner} and the packages (de.devsurf) which
+ * should be scanned. The {@link StartupModule} binds these parameter, so we are
+ * able to create and inject our {@link ScannerModule}. This Module uses the
+ * {@link ClasspathScanner} to explore the Classpath and scans for Annotations.
+ *
+ * All recognized Classes annotated with {@link GuiceModule} are installed in
+ * the child injector and with {@link Bind} are automatically bound.
+ *
+ * @author Daniel Manzke
+ *
+ */
+@Bind(multiple = true)
+public class ExampleApp implements ExampleApplication {
+ @Override
+ public void run() {
+ StartupModule startupModule = StartupModule.create(ASMClasspathScanner.class,
+ PackageFilter.create(ExampleApp.class));
+ startupModule.addFeature(ConfigurationFeature.class);
+ Injector injector = Guice.createInjector(startupModule);
+ System.out.println(injector.getInstance(Example.class).sayHello());
+ }
+
+ public static void main(String[] args) {
+ new ExampleApp().run();
+ }
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/general/ExampleConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/general/ExampleConfiguration.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/general/ExampleConfiguration.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/general/ExampleConfiguration.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,24 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.configuration.example.map.general;
+
+import org.apache.onami.autobind.configuration.Configuration;
+import org.apache.onami.autobind.configuration.PathConfig;
+
+@Configuration(location = @PathConfig(value = "/configuration.properties"))
+public interface ExampleConfiguration {
+
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/general/ExampleImpl.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/general/ExampleImpl.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/general/ExampleImpl.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/general/ExampleImpl.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,42 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.configuration.example.map.general;
+
+import java.util.Properties;
+
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+import com.google.inject.Inject;
+
+
+/**
+ * This class implements the Example interface and is not annotated like the
+ * other Examples, due the fact, that the {@link ExampleModule} will bind it
+ * manually. In this Example the {@link ASMClasspathScanner} is used, to find
+ * the {@link ExampleModule} and automatically install it.
+ *
+ * @author Daniel Manzke
+ *
+ */
+public class ExampleImpl implements Example {
+ @Inject
+ private Properties config;
+
+ @Override
+ public String sayHello() {
+ return "sayHello() - " + config.getProperty("message");
+ }
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/general/ExampleModule.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/general/ExampleModule.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/general/ExampleModule.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/general/ExampleModule.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,39 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.configuration.example.map.general;
+
+import org.apache.onami.autobind.annotations.GuiceModule;
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+import com.google.inject.AbstractModule;
+
+
+/**
+ * This is a GuiceModule, which bind the {@link ExampleImpl} to the
+ * {@link Example} interface and it will be recognized by the
+ * {@link ASMClasspathScanner}, due the fact that it is annotated with the
+ * {@link GuiceModule}.
+ *
+ * @author Daniel Manzke
+ *
+ */
+@GuiceModule
+public class ExampleModule extends AbstractModule {
+ @Override
+ protected void configure() {
+ bind(Example.class).to(ExampleImpl.class);
+ }
+}
Propchange: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/
------------------------------------------------------------------------------
bugtraq:number = true
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/Example.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/Example.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/Example.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/Example.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,26 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.configuration.example.map.lazy;
+
+/**
+ * Interface which is used to bind an implementation too.
+ *
+ * @author Daniel Manzke
+ *
+ */
+public interface Example {
+ String sayHello();
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/ExampleApp.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/ExampleApp.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/ExampleApp.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/ExampleApp.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,60 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.configuration.example.map.lazy;
+
+import org.apache.onami.autobind.annotations.Bind;
+import org.apache.onami.autobind.annotations.GuiceModule;
+import org.apache.onami.autobind.configuration.StartupModule;
+import org.apache.onami.autobind.configuration.features.ConfigurationFeature;
+import org.apache.onami.autobind.example.starter.ExampleApplication;
+import org.apache.onami.autobind.scanner.ClasspathScanner;
+import org.apache.onami.autobind.scanner.PackageFilter;
+import org.apache.onami.autobind.scanner.ScannerModule;
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+
+/**
+ * Example Application, which creates a new Injector with the help of the
+ * provided {@link StartupModule}. It passes the {@link ASMClasspathScanner}
+ * class for the {@link ClasspathScanner} and the packages (de.devsurf) which
+ * should be scanned. The {@link StartupModule} binds these parameter, so we are
+ * able to create and inject our {@link ScannerModule}. This Module uses the
+ * {@link ClasspathScanner} to explore the Classpath and scans for Annotations.
+ *
+ * All recognized Classes annotated with {@link GuiceModule} are installed in
+ * the child injector and with {@link Bind} are automatically bound.
+ *
+ * @author Daniel Manzke
+ *
+ */
+@Bind(multiple = true)
+public class ExampleApp implements ExampleApplication {
+ @Override
+ public void run() {
+ StartupModule startupModule = StartupModule.create(ASMClasspathScanner.class,
+ PackageFilter.create(ExampleApp.class));
+ startupModule.addFeature(ConfigurationFeature.class);
+ Injector injector = Guice.createInjector(startupModule);
+ System.out.println(injector.getInstance(Example.class).sayHello());
+ }
+
+ public static void main(String[] args) {
+ new ExampleApp().run();
+ }
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/ExampleConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/ExampleConfiguration.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/ExampleConfiguration.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/ExampleConfiguration.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,24 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.configuration.example.map.lazy;
+
+import org.apache.onami.autobind.configuration.Configuration;
+import org.apache.onami.autobind.configuration.PathConfig;
+
+@Configuration(location = @PathConfig(value = "/configuration.properties"), lazy = true)
+public interface ExampleConfiguration {
+
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/ExampleImpl.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/ExampleImpl.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/ExampleImpl.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/ExampleImpl.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,42 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.configuration.example.map.lazy;
+
+import java.util.Properties;
+
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+import com.google.inject.Inject;
+
+
+/**
+ * This class implements the Example interface and is not annotated like the
+ * other Examples, due the fact, that the {@link ExampleModule} will bind it
+ * manually. In this Example the {@link ASMClasspathScanner} is used, to find
+ * the {@link ExampleModule} and automatically install it.
+ *
+ * @author Daniel Manzke
+ *
+ */
+public class ExampleImpl implements Example {
+ @Inject
+ private Properties config;
+
+ @Override
+ public String sayHello() {
+ return "sayHello() - " + config.getProperty("message");
+ }
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/ExampleModule.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/ExampleModule.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/ExampleModule.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/lazy/ExampleModule.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,39 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.configuration.example.map.lazy;
+
+import org.apache.onami.autobind.annotations.GuiceModule;
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+import com.google.inject.AbstractModule;
+
+
+/**
+ * This is a GuiceModule, which bind the {@link ExampleImpl} to the
+ * {@link Example} interface and it will be recognized by the
+ * {@link ASMClasspathScanner}, due the fact that it is annotated with the
+ * {@link GuiceModule}.
+ *
+ * @author Daniel Manzke
+ *
+ */
+@GuiceModule
+public class ExampleModule extends AbstractModule {
+ @Override
+ protected void configure() {
+ bind(Example.class).to(ExampleImpl.class);
+ }
+}
Propchange: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/
------------------------------------------------------------------------------
bugtraq:number = true
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/Example.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/Example.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/Example.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/Example.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,26 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.configuration.example.map.named;
+
+/**
+ * Interface which is used to bind an implementation too.
+ *
+ * @author Daniel Manzke
+ *
+ */
+public interface Example {
+ String sayHello();
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/ExampleApp.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/ExampleApp.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/ExampleApp.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/ExampleApp.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,60 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.configuration.example.map.named;
+
+import org.apache.onami.autobind.annotations.Bind;
+import org.apache.onami.autobind.annotations.GuiceModule;
+import org.apache.onami.autobind.configuration.StartupModule;
+import org.apache.onami.autobind.configuration.features.ConfigurationFeature;
+import org.apache.onami.autobind.example.starter.ExampleApplication;
+import org.apache.onami.autobind.scanner.ClasspathScanner;
+import org.apache.onami.autobind.scanner.PackageFilter;
+import org.apache.onami.autobind.scanner.ScannerModule;
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+
+/**
+ * Example Application, which creates a new Injector with the help of the
+ * provided {@link StartupModule}. It passes the {@link ASMClasspathScanner}
+ * class for the {@link ClasspathScanner} and the packages (de.devsurf) which
+ * should be scanned. The {@link StartupModule} binds these parameter, so we are
+ * able to create and inject our {@link ScannerModule}. This Module uses the
+ * {@link ClasspathScanner} to explore the Classpath and scans for Annotations.
+ *
+ * All recognized Classes annotated with {@link GuiceModule} are installed in
+ * the child injector and with {@link Bind} are automatically bound.
+ *
+ * @author Daniel Manzke
+ *
+ */
+@Bind(multiple = true)
+public class ExampleApp implements ExampleApplication {
+ @Override
+ public void run() {
+ StartupModule startupModule = StartupModule.create(ASMClasspathScanner.class,
+ PackageFilter.create(ExampleApp.class));
+ startupModule.addFeature(ConfigurationFeature.class);
+ Injector injector = Guice.createInjector(startupModule);
+ System.out.println(injector.getInstance(Example.class).sayHello());
+ }
+
+ public static void main(String[] args) {
+ new ExampleApp().run();
+ }
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/ExampleConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/ExampleConfiguration.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/ExampleConfiguration.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/ExampleConfiguration.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,27 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.configuration.example.map.named;
+
+import javax.inject.Named;
+
+import org.apache.onami.autobind.configuration.Configuration;
+import org.apache.onami.autobind.configuration.PathConfig;
+
+
+@Configuration(name = @Named("config"), location = @PathConfig(value = "/configuration.properties"))
+public interface ExampleConfiguration {
+
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/ExampleImpl.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/ExampleImpl.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/ExampleImpl.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/ExampleImpl.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,45 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.configuration.example.map.named;
+
+import java.util.Properties;
+
+import javax.inject.Named;
+
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+import com.google.inject.Inject;
+
+
+/**
+ * This class implements the Example interface and is not annotated like the
+ * other Examples, due the fact, that the {@link ExampleModule} will bind it
+ * manually. In this Example the {@link ASMClasspathScanner} is used, to find
+ * the {@link ExampleModule} and automatically install it.
+ *
+ * @author Daniel Manzke
+ *
+ */
+public class ExampleImpl implements Example {
+ @Inject
+ @Named("config")
+ private Properties config;
+
+ @Override
+ public String sayHello() {
+ return "sayHello() - " + config.getProperty("message");
+ }
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/ExampleModule.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/ExampleModule.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/ExampleModule.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/configuration/example/map/named/ExampleModule.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,39 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.configuration.example.map.named;
+
+import org.apache.onami.autobind.annotations.GuiceModule;
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+import com.google.inject.AbstractModule;
+
+
+/**
+ * This is a GuiceModule, which bind the {@link ExampleImpl} to the
+ * {@link Example} interface and it will be recognized by the
+ * {@link ASMClasspathScanner}, due the fact that it is annotated with the
+ * {@link GuiceModule}.
+ *
+ * @author Daniel Manzke
+ *
+ */
+@GuiceModule
+public class ExampleModule extends AbstractModule {
+ @Override
+ protected void configure() {
+ bind(Example.class).to(ExampleImpl.class);
+ }
+}
Propchange: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/example/
------------------------------------------------------------------------------
bugtraq:number = true
Propchange: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/example/starter/
------------------------------------------------------------------------------
bugtraq:number = true
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/example/starter/ExampleApplication.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/example/starter/ExampleApplication.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/example/starter/ExampleApplication.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/example/starter/ExampleApplication.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,20 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.example.starter;
+
+public interface ExampleApplication extends Runnable {
+
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/example/starter/ExampleStarter.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/example/starter/ExampleStarter.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/example/starter/ExampleStarter.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/example/starter/ExampleStarter.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,43 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.example.starter;
+
+import java.util.Set;
+
+import org.apache.onami.autobind.scanner.PackageFilter;
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Key;
+import com.google.inject.TypeLiteral;
+
+
+public class ExampleStarter {
+ public static void main(String[] args) {
+ Injector injector = Guice.createInjector(new ExampleStartupModule(ASMClasspathScanner.class, PackageFilter.create("de.devsurf.injection.guice")));
+
+ Key<Set<ExampleApplication>> key = Key.get(new TypeLiteral<Set<ExampleApplication>>() {
+ });
+ Set<ExampleApplication> apps = injector.getInstance(key);
+ for (ExampleApplication app : apps) {
+ System.out.println("Starting App: " + app.getClass().getName());
+ app.run();
+ System.out.println();
+ }
+ System.out.println("Run " + apps.size() + " Applications.");
+ }
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/example/starter/ExampleStartupModule.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/example/starter/ExampleStartupModule.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/example/starter/ExampleStartupModule.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/example/starter/ExampleStartupModule.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,57 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.example.starter;
+
+import org.apache.onami.autobind.annotations.Bind;
+import org.apache.onami.autobind.annotations.GuiceModule;
+import org.apache.onami.autobind.annotations.features.AutoBindingFeature;
+import org.apache.onami.autobind.annotations.features.MultiBindingFeature;
+import org.apache.onami.autobind.configuration.StartupModule;
+import org.apache.onami.autobind.scanner.ClasspathScanner;
+import org.apache.onami.autobind.scanner.PackageFilter;
+import org.apache.onami.autobind.scanner.features.ScannerFeature;
+
+import com.google.inject.Binder;
+import com.google.inject.CreationException;
+import com.google.inject.multibindings.Multibinder;
+
+
+/**
+ * The {@link ExampleStartupModule} overwrites the
+ * bindAnnotationListeners-Method, because our Example has several Classes
+ * annotated with {@link Bind} and {@link GuiceModule}. Due the fact, that our
+ * GuiceModule binds the {@link Example}-Interface to the {@link ExampleImpl}
+ * -Class and the {@link AutoBindingFeature} too, we would get a
+ * {@link CreationException}.
+ *
+ * @author Daniel Manzke
+ *
+ */
+public class ExampleStartupModule extends StartupModule {
+
+ public ExampleStartupModule(Class<? extends ClasspathScanner> scanner, PackageFilter... packages) {
+ super(scanner, packages);
+ }
+
+ @Override
+ protected Multibinder<ScannerFeature> bindFeatures(Binder binder) {
+ Multibinder<ScannerFeature> listeners = Multibinder.newSetBinder(binder,
+ ScannerFeature.class);
+ listeners.addBinding().to(MultiBindingFeature.class);
+ return listeners;
+ }
+
+}
Propchange: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/
------------------------------------------------------------------------------
bugtraq:number = true
Propchange: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/
------------------------------------------------------------------------------
bugtraq:number = true
Propchange: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/
------------------------------------------------------------------------------
bugtraq:number = true
Propchange: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/automodule/
------------------------------------------------------------------------------
bugtraq:number = true
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/automodule/Example.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/automodule/Example.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/automodule/Example.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/automodule/Example.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,28 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.integrations.example.guicy.automodule;
+
+/**
+ * Interface which is used to bind an implementation too.
+ *
+ * @author Daniel Manzke
+ *
+ */
+public interface Example {
+ String sayHello();
+
+ void inform();
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/automodule/ExampleApp.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/automodule/ExampleApp.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/automodule/ExampleApp.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/automodule/ExampleApp.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,59 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.integrations.example.guicy.automodule;
+
+import org.apache.onami.autobind.annotations.Bind;
+import org.apache.onami.autobind.annotations.GuiceModule;
+import org.apache.onami.autobind.configuration.StartupModule;
+import org.apache.onami.autobind.example.starter.ExampleApplication;
+import org.apache.onami.autobind.scanner.ClasspathScanner;
+import org.apache.onami.autobind.scanner.PackageFilter;
+import org.apache.onami.autobind.scanner.ScannerModule;
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+
+/**
+ * Example Application, which creates a new Injector with the help of the
+ * provided {@link StartupModule}. It passes the {@link ASMClasspathScanner}
+ * class for the {@link ClasspathScanner} and the packages (de.devsurf) which
+ * should be scanned. The {@link StartupModule} binds these parameter, so we are
+ * able to create and inject our {@link ScannerModule}. This Module uses the
+ * {@link ClasspathScanner} to explore the Classpath and scans for Annotations.
+ *
+ * All recognized Classes annotated with {@link GuiceModule} are installed in
+ * the child injector and with {@link Bind} are automatically bound.
+ *
+ * @author Daniel Manzke
+ *
+ */
+@Bind(multiple = true)
+public class ExampleApp implements ExampleApplication {
+ @Override
+ public void run() {
+ StartupModule startupModule = StartupModule.create(ASMClasspathScanner.class,
+ PackageFilter.create(ExampleApp.class));
+ Injector injector = Guice.createInjector(startupModule);
+
+ System.out.println(injector.getInstance(Example.class).sayHello());
+ }
+
+ public static void main(String[] args) {
+ new ExampleApp().run();
+ }
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/automodule/ExampleImpl.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/automodule/ExampleImpl.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/automodule/ExampleImpl.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/automodule/ExampleImpl.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,42 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.integrations.example.guicy.automodule;
+
+import javax.annotation.PostConstruct;
+
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+
+/**
+ * This class implements the Example interface and is not annotated like the
+ * other Examples, due the fact, that the {@link ExampleModule} will bind it
+ * manually. In this Example the {@link ASMClasspathScanner} is used, to find
+ * the {@link ExampleModule} and automatically install it.
+ *
+ * @author Daniel Manzke
+ *
+ */
+public class ExampleImpl implements Example {
+ @PostConstruct
+ public void inform() {
+ System.out.println("inform about post construction!");
+ }
+
+ @Override
+ public String sayHello() {
+ return "yeahhh!!!";
+ }
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/automodule/ExampleModule.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/automodule/ExampleModule.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/automodule/ExampleModule.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/automodule/ExampleModule.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,39 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.integrations.example.guicy.automodule;
+
+import org.apache.onami.autobind.annotations.GuiceModule;
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+import com.google.inject.AbstractModule;
+
+
+/**
+ * This is a GuiceModule, which bind the {@link ExampleImpl} to the
+ * {@link Example} interface and it will be recognized by the
+ * {@link ASMClasspathScanner}, due the fact that it is annotated with the
+ * {@link GuiceModule}.
+ *
+ * @author Daniel Manzke
+ *
+ */
+@GuiceModule
+public class ExampleModule extends AbstractModule {
+ @Override
+ protected void configure() {
+ bind(Example.class).to(ExampleImpl.class);
+ }
+}
Propchange: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/jndi/
------------------------------------------------------------------------------
bugtraq:number = true
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/jndi/Example.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/jndi/Example.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/jndi/Example.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/jndi/Example.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,28 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.integrations.example.guicy.jndi;
+
+/**
+ * Interface which is used to bind an implementation too.
+ *
+ * @author Daniel Manzke
+ *
+ */
+public interface Example {
+ String sayHello();
+
+ void inform();
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/jndi/ExampleApp.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/jndi/ExampleApp.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/jndi/ExampleApp.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/jndi/ExampleApp.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,61 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.integrations.example.guicy.jndi;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.onami.autobind.annotations.Bind;
+import org.apache.onami.autobind.annotations.GuiceModule;
+import org.apache.onami.autobind.configuration.StartupModule;
+import org.apache.onami.autobind.example.starter.ExampleApplication;
+import org.apache.onami.autobind.scanner.ClasspathScanner;
+import org.apache.onami.autobind.scanner.ScannerModule;
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+
+/**
+ * Example Application, which creates a new Injector with the help of the
+ * provided {@link StartupModule}. It passes the {@link ASMClasspathScanner}
+ * class for the {@link ClasspathScanner} and the packages (de.devsurf) which
+ * should be scanned. The {@link StartupModule} binds these parameter, so we are
+ * able to create and inject our {@link ScannerModule}. This Module uses the
+ * {@link ClasspathScanner} to explore the Classpath and scans for Annotations.
+ *
+ * All recognized Classes annotated with {@link GuiceModule} are installed in
+ * the child injector and with {@link Bind} are automatically bound.
+ *
+ * @author Daniel Manzke
+ *
+ */
+@Bind(multiple = true)
+public class ExampleApp implements ExampleApplication {
+ @Override
+ public void run() {
+ try {
+ InitialContext context = new InitialContext();
+ Example example = (Example) context.lookup(Example.class.getName());
+
+ System.out.println(example.sayHello());
+ } catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String[] args) {
+ new ExampleApp().run();
+ }
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/jndi/ExampleImpl.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/jndi/ExampleImpl.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/jndi/ExampleImpl.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/jndi/ExampleImpl.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,42 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.integrations.example.guicy.jndi;
+
+import javax.annotation.PostConstruct;
+
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+
+/**
+ * This class implements the Example interface and is not annotated like the
+ * other Examples, due the fact, that the {@link ExampleModule} will bind it
+ * manually. In this Example the {@link ASMClasspathScanner} is used, to find
+ * the {@link ExampleModule} and automatically install it.
+ *
+ * @author Daniel Manzke
+ *
+ */
+public class ExampleImpl implements Example {
+ @PostConstruct
+ public void inform() {
+ System.out.println("inform about post construction!");
+ }
+
+ @Override
+ public String sayHello() {
+ return "yeahhh!!!";
+ }
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/jndi/ExampleModule.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/jndi/ExampleModule.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/jndi/ExampleModule.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/guicy/jndi/ExampleModule.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,39 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.integrations.example.guicy.jndi;
+
+import org.apache.onami.autobind.annotations.GuiceModule;
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+import com.google.inject.AbstractModule;
+
+
+/**
+ * This is a GuiceModule, which bind the {@link ExampleImpl} to the
+ * {@link Example} interface and it will be recognized by the
+ * {@link ASMClasspathScanner}, due the fact that it is annotated with the
+ * {@link GuiceModule}.
+ *
+ * @author Daniel Manzke
+ *
+ */
+@GuiceModule
+public class ExampleModule extends AbstractModule {
+ @Override
+ protected void configure() {
+ bind(Example.class).to(ExampleImpl.class);
+ }
+}
Propchange: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/
------------------------------------------------------------------------------
bugtraq:number = true
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/Example.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/Example.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/Example.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/Example.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,26 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.integrations.example.rocoto;
+
+/**
+ * Interface which is used to bind an implementation too.
+ *
+ * @author Daniel Manzke
+ *
+ */
+public interface Example {
+ String sayHello();
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/ExampleApp.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/ExampleApp.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/ExampleApp.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/ExampleApp.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,60 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.integrations.example.rocoto;
+
+import org.apache.onami.autobind.annotations.Bind;
+import org.apache.onami.autobind.annotations.GuiceModule;
+import org.apache.onami.autobind.configuration.StartupModule;
+import org.apache.onami.autobind.configuration.features.ConfigurationFeature;
+import org.apache.onami.autobind.example.starter.ExampleApplication;
+import org.apache.onami.autobind.scanner.ClasspathScanner;
+import org.apache.onami.autobind.scanner.PackageFilter;
+import org.apache.onami.autobind.scanner.ScannerModule;
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+
+/**
+ * Example Application, which creates a new Injector with the help of the
+ * provided {@link StartupModule}. It passes the {@link ASMClasspathScanner}
+ * class for the {@link ClasspathScanner} and the packages (de.devsurf) which
+ * should be scanned. The {@link StartupModule} binds these parameter, so we are
+ * able to create and inject our {@link ScannerModule}. This Module uses the
+ * {@link ClasspathScanner} to explore the Classpath and scans for Annotations.
+ *
+ * All recognized Classes annotated with {@link GuiceModule} are installed in
+ * the child injector and with {@link Bind} are automatically bound.
+ *
+ * @author Daniel Manzke
+ *
+ */
+@Bind(multiple = true)
+public class ExampleApp implements ExampleApplication {
+ @Override
+ public void run() {
+ StartupModule startupModule = StartupModule.create(ASMClasspathScanner.class,
+ PackageFilter.create(ExampleApp.class));
+ startupModule.addFeature(ConfigurationFeature.class);
+ Injector injector = Guice.createInjector(startupModule);
+ System.out.println(injector.getInstance(Example.class).sayHello());
+ }
+
+ public static void main(String[] args) {
+ new ExampleApp().run();
+ }
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/ExampleConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/ExampleConfiguration.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/ExampleConfiguration.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/ExampleConfiguration.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,25 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.integrations.example.rocoto;
+
+import org.apache.onami.autobind.configuration.Configuration;
+import org.apache.onami.autobind.configuration.Configuration.Type;
+import org.apache.onami.autobind.configuration.PathConfig;
+
+@Configuration(location = @PathConfig(value = "/configuration.properties"), type = Type.VALUES)
+public interface ExampleConfiguration {
+
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/ExampleImpl.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/ExampleImpl.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/ExampleImpl.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/ExampleImpl.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,43 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.integrations.example.rocoto;
+
+import javax.inject.Named;
+
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+import com.google.inject.Inject;
+
+
+/**
+ * This class implements the Example interface and is not annotated like the
+ * other Examples, due the fact, that the {@link ExampleModule} will bind it
+ * manually. In this Example the {@link ASMClasspathScanner} is used, to find
+ * the {@link ExampleModule} and automatically install it.
+ *
+ * @author Daniel Manzke
+ *
+ */
+public class ExampleImpl implements Example {
+ @Inject
+ @Named("message")
+ private String message;
+
+ @Override
+ public String sayHello() {
+ return "sayHello() - " + message;
+ }
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/ExampleModule.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/ExampleModule.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/ExampleModule.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/integrations/example/rocoto/ExampleModule.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,39 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.integrations.example.rocoto;
+
+import org.apache.onami.autobind.annotations.GuiceModule;
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+import com.google.inject.AbstractModule;
+
+
+/**
+ * This is a GuiceModule, which bind the {@link ExampleImpl} to the
+ * {@link Example} interface and it will be recognized by the
+ * {@link ASMClasspathScanner}, due the fact that it is annotated with the
+ * {@link GuiceModule}.
+ *
+ * @author Daniel Manzke
+ *
+ */
+@GuiceModule
+public class ExampleModule extends AbstractModule {
+ @Override
+ protected void configure() {
+ bind(Example.class).to(ExampleImpl.class);
+ }
+}
Propchange: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/
------------------------------------------------------------------------------
bugtraq:number = true
Propchange: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/
------------------------------------------------------------------------------
bugtraq:number = true
Propchange: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/
------------------------------------------------------------------------------
bugtraq:number = true
Propchange: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/
------------------------------------------------------------------------------
bugtraq:number = true
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/Example.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/Example.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/Example.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/Example.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,26 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.scanner.asm.example.autobind;
+
+/**
+ * Interface which is used to bind an implementation too.
+ *
+ * @author Daniel Manzke
+ *
+ */
+public interface Example {
+ String sayHello();
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/ExampleApp.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/ExampleApp.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/ExampleApp.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/ExampleApp.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,60 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.scanner.asm.example.autobind;
+
+import java.io.IOException;
+
+import org.apache.onami.autobind.annotations.Bind;
+import org.apache.onami.autobind.annotations.GuiceModule;
+import org.apache.onami.autobind.configuration.StartupModule;
+import org.apache.onami.autobind.example.starter.ExampleApplication;
+import org.apache.onami.autobind.scanner.ClasspathScanner;
+import org.apache.onami.autobind.scanner.PackageFilter;
+import org.apache.onami.autobind.scanner.ScannerModule;
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+
+/**
+ * Example Application, which creates a new Injector with the help of the
+ * provided {@link StartupModule}. It passes the {@link ASMClasspathScanner}
+ * class for the {@link ClasspathScanner} and the packages (de.devsurf) which
+ * should be scanned. The {@link StartupModule} binds these parameter, so we are
+ * able to create and inject our {@link ScannerModule}. This Module uses the
+ * {@link ClasspathScanner} to explore the Classpath and scans for Annotations.
+ *
+ * All recognized Classes annotated with {@link GuiceModule} are installed in
+ * the child injector and with {@link Bind} are automatically bound.
+ *
+ * @author Daniel Manzke
+ *
+ */
+@Bind(multiple = true)
+public class ExampleApp implements ExampleApplication {
+ @Override
+ public void run() {
+ Injector injector = Guice.createInjector(StartupModule.create(ASMClasspathScanner.class,
+ PackageFilter.create(ExampleApp.class)));
+
+ System.out.println(injector.getInstance(Example.class).sayHello());
+ }
+
+ public static void main(String[] args) throws IOException {
+ new ExampleApp().run();
+ }
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/ExampleImpl.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/ExampleImpl.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/ExampleImpl.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/ExampleImpl.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,37 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.scanner.asm.example.autobind;
+
+import org.apache.onami.autobind.annotations.Bind;
+import org.apache.onami.autobind.scanner.ClasspathScanner;
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+
+/**
+ * This class implements the Example interface and uses the {@link Bind}-
+ * Annotation, so it will be recognized by the {@link ClasspathScanner}. In this
+ * Example the {@link ASMClasspathScanner} is used.
+ *
+ * @author Daniel Manzke
+ *
+ */
+@Bind
+public class ExampleImpl implements Example {
+ @Override
+ public String sayHello() {
+ return "yeahhh!!!";
+ }
+}
Propchange: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/inherited/
------------------------------------------------------------------------------
bugtraq:number = true
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/inherited/Example.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/inherited/Example.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/inherited/Example.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/inherited/Example.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,26 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.scanner.asm.example.autobind.inherited;
+
+/**
+ * Interface which is used to bind an implementation too.
+ *
+ * @author Daniel Manzke
+ *
+ */
+public interface Example {
+ String sayHello();
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/inherited/ExampleApp.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/inherited/ExampleApp.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/inherited/ExampleApp.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/inherited/ExampleApp.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,60 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.scanner.asm.example.autobind.inherited;
+
+import java.io.IOException;
+
+import org.apache.onami.autobind.annotations.Bind;
+import org.apache.onami.autobind.annotations.GuiceModule;
+import org.apache.onami.autobind.configuration.StartupModule;
+import org.apache.onami.autobind.example.starter.ExampleApplication;
+import org.apache.onami.autobind.scanner.ClasspathScanner;
+import org.apache.onami.autobind.scanner.PackageFilter;
+import org.apache.onami.autobind.scanner.ScannerModule;
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+
+/**
+ * Example Application, which creates a new Injector with the help of the
+ * provided {@link StartupModule}. It passes the {@link ASMClasspathScanner}
+ * class for the {@link ClasspathScanner} and the packages (de.devsurf) which
+ * should be scanned. The {@link StartupModule} binds these parameter, so we are
+ * able to create and inject our {@link ScannerModule}. This Module uses the
+ * {@link ClasspathScanner} to explore the Classpath and scans for Annotations.
+ *
+ * All recognized Classes annotated with {@link GuiceModule} are installed in
+ * the child injector and with {@link Bind} are automatically bound.
+ *
+ * @author Daniel Manzke
+ *
+ */
+@Bind(multiple = true)
+public class ExampleApp implements ExampleApplication {
+ @Override
+ public void run() {
+ Injector injector = Guice.createInjector(StartupModule.create(ASMClasspathScanner.class,
+ PackageFilter.create(ExampleApp.class)));
+
+ System.out.println(injector.getInstance(Example.class).sayHello());
+ }
+
+ public static void main(String[] args) throws IOException {
+ new ExampleApp().run();
+ }
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/inherited/ExampleImpl.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/inherited/ExampleImpl.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/inherited/ExampleImpl.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/inherited/ExampleImpl.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,37 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.scanner.asm.example.autobind.inherited;
+
+import org.apache.onami.autobind.annotations.Bind;
+import org.apache.onami.autobind.scanner.ClasspathScanner;
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+
+/**
+ * This class implements the Example interface and uses the {@link Bind}-
+ * Annotation, so it will be recognized by the {@link ClasspathScanner}. In this
+ * Example the {@link ASMClasspathScanner} is used.
+ *
+ * @author Daniel Manzke
+ *
+ */
+@Bind
+public class ExampleImpl implements Example {
+ @Override
+ public String sayHello() {
+ return "yeahhh!!!";
+ }
+}
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/inherited/InheritedExampleImpl.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/inherited/InheritedExampleImpl.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/inherited/InheritedExampleImpl.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/inherited/InheritedExampleImpl.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,36 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.scanner.asm.example.autobind.inherited;
+
+import org.apache.onami.autobind.annotations.Bind;
+import org.apache.onami.autobind.scanner.ClasspathScanner;
+import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
+
+
+/**
+ * This class implements the Example interface and uses the {@link Bind}-
+ * Annotation, so it will be recognized by the {@link ClasspathScanner}. In this
+ * Example the {@link ASMClasspathScanner} is used.
+ *
+ * @author Daniel Manzke
+ *
+ */
+public class InheritedExampleImpl extends ExampleImpl {
+ @Override
+ public String sayHello() {
+ return "yeahhh I'm inherited!!!";
+ }
+}
Propchange: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/marker/
------------------------------------------------------------------------------
bugtraq:number = true
Added: incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/marker/Example.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/marker/Example.java?rev=1418140&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/marker/Example.java (added)
+++ incubator/onami/trunk/autobind/examples/src/main/java/org/apache/onami/autobind/scanner/asm/example/autobind/marker/Example.java Fri Dec 7 00:11:06 2012
@@ -0,0 +1,26 @@
+/**
+ * Copyright (C) 2010 Daniel Manzke <da...@googlemail.com>
+ *
+ * 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.onami.autobind.scanner.asm.example.autobind.marker;
+
+/**
+ * Interface which is used to bind an implementation too.
+ *
+ * @author Daniel Manzke
+ *
+ */
+public interface Example {
+ String sayHello();
+}