http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/static/js/puny.js ---------------------------------------------------------------------- diff --git a/balance/modules/puny/static/js/puny.js b/balance/modules/puny/static/js/puny.js deleted file mode 100644 index a49888a..0000000 --- a/balance/modules/puny/static/js/puny.js +++ /dev/null @@ -1,56 +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. - */ - -/** - * Puny - A light-weight content editor for Balance applications - * - * This library depends on JQuery v 1.4.1 or higher (http://www.jquery.com) - */ -$(document).ready(function() { - - // Support click-to-edit on puny elements - $('[puny]').live('click',function(event) { - punyInitEditor($(this)); - }); - // Enable the editor save button - $('#gollum-editor-submit').live('click', punyPersistChanges); - // Enable the editor cancel button - $('#gollum-editor-cancel').live('click', punyCancel); - -}); - -var editingResourceId = false; - - -function punyInitEditor ( elmt ) { - editingResourceId = elmt.attr('puny'); - window.location = puny_module_root + '/edit/' + editingResourceId; -}; - -function punyCancel() { - window.location = puny_current_url; -} - -function punyPersistChanges(event) { - editingResourceId = $('#punyResourceId').val(); - $.post( puny_module_root + '/store.do',{ - 'resourceId' : editingResourceId - , 'content' : $('#gollum-editor-body').val() - },function( data ) { - window.location = puny_current_url; - }, 'json'); -}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/views/edit.php ---------------------------------------------------------------------- diff --git a/balance/modules/puny/views/edit.php b/balance/modules/puny/views/edit.php deleted file mode 100644 index 0c4ed32..0000000 --- a/balance/modules/puny/views/edit.php +++ /dev/null @@ -1,141 +0,0 @@ -<?php -/* - * 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. - */ - -$module = App::Get()->loadModule(); - -// Pass the installed site root to javascript -App::Get()->response->addJavascript("var site_root = '" . SITE_ROOT . "';",true); - -// Don't show a header or footer on this view -App::Get()->response->useHeaderFile(false); -App::Get()->response->useFooterFile(false); - -// Include the main Puny class -require_once(App::Get()->settings['puny_module_path'] . '/classes/Puny.class.php'); - -// Load the requested resource -$resource = Puny::load(App::Get()->request->segments[0]); - -// Get the raw contents -$content = $resource->getContent(true); -?> - -<!-- JAVASCRIPTS --> -<!-- STYLESHEETS --> -<script type="text/javascript"> - $(document).ready(function() { - $.GollumEditor(); - }); -</script> - - -<div id="wiki-wrapper" class="edit outer"> - <div id="head"> - <h1>Editing <strong><?php echo $resource->getId();?></strong></h1> - <p>(latest version: <?php echo $resource->getVersion();?>)</p> - </div> - <div id="wiki-content"> - <div id="gollum-editor" data-escaped-name="Home" class="edit"> - <input type="hidden" id="punyResourceId" name="punyResourceId" value="<?php echo $resource->getId()?>"/> - - <div id="gollum-editor-function-bar"> - <div id="gollum-editor-function-buttons"> - <a href="#" id="function-h1" class="function-button" title="Header 1" tabindex="-1"> - <span>Header 1</span> </a> - <a href="#" id="function-h2" class="function-button" title="Header 2" tabindex="-1"> - <span>Header 2</span> </a> - <a href="#" id="function-h3" class="function-button" title="Header 3" tabindex="-1"> - <span>Header 3</span> </a> - <span class="function-divider"> </span> - <a href="#" id="function-internal-link" class="function-button" title="Wiki Link" tabindex="-1"> - <span>Wiki Link</span> </a> - <a href="#" id="function-link" class="function-button" title="Link" tabindex="-1"> - <span>Link</span> </a> - <a href="#" id="function-image" class="function-button" title="Image" tabindex="-1"> - <span>Image</span> </a> - <span class="function-divider"> </span> - <a href="#" id="function-bold" class="function-button" title="Bold" tabindex="-1"> - <span>Bold</span> </a> - <a href="#" id="function-italic" class="function-button" title="Italic" tabindex="-1"> - <span>Italic</span> </a> - <a href="#" id="function-code" class="function-button" title="Code" tabindex="-1"> - <span>Code</span> </a> - <span class="function-divider"> </span> - <a href="#" id="function-ul" class="function-button" title="Unordered List" tabindex="-1"> - <span>Unordered List</span> </a> - <a href="#" id="function-ol" class="function-button" title="Ordered List" tabindex="-1"> - <span>Ordered List</span> </a> - <a href="#" id="function-blockquote" class="function-button" title="Blockquote" tabindex="-1"> - <span>Blockquote</span> </a> - <a href="#" id="function-hr" class="function-button" title="Horizontal Rule" tabindex="-1"> - <span>Horizontal Rule</span> </a> - <span class="function-divider"> </span> - <a href="#" id="function-help" class="function-button" title="Help" tabindex="-1"> - <span>Help</span> </a> - </div> - - <div id="gollum-editor-format-selector"> - <!-- <select id="wiki_format" name="wiki[format]"> - <option value="asciidoc">AsciiDoc</option> - <option value="creole">Creole</option> - <option value="markdown" selected="selected">Markdown</option> - <option value="mediawiki">MediaWiki</option> - <option value="org">Org-mode</option> - <option value="pod">Pod</option> - <option value="rdoc">RDoc</option> - <option value="textile">Textile</option> - <option value="rest">reStructuredText</option> - </select> --> - <label id="wiki_format" name="wiki[format]">Markdown</label> - <label for="wiki_format">Edit Mode</label> - </div> - </div> - - <div id="gollum-editor-help" class="jaws" data-autodisplay="true"> - <ul id="gollum-editor-help-parent"> - <li></li> - </ul> - <ul id="gollum-editor-help-list"> - <li></li> - </ul> - <div id="gollum-editor-help-wrapper"> - <div id="gollum-editor-help-content"> - <p></p> - </div> - </div> - </div> - - <div id="gollum-error-message"></div> - <textarea data-markup-lang="markdown" format="markdown" - id="gollum-editor-body" name="punyContent"><?php echo stripslashes($content)?></textarea> -<!-- Edit Message --> - <!--<div id="gollum-editor-edit-summary" class="singleline"> - <label class="jaws" for="wiki_commit">Edit Message</label> - <input id="gollum-editor-message-field" name="wiki[commit]" - placeholder="Write a small message here explaining this change. (Optional)" - type="text" /> - </div> --> - - <span class="jaws"><br> </span> - <input id="gollum-editor-submit" class="gollum-editor-input" name="commit" - title="Save current changes" type="submit" value="Save" /> - <input id="gollum-editor-cancel" class="gollum-editor-input" name="cancel" - title="Cancel changes" type="submit" value="Cancel" /> - </div> - </div> -</div> http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/views/error.php ---------------------------------------------------------------------- diff --git a/balance/modules/puny/views/error.php b/balance/modules/puny/views/error.php deleted file mode 100644 index 4576634..0000000 --- a/balance/modules/puny/views/error.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php -/* - * 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. - */ - - // Grab the most recent error from the session - $errorText = $_SESSION['puny_error']; - unset($_SESSION['puny_error']); - - // Don't show a header or footer for this view - App::Get()->response->useHeaderFile(false); - App::Get()->response->useFooterFile(false); - -?> - -<h1>Puny</h1> -<h2>An error has occurred:</h2> -<p><?php echo $errorText;?></p> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/views/login.php ---------------------------------------------------------------------- diff --git a/balance/modules/puny/views/login.php b/balance/modules/puny/views/login.php deleted file mode 100644 index 66f9ee8..0000000 --- a/balance/modules/puny/views/login.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php -/* - * 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. - */ - -// Parse the Puny config file -$module = App::Get()->loadModule(); - -App::Get()->response->useHeaderFile(false); -App::Get()->response->useFooterFile(false); - -?> -<style type="text/css"> -div#login { - padding:15px; - width:800px; - background-color:#dfdfdf; - margin-bottom:none; - border:solid 5px #888; - font-size:1.2em; - color:#333; - -webkit-border-radius: 8px; - -moz-border-radius: 8px; - border-radius: 8px; -} -form { - margin:30px; -} -input { - padding:5px; - margin-right:5px; -} -label { - padding-right:5px; -} -</style> -<center> -<p> </p> -<div id="login"> -<form method="POST" action="<?php echo $module->moduleRoot?>/login.do"> -<label>Username:</label> -<input type="text" alt="username input" name="username"/> -<label>Password:</label> -<input type="password" alt="password input" name="password"/> -<input type="submit" value="Login"/> -</form> -</div> -</center> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/views/logout.php ---------------------------------------------------------------------- diff --git a/balance/modules/puny/views/logout.php b/balance/modules/puny/views/logout.php deleted file mode 100644 index fc2459c..0000000 --- a/balance/modules/puny/views/logout.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php -/* - * 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. - */ - -// Parse the Puny config file -$module = App::Get()->loadModule(); - -// Include the main Puny class -require_once($module->modulePath . '/classes/Puny.class.php'); - -// Instantiate Puny -$puny = new Puny(); - -// Destroy the editor session -$puny->destroyEditorSession(); - -// Redirect home -App::Get()->redirect(SITE_ROOT . '/'); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/views/preview.php ---------------------------------------------------------------------- diff --git a/balance/modules/puny/views/preview.php b/balance/modules/puny/views/preview.php deleted file mode 100644 index f14c92c..0000000 --- a/balance/modules/puny/views/preview.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php -/* - * 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. - */ - -// Parse the Puny config file -$module = App::Get()->loadModule(); - -// Include the main Puny class -require_once($module->modulePath . '/classes/Puny.class.php'); - -// Instantiate Puny -$puny = new Puny(); - -// Obtain the parameters from the request -$resourceId = App::Get()->request->segments[0]; -$versionId = isset(App::Get()->request->segments[1]) ? App::Get()->request->segments[1] : null; - -// Load, parse, and display the requested resource -echo $puny->load($resourceId, $versionId)->getContent(); - -// we're done :) -?> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/.gitignore ---------------------------------------------------------------------- diff --git a/catalog/.gitignore b/catalog/.gitignore deleted file mode 100644 index b54523f..0000000 --- a/catalog/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/maven-eclipse.xml http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/pom.xml ---------------------------------------------------------------------- diff --git a/catalog/pom.xml b/catalog/pom.xml deleted file mode 100644 index a957174..0000000 --- a/catalog/pom.xml +++ /dev/null @@ -1,236 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.oodt</groupId> - <artifactId>oodt-core</artifactId> - <version>1.1-SNAPSHOT</version> - <relativePath>../core/pom.xml</relativePath> - </parent> - <artifactId>cas-catalog</artifactId> - <name>OODT CAS Virtual Catalog and Integration Service.</name> - <description>CAS Catalog is an effort to virtualize underlying - catalogs for use in the CAS system. Heterogeneous catalog models - are mapped to a common dictionary, and then integrated locally so that - they may be queried across and ingested into.</description> - <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact. - Once the dependency is in the core pom, it can then be used in other modules without the version tags. - For example, within core/pom.xml: - - <dependency> - <groupId>com.amazonaws</groupId> - <artifactId>aws-java-sdk</artifactId> - <version>1.7.4</version> - </dependency> - - Elsewhere in the platform: - <dependency> - <groupId>com.amazonaws</groupId> - <artifactId>aws-java-sdk</artifactId> - </dependency> - - Where possible the same dependency version should be used across the whole platform but if required the version - can be overridden in a specific pom and should have a comment explaing why the version has been overridden - --> - <dependencies> - <dependency> - <groupId>com.thoughtworks.xstream</groupId> - <artifactId>xstream</artifactId> - <exclusions> - <exclusion> - <!-- xom is an optional dependency of xstream. Its also an Apache incompatible license --> - <groupId>xom</groupId> - <artifactId>xom</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.apache.solr</groupId> - <artifactId>solr-solrj</artifactId> - <exclusions> - <exclusion> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-core</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.solr</groupId> - <artifactId>solr-lucene-core</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - </dependency> - <dependency> - <groupId>hsqldb</groupId> - <artifactId>hsqldb</artifactId> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-core</artifactId> - </dependency> - <dependency> - <groupId>org.apache.oodt</groupId> - <artifactId>cas-cli</artifactId> - </dependency> - <dependency> - <groupId>org.apache.oodt</groupId> - <artifactId>cas-metadata</artifactId> - </dependency> - <dependency> - <groupId>org.apache.oodt</groupId> - <artifactId>oodt-commons</artifactId> - </dependency> - <dependency> - <groupId>xmlrpc</groupId> - <artifactId>xmlrpc</artifactId> - </dependency> - </dependencies> - <build> - <resources> - <resource> - <targetPath>org/apache/oodt/cas/catalog/config</targetPath> - <directory>${basedir}/src/main/resources/policy</directory> - <includes> - <include>catserv-properties.xml</include> - <include>catserv-beans.xml</include> - <include>catserv-server-config.xml</include> - <include>catserv-server-cmd-line-beans.xml</include> - <include>catserv-client-config.xml</include> - <include>catserv-client-action-beans.xml</include> - <include>catserv-client-cmd-line-beans.xml</include> - </includes> - </resource> - </resources> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <version>2.2-beta-2</version> - <configuration> - <descriptors> - <descriptor>src/main/assembly/assembly.xml</descriptor> - </descriptors> - <archive /> - </configuration> - <executions> - <execution> - <goals> - <goal>single</goal> - </goals> - <phase>package</phase> - </execution> - </executions> - </plugin> - </plugins> - </build> - <scm> - <!--<connection>scm:svn:https://svn.apache.org/repos/asf/oodt/trunk/catalog</connection> - <developerConnection>scm:svn:https://svn.apache.org/repos/asf/oodt/trunk/catalog</developerConnection> - <url>http://svn.apache.org/viewvc/oodt/trunk/catalog</url>--> - <tag>0.13-SNAPSHOT</tag> - </scm> - <ciManagement> - <notifiers> - <notifier> - <configuration> - <address>[email protected]</address> - </configuration> - </notifier> - </notifiers> - </ciManagement> - <profiles> - <profile> - <id>audit</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>rat-maven-plugin</artifactId> - <configuration> - <excludes> - <exclude>**/src/main/java/org/apache/oodt/cas/catalog/query/parser/*.java</exclude> - </excludes> - </configuration> - <executions> - <execution> - <goals> - <goal>check</goal> - </goals> - <phase>verify</phase> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - <profile> - <id>tmpdir</id> - <activation> - <property> - <name>test.tmpdir</name> - </property> - </activation> - <build> - <plugins> - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.4.3</version> - <configuration> - <systemProperties> - <property> - <name>java.io.tmpdir</name> - <value>${test.tmpdir}</value> - </property> - </systemProperties> - </configuration> - </plugin> - </plugins> - </build> - </profile> - </profiles> - <!-- - <reporting> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-project-info-reports-plugin</artifactId> - <version>2.4</version> - <configuration> - <checkoutDirectoryName>catalog</checkoutDirectoryName> - </configuration> - </plugin> - </plugins> - </reporting> ---> -</project> http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/assembly/assembly.xml ---------------------------------------------------------------------- diff --git a/catalog/src/main/assembly/assembly.xml b/catalog/src/main/assembly/assembly.xml deleted file mode 100644 index 28e832f..0000000 --- a/catalog/src/main/assembly/assembly.xml +++ /dev/null @@ -1,77 +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. ---> -<assembly> - <id>dist</id> - <formats> - <format>tar.gz</format> - <format>zip</format> - </formats> - <includeBaseDirectory>true</includeBaseDirectory> - <baseDirectory>${project.artifactId}-${project.version}</baseDirectory> - <includeSiteDirectory>false</includeSiteDirectory> - <fileSets> - <fileSet> - <directory>${basedir}</directory> - <outputDirectory>.</outputDirectory> - <includes> - <include>LICENSE.txt</include> - <include>CHANGES.txt</include> - </includes> - </fileSet> - <fileSet> - <directory>${basedir}/src/main/bin</directory> - <outputDirectory>bin</outputDirectory> - <includes/> - <fileMode>755</fileMode> - </fileSet> - <fileSet> - <directory>${basedir}/src/main/resources</directory> - <outputDirectory>etc</outputDirectory> - <includes> - <include>**.properties</include> - </includes> - </fileSet> - <fileSet> - <directory>${basedir}/src/main/resources</directory> - <outputDirectory>logs</outputDirectory> - <includes> - <include>REMOVE.log</include> - </includes> - </fileSet> - <fileSet> - <directory>${basedir}/src/main/resources</directory> - <outputDirectory>etc</outputDirectory> - <includes> - <include>**.properties</include> - </includes> - </fileSet> - <fileSet> - <directory>${basedir}/src/main/resources/policy</directory> - <outputDirectory>policy</outputDirectory> - <includes/> - </fileSet> - </fileSets> - <dependencySets> - <dependencySet> - <outputDirectory>lib</outputDirectory> - <unpack>false</unpack> - <useProjectArtifact>true</useProjectArtifact> - <useTransitiveDependencies>true</useTransitiveDependencies> - <unpackOptions/> - </dependencySet> - </dependencySets> -</assembly> http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/bin/catserv-client ---------------------------------------------------------------------- diff --git a/catalog/src/main/bin/catserv-client b/catalog/src/main/bin/catserv-client deleted file mode 100644 index babfd25..0000000 --- a/catalog/src/main/bin/catserv-client +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/csh - -########################################################################### -# 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. -########################################################################### - -set args - -if ( $#args > 0 ) then - set args = "$*" -endif - -setenv CATALOG_HOME `pwd`/.. - -${JAVA_HOME}/bin/java \ - -Djava.ext.dirs=../lib \ - -Djava.util.logging.config.file=../etc/logging.properties \ - -Dorg.apache.oodt.cas.cli.action.spring.config=../policy/cmd-line-actions.xml \ - -Dorg.apache.oodt.cas.cli.option.spring.config=../policy/cmd-line-options.xml \ - org.apache.oodt.cas.catalog.server.CatalogServiceCommandLineClient ${args} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/bin/catserv-server ---------------------------------------------------------------------- diff --git a/catalog/src/main/bin/catserv-server b/catalog/src/main/bin/catserv-server deleted file mode 100644 index bd21233..0000000 --- a/catalog/src/main/bin/catserv-server +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/csh - -########################################################################### -# 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. -########################################################################### - -set args - -if ( $#args > 0 ) then - set args = "$*" -endif - -setenv CATALOG_HOME `pwd`/.. - -${JAVA_HOME}/bin/java \ - -Djava.ext.dirs=../lib \ - -Djava.util.logging.config.file=../etc/logging.properties \ - -Dorg.apache.oodt.cas.cli.action.spring.config=../policy/cmd-line-server-actions.xml \ - -Dorg.apache.oodt.cas.cli.option.spring.config=../policy/cmd-line-server-options.xml \ - org.apache.oodt.cas.catalog.server.CatalogServiceServerLauncher ${args} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/CatalogServiceCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/CatalogServiceCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/CatalogServiceCliAction.java deleted file mode 100644 index 90ed978..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/CatalogServiceCliAction.java +++ /dev/null @@ -1,77 +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.catalog.cli.action; - -//OODT imports -import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelClientFactory; -import org.apache.oodt.cas.catalog.server.channel.xmlrpc.XmlRpcCommunicationChannelClientFactory; -import org.apache.oodt.cas.catalog.system.impl.CatalogServiceClient; -import org.apache.oodt.cas.catalog.system.impl.CatalogServiceClientFactory; -import org.apache.oodt.cas.cli.action.CmdLineAction; - -/** - * Base Catalog Service {@link CmdLineAction}. - * - * @author bfoster (Brian Foster) - */ -public abstract class CatalogServiceCliAction extends CmdLineAction { - - public static final int VAL = 1024; - public static final int VAL1 = 20; - public static final int VAL2 = 60; - private CatalogServiceClient client; - - private String getUrl() { - return System.getProperty("org.apache.oodt.cas.catalog.url"); - } - - private int getChunkSize() { - return Integer.getInteger("org.apache.oodt.cas.catalog.chunkSize", VAL); - } - - private int getRequestTimeout() { - return Integer.getInteger("org.apache.oodt.cas.catalog.requestTimeout", VAL1); - } - - private int getConnectionTimeout() { - return Integer.getInteger("org.apache.oodt.cas.catalog.connectionTimeout", VAL2); - } - - private int getAutoPagerSize() { - return Integer.getInteger("org.apache.oodt.cas.catalog.autoPagerSize", 1000); - } - - public CatalogServiceClient getClient() { - if (client == null) { - CatalogServiceClientFactory factory = new CatalogServiceClientFactory(); - factory.setCommunicationChannelClientFactory(getCommunicationChannelFactory()); - factory.setAutoPagerSize(getAutoPagerSize()); - return client = factory.createCatalogService(); - } else { - return client; - } - } - - private CommunicationChannelClientFactory getCommunicationChannelFactory() { - XmlRpcCommunicationChannelClientFactory factory = new XmlRpcCommunicationChannelClientFactory(); - factory.setServerUrl(getUrl()); - factory.setChunkSize(getChunkSize()); - factory.setRequestTimeout(getRequestTimeout()); - factory.setConnectionTimeout(getConnectionTimeout()); - return factory; - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/GetSupportedCatalogIdsCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/GetSupportedCatalogIdsCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/GetSupportedCatalogIdsCliAction.java deleted file mode 100644 index f8adad2..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/GetSupportedCatalogIdsCliAction.java +++ /dev/null @@ -1,40 +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.catalog.cli.action; - -//OODT imports -import org.apache.oodt.cas.cli.exception.CmdLineActionException; - -/** - * A {@link org.apache.oodt.cas.cli.action.CmdLineAction} which get a list of supported {@link org.apache.oodt.cas.catalog.system.Catalog;} - * IDs for given {@link org.apache.oodt.cas.catalog.system.impl.CatalogServiceClient}. - * - * @author bfoster (Brian Foster) - */ -public class GetSupportedCatalogIdsCliAction extends CatalogServiceCliAction { - - @Override - public void execute(ActionMessagePrinter printer) - throws CmdLineActionException { - try { - printer.println("CatalogIDs: " + getClient().getCurrentCatalogIds()); - } catch (Exception e) { - throw new CmdLineActionException( - "Failed to get supported Catalog IDs : " + e.getMessage(), e); - } - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogRepositoryCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogRepositoryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogRepositoryCliAction.java deleted file mode 100644 index 82cdddb..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogRepositoryCliAction.java +++ /dev/null @@ -1,80 +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.catalog.cli.action; - -//JDK imports -import java.util.Set; - -//Apache imports -import org.apache.commons.lang.Validate; - -//OODT imports -import org.apache.oodt.cas.catalog.repository.CatalogRepository; -import org.apache.oodt.cas.catalog.repository.CatalogRepositoryFactory; -import org.apache.oodt.cas.catalog.system.Catalog; -import org.apache.oodt.cas.catalog.util.Serializer; -import org.apache.oodt.cas.cli.exception.CmdLineActionException; - -//Spring imports -import org.springframework.context.support.FileSystemXmlApplicationContext; - -/** - * A {@link CmdLineAction} which allows {@link Catalog}s to be loaded from - * an existing {@link CatalogRepositoryFactory} and to be add to a running - * Catalog Service from an existing Spring bean XML file. - * - * @author bfoster (Brian Foster) - */ -public class LoadCatalogRepositoryCliAction extends CatalogServiceCliAction { - - protected String catalogRepositoryId; - protected String beanRepo; - - @Override - public void execute(ActionMessagePrinter printer) - throws CmdLineActionException { - try { - Validate.notNull(catalogRepositoryId, "Must specify catalogRepositoryId"); - Validate.notNull(beanRepo, "Must specify beanRepo"); - - FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext( - new String[] { this.beanRepo }, false); - appContext.setClassLoader(new Serializer().getClassLoader()); - appContext.refresh(); - CatalogRepositoryFactory factory = (CatalogRepositoryFactory) appContext - .getBean(this.catalogRepositoryId, CatalogRepositoryFactory.class); - CatalogRepository catalogRepository = factory.createRepository(); - Set<Catalog> catalogs = catalogRepository.deserializeAllCatalogs(); - printer.println("Deserialized Catalogs: " + catalogs.toString()); - for (Catalog catalog : catalogs) { - printer.println("Adding Catalog: " + catalog); - getClient().addCatalog(catalog); - } - } catch (Exception e) { - throw new CmdLineActionException( - "Failed to load catalogs from bean repo : " + e.getMessage(), e); - } - } - - public void setCatalogRepositoryId(String catalogRepositoryId) { - this.catalogRepositoryId = catalogRepositoryId; - } - - public void setBeanRepo(String beanRepo) { - this.beanRepo = beanRepo; - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogsCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogsCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogsCliAction.java deleted file mode 100644 index 72637b2..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogsCliAction.java +++ /dev/null @@ -1,70 +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.catalog.cli.action; - -//JDK imports -import java.util.Map; - -//Apache imports -import org.apache.commons.lang.Validate; - -//OODT imports -import org.apache.oodt.cas.catalog.system.Catalog; -import org.apache.oodt.cas.catalog.util.Serializer; -import org.apache.oodt.cas.cli.exception.CmdLineActionException; - -//Spring imports -import org.springframework.context.support.FileSystemXmlApplicationContext; - -/** - * A {@link CmdLineAction} which loads {@link Catalog}s from a Spring XML file - * and adds them to the running Catalog Service. - * - * @author bfoster (Brian Foster) - */ -public class LoadCatalogsCliAction extends CatalogServiceCliAction { - - protected String beanRepo; - - @Override - public void execute(ActionMessagePrinter printer) - throws CmdLineActionException { - try { - Validate.notNull(beanRepo, "Must specify beanRepo"); - - FileSystemXmlApplicationContext repoAppContext = - new FileSystemXmlApplicationContext( - new String[] { this.beanRepo }, false); - repoAppContext.setClassLoader(new Serializer().getClassLoader()); - repoAppContext.refresh(); - @SuppressWarnings("unchecked") - Map<String, Catalog> catalogs = repoAppContext - .getBeansOfType(Catalog.class); - for (Catalog catalog : catalogs.values()) { - printer.println("Adding catalog: " + catalog.getId()); - getClient().addCatalog(catalog); - } - } catch (Exception e) { - throw new CmdLineActionException("Failed to load catalogs : " - + e.getMessage(), e); - } - } - - public void setBeanRepo(String beanRepo) { - this.beanRepo = beanRepo; - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java deleted file mode 100644 index 8af24a0..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java +++ /dev/null @@ -1,116 +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.catalog.cli.action; - -//JDK imports -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -//Apache imports -import org.apache.commons.lang.Validate; - -//OODT imports -import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata; -import org.apache.oodt.cas.catalog.page.Page; -import org.apache.oodt.cas.catalog.page.PageInfo; -import org.apache.oodt.cas.catalog.query.QueryExpression; -import org.apache.oodt.cas.catalog.query.parser.QueryParser; -import org.apache.oodt.cas.cli.exception.CmdLineActionException; - - -/** - * @author bfoster (Brian Foster) - */ -public class PagedQueryCliAction extends CatalogServiceCliAction { - - private int pageNum = -1; - private int pageSize = -1; - private String query; - private Set<String> catalogIds; - - public void execute(ActionMessagePrinter printer) - throws CmdLineActionException { - try { - Validate.isTrue(pageNum != -1, "Must specify pageNum"); - Validate.isTrue(pageSize != -1, "Must specify pageSize"); - Validate.notNull(query, "Must specify query"); - - QueryExpression queryExpression = QueryParser - .parseQueryExpression(query); - Page page; - if (catalogIds == null) { - page = getClient().getPage(new PageInfo(pageSize, pageNum), - queryExpression); - } else { - page = getClient().getPage(new PageInfo(pageSize, pageNum), - queryExpression, catalogIds); - } - List<TransactionalMetadata> transactionMetadatas = getClient() - .getMetadata(page); - for (TransactionalMetadata tMet : transactionMetadatas) { - printer.print("ID: " + tMet.getTransactionId() + " ; CatalogIDs: " - + tMet.getCatalogIds() + " ; Metadata: ("); - StringBuilder sb = new StringBuilder(""); - for (Object metKey : tMet.getMetadata().getMap().keySet()) { - sb.append(metKey).append("=").append(tMet.getMetadata().getAllMetadata((String) metKey) - .toString().replaceAll("[\\[\\]]", "'")).append(", "); - } - printer.println(sb.substring(0, sb.length() - 2) + ")"); - } - } catch (Exception e) { - throw new CmdLineActionException("Failed to perform query '" + query - + "' : " + e.getMessage(), e); - } - } - - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } - - public void setPageNum(int pageNum) { - this.pageNum = pageNum; - } - - public void setQuery(String query) { - this.query = query; - } - - public void setCatalogIds(List<String> catalogIds) { - this.catalogIds = new HashSet<String>(catalogIds); - } - - public int getPageNum() { - return pageNum; - } - - public int getPageSize() { - return pageSize; - } - - public String getQuery() { - return query; - } - - public Set<String> getCatalogIds() { - return catalogIds; - } - - public void setCatalogIds(Set<String> catalogIds) { - this.catalogIds = catalogIds; - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java deleted file mode 100644 index 0a8eaf2..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java +++ /dev/null @@ -1,95 +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.catalog.cli.action; - -//JDK imports -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -//Apache imports -import org.apache.commons.lang.Validate; - -//OODT imports -import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata; -import org.apache.oodt.cas.catalog.page.QueryPager; -import org.apache.oodt.cas.catalog.query.QueryExpression; -import org.apache.oodt.cas.catalog.query.parser.QueryParser; -import org.apache.oodt.cas.cli.exception.CmdLineActionException; - -/** - * A {@link CmdLineAction} which queries Catalog Service. - * - * @author bfoster (Brian Foster) - */ -public class QueryCliAction extends CatalogServiceCliAction { - - private String query; - private Set<String> catalogIds; - - @Override - public void execute(ActionMessagePrinter printer) - throws CmdLineActionException { - try { - Validate.notNull(query, "Must specify query"); - - QueryExpression queryExpression = QueryParser - .parseQueryExpression(query); - QueryPager queryPager; - if (catalogIds == null) { - queryPager = getClient().query(queryExpression); - } else { - queryPager = getClient().query(queryExpression, catalogIds); - } - List<TransactionalMetadata> transactionMetadatas = getClient() - .getAllPages(queryPager); - for (TransactionalMetadata tMet : transactionMetadatas) { - printer.print("ID: " + tMet.getTransactionId() + " ; CatalogIDs: " - + tMet.getCatalogIds() + " ; Metadata: ("); - StringBuilder sb = new StringBuilder(""); - for (Object metKey : tMet.getMetadata().getMap().keySet()) { - sb.append(metKey).append("=").append(tMet.getMetadata().getAllMetadata((String) metKey) - .toString().replaceAll("[\\[\\]]", "'")).append(", "); - } - printer.println(sb.substring(0, sb.length() - 2) + ")"); - } - } catch (Exception e) { - throw new CmdLineActionException("Failed to perform query '" + query - + "' : " + e.getMessage(), e); - } - } - - public void setQuery(String query) { - this.query = query; - } - - public void setCatalogIds(List<String> catalogIds) { - this.catalogIds = new HashSet<String>(catalogIds); - } - - public String getQuery() { - return query; - } - - public Set<String> getCatalogIds() { - return catalogIds; - } - - public void setCatalogIds(Set<String> catalogIds) { - this.catalogIds = catalogIds; - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java deleted file mode 100644 index b62a535..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java +++ /dev/null @@ -1,134 +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.catalog.cli.action; - -//JDK imports -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -//Apache imports -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.Validate; - -//OODT imports -import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata; -import org.apache.oodt.cas.catalog.page.Page; -import org.apache.oodt.cas.catalog.page.PageInfo; -import org.apache.oodt.cas.catalog.query.QueryExpression; -import org.apache.oodt.cas.catalog.query.parser.QueryParser; -import org.apache.oodt.cas.cli.exception.CmdLineActionException; - -/** - * A {@link CmdLineAction} which queries Catalog Service. - * - * @author bfoster (Brian Foster) - */ -public class ReducedPagedQueryCliAction extends CatalogServiceCliAction { - - private int pageNum = -1; - private int pageSize = -1; - private String query; - private Set<String> catalogIds; - private List<String> termNames; - - @Override - public void execute(ActionMessagePrinter printer) - throws CmdLineActionException { - try { - Validate.isTrue(pageNum != -1, "Must specify pageNum"); - Validate.isTrue(pageSize != -1, "Must specify pageSize"); - Validate.notNull(query, "Must specify query"); - Validate.notNull(termNames, "Must specify termNames"); - - QueryExpression queryExpression = QueryParser - .parseQueryExpression(query); - Page page; - if (catalogIds == null) { - page = getClient().getPage(new PageInfo(pageSize, pageNum), - queryExpression); - } else { - page = getClient().getPage(new PageInfo(pageSize, pageNum), - queryExpression, catalogIds); - } - List<TransactionalMetadata> transactionMetadatas = getClient() - .getMetadata(page); - for (TransactionalMetadata tMet : transactionMetadatas) { - StringBuilder sb = new StringBuilder(""); - for (String termName : this.termNames) { - List<String> values = tMet.getMetadata().getAllMetadata( - (String) termName); - sb.append(termName).append(" = '").append(values == null ? "null" : StringUtils.join( - values.iterator(), ",")).append("', "); - } - printer.println(sb.substring(0, sb.length() - 2)); - } - } catch (Exception e) { - throw new CmdLineActionException("Failed to perform query '" + query - + "' : " + e.getMessage(), e); - } - } - - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } - - public void setPageNum(int pageNum) { - this.pageNum = pageNum; - } - - public void setQuery(String query) { - this.query = query; - } - - public void setCatalogIds(List<String> catalogIds) { - this.catalogIds = new HashSet<String>(catalogIds); - } - - public void setReducedTerms(List<String> termNames) { - this.termNames = termNames; - } - - public int getPageNum() { - return pageNum; - } - - public int getPageSize() { - return pageSize; - } - - public String getQuery() { - return query; - } - - public Set<String> getCatalogIds() { - return catalogIds; - } - - public void setCatalogIds(Set<String> catalogIds) { - this.catalogIds = catalogIds; - } - - public List<String> getTermNames() { - return termNames; - } - - public void setTermNames(List<String> termNames) { - this.termNames = termNames; - } -} - http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java deleted file mode 100644 index dd42147..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java +++ /dev/null @@ -1,110 +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.catalog.cli.action; - -//JDK imports -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -//Apache imports -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.Validate; - -//OODT imports -import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata; -import org.apache.oodt.cas.catalog.page.QueryPager; -import org.apache.oodt.cas.catalog.query.QueryExpression; -import org.apache.oodt.cas.catalog.query.parser.QueryParser; -import org.apache.oodt.cas.cli.exception.CmdLineActionException; - -/** - * A {@link CmdLineAction} which queries the Catalog Service and limits the - * results to a subset of given terms. - * - * @author bfoster (Brian Foster) - */ -public class ReducedQueryCliAction extends CatalogServiceCliAction { - - private String query; - private Set<String> catalogIds; - private List<String> termNames; - - @Override - public void execute(ActionMessagePrinter printer) - throws CmdLineActionException { - try { - Validate.notNull(query, "Must specify query"); - Validate.notNull(termNames, "Must specify termNames"); - - QueryExpression queryExpression = QueryParser - .parseQueryExpression(query); - QueryPager queryPager; - if (catalogIds == null) { - queryPager = getClient().query(queryExpression); - } else { - queryPager = getClient().query(queryExpression, catalogIds); - } - List<TransactionalMetadata> transactionMetadatas = getClient() - .getAllPages(queryPager); - for (TransactionalMetadata tMet : transactionMetadatas) { - StringBuilder sb = new StringBuilder(""); - for (String termName : this.termNames) { - List<String> values = tMet.getMetadata().getAllMetadata( - (String) termName); - sb.append(termName).append(" = '").append(values == null ? "null" : StringUtils.join( - values.iterator(), ",")).append("', "); - } - printer.println(sb.substring(0, sb.length() - 2)); - } - } catch (Exception e) { - throw new CmdLineActionException("", e); - } - } - - public void setQuery(String query) { - this.query = query; - } - - public void setCatalogIds(List<String> catalogIds) { - this.catalogIds = new HashSet<String>(catalogIds); - } - - public void setReducedTerms(List<String> termNames) { - this.termNames = termNames; - } - - public String getQuery() { - return query; - } - - public Set<String> getCatalogIds() { - return catalogIds; - } - - public void setCatalogIds(Set<String> catalogIds) { - this.catalogIds = catalogIds; - } - - public List<String> getTermNames() { - return termNames; - } - - public void setTermNames(List<String> termNames) { - this.termNames = termNames; - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ShutdownCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ShutdownCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ShutdownCliAction.java deleted file mode 100644 index 384492f..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ShutdownCliAction.java +++ /dev/null @@ -1,38 +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.catalog.cli.action; - -//OODT imports -import org.apache.oodt.cas.cli.exception.CmdLineActionException; - -/** - * A {@link CmdLineAction} which shuts down Catalog Service server. - * @author bfoster (Brian Foster) - */ -public class ShutdownCliAction extends CatalogServiceCliAction { - - @Override - public void execute(ActionMessagePrinter printer) - throws CmdLineActionException { - try { - getClient().shutdown(); - } catch (Exception e) { - throw new CmdLineActionException("Failed to shutdown server : " - + e.getMessage(), e); - } - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogDictionaryException.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogDictionaryException.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogDictionaryException.java deleted file mode 100644 index 899bedb..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogDictionaryException.java +++ /dev/null @@ -1,41 +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.catalog.exception; - -/** - * @author bfoster - * @version $Revision$ - * - */ -public class CatalogDictionaryException extends Exception { - - private static final long serialVersionUID = 7734987410778199955L; - - public CatalogDictionaryException() { - super(); - } - - public CatalogDictionaryException(String msg) { - super(msg); - } - - public CatalogDictionaryException(String msg, Throwable throwable) { - super(msg, throwable); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogException.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogException.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogException.java deleted file mode 100644 index 3225559..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogException.java +++ /dev/null @@ -1,40 +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.catalog.exception; - -/** - * @author bfoster - * @version $Revision$ - * - */ -public class CatalogException extends Exception { - - private static final long serialVersionUID = 7734987410778199955L; - - public CatalogException() { - super(); - } - - public CatalogException(String msg) { - super(msg); - } - - public CatalogException(String msg, Throwable throwable) { - super(msg, throwable); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogIndexException.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogIndexException.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogIndexException.java deleted file mode 100644 index 37529d8..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogIndexException.java +++ /dev/null @@ -1,40 +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.catalog.exception; - -/** - * @author bfoster - * @version $Revision$ - * - */ -public class CatalogIndexException extends Exception { - - private static final long serialVersionUID = 7734987410778199955L; - - public CatalogIndexException() { - super(); - } - - public CatalogIndexException(String msg) { - super(msg); - } - - public CatalogIndexException(String msg, Throwable throwable) { - super(msg, throwable); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogRepositoryException.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogRepositoryException.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogRepositoryException.java deleted file mode 100644 index ee9042f..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogRepositoryException.java +++ /dev/null @@ -1,40 +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.catalog.exception; - -/** - * @author bfoster - * @version $Revision$ - * - */ -public class CatalogRepositoryException extends Exception { - - private static final long serialVersionUID = 7734987410778199955L; - - public CatalogRepositoryException() { - super(); - } - - public CatalogRepositoryException(String msg) { - super(msg); - } - - public CatalogRepositoryException(String msg, Throwable throwable) { - super(msg, throwable); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogServiceException.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogServiceException.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogServiceException.java deleted file mode 100644 index 880ffba..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogServiceException.java +++ /dev/null @@ -1,40 +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.catalog.exception; - -/** - * @author bfoster - * @version $Revision$ - * - */ -public class CatalogServiceException extends Exception { - - private static final long serialVersionUID = 7734987410778199955L; - - public CatalogServiceException() { - super(); - } - - public CatalogServiceException(String msg) { - super(msg); - } - - public CatalogServiceException(String msg, Throwable throwable) { - super(msg, throwable); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/IngestServiceException.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/IngestServiceException.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/IngestServiceException.java deleted file mode 100644 index e61001b..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/IngestServiceException.java +++ /dev/null @@ -1,40 +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.catalog.exception; - -/** - * @author bfoster - * @version $Revision$ - * - */ -public class IngestServiceException extends Exception { - - private static final long serialVersionUID = 7734987410778199955L; - - public IngestServiceException() { - super(); - } - - public IngestServiceException(String msg) { - super(msg); - } - - public IngestServiceException(String msg, Throwable throwable) { - super(msg, throwable); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/QueryServiceException.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/QueryServiceException.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/QueryServiceException.java deleted file mode 100644 index 5e25883..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/QueryServiceException.java +++ /dev/null @@ -1,40 +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.catalog.exception; - -/** - * @author bfoster - * @version $Revision$ - * - */ -public class QueryServiceException extends Exception { - - private static final long serialVersionUID = 7734987410778199955L; - - public QueryServiceException() { - super(); - } - - public QueryServiceException(String msg) { - super(msg); - } - - public QueryServiceException(String msg, Throwable throwable) { - super(msg, throwable); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapper.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapper.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapper.java deleted file mode 100644 index ca6e53c..0000000 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapper.java +++ /dev/null @@ -1,259 +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.catalog.mapping; - -//JDK imports -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.text.ParseException; -import java.util.Calendar; -import java.util.Date; -import java.util.HashSet; -import java.util.Set; -//SQL imports -import javax.sql.DataSource; - -//OODT imports -import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException; -import org.apache.oodt.cas.catalog.page.CatalogReceipt; -import org.apache.oodt.cas.catalog.page.IndexPager; -import org.apache.oodt.cas.catalog.page.IngestReceipt; -import org.apache.oodt.cas.catalog.struct.TransactionId; -import org.apache.oodt.cas.catalog.struct.TransactionIdFactory; -import org.apache.oodt.commons.database.DatabaseConnectionBuilder; -import org.apache.oodt.commons.date.DateUtils; - -/** - * @author bfoster - * @version $Revision$ - * - * <p> - * A Ingest Mapper that indexes to an DataSource Database - * <p> - */ -public class DataSourceIngestMapper implements IngestMapper { - - private DataSource dataSource; - - private static final String CATALOG_ID = "' AND CATALOG_ID = '"; - - private static final String CAT_TRANS_FACTORY = "CAT_TRANS_FACTORY"; - - private static final String CAT_TRANS_ID = "CAT_TRANS_ID"; - - public DataSourceIngestMapper(String user, String pass, String driver, - String jdbcUrl) { - this.dataSource = DatabaseConnectionBuilder.buildDataSource(user, pass, - driver, jdbcUrl); - } - - @Override - public synchronized void deleteAllMappingsForCatalog(String catalogId) - throws CatalogRepositoryException, SQLException { - try (Connection conn = this.dataSource.getConnection(); - Statement stmt = conn.createStatement()) { - stmt.execute("DELETE FROM CatalogServiceMapper WHERE CATALOG_ID = '" + catalogId + "'"); - } - } - - @Override - public synchronized void deleteAllMappingsForCatalogServiceTransactionId( - TransactionId<?> catalogServiceTransactionId) - throws CatalogRepositoryException, SQLException { - try (Connection conn = this.dataSource.getConnection(); - Statement stmt = conn.createStatement()){ - stmt.execute("DELETE FROM CatalogServiceMapper WHERE CAT_SERV_TRANS_ID = '" + catalogServiceTransactionId + "'"); - conn.commit(); - } - } - - @Override - public synchronized void deleteTransactionIdMapping( - TransactionId<?> catalogTransactionId, String catalogId) - throws CatalogRepositoryException, SQLException { - try (Connection conn = this.dataSource.getConnection(); - Statement stmt = conn.createStatement()){ - stmt.execute("DELETE FROM CatalogServiceMapper WHERE CAT_TRANS_ID = '" + catalogTransactionId + CATALOG_ID + catalogId + "'"); - conn.commit(); - } - } - - @Override - public synchronized TransactionId<?> getCatalogServiceTransactionId( - TransactionId<?> catalogTransactionId, String catalogId) - throws CatalogRepositoryException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException { - ResultSet rs = null; - String query = "SELECT CAT_SERV_TRANS_ID,CAT_SERV_TRANS_FACTORY FROM CatalogServiceMapper WHERE CAT_TRANS_ID = '"+ catalogTransactionId + CATALOG_ID + catalogId + "'"; - try (Connection conn = this.dataSource.getConnection(); - PreparedStatement pstmt = conn.prepareStatement(query)){ - rs = pstmt.executeQuery(); - while(rs.next()) { - return ((TransactionIdFactory) Class.forName(rs.getString("CAT_SERV_TRANS_FACTORY")).newInstance()) - .createTransactionId(rs.getString("CAT_SERV_TRANS_ID")); - } - return null; - }finally { - if (rs != null) { - rs.close(); - } - } - } - - @Override - public synchronized TransactionId<?> getCatalogTransactionId( - TransactionId<?> catalogServiceTransactionId, String catalogId) - throws CatalogRepositoryException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException { - ResultSet rs = null; - String query = "SELECT CAT_TRANS_ID,CAT_TRANS_FACTORY FROM CatalogServiceMapper WHERE CAT_SERV_TRANS_ID = '"+ catalogServiceTransactionId + CATALOG_ID + catalogId + "'"; - try (Connection conn = this.dataSource.getConnection(); - PreparedStatement pstmt = conn.prepareStatement(query)){ - rs = pstmt.executeQuery(); - while(rs.next()) { - return ((TransactionIdFactory) Class.forName(rs.getString(CAT_TRANS_FACTORY)).newInstance()) - .createTransactionId(rs.getString(CAT_TRANS_ID)); - } - return null; - }finally { - if (rs != null) { - rs.close(); - } - } - } - - @Override - public synchronized Set<String> getCatalogIds( - TransactionId<?> catalogServiceTransactionId) - throws CatalogRepositoryException, SQLException { - ResultSet rs = null; - String query = "SELECT CATALOG_ID FROM CatalogServiceMapper WHERE CAT_SERV_TRANS_ID = '"+ catalogServiceTransactionId + "'"; - try (Connection conn = this.dataSource.getConnection(); - PreparedStatement pstmt = conn.prepareStatement(query)){ - rs = pstmt.executeQuery(); - Set<String> catalogIds = new HashSet<>(); - while(rs.next()) { - catalogIds.add(rs.getString("CATALOG_ID")); - } - return catalogIds; - }finally { - if (rs != null) { - rs.close(); - } - } - } - - @Override - public synchronized Set<TransactionId<?>> getPageOfCatalogTransactionIds( - IndexPager indexPager, String catalogId) - throws CatalogRepositoryException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException { - ResultSet rs = null; - String query = "SELECT * FROM " - +"( SELECT a.*, ROWNUM r FROM " - + "( SELECT CAT_TRANS_FACTORY,CAT_TRANS_ID FROM CatalogServiceMapper WHERE CatalogServiceMapper.CATALOG_ID = '" - + catalogId + "' ORDER BY CatalogServiceMapper.CAT_SERV_TRANS_ID DESC ) a " - + "WHERE ROWNUM <= " + (indexPager.getPageSize() * (indexPager.getPageNum() + 1)) + " ) " - + "WHERE r >= " + ((indexPager.getPageSize() * indexPager.getPageNum()) + 1); - try (Connection conn = this.dataSource.getConnection(); - PreparedStatement pstmt = conn.prepareStatement(query)){ - rs = pstmt.executeQuery(); - Set<TransactionId<?>> transactionIds = new HashSet<>(); - while(rs.next()) { - transactionIds.add(((TransactionIdFactory) Class.forName(rs.getString(CAT_TRANS_FACTORY)).newInstance()) - .createTransactionId(rs.getString(CAT_TRANS_ID))); - } - return transactionIds; - }finally { - if (rs != null) { - rs.close(); - } - } - } - - @Override - public synchronized boolean hasCatalogServiceTransactionId( - TransactionId<?> catalogServiceTransactionId) - throws CatalogRepositoryException, SQLException { - ResultSet rs = null; - String query = "SELECT CAT_SERV_TRANS_ID FROM CatalogServiceMapper WHERE CAT_SERV_TRANS_ID = '"+ catalogServiceTransactionId + "'"; - try (Connection conn = this.dataSource.getConnection(); - PreparedStatement pstmt = conn.prepareStatement(query)){ - rs = pstmt.executeQuery(); - return rs.next(); - }finally { - if (rs != null) { - rs.close(); - } - } - } - - @Override - public synchronized void storeTransactionIdMapping( - TransactionId<?> catalogServiceTransactionId, - TransactionIdFactory catalogServiceTransactionIdFactory, - CatalogReceipt catalogReceipt, - TransactionIdFactory catalogTransactionIdFactory) - throws CatalogRepositoryException, SQLException { - Calendar calTime = DateUtils.getCurrentUtcTime(); - calTime.setTime(catalogReceipt.getTransactionDate()); - String query = "INSERT INTO CatalogServiceMapper (CAT_SERV_TRANS_ID, CAT_SERV_TRANS_FACTORY, CAT_TRANS_ID, CAT_TRANS_FACTORY," - + " CAT_TRANS_DATE, CATALOG_ID) VALUES ('" - + catalogServiceTransactionId + "', '" - + catalogServiceTransactionIdFactory.getClass().getName() + "', '" - + catalogReceipt.getTransactionId() + "', '" - + catalogTransactionIdFactory.getClass().getName() + "', '" - + DateUtils.toString(calTime) + "', '" - + catalogReceipt.getCatalogId() + "')"; - try (Connection conn = this.dataSource.getConnection(); - PreparedStatement pstmt = conn.prepareStatement(query)){ - pstmt.execute(); - conn.commit(); - } - } - - @Override - public CatalogReceipt getCatalogReceipt( - TransactionId<?> catalogServiceTransactionId, String catalogId) - throws CatalogRepositoryException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException, ParseException { - ResultSet rs = null; - String query = "SELECT CAT_TRANS_ID, CAT_TRANS_FACTORY, CAT_TRANS_DATE FROM CatalogServiceMapper WHERE CAT_SERV_TRANS_ID = '"+ catalogServiceTransactionId + CATALOG_ID + catalogId + "'"; - try (Connection conn = this.dataSource.getConnection(); - PreparedStatement pstmt = conn.prepareStatement(query)){ - rs = pstmt.executeQuery(); - if(rs.next()) { - TransactionId<?> catalogTransactionId = ((TransactionIdFactory) Class.forName(rs.getString(CAT_TRANS_FACTORY)).newInstance()).createTransactionId(rs.getString(CAT_TRANS_ID)); - Date transactionDate = DateUtils.toCalendar(rs.getString("CAT_TRANS_DATE"), DateUtils.FormatType.UTC_FORMAT).getTime(); - return new CatalogReceipt(new IngestReceipt(catalogTransactionId, transactionDate), catalogId); - }else { - return null; - } - }finally { - if (rs != null) { - rs.close(); - } - } - } - - public DataSource getDataSource() { - return dataSource; - } - - public void setDataSource(DataSource dataSource) { - this.dataSource = dataSource; - } -}
