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/03 23:48:11 UTC

svn commit: r1452150 - in /incubator/onami/trunk/scopes/src/site: apt/ apt/index.apt.vm apt/userguide.apt site.xml

Author: randgalt
Date: Sun Mar  3 22:48:11 2013
New Revision: 1452150

URL: http://svn.apache.org/r1452150
Log:
Added user guide for Scopes module

Added:
    incubator/onami/trunk/scopes/src/site/apt/
    incubator/onami/trunk/scopes/src/site/apt/index.apt.vm   (with props)
    incubator/onami/trunk/scopes/src/site/apt/userguide.apt   (with props)
Modified:
    incubator/onami/trunk/scopes/src/site/site.xml

Added: incubator/onami/trunk/scopes/src/site/apt/index.apt.vm
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/scopes/src/site/apt/index.apt.vm?rev=1452150&view=auto
==============================================================================
--- incubator/onami/trunk/scopes/src/site/apt/index.apt.vm (added)
+++ incubator/onami/trunk/scopes/src/site/apt/index.apt.vm Sun Mar  3 22:48:11 2013
@@ -0,0 +1,45 @@
+                                    ------
+                                    Home
+                                    ------
+                                    The Apache Onami developers team
+                                    ------
+                                     2011-2013
+
+~~
+~~ 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.
+~~
+
+Welcome to ${project.name}!
+
+  ${project.name} adds useful Scopes to {{{http://code.google.com/p/google-guice/}Google Guice}}.
+
+Before starting
+
+  ${project.name} will soon be available on the Maven Central repo, you just need to add the dependency below in your <<<pom.xml>>> file:
+
++--------------------------------------+
+<dependencies>
+  ...
+  <dependency>
+    <groupId>${project.groupId}</groupId>
+    <artifactId>${project.artifactId}</artifactId>
+    <version>${project.version}</version>
+  </dependency>
+  ...
+</dependencies>
++--------------------------------------+

Propchange: incubator/onami/trunk/scopes/src/site/apt/index.apt.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/onami/trunk/scopes/src/site/apt/index.apt.vm
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/onami/trunk/scopes/src/site/apt/index.apt.vm
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/onami/trunk/scopes/src/site/apt/userguide.apt
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/scopes/src/site/apt/userguide.apt?rev=1452150&view=auto
==============================================================================
--- incubator/onami/trunk/scopes/src/site/apt/userguide.apt (added)
+++ incubator/onami/trunk/scopes/src/site/apt/userguide.apt Sun Mar  3 22:48:11 2013
@@ -0,0 +1,89 @@
+                                    ------
+                                    User Guide
+                                    ------
+                                    The Apache Onami developers team
+                                    ------
+                                     2011-2013
+
+~~
+~~ 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.
+~~
+
+User's guide
+
+  <<<org.apache.onami.scopes>>> adds useful Guice Scopes. Include these scopes
+  by adding the ScopesModule to your injector:
+
++--------------------------------------+
+Guice.createInjector( ..., ..., new ScopesModule(), ...);
++--------------------------------------+
+
+* LazySingleton
+
+  Guice can inject instances as a singletons. Depending on the mode that Guice is in,
+  it will lazily create the singletons (i.e. only when they are needed) or eagerly
+  create them (i.e. when the Injector is created). When the Guice mode is set to
+  Stage.PRODUCTION singletons are eagerly created. Guice does not provide a lazy
+  singleton scope.
+
+  You can use lazy singleton either by annotating a class with <<<...@LazySingleton>>>
+  or using the <<<LazySingletonScope>>> when binding. E.g.
+
++--------------------------------------+
+binder.bind(IFace.class).to(Impl.class).in(LazySingletonScope.get())
++--------------------------------------+
+
+** Example Usage
+
+  LazySingleton comes in handy when you need to have fine grained control over when an
+  instance is created. You can do this by using a provider in conjunction with
+  LazySingleton. E.g.
+
++--------------------------------------+
+// an example class
+@LazySingleton
+public class MyClass
+  ...
+
+// inject a provider instead of the instance
+public class Foo
+{
+  private final Provider<MyClass> myClassProvider;
+
+  @Inject
+  public foo(Provider<MyClass> myClassProvider)
+  {
+     this.myClassProvider = myClassProvider;
+  }
+
+  ...
+
+  // somewhere else in the class
+  myClassProvider.get();   // object will be created here
+}
++--------------------------------------+
+
+* ConcurrentLazySingleton
+
+  ConcurrentLazySingleton behaves just like LazySingleton with the addition that it
+  has fine grained concurrency support. Users of Guice may be surprised to learn that
+  Guice's default singleton scope creates objects using a very coarse lock. What this
+  means in practice is that singletons cannot be injected at the same time by two
+  different threads. ConcurrentLazySingleton synchronizes on the object key and, thus,
+  can construct multiple types of singletons concurrently.
+

Propchange: incubator/onami/trunk/scopes/src/site/apt/userguide.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/onami/trunk/scopes/src/site/apt/userguide.apt
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/onami/trunk/scopes/src/site/apt/userguide.apt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/onami/trunk/scopes/src/site/site.xml
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/scopes/src/site/site.xml?rev=1452150&r1=1452149&r2=1452150&view=diff
==============================================================================
--- incubator/onami/trunk/scopes/src/site/site.xml (original)
+++ incubator/onami/trunk/scopes/src/site/site.xml Sun Mar  3 22:48:11 2013
@@ -27,7 +27,8 @@
     </head>
 
     <menu name="Apache Onami™ Scopes">
-      <item name="Home" href="./index.html" />
+      <item name="Home" href="index.html" />
+      <item name="User guide" href="userguide.html" />
     </menu>
 
     <menu ref="reports"/>