org.ops4j.peaberry.util
Class SimpleExport<T>

java.lang.Object
  extended by org.ops4j.peaberry.util.SimpleExport<T>
All Implemented Interfaces:
Export<T>, Import<T>

public class SimpleExport<T>
extends Object
implements Export<T>

A basic mutable Export derived from a single dynamic Import.

Author:
mcculls@gmail.com (Stuart McCulloch)

Constructor Summary
SimpleExport(Import<T> service)
          Create a new Export from the given Import.
 
Method Summary
 Map<String,?> attributes()
          Get the attributes associated with the service.
 void attributes(Map<String,?> newAttributes)
          Update the attributes associated with the exported service.
 boolean available()
          Is the service instance available?
 T get()
          Start using the imported service instance.
 void put(T newInstance)
          Replace the exported service with the given instance.
 void unget()
          Stop using the imported service instance.
 void unput()
          Remove the exported service from the ServiceWatcher.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleExport

public SimpleExport(Import<T> service)
Create a new Export from the given Import.

Parameters:
service - service being exported
Method Detail

get

public T get()
Description copied from interface: Import
Start using the imported service instance.

Specified by:
get in interface Import<T>
Returns:
service instance

attributes

public Map<String,?> attributes()
Description copied from interface: Import
Get the attributes associated with the service.

Specified by:
attributes in interface Import<T>
Returns:
current attribute map

unget

public void unget()
Description copied from interface: Import
Stop using the imported service instance.

Specified by:
unget in interface Import<T>

available

public boolean available()
Description copied from interface: Import
Is the service instance available?

Specified by:
available in interface Import<T>
Returns:
true if the service is available, otherwise false

put

public void put(T newInstance)
Description copied from interface: Export
Replace the exported service with the given instance.

Specified by:
put in interface Export<T>
Parameters:
newInstance - service instance

attributes

public void attributes(Map<String,?> newAttributes)
Description copied from interface: Export
Update the attributes associated with the exported service.

Specified by:
attributes in interface Export<T>
Parameters:
newAttributes - service attributes

unput

public void unput()
Description copied from interface: Export
Remove the exported service from the ServiceWatcher.

Specified by:
unput in interface Export<T>


Copyright © 2006-2012 OPS4J - Open Participation Software for Java. All Rights Reserved.