Author: rozagh
Date: 2012-04-16 17:11:34 -0700 (Mon, 16 Apr 2012)
New Revision: 28848
Modified:
core3/api/trunk/core-task-api/src/main/java/org/cytoscape/task/AbstractNetworkViewLocationTaskFactory.java
core3/api/trunk/core-task-api/src/main/java/org/cytoscape/task/NetworkViewLocationTaskFactory.java
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/CyServiceRegistrarImpl.java
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/utils/ServiceUtil.java
Log:
Documentation update.
Modified:
core3/api/trunk/core-task-api/src/main/java/org/cytoscape/task/AbstractNetworkViewLocationTaskFactory.java
===================================================================
---
core3/api/trunk/core-task-api/src/main/java/org/cytoscape/task/AbstractNetworkViewLocationTaskFactory.java
2012-04-16 23:03:27 UTC (rev 28847)
+++
core3/api/trunk/core-task-api/src/main/java/org/cytoscape/task/AbstractNetworkViewLocationTaskFactory.java
2012-04-17 00:11:34 UTC (rev 28848)
@@ -9,6 +9,12 @@
import org.cytoscape.view.vizmap.VisualMappingManager;
import org.cytoscape.work.TaskIterator;
+/**
+ * The base class for all of the task factories that need to add a
functionality to the network view
+ * considering a give location (e.g. adding the node in the mouse clicked
location).
+ * @author rozagh
+ *
+ */
public abstract class AbstractNetworkViewLocationTaskFactory implements
NetworkViewLocationTaskFactory{
@Override
Modified:
core3/api/trunk/core-task-api/src/main/java/org/cytoscape/task/NetworkViewLocationTaskFactory.java
===================================================================
---
core3/api/trunk/core-task-api/src/main/java/org/cytoscape/task/NetworkViewLocationTaskFactory.java
2012-04-16 23:03:27 UTC (rev 28847)
+++
core3/api/trunk/core-task-api/src/main/java/org/cytoscape/task/NetworkViewLocationTaskFactory.java
2012-04-17 00:11:34 UTC (rev 28848)
@@ -9,7 +9,7 @@
/**
* An extension of TaskFactory that provides support for
- * tasks to deal with adding node and endge by right click menue.
+ * tasks to deal with adding node and edge by right click menu.
* @CyAPI.Spi.Interface
*/
public interface NetworkViewLocationTaskFactory{
Modified:
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/CyServiceRegistrarImpl.java
===================================================================
---
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/CyServiceRegistrarImpl.java
2012-04-16 23:03:27 UTC (rev 28847)
+++
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/CyServiceRegistrarImpl.java
2012-04-17 00:11:34 UTC (rev 28848)
@@ -2,6 +2,7 @@
package org.cytoscape.service.util.internal;
+import java.lang.annotation.Inherited;
import java.util.Map;
import java.util.HashMap;
import java.util.Dictionary;
@@ -30,6 +31,9 @@
serviceRegistrations = new
HashMap<Class,Map<Object,ServiceRegistration>>();
}
+ /**
+ * {@inheritDoc}
+ */
public void registerAllServices(Object o, Properties props) {
for ( Class c : RegisterUtil.getAllInterfaces(o.getClass()) ) {
if ( !c.getName().startsWith("java") )
@@ -37,6 +41,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public void registerService(Object service, Class serviceClass,
Properties props) {
ServiceUtil.registerService(bc, service, serviceClass, props,
serviceRegistrations);
@@ -44,6 +51,9 @@
}
+ /**
+ * {@inheritDoc}
+ */
public void unregisterAllServices(Object o) {
for ( Class c : RegisterUtil.getAllInterfaces(o.getClass()) ) {
if ( !c.getName().startsWith("java") ) {
@@ -53,6 +63,9 @@
}
+ /**
+ * {@inheritDoc}
+ */
public void unregisterService(Object o, Class c) {
if ( o == null )
throw new NullPointerException( "service object is
null" );
@@ -75,6 +88,9 @@
serviceRegistrations.get(c).remove(o);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public <S> S getService(Class<S> serviceClass) {
@@ -82,7 +98,9 @@
}
-
+ /**
+ * {@inheritDoc}
+ */
@Override
public <S> S getService(Class<S> serviceClass, String filter) {
@@ -90,6 +108,9 @@
return ServiceUtil.getService(bc, serviceClass, filter, null);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void registerServiceListener(Object listener,
String registerMethodName, String unregisterMethodName,
@@ -98,6 +119,9 @@
ServiceUtil.registerServiceListener(bc, listener,
registerMethodName, unregisterMethodName, serviceClass, methodClass,
additionalFilter, null);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void registerServiceListener(Object listener,
String registerMethodName, String unregisterMethodName,
@@ -106,6 +130,9 @@
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void registerServiceListener(Object listener,
String registerMethodName, String unregisterMethodName,
@@ -114,6 +141,9 @@
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void registerServiceListener(Object listener,
String registerMethodName, String unregisterMethodName,
Modified:
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/utils/ServiceUtil.java
===================================================================
---
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/utils/ServiceUtil.java
2012-04-16 23:03:27 UTC (rev 28847)
+++
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/utils/ServiceUtil.java
2012-04-17 00:11:34 UTC (rev 28848)
@@ -9,12 +9,28 @@
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
+/**
+ * Providing a set of functionalities used in common by multiple classes for
services.
+ * @author rozagh
+ *
+ */
public final class ServiceUtil {
private ServiceUtil(){
}
+ /**
+ * A method that attempts to get a service of the specified type. If an
+ * appropriate service is not found, an exception will be thrown.
+ * @param <S> The generic type of the class defining the type of
service desired.
+ * @param bc The BundleContext used to find services.
+ * @param serviceClass The class defining the type of service desired.
+ * @param gottenServices A reference to the list of services that has
been already gotten,
+ * The returned service will be added to this list if the list is not
null.
+ * @return A reference to a service of type serviceClass.
+ * @throws RuntimeException If the requested service can't be found.
+ */
public static <S> S getService(BundleContext bc, Class<S> serviceClass,
List<ServiceReference> gottenServices) {
try {
ServiceReference ref =
bc.getServiceReference(serviceClass.getName());
@@ -29,6 +45,20 @@
}
}
+ /**
+ * A method that attempts to get a service of the specified type and
that
+ * passes the specified filter. If an appropriate service is not found,
an
+ * exception will be thrown.
+ * @param <S> The generic type of the class defining the type of
service desired.
+ * @param bc The BundleContext used to find services.
+ * @param serviceClass The class defining the type of service desired.
+ * @param filter The string defining the filter the service must pass.
See OSGi's
+ * service filtering syntax for more detail.
+ * @param gottenServices A reference to the list of services that has
been already gotten,
+ * The returned service will be added to this list if the list is not
null.
+ * @return A reference to a service of type serviceClass that passes
the specified filter.
+ * @throws RuntimeException If the requested service can't be found.
+ */
public static <S> S getService(BundleContext bc, Class<S> serviceClass,
String filter, List<ServiceReference> gottenServices) {
try {
ServiceReference[] refs =
bc.getServiceReferences(serviceClass.getName(),filter);
@@ -42,6 +72,23 @@
}
}
+
+ /**
+ * A method that will cause the specified register/unregister methods
on the listener
+ * object to be called any time that a service of the specified type is
registered or
+ * unregistered.
+ * @param bc The BundleContext used to find services.
+ * @param listener Your object listening for service registrations.
+ * @param registerMethodName The name of the method to be called when a
service is registered.
+ * @param unregisterMethodName The name of the method to be called when
a service is unregistered.
+ * @param serviceClass The class defining the type of service desired.
+ * @param methodClass There are situations where, because of the use of
generic and type
+ * erasure that the serviceClass is a subclass of the class used by the
registration method,
+ * in which case, this extra argument allows that class to be
specified.
+ * @param additionalFilter An additional filter to be applied to the
OSGi services
+ * @param serviceListeners A reference to the list of service listeners
that has been already registered,
+ * The given service listener will be added to this list if the list is
not null.
+ */
public static void registerServiceListener(final BundleContext bc,
final Object listener, final String registerMethodName,
final String unregisterMethodName, final Class<?>
serviceClass, final Class<?> methodClass, final String additionalFilter ,
List<CyServiceListener> serviceListeners) {
@@ -55,6 +102,17 @@
}
}
+
+ /**
+ * A utility method that registers the specified service object as an
OSGi service of
+ * the specified type.
+ * @param bc The BundleContext used to find services.
+ * @param service The object to be registered as one or more services.
+ * @param serviceClass The class defining the type of service to be
registered.
+ * @param props The service properties to be registered with each
service.
+ * @param serviceRegistrations A reference to the map of the classes
and the objects that register the services.
+ * The service registered by this class will be added to the map if the
reference is not null.
+ */
public static void registerService(final BundleContext bc, final Object
service, final Class<?> serviceClass, final Properties props,
Map<Class,Map<Object,ServiceRegistration>>
serviceRegistrations) {
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.