You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by sm...@apache.org on 2010/06/09 21:11:27 UTC
svn commit: r953117 [2/7] - in /incubator/oodt/trunk:
pge/src/main/java/gov/nasa/jpl/oodt/cas/pge/
pge/src/main/java/gov/nasa/jpl/oodt/cas/pge/config/
pge/src/main/java/gov/nasa/jpl/oodt/cas/pge/metadata/
pge/src/main/java/gov/nasa/jpl/oodt/cas/pge/que...
Modified: incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/metadata/OFSNXMLConfigMetKeys.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/metadata/OFSNXMLConfigMetKeys.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/metadata/OFSNXMLConfigMetKeys.java (original)
+++ incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/metadata/OFSNXMLConfigMetKeys.java Wed Jun 9 19:11:21 2010
@@ -1,7 +1,20 @@
-//Copyright (c) 2009, California Institute of Technology.
-//ALL RIGHTS RESERVED. U.S. Government sponsorship acknowledged.
-//
-//$Id$
+/*
+ * 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 gov.nasa.jpl.oodt.product.handlers.ofsn.metadata;
Modified: incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/metadata/OFSNXMLMetKeys.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/metadata/OFSNXMLMetKeys.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/metadata/OFSNXMLMetKeys.java (original)
+++ incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/metadata/OFSNXMLMetKeys.java Wed Jun 9 19:11:21 2010
@@ -1,7 +1,20 @@
-//Copyright (c) 2008, California Institute of Technology.
-//ALL RIGHTS RESERVED. U.S. Government sponsorship acknowledged.
-//
-//$Id$
+/*
+ * 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 gov.nasa.jpl.oodt.product.handlers.ofsn.metadata;
Modified: incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/metadata/OODTMetKeys.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/metadata/OODTMetKeys.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/metadata/OODTMetKeys.java (original)
+++ incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/metadata/OODTMetKeys.java Wed Jun 9 19:11:21 2010
@@ -1,7 +1,20 @@
-//Copyright (c) 2008, California Institute of Technology.
-//ALL RIGHTS RESERVED. U.S. Government sponsorship acknowledged.
-//
-//$Id$
+/*
+ * 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 gov.nasa.jpl.oodt.product.handlers.ofsn.metadata;
Modified: incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/metadata/XMLQueryMetKeys.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/metadata/XMLQueryMetKeys.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/metadata/XMLQueryMetKeys.java (original)
+++ incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/metadata/XMLQueryMetKeys.java Wed Jun 9 19:11:21 2010
@@ -1,7 +1,20 @@
-//Copyright (c) 2008, California Institute of Technology.
-//ALL RIGHTS RESERVED. U.S. Government sponsorship acknowledged.
-//
-//$Id$
+/*
+ * 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 gov.nasa.jpl.oodt.product.handlers.ofsn.metadata;
Modified: incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/util/OFSNObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/util/OFSNObjectFactory.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/util/OFSNObjectFactory.java (original)
+++ incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/util/OFSNObjectFactory.java Wed Jun 9 19:11:21 2010
@@ -1,7 +1,20 @@
-//Copyright (c) 2009, California Institute of Technology.
-//ALL RIGHTS RESERVED. U.S. Government sponsorship acknowledged.
-//
-//$Id$
+/*
+ * 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 gov.nasa.jpl.oodt.product.handlers.ofsn.util;
Modified: incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/util/OFSNUtils.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/util/OFSNUtils.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/util/OFSNUtils.java (original)
+++ incubator/oodt/trunk/product/src/main/java/gov/nasa/jpl/oodt/product/handlers/ofsn/util/OFSNUtils.java Wed Jun 9 19:11:21 2010
@@ -1,7 +1,20 @@
-//Copyright (c) 2008, California Institute of Technology.
-//ALL RIGHTS RESERVED. U.S. Government sponsorship acknowledged.
-//
-//$Id$
+/*
+ * 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 gov.nasa.jpl.oodt.product.handlers.ofsn.util;
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/HTTPAdaptor.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/HTTPAdaptor.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/HTTPAdaptor.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/HTTPAdaptor.java Wed Jun 9 19:11:21 2010
@@ -1,7 +1,20 @@
-// Copyright 2002 California Institute of Technology. ALL RIGHTS RESERVED.
-// U.S. Government Sponsorship acknowledged.
-//
-// $Id: HTTPAdaptor.java,v 1.3 2007-06-09 15:50:50 kelly Exp $
+/*
+ * 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 jpl.eda.product;
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/HTTPFormRecorder.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/HTTPFormRecorder.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/HTTPFormRecorder.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/HTTPFormRecorder.java Wed Jun 9 19:11:21 2010
@@ -1,103 +1,116 @@
-// Copyright 2002 California Institute of Technology. ALL RIGHTS RESERVED.
-// U.S. Government Sponsorship acknowledged.
-//
-// $Id: HTTPFormRecorder.java,v 1.2 2005-10-07 16:28:13 kelly Exp $
-
-package jpl.eda.product;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.util.Date;
-import java.util.Vector;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import jpl.eda.xmlquery.XMLQuery;
-
-/**
- * Statistics recorder to an HTTP form-data acceptor.
- *
- * @author Kelly
- * @version $Revision: 1.2 $
- */
-class HTTPFormRecorder implements Recorder {
- /**
- * Creates a new <code>HTTPFormRecorder</code> instance.
- *
- * @param servletConfig a <code>ServletConfig</code> value.
- * @throws ServletException if an error occurs.
- */
- public HTTPFormRecorder(ServletConfig servletConfig) throws ServletException {
- try {
- String urlStr = servletConfig.getInitParameter("recorder.url");
- url = new URL(urlStr == null? "http://oodt.jpl.nasa.gov/data-stats/recorder" : urlStr);
-
- groupID = servletConfig.getInitParameter("recorder.id");
- if (groupID == null)
- groupID = "oodt";
- } catch (MalformedURLException ex) {
- throw new ServletException(ex);
- }
- }
-
- public void record(final Transaction transaction) {
- Thread t = new Thread() {
- public void run() {
- HttpURLConnection connection = null;
- try {
- String kwdQuery = transaction.getQuery().getKwdQueryString();
- StringBuffer req = new StringBuffer("groupID=").append(URLEncoder.encode(groupID, "UTF-8"))
- .append("&serverID=").append(URLEncoder.encode(transaction.getServerID(), "UTF-8"))
- .append("&keywordQuery=").append(URLEncoder.encode(kwdQuery, "UTF-8"))
- .append("&startTime=").append(transaction.getStartTime().getTime())
- .append("&numMatches=").append(transaction.getNumMatches())
- .append("&numBytes=").append(transaction.getNumBytes())
- .append("&ttc=").append(transaction.getTimeToComplete());
-
- connection = (HttpURLConnection) url.openConnection();
- connection.setDoInput(true);
- connection.setDoOutput(true);
- connection.setRequestProperty("Content-length", String.valueOf(req.length()));
- connection.setRequestMethod("POST");
-
- connection.connect();
- OutputStream out = connection.getOutputStream();
- out.write(req.toString().getBytes());
- out.close();
-
- int rc = connection.getResponseCode();
- if (rc != HttpURLConnection.HTTP_OK)
- throw new IOException("HTTP server response code " + rc);
- } catch (IOException ex) {
- throw new IllegalStateException("Unexpected IOException: " + ex.getMessage());
- } finally {
- if (connection != null)
- connection.disconnect();
- }
- }
- };
- try {
- t.start();
- t.join(MAX_TIME);
- if (t.isAlive()) t.interrupt();
- } catch (InterruptedException ex) {
- if (t.isAlive()) t.interrupt();
- }
- }
-
- public String toString() {
- return "HTTPFormRecorder[url=" + url + ",groupID=" + groupID + "]";
- }
-
- /** URL to which to send statistics. */
- protected URL url;
-
- /** Group ID under which to log statistics. */
- protected String groupID;
-
- /** How long to try to record a transaction before giving up, in milliseconds. */
- private static final long MAX_TIME = Long.getLong("jpl.eda.product.HTTPFormRecorder.maxTime", 500).longValue();
-}
+/*
+ * 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 jpl.eda.product;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.Date;
+import java.util.Vector;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import jpl.eda.xmlquery.XMLQuery;
+
+/**
+ * Statistics recorder to an HTTP form-data acceptor.
+ *
+ * @author Kelly
+ * @version $Revision: 1.2 $
+ */
+class HTTPFormRecorder implements Recorder {
+ /**
+ * Creates a new <code>HTTPFormRecorder</code> instance.
+ *
+ * @param servletConfig a <code>ServletConfig</code> value.
+ * @throws ServletException if an error occurs.
+ */
+ public HTTPFormRecorder(ServletConfig servletConfig) throws ServletException {
+ try {
+ String urlStr = servletConfig.getInitParameter("recorder.url");
+ url = new URL(urlStr == null? "http://oodt.jpl.nasa.gov/data-stats/recorder" : urlStr);
+
+ groupID = servletConfig.getInitParameter("recorder.id");
+ if (groupID == null)
+ groupID = "oodt";
+ } catch (MalformedURLException ex) {
+ throw new ServletException(ex);
+ }
+ }
+
+ public void record(final Transaction transaction) {
+ Thread t = new Thread() {
+ public void run() {
+ HttpURLConnection connection = null;
+ try {
+ String kwdQuery = transaction.getQuery().getKwdQueryString();
+ StringBuffer req = new StringBuffer("groupID=").append(URLEncoder.encode(groupID, "UTF-8"))
+ .append("&serverID=").append(URLEncoder.encode(transaction.getServerID(), "UTF-8"))
+ .append("&keywordQuery=").append(URLEncoder.encode(kwdQuery, "UTF-8"))
+ .append("&startTime=").append(transaction.getStartTime().getTime())
+ .append("&numMatches=").append(transaction.getNumMatches())
+ .append("&numBytes=").append(transaction.getNumBytes())
+ .append("&ttc=").append(transaction.getTimeToComplete());
+
+ connection = (HttpURLConnection) url.openConnection();
+ connection.setDoInput(true);
+ connection.setDoOutput(true);
+ connection.setRequestProperty("Content-length", String.valueOf(req.length()));
+ connection.setRequestMethod("POST");
+
+ connection.connect();
+ OutputStream out = connection.getOutputStream();
+ out.write(req.toString().getBytes());
+ out.close();
+
+ int rc = connection.getResponseCode();
+ if (rc != HttpURLConnection.HTTP_OK)
+ throw new IOException("HTTP server response code " + rc);
+ } catch (IOException ex) {
+ throw new IllegalStateException("Unexpected IOException: " + ex.getMessage());
+ } finally {
+ if (connection != null)
+ connection.disconnect();
+ }
+ }
+ };
+ try {
+ t.start();
+ t.join(MAX_TIME);
+ if (t.isAlive()) t.interrupt();
+ } catch (InterruptedException ex) {
+ if (t.isAlive()) t.interrupt();
+ }
+ }
+
+ public String toString() {
+ return "HTTPFormRecorder[url=" + url + ",groupID=" + groupID + "]";
+ }
+
+ /** URL to which to send statistics. */
+ protected URL url;
+
+ /** Group ID under which to log statistics. */
+ protected String groupID;
+
+ /** How long to try to record a transaction before giving up, in milliseconds. */
+ private static final long MAX_TIME = Long.getLong("jpl.eda.product.HTTPFormRecorder.maxTime", 500).longValue();
+}
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/LargeProductQueryHandler.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/LargeProductQueryHandler.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/LargeProductQueryHandler.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/LargeProductQueryHandler.java Wed Jun 9 19:11:21 2010
@@ -1,7 +1,20 @@
-// Copyright 2002 California Institute of Technology. ALL RIGHTS RESERVED.
-// U.S. Government Sponsorship acknowledged.
-//
-// $Id: LargeProductQueryHandler.java,v 1.1.1.1 2004-03-02 19:45:40 kelly Exp $
+/*
+ * 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 jpl.eda.product;
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductClient.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductClient.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductClient.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductClient.java Wed Jun 9 19:11:21 2010
@@ -1,7 +1,20 @@
-// Copyright 2002-2003 California Institute of Technology. ALL RIGHTS RESERVED.
-// U.S. Government Sponsorship acknowledged.
-//
-// $Id: ProductClient.java,v 1.5 2005-06-22 21:41:09 kelly Exp $
+/*
+ * 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 jpl.eda.product;
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductPermission.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductPermission.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductPermission.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductPermission.java Wed Jun 9 19:11:21 2010
@@ -1,7 +1,20 @@
-// Copyright 1999-2004 California Institute of Technology. ALL RIGHTS RESERVED.
-// U.S. Government Sponsorship acknowledged.
-//
-// $Id: ProductPermission.java,v 1.1 2004-08-13 21:27:39 kelly Exp $
+/*
+ * 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 jpl.eda.product;
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductSQLException.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductSQLException.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductSQLException.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductSQLException.java Wed Jun 9 19:11:21 2010
@@ -1,7 +1,20 @@
-// Copyright 2002 California Institute of Technology. ALL RIGHTS RESERVED.
-// U.S. Government Sponsorship acknowledged.
-//
-// $Id: ProductSQLException.java,v 1.1.1.1 2004-03-02 19:45:40 kelly Exp $
+/*
+ * 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 jpl.eda.product;
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductService.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductService.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductService.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductService.java Wed Jun 9 19:11:21 2010
@@ -1,7 +1,20 @@
-// Copyright 2002 California Institute of Technology. ALL RIGHTS RESERVED.
-// U.S. Government Sponsorship acknowledged.
-//
-// $Id: ProductService.java,v 1.1.1.1 2004-03-02 19:45:40 kelly Exp $
+/*
+ * 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 jpl.eda.product;
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductServlet.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductServlet.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductServlet.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/ProductServlet.java Wed Jun 9 19:11:21 2010
@@ -1,317 +1,330 @@
-// Copyright 1999-2003 California Institute of Technology. ALL RIGHTS RESERVED.
-// U.S. Government Sponsorship acknowledged.
-//
-// $Id: ProductServlet.java,v 1.2 2004-10-15 22:13:07 kelly Exp $
-
-package jpl.eda.product;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import jpl.eda.Configuration;
-import jpl.eda.EDAException;
-import jpl.eda.util.SAXParser;
-import jpl.eda.util.XML;
-import jpl.eda.xmlquery.Result;
-import jpl.eda.xmlquery.XMLQuery;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-
-/** Servlet that returns products in response to OODT queries.
- *
- * This servlet takes a <code>keywordQuery</code> parameter which is the DIS-style keyword
- * query string, and an <code>object</code> parameter which is the CORBA object name of
- * the object to receive the query.
- *
- * <p>It also takes the following optional parameters:
- * <ul>
- * <li><code>ns</code>: name server to use, defaulting to the system nameserver in the
- * <code>.edarc.xml</code> file.</li>
- *
- * <li><code>id</code>: product ID to return in the case of multiple products.</li>
- *
- * <li><code>mimeType</code>: desired MIME type of product. This can parameter may be
- * specified multiple times to show an in-order preference for MIME types.</li>
- * </ul>
- *
- * <p>It responds with a single product in the MIME type of the product.
- *
- * @author Kelly
- */
-public class ProductServlet extends HttpServlet {
- /** Default name server URL. */
- private static String defaultNameServerURL;
-
- /** Initialize by finding the default name server URL. */
- static {
- defaultNameServerURL = "corbaloc::localhost/" + jpl.eda.util.CORBAMgr.NS_OBJECT_KEY;
- try {
- Configuration configuration = Configuration.getConfiguration();
- configuration.mergeProperties(System.getProperties());
- defaultNameServerURL = configuration.getNameServerURL();
- } catch (RuntimeException ex) {
- throw ex;
- } catch (Exception ex) {
- System.err.println("Exception " + ex.getClass().getName() + " while reading configuration: "
- + ex.getMessage());
- }
-
- }
-
- /** Construct the product servlet.
- */
- public ProductServlet() {}
-
- public void init(ServletConfig servletConfig) throws ServletException {
- displayableTypes = new HashSet();
- try {
- SAXParser p = XML.createSAXParser();
- p.setContentHandler(new ContentHandler() {
- private StringBuffer token = new StringBuffer();
- private String pi;
- public void characters(char[] ch, int start, int length) {
- token.append(ch, start, length);
- }
- public void endDocument() {}
- public void endElement(String ns, String name, String qual) {
- displayableTypes.add(token.toString().trim());
- token.delete(0, token.length());
- }
- public void endPrefixMapping(String prefix) {}
- public void ignorableWhitespace(char[] ch, int start, int length) {}
- public void processingInstruction(String target, String data) {}
- public void setDocumentLocator(Locator locator) {}
- public void skippedEntity(String name) {}
- public void startDocument() {}
- public void startElement(String ns, String name, String qual, Attributes atts) {}
- public void startPrefixMapping(String prefix, String uri) {}
- });
- p.parse(new InputSource(getClass().getResourceAsStream("displayableTypes.xml")));
- } catch (SAXException ex) {
- throw new ServletException(ex);
- } catch (IOException ex) {
- throw new ServletException(ex);
- }
-
- try {
- jpl.eda.ExecServer.runInitializers();
- } catch (EDAException ex) {
- throw new ServletException(ex);
- }
-
- preferredNamespace = System.getProperty("jpl.eda.servlets.ProductServlet.preferredNamespace", "urn:eda:rmi:");
-
- String recorderList = servletConfig.getInitParameter("recorders");
- if (recorderList == null) recorderList = "";
- recorders = new ArrayList();
- for (Iterator i = jpl.eda.util.Utility.parseCommaList(recorderList); i.hasNext();) try {
- String recorderClassName = (String) i.next();
- Class recorderClass = Class.forName(recorderClassName);
- Constructor ctor = recorderClass.getConstructor(new Class[]{ ServletConfig.class });
- Recorder recorder = (Recorder) ctor.newInstance(new Object[]{ servletConfig });
- recorders.add(recorder);
- } catch (RuntimeException ex) {
- throw ex;
- } catch (Exception ex) {
- throw new ServletException(ex);
- }
-
- super.init(servletConfig);
- }
-
- public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
- doIt(req, res);
- }
- public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
- doIt(req, res);
- }
-
- /** Process the request for the query parameters, query, and deliver a product.
- *
- * @param req Servlet request.
- * @param res Servlet response.
- * @throws ServletException If there's something wrong with the request or response.
- * @throws IOException If there's an I/O error writing the image.
- */
- private void doIt(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
- Date startTime = new Date();
- String ns = null;
- String object = null;
- String host = req.getRemoteHost();
- try {
- object = req.getParameter("object");
- if (object == null)
- throw new IllegalArgumentException("required object parameter not specified");
- if (!object.startsWith("urn:"))
- object = preferredNamespace + object;
- String keywordQuery = req.getParameter("keywordQuery");
- if (keywordQuery == null)
- throw new IllegalArgumentException("required keywordQuery parameter not specified");
- String id = req.getParameter("id");
- String[] mimeAccept = req.getParameterValues("mimeType");
- if (mimeAccept == null) mimeAccept = new String[]{"*/*"};
- List mimeAcceptList = Arrays.asList(mimeAccept);
-
- // Construct the query from the parameters and send it in.
- XMLQuery xmlQuery = new XMLQuery(keywordQuery, "queryServlet", "Query from QueryServlet",
- "This query comes from the query servlet currently handling a client at "
- + req.getRemoteHost(), /*ddID*/null, /*resultModeID*/null, /*propType*/null, /*propLevels*/null,
- XMLQuery.DEFAULT_MAX_RESULTS, mimeAcceptList);
- ProductClient pc = new ProductClient(object);
- xmlQuery = pc.query(xmlQuery);
-
- // Get the results of the query, if any.
- List results = xmlQuery.getResults();
- boolean found;
- long resultSize = 0L;
- if (results.isEmpty()) {
- res.sendError(HttpServletResponse.SC_NOT_FOUND, "No matching results to query \"" + keywordQuery
- + "\" for object \"" + object + "\"");
- found = false;
- } else {
- // Default to the first result. Then look for a specific result, if specified.
- Result result = (Result) results.get(0);
- if (id != null) {
- for (Iterator i = results.iterator(); i.hasNext();) {
- Result r = (Result) i.next();
- if (id.equals(r.getID())) {
- result = r;
- break;
- }
- }
- throw new IllegalArgumentException("Result with ID " + id + " not in results list");
- }
-
- // Characterize.
- res.setContentType(result.getMimeType());
- if (!displayableByBrowser(result.getMimeType()))
- suggestFilename(result.getResourceID(), res);
- resultSize = result.getSize();
- if (resultSize <= Integer.MAX_VALUE)
- res.setContentLength((int) resultSize);
-
- // Deliver.
- BufferedInputStream productInputStream = null;
- try {
- productInputStream = new BufferedInputStream(result.getInputStream());
- byte[] buf = new byte[512];
- int numRead;
- while ((numRead = productInputStream.read(buf)) != -1)
- res.getOutputStream().write(buf, 0, numRead);
- productInputStream.close();
- found = true;
- } finally {
- if (productInputStream != null) try {
- productInputStream.close();
- } catch (IOException ignore) {}
- }
- }
-
- // Record the transaction for posterity (oh, and statistical analysis of our software, too).
- record(new Transaction(object, xmlQuery, startTime, found? 1 : 0, resultSize,
- System.currentTimeMillis() - startTime.getTime()));
- } catch (IllegalArgumentException ex) {
- System.err.println(host + ": illegal argument: " + ex.getMessage());
- res.sendError(HttpServletResponse.SC_BAD_REQUEST, ex.getMessage());
- } catch (ProductException ex) {
- System.err.println("Product exception: " + ex.getMessage());
- ex.printStackTrace();
- System.err.println(host + ": product exception: " + ex.getMessage());
- res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Query error: " + ex.getMessage());
- } catch (org.omg.CORBA.SystemException ex) {
- System.err.println("I hate CORBA: " + ex.getMessage());
- ex.printStackTrace();
- System.err.println(host + ": CORBA system exception: " + ex.getClass().getName() + ": " + ex.getMessage());
- res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "CORBA system exception \""
- + ex.getClass().getName() + "\" communicating with object \"" + object
- + "\" via name server \"" + ns + "\": " + ex);
- }
- }
-
- /**
- * Record the transaction for stastistical purposes.
- *
- * @param transaction a <code>Transaction</code> value.
- */
- private void record(Transaction transaction) {
- if (recorders.isEmpty()) return;
- new RecordingThread(transaction).start();
- }
-
- /**
- * Tell if the given MIME type is generally displayable by the majority of web browsers.
- *
- * @param mimeType a <code>String</code> value
- * @return True if the type named by <var>mimeType</var> is generally displayable
- */
- private boolean displayableByBrowser(String mimeType) {
- return displayableTypes.contains(mimeType);
- }
-
- /**
- * Add a header to suggest a filename to the browser.
- *
- * @param resourceID The name of the resource to suggest.
- * @param res The response in which to suggest the filename.
- */
- private void suggestFilename(String resourceID, HttpServletResponse res) {
- if (resourceID == null || resourceID.length() <= 0)
- resourceID = "product.dat";
- res.addHeader("Content-disposition", "attachment; filename=\"" + resourceID + "\"");
- }
-
- /** Set of MIME types ({@link String}s) generally displayable by browsers. */
- private Set displayableTypes;
-
- /** Preferred namespace prefixed to unqualified URNs. */
- private String preferredNamespace;
-
- /** List of statistical {@link Recorder}s. */
- private List recorders;
-
- /** Size of chunks to retrieve from product servers. */
- private static final int CHUNK_SIZE = Integer.getInteger("jpl.eda.servlets.ProductServlet.chunkSize", 32768).intValue();
-
- /**
- * Background thread to record statistics.
- */
- private class RecordingThread extends Thread {
- /**
- * Creates a new <code>RecordingThread</code> instance.
- *
- * @param transaction Transaction to record.
- */
- public RecordingThread(Transaction transaction) {
- super("Recording " + transaction);
- this.transaction = transaction;
- }
-
- public void run() {
- Recorder recorder = null;
- for (Iterator i = recorders.iterator(); i.hasNext();) try {
- recorder = (Recorder) i.next();
- recorder.record(transaction);
- } catch (StatsException ex) {
- System.err.println("Warning: " + recorder + " unable to record transaction " + transaction);
- }
- }
-
- /** Transaction to record. */
- private Transaction transaction;
- }
-}
+/*
+ * 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 jpl.eda.product;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import jpl.eda.Configuration;
+import jpl.eda.EDAException;
+import jpl.eda.util.SAXParser;
+import jpl.eda.util.XML;
+import jpl.eda.xmlquery.Result;
+import jpl.eda.xmlquery.XMLQuery;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+/** Servlet that returns products in response to OODT queries.
+ *
+ * This servlet takes a <code>keywordQuery</code> parameter which is the DIS-style keyword
+ * query string, and an <code>object</code> parameter which is the CORBA object name of
+ * the object to receive the query.
+ *
+ * <p>It also takes the following optional parameters:
+ * <ul>
+ * <li><code>ns</code>: name server to use, defaulting to the system nameserver in the
+ * <code>.edarc.xml</code> file.</li>
+ *
+ * <li><code>id</code>: product ID to return in the case of multiple products.</li>
+ *
+ * <li><code>mimeType</code>: desired MIME type of product. This can parameter may be
+ * specified multiple times to show an in-order preference for MIME types.</li>
+ * </ul>
+ *
+ * <p>It responds with a single product in the MIME type of the product.
+ *
+ * @author Kelly
+ */
+public class ProductServlet extends HttpServlet {
+ /** Default name server URL. */
+ private static String defaultNameServerURL;
+
+ /** Initialize by finding the default name server URL. */
+ static {
+ defaultNameServerURL = "corbaloc::localhost/" + jpl.eda.util.CORBAMgr.NS_OBJECT_KEY;
+ try {
+ Configuration configuration = Configuration.getConfiguration();
+ configuration.mergeProperties(System.getProperties());
+ defaultNameServerURL = configuration.getNameServerURL();
+ } catch (RuntimeException ex) {
+ throw ex;
+ } catch (Exception ex) {
+ System.err.println("Exception " + ex.getClass().getName() + " while reading configuration: "
+ + ex.getMessage());
+ }
+
+ }
+
+ /** Construct the product servlet.
+ */
+ public ProductServlet() {}
+
+ public void init(ServletConfig servletConfig) throws ServletException {
+ displayableTypes = new HashSet();
+ try {
+ SAXParser p = XML.createSAXParser();
+ p.setContentHandler(new ContentHandler() {
+ private StringBuffer token = new StringBuffer();
+ private String pi;
+ public void characters(char[] ch, int start, int length) {
+ token.append(ch, start, length);
+ }
+ public void endDocument() {}
+ public void endElement(String ns, String name, String qual) {
+ displayableTypes.add(token.toString().trim());
+ token.delete(0, token.length());
+ }
+ public void endPrefixMapping(String prefix) {}
+ public void ignorableWhitespace(char[] ch, int start, int length) {}
+ public void processingInstruction(String target, String data) {}
+ public void setDocumentLocator(Locator locator) {}
+ public void skippedEntity(String name) {}
+ public void startDocument() {}
+ public void startElement(String ns, String name, String qual, Attributes atts) {}
+ public void startPrefixMapping(String prefix, String uri) {}
+ });
+ p.parse(new InputSource(getClass().getResourceAsStream("displayableTypes.xml")));
+ } catch (SAXException ex) {
+ throw new ServletException(ex);
+ } catch (IOException ex) {
+ throw new ServletException(ex);
+ }
+
+ try {
+ jpl.eda.ExecServer.runInitializers();
+ } catch (EDAException ex) {
+ throw new ServletException(ex);
+ }
+
+ preferredNamespace = System.getProperty("jpl.eda.servlets.ProductServlet.preferredNamespace", "urn:eda:rmi:");
+
+ String recorderList = servletConfig.getInitParameter("recorders");
+ if (recorderList == null) recorderList = "";
+ recorders = new ArrayList();
+ for (Iterator i = jpl.eda.util.Utility.parseCommaList(recorderList); i.hasNext();) try {
+ String recorderClassName = (String) i.next();
+ Class recorderClass = Class.forName(recorderClassName);
+ Constructor ctor = recorderClass.getConstructor(new Class[]{ ServletConfig.class });
+ Recorder recorder = (Recorder) ctor.newInstance(new Object[]{ servletConfig });
+ recorders.add(recorder);
+ } catch (RuntimeException ex) {
+ throw ex;
+ } catch (Exception ex) {
+ throw new ServletException(ex);
+ }
+
+ super.init(servletConfig);
+ }
+
+ public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ doIt(req, res);
+ }
+ public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ doIt(req, res);
+ }
+
+ /** Process the request for the query parameters, query, and deliver a product.
+ *
+ * @param req Servlet request.
+ * @param res Servlet response.
+ * @throws ServletException If there's something wrong with the request or response.
+ * @throws IOException If there's an I/O error writing the image.
+ */
+ private void doIt(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ Date startTime = new Date();
+ String ns = null;
+ String object = null;
+ String host = req.getRemoteHost();
+ try {
+ object = req.getParameter("object");
+ if (object == null)
+ throw new IllegalArgumentException("required object parameter not specified");
+ if (!object.startsWith("urn:"))
+ object = preferredNamespace + object;
+ String keywordQuery = req.getParameter("keywordQuery");
+ if (keywordQuery == null)
+ throw new IllegalArgumentException("required keywordQuery parameter not specified");
+ String id = req.getParameter("id");
+ String[] mimeAccept = req.getParameterValues("mimeType");
+ if (mimeAccept == null) mimeAccept = new String[]{"*/*"};
+ List mimeAcceptList = Arrays.asList(mimeAccept);
+
+ // Construct the query from the parameters and send it in.
+ XMLQuery xmlQuery = new XMLQuery(keywordQuery, "queryServlet", "Query from QueryServlet",
+ "This query comes from the query servlet currently handling a client at "
+ + req.getRemoteHost(), /*ddID*/null, /*resultModeID*/null, /*propType*/null, /*propLevels*/null,
+ XMLQuery.DEFAULT_MAX_RESULTS, mimeAcceptList);
+ ProductClient pc = new ProductClient(object);
+ xmlQuery = pc.query(xmlQuery);
+
+ // Get the results of the query, if any.
+ List results = xmlQuery.getResults();
+ boolean found;
+ long resultSize = 0L;
+ if (results.isEmpty()) {
+ res.sendError(HttpServletResponse.SC_NOT_FOUND, "No matching results to query \"" + keywordQuery
+ + "\" for object \"" + object + "\"");
+ found = false;
+ } else {
+ // Default to the first result. Then look for a specific result, if specified.
+ Result result = (Result) results.get(0);
+ if (id != null) {
+ for (Iterator i = results.iterator(); i.hasNext();) {
+ Result r = (Result) i.next();
+ if (id.equals(r.getID())) {
+ result = r;
+ break;
+ }
+ }
+ throw new IllegalArgumentException("Result with ID " + id + " not in results list");
+ }
+
+ // Characterize.
+ res.setContentType(result.getMimeType());
+ if (!displayableByBrowser(result.getMimeType()))
+ suggestFilename(result.getResourceID(), res);
+ resultSize = result.getSize();
+ if (resultSize <= Integer.MAX_VALUE)
+ res.setContentLength((int) resultSize);
+
+ // Deliver.
+ BufferedInputStream productInputStream = null;
+ try {
+ productInputStream = new BufferedInputStream(result.getInputStream());
+ byte[] buf = new byte[512];
+ int numRead;
+ while ((numRead = productInputStream.read(buf)) != -1)
+ res.getOutputStream().write(buf, 0, numRead);
+ productInputStream.close();
+ found = true;
+ } finally {
+ if (productInputStream != null) try {
+ productInputStream.close();
+ } catch (IOException ignore) {}
+ }
+ }
+
+ // Record the transaction for posterity (oh, and statistical analysis of our software, too).
+ record(new Transaction(object, xmlQuery, startTime, found? 1 : 0, resultSize,
+ System.currentTimeMillis() - startTime.getTime()));
+ } catch (IllegalArgumentException ex) {
+ System.err.println(host + ": illegal argument: " + ex.getMessage());
+ res.sendError(HttpServletResponse.SC_BAD_REQUEST, ex.getMessage());
+ } catch (ProductException ex) {
+ System.err.println("Product exception: " + ex.getMessage());
+ ex.printStackTrace();
+ System.err.println(host + ": product exception: " + ex.getMessage());
+ res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Query error: " + ex.getMessage());
+ } catch (org.omg.CORBA.SystemException ex) {
+ System.err.println("I hate CORBA: " + ex.getMessage());
+ ex.printStackTrace();
+ System.err.println(host + ": CORBA system exception: " + ex.getClass().getName() + ": " + ex.getMessage());
+ res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "CORBA system exception \""
+ + ex.getClass().getName() + "\" communicating with object \"" + object
+ + "\" via name server \"" + ns + "\": " + ex);
+ }
+ }
+
+ /**
+ * Record the transaction for stastistical purposes.
+ *
+ * @param transaction a <code>Transaction</code> value.
+ */
+ private void record(Transaction transaction) {
+ if (recorders.isEmpty()) return;
+ new RecordingThread(transaction).start();
+ }
+
+ /**
+ * Tell if the given MIME type is generally displayable by the majority of web browsers.
+ *
+ * @param mimeType a <code>String</code> value
+ * @return True if the type named by <var>mimeType</var> is generally displayable
+ */
+ private boolean displayableByBrowser(String mimeType) {
+ return displayableTypes.contains(mimeType);
+ }
+
+ /**
+ * Add a header to suggest a filename to the browser.
+ *
+ * @param resourceID The name of the resource to suggest.
+ * @param res The response in which to suggest the filename.
+ */
+ private void suggestFilename(String resourceID, HttpServletResponse res) {
+ if (resourceID == null || resourceID.length() <= 0)
+ resourceID = "product.dat";
+ res.addHeader("Content-disposition", "attachment; filename=\"" + resourceID + "\"");
+ }
+
+ /** Set of MIME types ({@link String}s) generally displayable by browsers. */
+ private Set displayableTypes;
+
+ /** Preferred namespace prefixed to unqualified URNs. */
+ private String preferredNamespace;
+
+ /** List of statistical {@link Recorder}s. */
+ private List recorders;
+
+ /** Size of chunks to retrieve from product servers. */
+ private static final int CHUNK_SIZE = Integer.getInteger("jpl.eda.servlets.ProductServlet.chunkSize", 32768).intValue();
+
+ /**
+ * Background thread to record statistics.
+ */
+ private class RecordingThread extends Thread {
+ /**
+ * Creates a new <code>RecordingThread</code> instance.
+ *
+ * @param transaction Transaction to record.
+ */
+ public RecordingThread(Transaction transaction) {
+ super("Recording " + transaction);
+ this.transaction = transaction;
+ }
+
+ public void run() {
+ Recorder recorder = null;
+ for (Iterator i = recorders.iterator(); i.hasNext();) try {
+ recorder = (Recorder) i.next();
+ recorder.record(transaction);
+ } catch (StatsException ex) {
+ System.err.println("Warning: " + recorder + " unable to record transaction " + transaction);
+ }
+ }
+
+ /** Transaction to record. */
+ private Transaction transaction;
+ }
+}
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/QueryHandler.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/QueryHandler.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/QueryHandler.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/QueryHandler.java Wed Jun 9 19:11:21 2010
@@ -1,7 +1,20 @@
-// Copyright 2002 California Institute of Technology. ALL RIGHTS RESERVED.
-// U.S. Government Sponsorship acknowledged.
-//
-// $Id: QueryHandler.java,v 1.1.1.1 2004-03-02 19:45:40 kelly Exp $
+/*
+ * 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 jpl.eda.product;
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/Recorder.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/Recorder.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/Recorder.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/Recorder.java Wed Jun 9 19:11:21 2010
@@ -1,26 +1,39 @@
-// Copyright 2002 California Institute of Technology. ALL RIGHTS RESERVED.
-// U.S. Government Sponsorship acknowledged.
-//
-// $Id: Recorder.java,v 1.1 2004-04-26 17:58:44 kelly Exp $
-
-package jpl.eda.product;
-
-/**
- * Recorder of statistics.
- *
- * A recorder is a class implementing this interface and, in addition, providing a one
- * argument constructor that takes a {@link javax.servlet.ServletConfig} object and may
- * throw a {@link javax.servlet.ServletException}.
- *
- * @author Kelly
- * @version $Revision: 1.1 $
- */
-public interface Recorder {
- /**
- * Record the given transaction.
- *
- * @param transaction a <code>Transaction</code> value.
- * @throws StatsException if an error occurs.
- */
- void record(Transaction transaction) throws StatsException;
-}
+/*
+ * 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 jpl.eda.product;
+
+/**
+ * Recorder of statistics.
+ *
+ * A recorder is a class implementing this interface and, in addition, providing a one
+ * argument constructor that takes a {@link javax.servlet.ServletConfig} object and may
+ * throw a {@link javax.servlet.ServletException}.
+ *
+ * @author Kelly
+ * @version $Revision: 1.1 $
+ */
+public interface Recorder {
+ /**
+ * Record the given transaction.
+ *
+ * @param transaction a <code>Transaction</code> value.
+ * @throws StatsException if an error occurs.
+ */
+ void record(Transaction transaction) throws StatsException;
+}
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/Server.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/Server.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/Server.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/Server.java Wed Jun 9 19:11:21 2010
@@ -1,7 +1,20 @@
-// Copyright 2002 California Institute of Technology. ALL RIGHTS RESERVED.
-// U.S. Government Sponsorship acknowledged.
-//
-// $Id: Server.java,v 1.3 2005-06-22 21:51:40 kelly Exp $
+/*
+ * 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 jpl.eda.product;
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/StatsException.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/StatsException.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/StatsException.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/StatsException.java Wed Jun 9 19:11:21 2010
@@ -1,42 +1,55 @@
-// Copyright 2002 California Institute of Technology. ALL RIGHTS RESERVED.
-// U.S. Government Sponsorship acknowledged.
-//
-// $Id: StatsException.java,v 1.1 2004-04-26 17:58:44 kelly Exp $
-
-package jpl.eda.product;
-
-/**
- * Statistics exception.
- *
- * @author Kelly
- * @version $Revision: 1.1 $
- */
-public class StatsException extends Exception {
- /**
- * Creates a new <code>StatsException</code> instance.
- *
- * @param msg Detail message
- */
- public StatsException(String msg) {
- super(msg);
- }
-
- /**
- * Creates a new <code>StatsException</code> instance.
- *
- * @param cause Chained exception.
- */
- public StatsException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Creates a new <code>StatsException</code> instance.
- *
- * @param msg Detail message
- * @param cause Chained exception
- */
- public StatsException(String msg, Throwable cause) {
- super(msg, cause);
- }
-}
+/*
+ * 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 jpl.eda.product;
+
+/**
+ * Statistics exception.
+ *
+ * @author Kelly
+ * @version $Revision: 1.1 $
+ */
+public class StatsException extends Exception {
+ /**
+ * Creates a new <code>StatsException</code> instance.
+ *
+ * @param msg Detail message
+ */
+ public StatsException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Creates a new <code>StatsException</code> instance.
+ *
+ * @param cause Chained exception.
+ */
+ public StatsException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Creates a new <code>StatsException</code> instance.
+ *
+ * @param msg Detail message
+ * @param cause Chained exception
+ */
+ public StatsException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+}
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/Transaction.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/Transaction.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/Transaction.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/Transaction.java Wed Jun 9 19:11:21 2010
@@ -1,113 +1,126 @@
-// Copyright 2002 California Institute of Technology. ALL RIGHTS RESERVED.
-// U.S. Government Sponsorship acknowledged.
-//
-// $Id: Transaction.java,v 1.1 2004-04-26 17:58:44 kelly Exp $
-
-package jpl.eda.product;
-
-import java.util.Date;
-import jpl.eda.xmlquery.XMLQuery;
-
-/**
- * A transaction with the product servlet.
- *
- * @author Kelly
- * @version $Revision: 1.1 $
- */
-public class Transaction {
- /**
- * Creates a new <code>Transaction</code> instance.
- *
- * @param serverID Identifies the server that received the query
- * @param query The query passed in
- * @param started When the query was started
- * @param numMatches How many products matched
- * @param numBytes How many bytes returned
- * @param timeToComplete How long it took in milliseconds
- */
- public Transaction(String serverID, XMLQuery query, Date started, int numMatches, long numBytes, long timeToComplete) {
- this.serverID = serverID;
- this.query = query;
- this.started = started;
- this.numMatches = numMatches;
- this.numBytes = numBytes;
- this.timeToComplete = timeToComplete;
- }
-
- public String toString() {
- return "Transaction[serverID=" + serverID + ",query=" + query.getKwdQueryString() + ",started=" + started
- + ",numMatches=" + numMatches + ",numBytes=" + numBytes + ",ttc=" + timeToComplete + "]";
- }
-
- /**
- * Get the ID of the server to which the query.
- *
- * @return a <code>String</code> value.
- */
- public String getServerID() {
- return serverID;
- }
-
- /**
- * Get the query passed to the server.
- *
- * @return a <code>XMLQuery</code> value.
- */
- public XMLQuery getQuery() {
- return query;
- }
-
- /**
- * Get the time the query was started.
- *
- * @return a <code>Date</code> value.
- */
- public Date getStartTime() {
- return started;
- }
-
- /**
- * Get the number of products that matched.
- *
- * @return an <code>int</code> value.
- */
- public int getNumMatches() {
- return numMatches;
- }
-
- /**
- * Get the number of bytes of product returned to the client.
- *
- * @return a <code>long</code> value.
- */
- public long getNumBytes() {
- return numBytes;
- }
-
- /**
- * Get how long it took (in milliseconds) to perform the complete transaction.
- *
- * @return a <code>long</code> value.
- */
- public long getTimeToComplete() {
- return timeToComplete;
- }
-
- /** ID of server that received the query. */
- private String serverID;
-
- /** Query passed to the server. */
- private XMLQuery query;
-
- /** When the transaction started. */
- private Date started;
-
- /** Number of matching products. */
- private int numMatches;
-
- /** Number of bytes returned to querier. */
- private long numBytes;
-
- /** How long it took, in milliseconds. */
- private long timeToComplete;
-}
+/*
+ * 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 jpl.eda.product;
+
+import java.util.Date;
+import jpl.eda.xmlquery.XMLQuery;
+
+/**
+ * A transaction with the product servlet.
+ *
+ * @author Kelly
+ * @version $Revision: 1.1 $
+ */
+public class Transaction {
+ /**
+ * Creates a new <code>Transaction</code> instance.
+ *
+ * @param serverID Identifies the server that received the query
+ * @param query The query passed in
+ * @param started When the query was started
+ * @param numMatches How many products matched
+ * @param numBytes How many bytes returned
+ * @param timeToComplete How long it took in milliseconds
+ */
+ public Transaction(String serverID, XMLQuery query, Date started, int numMatches, long numBytes, long timeToComplete) {
+ this.serverID = serverID;
+ this.query = query;
+ this.started = started;
+ this.numMatches = numMatches;
+ this.numBytes = numBytes;
+ this.timeToComplete = timeToComplete;
+ }
+
+ public String toString() {
+ return "Transaction[serverID=" + serverID + ",query=" + query.getKwdQueryString() + ",started=" + started
+ + ",numMatches=" + numMatches + ",numBytes=" + numBytes + ",ttc=" + timeToComplete + "]";
+ }
+
+ /**
+ * Get the ID of the server to which the query.
+ *
+ * @return a <code>String</code> value.
+ */
+ public String getServerID() {
+ return serverID;
+ }
+
+ /**
+ * Get the query passed to the server.
+ *
+ * @return a <code>XMLQuery</code> value.
+ */
+ public XMLQuery getQuery() {
+ return query;
+ }
+
+ /**
+ * Get the time the query was started.
+ *
+ * @return a <code>Date</code> value.
+ */
+ public Date getStartTime() {
+ return started;
+ }
+
+ /**
+ * Get the number of products that matched.
+ *
+ * @return an <code>int</code> value.
+ */
+ public int getNumMatches() {
+ return numMatches;
+ }
+
+ /**
+ * Get the number of bytes of product returned to the client.
+ *
+ * @return a <code>long</code> value.
+ */
+ public long getNumBytes() {
+ return numBytes;
+ }
+
+ /**
+ * Get how long it took (in milliseconds) to perform the complete transaction.
+ *
+ * @return a <code>long</code> value.
+ */
+ public long getTimeToComplete() {
+ return timeToComplete;
+ }
+
+ /** ID of server that received the query. */
+ private String serverID;
+
+ /** Query passed to the server. */
+ private XMLQuery query;
+
+ /** When the transaction started. */
+ private Date started;
+
+ /** Number of matching products. */
+ private int numMatches;
+
+ /** Number of bytes returned to querier. */
+ private long numBytes;
+
+ /** How long it took, in milliseconds. */
+ private long timeToComplete;
+}
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/Utility.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/Utility.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/Utility.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/Utility.java Wed Jun 9 19:11:21 2010
@@ -1,7 +1,20 @@
-// Copyright 2002 California Institute of Technology. ALL RIGHTS RESERVED.
-// U.S. Government Sponsorship acknowledged.
-//
-// $Id: Utility.java,v 1.2 2004-04-05 15:01:22 kelly Exp $
+/*
+ * 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 jpl.eda.product;
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/corba/ProductServiceAdaptor.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/corba/ProductServiceAdaptor.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/corba/ProductServiceAdaptor.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/corba/ProductServiceAdaptor.java Wed Jun 9 19:11:21 2010
@@ -1,7 +1,20 @@
-// Copyright 2002 California Institute of Technology. ALL RIGHTS RESERVED.
-// U.S. Government Sponsorship acknowledged.
-//
-// $Id: ProductServiceAdaptor.java,v 1.1.1.1 2004-03-02 19:45:40 kelly Exp $
+/*
+ * 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 jpl.eda.product.corba;
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/corba/ProductServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/corba/ProductServiceImpl.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/corba/ProductServiceImpl.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/corba/ProductServiceImpl.java Wed Jun 9 19:11:21 2010
@@ -1,7 +1,20 @@
-// Copyright 1999-2002 California Institute of Technology. ALL RIGHTS RESERVED.
-// U.S. Government Sponsorship acknowledged.
-//
-// $Id: ProductServiceImpl.java,v 1.3 2004-07-30 22:31:05 kelly Exp $
+/*
+ * 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 jpl.eda.product.corba;
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/corba/ServerImpl.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/corba/ServerImpl.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/corba/ServerImpl.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/corba/ServerImpl.java Wed Jun 9 19:11:21 2010
@@ -1,7 +1,20 @@
-// Copyright 1999-2002 California Institute of Technology. ALL RIGHTS RESERVED.
-// U.S. Government Sponsorship acknowledged.
-//
-// $Id: ServerImpl.java,v 1.1.1.1 2004-03-02 19:45:41 kelly Exp $
+/*
+ * 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 jpl.eda.product.corba;
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/rmi/AuthorizedProductServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/rmi/AuthorizedProductServiceImpl.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/rmi/AuthorizedProductServiceImpl.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/rmi/AuthorizedProductServiceImpl.java Wed Jun 9 19:11:21 2010
@@ -1,64 +1,77 @@
-// Copyright 1999-2004 California Institute of Technology. ALL RIGHTS
-// RESERVED. U.S. Government Sponsorship acknowledged.
-//
-// $Id: AuthorizedProductServiceImpl.java,v 1.1 2004-08-13 21:33:55 kelly Exp $
-
-package jpl.eda.product.rmi;
-
-import java.rmi.RemoteException;
-import java.util.List;
-import jpl.eda.ExecServer;
-import jpl.eda.security.rmi.SecureServiceImpl;
-import jpl.eda.security.rmi.Session;
-
-/**
- * Product service that requires authorization.
- *
- * @author Kelly
- * @version $Revision: 1.1 $
- */
-public class AuthorizedProductServiceImpl extends SecureServiceImpl {
- /**
- * Creates a new {@link AuthorizedProductServiceImpl} instance.
- *
- * @throws RemoteException if an error occurs.
- */
- public AuthorizedProductServiceImpl() throws RemoteException {
- this(/*execServer*/null);
- }
-
- /**
- * Creates a new {@link AuthorizedProductServiceImpl} instance.
- *
- * @param server Server executive.
- * @throws RemoteException if an error occurs.
- */
- public AuthorizedProductServiceImpl(ExecServer server) throws RemoteException {
- super(System.getProperty("login.context.name", "oodt"),
- jpl.eda.product.Utility.getRMIPort("AuthorizedProductServiceImpl"));
- this.server = server;
- name = server != null? server.getName() : getClass().getName();
- handlers = jpl.eda.product.Utility.loadHandlers(name);
- }
-
- /**
- * Create a session for an authorized subject.
- *
- * @return a {@link Session} value.
- * @throws RemoteException if an error occurs.
- */
- protected Session createSessionServer() throws RemoteException {
- Integer portNum = Integer.getInteger(name + ".port", Integer.getInteger("port", 7576));
- AuthorizedSessionImpl session = new AuthorizedSessionImpl(portNum.intValue(), handlers);
- return session;
- }
-
- /** Server executive. */
- private ExecServer server;
-
- /** List of query handlers. */
- private List handlers;
-
- /** Object name. */
- private String name;
-}
+/*
+ * 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 jpl.eda.product.rmi;
+
+import java.rmi.RemoteException;
+import java.util.List;
+import jpl.eda.ExecServer;
+import jpl.eda.security.rmi.SecureServiceImpl;
+import jpl.eda.security.rmi.Session;
+
+/**
+ * Product service that requires authorization.
+ *
+ * @author Kelly
+ * @version $Revision: 1.1 $
+ */
+public class AuthorizedProductServiceImpl extends SecureServiceImpl {
+ /**
+ * Creates a new {@link AuthorizedProductServiceImpl} instance.
+ *
+ * @throws RemoteException if an error occurs.
+ */
+ public AuthorizedProductServiceImpl() throws RemoteException {
+ this(/*execServer*/null);
+ }
+
+ /**
+ * Creates a new {@link AuthorizedProductServiceImpl} instance.
+ *
+ * @param server Server executive.
+ * @throws RemoteException if an error occurs.
+ */
+ public AuthorizedProductServiceImpl(ExecServer server) throws RemoteException {
+ super(System.getProperty("login.context.name", "oodt"),
+ jpl.eda.product.Utility.getRMIPort("AuthorizedProductServiceImpl"));
+ this.server = server;
+ name = server != null? server.getName() : getClass().getName();
+ handlers = jpl.eda.product.Utility.loadHandlers(name);
+ }
+
+ /**
+ * Create a session for an authorized subject.
+ *
+ * @return a {@link Session} value.
+ * @throws RemoteException if an error occurs.
+ */
+ protected Session createSessionServer() throws RemoteException {
+ Integer portNum = Integer.getInteger(name + ".port", Integer.getInteger("port", 7576));
+ AuthorizedSessionImpl session = new AuthorizedSessionImpl(portNum.intValue(), handlers);
+ return session;
+ }
+
+ /** Server executive. */
+ private ExecServer server;
+
+ /** List of query handlers. */
+ private List handlers;
+
+ /** Object name. */
+ private String name;
+}
Modified: incubator/oodt/trunk/product/src/main/java/jpl/eda/product/rmi/AuthorizedSession.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/product/src/main/java/jpl/eda/product/rmi/AuthorizedSession.java?rev=953117&r1=953116&r2=953117&view=diff
==============================================================================
--- incubator/oodt/trunk/product/src/main/java/jpl/eda/product/rmi/AuthorizedSession.java (original)
+++ incubator/oodt/trunk/product/src/main/java/jpl/eda/product/rmi/AuthorizedSession.java Wed Jun 9 19:11:21 2010
@@ -1,53 +1,66 @@
-// Copyright 1999-2004 California Institute of Technology. ALL RIGHTS
-// RESERVED. U.S. Government Sponsorship acknowledged.
-//
-// $Id: AuthorizedSession.java,v 1.2 2005-02-24 21:34:56 kelly Exp $
-
-package jpl.eda.product.rmi;
-
-import java.rmi.RemoteException;
-import jpl.eda.product.ProductException;
-import jpl.eda.security.rmi.Session;
-import jpl.eda.xmlquery.XMLQuery;
-
-/**
- * An authorized session with a product server.
- *
- * @author Kelly
- * @version $Revision: 1.2 $
- */
-public interface AuthorizedSession extends Session {
- /**
- * Run a query.
- *
- * @param seq Secure sequence number.
- * @param q The query.
- * @return The response.
- * @throws ProductException if an error occurs.
- * @throws RemoteException if an error occurs.
- */
- XMLQuery query(int seq, XMLQuery q) throws ProductException, RemoteException;
-
- /**
- * Retrieve a chunk of a large product.
- *
- * @param seq Secure sequence number.
- * @param productID Product ID.
- * @param offset Where in the product to get the data.
- * @param length How much data to get.
- * @return The data.
- * @throws ProductException if an error occurs.
- * @throws RemoteException if an error occurs.
- */
- byte[] retrieveChunk(int seq, String productID, long offset, int length) throws ProductException, RemoteException;
-
- /**
- * Close off a large product.
- *
- * @param seq Secure sequence number.
- * @param productID Product ID.
- * @throws ProductException if an error occurs.
- * @throws RemoteException if an error occurs.
- */
- void close(int seq, String productID) throws ProductException, RemoteException;
-}
+/*
+ * 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 jpl.eda.product.rmi;
+
+import java.rmi.RemoteException;
+import jpl.eda.product.ProductException;
+import jpl.eda.security.rmi.Session;
+import jpl.eda.xmlquery.XMLQuery;
+
+/**
+ * An authorized session with a product server.
+ *
+ * @author Kelly
+ * @version $Revision: 1.2 $
+ */
+public interface AuthorizedSession extends Session {
+ /**
+ * Run a query.
+ *
+ * @param seq Secure sequence number.
+ * @param q The query.
+ * @return The response.
+ * @throws ProductException if an error occurs.
+ * @throws RemoteException if an error occurs.
+ */
+ XMLQuery query(int seq, XMLQuery q) throws ProductException, RemoteException;
+
+ /**
+ * Retrieve a chunk of a large product.
+ *
+ * @param seq Secure sequence number.
+ * @param productID Product ID.
+ * @param offset Where in the product to get the data.
+ * @param length How much data to get.
+ * @return The data.
+ * @throws ProductException if an error occurs.
+ * @throws RemoteException if an error occurs.
+ */
+ byte[] retrieveChunk(int seq, String productID, long offset, int length) throws ProductException, RemoteException;
+
+ /**
+ * Close off a large product.
+ *
+ * @param seq Secure sequence number.
+ * @param productID Product ID.
+ * @throws ProductException if an error occurs.
+ * @throws RemoteException if an error occurs.
+ */
+ void close(int seq, String productID) throws ProductException, RemoteException;
+}