You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by bf...@apache.org on 2012/02/28 08:10:44 UTC
svn commit: r1294490 [1/2] - in /oodt/trunk/catalog: ./ src/main/bin/
src/main/java/org/apache/oodt/cas/catalog/cli/
src/main/java/org/apache/oodt/cas/catalog/cli/action/
src/main/java/org/apache/oodt/cas/catalog/server/
src/main/java/org/apache/oodt/c...
Author: bfoster
Date: Tue Feb 28 07:10:42 2012
New Revision: 1294490
URL: http://svn.apache.org/viewvc?rev=1294490&view=rev
Log:
- CAS-Catalog integration with CAS-CLI
---------------
OODT-391
Added:
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/
- copied from r1243633, oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/action/
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/CatalogServiceCliAction.java (with props)
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/GetSupportedCatalogIdsCliAction.java (with props)
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogRepositoryCliAction.java (with props)
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogsCliAction.java (with props)
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java (with props)
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java (with props)
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java (with props)
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java (with props)
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ShutdownCliAction.java (with props)
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/CatalogServiceServerCliAction.java (with props)
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/LaunchXmlRpcServerCliAction.java (with props)
oodt/trunk/catalog/src/main/resources/policy/cmd-line-actions.xml (with props)
oodt/trunk/catalog/src/main/resources/policy/cmd-line-options.xml (with props)
oodt/trunk/catalog/src/main/resources/policy/cmd-line-server-actions.xml (with props)
oodt/trunk/catalog/src/main/resources/policy/cmd-line-server-options.xml (with props)
Removed:
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/CatalogServiceServerAction.java
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/GetSupportedCatalogIds.java
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogRepositoryServerAction.java
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogsServerAction.java
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryServerAction.java
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryServerAction.java
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryServerAction.java
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryServerAction.java
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ShutdownServerAction.java
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/action/
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/option/
oodt/trunk/catalog/src/main/resources/catalog-service.properties
Modified:
oodt/trunk/catalog/pom.xml
oodt/trunk/catalog/src/main/bin/catserv-client
oodt/trunk/catalog/src/main/bin/catserv-server
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceCommandLineClient.java
oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceServerLauncher.java
oodt/trunk/catalog/src/main/resources/logging.properties
oodt/trunk/catalog/src/main/resources/policy/catserv-beans.xml
Modified: oodt/trunk/catalog/pom.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/pom.xml?rev=1294490&r1=1294489&r2=1294490&view=diff
==============================================================================
--- oodt/trunk/catalog/pom.xml (original)
+++ oodt/trunk/catalog/pom.xml Tue Feb 28 07:10:42 2012
@@ -145,6 +145,11 @@
<groupId>org.apache.oodt</groupId>
<artifactId>cas-metadata</artifactId>
<version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.oodt</groupId>
+ <artifactId>cas-cli</artifactId>
+ <version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Modified: oodt/trunk/catalog/src/main/bin/catserv-client
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/bin/catserv-client?rev=1294490&r1=1294489&r2=1294490&view=diff
==============================================================================
--- oodt/trunk/catalog/src/main/bin/catserv-client (original)
+++ oodt/trunk/catalog/src/main/bin/catserv-client Tue Feb 28 07:10:42 2012
@@ -20,14 +20,14 @@
set args
if ( $#args > 0 ) then
- set args = "$*"
+ 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.catalog.properties.file=../etc/catalog-service.properties \
- org.apache.oodt.cas.catalog.server.CatalogServiceCommandLineClient ${args}
-
+ -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}
Modified: oodt/trunk/catalog/src/main/bin/catserv-server
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/bin/catserv-server?rev=1294490&r1=1294489&r2=1294490&view=diff
==============================================================================
--- oodt/trunk/catalog/src/main/bin/catserv-server (original)
+++ oodt/trunk/catalog/src/main/bin/catserv-server Tue Feb 28 07:10:42 2012
@@ -20,14 +20,14 @@
set args
if ( $#args > 0 ) then
- set args = "$*"
+ 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.catalog.properties.file=../etc/catalog-service.properties \
- org.apache.oodt.cas.catalog.server.CatalogServiceServerLauncher ${args}
-
\ No newline at end of file
+ -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}
Added: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/CatalogServiceCliAction.java
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/CatalogServiceCliAction.java?rev=1294490&view=auto
==============================================================================
--- oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/CatalogServiceCliAction.java (added)
+++ oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/CatalogServiceCliAction.java Tue Feb 28 07:10:42 2012
@@ -0,0 +1,74 @@
+/*
+ * 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 {
+
+ 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", 1024);
+ }
+
+ private int getRequestTimeout() {
+ return Integer.getInteger("org.apache.oodt.cas.catalog.requestTimeout", 20);
+ }
+
+ private int getConnectionTimeout() {
+ return Integer.getInteger("org.apache.oodt.cas.catalog.connectionTimeout", 60);
+ }
+
+ 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;
+ }
+}
Propchange: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/CatalogServiceCliAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/GetSupportedCatalogIdsCliAction.java
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/GetSupportedCatalogIdsCliAction.java?rev=1294490&view=auto
==============================================================================
--- oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/GetSupportedCatalogIdsCliAction.java (added)
+++ oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/GetSupportedCatalogIdsCliAction.java Tue Feb 28 07:10:42 2012
@@ -0,0 +1,41 @@
+/*
+ * 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.system.impl.CatalogServiceClient;
+import org.apache.oodt.cas.cli.exception.CmdLineActionException;
+
+/**
+ * A {@link CmdLineAction} which get a list of supported {@link Catalog}
+ * IDs for given {@link 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);
+ }
+ }
+}
Propchange: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/GetSupportedCatalogIdsCliAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogRepositoryCliAction.java
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogRepositoryCliAction.java?rev=1294490&view=auto
==============================================================================
--- oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogRepositoryCliAction.java (added)
+++ oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogRepositoryCliAction.java Tue Feb 28 07:10:42 2012
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.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;
+ }
+}
Propchange: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogRepositoryCliAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogsCliAction.java
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogsCliAction.java?rev=1294490&view=auto
==============================================================================
--- oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogsCliAction.java (added)
+++ oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogsCliAction.java Tue Feb 28 07:10:42 2012
@@ -0,0 +1,70 @@
+/*
+ * 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;
+ }
+}
Propchange: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogsCliAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java?rev=1294490&view=auto
==============================================================================
--- oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java (added)
+++ oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java Tue Feb 28 07:10:42 2012
@@ -0,0 +1,98 @@
+/*
+ * 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 {
+
+ protected int pageNum = -1;
+ protected int pageSize = -1;
+ protected String query;
+ protected 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 = null;
+ 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: (");
+ StringBuffer sb = new StringBuffer("");
+ for (Object metKey : tMet.getMetadata().getHashtable().keySet()) {
+ sb.append(metKey
+ + "="
+ + tMet.getMetadata().getAllMetadata((String) metKey)
+ .toString().replaceAll("[\\[\\]]", "'") + ", ");
+ }
+ 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);
+ }
+}
Propchange: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java?rev=1294490&view=auto
==============================================================================
--- oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java (added)
+++ oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java Tue Feb 28 07:10:42 2012
@@ -0,0 +1,85 @@
+/*
+ * 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 {
+
+ protected String query;
+ protected 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 = null;
+ 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: (");
+ StringBuffer sb = new StringBuffer("");
+ for (Object metKey : tMet.getMetadata().getHashtable().keySet()) {
+ sb.append(metKey
+ + "="
+ + tMet.getMetadata().getAllMetadata((String) metKey)
+ .toString().replaceAll("[\\[\\]]", "'") + ", ");
+ }
+ 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);
+ }
+}
Propchange: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java?rev=1294490&view=auto
==============================================================================
--- oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java (added)
+++ oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java Tue Feb 28 07:10:42 2012
@@ -0,0 +1,107 @@
+/*
+ * 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 {
+
+ protected int pageNum = -1;
+ protected int pageSize = -1;
+ protected String query;
+ protected Set<String> catalogIds;
+ protected 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 = null;
+ 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) {
+ StringBuffer sb = new StringBuffer("");
+ for (String termName : this.termNames) {
+ List<String> values = tMet.getMetadata().getAllMetadata(
+ (String) termName);
+ sb.append(termName
+ + " = '"
+ + (values == null ? "null" : StringUtils.join(
+ values.iterator(), ",")) + "', ");
+ }
+ 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;
+ }
+}
Propchange: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java?rev=1294490&view=auto
==============================================================================
--- oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java (added)
+++ oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java Tue Feb 28 07:10:42 2012
@@ -0,0 +1,92 @@
+/*
+ * 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 {
+
+ protected String query;
+ protected Set<String> catalogIds;
+ protected 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 = null;
+ if (catalogIds == null) {
+ queryPager = getClient().query(queryExpression);
+ } else {
+ queryPager = getClient().query(queryExpression, catalogIds);
+ }
+ List<TransactionalMetadata> transactionMetadatas = getClient()
+ .getAllPages(queryPager);
+ for (TransactionalMetadata tMet : transactionMetadatas) {
+ StringBuffer sb = new StringBuffer("");
+ for (String termName : this.termNames) {
+ List<String> values = tMet.getMetadata().getAllMetadata(
+ (String) termName);
+ sb.append(termName
+ + " = '"
+ + (values == null ? "null" : StringUtils.join(
+ values.iterator(), ",")) + "', ");
+ }
+ 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;
+ }
+}
Propchange: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ShutdownCliAction.java
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ShutdownCliAction.java?rev=1294490&view=auto
==============================================================================
--- oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ShutdownCliAction.java (added)
+++ oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ShutdownCliAction.java Tue Feb 28 07:10:42 2012
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.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);
+ }
+ }
+}
Propchange: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ShutdownCliAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceCommandLineClient.java
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceCommandLineClient.java?rev=1294490&r1=1294489&r2=1294490&view=diff
==============================================================================
--- oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceCommandLineClient.java (original)
+++ oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceCommandLineClient.java Tue Feb 28 07:10:42 2012
@@ -18,43 +18,27 @@ package org.apache.oodt.cas.catalog.serv
//JDK imports
import java.io.FileInputStream;
-import java.util.List;
-
-//Spring imports
-import org.apache.oodt.cas.catalog.server.action.CatalogServiceServerAction;
-import org.apache.oodt.cas.catalog.system.impl.CatalogServiceClient;
-import org.apache.oodt.cas.catalog.system.impl.CatalogServiceClientFactory;
-import org.apache.oodt.cas.catalog.util.Serializer;
-import org.springframework.context.support.FileSystemXmlApplicationContext;
//OODT imports
-import org.apache.oodt.commons.option.CmdLineOptionInstance;
-import org.apache.oodt.commons.option.util.CmdLineOptionUtils;
-import org.apache.oodt.cas.metadata.util.PathUtils;
+import org.apache.oodt.cas.cli.CmdLineUtility;
/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Client Utility for sending commands to servers
- * <p>
+ * Client Utility for sending commands to servers.
+ *
+ * @author bfoster (Brian Foster)
*/
public class CatalogServiceCommandLineClient {
- public static void main(String[] args) throws Exception {
- String propertiesFile = System.getProperty("org.apache.oodt.cas.catalog.properties.file");
- if (propertiesFile != null)
- System.getProperties().load(new FileInputStream(propertiesFile));
- String configFile = PathUtils.doDynamicReplacement(System.getProperty("org.apache..oodt.cas.catalog.client.config.file", "classpath:/org/apache/oodt/cas/catalog/config/catserv-client-config.xml"));
- FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(new String[] { configFile }, false);
-// appContext.setClassLoader(new Serializer().getClassLoader());
- appContext.refresh();
- List<CmdLineOptionInstance> optionInstances = CmdLineOptionUtils.loadValidateAndHandleInstances(appContext, args);
- CmdLineOptionInstance instance = CmdLineOptionUtils.getOptionInstanceByName("clientFactoryBeanId", optionInstances);
- CatalogServiceClientFactory csClientFactory = (CatalogServiceClientFactory) appContext.getBean(instance.getValues().get(0), CatalogServiceClientFactory.class);
- CatalogServiceClient csClient = csClientFactory.createCatalogService();
- instance = CmdLineOptionUtils.getOptionInstanceByName("action", optionInstances);
- ((CatalogServiceServerAction) appContext.getBean(instance.getValues().get(0), CatalogServiceServerAction.class)).performAction(csClient);
- }
+ public static void main(String[] args) throws Exception {
+ // Load Catalog Service properties.
+ String propertiesFile = System
+ .getProperty("org.apache.oodt.cas.catalog.properties.file");
+ if (propertiesFile != null) {
+ System.getProperties().load(new FileInputStream(propertiesFile));
+ }
+
+ // Run Command line.
+ CmdLineUtility cmdLineUtility = new CmdLineUtility();
+ cmdLineUtility.run(args);
+ }
}
Modified: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceServerLauncher.java
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceServerLauncher.java?rev=1294490&r1=1294489&r2=1294490&view=diff
==============================================================================
--- oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceServerLauncher.java (original)
+++ oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceServerLauncher.java Tue Feb 28 07:10:42 2012
@@ -18,21 +18,9 @@ package org.apache.oodt.cas.catalog.serv
//JDK imports
import java.io.FileInputStream;
-import java.util.List;
//OODT imports
-import org.apache.oodt.cas.catalog.server.action.CatalogServiceServerAction;
-import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelServer;
-import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelServerFactory;
-import org.apache.oodt.cas.catalog.system.impl.CatalogServiceClient;
-import org.apache.oodt.cas.catalog.system.impl.CatalogServiceClientFactory;
-import org.apache.oodt.cas.catalog.util.Serializer;
-import org.apache.oodt.commons.option.CmdLineOptionInstance;
-import org.apache.oodt.commons.option.util.CmdLineOptionUtils;
-import org.apache.oodt.cas.metadata.util.PathUtils;
-
-//Spring imports
-import org.springframework.context.support.FileSystemXmlApplicationContext;
+import org.apache.oodt.cas.cli.CmdLineUtility;
/**
* @author bfoster
@@ -45,50 +33,17 @@ import org.springframework.context.suppo
public class CatalogServiceServerLauncher {
private CatalogServiceServerLauncher() throws InstantiationException {}
-//
-// public static void startup(String beanId) throws Exception {
-// String propertiesFile = System.getProperty("org.apache.oodt.cas.catalog.properties.file");
-// if (propertiesFile != null)
-// System.getProperties().load(new FileInputStream(propertiesFile));
-// FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(PathUtils.doDynamicReplacement(System.getProperty("org.apache.oodt.cas.catalog.config.file", "classpath:/gov/nasa/jpl/oodt/cas/catalog/config/catserv-config.xml")));
-// CommunicationChannelServerFactory serverFactory = (CommunicationChannelServerFactory) appContext.getBean(beanId, CommunicationChannelServerFactory.class);
-// CommunicationChannelServer communicationChannelServer = serverFactory.createCommunicationChannelServer();
-// communicationChannelServer.startup();
-// System.out.println("\n---- Launched '" + communicationChannelServer.getClass().getCanonicalName() + "' on port: " + communicationChannelServer.getPort() + " ----");
-// }
public static void main(String[] args) throws Exception {
- String propertiesFile = System.getProperty("org.apache.oodt.cas.catalog.properties.file");
- if (propertiesFile != null)
- System.getProperties().load(new FileInputStream(propertiesFile));
- String configFile = PathUtils.doDynamicReplacement(System.getProperty("org.apache.oodt.cas.catalog.server.config.file", "classpath:/org/apache/oodt/cas/catalog/config/catserv-server-config.xml"));
- FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(new String[] { configFile }, false);
- appContext.setClassLoader(new Serializer().getClassLoader());
- appContext.refresh();
- List<CmdLineOptionInstance> optionInstances = CmdLineOptionUtils.loadValidateAndHandleInstances(appContext, args);
- CmdLineOptionInstance instance = CmdLineOptionUtils.getOptionInstanceByName("serverFactoryBeanId", optionInstances);
- CommunicationChannelServerFactory serverFactory = (CommunicationChannelServerFactory) appContext.getBean(instance.getValues().get(0), CommunicationChannelServerFactory.class);
- CommunicationChannelServer communicationChannelServer = serverFactory.createCommunicationChannelServer();
- communicationChannelServer.startup();
- System.out.println("\n---- Launched '" + communicationChannelServer.getClass().getCanonicalName() + "' on port: " + communicationChannelServer.getPort() + " ----");
-
-//
-//
-//
-// String beanId = null;
-// for (int i = 0; i < args.length; i++) {
-// if (args[i].equals("--serverFactoryBeanId"))
-// beanId = args[++i];
-// }
-//
-// if (beanId == null) {
-// System.out.println("Usage: " + CatalogServiceServerLauncher.class.getName() + "\n"
-// + " --serverFactoryBeanId <bean-id> \n");
-// System.exit(1);
-// }
-//
-// CatalogServiceServerLauncher.startup(beanId);
-
+ // Load Catalog Service properties.
+ String propertiesFile = System
+ .getProperty("org.apache.oodt.cas.catalog.properties.file");
+ if (propertiesFile != null) {
+ System.getProperties().load(new FileInputStream(propertiesFile));
+ }
+
+ // Run Command line.
+ CmdLineUtility cmdLineUtility = new CmdLineUtility();
+ cmdLineUtility.run(args);
}
-
}
Added: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/CatalogServiceServerCliAction.java
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/CatalogServiceServerCliAction.java?rev=1294490&view=auto
==============================================================================
--- oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/CatalogServiceServerCliAction.java (added)
+++ oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/CatalogServiceServerCliAction.java Tue Feb 28 07:10:42 2012
@@ -0,0 +1,82 @@
+/*
+ * 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.server.cli.action;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.mapping.IngestMapperFactory;
+import org.apache.oodt.cas.catalog.repository.CatalogRepositoryFactory;
+import org.apache.oodt.cas.cli.action.CmdLineAction;
+
+/**
+ * Base Catalog Service Server {@link CmdLineAction}.
+ *
+ * @author bfoster (Brian Foster)
+ */
+public abstract class CatalogServiceServerCliAction extends CmdLineAction {
+
+ public int getPort() {
+ return Integer.getInteger("org.apache.oodt.cas.catalog.port");
+ }
+
+ public String getTransactionId() {
+ return System.getProperty("org.apache.oodt.cas.catalog.transactionid");
+ }
+
+ public CatalogRepositoryFactory getRepository()
+ throws InstantiationException, IllegalAccessException,
+ ClassNotFoundException {
+ return (CatalogRepositoryFactory) Class.forName(
+ System.getProperty("org.apache.oodt.cas.catalog.repository"))
+ .newInstance();
+ }
+
+ public IngestMapperFactory getIngestMapper() throws InstantiationException,
+ IllegalAccessException, ClassNotFoundException {
+ return (IngestMapperFactory) Class.forName(
+ System.getProperty("org.apache.oodt.cas.catalog.ingestmapper"))
+ .newInstance();
+ }
+
+ public boolean getRestrictQueryPermissions() {
+ return Boolean
+ .getBoolean("org.apache.oodt.cas.catalog.restrict.query.permissions");
+ }
+
+ public boolean getRestrictIngestPermissions() {
+ return Boolean
+ .getBoolean("org.apache.oodt.cas.catalog.restrict.ingest.permissions");
+ }
+
+ public boolean getOneCatalogFailsAllFail() {
+ return Boolean
+ .getBoolean("org.apache.oodt.cas.catalog.oneCatalogFailsAllFail");
+ }
+
+ public boolean getSimplifyQueries() {
+ return Boolean.getBoolean("org.apache.oodt.cas.catalog.simplifyQueries");
+ }
+
+ public boolean getDisableIntersectingCrossCatalogQueries() {
+ return Boolean
+ .getBoolean("org.apache.oodt.cas.catalog.disableIntersectingCrossCatalogQueries");
+ }
+
+ public int getCrossCatalogResultSortingThreshold() {
+ return Integer
+ .getInteger("org.apache.oodt.cas.catalog.crossCatalogResultSortingThreshold");
+ }
+}
Propchange: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/CatalogServiceServerCliAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/LaunchXmlRpcServerCliAction.java
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/LaunchXmlRpcServerCliAction.java?rev=1294490&view=auto
==============================================================================
--- oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/LaunchXmlRpcServerCliAction.java (added)
+++ oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/LaunchXmlRpcServerCliAction.java Tue Feb 28 07:10:42 2012
@@ -0,0 +1,68 @@
+/*
+ * 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.server.cli.action;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.server.channel.xmlrpc.XmlRpcCommunicationChannelServerFactory;
+import org.apache.oodt.cas.catalog.system.impl.CatalogServiceLocalFactory;
+import org.apache.oodt.cas.cli.exception.CmdLineActionException;
+
+/**
+ *
+ * @author bfoster (Brian Foster)
+ */
+public class LaunchXmlRpcServerCliAction extends CatalogServiceServerCliAction {
+
+ @Override
+ public void execute(ActionMessagePrinter printer)
+ throws CmdLineActionException {
+ try {
+ printer.println("Starting XML-RPC server on port " + getPort());
+ getXmlRpcFactory().createCommunicationChannelServer().startup();
+ } catch (Exception e) {
+ throw new CmdLineActionException("Failed to startup server : "
+ + e.getMessage(), e);
+ }
+ }
+
+ protected XmlRpcCommunicationChannelServerFactory getXmlRpcFactory()
+ throws InstantiationException, IllegalAccessException,
+ ClassNotFoundException {
+ XmlRpcCommunicationChannelServerFactory factory = new XmlRpcCommunicationChannelServerFactory();
+ factory.setPort(getPort());
+ factory.setCatalogServiceFactory(getCatalogServiceFactory());
+ return factory;
+ }
+
+ protected CatalogServiceLocalFactory getCatalogServiceFactory()
+ throws InstantiationException, IllegalAccessException,
+ ClassNotFoundException {
+ CatalogServiceLocalFactory factory = new CatalogServiceLocalFactory();
+ factory.setTransactionIdFactory(getTransactionId());
+ factory.setCatalogRepositoryFactory(getRepository());
+ factory.setIngestMapperFactory(getIngestMapper());
+ factory.setRestrictQueryPermissions(getRestrictQueryPermissions());
+ factory.setRestrictIngestPermissions(getRestrictIngestPermissions());
+ factory.setOneCatalogFailsAllFail(getOneCatalogFailsAllFail());
+ factory.setSimplifyQueries(getSimplifyQueries());
+ factory.setDisableIntersectingCrossCatalogQueries(
+ getDisableIntersectingCrossCatalogQueries());
+ factory.setCrossCatalogResultSortingThreshold(
+ getCrossCatalogResultSortingThreshold());
+ return factory;
+ }
+}
Propchange: oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/LaunchXmlRpcServerCliAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: oodt/trunk/catalog/src/main/resources/logging.properties
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/resources/logging.properties?rev=1294490&r1=1294489&r2=1294490&view=diff
==============================================================================
--- oodt/trunk/catalog/src/main/resources/logging.properties (original)
+++ oodt/trunk/catalog/src/main/resources/logging.properties Tue Feb 28 07:10:42 2012
@@ -46,5 +46,11 @@ httpclient.wire.level = INFO
sun.rmi.level = INFO
# spring logging
-org.springframework.level = INFO
-
+org.springframework.beans.level = WARNING
+org.springframework.core.level = WARNING
+org.springframework.level = WARNING
+org.springframework.beans.factory.level = WARNING
+org.springframework.beans.factory.config.level = WARNING
+org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.level = WARNING
+org.apache.oodt.cas.crawl.util.CasPropertyPlaceholderConfigurer.level = WARNING
+sun.net.level = WARNING
\ No newline at end of file
Modified: oodt/trunk/catalog/src/main/resources/policy/catserv-beans.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/resources/policy/catserv-beans.xml?rev=1294490&r1=1294489&r2=1294490&view=diff
==============================================================================
--- oodt/trunk/catalog/src/main/resources/policy/catserv-beans.xml (original)
+++ oodt/trunk/catalog/src/main/resources/policy/catserv-beans.xml Tue Feb 28 07:10:42 2012
@@ -16,68 +16,56 @@
limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean class="org.apache.oodt.commons.spring.postprocessor.SetIdBeanPostProcessor"/>
-
- <!-- Catalog Services -->
- <bean id="CatalogServiceLocalFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.system.impl.CatalogServiceLocalFactory">
- <property name="transactionIdFactory" value="org.apache.oodt.cas.catalog.struct.impl.transaction.UuidTransactionIdFactory"/>
- <property name="catalogRepositoryFactory" ref="SerializedCatalogRepositoryFactory"/>
- <property name="ingestMapperFactory" ref="InMemoryIngestMapperFactory"/>
- <property name="pluginStorageDir" value="${pcs.support.home}/cas-catalog/plugin-jars/"/>
- <property name="restrictQueryPermissions" value="false"/>
- <property name="restrictIngestPermissions" value="false"/>
- <property name="oneCatalogFailsAllFail" value="true"/>
- <property name="simplifyQueries" value="true"/>
- <property name="disableIntersectingCrossCatalogQueries" value="false"/>
- <property name="crossCatalogResultSortingThreshold" value="200"/>
- </bean>
- <bean id="CatalogServiceClientFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.system.impl.CatalogServiceClientFactory">
- <property name="communicationChannelClientFactory" ref="XmlRpcClientFactory"/>
- <property name="autoPagerSize" value="1000"/>
- </bean>
-
- <!-- Communication Channels -->
- <bean id="XmlRpcServerFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.server.channel.xmlrpc.XmlRpcCommunicationChannelServerFactory">
- <property name="port" value="${catalog.port}"/>
- <property name="catalogServiceFactory" ref="CatalogServiceLocalFactory"/>
- </bean>
- <bean id="XmlRpcClientFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.server.channel.xmlrpc.XmlRpcCommunicationChannelClientFactory">
- <property name="serverUrl" value="${catalog.url}"/>
- <property name="requestTimeout" value="20"/>
- <property name="connectionTimeout" value="60"/>
- <property name="chunkSize" value="1024"/>
- </bean>
-
- <!-- Catalog Repositories -->
- <bean id="SpringCatalogRepositoryFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.repository.SpringCatalogRepositoryFactory">
- <property name="catalogBeanRepo" value="${catalog.home}/policy/filemgr-catalog-beans.xml"/>
- </bean>
- <bean id="WorkflowManagerRepositoryFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.repository.SpringCatalogRepositoryFactory">
- <property name="catalogBeanRepo" value="${catalog.home}/policy/workflow-manager-beans.xml"/>
- </bean>
- <bean id="SerializedCatalogRepositoryFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.repository.SerializedCatalogRepositoryFactory">
- <property name="storageDir" value="${pcs.support.home}/cas-catalog/catalog-repo"/>
- </bean>
-
- <!-- Mapper Indexes -->
- <bean id="DataSourceIngestMapperFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.mapping.DataSourceIngestMapperFactory">
- <property name="jdbcUrl" value="jdbc:oracle:thin:@dew.jpl.nasa.gov:1521:npptest"/>
- <property name="user" value="sa"/>
- <property name="pass" value=""/>
- <property name="driver" value="oracle.jdbc.driver.OracleDriver"/>
- </bean>
- <bean id="InMemoryIngestMapperFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.mapping.InMemoryIngestMapperFactory">
- <property name="jdbcUrl" value="jdbc:hsqldb:file:${pcs.support.home}/hsqldb;shutdown=true"/>
- <property name="user" value="sa"/>
- <property name="pass" value=""/>
- <property name="driver" value="org.hsqldb.jdbcDriver"/>
- <property name="tablesFile" value="${catalog.home}/policy/in-memory-ingest-mapper.sql"/>
- </bean>
- <bean id="MemoryBasedIngestMapperFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.mapping.MemoryBasedIngestMapperFactory"/>
-
-</beans>
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+ <bean class="org.apache.oodt.commons.spring.postprocessor.SetIdBeanPostProcessor" />
+
+ <!-- Catalog Services -->
+ <bean id="CatalogServiceLocalFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.system.impl.CatalogServiceLocalFactory">
+ <property name="transactionIdFactory" value="org.apache.oodt.cas.catalog.struct.impl.transaction.UuidTransactionIdFactory" />
+ <property name="catalogRepositoryFactory" ref="SerializedCatalogRepositoryFactory" />
+ <property name="ingestMapperFactory" ref="InMemoryIngestMapperFactory" />
+ <property name="pluginStorageDir" value="${pcs.support.home}/cas-catalog/plugin-jars/" />
+ <property name="restrictQueryPermissions" value="false" />
+ <property name="restrictIngestPermissions" value="false" />
+ <property name="oneCatalogFailsAllFail" value="true" />
+ <property name="simplifyQueries" value="true" />
+ <property name="disableIntersectingCrossCatalogQueries" value="false" />
+ <property name="crossCatalogResultSortingThreshold" value="200" />
+ </bean>
+
+ <!-- Communication Channels -->
+ <bean id="XmlRpcServerFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.server.channel.xmlrpc.XmlRpcCommunicationChannelServerFactory">
+ <property name="port" value="${catalog.port}" />
+ <property name="catalogServiceFactory" ref="CatalogServiceLocalFactory" />
+ </bean>
+ <!-- Catalog Repositories -->
+ <bean id="SpringCatalogRepositoryFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.repository.SpringCatalogRepositoryFactory">
+ <property name="catalogBeanRepo" value="${catalog.home}/policy/filemgr-catalog-beans.xml" />
+ </bean>
+ <bean id="WorkflowManagerRepositoryFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.repository.SpringCatalogRepositoryFactory">
+ <property name="catalogBeanRepo" value="${catalog.home}/policy/workflow-manager-beans.xml" />
+ </bean>
+ <bean id="SerializedCatalogRepositoryFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.repository.SerializedCatalogRepositoryFactory">
+ <property name="storageDir" value="${pcs.support.home}/cas-catalog/catalog-repo" />
+ </bean>
+
+ <!-- Mapper Indexes -->
+ <bean id="DataSourceIngestMapperFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.mapping.DataSourceIngestMapperFactory">
+ <property name="jdbcUrl" value="jdbc:oracle:thin:@dew.jpl.nasa.gov:1521:npptest" />
+ <property name="user" value="sa" />
+ <property name="pass" value="" />
+ <property name="driver" value="oracle.jdbc.driver.OracleDriver" />
+ </bean>
+ <bean id="InMemoryIngestMapperFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.mapping.InMemoryIngestMapperFactory">
+ <property name="jdbcUrl" value="jdbc:hsqldb:file:${pcs.support.home}/hsqldb;shutdown=true" />
+ <property name="user" value="sa" />
+ <property name="pass" value="" />
+ <property name="driver" value="org.hsqldb.jdbcDriver" />
+ <property name="tablesFile" value="${catalog.home}/policy/in-memory-ingest-mapper.sql" />
+ </bean>
+ <bean id="MemoryBasedIngestMapperFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.mapping.MemoryBasedIngestMapperFactory" />
+
+</beans>
Added: oodt/trunk/catalog/src/main/resources/policy/cmd-line-actions.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/resources/policy/cmd-line-actions.xml?rev=1294490&view=auto
==============================================================================
--- oodt/trunk/catalog/src/main/resources/policy/cmd-line-actions.xml (added)
+++ oodt/trunk/catalog/src/main/resources/policy/cmd-line-actions.xml Tue Feb 28 07:10:42 2012
@@ -0,0 +1,51 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:p="http://www.springframework.org/schema/p"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+ <bean class="org.apache.oodt.commons.spring.postprocessor.SetIdBeanPostProcessor" />
+
+ <!-- Command Line Actions -->
+ <bean id="shutdown" class="org.apache.oodt.cas.catalog.cli.action.ShutdownCliAction">
+ <property name="description" value="Shuts down the server for which the given client connects" />
+ </bean>
+ <bean id="query_all" class="org.apache.oodt.cas.catalog.cli.action.QueryCliAction">
+ <property name="description" value="Performs a un-paged query to the server which the given client connects" />
+ </bean>
+ <bean id="reduced_query_all" class="org.apache.oodt.cas.catalog.cli.action.ReducedQueryCliAction">
+ <property name="description" value="Performs a un-paged query to the server which the given client connects" />
+ </bean>
+ <bean id="query_paged" class="org.apache.oodt.cas.catalog.cli.action.PagedQueryCliAction">
+ <property name="description" value="Performs a paged query to the server which the given client connects" />
+ </bean>
+ <bean id="reduced_query_paged" class="org.apache.oodt.cas.catalog.cli.action.ReducedPagedQueryCliAction">
+ <property name="description" value="Performs a paged query to the server which the given client connects" />
+ </bean>
+ <bean id="load_catalogs" class="org.apache.oodt.cas.catalog.cli.action.LoadCatalogsCliAction">
+ <property name="description" value="Loads the catalogs from the given spring xml file into the server for which the given client connects" />
+ </bean>
+ <bean id="load_catalog_repo" class="org.apache.oodt.cas.catalog.cli.action.LoadCatalogRepositoryCliAction">
+ <property name="description" value="Loads the catalogs from the given repository from the given spring xml file into the server for which the given client connects" />
+ </bean>
+ <bean id="get_catalog_ids" class="org.apache.oodt.cas.catalog.cli.action.GetSupportedCatalogIdsCliAction">
+ <property name="description" value="Gets a list of supported catalog ids from the server which the given client connects" />
+ </bean>
+
+</beans>
\ No newline at end of file
Propchange: oodt/trunk/catalog/src/main/resources/policy/cmd-line-actions.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: oodt/trunk/catalog/src/main/resources/policy/cmd-line-options.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/resources/policy/cmd-line-options.xml?rev=1294490&view=auto
==============================================================================
--- oodt/trunk/catalog/src/main/resources/policy/cmd-line-options.xml (added)
+++ oodt/trunk/catalog/src/main/resources/policy/cmd-line-options.xml Tue Feb 28 07:10:42 2012
@@ -0,0 +1,317 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:p="http://www.springframework.org/schema/p"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+ <bean id="url" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="u" />
+ <property name="longOption" value="url" />
+ <property name="description" value="Server URL" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="url" />
+ <property name="required" value="true" />
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
+ <property name="propertyNames">
+ <list>
+ <value>org.apache.oodt.cas.catalog.url</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ <property name="validators">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.validator.ArgRegExpCmdLineOptionValidator">
+ <property name="allowedArgs">
+ <list>
+ <value>http://.*:\d*</value>
+ </list>
+ </property>
+ </bean>
+ </list>
+ </property>
+ </bean>
+
+ <bean id="chunkSize" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="cs" />
+ <property name="longOption" value="chunkSize" />
+ <property name="description" value="XML-RPC data chunk size in bytes" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="int" />
+ <property name="required" value="false" />
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
+ <property name="propertyNames">
+ <list>
+ <value>org.apache.oodt.cas.catalog.chunkSize</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="requestTimeout" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="rqt" />
+ <property name="longOption" value="requestTimeout" />
+ <property name="description" value="XML-RPC request timeout in seconds" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="int" />
+ <property name="required" value="false" />
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
+ <property name="propertyNames">
+ <list>
+ <value>org.apache.oodt.cas.catalog.requestTimeout</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="connectionTimeout" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="ct" />
+ <property name="longOption" value="connectionTimeout" />
+ <property name="description" value="XML-RPC connection timeout in seconds" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="int" />
+ <property name="required" value="false" />
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
+ <property name="propertyNames">
+ <list>
+ <value>org.apache.oodt.cas.catalog.connectionTimeout</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="query" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="q" />
+ <property name="longOption" value="query" />
+ <property name="description" value="CatalogService String Query" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="query" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="query_all" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="reduced_query_all" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="query_paged" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="reduced_query_paged" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
+ <property name="applyToActions">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="query_all" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="reduced_query_all" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="query_paged" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="reduced_query_paged" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="pageSize" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="ps" />
+ <property name="longOption" value="pageSize" />
+ <property name="description" value="Paged Query PageSize" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="integer" />
+ <property name="type" value="int" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="query_paged" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="reduced_query_paged" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
+ <property name="applyToActions">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="query_paged" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="reduced_query_paged" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="pageNum" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="pn" />
+ <property name="longOption" value="pageNum" />
+ <property name="description" value="Paged Query PageNum" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="integer" />
+ <property name="type" value="int" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="query_paged" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="reduced_query_paged" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
+ <property name="applyToActions">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="query_paged" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="reduced_query_paged" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="reducedTerms" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="rt" />
+ <property name="longOption" value="reducedTerms" />
+ <property name="description" value="Term filter for query results" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="list" />
+ <property name="type" value="java.util.List" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="reduced_query_all" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="reduced_query_paged" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
+ <property name="applyToActions">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="reduced_query_all" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="reduced_query_paged" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="catalogRepositoryId" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="crid" />
+ <property name="longOption" value="catalogRepositoryId" />
+ <property name="description" value="CatalogRepository Spring Bean Id" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="bean id" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="load_catalog_repo" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
+ <property name="applyToActions">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="load_catalog_repo" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="catalogIds" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="cid" />
+ <property name="longOption" value="catalogIds" />
+ <property name="description" value="List of Catalog IDs to query" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="catalog ids" />
+ <property name="type" value="java.util.List" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="query_all" p:relation="OPTIONAL" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="reduced_query_all" p:relation="OPTIONAL" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="query_paged" p:relation="OPTIONAL" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="reduced_query_paged" p:relation="OPTIONAL" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
+ <property name="applyToActions">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="query_all" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="reduced_query_all" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="query_paged" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="reduced_query_paged" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="beanRepo" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="br" />
+ <property name="longOption" value="beanRepo" />
+ <property name="description" value="Spring Bean XML File" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="file path" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="load_catalogs" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="load_catalog_repo" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
+ <property name="applyToActions">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="load_catalogs" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="load_catalog_repo" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+</beans>
Propchange: oodt/trunk/catalog/src/main/resources/policy/cmd-line-options.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: oodt/trunk/catalog/src/main/resources/policy/cmd-line-server-actions.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/catalog/src/main/resources/policy/cmd-line-server-actions.xml?rev=1294490&view=auto
==============================================================================
--- oodt/trunk/catalog/src/main/resources/policy/cmd-line-server-actions.xml (added)
+++ oodt/trunk/catalog/src/main/resources/policy/cmd-line-server-actions.xml Tue Feb 28 07:10:42 2012
@@ -0,0 +1,30 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:p="http://www.springframework.org/schema/p"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+ <bean class="org.apache.oodt.commons.spring.postprocessor.SetIdBeanPostProcessor" />
+
+ <!-- Command Line Actions -->
+ <bean id="launchXmlRpcServer" class="org.apache.oodt.cas.catalog.server.cli.action.LaunchXmlRpcServerCliAction">
+ <property name="description" value="Brings up a Catalog Service behind an XML-RPC server" />
+ </bean>
+
+</beans>
\ No newline at end of file
Propchange: oodt/trunk/catalog/src/main/resources/policy/cmd-line-server-actions.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain