You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by le...@apache.org on 2015/09/03 10:14:23 UTC
svn commit: r1700947 - in /oodt/branches/avro_rpc: ./ crawler/
crawler/src/main/avro/ crawler/src/main/avro/types/ crawler/src/main/bin/
crawler/src/main/java/org/apache/oodt/cas/crawl/cli/action/
crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/...
Author: lewismc
Date: Thu Sep 3 08:14:22 2015
New Revision: 1700947
URL: http://svn.apache.org/r1700947
Log:
OODT-865 Integrate Avro RPC with the crawler module AND OODT-852 Replace XMLRPC with AvroRPC in the crawler module (prototype)
Added:
oodt/branches/avro_rpc/crawler/src/main/avro/
oodt/branches/avro_rpc/crawler/src/main/avro/types/
oodt/branches/avro_rpc/crawler/src/main/avro/types/protocol.avdl
oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/AvroCrawlDaemonController.java
oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/AvroRpcCrawlerDaemon.java
oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/XmlRpcCrawlDaemonController.java
oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/XmlRpcCrawlerDaemon.java
oodt/branches/avro_rpc/crawler/src/test/java/org/apache/oodt/cas/crawl/daemon/
oodt/branches/avro_rpc/crawler/src/test/java/org/apache/oodt/cas/crawl/daemon/DummyDaemonCrawler.java
oodt/branches/avro_rpc/crawler/src/test/java/org/apache/oodt/cas/crawl/daemon/TestDaemonCrawler.java
Modified:
oodt/branches/avro_rpc/CHANGES.txt
oodt/branches/avro_rpc/crawler/pom.xml
oodt/branches/avro_rpc/crawler/src/main/bin/crawlctl
oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/cli/action/CrawlerLauncherCliAction.java
oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemon.java
oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java
oodt/branches/avro_rpc/mvn/archetypes/radix/src/main/resources/archetype-resources/crawler/src/main/resources/bin/crawlctl
oodt/branches/avro_rpc/pcs/core/src/main/java/org/apache/oodt/pcs/tools/PCSHealthMonitor.java
Modified: oodt/branches/avro_rpc/CHANGES.txt
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/CHANGES.txt?rev=1700947&r1=1700946&r2=1700947&view=diff
==============================================================================
--- oodt/branches/avro_rpc/CHANGES.txt (original)
+++ oodt/branches/avro_rpc/CHANGES.txt Thu Sep 3 08:14:22 2015
@@ -1,5 +1,11 @@
Apache OODT Change Log
======================
+
+Current Development
+
+* OODT-865 Integrate Avro RPC with the crawler module
+ OODT-852 Replace XMLRPC with AvroRPC in the crawler module (prototype) (Radu Manole, mattmann, lewismc)
+
Release 0.10 - 08/30/2015
* OODT-246 Give user the ability to print a detailed report on what jobs in
Modified: oodt/branches/avro_rpc/crawler/pom.xml
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/crawler/pom.xml?rev=1700947&r1=1700946&r2=1700947&view=diff
==============================================================================
--- oodt/branches/avro_rpc/crawler/pom.xml (original)
+++ oodt/branches/avro_rpc/crawler/pom.xml Thu Sep 3 08:14:22 2015
@@ -35,6 +35,27 @@ the License.
<build>
<plugins>
<plugin>
+ <groupId>org.apache.avro</groupId>
+ <artifactId>avro-maven-plugin</artifactId>
+ <version>1.7.7</version>
+ <configuration>
+ <stringType>String</stringType>
+ <detail>true</detail>
+ </configuration>
+ <executions>
+ <execution>
+ <id>protocol</id>
+ <configuration><imports>
+ <import>${basedir}/src/main/avro/types</import>
+ </imports>
+ </configuration>
+ <goals>
+ <goal>idl-protocol</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4</version>
<configuration>
@@ -86,12 +107,23 @@ the License.
<include>crawler-beans.xml</include>
<include>crawler-config.xml</include>
<include>precondition-beans.xml</include>
+ <include>naming-beans.xml</include>
</includes>
</resource>
</resources>
</build>
<dependencies>
<dependency>
+ <groupId>org.apache.avro</groupId>
+ <artifactId>avro</artifactId>
+ <version>1.7.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.avro</groupId>
+ <artifactId>avro-ipc</artifactId>
+ <version>1.7.7</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.oodt</groupId>
<artifactId>oodt-commons</artifactId>
<version>${project.parent.version}</version>
Added: oodt/branches/avro_rpc/crawler/src/main/avro/types/protocol.avdl
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/crawler/src/main/avro/types/protocol.avdl?rev=1700947&view=auto
==============================================================================
--- oodt/branches/avro_rpc/crawler/src/main/avro/types/protocol.avdl (added)
+++ oodt/branches/avro_rpc/crawler/src/main/avro/types/protocol.avdl Thu Sep 3 08:14:22 2015
@@ -0,0 +1,18 @@
+@namespace("org.apache.oodt.cas.crawler.structs.avrotypes")
+protocol IntAvroCrawlDaemon {
+
+ double rpcGetAverageCrawlTime();
+
+ int rpcGetMilisCrawling();
+
+ int rpcGetWaitInterval();
+
+ int rpcGetNumCrawls();
+
+ boolean rpcIsRunning();
+
+ boolean rpcStop();
+
+ void rpcSetWaitInterval(long waitInterval);
+
+}
\ No newline at end of file
Modified: oodt/branches/avro_rpc/crawler/src/main/bin/crawlctl
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/crawler/src/main/bin/crawlctl?rev=1700947&r1=1700946&r2=1700947&view=diff
==============================================================================
--- oodt/branches/avro_rpc/crawler/src/main/bin/crawlctl (original)
+++ oodt/branches/avro_rpc/crawler/src/main/bin/crawlctl Thu Sep 3 08:14:22 2015
@@ -15,4 +15,4 @@
# under the License.
##########################################################################
-java -Djava.util.logging.config.file=../etc/logging.properties -Djava.ext.dirs=../lib org.apache.oodt.cas.crawl.daemon.CrawlDaemonController $*
+java -Djava.util.logging.config.file=../etc/logging.properties -Djava.ext.dirs=../lib org.apache.oodt.cas.crawl.daemon.AvroCrawlDaemonController $*
Modified: oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/cli/action/CrawlerLauncherCliAction.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/cli/action/CrawlerLauncherCliAction.java?rev=1700947&r1=1700946&r2=1700947&view=diff
==============================================================================
--- oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/cli/action/CrawlerLauncherCliAction.java (original)
+++ oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/cli/action/CrawlerLauncherCliAction.java Thu Sep 3 08:14:22 2015
@@ -20,9 +20,9 @@ package org.apache.oodt.cas.crawl.cli.ac
import org.apache.oodt.cas.cli.action.CmdLineAction;
import org.apache.oodt.cas.cli.exception.CmdLineActionException;
import org.apache.oodt.cas.crawl.ProductCrawler;
-import org.apache.oodt.cas.crawl.daemon.CrawlDaemon;
//Spring imports
+import org.apache.oodt.cas.crawl.daemon.AvroRpcCrawlerDaemon;
import org.springframework.context.support.FileSystemXmlApplicationContext;
/**
@@ -52,7 +52,7 @@ public class CrawlerLauncherCliAction ex
.getBean(crawlerId != null ? crawlerId : getName());
pc.setApplicationContext(appContext);
if (pc.getDaemonPort() != -1 && pc.getDaemonWait() != -1) {
- new CrawlDaemon(pc.getDaemonWait(), pc, pc.getDaemonPort())
+ new AvroRpcCrawlerDaemon(pc.getDaemonWait(), pc, pc.getDaemonPort())
.startCrawling();
} else {
pc.crawl();
Added: oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/AvroCrawlDaemonController.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/AvroCrawlDaemonController.java?rev=1700947&view=auto
==============================================================================
--- oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/AvroCrawlDaemonController.java (added)
+++ oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/AvroCrawlDaemonController.java Thu Sep 3 08:14:22 2015
@@ -0,0 +1,191 @@
+/*
+ * 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.oodt.cas.crawl.daemon;
+
+import org.apache.avro.AvroRemoteException;
+import org.apache.avro.ipc.NettyTransceiver;
+import org.apache.avro.ipc.Transceiver;
+import org.apache.avro.ipc.specific.SpecificRequestor;
+import org.apache.oodt.cas.crawl.structs.exceptions.CrawlException;
+import org.apache.oodt.cas.crawler.structs.avrotypes.IntAvroCrawlDaemon;
+import org.apache.oodt.cas.workflow.structs.exceptions.InstanceRepositoryException;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public class AvroCrawlDaemonController implements CrawlDaemonController {
+
+ private Transceiver client = null;
+
+ private IntAvroCrawlDaemon proxy;
+
+ private URL url;
+
+ public AvroCrawlDaemonController(String crawlUrlStr)
+ throws InstantiationException, InstanceRepositoryException {
+ try {
+ url = new URL(crawlUrlStr);
+
+ this.client = new NettyTransceiver(new InetSocketAddress(url.getHost(),url.getPort()));
+ proxy = SpecificRequestor.getClient(IntAvroCrawlDaemon.class, client);
+
+ } catch (MalformedURLException e) {
+ throw new InstantiationException(e.getMessage());
+ } catch (IOException e) {
+ throw new InstanceRepositoryException(e.getMessage());
+ }
+ }
+
+
+ @Override
+ public double getAverageCrawlTime() throws CrawlException {
+ double avgCrawlTime = -1.0d;
+ try {
+ avgCrawlTime = proxy.rpcGetAverageCrawlTime();
+ } catch (AvroRemoteException e) {
+ throw new CrawlException(e.getMessage());
+ }
+ return avgCrawlTime;
+ }
+
+ @Override
+ public int getMilisCrawling() throws CrawlException {
+ int milisCrawling = -1;
+ try {
+ milisCrawling = proxy.rpcGetMilisCrawling();
+ } catch (AvroRemoteException e) {
+ throw new CrawlException(e.getMessage());
+ }
+ return milisCrawling;
+ }
+
+ @Override
+ public int getWaitInterval() throws CrawlException {
+ int waitInterval = -1;
+ try {
+ waitInterval = proxy.rpcGetWaitInterval();
+ } catch (AvroRemoteException e) {
+ throw new CrawlException(e.getMessage());
+ }
+ return waitInterval;
+ }
+
+ @Override
+ public int getNumCrawls() throws CrawlException {
+ int numCrawls = -1;
+ try {
+ numCrawls = proxy.rpcGetNumCrawls();
+ } catch (AvroRemoteException e) {
+ throw new CrawlException(e.getMessage());
+ }
+ return numCrawls;
+ }
+
+ @Override
+ public boolean isRunning() throws CrawlException {
+ boolean running = false;
+ try {
+ running = proxy.rpcIsRunning();
+ }catch (AvroRemoteException e) {
+ throw new CrawlException(e.getMessage());
+ }
+ return running;
+ }
+
+ @Override
+ public void stop() throws CrawlException {
+ boolean running = false;
+ try {
+ running = proxy.rpcStop();
+ } catch (AvroRemoteException e) {
+ throw new CrawlException(e.getMessage());
+ }
+ if (running) {
+ throw new CrawlException("Stop attempt failed: crawl daemon: ["
+ + this.url + "] still running");
+ }
+ }
+
+ @Override
+ public URL getUrl() {
+ return url;
+ }
+
+ public static void main(String[] args) throws Exception {
+ String avgCrawlOperation = "--getAverageCrawlTime\n";
+ String getMilisCrawlOperation = "--getMilisCrawling\n";
+ String getNumCrawlsOperation = "--getNumCrawls\n";
+ String getWaitIntervalOperation = "--getWaitInterval\n";
+ String isRunningOperation = "--isRunning\n";
+ String stopOperation = "--stop\n";
+
+ String usage = "CrawlController --url <url to avro rpc service> --operation [<operation> [params]]\n"
+ + "operations:\n"
+ + avgCrawlOperation
+ + getMilisCrawlOperation
+ + getNumCrawlsOperation
+ + getWaitIntervalOperation
+ + isRunningOperation + stopOperation;
+
+ String operation = null, url = null;
+
+ for (int i = 0; i < args.length; i++) {
+ if (args[i].equals("--operation")) {
+ operation = args[++i];
+ } else if (args[i].equals("--url")) {
+ url = args[++i];
+ }
+ }
+
+ if (operation == null) {
+ System.err.println(usage);
+ System.exit(1);
+ }
+
+ // create the controller
+ CrawlDaemonController controller = new AvroCrawlDaemonController(url);
+
+ if (operation.equals("--getAverageCrawlTime")) {
+ double avgCrawlTime = controller.getAverageCrawlTime();
+ System.out.println("Average Crawl Time: [" + avgCrawlTime + "]");
+ } else if (operation.equals("--getMilisCrawling")) {
+ int crawlTime = controller.getMilisCrawling();
+ System.out.println("Total Crawl Time: [" + crawlTime
+ + "] miliseconds");
+ } else if (operation.equals("--getNumCrawls")) {
+ int numCrawls = controller.getNumCrawls();
+ System.out.println("Num Crawls: [" + numCrawls + "]");
+ } else if (operation.equals("--getWaitInterval")) {
+ int waitInterval = controller.getWaitInterval();
+ System.out.println("Wait Interval: [" + waitInterval + "]");
+ } else if (operation.equals("--isRunning")) {
+ boolean running = controller.isRunning();
+ System.out.println(running ? "Yes" : "No");
+ } else if (operation.equals("--stop")) {
+ controller.stop();
+ System.out.println("Crawl Daemon: [" + controller.getUrl()
+ + "]: shutdown successful");
+ } else
+ throw new IllegalArgumentException("Unknown Operation!");
+
+ }
+
+
+}
Added: oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/AvroRpcCrawlerDaemon.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/AvroRpcCrawlerDaemon.java?rev=1700947&view=auto
==============================================================================
--- oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/AvroRpcCrawlerDaemon.java (added)
+++ oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/AvroRpcCrawlerDaemon.java Thu Sep 3 08:14:22 2015
@@ -0,0 +1,78 @@
+/*
+ * 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.oodt.cas.crawl.daemon;
+
+import org.apache.avro.AvroRemoteException;
+import org.apache.avro.ipc.NettyServer;
+import org.apache.avro.ipc.Server;
+import org.apache.avro.ipc.specific.SpecificResponder;
+import org.apache.oodt.cas.crawl.ProductCrawler;
+import org.apache.oodt.cas.crawler.structs.avrotypes.IntAvroCrawlDaemon;
+
+import java.net.InetSocketAddress;
+
+public class AvroRpcCrawlerDaemon extends CrawlDaemon implements IntAvroCrawlDaemon {
+
+ public AvroRpcCrawlerDaemon(int wait, ProductCrawler crawler, int port) {
+ super(wait,crawler,port);
+ }
+
+ @Override
+ public void startCrawling() {
+ Server server = new NettyServer(new SpecificResponder(IntAvroCrawlDaemon.class,this), new InetSocketAddress(this.getDaemonPort()));
+ server.start();
+ this.crawl();
+ server.close();
+ }
+
+ @Override
+ public double rpcGetAverageCrawlTime() throws AvroRemoteException {
+ return this.getAverageCrawlTime();
+ }
+
+ @Override
+ public int rpcGetMilisCrawling() throws AvroRemoteException {
+ return this.getMilisCrawling();
+ }
+
+ @Override
+ public int rpcGetWaitInterval() throws AvroRemoteException {
+ return this.getWaitInterval();
+ }
+
+ @Override
+ public int rpcGetNumCrawls() throws AvroRemoteException {
+ return this.getNumCrawls();
+ }
+
+ @Override
+ public boolean rpcIsRunning() throws AvroRemoteException {
+ return this.isRunning();
+ }
+
+ @Override
+ public boolean rpcStop() throws AvroRemoteException {
+ return this.stop();
+ }
+
+ @Override
+ public Void rpcSetWaitInterval(long waitInterval) throws AvroRemoteException {
+ this.setWaitInterval(waitInterval);
+ return null;
+ }
+}
Modified: oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemon.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemon.java?rev=1700947&r1=1700946&r2=1700947&view=diff
==============================================================================
--- oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemon.java (original)
+++ oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemon.java Thu Sep 3 08:14:22 2015
@@ -15,30 +15,15 @@
* limitations under the License.
*/
-
package org.apache.oodt.cas.crawl.daemon;
-//OODT imports
import org.apache.oodt.cas.crawl.ProductCrawler;
-//JDK imports
+import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
-//APACHE imports
-import org.apache.xmlrpc.WebServer;
-
-/**
- * @author mattmann
- * @version $Revision$
- *
- * <p>
- * A daemon utility class for {@link ProductCrawler}s that allows a regular
- * ProductCrawler to be run as a daemon, and statistics about crawling to be
- * kept. The daemon is an XML-RPC accessible web service.
- * </p>.
- */
-public class CrawlDaemon {
+public abstract class CrawlDaemon {
/* our log stream */
private static Logger LOG = Logger.getLogger(CrawlDaemon.class.getName());
@@ -67,12 +52,7 @@ public class CrawlDaemon {
this.daemonPort = port;
}
- public void startCrawling() {
- // start up the web server
- WebServer server = new WebServer(this.daemonPort);
- server.addHandler("crawldaemon", this);
- server.start();
-
+ public void crawl(){
LOG.log(Level.INFO, "Crawl Daemon started by "
+ System.getProperty("user.name", "unknown"));
@@ -96,9 +76,10 @@ public class CrawlDaemon {
LOG.log(Level.INFO, "Num Crawls: [" + this.numCrawls + "]");
LOG.log(Level.INFO, "Total time spent crawling: ["
+ (this.milisCrawling / 1000.0) + "] seconds");
+
LOG.log(Level.INFO, "Average Crawl Time: ["
+ (this.getAverageCrawlTime() / 1000.0) + "] seconds");
- server.shutdown();
+
}
public double getAverageCrawlTime() {
@@ -108,6 +89,7 @@ public class CrawlDaemon {
/**
* @return the crawler
*/
+
public ProductCrawler getCrawler() {
return crawler;
}
@@ -116,6 +98,7 @@ public class CrawlDaemon {
* @param crawler
* the crawler to set
*/
+
public void setCrawler(ProductCrawler crawler) {
this.crawler = crawler;
}
@@ -123,6 +106,7 @@ public class CrawlDaemon {
/**
* @return the milisCrawling
*/
+
public int getMilisCrawling() {
return (int) milisCrawling;
}
@@ -131,6 +115,7 @@ public class CrawlDaemon {
* @param milisCrawling
* the milisCrawling to set
*/
+
public void setMilisCrawling(long milisCrawling) {
this.milisCrawling = milisCrawling;
}
@@ -138,6 +123,7 @@ public class CrawlDaemon {
/**
* @return the numCrawls
*/
+
public int getNumCrawls() {
return numCrawls;
}
@@ -146,6 +132,7 @@ public class CrawlDaemon {
* @param numCrawls
* the numCrawls to set
*/
+
public void setNumCrawls(int numCrawls) {
this.numCrawls = numCrawls;
}
@@ -153,6 +140,7 @@ public class CrawlDaemon {
/**
* @return the running
*/
+
public boolean isRunning() {
return running;
}
@@ -161,6 +149,7 @@ public class CrawlDaemon {
* @param running
* the running to set
*/
+
public boolean stop() {
this.running = false;
return this.running;
@@ -169,6 +158,7 @@ public class CrawlDaemon {
/**
* @return the waitInterval
*/
+
public int getWaitInterval() {
return (int) waitInterval;
}
@@ -177,13 +167,15 @@ public class CrawlDaemon {
* @param waitInterval
* the waitInterval to set
*/
+
public void setWaitInterval(long waitInterval) {
this.waitInterval = waitInterval;
}
- private static void main(String[] args) throws InstantiationException {
- throw new InstantiationException(
- "Don't call a crawl daemon by its main function!");
+ public int getDaemonPort(){
+ return daemonPort;
}
+ abstract public void startCrawling();
+
}
Modified: oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java?rev=1700947&r1=1700946&r2=1700947&view=diff
==============================================================================
--- oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java (original)
+++ oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java Thu Sep 3 08:14:22 2015
@@ -15,204 +15,25 @@
* limitations under the License.
*/
-
package org.apache.oodt.cas.crawl.daemon;
-//OODT imports
import org.apache.oodt.cas.crawl.structs.exceptions.CrawlException;
-//JDK imports
-import java.io.IOException;
-import java.net.MalformedURLException;
import java.net.URL;
-import java.util.Vector;
-//APACHE imports
-import org.apache.xmlrpc.XmlRpcClient;
-import org.apache.xmlrpc.XmlRpcException;
-
-/**
- * @author mattmann
- * @version $Revision$
- *
- * <p>
- * A Controller class for the Crawl Daemons
- * </p>.
- */
-public class CrawlDaemonController {
+public interface CrawlDaemonController {
+
+ double getAverageCrawlTime() throws CrawlException;
+
+ int getMilisCrawling() throws CrawlException;
+
+ int getWaitInterval() throws CrawlException;
- /* our xml rpc client */
- private XmlRpcClient client = null;
+ int getNumCrawls() throws CrawlException;
- public CrawlDaemonController(String crawlUrlStr)
- throws InstantiationException {
- try {
- client = new XmlRpcClient(new URL(crawlUrlStr));
- } catch (MalformedURLException e) {
- throw new InstantiationException(e.getMessage());
- }
- }
-
- public double getAverageCrawlTime() throws CrawlException {
- Vector argList = new Vector();
-
- double avgCrawlTime = -1.0d;
-
- try {
- avgCrawlTime = ((Double) client.execute(
- "crawldaemon.getAverageCrawlTime", argList)).doubleValue();
- } catch (XmlRpcException e) {
- throw new CrawlException(e.getMessage());
- } catch (IOException e) {
- throw new CrawlException(e.getMessage());
- }
-
- return avgCrawlTime;
- }
-
- public int getMilisCrawling() throws CrawlException {
- Vector argList = new Vector();
-
- int milisCrawling = -1;
-
- try {
- milisCrawling = ((Integer) client.execute(
- "crawldaemon.getMilisCrawling", argList)).intValue();
- } catch (XmlRpcException e) {
- throw new CrawlException(e.getMessage());
- } catch (IOException e) {
- throw new CrawlException(e.getMessage());
- }
-
- return milisCrawling;
- }
-
- public int getWaitInterval() throws CrawlException {
- Vector argList = new Vector();
-
- int waitInterval = -1;
-
- try {
- waitInterval = ((Integer) client.execute(
- "crawldaemon.getWaitInterval", argList)).intValue();
- } catch (XmlRpcException e) {
- throw new CrawlException(e.getMessage());
- } catch (IOException e) {
- throw new CrawlException(e.getMessage());
- }
-
- return waitInterval;
- }
-
- public int getNumCrawls() throws CrawlException {
- Vector argList = new Vector();
- int numCrawls = -1;
-
- try {
- numCrawls = ((Integer) client.execute("crawldaemon.getNumCrawls",
- argList)).intValue();
- } catch (XmlRpcException e) {
- throw new CrawlException(e.getMessage());
- } catch (IOException e) {
- throw new CrawlException(e.getMessage());
- }
-
- return numCrawls;
-
- }
-
- public boolean isRunning() throws CrawlException {
- Vector argList = new Vector();
- boolean running = false;
-
- try {
- running = ((Boolean) client.execute("crawldaemon.isRunning",
- argList)).booleanValue();
- } catch (XmlRpcException e) {
- throw new CrawlException(e.getMessage());
- } catch (IOException e) {
- throw new CrawlException(e.getMessage());
- }
-
- return running;
- }
-
- public void stop() throws CrawlException {
- Vector argList = new Vector();
- boolean running = false;
-
- try {
- running = ((Boolean) client.execute("crawldaemon.stop", argList))
- .booleanValue();
- } catch (XmlRpcException e) {
- throw new CrawlException(e.getMessage());
- } catch (IOException e) {
- throw new CrawlException(e.getMessage());
- }
-
- if (running) {
- throw new CrawlException("Stop attempt failed: crawl daemon: ["
- + this.client.getURL() + "] still running");
- }
- }
-
- public static void main(String[] args) throws Exception {
- String avgCrawlOperation = "--getAverageCrawlTime\n";
- String getMilisCrawlOperation = "--getMilisCrawling\n";
- String getNumCrawlsOperation = "--getNumCrawls\n";
- String getWaitIntervalOperation = "--getWaitInterval\n";
- String isRunningOperation = "--isRunning\n";
- String stopOperation = "--stop\n";
-
- String usage = "CrawlController --url <url to xml rpc service> --operation [<operation> [params]]\n"
- + "operations:\n"
- + avgCrawlOperation
- + getMilisCrawlOperation
- + getNumCrawlsOperation
- + getWaitIntervalOperation
- + isRunningOperation + stopOperation;
-
- String operation = null, url = null;
-
- for (int i = 0; i < args.length; i++) {
- if (args[i].equals("--operation")) {
- operation = args[++i];
- } else if (args[i].equals("--url")) {
- url = args[++i];
- }
- }
-
- if (operation == null) {
- System.err.println(usage);
- System.exit(1);
- }
-
- // create the controller
- CrawlDaemonController controller = new CrawlDaemonController(url);
-
- if (operation.equals("--getAverageCrawlTime")) {
- double avgCrawlTime = controller.getAverageCrawlTime();
- System.out.println("Average Crawl Time: [" + avgCrawlTime + "]");
- } else if (operation.equals("--getMilisCrawling")) {
- int crawlTime = controller.getMilisCrawling();
- System.out.println("Total Crawl Time: [" + crawlTime
- + "] miliseconds");
- } else if (operation.equals("--getNumCrawls")) {
- int numCrawls = controller.getNumCrawls();
- System.out.println("Num Crawls: [" + numCrawls + "]");
- } else if (operation.equals("--getWaitInterval")) {
- int waitInterval = controller.getWaitInterval();
- System.out.println("Wait Interval: [" + waitInterval + "]");
- } else if (operation.equals("--isRunning")) {
- boolean running = controller.isRunning();
- System.out.println(running ? "Yes" : "No");
- } else if (operation.equals("--stop")) {
- controller.stop();
- System.out.println("Crawl Daemon: [" + controller.client.getURL()
- + "]: shutdown successful");
- } else
- throw new IllegalArgumentException("Unknown Operation!");
+ boolean isRunning() throws CrawlException;
- }
+ void stop() throws CrawlException;
+ URL getUrl();
}
Added: oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/XmlRpcCrawlDaemonController.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/XmlRpcCrawlDaemonController.java?rev=1700947&view=auto
==============================================================================
--- oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/XmlRpcCrawlDaemonController.java (added)
+++ oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/XmlRpcCrawlDaemonController.java Thu Sep 3 08:14:22 2015
@@ -0,0 +1,229 @@
+/*
+ * 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.oodt.cas.crawl.daemon;
+
+//OODT imports
+import org.apache.oodt.cas.crawl.structs.exceptions.CrawlException;
+
+//JDK imports
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Vector;
+
+//APACHE imports
+import org.apache.xmlrpc.XmlRpcClient;
+import org.apache.xmlrpc.XmlRpcException;
+
+/**
+ * @author mattmann
+ * @version $Revision$
+ *
+ * <p>
+ * A Controller class for the Crawl Daemons
+ * </p>.
+ */
+public class XmlRpcCrawlDaemonController implements CrawlDaemonController {
+
+ /* our xml rpc client */
+ private XmlRpcClient client = null;
+
+ public XmlRpcCrawlDaemonController(String crawlUrlStr)
+ throws InstantiationException {
+ try {
+ client = new XmlRpcClient(new URL(crawlUrlStr));
+ } catch (MalformedURLException e) {
+ throw new InstantiationException(e.getMessage());
+ }
+ }
+
+ @Override
+ public double getAverageCrawlTime() throws CrawlException {
+ Vector argList = new Vector();
+
+ double avgCrawlTime = -1.0d;
+
+ try {
+ avgCrawlTime = ((Double) client.execute(
+ "crawldaemon.rpcGetAverageCrawlTime", argList)).doubleValue();
+ } catch (XmlRpcException e) {
+ throw new CrawlException(e.getMessage());
+ } catch (IOException e) {
+ throw new CrawlException(e.getMessage());
+ }
+
+ return avgCrawlTime;
+ }
+
+ @Override
+ public int getMilisCrawling() throws CrawlException {
+ Vector argList = new Vector();
+
+ int milisCrawling = -1;
+
+ try {
+ milisCrawling = ((Integer) client.execute(
+ "crawldaemon.rpcGetMilisCrawling", argList)).intValue();
+ } catch (XmlRpcException e) {
+ throw new CrawlException(e.getMessage());
+ } catch (IOException e) {
+ throw new CrawlException(e.getMessage());
+ }
+
+ return milisCrawling;
+ }
+
+ @Override
+ public int getWaitInterval() throws CrawlException {
+ Vector argList = new Vector();
+
+ int waitInterval = -1;
+
+ try {
+ waitInterval = ((Integer) client.execute(
+ "crawldaemon.rpcGetWaitInterval", argList)).intValue();
+ } catch (XmlRpcException e) {
+ throw new CrawlException(e.getMessage());
+ } catch (IOException e) {
+ throw new CrawlException(e.getMessage());
+ }
+
+ return waitInterval;
+ }
+
+ @Override
+ public int getNumCrawls() throws CrawlException {
+ Vector argList = new Vector();
+ int numCrawls = -1;
+
+ try {
+ numCrawls = ((Integer) client.execute("crawldaemon.rpcGetNumCrawls",
+ argList)).intValue();
+ } catch (XmlRpcException e) {
+ throw new CrawlException(e.getMessage());
+ } catch (IOException e) {
+ throw new CrawlException(e.getMessage());
+ }
+
+ return numCrawls;
+
+ }
+
+ @Override
+ public boolean isRunning() throws CrawlException {
+ Vector argList = new Vector();
+ boolean running = false;
+
+ try {
+ running = ((Boolean) client.execute("crawldaemon.rpcIsRunning",
+ argList)).booleanValue();
+ } catch (XmlRpcException e) {
+ throw new CrawlException(e.getMessage());
+ } catch (IOException e) {
+ throw new CrawlException(e.getMessage());
+ }
+
+ return running;
+ }
+
+ @Override
+ public void stop() throws CrawlException {
+ Vector argList = new Vector();
+ boolean running = false;
+
+ try {
+ running = ((Boolean) client.execute("crawldaemon.rpcStop", argList))
+ .booleanValue();
+ } catch (XmlRpcException e) {
+ throw new CrawlException(e.getMessage());
+ } catch (IOException e) {
+ throw new CrawlException(e.getMessage());
+ }
+
+ if (running) {
+ throw new CrawlException("Stop attempt failed: crawl daemon: ["
+ + this.client.getURL() + "] still running");
+ }
+ }
+
+ @Override
+ public URL getUrl() {
+ return client.getURL();
+ }
+
+ public static void main(String[] args) throws Exception {
+ String avgCrawlOperation = "--getAverageCrawlTime\n";
+ String getMilisCrawlOperation = "--getMilisCrawling\n";
+ String getNumCrawlsOperation = "--getNumCrawls\n";
+ String getWaitIntervalOperation = "--getWaitInterval\n";
+ String isRunningOperation = "--isRunning\n";
+ String stopOperation = "--stop\n";
+
+ String usage = "CrawlController --url <url to xml rpc service> --operation [<operation> [params]]\n"
+ + "operations:\n"
+ + avgCrawlOperation
+ + getMilisCrawlOperation
+ + getNumCrawlsOperation
+ + getWaitIntervalOperation
+ + isRunningOperation + stopOperation;
+
+ String operation = null, url = null;
+
+ for (int i = 0; i < args.length; i++) {
+ if (args[i].equals("--operation")) {
+ operation = args[++i];
+ } else if (args[i].equals("--url")) {
+ url = args[++i];
+ }
+ }
+
+ if (operation == null) {
+ System.err.println(usage);
+ System.exit(1);
+ }
+
+ // create the controller
+ CrawlDaemonController controller = new XmlRpcCrawlDaemonController(url);
+
+ if (operation.equals("--getAverageCrawlTime")) {
+ double avgCrawlTime = controller.getAverageCrawlTime();
+ System.out.println("Average Crawl Time: [" + avgCrawlTime + "]");
+ } else if (operation.equals("--getMilisCrawling")) {
+ int crawlTime = controller.getMilisCrawling();
+ System.out.println("Total Crawl Time: [" + crawlTime
+ + "] miliseconds");
+ } else if (operation.equals("--getNumCrawls")) {
+ int numCrawls = controller.getNumCrawls();
+ System.out.println("Num Crawls: [" + numCrawls + "]");
+ } else if (operation.equals("--getWaitInterval")) {
+ int waitInterval = controller.getWaitInterval();
+ System.out.println("Wait Interval: [" + waitInterval + "]");
+ } else if (operation.equals("--isRunning")) {
+ boolean running = controller.isRunning();
+ System.out.println(running ? "Yes" : "No");
+ } else if (operation.equals("--stop")) {
+ controller.stop();
+ System.out.println("Crawl Daemon: [" + controller.getUrl()
+ + "]: shutdown successful");
+ } else
+ throw new IllegalArgumentException("Unknown Operation!");
+
+ }
+
+}
Added: oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/XmlRpcCrawlerDaemon.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/XmlRpcCrawlerDaemon.java?rev=1700947&view=auto
==============================================================================
--- oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/XmlRpcCrawlerDaemon.java (added)
+++ oodt/branches/avro_rpc/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/XmlRpcCrawlerDaemon.java Thu Sep 3 08:14:22 2015
@@ -0,0 +1,80 @@
+/*
+ * 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.oodt.cas.crawl.daemon;
+
+
+import org.apache.oodt.cas.crawl.ProductCrawler;
+import org.apache.xmlrpc.WebServer;
+
+public class XmlRpcCrawlerDaemon extends CrawlDaemon {
+
+ public XmlRpcCrawlerDaemon(int wait, ProductCrawler crawler, int port) {
+ super(wait,crawler,port);
+ }
+
+ public void startCrawling() {
+ WebServer server = new WebServer(this.getDaemonPort());
+ server.addHandler("crawldaemon", this);
+ server.start();
+ this.crawl();
+ server.shutdown();
+ }
+
+ public double rpcGetAverageCrawlTime() {
+ return this.getAverageCrawlTime();
+ }
+
+ /**
+ * @return the milisCrawling
+ */
+
+ public int rpcGetMilisCrawling() {
+ return this.getMilisCrawling();
+ }
+
+ /**
+ * @return the waitInterval
+ */
+
+ public int rpcGetWaitInterval() {
+ return (int) this.getWaitInterval();
+ }
+
+ /**
+ * @return the running
+ */
+
+ public boolean rpcIsRunning() {
+ return this.isRunning();
+ }
+
+
+ public boolean rpcStop() {
+ return this.stop();
+ }
+
+ /**
+ * @param waitInterval
+ * the waitInterval to set
+ */
+
+ public void rpcSetWaitInterval(long waitInterval){
+ this.setWaitInterval(waitInterval);
+ }
+
+}
Added: oodt/branches/avro_rpc/crawler/src/test/java/org/apache/oodt/cas/crawl/daemon/DummyDaemonCrawler.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/crawler/src/test/java/org/apache/oodt/cas/crawl/daemon/DummyDaemonCrawler.java?rev=1700947&view=auto
==============================================================================
--- oodt/branches/avro_rpc/crawler/src/test/java/org/apache/oodt/cas/crawl/daemon/DummyDaemonCrawler.java (added)
+++ oodt/branches/avro_rpc/crawler/src/test/java/org/apache/oodt/cas/crawl/daemon/DummyDaemonCrawler.java Thu Sep 3 08:14:22 2015
@@ -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.oodt.cas.crawl.daemon;
+
+import org.apache.avro.ipc.NettyServer;
+import org.apache.avro.ipc.Server;
+import org.apache.avro.ipc.specific.SpecificResponder;
+import org.apache.oodt.cas.crawl.ProductCrawler;
+import org.apache.oodt.cas.crawler.structs.avrotypes.IntAvroCrawlDaemon;
+
+import java.net.InetSocketAddress;
+
+public class DummyDaemonCrawler extends AvroRpcCrawlerDaemon {
+
+ private int port;
+
+ private Server server;
+
+ public DummyDaemonCrawler(int wait, ProductCrawler crawler, int port) {
+ super(wait, crawler, port);
+ this.port = port;
+ }
+
+ @Override
+ public void startCrawling(){
+ server = new NettyServer(new SpecificResponder(IntAvroCrawlDaemon.class,this), new InetSocketAddress(this.port));
+ server.start();
+ }
+
+ public void closeServer(){
+ server.close();
+ }
+}
Added: oodt/branches/avro_rpc/crawler/src/test/java/org/apache/oodt/cas/crawl/daemon/TestDaemonCrawler.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/crawler/src/test/java/org/apache/oodt/cas/crawl/daemon/TestDaemonCrawler.java?rev=1700947&view=auto
==============================================================================
--- oodt/branches/avro_rpc/crawler/src/test/java/org/apache/oodt/cas/crawl/daemon/TestDaemonCrawler.java (added)
+++ oodt/branches/avro_rpc/crawler/src/test/java/org/apache/oodt/cas/crawl/daemon/TestDaemonCrawler.java Thu Sep 3 08:14:22 2015
@@ -0,0 +1,50 @@
+/*
+ * 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.oodt.cas.crawl.daemon;
+
+import junit.framework.TestCase;
+import org.apache.oodt.cas.crawl.structs.exceptions.CrawlException;
+import org.apache.oodt.cas.workflow.structs.exceptions.InstanceRepositoryException;
+
+public class TestDaemonCrawler extends TestCase {
+
+ private DummyDaemonCrawler crawler;
+
+ public void setUp(){
+ crawler = new DummyDaemonCrawler(1,null,8001);
+ crawler.startCrawling();
+ }
+
+ public void testAvroDaemonCrawlerController(){
+ try {
+ AvroCrawlDaemonController controller = new AvroCrawlDaemonController("http://localhost:8001");
+ assertTrue(controller.isRunning());
+ assertEquals(1,controller.getWaitInterval());
+ } catch (InstantiationException e) {
+ fail(e.getMessage());
+ } catch (CrawlException e) {
+ fail(e.getMessage());
+ } catch (InstanceRepositoryException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ public void tearDown(){
+ crawler.closeServer();
+ }
+}
Modified: oodt/branches/avro_rpc/mvn/archetypes/radix/src/main/resources/archetype-resources/crawler/src/main/resources/bin/crawlctl
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/mvn/archetypes/radix/src/main/resources/archetype-resources/crawler/src/main/resources/bin/crawlctl?rev=1700947&r1=1700946&r2=1700947&view=diff
==============================================================================
--- oodt/branches/avro_rpc/mvn/archetypes/radix/src/main/resources/archetype-resources/crawler/src/main/resources/bin/crawlctl (original)
+++ oodt/branches/avro_rpc/mvn/archetypes/radix/src/main/resources/archetype-resources/crawler/src/main/resources/bin/crawlctl Thu Sep 3 08:14:22 2015
@@ -15,4 +15,4 @@
# under the License.
##########################################################################
-java -Djava.util.logging.config.file=../etc/logging.properties -Djava.ext.dirs=../lib org.apache.oodt.cas.crawl.daemon.CrawlDaemonController $@
+java -Djava.util.logging.config.file=../etc/logging.properties -Djava.ext.dirs=../lib org.apache.oodt.cas.crawl.daemon.AvroCrawlDaemonController $@
Modified: oodt/branches/avro_rpc/pcs/core/src/main/java/org/apache/oodt/pcs/tools/PCSHealthMonitor.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/pcs/core/src/main/java/org/apache/oodt/pcs/tools/PCSHealthMonitor.java?rev=1700947&r1=1700946&r2=1700947&view=diff
==============================================================================
--- oodt/branches/avro_rpc/pcs/core/src/main/java/org/apache/oodt/pcs/tools/PCSHealthMonitor.java (original)
+++ oodt/branches/avro_rpc/pcs/core/src/main/java/org/apache/oodt/pcs/tools/PCSHealthMonitor.java Thu Sep 3 08:14:22 2015
@@ -27,6 +27,8 @@ import java.util.List;
import java.util.Vector;
//APACHE imports
+import org.apache.oodt.cas.crawl.daemon.AvroCrawlDaemonController;
+import org.apache.oodt.cas.crawl.daemon.CrawlDaemonController;
import org.apache.xmlrpc.XmlRpcClient;
//OODT imports
@@ -35,7 +37,6 @@ import org.apache.oodt.cas.metadata.Meta
import org.apache.oodt.cas.filemgr.metadata.CoreMetKeys;
import org.apache.oodt.cas.filemgr.structs.Product;
import org.apache.oodt.cas.resource.structs.ResourceNode;
-import org.apache.oodt.cas.crawl.daemon.CrawlDaemonController;
import org.apache.oodt.pcs.util.FileManagerUtils;
import org.apache.oodt.pcs.util.ResourceManagerUtils;
import org.apache.oodt.pcs.util.WorkflowManagerUtils;
@@ -350,7 +351,7 @@ public final class PCSHealthMonitor impl
String crawlUrlStr = "http://" + this.crawlProps.getCrawlHost() + ":"
+ info.getCrawlerPort();
try {
- CrawlDaemonController controller = new CrawlDaemonController(
+ CrawlDaemonController controller = new AvroCrawlDaemonController(
crawlUrlStr);
CrawlerHealth health = new CrawlerHealth();
health.setCrawlerName(info.getCrawlerName());
@@ -553,7 +554,7 @@ public final class PCSHealthMonitor impl
String crawlUrlStr = "http://" + this.crawlProps.getCrawlHost() + ":"
+ info.getCrawlerPort();
try {
- CrawlDaemonController controller = new CrawlDaemonController(
+ CrawlDaemonController controller = new AvroCrawlDaemonController(
crawlUrlStr);
System.out.println(info.getCrawlerName() + ":");
System.out.println("Number of Crawls: " + controller.getNumCrawls());
@@ -613,7 +614,7 @@ public final class PCSHealthMonitor impl
CrawlDaemonController controller = null;
try {
- controller = new CrawlDaemonController(crawlUrlStr);
+ controller = new AvroCrawlDaemonController(crawlUrlStr);
return controller.isRunning();
} catch (Exception e) {
return false;