You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2011/02/12 20:10:48 UTC
svn commit: r1070132 [1/3] - in /oodt/trunk: ./ pcs/core/ pcs/core/src/
pcs/core/src/main/ pcs/core/src/main/assembly/ pcs/core/src/main/bin/
pcs/core/src/main/java/ pcs/core/src/main/java/org/
pcs/core/src/main/java/org/apache/ pcs/core/src/main/java/...
Author: mattmann
Date: Sat Feb 12 19:10:46 2011
New Revision: 1070132
URL: http://svn.apache.org/viewvc?rev=1070132&view=rev
Log:
- fix for OODT-135 Process Control System Package
Added:
oodt/trunk/pcs/core/ (with props)
oodt/trunk/pcs/core/pom.xml
oodt/trunk/pcs/core/src/
oodt/trunk/pcs/core/src/main/
oodt/trunk/pcs/core/src/main/assembly/
oodt/trunk/pcs/core/src/main/assembly/assembly.xml
oodt/trunk/pcs/core/src/main/bin/
oodt/trunk/pcs/core/src/main/bin/pcs_ll (with props)
oodt/trunk/pcs/core/src/main/bin/pcs_stat (with props)
oodt/trunk/pcs/core/src/main/bin/pcs_trace (with props)
oodt/trunk/pcs/core/src/main/java/
oodt/trunk/pcs/core/src/main/java/org/
oodt/trunk/pcs/core/src/main/java/org/apache/
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlInfo.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlPropertiesFile.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlerHealth.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlerPropertiesMetKeys.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlerStatus.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/JobHealthStatus.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/PCSDaemonStatus.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/PCSHealthMonitorMetKeys.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/PCSHealthMonitorReport.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/WorkflowStatesFile.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/WorkflowStatesMetKeys.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/listing/
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/listing/ListingConf.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/listing/ListingConfKeys.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/metadata/
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/metadata/PCSConfigMetadata.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/metadata/PCSMetadata.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/Pedigree.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTree.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTreeNode.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/query/
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/query/AbstractPCSQuery.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/query/FilenameQuery.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/query/InputFilesQuery.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/query/JobIdQuery.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/query/OutputFilesQuery.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/query/PCSQuery.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/query/ProductNameQuery.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/query/TemporalQuery.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/tools/
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/tools/PCSHealthMonitor.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/tools/PCSLongLister.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/tools/PCSTrace.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/util/
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/util/FileManagerUtils.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/util/ResourceManagerUtils.java (with props)
oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/util/WorkflowManagerUtils.java (with props)
oodt/trunk/pcs/core/src/main/resources/
oodt/trunk/pcs/core/src/main/resources/pcs-crawlers.xml
oodt/trunk/pcs/core/src/main/resources/pcs-ll-conf.xml
oodt/trunk/pcs/core/src/main/resources/pcs-workflow-statuses.xml
oodt/trunk/pcs/core/src/main/resources/pcs.logging.properties
Modified:
oodt/trunk/CHANGES.txt
Modified: oodt/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1070132&r1=1070131&r2=1070132&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Sat Feb 12 19:10:46 2011
@@ -4,6 +4,8 @@ Apache OODT Change Log
Release 0.3-SNAPSHOT (in progress)
--------------------------------------------
+* OODT-135 Process Control System Package (mattmann)
+
* OODT-138 Reference class prints stack trace when mime type repo
cannot be found (mattmann)
Propchange: oodt/trunk/pcs/core/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Feb 12 19:10:46 2011
@@ -0,0 +1 @@
+target
Added: oodt/trunk/pcs/core/pom.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/pom.xml?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/pom.xml (added)
+++ oodt/trunk/pcs/core/pom.xml Sat Feb 12 19:10:46 2011
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more contributor
+license agreements. See the NOTICE.txt file distributed with this work for
+additional information regarding copyright ownership. The ASF licenses this
+file to you under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+-->
+<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>
+ <artifactId>pcs-core</artifactId>
+ <parent>
+ <groupId>org.apache.oodt</groupId>
+ <artifactId>oodt-core</artifactId>
+ <version>0.3-SNAPSHOT</version>
+ <relativePath>../../core/pom.xml</relativePath>
+ </parent>
+ <name>Process Control System Core Package</name>
+ <packaging>jar</packaging>
+ <description>The Process Control System's core system framework. PCS is an agglomeration of
+ CAS services and components needed to build a science data system.
+ </description>
+ <build>
+ <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>
+ <manifest>
+ <mainClass>org.apache.oodt.pcs.tools.PCSHealthMonitor</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.oodt</groupId>
+ <artifactId>oodt-commons</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.oodt</groupId>
+ <artifactId>cas-metadata</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.oodt</groupId>
+ <artifactId>cas-workflow</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.oodt</groupId>
+ <artifactId>cas-resource</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.oodt</groupId>
+ <artifactId>cas-filemgr</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.oodt</groupId>
+ <artifactId>cas-crawler</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Added: oodt/trunk/pcs/core/src/main/assembly/assembly.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/assembly/assembly.xml?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/assembly/assembly.xml (added)
+++ oodt/trunk/pcs/core/src/main/assembly/assembly.xml Sat Feb 12 19:10:46 2011
@@ -0,0 +1,72 @@
+<!--
+/*
+ * 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.
+ */
+
+$Id$
+-->
+<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>scripts</outputDirectory>
+ <includes/>
+ <fileMode>755</fileMode>
+ </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>aux/pcs</outputDirectory>
+ <includes>
+ <include>pcs-crawlers.xml</include>
+ <include>pcs-workflow-statuses.xml</include>
+ <include>pcs-ll-conf.xml</include>
+ <include>pcs.logging.properties</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ <unpack>false</unpack>
+ <useProjectArtifact>true</useProjectArtifact>
+ <useTransitiveDependencies>true</useTransitiveDependencies>
+ <unpackOptions/>
+ </dependencySet>
+ </dependencySets>
+</assembly>
Added: oodt/trunk/pcs/core/src/main/bin/pcs_ll
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/bin/pcs_ll?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/bin/pcs_ll (added)
+++ oodt/trunk/pcs/core/src/main/bin/pcs_ll Sat Feb 12 19:10:46 2011
@@ -0,0 +1,47 @@
+#!/bin/tcsh
+# 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.
+#
+#
+# Tool: Long lister
+# Purpose: Provide metadata information for all files in a directory.
+# Interface: Command-line. If no arguments provided, assume the current
+# directory. Arguments can be a directory or a filename specification
+# with wildcards.
+# Output: Text to standard out. One line per file. Fields of line
+# (tab-separated):
+# Filename
+# Test Tag(s)
+# Test Counter(s)
+# Subtest tag(s)
+# DataStartTime
+# DataEndTime
+#
+# Note this behavior can be overriden by specifications in the pcs-ll-conf.xml
+# file.
+#
+# Sample usage: ./pcs_ll
+
+
+set ORIG_DIR = `pwd`
+set DIR = `dirname $0`
+cd $DIR
+set DIR_PATH = `pwd`
+cd $ORIG_DIR
+
+java -Djava.util.logging.config.file=$DIR_PATH/../aux/pcs/pcs.logging.properties \
+ -Djava.ext.dirs=$DIR_PATH/../lib:$DIR_PATH/../filemgr/lib:$DIR_PATH/../workflow/lib \
+ org.apache.oodt.pcs.tools.PCSLongLister \
+ $FILEMGR_URL $DIR_PATH/../aux/pcs/pcs-ll-conf.xml $argv[2-$#argv]
Propchange: oodt/trunk/pcs/core/src/main/bin/pcs_ll
------------------------------------------------------------------------------
svn:executable = *
Added: oodt/trunk/pcs/core/src/main/bin/pcs_stat
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/bin/pcs_stat?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/bin/pcs_stat (added)
+++ oodt/trunk/pcs/core/src/main/bin/pcs_stat Sat Feb 12 19:10:46 2011
@@ -0,0 +1,78 @@
+#!/bin/tcsh
+# 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.
+#
+#
+# A tool to provide a report of the health of the PCS.
+# Example report:
+#
+# --------------------------------------
+# PCS Health Monitor Report
+# Generated on: 2007-07-12T10:56:23.000Z
+#
+# Service Status:
+#
+# File Manager: [http://vostok:9000]: UP
+# Workflow Manager: [http://vostok:9001]: DOWN
+# Resource Manager: [http://vostok:9002]: UP
+# > batch stub: [http://compute-0-9:2001]: UP
+# > batch stub: [http://compute-0-10:2001]: UP
+#
+# Crawlers:
+# CPTOverview: [http://flatiron:9030]: UP
+# CPTHeliostat: [http://flatiron:9031]: DOWN
+#
+# PCS Health:
+#
+# Files:
+# --------
+# last product ingested: oco_L1aRad01wdk_90233_070604010005.hdf at 2007-06-04T10:00:00.000Z
+#
+# Jobs:
+# --------
+# 10 tasks QUEUED
+# 9 tasks CRAWLING
+# 1 tasks PGE EXEC
+#
+# Ingest:
+# --------
+# CPTOverview:
+#
+# number of crawls: 10
+# average crawl time (ms): 50
+#
+# CPTHeliostat:
+#
+# number of crawls: 56
+# average crawl time (ms): 10
+# --------------------------------------
+#
+# Sample usage: ./pcs_stat
+
+set ORIG_DIR = `pwd`
+set DIR = `dirname $0`
+cd $DIR
+set DIR_PATH = `pwd`
+cd $ORIG_DIR
+
+java -Djava.util.logging.config.file=$DIR_PATH/../aux/pcs/pcs.logging.properties \
+ -Djava.ext.dirs=$DIR_PATH/../lib:$DIR_PATH/../filemgr/lib:$DIR_PATH/../workflow/lib:../resmgr/lib \
+ -Dorg.apache.oodt.cas.filemgr.properties=$DIR_PATH/../filemgr/etc/filemgr.properties \
+ org.apache.oodt.pcs.tools.PCSHealthMonitor \
+ $FILEMGR_URL \
+ $WORKFLOW_URL \
+ $RESMGR_URL \
+ $DIR_PATH/../aux/pcs/pcs-crawlers.xml \
+ $DIR_PATH/../aux/pcs/pcs-workflow-statuses.xml
Propchange: oodt/trunk/pcs/core/src/main/bin/pcs_stat
------------------------------------------------------------------------------
svn:executable = *
Added: oodt/trunk/pcs/core/src/main/bin/pcs_trace
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/bin/pcs_trace?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/bin/pcs_trace (added)
+++ oodt/trunk/pcs/core/src/main/bin/pcs_trace Sat Feb 12 19:10:46 2011
@@ -0,0 +1,40 @@
+#!/bin/tcsh
+# 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.
+#
+#
+# PCS Trace utility to discover product information including lineage
+# upstream and downstream, metadata, pipeline information and the like
+#
+# Sample usage: ./pcs_trace oco_L033Sun01Sun_91601_070922054839.pkt
+
+
+set DIR = `dirname $0`
+cd $DIR
+set DIR_PATH = `pwd`
+
+if ( $#argv != 1 ) then
+ echo "Usage: $0 <product>"
+ exit 1
+else
+ java -Djava.ext.dirs=$DIR_PATH/../lib:$DIR_PATH/../filemgr/lib:$DIR_PATH/../workflow/lib \
+ -Djava.util.logging.config.file=$DIR_PATH/../aux/pcs/pcs.logging.properties \
+ -Dorg.apache.oodt.cas.filemgr.properties=$DIR_PATH/../filemgr/etc/filemgr.properties \
+ org.apache.oodt.pcs.tools.PCSTrace \
+ --fm $FILEMGR_URL \
+ --wm $WORKFLOW_URL \
+ --product $1 \
+ --enableNonCat
+endif
Propchange: oodt/trunk/pcs/core/src/main/bin/pcs_trace
------------------------------------------------------------------------------
svn:executable = *
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlInfo.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlInfo.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlInfo.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlInfo.java Sat Feb 12 19:10:46 2011
@@ -0,0 +1,84 @@
+/**
+ * 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.pcs.health;
+
+/**
+ * Information about a crawler: its <code>crawlerName</code> and
+ * <code>crawlerPort</code>.
+ *
+ * @author mattmann
+ * @version $Revision$
+ */
+public class CrawlInfo {
+
+ private String crawlerName;
+
+ private String crawlerPort;
+
+ /**
+ * Default Constructor.
+ *
+ */
+ public CrawlInfo() {
+
+ }
+
+ /**
+ * Constructs a new CrawlInfo with the specified parameters.
+ *
+ * @param name
+ * The name of the Crawler.
+ * @param port
+ * The port that the Crawler was running on.
+ */
+ public CrawlInfo(String name, String port) {
+ this.crawlerName = name;
+ this.crawlerPort = port;
+ }
+
+ /**
+ * @return the crawlerName
+ */
+ public String getCrawlerName() {
+ return crawlerName;
+ }
+
+ /**
+ * @param crawlerName
+ * the crawlerName to set
+ */
+ public void setCrawlerName(String crawlerName) {
+ this.crawlerName = crawlerName;
+ }
+
+ /**
+ * @return the crawlerPort
+ */
+ public String getCrawlerPort() {
+ return crawlerPort;
+ }
+
+ /**
+ * @param crawlerPort
+ * the crawlerPort to set
+ */
+ public void setCrawlerPort(String crawlerPort) {
+ this.crawlerPort = crawlerPort;
+ }
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlPropertiesFile.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlPropertiesFile.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlPropertiesFile.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlPropertiesFile.java Sat Feb 12 19:10:46 2011
@@ -0,0 +1,94 @@
+/**
+ * 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.pcs.health;
+
+//OODT imports
+import org.apache.oodt.pcs.input.PGEConfigurationFile;
+import org.apache.oodt.pcs.input.PGEGroup;
+import org.apache.oodt.pcs.input.PGEConfigFileReader;
+import org.apache.oodt.cas.metadata.util.PathUtils;
+
+//JDK imports
+import java.io.FileInputStream;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+/**
+ *
+ * Properties used by the {@link PCSHealthMonitor} tool to determine
+ * {@link ProductCrawler} status.
+ *
+ * @author mattmann
+ * @version $Revision$
+ */
+public class CrawlPropertiesFile implements CrawlerPropertiesMetKeys {
+
+ private PGEConfigurationFile file;
+
+ /**
+ * Constructs a new CrawlPropertiesFile.
+ *
+ * @param filePath
+ * The path to the CrawlPropertiesFile to load.
+ * @throws InstantiationException
+ * If there is some error reading the file.
+ */
+ public CrawlPropertiesFile(String filePath) throws InstantiationException {
+ try {
+ this.file = new PGEConfigFileReader().read(new FileInputStream(filePath));
+ } catch (Exception e) {
+ throw new InstantiationException(e.getMessage());
+ }
+ }
+
+ /**
+ *
+ * @return A {@link List} of {@link CrawlInfo} objects describing a Crawler.
+ */
+ public List getCrawlers() {
+ PGEGroup crawlInfo = (PGEGroup) this.file.getPgeSpecificGroups().get(
+ CRAWLER_INFO_GROUP);
+
+ Map scalars = crawlInfo.getScalars();
+ List crawlers = new Vector(scalars.keySet().size());
+ for (Iterator i = scalars.keySet().iterator(); i.hasNext();) {
+ String crawlerName = (String) i.next();
+ String crawlerPort = crawlInfo.getScalar(crawlerName).getValue();
+ CrawlInfo info = new CrawlInfo(crawlerName, crawlerPort);
+ crawlers.add(info);
+ }
+
+ return crawlers;
+ }
+
+ /**
+ *
+ * @return The String hostname that the Crawlers run on. This is used by the
+ * {@link PCSHealthMonitor} tool to communicate with the Crawlers and
+ * to check their status.
+ */
+ public String getCrawlHost() {
+ String crawlHost = ((PGEGroup) this.file.getPgeSpecificGroups().get(
+ CRAWLER_PROPERTIES_GROUP)).getScalar(CRAWLER_HOST_NAME).getValue();
+ crawlHost = PathUtils.replaceEnvVariables(crawlHost);
+ return crawlHost;
+ }
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlPropertiesFile.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlerHealth.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlerHealth.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlerHealth.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlerHealth.java Sat Feb 12 19:10:46 2011
@@ -0,0 +1,110 @@
+/**
+ * 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.pcs.health;
+
+//OODT imports
+import org.apache.oodt.cas.crawl.daemon.CrawlDaemon; //for javadoc
+
+/**
+ *
+ * Health of a PCS Crawler in terms of the number of crawls performed, and
+ * average crawl time provided by a {@link CrawlDaemon}
+ *
+ * @author mattmann
+ * @version $Revision$
+ *
+ */
+public class CrawlerHealth {
+
+ private String crawlerName;
+
+ private int numCrawls;
+
+ private double avgCrawlTime;
+
+ /**
+ * Default Constructor.
+ *
+ */
+ public CrawlerHealth() {
+
+ }
+
+ /**
+ * Constructs a new CrawlerHealth with the given parameters.
+ *
+ * @param crawlerName
+ * Name of the Crawler.
+ * @param numCrawls
+ * The number of crawls performed.
+ * @param avgCrawlTime
+ * The average time (in seconds) that a Crawler spends during each
+ * crawl.
+ */
+ public CrawlerHealth(String crawlerName, int numCrawls, double avgCrawlTime) {
+ this.crawlerName = crawlerName;
+ this.numCrawls = numCrawls;
+ this.avgCrawlTime = avgCrawlTime;
+ }
+
+ /**
+ * @return the avgCrawlTime
+ */
+ public double getAvgCrawlTime() {
+ return avgCrawlTime;
+ }
+
+ /**
+ * @param avgCrawlTime
+ * the avgCrawlTime to set
+ */
+ public void setAvgCrawlTime(double avgCrawlTime) {
+ this.avgCrawlTime = avgCrawlTime;
+ }
+
+ /**
+ * @return the crawlerName
+ */
+ public String getCrawlerName() {
+ return crawlerName;
+ }
+
+ /**
+ * @param crawlerName
+ * the crawlerName to set
+ */
+ public void setCrawlerName(String crawlerName) {
+ this.crawlerName = crawlerName;
+ }
+
+ /**
+ * @return the numCrawls
+ */
+ public int getNumCrawls() {
+ return numCrawls;
+ }
+
+ /**
+ * @param numCrawls
+ * the numCrawls to set
+ */
+ public void setNumCrawls(int numCrawls) {
+ this.numCrawls = numCrawls;
+ }
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlerHealth.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlerPropertiesMetKeys.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlerPropertiesMetKeys.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlerPropertiesMetKeys.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlerPropertiesMetKeys.java Sat Feb 12 19:10:46 2011
@@ -0,0 +1,35 @@
+/**
+ * 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.pcs.health;
+
+/**
+ *
+ * Met keys read from the {@link CrawlPropertiesFile}.
+ *
+ * @author mattmann
+ * @version $Revision$
+ */
+public interface CrawlerPropertiesMetKeys {
+
+ public static final String CRAWLER_INFO_GROUP = "CrawlerInfo";
+
+ public static final String CRAWLER_PROPERTIES_GROUP = "CrawlProperties";
+
+ public static final String CRAWLER_HOST_NAME = "Hostname";
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlerPropertiesMetKeys.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlerStatus.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlerStatus.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlerStatus.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlerStatus.java Sat Feb 12 19:10:46 2011
@@ -0,0 +1,105 @@
+/**
+ * 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.pcs.health;
+
+/**
+ * Provides status about a Crawler to the {@link PCSHealthMonitor}.
+ *
+ * @author mattmann
+ * @version $Revision$
+ */
+public class CrawlerStatus {
+
+ private CrawlInfo info;
+
+ private String status;
+
+ private String crawlHost;
+
+ /**
+ * Default Constructor.
+ *
+ */
+ public CrawlerStatus() {
+
+ }
+
+ /**
+ * Constructs a new CrawlerStatus with the given parameters.
+ *
+ * @param info
+ * The {@link CrawlerInfo} describing this Crawler.
+ * @param status
+ * One of {@link PCSHealthMonitorMetKeys#STATUS_UP} , or
+ * {@link PCSHealthMonitorMetKeys#STATUS_DOWN}.
+ *
+ * @param crawlHost
+ * The host that the Crawler is running on.
+ */
+ public CrawlerStatus(CrawlInfo info, String status, String crawlHost) {
+ this.info = info;
+ this.status = status;
+ this.crawlHost = crawlHost;
+ }
+
+ /**
+ * @return the info
+ */
+ public CrawlInfo getInfo() {
+ return info;
+ }
+
+ /**
+ * @param info
+ * the info to set
+ */
+ public void setInfo(CrawlInfo info) {
+ this.info = info;
+ }
+
+ /**
+ * @return the status
+ */
+ public String getStatus() {
+ return status;
+ }
+
+ /**
+ * @param status
+ * the status to set
+ */
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ /**
+ * @return the crawlHost
+ */
+ public String getCrawlHost() {
+ return crawlHost;
+ }
+
+ /**
+ * @param crawlHost
+ * the crawlHost to set
+ */
+ public void setCrawlHost(String crawlHost) {
+ this.crawlHost = crawlHost;
+ }
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/CrawlerStatus.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/JobHealthStatus.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/JobHealthStatus.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/JobHealthStatus.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/JobHealthStatus.java Sat Feb 12 19:10:46 2011
@@ -0,0 +1,87 @@
+/**
+ * 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.pcs.health;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.structs.WorkflowInstance; //for javadoc
+import org.apache.oodt.cas.workflow.structs.WorkflowStatus; //for javadoc
+
+/**
+ *
+ * A container representing Job health status in the PCS
+ *
+ * @author mattmann
+ * @version $Revision$
+ */
+public class JobHealthStatus {
+
+ private String status;
+
+ private int numPipelines;
+
+ public JobHealthStatus() {
+
+ }
+
+ /**
+ * Constructs a JobHealthStatus with the given parameters.
+ *
+ * @param status
+ * The Job status, one of {@link WorkflowStatus#STARTED}, or any of
+ * the other WorkflowStatus keys.
+ *
+ * @param numPipelines
+ * The number of {@link WorkflowInstance}s with the given
+ * {@link WorkflowStatus}.
+ */
+ public JobHealthStatus(String status, int numPipelines) {
+ this.status = status;
+ this.numPipelines = numPipelines;
+ }
+
+ /**
+ * @return the numPipelines
+ */
+ public int getNumPipelines() {
+ return numPipelines;
+ }
+
+ /**
+ * @param numPipelines
+ * the numPipelines to set
+ */
+ public void setNumPipelines(int numPipelines) {
+ this.numPipelines = numPipelines;
+ }
+
+ /**
+ * @return the status
+ */
+ public String getStatus() {
+ return status;
+ }
+
+ /**
+ * @param status
+ * the status to set
+ */
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/JobHealthStatus.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/PCSDaemonStatus.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/PCSDaemonStatus.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/PCSDaemonStatus.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/PCSDaemonStatus.java Sat Feb 12 19:10:46 2011
@@ -0,0 +1,96 @@
+//Copyright (c) 2008, California Institute of Technology.
+//ALL RIGHTS RESERVED. U.S. Government sponsorship acknowledged.
+//
+//$Id$
+
+package org.apache.oodt.pcs.health;
+
+/**
+ * @author mattmann
+ * @version $Revision$
+ *
+ * <p>
+ * A simple data structure to capture the status of a PCS daemon (either the
+ * File Manager, the Workflow Manager, or the Resource Manager)
+ * </p>.
+ */
+public class PCSDaemonStatus {
+
+ private String daemonName;
+
+ private String urlStr;
+
+ private String status;
+
+ /**
+ * Default Constructor.
+ *
+ */
+ public PCSDaemonStatus() {
+ }
+
+ /**
+ * Constructs a new PCSDaemonStatus with the default parameters.
+ *
+ * @param daemonName
+ * The name of the PCS Daemon.
+ * @param urlStr
+ * A Stirng representation of a {@link URL} that this daemon runs
+ * on.
+ * @param status
+ * One of {@link PCSHealthMonitorMetKeys#STATUS_UP} , or
+ * {@link PCSHealthMonitorMetKeys#STATUS_DOWN}.
+ */
+ public PCSDaemonStatus(String daemonName, String urlStr, String status) {
+ super();
+ this.daemonName = daemonName;
+ this.urlStr = urlStr;
+ this.status = status;
+ }
+
+ /**
+ * @return the daemonName
+ */
+ public String getDaemonName() {
+ return daemonName;
+ }
+
+ /**
+ * @param daemonName
+ * the daemonName to set
+ */
+ public void setDaemonName(String daemonName) {
+ this.daemonName = daemonName;
+ }
+
+ /**
+ * @return the status
+ */
+ public String getStatus() {
+ return status;
+ }
+
+ /**
+ * @param status
+ * the status to set
+ */
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ /**
+ * @return the urlStr
+ */
+ public String getUrlStr() {
+ return urlStr;
+ }
+
+ /**
+ * @param urlStr
+ * the urlStr to set
+ */
+ public void setUrlStr(String urlStr) {
+ this.urlStr = urlStr;
+ }
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/PCSDaemonStatus.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/PCSHealthMonitorMetKeys.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/PCSHealthMonitorMetKeys.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/PCSHealthMonitorMetKeys.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/PCSHealthMonitorMetKeys.java Sat Feb 12 19:10:46 2011
@@ -0,0 +1,52 @@
+/**
+ * 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.pcs.health;
+
+/**
+ * Met keys for the {@link PCSHealthMonitor} tool
+ *
+ * @author mattmann
+ * @version $Revision$
+ */
+public interface PCSHealthMonitorMetKeys {
+
+ public static final String HEADER_AND_FOOTER = "--------------------------------------";
+
+ public static final String SECTION_SEPARATOR = "--------";
+
+ public static final String REPORT_BANNER = "PCS Health Monitor Report";
+
+ public static final String FILE_MANAGER_DAEMON_NAME = "File Manager";
+
+ public static final String WORKFLOW_MANAGER_DAEMON_NAME = "Workflow Manager";
+
+ public static final String RESOURCE_MANAGER_DAEMON_NAME = "Resource Manager";
+
+ public static final String BATCH_STUB_DAEMON_NAME = "batch stub";
+
+ public static final String STATUS_UP = "UP";
+
+ public static final String STATUS_DOWN = "DOWN";
+
+ public static final int TOP_N_PRODUCTS = 20;
+
+ public static final int CRAWLER_DOWN_INT = -1;
+
+ public static final double CRAWLER_DOWN_DOUBLE = -1.0;
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/PCSHealthMonitorMetKeys.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/PCSHealthMonitorReport.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/PCSHealthMonitorReport.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/PCSHealthMonitorReport.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/PCSHealthMonitorReport.java Sat Feb 12 19:10:46 2011
@@ -0,0 +1,252 @@
+/**
+ * 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.pcs.health;
+
+//OODT imports
+import org.apache.oodt.commons.date.DateUtils;
+import org.apache.oodt.pcs.tools.PCSHealthMonitor;
+import org.apache.oodt.cas.filemgr.structs.Product; //for javadoc
+import org.apache.oodt.cas.resource.system.extern.XmlRpcBatchStub; //for javadoc
+
+//JDK imports
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+/**
+ *
+ * The output generated from running the {@link PCSHealthMonitor#getReport()}
+ * method.
+ *
+ * @author mattmann
+ * @version $Revision$
+ */
+public class PCSHealthMonitorReport {
+
+ private Date generationDate;
+
+ private PCSDaemonStatus fmStatus;
+
+ private PCSDaemonStatus wmStatus;
+
+ private PCSDaemonStatus rmStatus;
+
+ private List batchStubStatus;
+
+ private List crawlerStatus;
+
+ private List latestProductsIngested;
+
+ private List jobHealthStatus;
+
+ private List crawlerHealthStatus;
+
+ /**
+ * Default Constructor.
+ *
+ */
+ public PCSHealthMonitorReport() {
+
+ }
+
+ /**
+ * Constructs a new PCSHealthMonitorReport with the given parameters.
+ *
+ * @param generationDate
+ * The {@link Date} that this report was generated.
+ * @param fmStatus
+ * The {@link PCSDaemonStatus} for the File Manager.
+ * @param wmStatus
+ * The {@link PCSDaemonStatus} for the Workflow Manager.
+ * @param rmStatus
+ * THe {@link PCSDaemonStatus} for the Resource Manager.
+ * @param batchStubStatus
+ * A {@lik List} of {@link PCSDaemonStatus}es for each
+ * {@link XmlRpcBatchStub}.
+ * @param crawlerStatus
+ * A {@link List} of {@link CrawlerStatus}es.
+ * @param latestProductsIngested
+ * A {@link List} of the top N {@link Product}s that have been
+ * ingested.
+ * @param jobHealthStatus
+ * A {@link List} of {@link JobHealthStatus}es.
+ * @param crawlerHealthStatus
+ * A {@link List} of {@link CrawlerHealth}s.
+ */
+ public PCSHealthMonitorReport(Date generationDate, PCSDaemonStatus fmStatus,
+ PCSDaemonStatus wmStatus, PCSDaemonStatus rmStatus, List batchStubStatus,
+ List crawlerStatus, List latestProductsIngested, List jobHealthStatus,
+ List crawlerHealthStatus) {
+ super();
+ this.generationDate = generationDate;
+ this.fmStatus = fmStatus;
+ this.wmStatus = wmStatus;
+ this.rmStatus = rmStatus;
+ this.batchStubStatus = batchStubStatus;
+ this.crawlerStatus = crawlerStatus;
+ this.latestProductsIngested = latestProductsIngested;
+ this.jobHealthStatus = jobHealthStatus;
+ this.crawlerHealthStatus = crawlerHealthStatus;
+ }
+
+ /**
+ * @return the batchStubStatus
+ */
+ public List getBatchStubStatus() {
+ return batchStubStatus;
+ }
+
+ /**
+ * @param batchStubStatus
+ * the batchStubStatus to set
+ */
+ public void setBatchStubStatus(List batchStubStatus) {
+ this.batchStubStatus = batchStubStatus;
+ }
+
+ /**
+ * @return the crawlerHealthStatus
+ */
+ public List getCrawlerHealthStatus() {
+ return crawlerHealthStatus;
+ }
+
+ /**
+ * @param crawlerHealthStatus
+ * the crawlerHealthStatus to set
+ */
+ public void setCrawlerHealthStatus(List crawlerHealthStatus) {
+ this.crawlerHealthStatus = crawlerHealthStatus;
+ }
+
+ /**
+ * @return the crawlerStatus
+ */
+ public List getCrawlerStatus() {
+ return crawlerStatus;
+ }
+
+ /**
+ * @param crawlerStatus
+ * the crawlerStatus to set
+ */
+ public void setCrawlerStatus(List crawlerStatus) {
+ this.crawlerStatus = crawlerStatus;
+ }
+
+ /**
+ * @return the fmStatus
+ */
+ public PCSDaemonStatus getFmStatus() {
+ return fmStatus;
+ }
+
+ /**
+ * @param fmStatus
+ * the fmStatus to set
+ */
+ public void setFmStatus(PCSDaemonStatus fmStatus) {
+ this.fmStatus = fmStatus;
+ }
+
+ /**
+ * @return the generationDate
+ */
+ public Date getGenerationDate() {
+ return generationDate;
+ }
+
+ /**
+ * @param generationDate
+ * the generationDate to set
+ */
+ public void setGenerationDate(Date generationDate) {
+ this.generationDate = generationDate;
+ }
+
+ /**
+ * @return the jobHealthStatus
+ */
+ public List getJobHealthStatus() {
+ return jobHealthStatus;
+ }
+
+ /**
+ * @param jobHealthStatus
+ * the jobHealthStatus to set
+ */
+ public void setJobHealthStatus(List jobHealthStatus) {
+ this.jobHealthStatus = jobHealthStatus;
+ }
+
+ /**
+ * @return the latestProductsIngested
+ */
+ public List getLatestProductsIngested() {
+ return latestProductsIngested;
+ }
+
+ /**
+ * @param latestProductsIngested
+ * the latestProductsIngested to set
+ */
+ public void setLatestProductsIngested(List latestProductsIngested) {
+ this.latestProductsIngested = latestProductsIngested;
+ }
+
+ /**
+ * @return the rmStatus
+ */
+ public PCSDaemonStatus getRmStatus() {
+ return rmStatus;
+ }
+
+ /**
+ * @param rmStatus
+ * the rmStatus to set
+ */
+ public void setRmStatus(PCSDaemonStatus rmStatus) {
+ this.rmStatus = rmStatus;
+ }
+
+ /**
+ * @return the wmStatus
+ */
+ public PCSDaemonStatus getWmStatus() {
+ return wmStatus;
+ }
+
+ /**
+ * @param wmStatus
+ * the wmStatus to set
+ */
+ public void setWmStatus(PCSDaemonStatus wmStatus) {
+ this.wmStatus = wmStatus;
+ }
+
+ /**
+ *
+ * @return This report's {@link #generationDate} in ISO 8601 String format.
+ */
+ public String getCreateDateIsoFormat() {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(this.generationDate);
+ return DateUtils.toString(cal);
+ }
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/PCSHealthMonitorReport.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/WorkflowStatesFile.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/WorkflowStatesFile.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/WorkflowStatesFile.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/WorkflowStatesFile.java Sat Feb 12 19:10:46 2011
@@ -0,0 +1,69 @@
+/**
+ * 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.pcs.health;
+
+//OODT imports
+import org.apache.oodt.pcs.input.PGEConfigurationFile;
+import org.apache.oodt.pcs.input.PGEGroup;
+import org.apache.oodt.pcs.input.PGEConfigFileReader;
+
+//JDK imports
+import java.io.FileInputStream;
+import java.util.List;
+
+/**
+ *
+ * A file that manages the {@link Workflow} states that the
+ * {@link PCSHealthMonitor} tool will look up when obtaining status in the PCS.
+ *
+ * @author mattmann
+ * @version $Revision$
+ */
+public class WorkflowStatesFile implements WorkflowStatesMetKeys {
+
+ private PGEConfigurationFile file;
+
+ /**
+ * Constructs a new WorkflowStatesFile with the specified parameters.
+ *
+ * @param filePath
+ * The {@link File} path to the WorkflowStatesFile.
+ *
+ * @throws InstantiationException
+ * If there is any error reading and parsing the WorkflowStates
+ * file.
+ */
+ public WorkflowStatesFile(String filePath) throws InstantiationException {
+ try {
+ this.file = new PGEConfigFileReader().read(new FileInputStream(filePath));
+ } catch (Exception e) {
+ throw new InstantiationException(e.getMessage());
+ }
+ }
+
+ /**
+ *
+ * @return The {@link List} of String Workflow States defined in the Workflow
+ * States file.
+ */
+ public List getStates() {
+ return ((PGEGroup) this.file.getPgeSpecificGroups().get(
+ WORKFLOW_STATES_GROUP)).getVector(WORKFLOW_STATES_VECTOR).getElements();
+ }
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/WorkflowStatesFile.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/WorkflowStatesMetKeys.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/WorkflowStatesMetKeys.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/WorkflowStatesMetKeys.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/WorkflowStatesMetKeys.java Sat Feb 12 19:10:46 2011
@@ -0,0 +1,33 @@
+/**
+ * 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.pcs.health;
+
+/**
+ *
+ * Met keys for the {@link WorkflowStatesFile}
+ *
+ * @author mattmann
+ * @version $Revision$
+ */
+public interface WorkflowStatesMetKeys {
+
+ public static final String WORKFLOW_STATES_GROUP = "WorkflowStatesGroup";
+
+ public static final String WORKFLOW_STATES_VECTOR = "States";
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/health/WorkflowStatesMetKeys.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/listing/ListingConf.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/listing/ListingConf.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/listing/ListingConf.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/listing/ListingConf.java Sat Feb 12 19:10:46 2011
@@ -0,0 +1,133 @@
+/**
+ * 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.pcs.listing;
+
+//JDK imports
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.util.Collections;
+import java.util.List;
+
+//OODT imports
+import org.apache.oodt.pcs.input.PGEConfigFileException;
+import org.apache.oodt.pcs.input.PGEConfigFileReader;
+import org.apache.oodt.pcs.input.PGEConfigurationFile;
+import org.apache.oodt.pcs.tools.PCSLongLister; //for javadoc
+import static org.apache.oodt.pcs.listing.ListingConfKeys.*;
+
+/**
+ *
+ * The configuration for the {@link PCSLongLister}.
+ *
+ * @author mattmann
+ * @version $Revision$
+ *
+ */
+public class ListingConf {
+
+ private PGEConfigurationFile conf;
+
+ /**
+ * Constructs a new ListingConf with the given {@link File}.
+ *
+ * @param file
+ * The configuration file.
+ * @throws FileNotFoundException
+ * If the config file cannot be found.
+ * @throws InstantiationException
+ * If there is some error reading the config file.
+ */
+ public ListingConf(File file) throws FileNotFoundException,
+ InstantiationException {
+ try {
+ this.conf = new PGEConfigFileReader().read(new FileInputStream(file));
+ } catch (FileNotFoundException e) {
+ throw e;
+ } catch (PGEConfigFileException e) {
+ throw new InstantiationException(e.getMessage());
+ } finally {
+ if (this.conf == null)
+ throw new InstantiationException("Configuration is null!");
+ }
+ }
+
+ /**
+ * Returns the set of excluded product types.
+ *
+ * @return The set of excluded product types.
+ */
+ public List<String> getExcludedTypes() {
+ if (this.conf.getPgeSpecificGroups().get(EXCLUDED_PRODUCT_TYPE_GROUP) == null) {
+ return Collections.EMPTY_LIST;
+ }
+
+ return (List<String>) (List<?>) this.conf.getPgeSpecificGroups().get(
+ EXCLUDED_PRODUCT_TYPE_GROUP).getVector(EXCLUDED_VECTOR).getElements();
+
+ }
+
+ /**
+ * Gets the set of Header column met key names for the long lister.
+ *
+ * @return The set of Header column met key names for the long lister.
+ */
+ public List<String> getHeaderColKeys() {
+ if (this.conf.getPgeSpecificGroups().get(MET_FIELD_COLS_GROUP) == null) {
+ return Collections.EMPTY_LIST;
+ }
+
+ return (List<String>) (List<?>) this.conf.getPgeSpecificGroups().get(
+ MET_FIELD_COLS_GROUP).getVector(MET_FIELDS_ORDER_VECTOR).getElements();
+ }
+
+ /**
+ * Returns the display name for a particular header col key.
+ *
+ * @param headerColKey
+ * The header col met key to look up the display name for.
+ * @return The header col met key's display name.
+ */
+ public String getHeaderColDisplayName(String headerColKey) {
+ if (this.conf.getPgeSpecificGroups().get(MET_FIELD_COLS_GROUP) == null) {
+ return "";
+ }
+
+ return this.conf.getPgeSpecificGroups().get(MET_FIELD_COLS_GROUP)
+ .getScalar(headerColKey).getValue();
+ }
+
+ /**
+ * Tester method to determine if an output field is a collection field, and
+ * needs special handling.
+ *
+ * @param colName
+ * The field name to check.
+ * @return True if it's a collection field, false if not, or if the collection
+ * fields group doesn't exist in the conf.
+ */
+ public boolean isCollectionField(String colName) {
+ if (this.conf.getPgeSpecificGroups().get(COLLECTION_FIELDS_GROUP) == null) {
+ return false;
+ }
+
+ return this.conf.getPgeSpecificGroups().get(COLLECTION_FIELDS_GROUP)
+ .getVector(COLLECTION_FIELDS_NAMES).getElements().contains(colName);
+ }
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/listing/ListingConf.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/listing/ListingConfKeys.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/listing/ListingConfKeys.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/listing/ListingConfKeys.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/listing/ListingConfKeys.java Sat Feb 12 19:10:46 2011
@@ -0,0 +1,42 @@
+/**
+ * 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.pcs.listing;
+
+/**
+ *
+ * Met keys required to read the {@link ListingConf}.
+ *
+ * @author mattmann
+ * @version $Revision$
+ *
+ */
+public interface ListingConfKeys {
+
+ public static final String MET_FIELD_COLS_GROUP = "MetFieldColumns";
+
+ public static final String MET_FIELDS_ORDER_VECTOR = "OrderedMetKeys";
+
+ public static final String COLLECTION_FIELDS_GROUP = "CollectionFields";
+
+ public static final String COLLECTION_FIELDS_NAMES = "FieldNames";
+
+ public static final String EXCLUDED_PRODUCT_TYPE_GROUP = "ExcludedProductTypeList";
+
+ public static final String EXCLUDED_VECTOR = "ProductTypes";
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/listing/ListingConfKeys.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/metadata/PCSConfigMetadata.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/metadata/PCSConfigMetadata.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/metadata/PCSConfigMetadata.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/metadata/PCSConfigMetadata.java Sat Feb 12 19:10:46 2011
@@ -0,0 +1,79 @@
+/**
+ * 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.pcs.metadata;
+
+/**
+ *
+ * A set of Met Keys for the Task Metadata required by the PCS.
+ *
+ * @author mattmann
+ * @version $Revision$
+ */
+public interface PCSConfigMetadata {
+
+ public static final String PGE_TASK_TYPE = "PCS_PGETaskType";
+
+ public static final String NUM_JAVA_EXT_DIRS = "PCS_NumJavaExtDirs";
+
+ // use this key like: JAVA_EXT_DIR+"1", or JAVA_EXT_DIR+"2"
+ public static final String JAVA_EXT_DIR = "PCS_JavaExtDir";
+
+ public static final String JAVA_MAIN_CLASS = "PCS_JavaMainClass";
+
+ public static final String FILE_MANAGER_URL = "PCS_FileManagerUrl";
+
+ public static final String SCF_FILE_MANAGER_URL = "SCF_FileManagerUrl";
+
+ public static final String WORKFLOW_MANAGER_URL = "PCS_WorkflowManagerUrl";
+
+ public static final String PGE_CONFIG_FILE_PROPERTY_ADDER_CLASS = "PCS_PGEConfigPropertyAdderClass";
+
+ public static final String CLIENT_TRANSFER_SERVICE_FACTORY = "PCS_ClientTransferServiceFactory";
+
+ public static final String CRAWLER_CLEANUP = "PCS_CrawlerCleanup";
+
+ public static final String CRAWLER_CRAWLDIRS = "PCS_CrawlerCrawlForDirs";
+
+ public static final String CONFIG_FILE_SCHEMA_PATH = "PCS_ConfigFileSchemaPath";
+
+ public static final String PGE_CONFIG_FILE_NAME = "PCS_PGEConfigFileName";
+
+ public static final String PGE_LOG_FILE_NAME = "PCS_PGELogFileName";
+
+ public static final String PGE_TYPE_GDS_ADAPTOR = "GDSAdaptor";
+
+ public static final String PGE_TYPE_GDS_PGE = "GDSPge";
+
+ public static final String UNKNOWN = "UNKNOWN";
+
+ public static final String WORKFLOW_MGR_URL = "WorkflowManagerUrl";
+
+ public static final String WORKFLOW_INST_ID = "WorkflowInstId";
+
+ public static final String MAX_ALLOWABLE_GAP_MINUTES = "PCS_MaxAllowableTimeGapMinutes";
+
+ /* PGE task statuses */
+ public static final String STAGING_INPUT = "STAGING INPUT";
+
+ public static final String CONF_FILE_BUILD = "BUILDING CONFIG FILE";
+
+ public static final String RUNNING_PGE = "PGE EXEC";
+
+ public static final String CRAWLING = "CRAWLING";
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/metadata/PCSConfigMetadata.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/metadata/PCSMetadata.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/metadata/PCSMetadata.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/metadata/PCSMetadata.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/metadata/PCSMetadata.java Sat Feb 12 19:10:46 2011
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.pcs.metadata;
+
+/**
+ *
+ * A Collection of Metadata field names for PCS.
+ *
+ */
+public interface PCSMetadata {
+
+ /* Met Fields */
+ public static final String APPLICATION_SUCCESS_FLAG = "ApplicationSuccessFlag";
+
+ public static final String ON_DISK = "OnDisk";
+
+ public static final String TAPE_LOCATION = "TapeLocation";
+
+ public static final String PRODUCTION_LOCATION = "ProductionLocation";
+
+ public static final String PRODUCTION_LOCATION_CODE = "ProductionLocationCode";
+
+ public static final String DATA_VERSION = "DataVersion";
+
+ public static final String DATA_PROVIDER = "DataProvider";
+
+ public static final String COLLECTION_LABEL = "CollectionLabel";
+
+ public static final String COMMENTS = "Comments";
+
+ public static final String EXECUTABLE_PATHNAMES = "ExecutablePathnames";
+
+ public static final String EXECUTABLE_VERSIONS = "ExecutableVersions";
+
+ public static final String PROCESSING_LEVEL = "ProcessingLevel";
+
+ public static final String JOB_ID = "JobId";
+
+ public static final String TASK_ID = "TaskId";
+
+ public static final String PRODUCTION_DATE_TIME = "ProductionDateTime";
+
+ public static final String INPUT_FILES = "InputFiles";
+
+ public static final String PGE_NAME = "PGEName";
+
+ public static final String OUTPUT_FILES = "OutputFiles";
+
+ public static final String TEST_TAG = "TestTag";
+
+ public static final String SUB_TEST_TAG = "SubTestTag";
+
+ public static final String TEST_LOCATION = "TestLocation";
+
+ public static final String TEST_COUNTER = "TestCounter";
+
+ public static final String TEST_DATE = "TestDate";
+
+ public static final String START_DATE_TIME = "StartDateTime";
+
+ public static final String END_DATE_TIME = "EndDateTime";
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/metadata/PCSMetadata.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/Pedigree.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/Pedigree.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/Pedigree.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/Pedigree.java Sat Feb 12 19:10:46 2011
@@ -0,0 +1,224 @@
+/**
+ * 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.pcs.pedigree;
+
+//OODT imports
+import org.apache.oodt.pcs.metadata.PCSMetadata;
+import org.apache.oodt.pcs.metadata.PCSConfigMetadata;
+import org.apache.oodt.pcs.query.FilenameQuery;
+import org.apache.oodt.pcs.query.InputFilesQuery;
+import org.apache.oodt.pcs.query.JobIdQuery;
+import org.apache.oodt.pcs.util.FileManagerUtils;
+import org.apache.oodt.cas.filemgr.structs.Product;
+import org.apache.oodt.cas.metadata.Metadata;
+
+//JDK imports
+import java.util.Iterator;
+import java.util.List;
+import java.util.Stack;
+import java.util.Vector;
+
+/**
+ *
+ * A class to provide pedigre tracking for PCS {@link Product}s.
+ *
+ * @author mattmann
+ * @version $Revision$
+ */
+public class Pedigree implements PCSMetadata, PCSConfigMetadata {
+
+ /* our file manager interface */
+ private FileManagerUtils fm;
+
+ /* should we include not cataloged products in the pedigree? */
+ private boolean listNotCataloged = false;
+
+ /* are there any product types that we should exclude from the pedigree? */
+ private List prodTypeExcludeList;
+
+ /**
+ *
+ * Constructs a new Pedigree object that will connect to the file manager at
+ * the given {@link URL} specified by the <code>fmUrlStr</code> string
+ * parameter.
+ *
+ * @param fmUrlStr
+ * The String {@link URL} of the file manager to connect to.
+ * @param listNotCat
+ * Whether or not we should include non-cataloged products in the
+ * pedigree.
+ * @param excludeList
+ * A {@link List} of String {@link ProductType} names that should be
+ * excluded from the Pedigree.
+ */
+ public Pedigree(String fmUrlStr, boolean listNotCat, List excludeList) {
+ this(new FileManagerUtils(FileManagerUtils.safeGetUrlFromString(fmUrlStr)),
+ listNotCat, excludeList);
+
+ }
+
+ /**
+ *
+ * Constructs a new Pedigree object that will connect to the file manager
+ * specified by the {@link FileManagerUtils} object passed in.
+ *
+ * @param fm
+ * The PCS interface to the File Manager.
+ * @param listNotCat
+ * Whether or not we should include non-cataloged products in the
+ * pedigree.
+ * @param excludeList
+ * A {@link List} of String {@link ProductType} names that should be
+ * excluded from the Pedigree.
+ */
+ public Pedigree(FileManagerUtils fm, boolean listNotCat, List excludeList) {
+ this.fm = fm;
+ this.listNotCataloged = listNotCat;
+ this.prodTypeExcludeList = excludeList;
+ }
+
+ /**
+ * Performs a full pedigree of the specified {@link Product} <code>orig</code>
+ * . If <code>upstream</code> is set to true, an upstream pedigree is
+ * performed, otherwise, a downstream pedigree is performed.
+ *
+ * @param orig
+ * The {@link Product} to perform a pedigree of.
+ * @param upstream
+ * Whether or not we should do an upstream (true) or downstream
+ * (false) pedigree.
+ * @return A {@link PedigreeTree} containing the Pedigree of a given product.
+ */
+ public PedigreeTree doPedigree(Product orig, boolean upstream) {
+ List pedProds = null;
+ PedigreeTreeNode origRoot = PedigreeTreeNode
+ .getPedigreeTreeNodeFromProduct(orig, null);
+
+ // System.out.println("Doing pedigree: upstream: ["+upstream+"]");
+ Stack roots = new Stack();
+ roots.add(origRoot);
+
+ do {
+
+ PedigreeTreeNode currRoot = (PedigreeTreeNode) roots.pop();
+ /*
+ * System.out.println("Examining root: ["+currRoot.getNodeProduct().
+ * getProductName()+"]");
+ */
+
+ if (upstream) {
+ pedProds = getUpstreamPedigreedProducts(currRoot.getNodeProduct());
+ } else {
+ pedProds = getDownstreamPedigreedProducts(currRoot.getNodeProduct());
+ }
+
+ if (pedProds != null && pedProds.size() > 0) {
+ for (Iterator i = pedProds.iterator(); i.hasNext();) {
+ Product p = (Product) i.next();
+ if (p.getProductName().equals(
+ currRoot.getNodeProduct().getProductName())) {
+ // don't allow for the same pedigreed product to be
+ // added to the list
+ continue;
+ }
+ PedigreeTreeNode prodNode = PedigreeTreeNode
+ .getPedigreeTreeNodeFromProduct(p, currRoot);
+ roots.add(prodNode);
+ }
+ } else {
+ // System.out.println("Pedigree products is null or size 0");
+ }
+
+ } while (!roots.empty());
+
+ return new PedigreeTree(origRoot);
+ }
+
+ /**
+ * Returns the most direct ancestors (a {@link List} of {@link Product}s)
+ * upstream from the given {@link Product} named <code>orig</code>.
+ *
+ * @param orig
+ * The {@link Product} to get direct upstream relatives of.
+ * @return A {@link List} of {@link Product}s directly upstream from the given
+ * {@link Product}.
+ */
+ public List getUpstreamPedigreedProducts(Product orig) {
+ if (orig.getProductType().getName().equals(UNKNOWN)) {
+ return new Vector();
+ }
+ Metadata pMet = fm.safeGetMetadata(orig);
+ return getProducts(pMet.getAllMetadata(INPUT_FILES));
+
+ }
+
+ /**
+ * Returns the most direct ancestors (a {@link List} of {@link Product}s)
+ * downstream from the given {@link Product} named <code>orig</code>.
+ *
+ * @param orig
+ * The {@link Product} to get direct downstream relatives of.
+ * @return A {@link List} of {@link Product}s directly downstream from the
+ * given {@link Product}.
+ */
+ public List getDownstreamPedigreedProducts(Product orig) {
+ return fm.queryAllTypes(new InputFilesQuery(orig.getProductName(), fm)
+ .buildQuery(), this.prodTypeExcludeList);
+ }
+
+ /**
+ * Gets all associated {@link Product}s with the provided
+ * {@link WorkflowInstance} identified by its ID (the <code>wInstId</code>
+ * string parameter).
+ *
+ * @param wInstId
+ * The ID of the {@link WorkflowInstance} to look up the
+ * {@link Product}s for.
+ * @return A {@link List} of {@link Product}s associated with the provided
+ * Workflow Instance ID.
+ */
+ public List getWorkflowInstProds(String wInstId) {
+ return fm.queryAllTypes(new JobIdQuery(wInstId, fm).buildQuery(),
+ this.prodTypeExcludeList);
+ }
+
+ private List getProducts(List prodNames) {
+ if (prodNames == null || (prodNames != null && prodNames.size() == 0)) {
+ return new Vector();
+ }
+
+ List prods = new Vector(prodNames.size());
+
+ for (Iterator i = prodNames.iterator(); i.hasNext();) {
+ String prodName = (String) i.next();
+ List prodList = fm.queryAllTypes(new FilenameQuery(prodName, fm)
+ .buildQuery(), this.prodTypeExcludeList);
+ if (prodList != null && prodList.size() > 0) {
+ prods.add((Product) prodList.get(0));
+ } else {
+ if (this.listNotCataloged) {
+ // create a new product and add it
+ prods.add(Product.getDefaultFlatProduct(prodName, UNKNOWN));
+ }
+ }
+ }
+
+ return prods;
+ }
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/Pedigree.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTree.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTree.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTree.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTree.java Sat Feb 12 19:10:46 2011
@@ -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.pcs.pedigree;
+
+/**
+ *
+ * A data structure representing an upstream and downstream
+ * pedigree for a particular {@link Product}. That is: what files
+ * went into producing this {@link Product}, and in what files
+ * was this {@link Product} included?
+ *
+ * @author mattmann
+ * @version $Revision$
+ *
+ */
+public class PedigreeTree {
+
+ private PedigreeTreeNode root;
+
+ public PedigreeTree(PedigreeTreeNode root) {
+ this.root = root;
+ }
+
+ public int getNumLevels() {
+ if (root != null) {
+ return traverse(root, 0) + 1;
+ } else
+ return 0;
+ }
+
+ public PedigreeTreeNode getRoot() {
+ return root;
+ }
+
+ public void setRoot(PedigreeTreeNode root) {
+ this.root = root;
+ }
+
+ /**
+ * Tree:
+ * -------->[N3]
+ * ---->[N2]
+ * -------->[N5]
+ * [N1]---
+ * ---->[N4]
+ *
+ *
+ *
+ * @param node
+ * @param level
+ * @return
+ */
+ private int traverse(PedigreeTreeNode node, int level) {
+ int maxLevel = level;
+ if (node.getNumChildren() > 0) {
+ for (int i = 0; i < node.getNumChildren(); i++) {
+ int lvl = traverse(node.getChildAt(i), level + 1);
+ if (lvl > maxLevel) {
+ maxLevel = lvl;
+ }
+ }
+ }
+
+ return maxLevel;
+ }
+
+ public void traverseAndPrint(PedigreeTreeNode node, int level) {
+ System.out.println(getTabStr(level)
+ + node.getNodeProduct().getProductName());
+ if (node.getNumChildren() > 0) {
+ for (int i = 0; i < node.getNumChildren(); i++) {
+ traverseAndPrint(node.getChildAt(i), level + 1);
+
+ }
+ }
+ }
+
+ private String getTabStr(int num) {
+ StringBuffer tabStrBuf = new StringBuffer();
+ for (int i = 0; i < num; i++) {
+ tabStrBuf.append("\t");
+ }
+
+ return tabStrBuf.toString();
+ }
+
+ public void printPedigreeTree() {
+ PedigreeTreeNode root = getRoot();
+ traverseAndPrint(root, 0);
+ }
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTree.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTreeNode.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTreeNode.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTreeNode.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTreeNode.java Sat Feb 12 19:10:46 2011
@@ -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.pcs.pedigree;
+
+//OODT imports
+import org.apache.oodt.cas.filemgr.structs.Product;
+
+//JDK imports
+import java.util.List;
+import java.util.Vector;
+
+/**
+ *
+ * A node in the {@link PedigreeTree}.
+ *
+ * @author mattmann
+ * @version $Revision$
+ */
+public class PedigreeTreeNode {
+
+ private Product prod;
+
+ private List children;
+
+ private PedigreeTreeNode parent;
+
+ public PedigreeTreeNode(PedigreeTreeNode parent) {
+ this(parent, null);
+ }
+
+ public PedigreeTreeNode(PedigreeTreeNode parent, Product prod) {
+ this(parent, new Vector(), prod);
+ }
+
+ public PedigreeTreeNode(PedigreeTreeNode parent, List children, Product prod) {
+ this.parent = parent;
+ if (this.parent != null) {
+ this.parent.addChild(this);
+ }
+ this.children = children;
+ this.prod = prod;
+ }
+
+ public void setParent(PedigreeTreeNode parent) {
+ this.parent = parent;
+ }
+
+ public void addChild(PedigreeTreeNode child) {
+ this.children.add(child);
+ }
+
+ public int getNumChildren() {
+ if (this.children == null)
+ return 0;
+ return this.children.size();
+ }
+
+ public PedigreeTreeNode getChildAt(int idx) {
+ return (PedigreeTreeNode) this.children.get(idx);
+ }
+
+ public Product getNodeProduct() {
+ return this.prod;
+ }
+
+ public void setNodeProduct(Product prod) {
+ this.prod = prod;
+ }
+
+ public static PedigreeTreeNode getPedigreeTreeNodeFromProduct(Product p,
+ PedigreeTreeNode parent) {
+ PedigreeTreeNode node = new PedigreeTreeNode(parent);
+ node.setNodeProduct(p);
+ return node;
+ }
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTreeNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/query/AbstractPCSQuery.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/query/AbstractPCSQuery.java?rev=1070132&view=auto
==============================================================================
--- oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/query/AbstractPCSQuery.java (added)
+++ oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/query/AbstractPCSQuery.java Sat Feb 12 19:10:46 2011
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.pcs.query;
+
+//OODT imports
+import org.apache.oodt.pcs.util.FileManagerUtils;
+import org.apache.oodt.cas.filemgr.structs.Element;
+
+/**
+ * Abstract functionality for PCS queries.
+ *
+ * @author mattmann
+ * @version $Revision$
+ */
+public abstract class AbstractPCSQuery implements PCSQuery {
+
+ /* interface to the file manager so we can look up elem defs */
+ protected FileManagerUtils fm = null;
+
+ /**
+ * Constructs a new AbstractOCOQuery using the given {@link FileManagerUtils}
+ * file manager interface.
+ *
+ * @param fm
+ * The interface to the File Manager.
+ */
+ protected AbstractPCSQuery(FileManagerUtils fm) {
+ this.fm = fm;
+ }
+
+ /**
+ * Wrapper method around {@link #fm.safeGetElementByName}.
+ *
+ * @param elemName
+ * The name of the metadata element to obtain the ID for.
+ * @return The String ID of the given <code>elemName</code>.
+ */
+ protected String getElemId(String elemName) {
+ Element elem = fm.safeGetElementByName(elemName);
+ if (elem == null)
+ return null;
+
+ return elem.getElementId();
+ }
+
+}
Propchange: oodt/trunk/pcs/core/src/main/java/org/apache/oodt/pcs/query/AbstractPCSQuery.java
------------------------------------------------------------------------------
svn:eol-style = native