resource

package resource

Package related methods for managed resources.

Visibility
  1. Public
  2. All

Type Members

  1. abstract class AbstractManagedResource[R] extends ManagedResource[R] with ManagedResourceOperations[R]

    Abstract class implementing most of the managed resource features in terms of an open and close method.

  2. final class DefaultManagedResource[R] extends AbstractManagedResource[R]

    This is the default implementation of a ManagedResource that makes use of the Resource type trait.

  3. type ErrorHolder[A] = Either[List[Throwable], A]

    The type used to hold errors and results in the same return value.

    The type used to hold errors and results in the same return value.

    Definition Classes
    package
  4. trait ExtractableManagedResource[+A] extends ManagedResource[A]

    This trait represents a resource that has been modified (or will be modified) inside an ARM block in such a way that the resulting value can be extracted outside of the "ManagedResource" monad.

  5. sealed trait LowPriorityResourceImplicits extends AnyRef

    Trait holding type class implementations for Resource.

  6. trait ManagedResource[+R] extends AnyRef

    This class encapsulates a method of ensuring a resource is opened/closed during critical stages of its lifecycle.

  7. trait ManagedResourceOperations[+R] extends ManagedResource[R]

    This class implements all ManagedResource methods except acquireFor.

  8. trait ManagedTraversable[+B, A] extends Traversable[B]

    This trait provides a means to ensure traversable access to items inside a resource, while ensuring that the resource is opened/closed appropriately before/after the traversal.

  9. sealed trait MediumPriorityResourceImplicits extends LowPriorityResourceImplicits

  10. trait Resource[R] extends AnyRef

    This is a type trait for types that are considered 'resources'.

Value Members

  1. object Resource extends MediumPriorityResourceImplicits

    Companion object to the Resource type trait.

  2. def and[A, B](r1: ManagedResource[A], r2: ManagedResource[B]): ManagedResource[(A, B)] with ManagedResourceOperations[(A, B)]

    Combined two resources such that they are both opened/closed together.

    Combined two resources such that they are both opened/closed together. The first resource is opened before the second resource and closed after the second resource, however the resulting ManagedResource acts like both are opened/closed together.

    returns

    A ManagedResource of a tuple containing the initial two resources.

    Definition Classes
    package
  3. def join[A, MR, CC](resources: CC)(implicit ev0: <:<[CC, Seq[MR]], ev1: <:<[MR, ManagedResource[A]]): ManagedResource[Seq[A]]

    Takes a sequence of ManagedResource objects and traits them as a ManagedResource of a Sequence of Objects.

    Takes a sequence of ManagedResource objects and traits them as a ManagedResource of a Sequence of Objects.

    This is useful for dealing with many resources within the same scope.

    returns

    A ManagedResoruce of a collection of types

    Definition Classes
    package
  4. def makeManagedResource[R](opener: ⇒ R)(closer: (R) ⇒ Unit)(exceptions: List[Class[_ <: Throwable]])(implicit arg0: Manifest[R]): DefaultManagedResource[R]

    Constructs a managed resource using function objects for each abstract method.

    Constructs a managed resource using function objects for each abstract method.

    opener

    The by-name parameter that will open the resource.

    closer

    A closure that will close the resource.

    exceptions

    A list of exception classes that cannot be ignored to close a resource.

    Definition Classes
    package
  5. def managed[A](opener: ⇒ A)(implicit arg0: Resource[A], arg1: Manifest[A]): ManagedResource[A]

    Creates a ManagedResource for any type with a Resource type class implementation.

    Creates a ManagedResource for any type with a Resource type class implementation. This includes all java.io.Closeable subclasses, and any types that have a close or dispose method. You can also provide your own resource type class implementations in your own scope.

    Definition Classes
    package
  6. def withResources[C](f: ⇒ C @util.continuations.package.cps[Either[List[Throwable],C]]): Either[List[Throwable], C]

    Starts block that will use continuation-based resource handling.

    Starts block that will use continuation-based resource handling. This is where you can nest resources directly without having to worry about closing the block. Example:

    Definition Classes
    package