Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7237D200CF8 for ; Tue, 18 Jul 2017 01:05:24 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 70B0E165F2B; Mon, 17 Jul 2017 23:05:24 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 182A0165F28 for ; Tue, 18 Jul 2017 01:05:19 +0200 (CEST) Received: (qmail 49453 invoked by uid 500); 17 Jul 2017 23:05:19 -0000 Mailing-List: contact commits-help@oodt.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@oodt.apache.org Delivered-To: mailing list commits@oodt.apache.org Received: (qmail 49318 invoked by uid 99); 17 Jul 2017 23:05:19 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Jul 2017 23:05:19 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 46C62F5549; Mon, 17 Jul 2017 23:05:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mattmann@apache.org To: commits@oodt.apache.org Date: Mon, 17 Jul 2017 23:05:26 -0000 Message-Id: In-Reply-To: <95eff81647544b1996db031f8290e90b@git.apache.org> References: <95eff81647544b1996db031f8290e90b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [11/88] [abbrv] [partial] oodt git commit: Record change for OODT-836, OODT-837. archived-at: Mon, 17 Jul 2017 23:05:24 -0000 http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/TestJschSftpProtocol.java ---------------------------------------------------------------------- diff --git a/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/TestJschSftpProtocol.java b/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/TestJschSftpProtocol.java deleted file mode 100644 index 2cdd2eb..0000000 --- a/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/TestJschSftpProtocol.java +++ /dev/null @@ -1,298 +0,0 @@ -/* - * 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.protocol.sftp; - -//JUnit imports - -import org.apache.commons.io.FileUtils; -import org.apache.mina.util.AvailablePortFinder; -import org.apache.oodt.cas.protocol.ProtocolFile; -import org.apache.oodt.cas.protocol.exceptions.ProtocolException; -import org.apache.oodt.cas.protocol.sftp.auth.HostKeyAuthentication; -import org.apache.oodt.cas.protocol.util.ProtocolFileFilter; - -import com.sshtools.daemon.SshDaemon; -import com.sshtools.daemon.configuration.PlatformConfiguration; -import com.sshtools.daemon.configuration.ServerConfiguration; -import com.sshtools.daemon.configuration.XmlServerConfigurationContext; -import com.sshtools.j2ssh.configuration.ConfigurationException; -import com.sshtools.j2ssh.configuration.ConfigurationLoader; - -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.xml.sax.SAXException; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintStream; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.xml.parsers.ParserConfigurationException; - -import junit.framework.TestCase; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; - -//JAVAX imports -//OODT imports -//SshTools imports -//JUnit imports - -/** - * Test class for {@link JschSftpProtocol}. - * - * @author bfoster - */ -public class TestJschSftpProtocol extends TestCase { - - static TestXmlServerConfigurationContext context; - static final Logger LOG = Logger.getLogger(TestJschSftpProtocol.class.getName()); - static Thread thread; - File publicKeysDir; - - @Override - public void setUp() { - try { - publicKeysDir = new File("src/test/resources/publicKeys"); - publicKeysDir.mkdirs(); - FileUtils.forceDeleteOnExit(publicKeysDir); - FileUtils.copyFile(new File("src/test/resources/authorization.xml"), new File("src/test/resources/publicKeys/authorization.xml")); - FileUtils.copyFile(new File("src/test/resources/server.xml"), new File("src/test/resources/publicKeys/server.xml")); - FileUtils.copyFile(new File("src/test/resources/platform.xml"), new File("src/test/resources/publicKeys/platform.xml")); - ConfigurationLoader.initialize(true, context = new TestXmlServerConfigurationContext()); - } catch (Exception e) { - fail("Failed to initialize server configuration"); - } - - (thread = new Thread(new Runnable() { - public void run() { - try { - SshDaemon.start(); - } catch (Exception e) { - LOG.log(Level.SEVERE, e.getMessage()); - } - } - - })).start(); - } - - @Override - public void tearDown() throws IOException { - FileUtils.forceDelete(publicKeysDir); - SshDaemon.stop(""); - } - - public void testCDandPWDandLS() throws IOException, ProtocolException { - int port = context.getPort(); - File pubKeyFile = createPubKeyForPort(port); - JschSftpProtocol sftpProtocol = spy(new JschSftpProtocol(port)); - Mockito.doAnswer(new Answer() { - public Object answer(InvocationOnMock invocation) { - return null; - }}).when(sftpProtocol).connect("localhost", new HostKeyAuthentication("bfoster", "", - pubKeyFile.getAbsoluteFile().getAbsolutePath())); - - sftpProtocol.connect("localhost", new HostKeyAuthentication("bfoster", "", - pubKeyFile.getAbsoluteFile().getAbsolutePath())); - ProtocolFile homeDir = sftpProtocol.pwd(); - ProtocolFile testDir = new ProtocolFile(homeDir, "sshTestDir", true); - sftpProtocol.cd(testDir); - - Mockito.when(sftpProtocol.pwd()).thenReturn(new ProtocolFile(homeDir, "sshTestDir", true)); - - - assertEquals(testDir, sftpProtocol.pwd()); - List lsResults = new ArrayList( - sftpProtocol.ls(new ProtocolFileFilter() { - public boolean accept(ProtocolFile file) { - return file.getName().equals("sshTestFile"); - } - })); - assertEquals(1, lsResults.size()); - ProtocolFile testFile = lsResults.get(0); - ProtocolFile testnew = new ProtocolFile(testDir, "sshTestFile", false); - assertEquals(new ProtocolFile(null, testDir.getPath()+"/sshTestFile", false), testFile); - } - - public void testGET() throws ProtocolException, IOException { - int port = context.getPort(); - File pubKeyFile = createPubKeyForPort(port); - //JschSftpProtocol sftpProtocol = new JschSftpProtocol(port); - JschSftpProtocol mockc = mock(JschSftpProtocol.class); - - Mockito.doAnswer(new Answer() { - public Object answer(InvocationOnMock invocation) { - return null; - }}).when(mockc).connect("localhost", new HostKeyAuthentication("bfoster", "", - pubKeyFile.getAbsoluteFile().getAbsolutePath())); - mockc.connect("localhost", new HostKeyAuthentication("bfoster", "", - pubKeyFile.getAbsoluteFile().getAbsolutePath())); - - - File bogusFile = File.createTempFile("bogus", "bogus"); - final File tmpFile = new File(bogusFile.getParentFile(), "TestJschSftpProtocol"); - bogusFile.delete(); - tmpFile.mkdirs(); - mockc.cd(new ProtocolFile("sshTestDir", true)); - File testDownloadFile = new File(tmpFile, "testDownloadFile"); - - Mockito.doAnswer(new Answer(){ - public Object answer(InvocationOnMock invocationOnMock) throws IOException { - - PrintWriter writer = new PrintWriter(tmpFile+"/testDownloadFile", "UTF-8"); - writer.print(readFile("src/test/resources/sshTestDir/sshTestFile")); - writer.close(); - - return null; - } - }).when(mockc).get(new ProtocolFile("sshTestFile", false), testDownloadFile); - - - mockc.get(new ProtocolFile("sshTestFile", false), testDownloadFile); - - assertTrue(FileUtils.contentEquals(new File("src/test/resources/sshTestDir/sshTestFile"), testDownloadFile)); - - FileUtils.forceDelete(tmpFile); - } - - public String readFile(String path){ - BufferedReader buffReader = null; - try{ - buffReader = new BufferedReader (new FileReader(path)); - String line = buffReader.readLine(); - StringBuilder build = new StringBuilder(); - while(line != null){ - build.append(line); - build.append("\n"); - System.out.println(line); - line = buffReader.readLine(); - - - } - return build.toString(); - }catch(IOException ioe){ - LOG.log(Level.SEVERE, ioe.getMessage()); - }finally{ - try{ - buffReader.close(); - }catch(IOException ioe1){ - //Leave It - } - - } - return path; - } - - private static class TestServerConfiguration extends ServerConfiguration { - - int commandPort = AvailablePortFinder.getNextAvailable(12222); - int port = AvailablePortFinder.getNextAvailable(2022); - - public TestServerConfiguration(InputStream is) throws SAXException, - ParserConfigurationException, IOException { - super(is); - } - - @Override - public int getCommandPort() { - return commandPort; - } - - @Override - public int getPort() { - return port; - } - } - - private static class TestXmlServerConfigurationContext extends XmlServerConfigurationContext { - - private TestServerConfiguration serverConfig; - private PlatformConfiguration platformConfig; - - public TestXmlServerConfigurationContext() { - super(); - } - - @Override - public void initialize() throws ConfigurationException { - try { - serverConfig = new TestServerConfiguration(ConfigurationLoader.loadFile("src/test/resources/publicKeys/server.xml")); - } catch (Exception e) { - throw new ConfigurationException(e.getMessage()); - } - try { - platformConfig = new PlatformConfiguration(ConfigurationLoader.loadFile("src/test/resources/publicKeys/platform.xml")) {}; - } catch (Exception e) { - throw new ConfigurationException(e.getMessage()); - } - } - - @Override - public boolean isConfigurationAvailable(@SuppressWarnings("rawtypes") Class cls) { - try { - getConfiguration(cls); - return true; - } catch (Exception e) { - return false; - } - } - - @Override - public Object getConfiguration(@SuppressWarnings("rawtypes") Class cls) throws ConfigurationException { - if (ServerConfiguration.class.equals(cls)) { - return serverConfig; - } else if (PlatformConfiguration.class.equals(cls)) { - return platformConfig; - } else { - throw new ConfigurationException(cls.getName() - + " configuration not available"); - } - } - - public int getPort() { - return serverConfig.getPort(); - } - } - - private File createPubKeyForPort(int port) throws IOException { - PrintStream ps = null; - BufferedReader br = null; - try { - File publicKeyFile = new File(publicKeysDir, "sample-dsa.pub"); - br = new BufferedReader(new FileReader(new File("src/test/resources/sample-dsa.pub").getAbsoluteFile())); - ps = new PrintStream(new FileOutputStream(publicKeyFile)); - String nextLine; - while ((nextLine = br.readLine()) != null) { - ps.println(nextLine.replace("2022", Integer.toString(port))); - } - return publicKeyFile; - } finally { - try { ps.close(); } catch (Exception ignored) {} - try { br.close(); } catch (Exception ignored) {} - } - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/UnsupportedShellProcessProvider.java ---------------------------------------------------------------------- diff --git a/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/UnsupportedShellProcessProvider.java b/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/UnsupportedShellProcessProvider.java deleted file mode 100644 index 9e784b8..0000000 --- a/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/UnsupportedShellProcessProvider.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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.protocol.sftp; - -//JDK imports -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Map; - -//SshTools imports -import com.sshtools.daemon.platform.NativeProcessProvider; -import com.sshtools.j2ssh.io.DynamicBuffer; - -/** - * This is a shell provider that prints a message saying that we don't support - * shell access, and then closes the connection. - */ -public final class UnsupportedShellProcessProvider extends - NativeProcessProvider { - - private static final String MESSAGE = "This server does not provide shell access, only SFTP. Goodbye.\n"; - - private DynamicBuffer stdin = new DynamicBuffer(); - private DynamicBuffer stderr = new DynamicBuffer(); - private DynamicBuffer stdout = new DynamicBuffer(); - - @Override - public boolean createProcess(final String command, final Map environment) - throws IOException { - return true; - } - - @Override - public String getDefaultTerminalProvider() { - return "UnsupportedShell"; - } - - @Override - public void kill() { - try { - stdin.getInputStream().close(); - stdin.getOutputStream().close(); - } catch (Exception ignored) { - } - try { - stdout.getInputStream().close(); - stdout.getOutputStream().close(); - } catch (Exception ignored) { - } - try { - stderr.getInputStream().close(); - stderr.getOutputStream().close(); - } catch (Exception ignored) { - } - } - - @Override - public void start() throws IOException { - stdin.getOutputStream().write(MESSAGE.getBytes()); - } - - @Override - public boolean stillActive() { - try { - return stdin.getInputStream().available() > 0; - } catch (IOException ex) { - return false; - } - } - - @Override - public boolean supportsPseudoTerminal(final String term) { - return true; - } - - @Override - public boolean allocatePseudoTerminal(final String term, final int cols, - final int rows, final int width, final int height, final String modes) { - return true; - } - - @Override - public int waitForExitCode() { - return 0; - } - - public InputStream getInputStream() throws IOException { - return stdin.getInputStream(); - } - - public OutputStream getOutputStream() throws IOException { - return stdout.getOutputStream(); - } - - public InputStream getStderrInputStream() { - return stderr.getInputStream(); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/auth/TestHostKeyAuthentication.java ---------------------------------------------------------------------- diff --git a/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/auth/TestHostKeyAuthentication.java b/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/auth/TestHostKeyAuthentication.java deleted file mode 100644 index 5dbb514..0000000 --- a/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/auth/TestHostKeyAuthentication.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.protocol.sftp.auth; - -//JUnit imports -import junit.framework.TestCase; - -/** - * Test class for {@link HostKeyAuthentication}. - * - * @author bfoster - */ -public class TestHostKeyAuthentication extends TestCase { - - public void testInitialState() { - HostKeyAuthentication auth = new HostKeyAuthentication("user", "pass", "file"); - assertEquals("user", auth.getUser()); - assertEquals("pass", auth.getPass()); - assertEquals("file", auth.getHostKeyFile()); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/resources/authorization.xml ---------------------------------------------------------------------- diff --git a/protocol/sftp/src/test/resources/authorization.xml b/protocol/sftp/src/test/resources/authorization.xml deleted file mode 100644 index da00e69..0000000 --- a/protocol/sftp/src/test/resources/authorization.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - sample-dsa.pub - - http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/resources/platform.xml ---------------------------------------------------------------------- diff --git a/protocol/sftp/src/test/resources/platform.xml b/protocol/sftp/src/test/resources/platform.xml deleted file mode 100644 index b0f93af..0000000 --- a/protocol/sftp/src/test/resources/platform.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - org.apache.oodt.cas.protocol.sftp.UnsupportedShellProcessProvider - - - org.apache.oodt.cas.protocol.sftp.DummyAuthenticationProvider - - com.sshtools.daemon.vfs.VirtualFileSystem - - - - http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/resources/sample-dsa.key ---------------------------------------------------------------------- diff --git a/protocol/sftp/src/test/resources/sample-dsa.key b/protocol/sftp/src/test/resources/sample-dsa.key deleted file mode 100644 index ad94854..0000000 --- a/protocol/sftp/src/test/resources/sample-dsa.key +++ /dev/null @@ -1,12 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBvAIBAAKBgQD/dvNwGfLUx8hRXmJRN/zEvlrUVgOPuYao0JQfcdwz4Zqi/kDq -+4I/GsGphw8v/pI0g0N5jHiiGQ+apVoSOXoYgrW6YNKHIpmBvM1zVQWA33bAqq/+ -+k+9Bugp8xvAA5AXUrPdRKQiKYC5ECYX/lIDZCSgty6QrQSnhmAECdm6mQIVAO/1 -X4nkLhL4jwhOGMUmuTVOQxwJAoGBAMi/2mkZc1Aj7FQCJsv/j/Th9eYLYJ1JaeFm -iYhfkggMfoKyfWlEEjll56UThZL+ZyC2WVUUWDuTrt77zVPUGxEFM2gwL9judLaq -lV+rOFrwf5LcaQnSoNHWrkf2MUy+juinZFHN/2eI+mQXv0/07IQjbCDAH0U1rr97 -Qxw9Saa3AoGAVMOH1a6meQj4pzZZ9BEkFVVQAuC+DBqxZND2flxIMnO/Z9si1Znw -0z0ClXXY5vpk1DQJ2FI60aufqYgg/2UhQNjTp37DKL6sk4aK25wwXLWbuaf6b9Ah -IFwU+g5xSm0j12P40AqaNIhLoCv2FPXSHvnJDsZw3r703ITUB+hwlEwCFQCjIrDI -YOzgRFkXJwfZCKVpo3L1JA== ------END DSA PRIVATE KEY----- \ No newline at end of file http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/resources/sample-dsa.pub ---------------------------------------------------------------------- diff --git a/protocol/sftp/src/test/resources/sample-dsa.pub b/protocol/sftp/src/test/resources/sample-dsa.pub deleted file mode 100644 index 9a1c9b6..0000000 --- a/protocol/sftp/src/test/resources/sample-dsa.pub +++ /dev/null @@ -1 +0,0 @@ -[localhost]:2022 ssh-dss AAAAB3NzaC1kc3MAAACBAP9283AZ8tTHyFFeYlE3/MS+WtRWA4+5hqjQlB9x3DPhmqL+QOr7gj8awamHDy/+kjSDQ3mMeKIZD5qlWhI5ehiCtbpg0ocimYG8zXNVBYDfdsCqr/76T70G6CnzG8ADkBdSs91EpCIpgLkQJhf+UgNkJKC3LpCtBKeGYAQJ2bqZAAAAFQDv9V+J5C4S+I8IThjFJrk1TkMcCQAAAIEAyL/aaRlzUCPsVAImy/+P9OH15gtgnUlp4WaJiF+SCAx+grJ9aUQSOWXnpROFkv5nILZZVRRYO5Ou3vvNU9QbEQUzaDAv2O50tqqVX6s4WvB/ktxpCdKg0dauR/YxTL6O6KdkUc3/Z4j6ZBe/T/TshCNsIMAfRTWuv3tDHD1JprcAAACAVMOH1a6meQj4pzZZ9BEkFVVQAuC+DBqxZND2flxIMnO/Z9si1Znw0z0ClXXY5vpk1DQJ2FI60aufqYgg/2UhQNjTp37DKL6sk4aK25wwXLWbuaf6b9AhIFwU+g5xSm0j12P40AqaNIhLoCv2FPXSHvnJDsZw3r703ITUB+hwlEw= http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/resources/server.xml ---------------------------------------------------------------------- diff --git a/protocol/sftp/src/test/resources/server.xml b/protocol/sftp/src/test/resources/server.xml deleted file mode 100644 index b690761..0000000 --- a/protocol/sftp/src/test/resources/server.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - password - keyboard-interactive - - - http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/resources/sshTestDir/sshTestFile ---------------------------------------------------------------------- diff --git a/protocol/sftp/src/test/resources/sshTestDir/sshTestFile b/protocol/sftp/src/test/resources/sshTestDir/sshTestFile deleted file mode 100644 index 2556d55..0000000 --- a/protocol/sftp/src/test/resources/sshTestDir/sshTestFile +++ /dev/null @@ -1,18 +0,0 @@ -# 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. - -This is a -test -File http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/pom.xml ---------------------------------------------------------------------- diff --git a/pushpull/pom.xml b/pushpull/pom.xml deleted file mode 100644 index a451ce2..0000000 --- a/pushpull/pom.xml +++ /dev/null @@ -1,181 +0,0 @@ - - - - - 4.0.0 - - org.apache.oodt - oodt-core - 1.1-SNAPSHOT - ../core/pom.xml - - cas-pushpull - CAS Push-Pull-Framework - - - - com.google.guava - guava - 10.0.1 - - - junit - junit - 4.8.1 - test - - - org.apache.oodt - cas-filemgr - ${project.parent.version} - - - org.apache.oodt - cas-metadata - ${project.parent.version} - - - org.apache.oodt - cas-protocol-api - ${project.parent.version} - - - org.apache.oodt - cas-protocol-ftp - ${project.parent.version} - - - org.apache.oodt - cas-protocol-http - ${project.parent.version} - - - org.apache.oodt - cas-protocol-imaps - ${project.parent.version} - - - org.apache.oodt - cas-protocol-sftp - ${project.parent.version} - - - org.hamcrest - hamcrest-all - 1.3 - test - - - org.mockito - mockito-all - 1.9.5 - test - - - oro - oro - 2.0.8 - - - xmlrpc - xmlrpc - 2.0.1 - - - - - - - org.apache.maven.plugins - maven-assembly-plugin - 2.2-beta-2 - - - src/main/assembly/assembly.xml - - - - org.apache.oodt.cas.pushpull.daemon.DaemonLauncher - - - - - - - single - - package - - - - - - - - 0.13-SNAPSHOT - - - - audit - - false - - - - - org.codehaus.mojo - rat-maven-plugin - - - **/resources/examples/**/* - - - - - - check - - verify - - - - - - - - http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/assembly/assembly.xml ---------------------------------------------------------------------- diff --git a/pushpull/src/main/assembly/assembly.xml b/pushpull/src/main/assembly/assembly.xml deleted file mode 100644 index 8f5c163..0000000 --- a/pushpull/src/main/assembly/assembly.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - dist - - tar.gz - zip - - true - ${project.artifactId}-${project.version} - false - - - ${basedir} - . - - LICENSE.txt - CHANGES.txt - - - - ${basedir}/src/main/bin - bin - - 755 - - - ${basedir}/src/main/resources - etc - - *.properties - jssecacerts - - - - ${basedir}/src/main/resources/examples - etc/examples - - - - ${basedir}/src/main/resources - logs - - REMOVE.log - - - - ${basedir}/src/main/resources/policy - policy - - *.xml - - - - target/site/apidocs - false - doc - - - - - - lib - false - true - true - - - - http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/bin/pushpull ---------------------------------------------------------------------- diff --git a/pushpull/src/main/bin/pushpull b/pushpull/src/main/bin/pushpull deleted file mode 100644 index 62d32eb..0000000 --- a/pushpull/src/main/bin/pushpull +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/csh -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE.txt 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. - -set LIB_DEPS -foreach file (`find ../lib/*.jar`) - set LIB_DEPS = "${file}:${LIB_DEPS}" -end - -setenv PATH ${JAVA_HOME}/bin:${CAS_PP_HOME}/bin:/usr/bin:/bin:/usr/sbin:/sbin - -#execution -- do not set "java.ext.dirs" because it messes up search path for a sftp library -${JAVA_HOME}/bin/java \ - -cp ${LIB_DEPS} -Dcom.sun.management.jmxremote \ - -Djava.util.logging.config.file=../etc/logging.properties \ - -Djavax.net.ssl.trustStore=${CAS_PP_RESOURCES}/jssecacerts \ - org.apache.oodt.cas.pushpull.daemon.DaemonLauncher \ - --rmiRegistryPort ${DAEMONLAUNCHER_PORT} \ - --propertiesFile ${CAS_PP_RESOURCES}/push_pull_framework.properties \ - --remoteSpecsFile ${CAS_PP_RESOURCES}/examples/RemoteSpecsFiles/RemoteSpecs.xml http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/bin/url-downloader ---------------------------------------------------------------------- diff --git a/pushpull/src/main/bin/url-downloader b/pushpull/src/main/bin/url-downloader deleted file mode 100644 index 9c71713..0000000 --- a/pushpull/src/main/bin/url-downloader +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE.txt 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. - -$JAVA_HOME/bin/java -Djava.ext.dirs=../lib \ - -Djava.util.logging.config.file=../etc/logging.properties \ - org.apache.oodt.cas.protocol.http.HttpProtocol \ - --url $1 \ - --downloadToDir $2 http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/Config.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/Config.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/Config.java deleted file mode 100644 index 9eaa4c0..0000000 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/Config.java +++ /dev/null @@ -1,405 +0,0 @@ -/* - * 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.pushpull.config; - -//OODT imports -import org.apache.oodt.cas.pushpull.exceptions.ConfigException; -import org.apache.oodt.cas.pushpull.objectfactory.PushPullObjectFactory; -import org.apache.oodt.cas.pushpull.retrievalsystem.RemoteFileMetKeys; -import org.apache.oodt.cas.filemgr.ingest.Ingester; -import org.apache.oodt.cas.metadata.util.PropertiesUtils; - -//JDK imports -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * This class will parse a java .properties file for FileRetrievalSystem so that - * information can be easily accessed through getter methods. - * - * @author bfoster - * - */ -public class Config implements ConfigMetKeys { - - private ProtocolInfo pi; - - private ParserInfo parserInfo; - - private Ingester ingester; - - private URL fmUrl; - - private String productTypeDetectionFile; - - private boolean useTracker; - - private boolean onlyDefinedTypes; - - private int recommendedThreadCount; - - private int maxFailedDownloads; - - private boolean writeMetFile; - - private String metFileExtension; - - private String[] listOfMetadataToOutput; - - private File baseStagingArea; - - /* our log stream */ - private static final Logger LOG = Logger.getLogger(Config.class.getName()); - - /** - * Constructor - * - */ - public Config() { - pi = new ProtocolInfo(); - parserInfo = new ParserInfo(); - this.maxFailedDownloads = 10; - this.recommendedThreadCount = 8; - listOfMetadataToOutput = new String[] { RemoteFileMetKeys.PRODUCT_NAME, - RemoteFileMetKeys.RETRIEVED_FROM_LOC, - RemoteFileMetKeys.DATA_PROVIDER, RemoteFileMetKeys.FILE_SIZE, - RemoteFileMetKeys.PRODUCT_TYPE }; - int i = 1; - do { - this.baseStagingArea = new File("./" + STAGING_AREA_PREFIX + "_" - + i++); - } while (this.baseStagingArea.exists()); - } - - /** - * Opens the configuration file and adds its properties to System properties - * - * @return - */ - public void loadConfigFile(File configFile) throws ConfigException { - - // load properties from configuration file - try { - System.getProperties().load(new FileInputStream(configFile)); - } catch (Exception e) { - throw new ConfigException("Failed to load properties file : " - + e.getMessage()); - } - - // parse properties and xml file specified in config file - try { - loadProperties(); - } catch (Exception e) { - throw new ConfigException( - "Failed to get properties from properties file : " - + e.getMessage()); - } - } - - public void setProtocolInfo(ProtocolInfo pi) { - this.pi = pi; - } - - public void setUseTracker(boolean useTracker) { - this.useTracker = useTracker; - } - - public void setIngester(Ingester ingester) { - this.ingester = ingester; - } - - public void setFmUrl(URL fmUrl){ - this.fmUrl = fmUrl; - } - - public void setTempInfoFileExtension(String extension) { - this.metFileExtension = extension; - } - - public void setRecommendedThreadCount(int count) { - this.recommendedThreadCount = count; - } - - public void setMaxAllowedFailedDownloads(int max) { - this.maxFailedDownloads = max; - } - - public void setOnlyDownloadDefinedTypes(boolean onlyDefinedTypes) { - this.onlyDefinedTypes = onlyDefinedTypes; - } - - public void setBaseStagingArea(File baseStagingArea) { - this.baseStagingArea = baseStagingArea; - } - - public void setProductTypeDetectionFile(String filePath) { - this.productTypeDetectionFile = filePath; - } - - public void setWriteMetFile(boolean writeMetFile) { - this.writeMetFile = writeMetFile; - } - - /** - * Parses the properties which were added to System properties by - * loadConfigFile(). Stores info for access by getter methods - * - * @throws ConfigException - * @throws InstantiationException - * @throws IOException - * @throws FileNotFoundException - * @throws ClassNotFoundException - * @throws ClassNotFoundException - */ - void loadProperties() throws ConfigException { - this.loadExternalConfigFiles(); - this.loadProtocolTypes(); - this.loadParserInfo(); - this.loadIngester(); - this.loadMiscVariables(); - this.loadProductTypeDetection(); - this.loadMetadataListToOutput(); - } - - void loadExternalConfigFiles() throws ConfigException { - String[] externalConfigs = PropertiesUtils - .getProperties(EXTERNAL_PROPERTIES_FILES); - for (String externalConfig : externalConfigs) { - try { - System.getProperties().load( - new FileInputStream(new File(externalConfig))); - } catch (Exception e) { - throw new ConfigException("Failed to load default config file " - + externalConfig + " : " + e.getMessage()); - } - } - } - - void loadProtocolTypes() throws ConfigException { - LOG.log(Level.INFO, - "Associating protocol types with ProtocolFactories . . ."); - String[] protocolFactoryInfoFiles = PropertiesUtils - .getProperties(PROTOCOL_FACTORY_INFO_FILES); - for (String file : protocolFactoryInfoFiles) { - try { - pi.loadProtocolFactoryInfoFromFile(new File(file)); - } catch (Exception e) { - throw new ConfigException( - "Failed to load ProtocolFactory config file " + file - + " : " + e.getMessage()); - } - } - } - - void loadParserInfo() throws ConfigException { - LOG.log(Level.INFO, "Associating parsers with RetrievalMethods . . ."); - String[] parserInfoFiles = PropertiesUtils - .getProperties(PARSER_INFO_FILES); - for (String file : parserInfoFiles) { - try { - parserInfo.loadParserInfo(new File(file)); - } catch (Exception e) { - throw new ConfigException("Failed to load parser info file " - + file + " : " + e.getMessage()); - } - } - } - - void loadIngester() throws ConfigException { - try { - String fmUrlStr = PropertiesUtils.getProperties(INGESTER_FM_URL, - new String[] { NO_FM_SPECIFIED })[0]; - - if (fmUrlStr.equals(NO_FM_SPECIFIED)) { - LOG - .log(Level.INFO, - "No file manager url specified: no ingester will be used"); - } else { - String ingesterClass = PropertiesUtils - .getProperties(INGESTER_CLASS)[0]; - String dataTransferClass = PropertiesUtils - .getProperties(INGESTER_DATA_TRANSFER)[0]; - String cacheFactoryClass = System.getProperty(CACHE_FACTORY_CLASS); - - LOG.log(Level.INFO, "Configuring and building ingester: [" - + ingesterClass + "]: data transfer: [" - + dataTransferClass + "]: to ingest to file manager: [" - + fmUrlStr + "]"); - - if (cacheFactoryClass != null) { - LOG.log(Level.INFO, "Configuring Ingester cache: [" - + cacheFactoryClass + "]"); - } - - this.ingester = PushPullObjectFactory.createIngester( - ingesterClass, cacheFactoryClass); - - this.fmUrl = safeGetUrlFromString(fmUrlStr); - - } - - } catch (Exception e) { - LOG.log(Level.SEVERE, e.getMessage()); - throw new ConfigException("Failed to load Ingester : " - + e.getMessage()); - } - } - - void loadProductTypeDetection() throws ConfigException { - try { - this.productTypeDetectionFile = PropertiesUtils - .getProperties(TYPE_DETECTION_FILE)[0]; - LOG.log(Level.INFO, "Loading product type detection file: " - + productTypeDetectionFile); - } catch (Exception e) { - throw new ConfigException( - "Failed to load ProductTypeDetection file '" - + productTypeDetectionFile + "' : " - + e.getMessage()); - } - } - - void loadMetadataListToOutput() { - listOfMetadataToOutput = PropertiesUtils.getProperties( - MET_LIST_TO_PRINT, new String[] { - RemoteFileMetKeys.PRODUCT_NAME, - RemoteFileMetKeys.RETRIEVED_FROM_LOC, - RemoteFileMetKeys.DATA_PROVIDER, - RemoteFileMetKeys.FILE_SIZE, - RemoteFileMetKeys.PRODUCT_TYPE }); - } - - void loadMiscVariables() { - onlyDefinedTypes = (PropertiesUtils.getProperties( - ALLOW_ONLY_DEFINED_TYPES, new String[] { "false" })[0] - .toLowerCase().equals("true")); - useTracker = (PropertiesUtils.getProperties(USE_TRACKER, - new String[] { "false" })[0].toLowerCase().equals("true")); - this.recommendedThreadCount = Integer.parseInt(PropertiesUtils - .getProperties(FILE_RET_SYSTEM_REC_THREAD_COUNT, - new String[] { "8" })[0]); - this.maxFailedDownloads = Integer.parseInt(PropertiesUtils - .getProperties(FILE_RET_SYSTEM_MAX_ALLOWED_FAIL_DOWNLOADS, - new String[] { "10" })[0]); - metFileExtension = PropertiesUtils.getProperties(MET_FILE_EXT, - new String[] { "info.tmp" })[0]; - this.writeMetFile = Boolean.getBoolean(WRITE_MET_FILE); - String timeoutString = PropertiesUtils.getProperties( - PROTOCOL_TIMEOUT_MS, new String[] { "600000" })[0]; - if (timeoutString == null) { - timeoutString = "0"; - } - pi.setDownloadTimeout(Long.parseLong(timeoutString)); - pi.setPageSize(Integer.parseInt(PropertiesUtils.getProperties( - PROTOCOL_PAGE_SIZE, new String[] { "8" })[0])); - this.baseStagingArea = new File(PropertiesUtils.getProperties( - DATA_FILE_BASE_STAGING_AREA, - new String[] { this.baseStagingArea.getPath() })[0]); - } - - public ProtocolInfo getProtocolInfo() { - return this.pi; - } - - public Ingester getIngester() { - return this.ingester; - } - - public URL getFmUrl(){ - return this.fmUrl; - } - - public boolean useTracker() { - return useTracker; - } - - public String getMetFileExtension() { - return this.metFileExtension; - } - - public String getProductTypeDetectionFile() { - return this.productTypeDetectionFile; - } - - public int getRecommendedThreadCount() { - return this.recommendedThreadCount; - } - - public int getMaxFailedDownloads() { - return this.maxFailedDownloads; - } - - public boolean onlyDownloadDefinedTypes() { - return this.onlyDefinedTypes; - } - - public String[] getListOfMetadataToOutput() { - return this.listOfMetadataToOutput; - } - - public ParserInfo getParserInfo() { - return this.parserInfo; - } - - public File getBaseStagingArea() { - return this.baseStagingArea; - } - - public boolean getWriteMetFile() { - return this.writeMetFile; - } - - public Config clone() { - Config config = new Config(); - config.baseStagingArea = this.baseStagingArea; - config.ingester = this.ingester; - config.fmUrl = this.fmUrl; - config.listOfMetadataToOutput = this.listOfMetadataToOutput; - config.maxFailedDownloads = this.maxFailedDownloads; - config.metFileExtension = this.metFileExtension; - config.onlyDefinedTypes = this.onlyDefinedTypes; - config.parserInfo = this.parserInfo; - config.pi = this.pi; - config.productTypeDetectionFile = this.productTypeDetectionFile; - config.recommendedThreadCount = this.recommendedThreadCount; - config.useTracker = this.useTracker; - config.writeMetFile = this.writeMetFile; - return config; - } - - private static URL safeGetUrlFromString(String urlStr) { - URL url = null; - - try { - url = new URL(urlStr); - } catch (MalformedURLException e) { - LOG.log(Level.WARNING, "Unable to generate url from url string: [" - + urlStr + "]: Message: " + e.getMessage()); - } - - return url; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ConfigMetKeys.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ConfigMetKeys.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ConfigMetKeys.java deleted file mode 100644 index bb32309..0000000 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ConfigMetKeys.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.pushpull.config; - -/** - * @author mattmann - * @version $Revision$ - * - *

- * Met keys for the PushPullFramework {@link Config} - *

. - */ -public interface ConfigMetKeys { - - String STAGING_AREA_PREFIX = "Staging_Area"; - - String EXTERNAL_PROPERTIES_FILES = "org.apache.oodt.cas.pushpull.config.external.properties.files"; - - String PROTOCOL_FACTORY_INFO_FILES = "org.apache.oodt.cas.pushpull.config.protocolfactory.info.files"; - - String PARSER_INFO_FILES = "org.apache.oodt.cas.pushpull.config.parser.info.files"; - - String INGESTER_CLASS = "org.apache.oodt.cas.filemgr.ingester"; - - String INGESTER_DATA_TRANSFER = "org.apache.oodt.cas.filemgr.datatransfer.factory"; - - String INGESTER_FM_URL = "org.apache.oodt.cas.filemgr.url"; - - String NO_FM_SPECIFIED = "N/A"; - - String CACHE_FACTORY_CLASS = "org.apache.oodt.cas.filemgr.ingest.cache.factory"; - - String TYPE_DETECTION_FILE = "org.apache.oodt.cas.pushpull.config.type.detection.file"; - - String MET_LIST_TO_PRINT = "org.apache.oodt.cas.pushpull.metadata.list.to.print"; - - String ALLOW_ONLY_DEFINED_TYPES = "org.apache.oodt.cas.pushpull.allow.only.defined.types"; - - String USE_TRACKER = "org.apache.oodt.cas.pushpull.crawler.use.tracker"; - - String FILE_RET_SYSTEM_REC_THREAD_COUNT = "org.apache.oodt.cas.pushpull.file.retrieval.system.recommended.thread.count"; - - String FILE_RET_SYSTEM_MAX_ALLOWED_FAIL_DOWNLOADS = "org.apache.oodt.cas.pushpull.file.retrieval.system.max.number.allowed.failed.downloads"; - - String MET_FILE_EXT = "org.apache.oodt.cas.pushpull.met.file.extension"; - - String PROTOCOL_TIMEOUT_MS = "org.apache.oodt.cas.pushpull.protocol.timeout.milliseconds"; - - String PROTOCOL_PAGE_SIZE = "org.apache.oodt.cas.pushpull.protocol.page_size"; - - String DATA_FILE_BASE_STAGING_AREA = "org.apache.oodt.cas.pushpull.data.files.base.staging.area"; - - String WRITE_MET_FILE = "org.apache.oodt.cas.pushpull.write.met.file"; - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ConfigParserMetKeys.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ConfigParserMetKeys.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ConfigParserMetKeys.java deleted file mode 100644 index 6d43ad3..0000000 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ConfigParserMetKeys.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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.pushpull.config; - -/** - * @author mattmann - * @version $Revision$ - * - *

- * Met Keys used when parsing {@link Config} xml files - *

. - */ -public interface ConfigParserMetKeys { - - String RETRIEVAL_METHOD_TAG = "rtvlMethod"; - - String CLASS_ATTR = "class"; - - String PARSER_TAG = "parser"; - - String PROTOCOL_TAG = "protocol"; - - String TYPE_ATTR = "type"; - - String PROTOCOL_FACTORY_TAG = "protocolFactory"; - - String ALIAS_SPEC_TAG = "aliasSpec"; - - String FILE_ATTR = "file"; - - String DAEMON_TAG = "daemon"; - - String ACTIVE_ATTR = "active"; - - String ALIAS_ATTR = "alias"; - - String RUN_INFO_TAG = "runInfo"; - - String FIRSTRUN_DATETIME_ATTR = "firstRunDateTime"; - - String PERIOD_ATTR = "period"; - - String RUNONREBOOT_ATTR = "runOnReboot"; - - String EPSILON_ATTR = "epsilon"; - - String PROP_INFO_TAG = "propInfo"; - - String DIR_ATTR = "dir"; - - String PROP_FILES_TAG = "propFiles"; - - String REG_EXP_ATTR = "regExp"; - - String PARSER_ATTR = "parser"; - - String DOWNLOAD_INFO_TAG = "downloadInfo"; - - String RENAMING_CONV_ATTR = "renamingConv"; - - String ALLOW_ALIAS_OVERRIDE_ATTR = "allowAliasOverride"; - - String DELETE_FROM_SERVER_ATTR = "deleteFromServer"; - - String PROP_FILE_TAG = "propFile"; - - String PATH_ATTR = "path"; - - String AFTER_USE_TAG = "afterUse"; - - String DELETE_ON_SUCCESS_ATTR = "deleteOnSuccess"; - - String MOVEON_TO_SUCCESS_ATTR = "moveToOnSuccess"; - - String MOVEON_TO_FAIL_ATTR = "moveToOnFail"; - - String DATA_INFO_TAG = "dataInfo"; - - String QUERY_ELEM_ATTR = "queryElement"; - - String STAGING_AREA_ATTR = "stagingArea"; - - String SOURCE_TAG = "source"; - - String HOST_ATTR = "host"; - - String LOGIN_ATTR = "login"; - - String USERNAME_TAG = "username"; - - String PASSWORD_TAG = "password"; - - String CD_TEST_DIR_TAG = "cdTestDir"; - - String MAX_CONN_TAG = "maxConn"; - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DaemonInfo.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DaemonInfo.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DaemonInfo.java deleted file mode 100644 index 34966eb..0000000 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DaemonInfo.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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.pushpull.config; - -//JDK imports -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -/** - * - * @author bfoster - * @version $Revision$ - * - *

Describe your class here

. - */ -public class DaemonInfo { - - private static SimpleDateFormat utcFormat = new SimpleDateFormat( - "yyyy-MM-dd'T'hh:mm:ss'Z'"); - - private Date firstRunDateTime; - - private long timeIntervalInMilliseconds; - - private long epsilonInMilliseconds; - - private boolean runOnReboot; - - private PropFilesInfo pfi; - - private DataFilesInfo dfi; - - public DaemonInfo(String firstRunDateTimeString, String period, - String epsilon, boolean runOnReboot, PropFilesInfo pfi, - DataFilesInfo dfi) throws ParseException { - this.runOnReboot = runOnReboot; - if (firstRunDateTimeString != null - && !firstRunDateTimeString.equals("")) { - this.firstRunDateTime = utcFormat.parse(firstRunDateTimeString); - } else { - this.firstRunDateTime = new Date(); - } - if (period != null && !period.equals("")) { - this.timeIntervalInMilliseconds = Long.parseLong(period.substring( - 0, period.length() - 1)) - * this.getMillisecondsInMetric((period.charAt(period - .length() - 1) + "") - .toLowerCase()); - } else { - this.timeIntervalInMilliseconds = -1; - } - if (epsilon != null && !epsilon.equals("")) { - this.epsilonInMilliseconds = Long.parseLong(epsilon.substring(0, - epsilon.length() - 1)) - * this.getMillisecondsInMetric((epsilon.charAt(epsilon - .length() - 1) + "") - .toLowerCase()); - } else { - this.epsilonInMilliseconds = -1; - } - this.pfi = pfi; - this.dfi = dfi; - } - - private long getMillisecondsInMetric(String stringMetric) { - switch (stringMetric.charAt(0)) { - case 'w': - return 604800000; - case 'd': - return 86400000; - case 'h': - return 3600000; - case 'm': - return 60000; - case 's': - return 1000; - default: - return -1; - } - } - - public PropFilesInfo getPropFilesInfo() { - return this.pfi; - } - - public DataFilesInfo getDataFilesInfo() { - return this.dfi; - } - - public long getTimeIntervalInMilliseconds() { - return this.timeIntervalInMilliseconds; - } - - public long getEpsilonInMilliseconds() { - return this.epsilonInMilliseconds; - } - - public boolean runOnReboot() { - return this.runOnReboot; - } - - public Date getFirstRunDateTime() { - return this.firstRunDateTime; - } - - public String toString() { - return "--------DaemonInfo--------\n" + " " + "First run date/time: " - + this.firstRunDateTime + "\n" + " " - + "Period in milliseconds: " + this.timeIntervalInMilliseconds - + "\n" + " " + "Epsilon in milliseoncs: " - + this.epsilonInMilliseconds + "\n" + " " + "Run on reboot: " - + this.runOnReboot + "\n" + this.dfi + this.pfi + "\n"; - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DataFilesInfo.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DataFilesInfo.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DataFilesInfo.java deleted file mode 100644 index 1b5ffb6..0000000 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DataFilesInfo.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.pushpull.config; - -/** - * - * @author bfoster - * @version $Revision$ - * - *

Describe your class here

. - */ -public class DataFilesInfo { - - private String queryMetadataElementName; - - private DownloadInfo di; - - public DataFilesInfo(String queryMetadataElementName, DownloadInfo di) { - this.queryMetadataElementName = queryMetadataElementName; - this.di = di; - } - - public DownloadInfo getDownloadInfo() { - return this.di; - } - - public String getQueryMetadataElementName() { - return this.queryMetadataElementName; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DownloadInfo.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DownloadInfo.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DownloadInfo.java deleted file mode 100644 index 5f08926..0000000 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DownloadInfo.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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.pushpull.config; - -//OODT imports -import org.apache.oodt.cas.pushpull.protocol.RemoteSite; - -//JDK imports -import java.io.File; - -/** - * - * @author bfoster - * @version $Revision$ - * - *

- * Describe your class here - *

. - */ -public class DownloadInfo { - - private RemoteSite remoteSite; - - private String renamingConv; - - private boolean deleteFromServer; - - private File stagingArea; - - private boolean allowAliasOverride; - - public DownloadInfo(RemoteSite remoteSite, String renamingConv, - boolean deleteFromServer, File stagingArea, - boolean allowAliasOverride) { - this.remoteSite = remoteSite; - this.renamingConv = renamingConv; - this.deleteFromServer = deleteFromServer; - this.stagingArea = stagingArea; - this.allowAliasOverride = allowAliasOverride; - } - - public RemoteSite getRemoteSite() { - return this.remoteSite; - } - - public String getRenamingConv() { - return this.renamingConv; - } - - public boolean deleteFromServer() { - return this.deleteFromServer; - } - - public File getStagingArea() { - return this.stagingArea; - } - - public boolean isAllowAliasOverride() { - return this.allowAliasOverride; - } - - public String toString() { - return "DataFileInfo:\n" + " " + this.remoteSite + "\n" + " " - + "RenamingConvension: " + this.renamingConv + "\n" + " " - + "StagingArea: " + this.getStagingArea().getAbsolutePath() - + "\n" + " " + "Delete files from server: " - + this.deleteFromServer + "\n" + " " - + "Allow alias override: " + this.allowAliasOverride + "\n"; - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ParserInfo.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ParserInfo.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ParserInfo.java deleted file mode 100644 index 372a623..0000000 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ParserInfo.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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.pushpull.config; - -//JDK imports -import java.io.File; -import java.io.FileInputStream; -import java.util.concurrent.ConcurrentHashMap; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -//OODT imports -import org.apache.oodt.cas.pushpull.exceptions.ConfigException; -import org.apache.oodt.cas.pushpull.filerestrictions.Parser; -import org.apache.oodt.cas.pushpull.retrievalmethod.RetrievalMethod; -import org.apache.oodt.cas.metadata.util.PathUtils; -import org.apache.oodt.commons.xml.XMLUtils; - -/** - * - * @author bfoster - * @version $Revision$ - * - *

- * Describe your class here - *

. - */ -public class ParserInfo implements ConfigParserMetKeys{ - - private ConcurrentHashMap parserToRetrievalMethodMap; - - /* our log stream */ - private static final Logger LOG = Logger.getLogger(ParserInfo.class - .getName()); - - public ParserInfo() { - parserToRetrievalMethodMap = new ConcurrentHashMap(); - } - - public void loadParserInfo(File xmlFile) throws ConfigException { - try { - NodeList rmList = XMLUtils.getDocumentRoot(new FileInputStream(xmlFile)) - .getElementsByTagName(RETRIEVAL_METHOD_TAG); - for (int i = 0; i < rmList.getLength(); i++) { - - // get rm element - Node rmNode = rmList.item(i); - - // get classpath for this rm - String rmClasspath = PathUtils - .replaceEnvVariables(((Element) rmNode) - .getAttribute(CLASS_ATTR)); - - // get all login info for this source - NodeList parserList = ((Element) rmNode) - .getElementsByTagName(PARSER_TAG); - for (int j = 0; j < parserList.getLength(); j++) { - - // get a single login info - Node parserNode = parserList.item(j); - String parserClasspath = PathUtils - .replaceEnvVariables(((Element) parserNode) - .getAttribute(CLASS_ATTR)); - - LOG.log(Level.INFO, "Assiging parser '" + parserClasspath - + "' with retrievalmethod '" + rmClasspath + "'"); - this.parserToRetrievalMethodMap.put(parserClasspath, - rmClasspath); - } - } - } catch (Exception e) { - throw new ConfigException("Failed to load Parser info : " - + e.getMessage()); - } - } - - public Class getRetrievalMethod(Parser parser) - throws ClassNotFoundException { - System.out.println(parser.getClass().getCanonicalName()); - return (Class) Class - .forName(this.parserToRetrievalMethodMap.get(parser.getClass() - .getCanonicalName())); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/PropFilesInfo.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/PropFilesInfo.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/PropFilesInfo.java deleted file mode 100644 index 97cb18f..0000000 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/PropFilesInfo.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * 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.pushpull.config; - -//OODT imports -import org.apache.oodt.cas.pushpull.filerestrictions.Parser; - -//JDK imports -import java.io.File; -import java.util.concurrent.ConcurrentHashMap; -import java.util.LinkedList; -import java.util.Map.Entry; -import java.util.regex.Pattern; - -/** - * - * @author bfoster - * @version $Revision$ - * - *

Describe your class here

. - */ -public class PropFilesInfo { - - private File localDir; - - private boolean deleteOnSuccess; - - private File successLoc; - - private File failLoc; - - private LinkedList patterns; - - private ConcurrentHashMap fileToParserMap; - - private DownloadInfo di; - - public PropFilesInfo(File localDir) { - this.localDir = localDir; - patterns = new LinkedList(); - } - - public void setDownloadInfo(DownloadInfo di, - ConcurrentHashMap fileToParserMap) { - this.di = di; - this.fileToParserMap = fileToParserMap; - } - - public LinkedList getDownloadInfoPropFiles() { - LinkedList returnList = new LinkedList(); - for (Entry entry : this.fileToParserMap.entrySet()) { - returnList.add(entry.getKey()); - } - return returnList; - } - - public void setAfterUseEffects(File successLoc, File failLoc) { - this.successLoc = successLoc; - this.failLoc = failLoc; - } - - public void addPropFiles(String regExp, Parser parser) { - patterns.add(new RegExpAndParser(regExp, parser)); - } - - public Parser getParserForFile(File propFile) { - Parser parser = this.fileToParserMap == null ? null - : this.fileToParserMap.get(propFile); - if (parser == null) { - parser = this.getParserForFilename(propFile.getName()); - } - return parser; - } - - public Parser getParserForFilename(String propFilename) { - for (RegExpAndParser pattern : patterns) { - if (pattern.isAcceptedByPattern(propFilename)) { - return pattern.getParser(); - } - } - return null; - } - - public boolean needsToBeDownloaded() { - return di != null; - } - - public DownloadInfo getDownloadInfo() { - return this.di; - } - - public File getFinalDestination(boolean success) { - return success ? this.getOnSuccessDir() : this.getOnFailDir(); - } - - public File getOnSuccessDir() { - return (this.successLoc == null) ? this.localDir : this.successLoc; - } - - public File getOnFailDir() { - return (this.failLoc == null) ? this.localDir : this.failLoc; - } - - public File getLocalDir() { - return this.localDir; - } - - public void setDeleteOnSuccess(boolean deleteOnSuccess) { - this.deleteOnSuccess = deleteOnSuccess; - } - - public boolean getDeleteOnSuccess() { - return deleteOnSuccess; - } - - public String toString() { - return "PropFilesInfo\n" + " " + "Local directory: " + this.localDir - + "\n" + " " + "Patterns: " + this.patterns + "\n" + " " - + "Delete on success: " + this.deleteOnSuccess + "\n" + " " - + "Move to directory on success: " + this.successLoc + "\n" - + " " + "Move to directory on fail: " + this.failLoc + "\n" - + " " + this.di + "\n"; - } - - private class RegExpAndParser { - private String pattern; - - private Parser parser; - - public RegExpAndParser(String pattern, Parser parser) { - this.pattern = pattern; - this.parser = parser; - } - - public boolean isAcceptedByPattern(String filename) { - return Pattern.matches(pattern, filename); - } - - public Parser getParser() { - return this.parser; - } - - public String getPattern() { - return this.pattern; - } - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ProtocolInfo.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ProtocolInfo.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ProtocolInfo.java deleted file mode 100644 index eebafab..0000000 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ProtocolInfo.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * 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.pushpull.config; - -//OODT imports -import org.apache.oodt.cas.protocol.ProtocolFactory; -import org.apache.oodt.cas.pushpull.exceptions.ConfigException; -import org.apache.oodt.cas.metadata.util.PathUtils; -import org.apache.oodt.commons.xml.XMLUtils; - -//JDK imports -import java.io.File; -import java.io.FileInputStream; -import java.util.concurrent.ConcurrentHashMap; -import java.util.LinkedList; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * - * @author bfoster - * @version $Revision$ - * - *

- * Describe your class here - *

. - */ -public class ProtocolInfo implements ConfigParserMetKeys { - - private long timeout; - - private int pgSize; - - private static final int DEFAULT_PG_SIZE = 8; - - private ConcurrentHashMap>> protocolClassReference; - - /* our log stream */ - private static final Logger LOG = Logger.getLogger(ProtocolInfo.class - .getName()); - - public ProtocolInfo() { - timeout = 0; - pgSize = DEFAULT_PG_SIZE; - protocolClassReference = new ConcurrentHashMap>>(); - } - - public void loadProtocolFactoryInfoFromFile(File protocolFactoryInfo) - throws ConfigException { - try { - NodeList sourceList = XMLUtils.getDocumentRoot(new FileInputStream(protocolFactoryInfo)) - .getElementsByTagName(PROTOCOL_TAG); - for (int i = 0; i < sourceList.getLength(); i++) { - - // get source element - Node sourceNode = sourceList.item(i); - - // get host of this source - String type = PathUtils - .replaceEnvVariables(((Element) sourceNode) - .getAttribute(TYPE_ATTR)); - - // get all login info for this source - NodeList loginList = ((Element) sourceNode) - .getElementsByTagName(PROTOCOL_FACTORY_TAG); - for (int j = 0; j < loginList.getLength(); j++) { - - // get a single login info - Node loginNode = loginList.item(j); - String protocolFactoryClass = PathUtils - .replaceEnvVariables(((Element) loginNode) - .getAttribute(CLASS_ATTR)); - - this.addClassForType(type, protocolFactoryClass); - } - } - } catch (Exception e) { - throw new ConfigException( - "Failed to load ProtocolFactory info for protocol types : " - + e.getMessage()); - } - } - - public void addClassForType(String type, - Class protocolFactoryClass) { - LinkedList> protocolClasses; - if ((protocolClasses = protocolClassReference.get(type)) == null) { - protocolClasses = new LinkedList>(); - protocolClassReference.put(type.toLowerCase(), protocolClasses); - } - protocolClasses.add(protocolFactoryClass); - LOG.log(Level.INFO, "Assiging protocol '" + type.toLowerCase() - + "' with class '" + protocolFactoryClass + "'"); - } - - public void addClassForType(String type, String protocolFactoryClass) - throws ClassNotFoundException { - this.addClassForType(type, (Class) Class - .forName(protocolFactoryClass)); - } - - public void addClassForType(String type, - Class[] protocolFactoryClasses) { - for (Class clazz : protocolFactoryClasses) { - this.addClassForType(type, clazz); - } - } - - public void addClassForType(String type, String[] protocolFactoryClasses) - throws ClassNotFoundException { - for (String clazz : protocolFactoryClasses) { - this.addClassForType(type, (Class) Class - .forName(clazz)); - } - } - - public void setDownloadTimeout(long timeout) { - this.timeout = timeout; - } - - public void setPageSize(int pgSize) { - if (pgSize != -1) { - this.pgSize = pgSize; - } else { - this.pgSize = Integer.MAX_VALUE; - } - } - - public LinkedList> getProtocolClassesForProtocolType( - String type) { - return protocolClassReference.get(type.toLowerCase()); - } - - public long getDownloadTimeout() { - return timeout; - } - - public int getPageSize() { - return pgSize; - } - - public ProtocolInfo clone() { - ProtocolInfo pi = new ProtocolInfo(); - pi.protocolClassReference = this.protocolClassReference; - pi.timeout = this.timeout; - pi.pgSize = this.pgSize; - return pi; - } -}