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 2018/05/01 13:23:29 UTC
svn commit: r1830680 - in
/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples:
./ processor/ registry/
Author: cwiklik
Date: Tue May 1 13:23:29 2018
New Revision: 1830680
URL: http://svn.apache.org/viewvc?rev=1830680&view=rev
Log:
UIMA-5756 added examples
Added:
uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/
uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/
uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/CustomProcessorExample.java
uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/SuccessResultExample.java
uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/registry/
uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/registry/RegistryClientExample.java
Added: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/CustomProcessorExample.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/CustomProcessorExample.java?rev=1830680&view=auto
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/CustomProcessorExample.java (added)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/CustomProcessorExample.java Tue May 1 13:23:29 2018
@@ -0,0 +1,48 @@
+/*
+ * 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.ps.service.examples.processor;
+
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.ducc.ps.service.errors.ServiceInitializationException;
+import org.apache.uima.ducc.ps.service.processor.IProcessResult;
+import org.apache.uima.ducc.ps.service.processor.IServiceProcessor;
+import org.apache.uima.util.Level;
+import org.apache.uima.util.Logger;
+
+public class CustomProcessorExample implements IServiceProcessor{
+
+ private Logger logger = UIMAFramework.getLogger(CustomProcessorExample.class);
+ @Override
+ public void initialize() throws ServiceInitializationException {
+ logger.log(Level.INFO,"... initialize() called");
+ }
+
+ @Override
+ public IProcessResult process(String serializedTask) {
+ logger.log(Level.INFO,"... process() called");
+ return new SuccessResultExample("");
+ }
+
+ @Override
+ public void stop() {
+ logger.log(Level.INFO,"... stop() called");
+
+ }
+
+}
Added: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/SuccessResultExample.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/SuccessResultExample.java?rev=1830680&view=auto
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/SuccessResultExample.java (added)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/SuccessResultExample.java Tue May 1 13:23:29 2018
@@ -0,0 +1,54 @@
+/*
+ * 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.ps.service.examples.processor;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import org.apache.uima.ducc.ps.service.processor.IProcessResult;
+
+public class SuccessResultExample implements IProcessResult{
+
+ private Exception exception;
+ private String success;
+
+ public SuccessResultExample(String success) {
+ this.success = success;
+ }
+ public SuccessResultExample(Exception exception) {
+ this.exception = exception;
+ }
+ @Override
+ public boolean terminateProcess() {
+ return false;
+ }
+
+ @Override
+ public String getResult() {
+ return success;
+ }
+
+ @Override
+ public String getError() {
+ StringWriter stackTraceBuffer = new StringWriter();
+ exception.printStackTrace(new PrintWriter(stackTraceBuffer));
+ return stackTraceBuffer.toString();
+ }
+
+}
Added: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/registry/RegistryClientExample.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/registry/RegistryClientExample.java?rev=1830680&view=auto
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/registry/RegistryClientExample.java (added)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/registry/RegistryClientExample.java Tue May 1 13:23:29 2018
@@ -0,0 +1,38 @@
+/*
+ * 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.ps.service.examples.registry;
+
+import org.apache.uima.ducc.ps.service.registry.IRegistryClient;
+import org.apache.uima.ducc.ps.service.registry.RegistryNotAvailableException;
+
+public class RegistryClientExample implements IRegistryClient {
+
+ private String targetURL;
+
+ public RegistryClientExample(String targetURL) {
+ this.targetURL = targetURL;
+ }
+ @Override
+ public String lookUp(String currentTarget) throws RegistryNotAvailableException {
+
+ return targetURL;
+ }
+
+}