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/08 06:25:18 UTC
svn commit: r1701724 [4/6] - in /oodt/branches/avro_rpc: ./
app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/model/
crawler/src/main/java/org/apache/oodt/cas/crawl/action/
crawler/src/main/java/org/apache/oodt/cas/crawl/comparator/ filem...
Added: oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/AvroFileManagerClientFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/AvroFileManagerClientFactory.java?rev=1701724&view=auto
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/AvroFileManagerClientFactory.java (added)
+++ oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/AvroFileManagerClientFactory.java Tue Sep 8 04:25:17 2015
@@ -0,0 +1,61 @@
+/*
+ * 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.filemgr.system.rpc;
+
+import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+import org.apache.oodt.cas.filemgr.system.AvroFileManagerClient;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
+import java.net.URL;
+
+/**
+ * @author radu
+ *
+ * <p>A factory class for creating {@link AvroFileManagerClient} implementation. </p>
+ *
+ */
+public class AvroFileManagerClientFactory implements FileManagerClientFactory {
+
+ private URL url;
+
+ private boolean testConnection = true;
+
+ @Override
+ public void setUrl(URL url) {
+ this.url = url;
+ }
+
+ @Override
+ public URL getUrl() {
+ return this.url;
+ }
+
+ @Override
+ public void setTestConnection(boolean testConnection) {
+ this.testConnection = testConnection;
+ }
+
+ @Override
+ public boolean getTestConnection() {
+ return this.testConnection;
+ }
+
+ @Override
+ public FileManagerClient createFileManagerClient() throws ConnectionException {
+ return new AvroFileManagerClient(this.url,this.testConnection);
+ }
+}
Added: oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/AvroFileManagerServerFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/AvroFileManagerServerFactory.java?rev=1701724&view=auto
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/AvroFileManagerServerFactory.java (added)
+++ oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/AvroFileManagerServerFactory.java Tue Sep 8 04:25:17 2015
@@ -0,0 +1,46 @@
+/*
+ * 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.filemgr.system.rpc;
+
+import org.apache.oodt.cas.filemgr.system.AvroFileManagerServer;
+import org.apache.oodt.cas.filemgr.system.FileManagerServer;
+/**
+ * @author radu
+ *
+ * <p>A factory class for creating {@link AvroFileManagerServer} implementation. </p>
+ *
+ */
+public class AvroFileManagerServerFactory implements FileManagerServerFactory {
+
+ private int port;
+
+ @Override
+ public FileManagerServer createFileManagerServer() {
+ return new AvroFileManagerServer(this.port);
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+}
Added: oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/FileManagerClientFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/FileManagerClientFactory.java?rev=1701724&view=auto
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/FileManagerClientFactory.java (added)
+++ oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/FileManagerClientFactory.java Tue Sep 8 04:25:17 2015
@@ -0,0 +1,58 @@
+/*
+ * 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.filemgr.system.rpc;
+
+import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
+
+import java.net.URL;
+
+/**
+ * @author radu
+ *
+ * <p>RPC server factory interface.</p>
+ *
+ */
+public interface FileManagerClientFactory {
+ /**
+ *
+ * <p>Setting url where sever is set on.</p>
+ *
+ * @param url
+ */
+ public void setUrl(URL url);
+
+ public URL getUrl();
+
+ /**
+ * <p>Setting ether to verify connection or not.</p>
+ *
+ * @param testConnection
+ */
+ public void setTestConnection(boolean testConnection);
+
+ public boolean getTestConnection();
+
+ /**
+ * <p>Returning server RPC implementation.</p>
+ * @return
+ * @throws ConnectionException
+ */
+ public FileManagerClient createFileManagerClient() throws ConnectionException;
+}
Added: oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/FileManagerServerFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/FileManagerServerFactory.java?rev=1701724&view=auto
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/FileManagerServerFactory.java (added)
+++ oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/FileManagerServerFactory.java Tue Sep 8 04:25:17 2015
@@ -0,0 +1,44 @@
+/*
+ * 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.filemgr.system.rpc;
+
+import org.apache.oodt.cas.filemgr.system.FileManagerServer;
+
+/**
+ * @author radu
+ *
+ * <p>RPC server factory interface.</p>
+ *
+ */
+public interface FileManagerServerFactory {
+
+ public int getPort();
+
+ /**
+ * <p>Setting port on witch FileManagerServer will run on.</p>
+ * @param port
+ */
+ public void setPort(int port);
+
+ /**
+ * <p>Returning server RPC implementation.</p>
+ * @return
+ */
+ public FileManagerServer createFileManagerServer();
+
+}
Added: oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/XmlRpcFileManagerClientFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/XmlRpcFileManagerClientFactory.java?rev=1701724&view=auto
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/XmlRpcFileManagerClientFactory.java (added)
+++ oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/XmlRpcFileManagerClientFactory.java Tue Sep 8 04:25:17 2015
@@ -0,0 +1,58 @@
+/*
+ * 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.filemgr.system.rpc;
+
+import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
+import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+
+import java.net.URL;
+
+public class XmlRpcFileManagerClientFactory implements FileManagerClientFactory {
+
+ private URL url;
+
+ private boolean testConnection = true;
+
+ @Override
+ public void setUrl(URL url) {
+ this.url = url;
+ }
+
+ @Override
+ public URL getUrl() {
+ return this.url;
+ }
+
+ @Override
+ public void setTestConnection(boolean testConnection) {
+ this.testConnection = testConnection;
+ }
+
+ @Override
+ public boolean getTestConnection() {
+ return this.testConnection;
+ }
+
+ @Override
+ public FileManagerClient createFileManagerClient() throws ConnectionException {
+ return new XmlRpcFileManagerClient(this.url,this.testConnection);
+ }
+
+}
Added: oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/XmlRpcFileManagerServerFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/XmlRpcFileManagerServerFactory.java?rev=1701724&view=auto
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/XmlRpcFileManagerServerFactory.java (added)
+++ oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/rpc/XmlRpcFileManagerServerFactory.java Tue Sep 8 04:25:17 2015
@@ -0,0 +1,44 @@
+/*
+ * 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.filemgr.system.rpc;
+
+import org.apache.oodt.cas.filemgr.system.FileManagerServer;
+import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerServer;
+
+/**
+ * Created by radu on 7/11/15.
+ */
+public class XmlRpcFileManagerServerFactory implements FileManagerServerFactory {
+
+ private int port;
+
+ public int getPort() {
+ return port;
+ }
+
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ @Override
+ public FileManagerServer createFileManagerServer() {
+ return new XmlRpcFileManagerServer(this.port);
+ }
+
+
+}
Modified: oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/CatalogSearch.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/CatalogSearch.java?rev=1701724&r1=1701723&r2=1701724&view=diff
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/CatalogSearch.java (original)
+++ oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/CatalogSearch.java Tue Sep 8 04:25:17 2015
@@ -26,7 +26,7 @@ import org.apache.oodt.cas.filemgr.struc
import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
import org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException;
import org.apache.oodt.cas.filemgr.structs.exceptions.ValidationLayerException;
-import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
//JDK imports
import java.io.BufferedReader;
@@ -46,6 +46,7 @@ import org.apache.lucene.search.PhraseQu
import org.apache.lucene.search.Query;
import org.apache.lucene.search.RangeQuery;
import org.apache.lucene.search.TermQuery;
+import org.apache.oodt.cas.filemgr.util.RpcCommunicationFactory;
/**
*
@@ -61,7 +62,7 @@ public class CatalogSearch {
private static QueryParser parser;
- private static XmlRpcFileManagerClient client;
+ private static FileManagerClient client;
private static String freeTextBlock = "__FREE__";
@@ -368,7 +369,7 @@ public class CatalogSearch {
// connect with Filemgr Client
boolean clientConnect = true;
try {
- client = new XmlRpcFileManagerClient(new URL(fileManagerUrl));
+ client = RpcCommunicationFactory.createClient(new URL(fileManagerUrl));
} catch (Exception e) {
System.out
.println("Exception when communicating with file manager, errors to follow: message: "
Modified: oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java?rev=1701724&r1=1701723&r2=1701724&view=diff
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java (original)
+++ oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java Tue Sep 8 04:25:17 2015
@@ -22,7 +22,8 @@ import org.apache.oodt.cas.filemgr.struc
import org.apache.oodt.cas.filemgr.structs.Product;
import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
import org.apache.oodt.cas.filemgr.structs.exceptions.DataTransferException;
-import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
+import org.apache.oodt.cas.filemgr.util.RpcCommunicationFactory;
//JDK imports
import java.io.BufferedReader;
@@ -55,14 +56,14 @@ public class DeleteProduct {
private static final Logger LOG = Logger.getLogger(DeleteProduct.class.getName());
/* our File Manager client */
- private static XmlRpcFileManagerClient client = null;
+ private static FileManagerClient client = null;
/* whether or not we should commit our deletions */
private boolean commit = true;
public DeleteProduct(String fileManagerUrl, boolean commit) {
try {
- client = new XmlRpcFileManagerClient(new URL(fileManagerUrl));
+ client = RpcCommunicationFactory.createClient(new URL(fileManagerUrl));
} catch (Exception e) {
LOG.log(Level.SEVERE,
"Unable to create file manager client: Message: "
Modified: oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java?rev=1701724&r1=1701723&r2=1701724&view=diff
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java (original)
+++ oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java Tue Sep 8 04:25:17 2015
@@ -33,7 +33,8 @@ import org.apache.oodt.cas.filemgr.struc
import org.apache.oodt.cas.filemgr.structs.ProductType;
import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
-import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
+import org.apache.oodt.cas.filemgr.util.RpcCommunicationFactory;
import org.apache.oodt.cas.filemgr.util.GenericFileManagerObjectFactory;
import org.apache.oodt.cas.metadata.Metadata;
@@ -50,10 +51,10 @@ import org.apache.oodt.cas.metadata.Meta
public class ExpImpCatalog {
/* the client to the source catalog to export */
- private XmlRpcFileManagerClient sourceClient = null;
+ private FileManagerClient sourceClient = null;
/* the client to the dest catalog to import into */
- private XmlRpcFileManagerClient destClient = null;
+ private FileManagerClient destClient = null;
/* a source catalog I/F to export from (if no fm client is desired) */
private Catalog srcCatalog = null;
@@ -81,7 +82,7 @@ public class ExpImpCatalog {
*/
public ExpImpCatalog(URL sUrl, URL dUrl, boolean unique) {
try {
- sourceClient = new XmlRpcFileManagerClient(sUrl);
+ sourceClient = RpcCommunicationFactory.createClient(sUrl);
} catch (ConnectionException e) {
LOG.log(Level.WARNING, "Unable to connect to source filemgr: ["
+ sUrl + "]");
@@ -89,7 +90,7 @@ public class ExpImpCatalog {
}
try {
- destClient = new XmlRpcFileManagerClient(dUrl);
+ destClient = RpcCommunicationFactory.createClient(dUrl);
} catch (ConnectionException e) {
LOG.log(Level.WARNING, "Unable to connect to dest filemgr: ["
+ dUrl + "]");
Modified: oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataBasedProductMover.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataBasedProductMover.java?rev=1701724&r1=1701723&r2=1701724&view=diff
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataBasedProductMover.java (original)
+++ oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataBasedProductMover.java Tue Sep 8 04:25:17 2015
@@ -32,7 +32,8 @@ import org.apache.oodt.cas.filemgr.struc
import org.apache.oodt.cas.filemgr.structs.ProductType;
import org.apache.oodt.cas.filemgr.structs.Reference;
import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
-import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
+import org.apache.oodt.cas.filemgr.util.RpcCommunicationFactory;
import org.apache.oodt.cas.metadata.util.PathUtils;
import org.apache.oodt.cas.metadata.Metadata;
@@ -54,7 +55,7 @@ public class MetadataBasedProductMover {
private String pathSpec = null;
/* the client to the file manager */
- private XmlRpcFileManagerClient fmgrClient = null;
+ private FileManagerClient fmgrClient = null;
/* our log stream */
private static final Logger LOG = Logger
@@ -75,7 +76,7 @@ public class MetadataBasedProductMover {
throws InstantiationException {
this.pathSpec = pathSpec;
try {
- this.fmgrClient = new XmlRpcFileManagerClient(new URL(fmUrl));
+ this.fmgrClient = RpcCommunicationFactory.createClient(new URL(fmUrl));
} catch (MalformedURLException e) {
throw new InstantiationException(e.getMessage());
} catch (ConnectionException e) {
Modified: oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java?rev=1701724&r1=1701723&r2=1701724&view=diff
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java (original)
+++ oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java Tue Sep 8 04:25:17 2015
@@ -20,7 +20,8 @@ package org.apache.oodt.cas.filemgr.tool
//OODT imports
import org.apache.oodt.cas.filemgr.structs.Product;
import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
-import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
+import org.apache.oodt.cas.filemgr.util.RpcCommunicationFactory;
import org.apache.oodt.cas.metadata.Metadata;
import org.apache.oodt.cas.metadata.SerializableMetadata;
import org.apache.oodt.commons.xml.XMLUtils;
@@ -49,7 +50,7 @@ public final class MetadataDumper {
.getName());
/* our file manager client */
- private XmlRpcFileManagerClient fmClient = null;
+ private FileManagerClient fmClient = null;
private final static String FILENAME = "Filename";
@@ -57,7 +58,7 @@ public final class MetadataDumper {
public MetadataDumper(String fmUrlStr) throws InstantiationException {
try {
- this.fmClient = new XmlRpcFileManagerClient(new URL(fmUrlStr));
+ this.fmClient = RpcCommunicationFactory.createClient(new URL(fmUrlStr));
} catch (MalformedURLException e) {
LOG.log(Level.SEVERE, "malformed file manager url: [" + fmUrlStr
+ "]", e);
Modified: oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java?rev=1701724&r1=1701723&r2=1701724&view=diff
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java (original)
+++ oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java Tue Sep 8 04:25:17 2015
@@ -21,7 +21,8 @@ package org.apache.oodt.cas.filemgr.tool
import org.apache.oodt.cas.filemgr.structs.Product;
import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
-import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
+import org.apache.oodt.cas.filemgr.util.RpcCommunicationFactory;
import org.apache.oodt.cas.metadata.Metadata;
import org.apache.oodt.commons.xml.XMLUtils;
@@ -48,7 +49,7 @@ public final class ProductDumper {
.getName());
/* our file manager client */
- private XmlRpcFileManagerClient fmClient = null;
+ private FileManagerClient fmClient = null;
private final static String FILENAME = "Filename";
@@ -56,7 +57,7 @@ public final class ProductDumper {
public ProductDumper(String fmUrlStr) throws InstantiationException {
try {
- this.fmClient = new XmlRpcFileManagerClient(new URL(fmUrlStr));
+ this.fmClient = RpcCommunicationFactory.createClient(new URL(fmUrlStr));
} catch (MalformedURLException e) {
LOG.log(Level.SEVERE, "malformed file manager url: [" + fmUrlStr
+ "]", e);
Modified: oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java?rev=1701724&r1=1701723&r2=1701724&view=diff
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java (original)
+++ oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java Tue Sep 8 04:25:17 2015
@@ -37,7 +37,8 @@ import org.apache.oodt.cas.filemgr.struc
import org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException;
import org.apache.oodt.cas.filemgr.structs.query.ComplexQuery;
import org.apache.oodt.cas.filemgr.structs.query.QueryResult;
-import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
+import org.apache.oodt.cas.filemgr.util.RpcCommunicationFactory;
import org.apache.oodt.cas.filemgr.util.SqlParser;
//APACHE imports
@@ -65,7 +66,7 @@ public final class QueryTool {
private static String freeTextBlock = "__FREE__";
- private XmlRpcFileManagerClient client = null;
+ private FileManagerClient client = null;
private static enum QueryType { LUCENE, SQL };
@@ -74,7 +75,7 @@ public final class QueryTool {
public QueryTool(URL fmUrl) throws InstantiationException {
try {
- client = new XmlRpcFileManagerClient(fmUrl);
+ client = RpcCommunicationFactory.createClient(fmUrl);
} catch (ConnectionException e) {
throw new InstantiationException(e.getMessage());
}
@@ -249,7 +250,7 @@ public final class QueryTool {
ComplexQuery complexQuery = SqlParser.parseSqlQuery(query);
complexQuery.setSortByMetKey(sortBy);
complexQuery.setToStringResultFormat(outputFormat);
- List<QueryResult> results = new XmlRpcFileManagerClient(new URL(filemgrUrl)).complexQuery(complexQuery);
+ List<QueryResult> results = RpcCommunicationFactory.createClient(new URL(filemgrUrl)).complexQuery(complexQuery);
StringBuffer returnString = new StringBuffer("");
for (QueryResult qr : results)
returnString.append(qr.toString() + delimiter);
Modified: oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java?rev=1701724&r1=1701723&r2=1701724&view=diff
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java (original)
+++ oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java Tue Sep 8 04:25:17 2015
@@ -49,7 +49,8 @@ import org.apache.oodt.cas.filemgr.struc
import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
import org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException;
-import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
+import org.apache.oodt.cas.filemgr.util.RpcCommunicationFactory;
import org.apache.oodt.cas.metadata.Metadata;
import org.apache.oodt.cas.metadata.SerializableMetadata;
import org.apache.oodt.cas.metadata.util.PathUtils;
@@ -244,8 +245,7 @@ public class SolrIndexer {
public void indexProductTypes(boolean delete) {
LOG.info("Indexing product types...");
try {
- XmlRpcFileManagerClient fmClient = new XmlRpcFileManagerClient(new URL(
- this.fmUrl));
+ FileManagerClient fmClient = RpcCommunicationFactory.createClient(new URL(this.fmUrl));
LOG.info("Retrieving list of product types.");
List<ProductType> types = fmClient.getProductTypes();
for (ProductType type : types) {
@@ -295,7 +295,7 @@ public class SolrIndexer {
/**
* Suppresses exception that occurred with older file managers.
*/
- private ProductPage safeFirstPage(XmlRpcFileManagerClient fmClient, ProductType type) {
+ private ProductPage safeFirstPage(FileManagerClient fmClient, ProductType type) {
ProductPage page = null;
try {
page = fmClient.getFirstPage(type);
@@ -319,8 +319,7 @@ public class SolrIndexer {
public void indexAll(boolean delete) {
LOG.info("Indexing products...");
try {
- XmlRpcFileManagerClient fmClient = new XmlRpcFileManagerClient(new URL(
- this.fmUrl));
+ FileManagerClient fmClient = RpcCommunicationFactory.createClient(new URL(this.fmUrl));
LOG.info("Retrieving list of product types.");
List<ProductType> types = fmClient.getProductTypes();
for (ProductType type : types) {
@@ -373,8 +372,7 @@ public class SolrIndexer {
throws SolrServerException {
LOG.info("Attempting to index product: " + productId);
try {
- XmlRpcFileManagerClient fmClient = new XmlRpcFileManagerClient(new URL(
- this.fmUrl));
+ FileManagerClient fmClient = RpcCommunicationFactory.createClient(new URL(this.fmUrl));
Product product = fmClient.getProductById(productId);
Metadata productMetadata = fmClient.getMetadata(product);
indexProduct(product.getProductId(), productMetadata, product
@@ -424,8 +422,7 @@ public class SolrIndexer {
}
}
- XmlRpcFileManagerClient fmClient = new XmlRpcFileManagerClient(new URL(
- this.fmUrl));
+ FileManagerClient fmClient = RpcCommunicationFactory.createClient(new URL(this.fmUrl));
Product product = fmClient.getProductByName(productName);
Metadata productMetadata = fmClient.getMetadata(product);
// NOTE: delete (by id) is now false
Added: oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/AvroTypeFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/AvroTypeFactory.java?rev=1701724&view=auto
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/AvroTypeFactory.java (added)
+++ oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/AvroTypeFactory.java Tue Sep 8 04:25:17 2015
@@ -0,0 +1,528 @@
+/*
+ * 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.filemgr.util;
+
+import org.apache.oodt.cas.filemgr.structs.*;
+import org.apache.oodt.cas.filemgr.structs.avrotypes.*;
+import org.apache.oodt.cas.filemgr.structs.exceptions.QueryFormulationException;
+import org.apache.oodt.cas.filemgr.structs.query.ComplexQuery;
+import org.apache.oodt.cas.filemgr.structs.query.QueryFilter;
+import org.apache.oodt.cas.filemgr.structs.query.QueryResult;
+import org.apache.oodt.cas.filemgr.structs.query.filter.FilterAlgor;
+import org.apache.oodt.cas.filemgr.structs.type.TypeHandler;
+import org.apache.oodt.cas.metadata.Metadata;
+
+import java.util.*;
+
+/**
+ * @author radu
+ *
+ * <p>
+ * A factory class for creating File Manager Avro types suitable for transfer
+ * over the Avro IPC pipe.
+ * </p>
+ */
+public class AvroTypeFactory {
+
+ public static AvroReference getAvroReference(Reference reference){
+
+ AvroReference avroReference = new AvroReference();
+
+ avroReference.setOrigReference(reference.getOrigReference());
+
+ if (reference.getDataStoreReference() != null)
+ avroReference.setDataStoreReference(reference.getDataStoreReference());
+ else
+ avroReference.setDataStoreReference("");
+
+ avroReference.setFileSize(reference.getFileSize());
+
+ if(reference.getMimeType() != null)
+ avroReference.setMimeTypeName(reference.getMimeType().getName());
+ return avroReference;
+ }
+
+ public static Reference getReference(AvroReference avroReference) {
+ Reference reference = new Reference();
+
+ reference.setOrigReference(avroReference.getOrigReference());
+ reference.setDataStoreReference(avroReference.getDataStoreReference());
+ reference.setFileSize(avroReference.getFileSize());
+ reference.setMimeType(avroReference.getMimeTypeName());
+
+ return reference;
+
+ }
+
+ public static AvroExtractorSpec getAvroExtractorSpec(ExtractorSpec extractorSpec){
+
+ AvroExtractorSpec avroExtractorSpec = new AvroExtractorSpec();
+
+ avroExtractorSpec.setClassName(extractorSpec.getClassName());
+
+ Properties props = extractorSpec.getConfiguration();
+ if (props != null && props.keySet().size() > 0)
+ avroExtractorSpec.setConfiguration((Map) props);
+
+ return avroExtractorSpec;
+ }
+
+ public static ExtractorSpec getExtractorSpec(AvroExtractorSpec avroExtractorSpec){
+ Properties properties = new Properties();
+
+ Map configuration = avroExtractorSpec.getConfiguration();
+ if (configuration != null && configuration.keySet().size() > 0) {
+ for (Iterator<String> i = configuration.keySet().iterator(); i.hasNext();) {
+ String propName = i.next();
+ String propValue =(String) configuration.get(propName);
+ properties.setProperty(propName, propValue);
+ }
+ }
+
+ return new ExtractorSpec(avroExtractorSpec.getClassName(),properties);
+ }
+
+ public static AvroMetadata getAvroMetadata(Metadata metadata){
+
+ AvroMetadata avroMetadata = new AvroMetadata();
+ Hashtable met = metadata.getHashtable();
+ Map<String,List<String>> hashMapMetadata = new HashMap<String,List<String>>();
+
+ if (met != null && met.size() > 0){
+ for (Iterator i = met.keySet().iterator(); i.hasNext();){
+ String key =(String) i.next();
+ hashMapMetadata.put(key, (List<String>) met.get(key));
+ }
+ }
+ return new AvroMetadata(hashMapMetadata);
+ }
+ public static Metadata getMetadata(AvroMetadata metadata){
+ Metadata met = new Metadata();
+
+ Map<String,List<String>> hashMapMet = metadata.getTableMetadata();
+
+ if (hashMapMet != null){
+ Iterator iMet = hashMapMet.keySet().iterator();
+ while(iMet.hasNext()){
+ String i =(String) iMet.next();
+ met.addMetadata(i,hashMapMet.get(i));
+ }
+ }
+
+ return met;
+
+ }
+
+ public static AvroTypeHandler getAvroTypeHandler(TypeHandler typeHandler){
+ AvroTypeHandler avroTypeHandler = new AvroTypeHandler();
+ avroTypeHandler.setClassName(typeHandler.getClass().getCanonicalName());
+ avroTypeHandler.setElementName(typeHandler.getElementName());
+ return avroTypeHandler;
+ }
+
+ public static TypeHandler getTypeHandler(AvroTypeHandler avroTypeHandler){
+ try {
+ TypeHandler th = (TypeHandler)Class.forName(avroTypeHandler.getClassName()).newInstance();
+ th.setElementName(avroTypeHandler.getElementName());
+ return th;
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+
+ public static AvroProductType getAvroProductType(ProductType productType){
+ if (productType == null){
+ return null;
+ }
+
+ AvroProductType avroProductType = new AvroProductType();
+
+ if(productType.getProductTypeId() != null)
+ avroProductType.setProductTypeId(productType.getProductTypeId());
+ if(productType.getName() != null)
+ avroProductType.setName(productType.getName());
+ if(productType.getDescription() != null)
+ avroProductType.setDescription(productType.getDescription());
+ if(productType.getProductRepositoryPath() != null)
+ avroProductType.setProductRepositoryPath(productType.getProductRepositoryPath());
+ if(productType.getVersioner() != null)
+ avroProductType.setVersioner(productType.getVersioner());
+ if(productType.getTypeMetadata() != null)
+ avroProductType.setTypeMetadata(getAvroMetadata(productType.getTypeMetadata()));
+
+ List<ExtractorSpec> extractorSpecs = productType.getExtractors();
+ if (extractorSpecs != null && extractorSpecs.size() > 0 ) {
+ List<AvroExtractorSpec> avroExtractorSpecs = new ArrayList<AvroExtractorSpec>();
+ for (ExtractorSpec es : extractorSpecs) {
+ avroExtractorSpecs.add(getAvroExtractorSpec(es));
+ }
+ avroProductType.setExtractors(avroExtractorSpecs);
+ }
+ List<TypeHandler> typeHandlers = productType.getHandlers();
+ if (typeHandlers != null && typeHandlers.size() > 0 ) {
+ List<AvroTypeHandler> avroTypeHandlers = new ArrayList<AvroTypeHandler>();
+ for (TypeHandler th : typeHandlers) {
+ avroTypeHandlers.add(getAvroTypeHandler(th));
+ }
+ avroProductType.setHandlers(avroTypeHandlers);
+ }
+ return avroProductType;
+ }
+
+ public static ProductType getProductType(AvroProductType avroProductType){
+
+ ProductType productType = new ProductType();
+
+ productType.setDescription(avroProductType.getDescription());
+ productType.setName(avroProductType.getName());
+ productType.setProductRepositoryPath(avroProductType.getProductRepositoryPath());
+ productType.setProductTypeId(avroProductType.getProductTypeId());
+ productType.setVersioner(avroProductType.getVersioner());
+ if (avroProductType.getTypeMetadata() != null) {
+ productType.setTypeMetadata(AvroTypeFactory.getMetadata(avroProductType.getTypeMetadata()));
+ }
+
+ List<AvroExtractorSpec> avroExtractorSpecs = avroProductType.getExtractors();
+ List<ExtractorSpec> extractorSpecs = new ArrayList<ExtractorSpec>();
+ if (avroExtractorSpecs != null && avroExtractorSpecs.size() > 0) {
+ for (AvroExtractorSpec aes : avroExtractorSpecs){
+ extractorSpecs.add(AvroTypeFactory.getExtractorSpec(aes));
+ }
+ productType.setExtractors(extractorSpecs);
+ }
+
+ List<AvroTypeHandler> avroTypeHandlers = avroProductType.getHandlers();
+ List<TypeHandler> typeHandlers = new ArrayList<TypeHandler>();
+ if (avroTypeHandlers != null && avroTypeHandlers.size() > 0) {
+ for (AvroTypeHandler aes : avroTypeHandlers){
+ typeHandlers.add(AvroTypeFactory.getTypeHandler(aes));
+ }
+ productType.setHandlers(typeHandlers);
+ }
+
+ return productType;
+ }
+
+ public static AvroProduct getAvroProduct(Product product){
+
+ AvroProduct avroProduct = new AvroProduct();
+
+ if (product.getProductId() != null)
+ avroProduct.setProductId(product.getProductId());
+
+ if (product.getProductName() != null)
+ avroProduct.setProductName(product.getProductName());
+
+ if (product.getProductType() != null)
+ avroProduct.setProductType(getAvroProductType(product.getProductType()));
+
+ if (product.getProductType() != null)
+ avroProduct.setProductStructure(product.getProductStructure());
+
+ //referince
+ List<Reference> references = product.getProductReferences();
+ if (references != null){
+ List<AvroReference> avroReferences = AvroTypeFactory.getAvroReferences(product.getProductReferences());
+ avroProduct.setReferences(avroReferences);
+
+ }
+
+ if (product.getTransferStatus() != null)
+ avroProduct.setTransferStatus(product.getTransferStatus());
+
+ if (product.getRootRef() != null)
+ avroProduct.setRootRef(getAvroReference(product.getRootRef()));
+
+ return avroProduct;
+ }
+
+ public static Product getProduct(AvroProduct avroPoduct){
+ Product product = new Product();
+ product.setProductName(avroPoduct.getProductName());
+ if (avroPoduct.getProductType() != null)
+ product.setProductType(getProductType(avroPoduct.getProductType()));
+ product.setProductStructure(avroPoduct.getProductStructure());
+ product.setTransferStatus(avroPoduct.getTransferStatus());
+ //references
+ if (avroPoduct.getReferences() != null)
+ product.setProductReferences(getReferences(avroPoduct.getReferences()));
+ product.setProductId(avroPoduct.getProductId());
+ if (avroPoduct.getRootRef() != null)
+ product.setRootRef(getReference(avroPoduct.getRootRef()));
+ return product;
+ }
+
+ public static AvroFileTransferStatus getAvroFileTransferStatus(FileTransferStatus fileTransferStatus){
+ return new AvroFileTransferStatus(
+ getAvroReference(fileTransferStatus.getFileRef()),
+ fileTransferStatus.getBytesTransferred(),
+ getAvroProduct(fileTransferStatus.getParentProduct()));
+ }
+
+ public static FileTransferStatus getFileTransferStatus(AvroFileTransferStatus avroFileTransferStatus){
+ return new FileTransferStatus(
+ getReference(avroFileTransferStatus.getFileRef()),
+ 0,
+ avroFileTransferStatus.getBytesTransferred(),
+ getProduct(avroFileTransferStatus.getParentProduct())
+ );
+ }
+
+ public static AvroQueryCriteria getAvroQueryCriteria(QueryCriteria queryCriteria){
+ AvroQueryCriteria avroQueryCriteria = new AvroQueryCriteria();
+ avroQueryCriteria.setClassName(queryCriteria.getClass().getCanonicalName());
+ if (queryCriteria instanceof TermQueryCriteria){
+ avroQueryCriteria.setElementName(queryCriteria.getElementName());
+ avroQueryCriteria.setElementValue(((TermQueryCriteria) queryCriteria).getValue());
+ } else if (queryCriteria instanceof RangeQueryCriteria){
+ avroQueryCriteria.setElementName(queryCriteria.getElementName());
+ avroQueryCriteria.setElementStartValue(((RangeQueryCriteria) queryCriteria).getStartValue());
+ avroQueryCriteria.setElementEndValue(((RangeQueryCriteria) queryCriteria).getEndValue());
+ avroQueryCriteria.setInclusive(((RangeQueryCriteria) queryCriteria).getInclusive());
+ } else if(queryCriteria instanceof BooleanQueryCriteria){
+ List<AvroQueryCriteria> avroQueryCriterias = new ArrayList<AvroQueryCriteria>();
+ List<QueryCriteria> queryCriterias = ((BooleanQueryCriteria)queryCriteria).getTerms();
+ if(queryCriteria != null && queryCriterias.size() > 0){
+ for(QueryCriteria qc : queryCriterias){
+ avroQueryCriterias.add(getAvroQueryCriteria(qc));
+ }
+ }
+ avroQueryCriteria.setOperator(((BooleanQueryCriteria)queryCriteria).getOperator());
+ avroQueryCriteria.setTerms(avroQueryCriterias);
+ }
+ return avroQueryCriteria;
+ }
+
+ public static QueryCriteria getQueryCriteria(AvroQueryCriteria avroQueryCriteria){
+ QueryCriteria queryCriteria = null;
+ if(avroQueryCriteria.getClassName().equals(TermQueryCriteria.class.getCanonicalName())){
+ queryCriteria = new TermQueryCriteria();
+ queryCriteria.setElementName(avroQueryCriteria.getElementName());
+ ((TermQueryCriteria)queryCriteria).setValue(avroQueryCriteria.getElementValue());
+ }else if (avroQueryCriteria.getClassName().equals(RangeQueryCriteria.class.getCanonicalName())){
+ queryCriteria = new RangeQueryCriteria();
+ queryCriteria.setElementName(avroQueryCriteria.getElementName());
+ ((RangeQueryCriteria)queryCriteria).setStartValue(avroQueryCriteria.getElementStartValue());
+ ((RangeQueryCriteria)queryCriteria).setEndValue(avroQueryCriteria.getElementEndValue());
+ ((RangeQueryCriteria)queryCriteria).setInclusive(avroQueryCriteria.getInclusive());
+ }else if(avroQueryCriteria.getClassName().equals(BooleanQueryCriteria.class.getCanonicalName())){
+ queryCriteria = new BooleanQueryCriteria();
+ try{
+ ((BooleanQueryCriteria)queryCriteria).setOperator(avroQueryCriteria.getOperator());
+ } catch (QueryFormulationException e){
+ System.out.println("Error generating Boolean Query.");
+ }
+ List<AvroQueryCriteria> avroQueryCriterias = avroQueryCriteria.getTerms();
+
+ if (avroQueryCriterias != null && avroQueryCriterias.size() > 0)
+ for (AvroQueryCriteria aqc : avroQueryCriterias){
+ try {
+ ((BooleanQueryCriteria)queryCriteria).addTerm(getQueryCriteria(aqc));
+ } catch (QueryFormulationException e) {
+ System.out.println("Error generating Boolean Query.");
+ }
+ }
+ }
+ return queryCriteria;
+ }
+
+ public static AvroQuery getAvroQuery(Query query){
+ List<AvroQueryCriteria> avroQueryCriterias = new ArrayList<AvroQueryCriteria>();
+ for (QueryCriteria qc : query.getCriteria()){
+ avroQueryCriterias.add(getAvroQueryCriteria(qc));
+ }
+ return new AvroQuery(avroQueryCriterias);
+ }
+
+ public static Query getQuery(AvroQuery avroQuery){
+ List<QueryCriteria> queryCriterias = new ArrayList<QueryCriteria>();
+ for (AvroQueryCriteria qc : avroQuery.getCriteria()){
+ queryCriterias.add(getQueryCriteria(qc));
+ }
+
+ return new Query(queryCriterias);
+ }
+
+ public static AvroProductPage getAvroProductPage(ProductPage productPage){
+ List<AvroProduct> avroProducts = new ArrayList<AvroProduct>();
+ for (Product ap : productPage.getPageProducts()){
+ avroProducts.add(getAvroProduct(ap));
+ }
+
+ return new AvroProductPage(productPage.getPageNum(),
+ productPage.getTotalPages(),
+ productPage.getPageSize(),
+ avroProducts,
+ productPage.getNumOfHits());
+ }
+
+ public static ProductPage getProductPage(AvroProductPage avroProductPage){
+ List<Product> products = new ArrayList<Product>();
+ for (AvroProduct ap : avroProductPage.getPageProducts()){
+ products.add(getProduct(ap));
+ }
+
+ ProductPage pp = new ProductPage(avroProductPage.getPageNum(),
+ avroProductPage.getTotalPages(),
+ avroProductPage.getPageSize(),
+ products
+ );
+ pp.setNumOfHits(avroProductPage.getNumOfHits());
+ return pp;
+ }
+
+ public static AvroElement getAvroElement(Element element){
+ return new AvroElement(
+ element.getElementId(),
+ element.getElementName(),
+ element.getDCElement(),
+ element.getDescription());
+ }
+
+ public static Element getElement(AvroElement avroElement){
+ return new Element(
+ avroElement.getElementId(),
+ avroElement.getElementName(),
+ null,
+ avroElement.getDcElement(),
+ avroElement.getDescription(),
+ null);
+ }
+
+ public static AvroQueryResult getAvroQueryResult(QueryResult queryResult){
+ return new AvroQueryResult(getAvroProduct(queryResult.getProduct()),
+ getAvroMetadata(queryResult.getMetadata()),
+ queryResult.getToStringFormat());
+ }
+
+ public static QueryResult getQueryResult(AvroQueryResult avroQueryResult){
+ QueryResult qr = new QueryResult(
+ getProduct(avroQueryResult.getProduct()),
+ getMetadata(avroQueryResult.getMetadata())
+ );
+ qr.setToStringFormat(avroQueryResult.getToStringFormat());
+
+ return qr;
+ }
+// sa schimb mai sun la get class get name !!!!!
+
+ public static AvroFilterAlgor getAvroFilterAlgor(FilterAlgor filterAlgor){
+ return new AvroFilterAlgor(filterAlgor.getClass().getName(),filterAlgor.getEpsilon());
+ }
+
+ public static FilterAlgor getFilterAlgor(AvroFilterAlgor avroFilterAlgor){
+
+ FilterAlgor fa = null;
+ try {
+ fa = (FilterAlgor) Class.forName(avroFilterAlgor.getClassName()).newInstance();
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+ fa.setEpsilon(avroFilterAlgor.getEpsilon());
+ return fa;
+ }
+
+
+ public static AvroQueryFilter getAvroQueryFilter(QueryFilter queryFilter){
+
+
+ AvroQueryFilter avroQueryFilter = new AvroQueryFilter(
+ queryFilter.getStartDateTimeMetKey(),
+ queryFilter.getEndDateTimeMetKey(),
+ queryFilter.getPriorityMetKey(),
+ getAvroFilterAlgor(queryFilter.getFilterAlgor()));
+
+ return avroQueryFilter;
+ }
+
+ public static QueryFilter getQueryFilter(AvroQueryFilter avroQueryFilter){
+ return new QueryFilter(avroQueryFilter.getStartDateTimeMetKey(),
+ avroQueryFilter.getEndDateTimeMetKey(),
+ avroQueryFilter.getPriorityMetKey(),
+ getFilterAlgor(avroQueryFilter.getFilterAlgor()));
+ }
+
+ public static AvroComplexQuery getAvroComplexQuery(ComplexQuery complexQuery){
+ List<AvroQueryCriteria> avroQueryCriterias = new ArrayList<AvroQueryCriteria>();
+ for (QueryCriteria aqc : complexQuery.getCriteria()){
+ avroQueryCriterias.add(getAvroQueryCriteria(aqc));
+ }
+ AvroComplexQuery avroComplexQuery = new AvroComplexQuery();
+
+ avroComplexQuery.setCriteria(avroQueryCriterias);
+ avroComplexQuery.setReducedProductTypeNames(complexQuery.getReducedProductTypeNames());
+ avroComplexQuery.setReducedMetadata(complexQuery.getReducedMetadata());
+ if(complexQuery.getQueryFilter() != null)
+ avroComplexQuery.setQueryFilter(getAvroQueryFilter(complexQuery.getQueryFilter()));
+ avroComplexQuery.setSortByMetKey(complexQuery.getSortByMetKey());
+ avroComplexQuery.setToStringResultFormat(complexQuery.getToStringResultFormat());
+ return avroComplexQuery;
+ }
+
+ public static ComplexQuery getComplexQuery(AvroComplexQuery avroComplexQuery){
+ List<QueryCriteria> queryCriterias = new ArrayList<QueryCriteria>();
+ List<AvroQueryCriteria> avroQueryCriterias = avroComplexQuery.getCriteria();
+
+ if (avroQueryCriterias != null && avroQueryCriterias.size() > 0) {
+ for (AvroQueryCriteria aqc : avroQueryCriterias){
+ queryCriterias.add(getQueryCriteria(aqc));
+ }
+ }
+ ComplexQuery complexQuery = new ComplexQuery();
+
+ complexQuery.setCriteria(queryCriterias);
+ complexQuery.setReducedProductTypeNames(avroComplexQuery.getReducedProductTypeNames());
+ complexQuery.setReducedMetadata(avroComplexQuery.getReducedMetadata());
+ if(avroComplexQuery.getQueryFilter() != null)
+ complexQuery.setQueryFilter(getQueryFilter(avroComplexQuery.getQueryFilter()));
+ complexQuery.setSortByMetKey(avroComplexQuery.getSortByMetKey());
+ complexQuery.setToStringResultFormat(avroComplexQuery.getToStringResultFormat());
+ return complexQuery;
+ }
+
+
+ private static List<Reference> getReferences(List<AvroReference> avroReferences){
+ List<Reference> references = new ArrayList<Reference>();
+
+ for(AvroReference ar : avroReferences){
+ references.add(AvroTypeFactory.getReference(ar));
+ }
+ return references;
+ }
+
+ private static List<AvroReference> getAvroReferences(List<Reference> references){
+ List<AvroReference> avroReferences = new ArrayList<AvroReference>();
+
+ for (Reference r : references){
+ avroReferences.add(getAvroReference(r));
+ }
+ return avroReferences;
+ }
+
+}
Added: oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/RpcCommunicationFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/RpcCommunicationFactory.java?rev=1701724&view=auto
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/RpcCommunicationFactory.java (added)
+++ oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/RpcCommunicationFactory.java Tue Sep 8 04:25:17 2015
@@ -0,0 +1,146 @@
+/*
+ * 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.filemgr.util;
+
+import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
+import org.apache.oodt.cas.filemgr.system.FileManagerServer;
+import org.apache.oodt.cas.filemgr.system.rpc.FileManagerClientFactory;
+import org.apache.oodt.cas.filemgr.system.rpc.FileManagerServerFactory;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ *
+ * Class that manage the initialization of {@link FileManagerServer} and {@link FileManagerClient}
+ * ether with AvroRpc or XmlRpc logic. Default is AvroRpc.
+ *
+ * @author radu
+ *
+ */
+public class RpcCommunicationFactory {
+
+ private static Logger LOG = Logger.getLogger(RpcCommunicationFactory.class
+ .getName());
+
+ private static String getClientFactoryName(){
+ return System.getProperty("filemgr.client",
+ "org.apache.oodt.cas.filemgr.system.rpc.AvroFileManagerClientFactory");
+ }
+
+ /**
+ * Set properties from filemgr.properties file
+ * to get name of RPC initialization class.
+ */
+ private static void setPror(){
+ // set up the configuration, if there is any
+ if (System.getProperty("org.apache.oodt.cas.filemgr.properties") != null) {
+ String configFile = System.getProperty("org.apache.oodt.cas.filemgr.properties");
+
+ LOG.log(Level.INFO, "Loading File Manager Configuration Properties from: [" + configFile + "]");
+
+ try {
+ System.getProperties().load(new FileInputStream(new File(configFile)));
+ } catch (Exception e) {
+ LOG.log(Level.INFO, "Error loading configuration properties from: [" + configFile + "]");
+ }
+ }
+ }
+
+ /**
+ * Initialization of RPC client.
+ * @param filemgrUrl
+ * @return instance of ether AvroRpc of XMLRPC of FileManagerClient default is AvroRpc.
+ * @throws ConnectionException
+ */
+ public static FileManagerClient createClient(URL filemgrUrl) throws ConnectionException {
+ setPror();
+
+ try {
+ FileManagerClientFactory fmcf= (FileManagerClientFactory) Class.forName(getClientFactoryName()).newInstance();
+ fmcf.setTestConnection(true);
+ fmcf.setUrl(filemgrUrl);
+ return fmcf.createFileManagerClient();
+ } catch (InstantiationException e) {
+ throw new ConnectionException(e.getMessage());
+ } catch (IllegalAccessException e) {
+ throw new ConnectionException(e.getMessage());
+ } catch (ClassNotFoundException e) {
+ throw new ConnectionException(e.getMessage());
+ }
+ }
+
+ /**
+ * Initialization of RPC client
+ * @param filemgrUrl
+ * @param testConnection
+ * @return instance of ether AvroRpc of XMLRPC of FileManagerClient.
+ * @throws ConnectionException
+ */
+ public static FileManagerClient createClient(URL filemgrUrl, boolean testConnection) throws ConnectionException {
+ setPror();
+
+ try {
+ FileManagerClientFactory fmcf= (FileManagerClientFactory) Class.forName(getClientFactoryName()).newInstance();
+ fmcf.setTestConnection(testConnection);
+ fmcf.setUrl(filemgrUrl);
+ return fmcf.createFileManagerClient();
+
+ } catch (InstantiationException e) {
+ throw new ConnectionException(e.getMessage());
+ } catch (IllegalAccessException e) {
+ throw new ConnectionException(e.getMessage());
+ } catch (ClassNotFoundException e) {
+ throw new ConnectionException(e.getMessage());
+ }
+ }
+
+ /**
+ *
+ * Initialization of RPC server.
+ *
+ * @param port
+ * @return instance of ether AvroRpc of XMLRPC of FileManagerServer.
+ * @throws IOException
+ */
+ public static FileManagerServer createServer(int port) throws IOException {
+ String serverFactory = System.getProperty("filemgr.server",
+ "org.apache.oodt.cas.filemgr.system.rpc.AvroFileManagerServerFactory");
+
+ LOG.log(Level.INFO, "Init. server's factory class: " + serverFactory);
+
+ try {
+ FileManagerServerFactory fmsf= (FileManagerServerFactory) Class.forName(serverFactory).newInstance();
+ fmsf.setPort(port);
+ return fmsf.createFileManagerServer();
+ } catch (InstantiationException e) {
+ LOG.log(Level.SEVERE, "Could not start FileManager server reason", e);
+ } catch (IllegalAccessException e) {
+ LOG.log(Level.SEVERE, "Could not start FileManager server reason", e);
+ } catch (ClassNotFoundException e) {
+ LOG.log(Level.SEVERE, "Could not start FileManager server reason", e);
+ }
+ return null;
+ }
+
+}
Modified: oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java?rev=1701724&r1=1701723&r2=1701724&view=diff
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java (original)
+++ oodt/branches/avro_rpc/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java Tue Sep 8 04:25:17 2015
@@ -346,7 +346,7 @@ public final class XmlRpcStructFactory {
public static Hashtable<String, Object> getXmlRpcProductType(ProductType type) {
Hashtable<String, Object> productTypeHash = new Hashtable<String, Object>();
- // TODO(bfoster): ProductType ID is currently required by XmlRpcFileManager.
+ // TODO(bfoster): ProductType ID is currently required by XmlRpcFileManagerServer.
productTypeHash.put("id", type.getProductTypeId());
if (type.getName() != null) {
productTypeHash.put("name", type.getName());
Modified: oodt/branches/avro_rpc/filemgr/src/main/resources/filemgr.properties
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/main/resources/filemgr.properties?rev=1701724&r1=1701723&r2=1701724&view=diff
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/main/resources/filemgr.properties (original)
+++ oodt/branches/avro_rpc/filemgr/src/main/resources/filemgr.properties Tue Sep 8 04:25:17 2015
@@ -15,6 +15,12 @@
# Configuration properties for the File Manager
+# rpc configuration, uncomment the avro implementations to use AvroRPC
+filemgr.server=org.apache.oodt.cas.filemgr.system.rpc.XmlRpcFileManagerServerFactory
+filemgr.client=org.apache.oodt.cas.filemgr.system.rpc.XmlRpcFileManagerClientFactory
+#filemgr.server=org.apache.oodt.cas.filemgr.system.rpc.AvroFileManagerServerFactory
+#filemgr.client=org.apache.oodt.cas.filemgr.system.rpc.AvroFileManagerClientFactory
+
# repository factory
filemgr.repository.factory=org.apache.oodt.cas.filemgr.repository.XMLRepositoryManagerFactory
Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/TestFileManagerCli.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/TestFileManagerCli.java?rev=1701724&r1=1701723&r2=1701724&view=diff
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/TestFileManagerCli.java (original)
+++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/TestFileManagerCli.java Tue Sep 8 04:25:17 2015
@@ -40,8 +40,8 @@ import org.apache.oodt.cas.filemgr.struc
import org.apache.oodt.cas.filemgr.structs.TermQueryCriteria;
import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
import org.apache.oodt.cas.filemgr.structs.query.ComplexQuery;
-import org.apache.oodt.cas.filemgr.system.MockXmlRpcFileManagerClient;
-import org.apache.oodt.cas.filemgr.system.MockXmlRpcFileManagerClient.MethodCallDetails;
+import org.apache.oodt.cas.filemgr.system.MockFileManagerClient;
+import org.apache.oodt.cas.filemgr.system.MockFileManagerClient.MethodCallDetails;
import org.apache.oodt.cas.metadata.Metadata;
//Google imports
@@ -55,7 +55,7 @@ import com.google.common.collect.Lists;
public class TestFileManagerCli extends TestCase {
private CmdLineUtility cmdLineUtility;
- private MockXmlRpcFileManagerClient client;
+ private MockFileManagerClient client;
private Properties initialProperties = new Properties(
System.getProperties());
Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/UseMockClientCmdLineActionStore.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/UseMockClientCmdLineActionStore.java?rev=1701724&r1=1701723&r2=1701724&view=diff
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/UseMockClientCmdLineActionStore.java (original)
+++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/UseMockClientCmdLineActionStore.java Tue Sep 8 04:25:17 2015
@@ -24,7 +24,7 @@ import org.apache.oodt.cas.cli.action.Cm
import org.apache.oodt.cas.cli.action.store.spring.SpringCmdLineActionStore;
import org.apache.oodt.cas.cli.exception.CmdLineActionStoreException;
import org.apache.oodt.cas.filemgr.cli.action.FileManagerCliAction;
-import org.apache.oodt.cas.filemgr.system.MockXmlRpcFileManagerClient;
+import org.apache.oodt.cas.filemgr.system.MockFileManagerClient;
/**
* A {@link SpringCmdLineActionStore} which sets {@link WorkflowCliAction}s
@@ -34,12 +34,12 @@ import org.apache.oodt.cas.filemgr.syste
*/
public class UseMockClientCmdLineActionStore extends SpringCmdLineActionStore {
- private MockXmlRpcFileManagerClient client;
+ private MockFileManagerClient client;
public UseMockClientCmdLineActionStore() {
super(System.getProperty("org.apache.oodt.cas.cli.action.spring.config"));
try {
- client = new MockXmlRpcFileManagerClient();
+ client = new MockFileManagerClient();
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -55,7 +55,7 @@ public class UseMockClientCmdLineActionS
return actions;
}
- public MockXmlRpcFileManagerClient getClient() {
+ public MockFileManagerClient getClient() {
return client;
}
}
Added: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/DummyFileManagerClient.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/DummyFileManagerClient.java?rev=1701724&view=auto
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/DummyFileManagerClient.java (added)
+++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/DummyFileManagerClient.java Tue Sep 8 04:25:17 2015
@@ -0,0 +1,288 @@
+package org.apache.oodt.cas.filemgr.cli.action;
+
+import org.apache.oodt.cas.filemgr.datatransfer.DataTransfer;
+import org.apache.oodt.cas.filemgr.structs.*;
+import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.DataTransferException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.ValidationLayerException;
+import org.apache.oodt.cas.filemgr.structs.query.ComplexQuery;
+import org.apache.oodt.cas.filemgr.structs.query.QueryResult;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.xmlrpc.XmlRpcException;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+
+public class DummyFileManagerClient implements FileManagerClient {
+
+
+ URL url;
+
+ public DummyFileManagerClient(URL url,boolean testConnection){
+ this.url = url;
+ }
+
+
+ @Override
+ public boolean refreshConfigAndPolicy() {
+ return false;
+ }
+
+ @Override
+ public boolean isAlive() {
+ return false;
+ }
+
+ @Override
+ public boolean transferringProduct(Product product) throws DataTransferException {
+ return false;
+ }
+
+ @Override
+ public boolean removeProductTransferStatus(Product product) throws DataTransferException {
+ return false;
+ }
+
+ @Override
+ public boolean isTransferComplete(Product product) throws DataTransferException {
+ return false;
+ }
+
+ @Override
+ public boolean moveProduct(Product product, String newPath) throws DataTransferException {
+ return false;
+ }
+
+ @Override
+ public boolean modifyProduct(Product product) throws CatalogException {
+ return false;
+ }
+
+ @Override
+ public boolean removeProduct(Product product) throws CatalogException {
+ return false;
+ }
+
+ @Override
+ public FileTransferStatus getCurrentFileTransfer() throws DataTransferException {
+ return null;
+ }
+
+ @Override
+ public List<FileTransferStatus> getCurrentFileTransfers() throws DataTransferException {
+ return null;
+ }
+
+ @Override
+ public double getProductPctTransferred(Product product) throws DataTransferException {
+ return 0;
+ }
+
+ @Override
+ public double getRefPctTransferred(Reference reference) throws DataTransferException {
+ return 0;
+ }
+
+ @Override
+ public ProductPage pagedQuery(Query query, ProductType type, int pageNum) throws CatalogException {
+ return null;
+ }
+
+ @Override
+ public ProductPage getFirstPage(ProductType type) throws CatalogException {
+ return null;
+ }
+
+ @Override
+ public ProductPage getLastPage(ProductType type) throws CatalogException {
+ return null;
+ }
+
+ @Override
+ public ProductPage getNextPage(ProductType type, ProductPage currPage) throws CatalogException {
+ return null;
+ }
+
+ @Override
+ public ProductPage getPrevPage(ProductType type, ProductPage currPage) throws CatalogException {
+ return null;
+ }
+
+ @Override
+ public String addProductType(ProductType type) throws RepositoryManagerException {
+ return null;
+ }
+
+ @Override
+ public boolean hasProduct(String productName) throws CatalogException {
+ return false;
+ }
+
+ @Override
+ public int getNumProducts(ProductType type) throws CatalogException {
+ return 0;
+ }
+
+ @Override
+ public List<Product> getTopNProducts(int n) throws CatalogException {
+ return null;
+ }
+
+ @Override
+ public List<Product> getTopNProducts(int n, ProductType type) throws CatalogException {
+ return null;
+ }
+
+ @Override
+ public void setProductTransferStatus(Product product) throws CatalogException {
+
+ }
+
+ @Override
+ public void addProductReferences(Product product) throws CatalogException {
+
+ }
+
+ @Override
+ public void addMetadata(Product product, Metadata metadata) throws CatalogException {
+
+ }
+
+ @Override
+ public boolean updateMetadata(Product product, Metadata met) throws CatalogException {
+ return false;
+ }
+
+ @Override
+ public String catalogProduct(Product product) throws CatalogException {
+ return null;
+ }
+
+ @Override
+ public Metadata getMetadata(Product product) throws CatalogException {
+ return null;
+ }
+
+ @Override
+ public Metadata getReducedMetadata(Product product, List<?> elements) throws CatalogException {
+ return null;
+ }
+
+ @Override
+ public boolean removeFile(String filePath) throws DataTransferException {
+ return false;
+ }
+
+ @Override
+ public byte[] retrieveFile(String filePath, int offset, int numBytes) throws DataTransferException {
+ return new byte[0];
+ }
+
+ @Override
+ public void transferFile(String filePath, byte[] fileData, int offset, int numBytes) throws DataTransferException {
+
+ }
+
+ @Override
+ public List<Product> getProductsByProductType(ProductType type) throws CatalogException {
+ return null;
+ }
+
+ @Override
+ public List<Element> getElementsByProductType(ProductType type) throws ValidationLayerException {
+ return null;
+ }
+
+ @Override
+ public Element getElementById(String elementId) throws ValidationLayerException {
+ return null;
+ }
+
+ @Override
+ public Element getElementByName(String elementName) throws ValidationLayerException {
+ return null;
+ }
+
+ @Override
+ public List<QueryResult> complexQuery(ComplexQuery complexQuery) throws CatalogException {
+ return null;
+ }
+
+ @Override
+ public List<Product> query(Query query, ProductType type) throws CatalogException {
+ return null;
+ }
+
+ @Override
+ public ProductType getProductTypeByName(String productTypeName) throws RepositoryManagerException {
+ return null;
+ }
+
+ @Override
+ public ProductType getProductTypeById(String productTypeId) throws RepositoryManagerException {
+ return null;
+ }
+
+ @Override
+ public List<ProductType> getProductTypes() throws RepositoryManagerException {
+ return null;
+ }
+
+ @Override
+ public List<Reference> getProductReferences(Product product) throws CatalogException {
+ return null;
+ }
+
+ @Override
+ public Product getProductById(String productId) throws CatalogException {
+ return null;
+ }
+
+ @Override
+ public Product getProductByName(String productName) throws CatalogException {
+ return null;
+ }
+
+ @Override
+ public String ingestProduct(Product product, Metadata metadata, boolean clientTransfer) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Metadata getCatalogValues(Metadata metadata, ProductType productType) throws XmlRpcException, IOException {
+ return null;
+ }
+
+ @Override
+ public Metadata getOrigValues(Metadata metadata, ProductType productType) throws XmlRpcException, IOException {
+ return null;
+ }
+
+ @Override
+ public Query getCatalogQuery(Query query, ProductType productType) throws XmlRpcException, IOException {
+ return null;
+ }
+
+ @Override
+ public URL getFileManagerUrl() {
+ return this.url;
+ }
+
+ @Override
+ public void setFileManagerUrl(URL fileManagerUrl) {
+
+ }
+
+ @Override
+ public DataTransfer getDataTransfer() {
+ return null;
+ }
+
+ @Override
+ public void setDataTransfer(DataTransfer dataTransfer) {
+
+ }
+}
Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestAddProductTypeCliAction.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestAddProductTypeCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestAddProductTypeCliAction.java (original)
+++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestAddProductTypeCliAction.java Tue Sep 8 04:25:17 2015
@@ -25,7 +25,7 @@ import org.apache.oodt.cas.cli.action.Cm
import org.apache.oodt.cas.cli.exception.CmdLineActionException;
import org.apache.oodt.cas.filemgr.structs.ProductType;
import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
-import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
import org.apache.oodt.cas.filemgr.versioning.BasicVersioner;
//JUnit imports
@@ -109,10 +109,10 @@ public class TestAddProductTypeCliAction
}
public class MockAddProductTypeCliAction extends AddProductTypeCliAction {
- public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ public FileManagerClient getClient() throws MalformedURLException,
ConnectionException {
- return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
- false) {
+ return new DummyFileManagerClient(new URL("http://localhost:9000"),false)
+ {
public String addProductType(ProductType type) {
productTypePassedToClient = type;
return PRODUCT_TYPE_ID;
Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestDeleteProductByIdCliAction.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestDeleteProductByIdCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestDeleteProductByIdCliAction.java (original)
+++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestDeleteProductByIdCliAction.java Tue Sep 8 04:25:17 2015
@@ -27,7 +27,7 @@ import org.apache.oodt.cas.cli.exception
import org.apache.oodt.cas.filemgr.structs.Product;
import org.apache.oodt.cas.filemgr.structs.Reference;
import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
-import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
//Google imports
import com.google.common.collect.Lists;
@@ -109,9 +109,9 @@ public class TestDeleteProductByIdCliAct
public class MockDeleteProductByIdCliAction extends
DeleteProductByIdCliAction {
@Override
- public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ public FileManagerClient getClient() throws MalformedURLException,
ConnectionException {
- return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ return new DummyFileManagerClient(new URL("http://localhost:9000"),
false) {
@Override
public Product getProductById(String productId) {
@@ -143,9 +143,9 @@ public class TestDeleteProductByIdCliAct
public class NullProductDeleteProductByIdCliAction extends
MockDeleteProductByIdCliAction {
@Override
- public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ public FileManagerClient getClient() throws MalformedURLException,
ConnectionException {
- return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ return new DummyFileManagerClient(new URL("http://localhost:9000"),
false) {
@Override
public Product getProductById(String productId) {
@@ -158,9 +158,9 @@ public class TestDeleteProductByIdCliAct
public class NullRefsDeleteProductByIdCliAction extends
MockDeleteProductByIdCliAction {
@Override
- public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ public FileManagerClient getClient() throws MalformedURLException,
ConnectionException {
- return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ return new DummyFileManagerClient(new URL("http://localhost:9000"),
false) {
@Override
public Product getProductById(String productId) {
@@ -180,9 +180,9 @@ public class TestDeleteProductByIdCliAct
public class FalseDeleteProductByIdCliAction extends
MockDeleteProductByIdCliAction {
@Override
- public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ public FileManagerClient getClient() throws MalformedURLException,
ConnectionException {
- return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ return new DummyFileManagerClient(new URL("http://localhost:9000"),
false) {
@Override
public Product getProductById(String productId) {
Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestDeleteProductByNameCliAction.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestDeleteProductByNameCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestDeleteProductByNameCliAction.java (original)
+++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestDeleteProductByNameCliAction.java Tue Sep 8 04:25:17 2015
@@ -27,7 +27,7 @@ import org.apache.oodt.cas.cli.exception
import org.apache.oodt.cas.filemgr.structs.Product;
import org.apache.oodt.cas.filemgr.structs.Reference;
import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
-import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
//Google imports
import com.google.common.collect.Lists;
@@ -108,9 +108,9 @@ public class TestDeleteProductByNameCliA
public class MockDeleteProductByNameCliAction extends DeleteProductByNameCliAction {
@Override
- public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ public FileManagerClient getClient() throws MalformedURLException,
ConnectionException {
- return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ return new DummyFileManagerClient(new URL("http://localhost:9000"),
false) {
@Override
public Product getProductByName(String productName) {
@@ -141,9 +141,9 @@ public class TestDeleteProductByNameCliA
public class NullProductDeleteProductByNameCliAction extends MockDeleteProductByNameCliAction {
@Override
- public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ public FileManagerClient getClient() throws MalformedURLException,
ConnectionException {
- return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ return new DummyFileManagerClient(new URL("http://localhost:9000"),
false) {
@Override
public Product getProductByName(String productName) {
@@ -156,9 +156,9 @@ public class TestDeleteProductByNameCliA
public class NullRefsDeleteProductByNameCliAction extends
MockDeleteProductByNameCliAction {
@Override
- public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ public FileManagerClient getClient() throws MalformedURLException,
ConnectionException {
- return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ return new DummyFileManagerClient(new URL("http://localhost:9000"),
false) {
@Override
public List<Reference> getProductReferences(Product product) {
@@ -170,9 +170,9 @@ public class TestDeleteProductByNameCliA
public class FalseDeleteProductByNameCliAction extends MockDeleteProductByNameCliAction {
@Override
- public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ public FileManagerClient getClient() throws MalformedURLException,
ConnectionException {
- return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ return new DummyFileManagerClient(new URL("http://localhost:9000"),
false) {
@Override
public boolean removeProduct(Product p) {
Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestDumpMetadataCliAction.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestDumpMetadataCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestDumpMetadataCliAction.java (original)
+++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestDumpMetadataCliAction.java Tue Sep 8 04:25:17 2015
@@ -33,7 +33,7 @@ import org.apache.oodt.cas.cli.action.Cm
import org.apache.oodt.cas.cli.exception.CmdLineActionException;
import org.apache.oodt.cas.filemgr.structs.Product;
import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
-import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
import org.apache.oodt.cas.metadata.Metadata;
//JUnit imports
@@ -95,9 +95,9 @@ public class TestDumpMetadataCliAction e
public class MockDumpMetadataCliAction extends DumpMetadataCliAction {
@Override
- public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ public FileManagerClient getClient() throws MalformedURLException,
ConnectionException {
- return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ return new DummyFileManagerClient(new URL("http://localhost:9000"),
false) {
@Override
public Product getProductById(String productId) {
Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetCurrentTransferCliAction.java
URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetCurrentTransferCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff
==============================================================================
--- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetCurrentTransferCliAction.java (original)
+++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetCurrentTransferCliAction.java Tue Sep 8 04:25:17 2015
@@ -27,7 +27,7 @@ import org.apache.oodt.cas.filemgr.struc
import org.apache.oodt.cas.filemgr.structs.Product;
import org.apache.oodt.cas.filemgr.structs.Reference;
import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
-import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
//JUnit imports
import junit.framework.TestCase;
@@ -71,9 +71,9 @@ public class TestGetCurrentTransferCliAc
public class MockGetCurrentTransferCliAction extends
GetCurrentTransferCliAction {
- public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ public FileManagerClient getClient() throws MalformedURLException,
ConnectionException {
- return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ return new DummyFileManagerClient(new URL("http://localhost:9000"),
false) {
public FileTransferStatus getCurrentFileTransfer() {
status = new FileTransferStatus();
@@ -90,9 +90,9 @@ public class TestGetCurrentTransferCliAc
public class NullStatusGetCurrentTransferCliAction extends
GetCurrentTransferCliAction {
- public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ public FileManagerClient getClient() throws MalformedURLException,
ConnectionException {
- return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ return new DummyFileManagerClient(new URL("http://localhost:9000"),
false) {
public FileTransferStatus getCurrentFileTransfer() {
return null;