You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2013/01/02 20:45:29 UTC

svn commit: r1427972 [3/3] - in /uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src: main/ main/java/ main/java/org/ main/java/org/apache/ main/java/org/apache/uima/ main/java/org/apache/uima/ducc/ main/java/org/apache/uima/ducc/sm/ main/java/org/apache/uim...

Added: uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/UimaServiceMeta.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/UimaServiceMeta.java?rev=1427972&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/UimaServiceMeta.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/UimaServiceMeta.java Wed Jan  2 19:45:28 2013
@@ -0,0 +1,132 @@
+/*
+ * 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.
+*/
+package org.apache.uima.ducc.sm;
+
+import org.apache.uima.ducc.common.ServiceStatistics;
+import org.apache.uima.ducc.common.UimaAsServiceMonitor;
+import org.apache.uima.ducc.common.utils.DuccLogger;
+
+
+/**
+ * This class runs the watchdog thread that pings a service and maintains the
+ * service state for a service.  There is one object in one thread per service.
+ */
+
+class UimaServiceMeta
+    implements SmConstants,
+               IServiceMeta
+{	
+    private DuccLogger logger = DuccLogger.getLogger(this.getClass().getName(), COMPONENT_NAME);	
+
+    boolean shutdown = false;
+    ServiceSet sset;
+    String endpoint;
+    String broker_host;
+    int broker_port;
+
+    int meta_ping_rate;
+    int meta_ping_stability;
+
+    UimaAsServiceMonitor monitor = null;
+    boolean connected = false;
+
+    UimaServiceMeta(ServiceSet sset, String endpoint, String broker_host, int broker_port)
+    	throws Exception
+    {
+        this.sset = sset;
+        this.endpoint = endpoint;
+        this.broker_host = broker_host;
+        this.broker_port = broker_port;
+        this.meta_ping_rate = ServiceManagerComponent.meta_ping_rate;
+        this.meta_ping_stability = ServiceManagerComponent.meta_ping_stability;
+        this.monitor = new UimaAsServiceMonitor(endpoint, broker_host, broker_port);
+    }
+
+    public ServiceStatistics getServiceStatistics()
+    {
+        if ( monitor == null ) return null;
+        return monitor.getServiceStatistics();
+    }
+
+    public void run()
+    {
+    	String methodName = "run";
+        int missed_pings = 0;
+        while ( true ) {
+            synchronized(this) {
+                if (shutdown) return;
+            }
+
+            if ( ! connected ) {
+                try {
+                    logger.debug(methodName, sset.getId(), "Initializing monitor");
+                    monitor.connect();
+                    connected = true;
+                    logger.debug(methodName, sset.getId(), "Monitor initialized");
+                } catch ( Throwable t ) {
+                    connected = false;
+                    logger.warn(methodName, sset.getId(), t);
+                }
+            }
+
+            try {
+                if ( connected ) {
+                    monitor.collect();
+                } else {
+                    logger.error(methodName, sset.getId(), "Not collecting broler statistics, cannot connect to broker");
+                }
+            } catch ( Throwable t ) {
+                logger.error(methodName, null, "Cannot collect broker statistics.  The queue may have been deleted.  Details:", t);
+                connected = false;
+            }
+
+
+            if ( sset.ping() ) {
+                synchronized(this) {
+                    if (shutdown) return;
+                    sset.setResponsive();
+                }
+                logger.info(methodName, sset.getId(), "Ping ok:", endpoint, monitor.getServiceStatistics().toString());
+                missed_pings = 0;
+            } else {
+                logger.info(methodName, null, "missed_pings", missed_pings, "endpoint", endpoint);
+                if ( ++missed_pings > meta_ping_stability ) {
+                	logger.info(methodName, null, "Seting state to unresponsive, endpoint", endpoint);
+                    sset.setUnresponsive();
+                } else {
+                	logger.info(methodName, null, "Seting state to waiting, endpoint", endpoint);
+                    sset.setWaiting();
+                }
+            }
+
+            try {
+            	logger.trace(methodName, null, "sleeping", meta_ping_rate);
+                Thread.sleep(meta_ping_rate);
+            } catch ( Throwable t ) {
+                // nothing
+            }            
+        }
+    }
+
+    public synchronized void stop()
+    {
+        shutdown = true;
+    }
+}
+

Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/UimaServiceMeta.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/config/ServiceManagerConfiguration.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/config/ServiceManagerConfiguration.java?rev=1427972&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/config/ServiceManagerConfiguration.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/config/ServiceManagerConfiguration.java Wed Jan  2 19:45:28 2013
@@ -0,0 +1,286 @@
+/*
+ * 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.
+*/
+package org.apache.uima.ducc.sm.config;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.JettyHttpComponent;
+import org.apache.uima.ducc.common.config.CommonConfiguration;
+import org.apache.uima.ducc.common.exception.DuccRuntimeException;
+import org.apache.uima.ducc.common.utils.DuccLogger;
+import org.apache.uima.ducc.common.utils.XStreamUtils;
+import org.apache.uima.ducc.sm.ServiceManagerComponent;
+import org.apache.uima.ducc.sm.event.ServiceManagerEventListener;
+import org.apache.uima.ducc.transport.DuccTransportConfiguration;
+import org.apache.uima.ducc.transport.event.AServiceRequest;
+import org.apache.uima.ducc.transport.event.ServiceReplyEvent;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
+
+
+/**
+ * A {@link ServiceManagerConfiguration} to configure Service Manager component. Depends on 
+ * properties loaded by a main program into System properties. 
+ * 
+ */
+@Configuration
+@Import({DuccTransportConfiguration.class,CommonConfiguration.class})
+public class ServiceManagerConfiguration 
+{
+	//	use Spring magic to autowire (instantiate and bind) CommonConfiguration to a local variable
+	@Autowired CommonConfiguration common;
+	//	use Spring magic to autowire (instantiate and bind) DuccTransportConfiguration to a local variable
+	@Autowired DuccTransportConfiguration serviceManagerTransport;
+
+    private DuccLogger logger = DuccLogger.getLogger(this.getClass(), "SM");
+
+
+	/**
+	 * Instantiate {@link ServiceManagerEventListener} which will handle incoming messages.
+	 * 
+	 * @param sm - {@link ServiceManagerComponent} instance
+	 * @return - {@link ServiceManagerEventListener}
+	 */
+	public ServiceManagerEventListener serviceManagerDelegateListener(ServiceManagerComponent sm) {
+		ServiceManagerEventListener smel =  new ServiceManagerEventListener(sm);
+		//smel.setEndpoint(common.jmStateUpdateEndpoint);
+		smel.setEndpoint(common.pmRequestEndpoint);
+		return smel;
+	}
+	/**
+	 * Create a Router to handle incoming messages from a given endpoint. All messages are delegated
+	 * to a provided listener. Note: Camel uses introspection to determine which method to call when
+	 * delegating a message. The name of the method doesnt matter it is the argument that needs
+	 * to match the type of object in the message. If there is no method with a matching argument
+	 * type the message will not be delegated.
+	 * 
+	 * @param endpoint - endpoint where messages are expected
+	 * @param delegate - {@link ServiceManagerEventListener} instance
+	 * @return - initialized {@link RouteBuilder} instance
+	 * 
+	 */
+	public synchronized RouteBuilder routeBuilderForIncomingRequests(final String endpoint, final ServiceManagerEventListener delegate) {
+        return new RouteBuilder() {
+            public void configure() {
+            	from(endpoint)
+            	//from("activemq:topic:tmp-jm-state")
+            	.process(new TransportProcessor())
+            	.bean(delegate);
+            }
+        };
+    }
+
+	/**
+	 * @param endpoint - endpoint where messages are expected
+	 * @param delegate - {@link ServiceManagerEventListener} instance
+	 * @return - initialized {@link RouteBuilder} instance
+	 */
+	/*
+	  
+	public synchronized RouteBuilder routeBuilderForApi(final String endpoint, final ServiceManagerEventListener delegate) 
+	{
+        return new RouteBuilder() {
+            public void configure() {
+            	from(endpoint)
+                    //from("activemq:topic:tmp-jm-state")
+                    .process(new TransportProcessor())
+                    .bean(delegate)
+                    .process(new SmReplyProcessor())   // inject reply object
+                    ;
+            }
+        };
+    }
+*/
+    private RouteBuilder routeBuilderForJetty(final CamelContext context, final ServiceManagerEventListener delegate) throws Exception {
+    
+        return new RouteBuilder() {
+            public void configure() {
+            
+                JettyHttpComponent jettyComponent = new JettyHttpComponent();
+                String port = System.getProperty("ducc.sm.http.port");
+                //ExchangeMonitor xmError = new ExchangeMonitor(LifeStatus.Error, ExchangeType.Receive);
+			
+                context.addComponent("jetty", jettyComponent);
+                onException(Throwable.class).maximumRedeliveries(0).handled(false).process(new ErrorProcessor());
+            
+                from("jetty://http://0.0.0.0:" + port + "/sm")
+                    .unmarshal().xstream()
+                    .bean(delegate)
+                    .process(new SmReplyProcessor())     // inject reply object
+                    .process(new JettyReplyProcessor())  // translate to http response
+                    ;
+            }
+        };
+    }
+
+	private class SmReplyProcessor implements Processor {
+		
+		private SmReplyProcessor() {
+		}
+		
+		public void process(Exchange exchange) throws Exception 
+		{
+            String methodName = "process";                
+            try {
+                logger.info(methodName, null, "Replying");
+                AServiceRequest incoming =  (AServiceRequest) exchange.getIn().getBody();
+                ServiceReplyEvent reply = incoming.getReply();
+                exchange.getIn().setBody(reply);
+            } catch ( Throwable t ) {
+                logger.error(methodName, null, t);
+            }
+		}
+	}
+
+    private class JettyReplyProcessor
+        implements Processor 
+    {
+        public void process(Exchange exchange) throws Exception 
+        {
+            exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 200);
+            exchange.getOut().setHeader("content-type", "text/xml");
+            Object o = exchange.getIn().getBody();
+            if ( o != null ) {
+                String body = XStreamUtils.marshall(o);
+                exchange.getOut().setBody(body);
+                exchange.getOut().setHeader("content-length", body.length());
+            } else {
+                logger.warn("RouteBuilder.configure", null, new DuccRuntimeException("No reply object was provided."));
+                exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 500);
+            } 
+        }
+    }
+
+    public class ErrorProcessor implements Processor {
+        
+        public void process(Exchange exchange) throws Exception {
+            // the caused by exception is stored in a property on the exchange
+            Throwable caused = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
+            exchange.getOut().setBody(XStreamUtils.marshall(caused));
+            logger.error("ErrorProcessor.process", null, caused);
+        }
+    }
+
+	/**
+	 * This class handles a message before it is delegated to a component listener. In this method the message can be enriched,
+	 * logged, etc.
+	 * 
+	 */
+	public class TransportProcessor implements Processor {
+
+		public void process(Exchange exchange) throws Exception {
+//			System.out.println("... SM transport received Event. Body Type:"+exchange.getIn().getBody().getClass().getName());
+//			Destination replyTo = exchange.getIn().getHeader("JMSReplyTo", Destination.class); 
+//			System.out.println("... transport - value of replyTo:" + replyTo);
+		}
+		
+	}
+	
+	
+	/**
+	 * Creates Camel router that will publish Service Manager state at regular intervals.
+	 * 
+	 * @param targetEndpointToReceiveSMStateUpdate - endpoint where to publish SM state 
+	 * @param statePublishRate - how often to publish state
+	 * @return
+	 * @throws Exception
+     * @deprecated
+	 *
+	private RouteBuilder routeBuilderForSMStatePost(final ServiceManager sm, final String targetEndpointToReceiveSMStateUpdate, final int statePublishRate) throws Exception {
+		final ServiceManagerStateProcessor smp =  // an object responsible for generating the state 
+			new ServiceManagerStateProcessor(sm);
+		
+		return new RouteBuilder() {
+		      public void configure() {
+		        from("timer:smStateDumpTimer?fixedRate=true&period=" + statePublishRate)
+		                .process(smp)
+		                .marshal()
+		                .xstream()
+		                .to(targetEndpointToReceiveSMStateUpdate);
+		      }
+		    };
+
+	}
+	*/
+	/**
+	 * Camel Processor responsible for generating Service Manager's state.
+	 * 
+	 *
+	private class ServiceManagerStateProcessor implements Processor {
+		private ServiceManager sm;
+		
+		private ServiceManagerStateProcessor(ServiceManager sm) {
+			this.sm = sm;
+		}
+		public void process(Exchange exchange) throws Exception {
+			// Fetch new state from Job Manager
+			SmStateDuccEvent sse = sm.getState();
+			//	Add the state object to the Message
+			exchange.getIn().setBody(sse);
+		}
+		
+	}
+	*/
+	
+	/**
+	 * Creates and initializes {@link ServiceManagerComponent} instance. @Bean annotation identifies {@link ServiceManagerComponent}
+	 * as a Spring framework Bean which will be managed by Spring container.  
+	 * 
+	 * @return {@link ServiceManagerComponent} instance
+	 * 
+	 * @throws Exception
+	 */
+	@Bean 
+	public ServiceManagerComponent serviceManager() throws Exception {
+		ServiceManagerComponent sm = new ServiceManagerComponent(common.camelContext());
+        //	Instantiate delegate listener to receive incoming messages. 
+        ServiceManagerEventListener delegateListener = this.serviceManagerDelegateListener(sm);
+		//	Inject a dispatcher into the listener in case it needs to send
+		//  a message to another component
+        // delegateListener.setDuccEventDispatcher(serviceManagerTransport.duccEventDispatcher(common.orchestratorStateUpdateEndpoint, sm.getContext()));
+
+        // Set context so SM can send state when it wants to (not on timer)
+        sm.setTransportConfiguration(serviceManagerTransport.duccEventDispatcher(common.smStateUpdateEndpoint, sm.getContext()), 
+                                     common.smStateUpdateEndpoint);
+        
+
+        //delegateListener.setDuccEventDispatcher(serviceManagerTransport.duccEventDispatcher(common.orchestratorAbbreviatedStateUpdateEndpoint, sm.getContext()));
+        //
+
+		//	Inject Camel Router that will delegate messages to Service Manager delegate listener
+        // TODO Not used? OR state messages - incoming
+		// sm.getContext().addRoutes(this.routeBuilderForIncomingRequests(common.orchestratorStateUpdateEndpoint, delegateListener));
+
+        // OR abbreviated state messages - incoming
+		sm.getContext().addRoutes(this.routeBuilderForIncomingRequests(common.orchestratorAbbreviatedStateUpdateEndpoint, delegateListener));
+
+        // API requests - incoming
+		//sm.getContext().addRoutes(this.routeBuilderForApi(common.smRequestEndpoint, delegateListener));
+		sm.getContext().addRoutes(this.routeBuilderForJetty(sm.getContext(), delegateListener));
+
+        // TODO Not used - timer to send state. We now send whenever we get an OR heartbeat.
+		//sm.getContext().addRoutes(this.routeBuilderForSMStatePost(sm, common.smStateUpdateEndpoint, Integer.parseInt(common.smStatePublishRate)));
+		return sm;
+	}
+
+}

Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/config/ServiceManagerConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/event/ServiceManagerEventListener.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/event/ServiceManagerEventListener.java?rev=1427972&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/event/ServiceManagerEventListener.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/event/ServiceManagerEventListener.java Wed Jan  2 19:45:28 2013
@@ -0,0 +1,188 @@
+/*
+ * 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.
+*/
+package org.apache.uima.ducc.sm.event;
+
+import org.apache.camel.Body;
+import org.apache.uima.ducc.common.utils.DuccLogger;
+import org.apache.uima.ducc.sm.IServiceManager;
+import org.apache.uima.ducc.sm.SmConstants;
+import org.apache.uima.ducc.transport.dispatcher.DuccEventDispatcher;
+import org.apache.uima.ducc.transport.event.OrchestratorAbbreviatedStateDuccEvent;
+import org.apache.uima.ducc.transport.event.OrchestratorStateDuccEvent;
+import org.apache.uima.ducc.transport.event.ServiceModifyEvent;
+import org.apache.uima.ducc.transport.event.ServiceQueryEvent;
+import org.apache.uima.ducc.transport.event.ServiceRegisterEvent;
+import org.apache.uima.ducc.transport.event.ServiceReplyEvent;
+import org.apache.uima.ducc.transport.event.ServiceStartEvent;
+import org.apache.uima.ducc.transport.event.ServiceStopEvent;
+import org.apache.uima.ducc.transport.event.ServiceUnregisterEvent;
+import org.apache.uima.ducc.transport.event.delegate.DuccEventDelegateListener;
+
+
+/**
+ * 
+ *
+ */
+public class ServiceManagerEventListener 
+    implements DuccEventDelegateListener,
+               SmConstants
+{
+//	private DuccEventDispatcher eventDispatcher;
+//	private String targetEndpoint;
+	private IServiceManager serviceManager;
+	
+
+	private static DuccLogger logger = DuccLogger.getLogger(ServiceManagerEventListener.class.getName(), COMPONENT_NAME);	
+
+	public ServiceManagerEventListener(IServiceManager serviceManager) 
+    {
+		this.serviceManager = serviceManager;
+	}
+    
+    // TODO not used
+	public void setDuccEventDispatcher( DuccEventDispatcher eventDispatcher ) 
+    {
+//		this.eventDispatcher = eventDispatcher;
+	}
+
+    // TODO not used
+	public void setEndpoint( String endpoint ) 
+    {
+//		this.targetEndpoint = endpoint;
+	}
+
+    private ServiceReplyEvent failureEvent(String message)
+    {
+        return new ServiceReplyEvent(ServiceCode.NOTOK, message, "no.endpoint", null);
+    }
+
+    private ServiceReplyEvent failureEvent()
+    {
+        return failureEvent("Internal error, check SM logs.");
+    }
+
+    // Incoming API requests
+	public void onServiceRegisterEvent(@Body ServiceRegisterEvent duccEvent) 
+        throws Exception 
+    {
+		String methodName = "onServiceRegisterEvent";
+        try {
+            serviceManager.register(duccEvent);
+        } catch ( IllegalStateException e) {
+            duccEvent.setReply(failureEvent(e.getMessage()));
+            logger.error(methodName, null, e);
+        } catch ( Throwable t ) {
+            duccEvent.setReply(failureEvent());
+            logger.error(methodName, null, t);
+        }
+	}
+
+    // Incoming API requests
+	public void onServiceUnregisterEvent(@Body ServiceUnregisterEvent duccEvent) 
+        throws Exception 
+    {
+		String methodName = "onServiceUnregisterEvent";
+        try {
+            serviceManager.unregister(duccEvent);
+        } catch ( Throwable t ) {
+            duccEvent.setReply(failureEvent());
+            logger.error(methodName, null, t);
+        }
+	}
+
+    // Incoming API requests
+	public void onServiceStartEvent(@Body ServiceStartEvent duccEvent) throws Exception 
+    {
+		String methodName = "onServiceStartEvent";
+        try {
+            logger.info(methodName, null, "-------------- Start ----------", duccEvent.toString());
+            serviceManager.start(duccEvent);
+        } catch ( Throwable t ) {
+            duccEvent.setReply(failureEvent());
+            logger.error(methodName, null, t);
+        }
+	}
+
+    // Incoming API requests
+	public void onServiceStopEvent(@Body ServiceStopEvent duccEvent) throws Exception 
+    {
+		String methodName = "onServiceStopEvent";
+        try {
+            serviceManager.stop(duccEvent);
+        } catch ( Throwable t ) {
+            duccEvent.setReply(failureEvent());
+            logger.error(methodName, null, t);
+        }
+	}
+
+    // Incoming API requests
+	public void onServiceModifyEvent(@Body ServiceModifyEvent duccEvent) throws Exception 
+    {
+		String methodName = "onServiceModifyEvent";
+        try {
+            logger.info(methodName, null, "-------------- Modify ----------", duccEvent.toString());
+            serviceManager.modify(duccEvent);
+        } catch ( Throwable t ) {
+            duccEvent.setReply(failureEvent());
+            logger.error(methodName, null, t);
+        }
+	}
+
+    // Incoming API requests
+	public void onServiceQueryEvent(@Body ServiceQueryEvent duccEvent) 
+        throws Exception 
+    {
+		String methodName = "onServiceQueryEvent";
+        try {
+            serviceManager.query(duccEvent);
+        } catch ( Throwable t ) {
+            duccEvent.setReply(failureEvent());
+            logger.error(methodName, null, t);
+        }
+	}
+
+    // TODO OR state - not used any more?
+	public void onOrchestratorStateDuccEvent(@Body OrchestratorStateDuccEvent duccEvent) 
+        throws Exception 
+    {
+		//System.out.println("......... Service Manager Received OrchestratorStateDuccEvent.");
+		//serviceManager.evaluateServiceRequirements(duccEvent.getWorkMap());
+//		DuccEvent de = new StartServiceDuccEvent();
+//		eventDispatcher.dispatch(targetEndpoint, duccEvent);
+	}
+
+    // Abbreviated OR state
+	public void onOrchestratorAbbreviatedStateDuccEvent(@Body OrchestratorAbbreviatedStateDuccEvent duccEvent) 
+        throws Exception 
+    {
+		String methodName = "onOrchestratorAbbreviatedStateDuccEvent";
+		// System.out.println("......... Service Manager Received OrchestratorAbbreviatedStateDuccEvent.");
+		// serviceManager.evaluateServiceRequirements(duccEvent.getWorkMap());
+        try {
+            serviceManager.orchestratorStateArrives(duccEvent.getWorkMap());
+        } catch ( Throwable t ) {
+            logger.error(methodName, null, t);
+        }
+
+		//serviceManager.evaluateServiceRequirements(duccEvent);
+//		DuccEvent de = new StartServiceDuccEvent();
+//		eventDispatcher.dispatch(targetEndpoint, duccEvent);
+	}
+
+}

Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/event/ServiceManagerEventListener.java
------------------------------------------------------------------------------
    svn:eol-style = native